xmltree.h

Name

xmltree.h -- The XML tree helper functions.

Synopsis



xmlDocPtr   xmlSecParseFile                 (const char *filename);
xmlDocPtr   xmlSecParseMemory               (unsigned char *buffer,
                                             size_t size,
                                             int recovery);
xmlDocPtr   xmlSecParseMemoryExt            (unsigned char *prefix,
                                             size_t prefixSize,
                                             unsigned char *buffer,
                                             size_t bufferSize,
                                             unsigned char *postfix,
                                             size_t postfixSize);
int         xmlSecCheckNodeName             (const xmlNodePtr cur,
                                             const xmlChar *name,
                                             const xmlChar *ns);
xmlNodePtr  xmlSecGetNextElementNode        (xmlNodePtr cur);
xmlNodePtr  xmlSecFindChild                 (const xmlNodePtr parent,
                                             const xmlChar *name,
                                             const xmlChar *ns);
xmlNodePtr  xmlSecFindParent                (const xmlNodePtr cur,
                                             const xmlChar *name,
                                             const xmlChar *ns);
xmlNodePtr  xmlSecFindNode                  (const xmlNodePtr parent,
                                             const xmlChar *name,
                                             const xmlChar *ns);
xmlNodePtr  xmlSecAddChild                  (xmlNodePtr parent,
                                             const xmlChar *name,
                                             const xmlChar *ns);
xmlNodePtr  xmlSecAddNextSibling            (xmlNodePtr node,
                                             const xmlChar *name,
                                             const xmlChar *ns);
xmlNodePtr  xmlSecAddPrevSibling            (xmlNodePtr node,
                                             const xmlChar *name,
                                             const xmlChar *ns);
int         xmlSecReplaceNode               (xmlNodePtr node,
                                             xmlNodePtr newNode);
int         xmlSecReplaceContent            (xmlNodePtr node,
                                             xmlNodePtr newNode);
int         xmlSecReplaceNodeBuffer         (xmlNodePtr node,
                                             unsigned char *buffer,
                                             size_t size);
void        xmlSecAddIDs                    (xmlDocPtr doc,
                                             xmlNodePtr cur,
                                             const xmlChar **ids);
#define     xmlSecGetHex                    (c)
#define     xmlSecIsHex                     (c)

Description

Details

xmlSecParseFile ()

xmlDocPtr   xmlSecParseFile                 (const char *filename);

Loads XML Doc from file filename. We need a special version because of c14n issue. The code is copied from xmlSAXParseFileWithData() function.

filename : the filename.
Returns :pointer to the loaded XML document or NULL if an error occurs.


xmlSecParseMemory ()

xmlDocPtr   xmlSecParseMemory               (unsigned char *buffer,
                                             size_t size,
                                             int recovery);

Loads XML Doc from memory. We need a special version because of c14n issue. The code is copied from xmlSAXParseMemory() function.

buffer : the input buffer.
size : the input buffer size.
recovery : the flag.
Returns :pointer to the loaded XML document or NULL if an error occurs.


xmlSecParseMemoryExt ()

xmlDocPtr   xmlSecParseMemoryExt            (unsigned char *prefix,
                                             size_t prefixSize,
                                             unsigned char *buffer,
                                             size_t bufferSize,
                                             unsigned char *postfix,
                                             size_t postfixSize);

Loads XML Doc from 3 chunks of memory: prefix, buffer and postfix. '

prefix : the first part of the input.
prefixSize : the size of the first part of the input.
buffer : the second part of the input.
bufferSize : the size of the second part of the input.
postfix : the third part of the input.
postfixSize : the size of the third part of the input.
Returns :pointer to the loaded XML document or NULL if an error occurs.


xmlSecCheckNodeName ()

int         xmlSecCheckNodeName             (const xmlNodePtr cur,
                                             const xmlChar *name,
                                             const xmlChar *ns);

Checks that the node has a given name and a given namespace href.

cur : the pointer to an XML node.
name : the name,
ns : the namespace href.
Returns :1 if the node matches or 0 otherwise.


xmlSecGetNextElementNode ()

