Repository navigation
API XMLSec Core Nodeset
API Group: xmlsec_core_nodeset
XML node-set implementation used during transformations.
XML nodes set functions.
typedef int(* xmlSecNodeSetWalkCallback) (xmlSecNodeSetPtr nset, xmlNodePtr cur, xmlNodePtr parent, void *data))(xmlSecNodeSetPtr nset, xmlNodePtr cur, xmlNodePtr parent, void *data);Source: include/xmlsec/nodeset.h
Node walk callback, called once per node in the node set (namespace nodes once per descendant element).
The callback function called once per node in the node set (namespace nodes once per descendant element).
Parameters:
-
nset— the pointer to the xmlSecNodeSet structure. -
cur— the pointer to the current XML node. -
parent— the pointer to the parent node ofcur. -
data— the pointer to application specific data.
Returns: a non-negative value to continue the walk, or a negative value if the walk procedure should be interrupted.
Source: include/xmlsec/nodeset.h
The basic node set types.
| Value | Initializer | Description |
|---|---|---|
xmlSecNodeSetNormal |
0 |
node set = nodes in the list. |
xmlSecNodeSetInvert |
`` | node set = all document nodes minus nodes in the list. |
xmlSecNodeSetTree |
`` | node set = nodes in the list and all their subtrees. |
xmlSecNodeSetTreeWithoutComments |
`` | node set = nodes in the list and all their subtrees but no comment nodes. |
xmlSecNodeSetTreeInvert |
`` | node set = all document nodes minus nodes in the list and all their subtrees. |
xmlSecNodeSetTreeWithoutCommentsInvert |
`` | node set = all document nodes minus (nodes in the list and all their subtrees plus all comment nodes). |
xmlSecNodeSetList |
`` | DEPRECATED: node set = all nodes in the children list of node sets. |
Source: include/xmlsec/nodeset.h
The simple node set operations.
| Value | Initializer | Description |
|---|---|---|
xmlSecNodeSetIntersection |
0 |
intersection. |
xmlSecNodeSetSubtraction |
`` | subtraction. |
xmlSecNodeSetUnion |
`` | union. |
xmlSecNodeSetPtr xmlSecNodeSetCreate(xmlDocPtr doc, xmlNodeSetPtr nodes, xmlSecNodeSetType type);Source: include/xmlsec/nodeset.h
Creates a new nodes set.
Creates a new nodes set. Caller is responsible for freeing returned object by calling xmlSecNodeSetDestroy function.
Parameters:
-
doc— the pointer to parent XML document. -
nodes— the list of nodes. -
type— the nodes set type.
Returns: pointer to newly allocated node set or NULL if an error occurs.
void xmlSecNodeSetDestroy(xmlSecNodeSetPtr nset);Source: include/xmlsec/nodeset.h
Destroys a nodes set.
Destroys the nodes set created with xmlSecNodeSetCreate function.
Parameters:
-
nset— the pointer to node set.
void xmlSecNodeSetDocDestroy(xmlSecNodeSetPtr nset);Source: include/xmlsec/nodeset.h
Marks node set to destroy the parent document.
Instructs node set to destroy the node's parent doc when node set is destroyed.
Parameters:
-
nset— the pointer to node set.
int xmlSecNodeSetContains(xmlSecNodeSetPtr nset, xmlNodePtr node, xmlNodePtr parent);Source: include/xmlsec/nodeset.h
Checks if a node is in the nodes set.
Checks whether the node is in the nodes set or not. The function returns 0 (not visible) in case of an error to match the LibXML2 C14N IsVisibleCallback expectations.
Parameters:
-
nset— the pointer to node set. -
node— the pointer to XML node to check. -
parent— the pointer tonodeparent node.
Returns: 1 if the node is in the nodes set nset, 0 if it is not or if node is NULL or if an error occurs.
xmlSecNodeSetPtr xmlSecNodeSetAdd(xmlSecNodeSetPtr nset, xmlSecNodeSetPtr newNSet, xmlSecNodeSetOp op);Source: include/xmlsec/nodeset.h
Adds a nodes set to another with an operation.
Adds newNSet to the nset using operation op.
Parameters:
-
nset— the pointer to current nodes set (or NULL). -
newNSet— the pointer to new nodes set. -
op— the operation type.
Returns: the pointer to combined nodes set or NULL if an error occurs.
xmlSecNodeSetPtr xmlSecNodeSetGetChildren(xmlDocPtr doc, const xmlNodePtr parent, int withComments, int invert);Source: include/xmlsec/nodeset.h
Creates a nodes set from parent subtree children.
Creates a new nodes set that contains:
- if
withCommentsis not 0 andinvertis 0: all nodes in theparentsubtree; - if
withCommentsis 0 andinvertis 0: all nodes in theparentsubtree except comment nodes; - if
withCommentsis not 0 andinvertis not 0: all nodes in thedocexcept nodes in theparentsubtree; - if
withCommentsis 0 andinvertis not 0: all nodes in thedocexcept nodes in theparentsubtree and comment nodes.
Parameters:
-
doc— the pointer to an XML document. -
parent— the pointer to parent XML node or NULL if we want to include all document nodes. -
withComments— the flag to include comments or not. -
invert— the "invert" flag.
Returns: pointer to the newly created xmlSecNodeSet structure or NULL if an error occurs.
int xmlSecNodeSetWalk(xmlSecNodeSetPtr nset, xmlSecNodeSetWalkCallback walkFunc, void *data);Source: include/xmlsec/nodeset.h
Walks all nodes in a set calling a callback function.
Calls the function walkFunc for each node in the nodes set nset. Element and attribute nodes are reported once each. Namespace nodes, however, are reported once per descendant element in which they are in scope (the walk revisits the namespace declarations along each element's ancestor chain), so a namespace declared on a common ancestor may be reported more than once. If the walkFunc returns a negative value, then the walk procedure is interrupted.
Parameters:
-
nset— the pointer to node set. -
walkFunc— the callback function. -
data— the application specific data passed to thewalkFunc.
Returns: 0 on success or a negative value if an error occurs.
int xmlSecNodeSetDumpTextNodes(xmlSecNodeSetPtr nset, xmlOutputBufferPtr out);Source: include/xmlsec/nodeset.h
Dumps text node content from a nodes set.
Dumps content of all the text nodes from nset to out.
Parameters:
-
nset— the pointer to node set. -
out— the output buffer.
Returns: 0 on success or a negative value otherwise.
void xmlSecNodeSetDebugDump(xmlSecNodeSetPtr nset, FILE *output);Source: include/xmlsec/nodeset.h
Prints information about nset to the output.
Prints the type, operation, and node count of each set in the circular list starting from nset. The first set defines the base and has no operation; each following set carries the operation that combines it with the previous ones.
Parameters:
-
nset— the pointer to node set. -
output— the pointer to output FILE.
xmlSecNodeSetPtr xmlSecNodeSetAddList(xmlSecNodeSetPtr nset, xmlSecNodeSetPtr newNSet, xmlSecNodeSetOp op);Source: include/xmlsec/nodeset.h
DEPRECATED: Adds a nodes set as a child list.
Adds newNSet to the nset as child using operation op.
Parameters:
-
nset— the pointer to current nodes set (or NULL). -
newNSet— the pointer to new nodes set. -
op— the operation type.
Returns: the pointer to combined nodes set or NULL if an error occurs.