<refentry id="xmlsec-nodeset">
<refmeta>
<refentrytitle>nodeset.h</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>XMLSEC Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>nodeset.h</refname><refpurpose>The enchanced nodes set imlmentation.</refpurpose>
</refnamediv>

<refsynopsisdiv><title>Synopsis</title>
<synopsis>



enum        <link linkend="xmlSecNodeSetType">xmlSecNodeSetType</link>;
enum        <link linkend="xmlSecNodeSetOp">xmlSecNodeSetOp</link>;
struct      <link linkend="xmlSecNodeSet">xmlSecNodeSet</link>;
int         (<link linkend="xmlSecNodeSetWalkCallback">*xmlSecNodeSetWalkCallback</link>)    (<link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> nset,
                                             <link linkend="xmlNodePtr">xmlNodePtr</link> cur,
                                             <link linkend="xmlNodePtr">xmlNodePtr</link> parent,
                                             void *data);
<link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> <link linkend="xmlSecNodeSetCreate">xmlSecNodeSetCreate</link>        (<link linkend="xmlDocPtr">xmlDocPtr</link> doc,
                                             <link linkend="xmlNodeSetPtr">xmlNodeSetPtr</link> nodes,
                                             <link linkend="xmlSecNodeSetType">xmlSecNodeSetType</link> type);
void        <link linkend="xmlSecNodeSetDestroy">xmlSecNodeSetDestroy</link>            (<link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> nset);
int         <link linkend="xmlSecNodeSetContains">xmlSecNodeSetContains</link>           (<link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> nset,
                                             <link linkend="xmlNodePtr">xmlNodePtr</link> node,
                                             <link linkend="xmlNodePtr">xmlNodePtr</link> parent);
<link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> <link linkend="xmlSecNodeSetAdd">xmlSecNodeSetAdd</link>           (<link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> nset,
                                             <link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> newNSet,
                                             <link linkend="xmlSecNodeSetOp">xmlSecNodeSetOp</link> op);
<link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> <link linkend="xmlSecNodeSetAddList">xmlSecNodeSetAddList</link>       (<link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> nset,
                                             <link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> newNSet,
                                             <link linkend="xmlSecNodeSetOp">xmlSecNodeSetOp</link> op);
<link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> <link linkend="xmlSecNodeSetGetChildren">xmlSecNodeSetGetChildren</link>   (<link linkend="xmlDocPtr">xmlDocPtr</link> doc,
                                             const <link linkend="xmlNodePtr">xmlNodePtr</link> parent,
                                             int withComments,
                                             int invert);
int         <link linkend="xmlSecNodeSetWalk">xmlSecNodeSetWalk</link>               (<link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> nset,
                                             <link linkend="xmlSecNodeSetWalkCallback">xmlSecNodeSetWalkCallback</link> walkFunc,
                                             void *data);
void        <link linkend="xmlSecNodeSetDebugDump">xmlSecNodeSetDebugDump</link>          (<link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> nset,
                                             <link linkend="FILE-CAPS">FILE</link> *output);
</synopsis>
</refsynopsisdiv>





<refsect1>
<title>Description</title>
<para>

</para>
</refsect1>

<refsect1>
<title>Details</title>
<refsect2>
<title><anchor id="xmlSecNodeSetType">enum xmlSecNodeSetType</title>
<programlisting>typedef enum {
    xmlSecNodeSetNormal = 0,
    xmlSecNodeSetInvert,
    xmlSecNodeSetTree,
    xmlSecNodeSetTreeWithoutComments, 
    xmlSecNodeSetTreeInvert,
    xmlSecNodeSetTreeWithoutCommentsInvert,
    xmlSecNodeSetList
} xmlSecNodeSetType;
</programlisting>
<para>
The simple nodes sets types.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="enum">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row>
<entry><literal>xmlSecNodeSetNormal</literal></entry>
<entry> nodes set = nodes in the list.
</entry>
</row>
<row>
<entry><literal>xmlSecNodeSetInvert</literal></entry>
<entry>  nodes set = all document nodes minus nodes in the list.
</entry>
</row>
<row>
<entry><literal>xmlSecNodeSetTree</literal></entry>
<entry> nodes set = nodes in the list and all their subtress.
</entry>
</row>
<row>
<entry><literal>xmlSecNodeSetTreeWithoutComments</literal></entry>
<entry> nodes set = nodes in the list and 
all their subtress but no comment nodes.
</entry>
</row>
<row>
<entry><literal>xmlSecNodeSetTreeInvert</literal></entry>
<entry> nodes set = all document nodes minus nodes in the 
	list and all their subtress.
