2 * XML Security Library (http://www.aleksey.com/xmlsec).
6 * This is free software; see Copyright file in the source
7 * distribution for preciese wording.
9 * Copyright (C) 2002-2003 Aleksey Sanin <aleksey@aleksey.com>
11 #ifndef __XMLSEC_NODESET_H__
12 #define __XMLSEC_NODESET_H__
16 #endif /* __cplusplus */
18 #include <libxml/tree.h>
19 #include <libxml/xpath.h>
21 #include <xmlsec/xmlsec.h>
23 typedef struct _xmlSecNodeSet xmlSecNodeSet, *xmlSecNodeSetPtr;
27 * @xmlSecNodeSetNormal: nodes set = nodes in the list.
28 * @xmlSecNodeSetInvert: nodes set = all document nodes minus nodes in the list.
29 * @xmlSecNodeSetTree: nodes set = nodes in the list and all their subtress.
30 * @xmlSecNodeSetTreeWithoutComments: nodes set = nodes in the list and
31 * all their subtress but no comment nodes.
32 * @xmlSecNodeSetTreeInvert: nodes set = all document nodes minus nodes in the
33 * list and all their subtress.
34 * @xmlSecNodeSetTreeWithoutCommentsInvert: nodes set = all document nodes
35 * minus (nodes in the list and all their subtress
36 * plus all comment nodes).
37 * @xmlSecNodeSetList: nodes set = all nodes in the chidren list of nodes sets.
39 * The basic nodes sets types.
42 xmlSecNodeSetNormal = 0,
45 xmlSecNodeSetTreeWithoutComments,
46 xmlSecNodeSetTreeInvert,
47 xmlSecNodeSetTreeWithoutCommentsInvert,
53 * @xmlSecNodeSetIntersection: intersection.
54 * @xmlSecNodeSetSubtraction: subtraction.
55 * @xmlSecNodeSetUnion: union.
57 * The simple nodes sets operations.
60 xmlSecNodeSetIntersection = 0,
61 xmlSecNodeSetSubtraction,
67 * @nodes: the nodes list.
68 * @doc: the parent XML document.
69 * @destroyDoc: the flag: if set to 1 then @doc will
70 * be destroyed when node set is destroyed.
71 * @type: the nodes set type.
72 * @op: the operation type.
73 * @next: the next nodes set.
74 * @prev: the previous nodes set.
75 * @children: the children list (valid only if type
76 * equal to #xmlSecNodeSetList).
78 * The enchanced nodes set.
80 struct _xmlSecNodeSet {
84 xmlSecNodeSetType type;
86 xmlSecNodeSetPtr next;
87 xmlSecNodeSetPtr prev;
88 xmlSecNodeSetPtr children;
92 * xmlSecNodeSetWalkCallback:
93 * @nset: the pointer to #xmlSecNodeSet structure.
94 * @cur: the pointer current XML node.
95 * @parent: the pointer to the @cur parent node.
96 * @data: the pointer to application specific data.
98 * The callback function called once per each node in the nodes set.
100 * Returns: 0 on success or a negative value if an error occurs
101 * an walk procedure should be interrupted.
103 typedef int (*xmlSecNodeSetWalkCallback) (xmlSecNodeSetPtr nset,
108 XMLSEC_EXPORT xmlSecNodeSetPtr xmlSecNodeSetCreate (xmlDocPtr doc,
110 xmlSecNodeSetType type);
111 XMLSEC_EXPORT void xmlSecNodeSetDestroy (xmlSecNodeSetPtr nset);
112 XMLSEC_EXPORT void xmlSecNodeSetDocDestroy (xmlSecNodeSetPtr nset);
113 XMLSEC_EXPORT int xmlSecNodeSetContains (xmlSecNodeSetPtr nset,
116 XMLSEC_EXPORT xmlSecNodeSetPtr xmlSecNodeSetAdd (xmlSecNodeSetPtr nset,
117 xmlSecNodeSetPtr newNSet,
119 XMLSEC_EXPORT xmlSecNodeSetPtr xmlSecNodeSetAddList (xmlSecNodeSetPtr nset,
120 xmlSecNodeSetPtr newNSet,
122 XMLSEC_EXPORT xmlSecNodeSetPtr xmlSecNodeSetGetChildren(xmlDocPtr doc,
123 const xmlNodePtr parent,
126 XMLSEC_EXPORT int xmlSecNodeSetWalk (xmlSecNodeSetPtr nset,
127 xmlSecNodeSetWalkCallback walkFunc,
129 XMLSEC_EXPORT int xmlSecNodeSetDumpTextNodes(xmlSecNodeSetPtr nset,
130 xmlOutputBufferPtr out);
131 XMLSEC_EXPORT void xmlSecNodeSetDebugDump (xmlSecNodeSetPtr nset,
136 #endif /* __cplusplus */
138 #endif /* __XMLSEC_NODESET_H__ */