xmlNodePtr  xmlSecGetNextElementNode        (xmlNodePtr cur);

Seraches for the next element node.

cur : the pointer to an XML node.
Returns :the pointer to next element node or NULL if it is not found.


xmlSecFindChild ()

xmlNodePtr  xmlSecFindChild                 (const xmlNodePtr parent,
                                             const xmlChar *name,
                                             const xmlChar *ns);

Searches a direct child of the parent node having given name and namespace href.

parent : the pointer to XML node.
name : the name.
ns : the namespace href (may be NULL).
Returns :the pointer to the found node or NULL if an error occurs or node is not found.


xmlSecFindParent ()

xmlNodePtr  xmlSecFindParent                (const xmlNodePtr cur,
                                             const xmlChar *name,
                                             const xmlChar *ns);

Searches the ancestors axis of the cur node for a node having given name and namespace href.

cur : the pointer to an XML node.
name : the name.
ns : the namespace href (may be NULL).
Returns :the pointer to the found node or NULL if an error occurs or node is not found.


xmlSecFindNode ()

xmlNodePtr  xmlSecFindNode                  (const xmlNodePtr parent,
                                             const xmlChar *name,
                                             const xmlChar *ns);

Searches all children of the parent node having given name and namespace href.

parent : the pointer to XML node.
name : the name.
ns : the namespace href (may be NULL).
Returns :the pointer to the found node or NULL if an error occurs or node is not found.


xmlSecAddChild ()

xmlNodePtr  xmlSecAddChild                  (xmlNodePtr parent,
                                             const xmlChar *name,
                                             const xmlChar *ns);

Adds a child to the node parent with given name and namespace ns.

parent : the pointer to an XML node.
name : the new node name.
ns : the new node namespace.
Returns :pointer to the new node or NULL if an error occurs.


xmlSecAddNextSibling ()

xmlNodePtr  xmlSecAddNextSibling            (xmlNodePtr node,
                                             const xmlChar *name,
                                             const xmlChar *ns);

Adds next sibling to the node node with given name and namespace ns.

node : the pointer to an XML node.
name : the new node name.
ns : the new node namespace.
Returns :pointer to the new node or NULL if an error occurs.


xmlSecAddPrevSibling ()

xmlNodePtr  xmlSecAddPrevSibling            (xmlNodePtr node,
                                             const xmlChar *name,
                                             const xmlChar *ns);

Adds prev sibling to the node node with given name and namespace ns.

node : the pointer to an XML node.
name : the new node name.
ns : the new node namespace.
Returns :pointer to the new node or NULL if an error occurs.


xmlSecReplaceNode ()

int         xmlSecReplaceNode               (xmlNodePtr node,
                                             xmlNodePtr newNode);

Swaps the node and newNode in the XML tree.

node : the current node.
newNode : the new node.
Returns :0 on success or a negative value if an error occurs.


xmlSecReplaceContent ()

int         xmlSecReplaceContent            (xmlNodePtr node,
                                             xmlNodePtr newNode);

Swaps the content of node and newNode.

node : the current node.
newNode : the new node.
Returns :0 on success or a negative value if an error occurs.


xmlSecReplaceNodeBuffer ()

int         xmlSecReplaceNodeBuffer         (xmlNodePtr node,
                                             unsigned char *buffer,
                                             size_t size);

Swaps the node and the parsed XML data from the buffer in the XML tree.

node : the current node.
buffer : the XML data.
size : the XML data size.
Returns :0 on success or a negative value if an error occurs.


xmlSecAddIDs ()

void        xmlSecAddIDs                    (xmlDocPtr doc,
                                             xmlNodePtr cur,
                                             const xmlChar **ids);

Walks thru all children of the cur node and adds all attributes from the ids list to the doc document IDs attributes hash.

doc : the pointer to an XML document.
cur : the pointer to an XML node.
ids : the pointer to a NULL terminated list of ID attributes.


xmlSecGetHex()

#define     xmlSecGetHex(c)

Macro. Returns the hex value of the c.

c : the character,


xmlSecIsHex()

#define     xmlSecIsHex(c)

Macro. Returns 1 if c is a hex digit or 0 other wise.

c : the character.