</entry>
</row>
<row>
<entry><literal>xmlSecNodeSetTreeWithoutCommentsInvert</literal></entry>
<entry> nodes set = all document nodes 
	minus (nodes in the list and all their subtress plus all comment nodes).
</entry>
</row>
<row>
<entry><literal>xmlSecNodeSetList</literal></entry>
<entry> nodes set = all nodes in the chidren list of nodes sets.
</entry>
</row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="xmlSecNodeSetOp">enum xmlSecNodeSetOp</title>
<programlisting>typedef enum {
    xmlSecNodeSetIntersection = 0,
    xmlSecNodeSetSubtraction,
    xmlSecNodeSetUnion
} xmlSecNodeSetOp;
</programlisting>
<para>
The simple nodes sets operations.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="enum">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row>
<entry><literal>xmlSecNodeSetIntersection</literal></entry>
<entry> intersection.
</entry>
</row>
<row>
<entry><literal>xmlSecNodeSetSubtraction</literal></entry>
<entry> subtraction.
</entry>
</row>
<row>
<entry><literal>xmlSecNodeSetUnion</literal></entry>
<entry> union.
</entry>
</row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="xmlSecNodeSet">struct xmlSecNodeSet</title>
<programlisting>struct xmlSecNodeSet {
    xmlNodeSetPtr	nodes;
    xmlDocPtr		doc;
    xmlSecNodeSetType	type;
    xmlSecNodeSetOp	op;
    xmlSecNodeSetPtr	next;
    xmlSecNodeSetPtr	prev;
    xmlSecNodeSetPtr	children;
};
</programlisting>
<para>
The enchanced nodes set.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="struct">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row>
<entry><link linkend="xmlNodeSetPtr">xmlNodeSetPtr</link> <structfield>nodes</structfield></entry>
<entry> the nodes list.
</entry>
</row>
<row>
<entry><link linkend="xmlDocPtr">xmlDocPtr</link> <structfield>doc</structfield></entry>
<entry> the parent XML document.
</entry>
</row>
<row>
<entry><link linkend="xmlSecNodeSetType">xmlSecNodeSetType</link> <structfield>type</structfield></entry>
<entry> the nodes set type.
</entry>
</row>
<row>
<entry><link linkend="xmlSecNodeSetOp">xmlSecNodeSetOp</link> <structfield>op</structfield></entry>
<entry> the operation type.
</entry>
</row>
<row>
<entry><link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> <structfield>next</structfield></entry>
<entry> the next nodes set.
</entry>
</row>
<row>
<entry><link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> <structfield>prev</structfield></entry>
<entry> the previous nodes set.
</entry>
</row>
<row>
<entry><link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> <structfield>children</structfield></entry>
<entry> the children list (valid only if type equal to <link linkend="xmlSecNodeSetList">xmlSecNodeSetList</link>).
</entry>
</row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="xmlSecNodeSetWalkCallback">xmlSecNodeSetWalkCallback ()</title>
<programlisting>int         (*xmlSecNodeSetWalkCallback)    (<link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> nset,
                                             <link linkend="xmlNodePtr">xmlNodePtr</link> cur,
                                             <link linkend="xmlNodePtr">xmlNodePtr</link> parent,
                                             void *data);</programlisting>
<para>
The callback function called once per each node in the nodes set.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>nset</parameter>&nbsp;:</entry>
<entry> the pointer to <link linkend="xmlSecNodeSet">xmlSecNodeSet</link> structure.
</entry></row>
<row><entry align="right"><parameter>cur</parameter>&nbsp;:</entry>
<entry> the pointer current XML node.
</entry></row>
<row><entry align="right"><parameter>parent</parameter>&nbsp;:</entry>
<entry> the pointer to the <parameter>cur</parameter> parent node.
</entry></row>
<row><entry align="right"><parameter>data</parameter>&nbsp;:</entry>
<entry> the pointer to application specific data.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>0 on success or a negative value if an error occurs
an walk procedure should be interrupted.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="xmlSecNodeSetCreate">xmlSecNodeSetCreate ()</title>
<programlisting><link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> xmlSecNodeSetCreate        (<link linkend="xmlDocPtr">xmlDocPtr</link> doc,
                                             <link linkend="xmlNodeSetPtr">xmlNodeSetPtr</link> nodes,
                                             <link linkend="xmlSecNodeSetType">xmlSecNodeSetType</link> type);</programlisting>
<para>
Creates new nodes set.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>doc</parameter>&nbsp;:</entry>
<entry> the pointer to parent XML document.
</entry></row>
<row><entry align="right"><parameter>nodes</parameter>&nbsp;:</entry>
<entry> the list of nodes.
</entry></row>
<row><entry align="right"><parameter>type</parameter>&nbsp;:</entry>
<entry> the nodes set type.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>pointer to newly allocated <link linkend="xmlSecNodeSet">xmlSecNodeSet</link> structure 
or NULL if an error occurs.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="xmlSecNodeSetDestroy">xmlSecNodeSetDestroy ()</title>
<programlisting>void        xmlSecNodeSetDestroy            (<link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> nset);</programlisting>
<para>
Destroys the nodes set.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>nset</parameter>&nbsp;:</entry>
<entry> the pointer to <link linkend="xmlSecNodeSet">xmlSecNodeSet</link> structure.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="xmlSecNodeSetContains">xmlSecNodeSetContains ()</title>
<programlisting>int         xmlSecNodeSetContains           (<link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> nset,
                                             <link linkend="xmlNodePtr">xmlNodePtr</link> node,
                                             <link linkend="xmlNodePtr">xmlNodePtr</link> parent);</programlisting>
<para>
Checks whether the <parameter>node</parameter> is in the nodes set or not.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>nset</parameter>&nbsp;:</entry>
<entry> the pointer to <link linkend="xmlSecNodeSet">xmlSecNodeSet</link> structure.
</entry></row>
<row><entry align="right"><parameter>node</parameter>&nbsp;:</entry>
<entry> the pointer to XML node to check.
</entry></row>
<row><entry align="right"><parameter>parent</parameter>&nbsp;:</entry>
<entry> the pointer to <parameter>node</parameter> parent node.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>1 if the <parameter>node</parameter> is in the nodes set <parameter>nset</parameter>, 0 if it is not
and a negative value if an error occurs.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="xmlSecNodeSetAdd">xmlSecNodeSetAdd ()</title>
<programlisting><link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> xmlSecNodeSetAdd           (<link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> nset,
                                             <link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> newNSet,
                                             <link linkend="xmlSecNodeSetOp">xmlSecNodeSetOp</link> op);</programlisting>
<para>
Adds <parameter>newNSet</parameter> to the <parameter>nset</parameter> using operation <parameter>op</parameter>.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>nset</parameter>&nbsp;:</entry>
<entry> the pointer to currrent nodes set (or NULL).
</entry></row>
<row><entry align="right"><parameter>newNSet</parameter>&nbsp;:</entry>
<entry> the pointer to new nodes set.
</entry></row>
<row><entry align="right"><parameter>op</parameter>&nbsp;:</entry>
<entry> the operation type.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the pointer to combined nodes set or NULL if an error 
occurs.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="xmlSecNodeSetAddList">xmlSecNodeSetAddList ()</title>
<programlisting><link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> xmlSecNodeSetAddList       (<link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> nset,
                                             <link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> newNSet,
                                             <link linkend="xmlSecNodeSetOp">xmlSecNodeSetOp</link> op);</programlisting>
<para>
Adds <parameter>newNSet</parameter> to the <parameter>nset</parameter> as child using operation <parameter>op</parameter>.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>nset</parameter>&nbsp;:</entry>
<entry> the pointer to currrent nodes set (or NULL).
</entry></row>
<row><entry align="right"><parameter>newNSet</parameter>&nbsp;:</entry>
<entry> the pointer to new nodes set.
</entry></row>
<row><entry align="right"><parameter>op</parameter>&nbsp;:</entry>
<entry> the operation type.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the pointer to combined nodes set or NULL if an error 
occurs.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="xmlSecNodeSetGetChildren">xmlSecNodeSetGetChildren ()</title>
<programlisting><link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> xmlSecNodeSetGetChildren   (<link linkend="xmlDocPtr">xmlDocPtr</link> doc,
                                             const <link linkend="xmlNodePtr">xmlNodePtr</link> parent,
                                             int withComments,
                                             int invert);</programlisting>
<para>
Creates a new nodes set that contains:
 - if <parameter>withComments</parameter> is not 0 and <parameter>invert</parameter> is 0:
   all nodes in the <parameter>parent</parameter> subtree;
 - if <parameter>withComments</parameter> is 0 and <parameter>invert</parameter> is 0:
   all nodes in the <parameter>parent</parameter> subtree except comment nodes;
 - if <parameter>withComments</parameter> is not 0 and <parameter>invert</parameter> not is 0:
   all nodes in the <parameter>doc</parameter> except nodes in the <parameter>parent</parameter> subtree;
 - if <parameter>withComments</parameter> is 0 and <parameter>invert</parameter> is 0:
   all nodes in the <parameter>doc</parameter> except nodes in the <parameter>parent</parameter> subtree 
   and comment nodes.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>doc</parameter>&nbsp;:</entry>
<entry> the pointer to an XML document.
</entry></row>
<row><entry align="right"><parameter>parent</parameter>&nbsp;:</entry>
<entry> the pointer to parent XML node.
</entry></row>
<row><entry align="right"><parameter>withComments</parameter>&nbsp;:</entry>
<entry> the flag include  comments or not.
</entry></row>
<row><entry align="right"><parameter>invert</parameter>&nbsp;:</entry>
<entry> the "invert" flag.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>pointer to the newly created <link linkend="xmlSecNodeSet">xmlSecNodeSet</link> structure
or NULL if an error occurs.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="xmlSecNodeSetWalk">xmlSecNodeSetWalk ()</title>
<programlisting>int         xmlSecNodeSetWalk               (<link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> nset,
                                             <link linkend="xmlSecNodeSetWalkCallback">xmlSecNodeSetWalkCallback</link> walkFunc,
                                             void *data);</programlisting>
<para>
Calls the function <parameter>walkFunc</parameter> once per each node in the nodes set <parameter>nset</parameter>.
If the <parameter>walkFunc</parameter> returns a negative value, then the walk procedure 
is interrupted.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>nset</parameter>&nbsp;:</entry>
<entry> the pointer to <link linkend="xmlSecNodeSet">xmlSecNodeSet</link> structure.
</entry></row>
<row><entry align="right"><parameter>walkFunc</parameter>&nbsp;:</entry>
<entry> the callback functions.
</entry></row>
<row><entry align="right"><parameter>data</parameter>&nbsp;:</entry>
<entry> the application specific data passed to the <parameter>walkFunc</parameter>.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>0 on success or a negative value if an error occurs.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="xmlSecNodeSetDebugDump">xmlSecNodeSetDebugDump ()</title>
<programlisting>void        xmlSecNodeSetDebugDump          (<link linkend="xmlSecNodeSetPtr">xmlSecNodeSetPtr</link> nset,
                                             <link linkend="FILE-CAPS">FILE</link> *output);</programlisting>
<para>
Prints information about <parameter>nset</parameter> to the <parameter>output</parameter>.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>nset</parameter>&nbsp;:</entry>
<entry> the pointer to <link linkend="xmlSecNodeSet">xmlSecNodeSet</link> structure.
</entry></row>
<row><entry align="right"><parameter>output</parameter>&nbsp;:</entry>
<entry> the pointer to FILE.
</entry></row>
</tbody></tgroup></informaltable></refsect2>

</refsect1>




</refentry>
