libxml2
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions
tree.h File Reference

Document tree API. More...

Data Structures

struct   _xmlBuffer
  A buffer structure, this old construct is limited to 2GB and is being deprecated, use API with xmlBuf instead. More...
struct   _xmlNotation
  A DTD Notation definition. More...
struct   _xmlEnumeration
  List structure used when there is an enumeration in DTDs. More...
struct   _xmlAttribute
  An Attribute declaration in a DTD. More...
struct   _xmlElementContent
  An XML Element content as stored after parsing an element definition in a DTD. More...
struct   _xmlElement
  An XML Element declaration from a DTD. More...
struct   _xmlNs
  An XML namespace. More...
struct   _xmlDtd
  An XML DTD, as defined by <!DOCTYPE ... There is actually one for the internal subset and for the external subset. More...
struct   _xmlAttr
  An attribute of element. More...
struct   _xmlID
  An XML ID instance. More...
struct   _xmlNode
  Generic node type in an XML or HTML tree. More...
struct   _xmlDoc
  An XML or HTML document. More...
struct   _xmlDOMWrapCtxt
  Context for DOM wrapper-operations. More...

Macros

#define  LIBXML2_NEW_BUFFER
  Macro used to express that the API use the new buffers for xmlParserInputBuffer and xmlOutputBuffer.
#define  XML_XML_NAMESPACE    (const xmlChar *) "http://www.w3.org/XML/1998/namespace"
  This is the namespace for the special xml: prefix predefined in the XML Namespace specification.
#define  XML_XML_ID   (const xmlChar *) "xml:id"
  This is the name for the special xml:id attribute.
#define  XML_LOCAL_NAMESPACE   XML_NAMESPACE_DECL
  A namespace declaration node.
#define  xmlChildrenNode   children
  Macro for compatibility naming layer with libxml1.
#define  xmlRootNode   children
  Macro for compatibility naming layer with libxml1.

Typedefs

  Parser input buffer.
typedef struct _xmlOutputBuffer  xmlOutputBuffer
  Output buffer.
typedef struct _xmlParserInput  xmlParserInput
  Parser input.
typedef struct _xmlParserCtxt  xmlParserCtxt
  Parser context.
typedef struct _xmlSAXLocator  xmlSAXLocator
  SAX locator.
typedef struct _xmlSAXHandler  xmlSAXHandler
  SAX handler.
typedef struct _xmlEntity  xmlEntity
  Entity declaration.
typedef struct _xmlBuffer  xmlBuffer
  Buffer type.
typedef struct _xmlBuf  xmlBuf
  Buffer with 64-bit support.
typedef struct _xmlNotation  xmlNotation
  Notation declaration.
typedef struct _xmlEnumeration  xmlEnumeration
  Enumeration in a DTD.
typedef struct _xmlAttribute  xmlAttribute
  Attribute declaration.
typedef struct _xmlElementContent  xmlElementContent
  Element content in element declarations.
typedef struct _xmlElement  xmlElement
  Element declaration.
typedef struct _xmlNs  xmlNs
  Namespace declaration.
typedef struct _xmlDtd  xmlDtd
  Document type definition (DTD)
typedef struct _xmlAttr  xmlAttr
  Attribute of an element.
typedef struct _xmlID  xmlID
  Extra data for ID attributes.
typedef struct _xmlNode  xmlNode
  Generic node type in an XML or HTML tree.
typedef struct _xmlDoc  xmlDoc
  XML or HTML document.
typedef struct _xmlDOMWrapCtxt  xmlDOMWrapCtxt
  Context for DOM wrapper operations.
typedef xmlNs *(*  xmlDOMWrapAcquireNsFunction) (xmlDOMWrapCtxt *ctxt, xmlNode *node, const xmlChar *nsName, const xmlChar *nsPrefix)
  A function called to acquire namespaces (xmlNs) from the wrapper.
typedef void(*  xmlRegisterNodeFunc) (xmlNode *node)
  Signature for the registration callback of a created node.
typedef void(*  xmlDeregisterNodeFunc) (xmlNode *node)
  Signature for the deregistration callback of a discarded node.

Enumerations

  Removed, buffers always use XML_BUFFER_ALLOC_IO now.
enum   xmlElementType
  The different element types carried by an XML tree. More...
  A DTD Attribute type definition.
  A DTD Attribute default definition.
  Possible definitions of element content types.
  Possible definitions of element content occurrences.
  The different possibilities for an element content type.
  Set of properties of the document as found by the parser. More...

Functions

int  xmlValidateNCName (const xmlChar *value, int space)
  Check that a value conforms to the lexical space of NCName.
int  xmlValidateQName (const xmlChar *value, int space)
  Check that a value conforms to the lexical space of QName.
int  xmlValidateName (const xmlChar *value, int space)
  Check that a value conforms to the lexical space of Name.
int  xmlValidateNMToken (const xmlChar *value, int space)
  Check that a value conforms to the lexical space of NMToken.
xmlChar *  xmlBuildQName (const xmlChar *ncname, const xmlChar *prefix, xmlChar *memory, int len)
  Build a QName from prefix and local name.
xmlChar *  xmlSplitQName2 (const xmlChar *name, xmlChar **prefix)
  Parse an XML qualified name.
const xmlChar *  xmlSplitQName3 (const xmlChar *name, int *len)
  Parse an XML qualified name.
xmlDtd *  xmlCreateIntSubset (xmlDoc *doc, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId)
  Create a DTD node.
xmlDtd *  xmlNewDtd (xmlDoc *doc, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId)
  Create a DTD node.
xmlDtd *  xmlGetIntSubset (const xmlDoc *doc)
  Get the internal subset of a document.
void  xmlFreeDtd (xmlDtd *cur)
  Free a DTD structure.
xmlNs *  xmlNewNs (xmlNode *node, const xmlChar *href, const xmlChar *prefix)
  Create a new namespace.
void  xmlFreeNs (xmlNs *cur)
  Free an xmlNs object.
void  xmlFreeNsList (xmlNs *cur)
  Free a list of xmlNs objects.
xmlDoc *  xmlNewDoc (const xmlChar *version)
  Creates a new XML document.
void  xmlFreeDoc (xmlDoc *cur)
  Free a document including all children and associated DTDs.
xmlAttr *  xmlNewDocProp (xmlDoc *doc, const xmlChar *name, const xmlChar *value)
  Create an attribute node.
xmlAttr *  xmlNewProp (xmlNode *node, const xmlChar *name, const xmlChar *value)
  Create an attribute node.
xmlAttr *  xmlNewNsProp (xmlNode *node, xmlNs *ns, const xmlChar *name, const xmlChar *value)
  Create an attribute node.
xmlAttr *  xmlNewNsPropEatName (xmlNode *node, xmlNs *ns, xmlChar *name, const xmlChar *value)
  Create an attribute node.
void  xmlFreePropList (xmlAttr *cur)
  Free an attribute list including all children.
void  xmlFreeProp (xmlAttr *cur)
  Free an attribute including all children.
xmlAttr *  xmlCopyProp (xmlNode *target, xmlAttr *cur)
  Create a copy of the attribute.
xmlAttr *  xmlCopyPropList (xmlNode *target, xmlAttr *cur)
  Create a copy of an attribute list.
  Copy a DTD.
xmlDoc *  xmlCopyDoc (xmlDoc *doc, int recursive)
  Copy a document.
xmlNode *  xmlNewDocNode (xmlDoc *doc, xmlNs *ns, const xmlChar *name, const xmlChar *content)
  Create an element node.
xmlNode *  xmlNewDocNodeEatName (xmlDoc *doc, xmlNs *ns, xmlChar *name, const xmlChar *content)
  Create an element node.
xmlNode *  xmlNewNode (xmlNs *ns, const xmlChar *name)
  Create an element node.
  Create an element node.
xmlNode *  xmlNewChild (xmlNode *parent, xmlNs *ns, const xmlChar *name, const xmlChar *content)
  Create a new child element and append it to a parent element.
xmlNode *  xmlNewDocText (const xmlDoc *doc, const xmlChar *content)
  Create a new text node.
xmlNode *  xmlNewText (const xmlChar *content)
  Create a text node.
xmlNode *  xmlNewDocPI (xmlDoc *doc, const xmlChar *name, const xmlChar *content)
  Create a processing instruction object.
xmlNode *  xmlNewPI (const xmlChar *name, const xmlChar *content)
  Create a processing instruction node.
xmlNode *  xmlNewDocTextLen (xmlDoc *doc, const xmlChar *content, int len)
  Create a new text node.
xmlNode *  xmlNewTextLen (const xmlChar *content, int len)
  Create a new text node.
xmlNode *  xmlNewDocComment (xmlDoc *doc, const xmlChar *content)
  Create a comment node.
xmlNode *  xmlNewComment (const xmlChar *content)
  Use of this function is DISCOURAGED in favor of xmlNewDocComment.
xmlNode *  xmlNewCDataBlock (xmlDoc *doc, const xmlChar *content, int len)
  Create a CDATA section node.
xmlNode *  xmlNewCharRef (xmlDoc *doc, const xmlChar *name)
  Create an empty entity reference node.
xmlNode *  xmlNewReference (const xmlDoc *doc, const xmlChar *name)
  Create a new entity reference node, linking the result with the entity in doc if found.
xmlNode *  xmlCopyNode (xmlNode *node, int recursive)
  Copy a node.
xmlNode *  xmlDocCopyNode (xmlNode *node, xmlDoc *doc, int recursive)
  Copy a node into another document.
  Copy a node list and all children into a new document.
  Copy a node list and all children.
xmlNode *  xmlNewTextChild (xmlNode *parent, xmlNs *ns, const xmlChar *name, const xmlChar *content)
  Create a new child element and append it to a parent element.
xmlNode *  xmlNewDocRawNode (xmlDoc *doc, xmlNs *ns, const xmlChar *name, const xmlChar *content)
  Create an element node.
  Create a document fragment node.
long  xmlGetLineNo (const xmlNode *node)
  Get line number of node.
xmlChar *  xmlGetNodePath (const xmlNode *node)
  Build a structure based Path for the given node.
  Get the root element of the document.
xmlNode *  xmlGetLastChild (const xmlNode *parent)
  Find the last child of a node.
int  xmlNodeIsText (const xmlNode *node)
  Check whether the node is a text node.
int  xmlIsBlankNode (const xmlNode *node)
  Checks whether this node is an empty or whitespace-only text node.
  If root is NULL no action is taken.
void  xmlNodeSetName (xmlNode *cur, const xmlChar *name)
  Set (or reset) the name of a node.
xmlNode *  xmlAddChild (xmlNode *parent, xmlNode *cur)
  Unlink cur and append it to the children of parent.
xmlNode *  xmlAddChildList (xmlNode *parent, xmlNode *cur)
  Append a node list to another node.
  Unlink the old node.
  Unlinks cur and inserts it as previous sibling before next.
  Unlinks cur and inserts it as last sibling of node.
  Unlinks cur and inserts it as next sibling after prev.
void  xmlUnlinkNode (xmlNode *cur)
  Unlink a node from its tree.
xmlNode *  xmlTextMerge (xmlNode *first, xmlNode *second)
  Merge the second text node into the first.
int  xmlTextConcat (xmlNode *node, const xmlChar *content, int len)
  Concat the given string at the end of the existing node content.
void  xmlFreeNodeList (xmlNode *cur)
  Free a node list including all children.
void  xmlFreeNode (xmlNode *cur)
  Free a node including all the children.
int  xmlSetTreeDoc (xmlNode *tree, xmlDoc *doc)
  Associate all nodes in a tree with a new document.
int  xmlSetListDoc (xmlNode *list, xmlDoc *doc)
  Associate all subtrees in list with a new document.
xmlNs *  xmlSearchNs (xmlDoc *doc, xmlNode *node, const xmlChar *nameSpace)
  Search for a namespace with prefix in scope of node.
xmlNs *  xmlSearchNsByHref (xmlDoc *doc, xmlNode *node, const xmlChar *href)
  Search for a namespace matching URI in scope of node.
int  xmlGetNsListSafe (const xmlDoc *doc, const xmlNode *node, xmlNs ***out)
  Find all in-scope namespaces of a node.
xmlNs **  xmlGetNsList (const xmlDoc *doc, const xmlNode *node)
  Find all in-scope namespaces of a node.
void  xmlSetNs (xmlNode *node, xmlNs *ns)
  Set the namespace of an element or attribute node.
  Copy a namespace.
  Copy a namespace list.
xmlAttr *  xmlSetProp (xmlNode *node, const xmlChar *name, const xmlChar *value)
  Set (or reset) an element's attribute.
xmlAttr *  xmlSetNsProp (xmlNode *node, xmlNs *ns, const xmlChar *name, const xmlChar *value)
  Set (or reset) an element's attribute.
int  xmlNodeGetAttrValue (const xmlNode *node, const xmlChar *name, const xmlChar *nsUri, xmlChar **out)
  Look up the value of an element's attribute.
xmlChar *  xmlGetNoNsProp (const xmlNode *node, const xmlChar *name)
  Look up the value of an element's attribute.
xmlChar *  xmlGetProp (const xmlNode *node, const xmlChar *name)
  Look up the value of an element's attribute.
xmlAttr *  xmlHasProp (const xmlNode *node, const xmlChar *name)
  Search for an attribute of an element.
xmlAttr *  xmlHasNsProp (const xmlNode *node, const xmlChar *name, const xmlChar *nameSpace)
  Search for an attribute of an element.
xmlChar *  xmlGetNsProp (const xmlNode *node, const xmlChar *name, const xmlChar *nameSpace)
  Look up the value of an element's attribute.
xmlNode *  xmlStringGetNodeList (const xmlDoc *doc, const xmlChar *value)
  Parse an attribute value and build a node list with text and entity reference nodes.
xmlNode *  xmlStringLenGetNodeList (const xmlDoc *doc, const xmlChar *value, int len)
xmlChar *  xmlNodeListGetString (xmlDoc *doc, const xmlNode *list, int inLine)
  Serializes attribute children (text and entity reference nodes) into a string.
xmlChar *  xmlNodeListGetRawString (const xmlDoc *doc, const xmlNode *list, int inLine)
  Serializes attribute children (text and entity reference nodes) into a string.
int  xmlNodeSetContent (xmlNode *cur, const xmlChar *content)
  Replace the text content of a node.
int  xmlNodeSetContentLen (xmlNode *cur, const xmlChar *content, int len)
int  xmlNodeAddContent (xmlNode *cur, const xmlChar *content)
  Append the extra substring to the node content.
int  xmlNodeAddContentLen (xmlNode *cur, const xmlChar *content, int len)
  Append the extra substring to the node content.
  Returns the string value of a node.
int  xmlNodeBufGetContent (xmlBuffer *buffer, const xmlNode *cur)
  Append the string value of a node to buffer.
int  xmlBufGetNodeContent (xmlBuf *buf, const xmlNode *cur)
  Append the string value of a node to buf.
xmlChar *  xmlNodeGetLang (const xmlNode *cur)
  Find the xml:lang of a node.
int  xmlNodeGetSpacePreserve (const xmlNode *cur)
  Find the xml:space of a node.
int  xmlNodeSetLang (xmlNode *cur, const xmlChar *lang)
  Set the xml:lang attribute of a node.
int  xmlNodeSetSpacePreserve (xmlNode *cur, int val)
  Set the xml:space attribute of a node.
int  xmlNodeGetBaseSafe (const xmlDoc *doc, const xmlNode *cur, xmlChar **baseOut)
  Searches for the base URI.
xmlChar *  xmlNodeGetBase (const xmlDoc *doc, const xmlNode *cur)
int  xmlNodeSetBase (xmlNode *cur, const xmlChar *uri)
  Set (or reset) the base URI of a node, i.e.
int  xmlRemoveProp (xmlAttr *cur)
  Unlink and free an attribute including all children.
int  xmlUnsetNsProp (xmlNode *node, xmlNs *ns, const xmlChar *name)
  Remove an attribute of an element.
int  xmlUnsetProp (xmlNode *node, const xmlChar *name)
  Remove an attribute of an element.
void  xmlAttrSerializeTxtContent (xmlBuffer *buf, xmlDoc *doc, xmlAttr *attr, const xmlChar *string)
  Serialize attribute text to an xmlBuffer.
int  xmlReconciliateNs (xmlDoc *doc, xmlNode *tree)
  This function checks that all the namespaces declared within the given tree are properly declared.
void  xmlDocDumpFormatMemory (xmlDoc *cur, xmlChar **mem, int *size, int format)
  Same as xmlDocDumpFormatMemoryEnc with encoding set to NULL.
void  xmlDocDumpMemory (xmlDoc *cur, xmlChar **mem, int *size)
  Same as xmlDocDumpFormatMemoryEnc with encoding set to NULL and format set to 0.
void  xmlDocDumpMemoryEnc (xmlDoc *out_doc, xmlChar **doc_txt_ptr, int *doc_txt_len, const char *txt_encoding)
  Same as xmlDocDumpFormatMemoryEnc with format set to 0.
void  xmlDocDumpFormatMemoryEnc (xmlDoc *out_doc, xmlChar **doc_txt_ptr, int *doc_txt_len, const char *txt_encoding, int format)
  Serialize an XML document to memory.
int  xmlDocFormatDump (FILE *f, xmlDoc *cur, int format)
  Serialize an XML document to a FILE.
int  xmlDocDump (FILE *f, xmlDoc *cur)
  Serialize an XML document to a FILE.
void  xmlElemDump (FILE *f, xmlDoc *doc, xmlNode *cur)
  Serialize an XML node to a FILE.
int  xmlSaveFile (const char *filename, xmlDoc *cur)
  Same as xmlSaveFormatFileEnc with encoding set to NULL and format set to 0.
int  xmlSaveFormatFile (const char *filename, xmlDoc *cur, int format)
  Same as xmlSaveFormatFileEnc with encoding set to NULL.
size_t  xmlBufNodeDump (xmlBuf *buf, xmlDoc *doc, xmlNode *cur, int level, int format)
  Serialize an XML node to an xmlBuf.
int  xmlNodeDump (xmlBuffer *buf, xmlDoc *doc, xmlNode *cur, int level, int format)
  Serialize an XML node to an xmlBuffer.
int  xmlSaveFileTo (xmlOutputBuffer *buf, xmlDoc *cur, const char *encoding)
  Same as xmlSaveFormatFileTo with format set to 0.
int  xmlSaveFormatFileTo (xmlOutputBuffer *buf, xmlDoc *cur, const char *encoding, int format)
  Serialize an XML document to an output buffer.
void  xmlNodeDumpOutput (xmlOutputBuffer *buf, xmlDoc *doc, xmlNode *cur, int level, int format, const char *encoding)
  Serialize an XML node to an output buffer.
int  xmlSaveFormatFileEnc (const char *filename, xmlDoc *cur, const char *encoding, int format)
  Serialize an XML document to a file using the given encoding.
int  xmlSaveFileEnc (const char *filename, xmlDoc *cur, const char *encoding)
  Same as xmlSaveFormatFileEnc with format set to 0.
int  xmlIsXHTML (const xmlChar *systemID, const xmlChar *publicID)
  Try to find if the document correspond to an XHTML DTD.
int  xmlGetDocCompressMode (const xmlDoc *doc)
  Get the compression level of a document, ZLIB based.
void  xmlSetDocCompressMode (xmlDoc *doc, int mode)
  Set the compression level of a document, ZLIB based.
int  xmlGetCompressMode (void)
  Get the global compression level, ZLIB based.
void  xmlSetCompressMode (int mode)
  Set the global compression level, ZLIB based.
  Allocates and initializes a new DOM-wrapper context.
  Frees the DOM-wrapper context.
int  xmlDOMWrapReconcileNamespaces (xmlDOMWrapCtxt *ctxt, xmlNode *elem, int options)
  Fix up namespaces.
int  xmlDOMWrapAdoptNode (xmlDOMWrapCtxt *ctxt, xmlDoc *sourceDoc, xmlNode *node, xmlDoc *destDoc, xmlNode *destParent, int options)
  Fix up namespaces before moving a node.
int  xmlDOMWrapRemoveNode (xmlDOMWrapCtxt *ctxt, xmlDoc *doc, xmlNode *node, int options)
  Unlinks the given node from its owner.
int  xmlDOMWrapCloneNode (xmlDOMWrapCtxt *ctxt, xmlDoc *sourceDoc, xmlNode *node, xmlNode **clonedNode, xmlDoc *destDoc, xmlNode *destParent, int deep, int options)
  Clone a node and fix namespaces.
unsigned long  xmlChildElementCount (xmlNode *parent)
  Count the number of child nodes which are elements.
  Find the closest following sibling which is a element.
  Find the first child node which is an element.
  Find the last child node which is an element.
  Find the closest preceding sibling which is a element.
  Registers a callback for node creation.
  Registers a callback for node destruction.
  Set per-thread default value.
  Set per-thread default value.
  Set the buffer allocation scheme.
  Get the buffer allocation scheme.
  Create a buffer.
xmlBuffer *  xmlBufferCreateSize (size_t size)
  Create a buffer with an initial size.
xmlBuffer *  xmlBufferCreateStatic (void *mem, size_t size)
  Create a static buffer.
int  xmlBufferResize (xmlBuffer *buf, unsigned int size)
  Resize a buffer to a minimum size.
void  xmlBufferFree (xmlBuffer *buf)
  Free a buffer.
int  xmlBufferDump (FILE *file, xmlBuffer *buf)
  Dump a buffer to a FILE.
int  xmlBufferAdd (xmlBuffer *buf, const xmlChar *str, int len)
  Append bytes to a buffer.
int  xmlBufferAddHead (xmlBuffer *buf, const xmlChar *str, int len)
  Prepend bytes to a buffer.
int  xmlBufferCat (xmlBuffer *buf, const xmlChar *str)
  Append a zero-terminated string to a buffer.
int  xmlBufferCCat (xmlBuffer *buf, const char *str)
  Append a zero-terminated C string to a buffer.
int  xmlBufferShrink (xmlBuffer *buf, unsigned int len)
  Discard bytes at the start of a buffer.
int  xmlBufferGrow (xmlBuffer *buf, unsigned int len)
  Grow a buffer.
void  xmlBufferEmpty (xmlBuffer *buf)
  Empty a buffer.
const xmlChar *  xmlBufferContent (const xmlBuffer *buf)
  Get pointer into buffer content.
  Extract buffer content.
  Set the allocation scheme of a buffer.
int  xmlBufferLength (const xmlBuffer *buf)
  Get the size of the buffer content.
void  xmlBufferWriteCHAR (xmlBuffer *buf, const xmlChar *string)
  Append a zero-terminated xmlChar string to a buffer.
void  xmlBufferWriteChar (xmlBuffer *buf, const char *string)
  Append a zero-terminated C string to a buffer.
void  xmlBufferWriteQuotedString (xmlBuffer *buf, const xmlChar *string)
  Append a quoted string to a buffer.
xmlChar *  xmlBufContent (const xmlBuf *buf)
  Get pointer into buffer content.
  Return a pointer to the end of the buffer content.
size_t  xmlBufUse (xmlBuf *buf)
  Return the size of the buffer content.
size_t  xmlBufShrink (xmlBuf *buf, size_t len)
  Discard bytes at the start of a buffer.

Detailed Description

Document tree API.

Data structures and functions to build, modify, query and serialize XML and HTML document trees. Also contains the buffer API.

Copyright
See Copyright for the status of this software.
Author
Daniel Veillard

Macro Definition Documentation

◆  LIBXML2_NEW_BUFFER

#define LIBXML2_NEW_BUFFER

Macro used to express that the API use the new buffers for xmlParserInputBuffer and xmlOutputBuffer.

The change was introduced in 2.9.0.

◆  xmlChildrenNode

#define xmlChildrenNode   children

Macro for compatibility naming layer with libxml1.

Maps to "children."

◆  xmlRootNode

#define xmlRootNode   children

Macro for compatibility naming layer with libxml1.

Maps to "children".

Typedef Documentation

◆  xmlDeregisterNodeFunc

typedef void(* xmlDeregisterNodeFunc) (xmlNode *node)

Signature for the deregistration callback of a discarded node.

Parameters
node the current node

◆  xmlDOMWrapAcquireNsFunction

typedef xmlNs *(* xmlDOMWrapAcquireNsFunction) (xmlDOMWrapCtxt *ctxt, xmlNode *node, const xmlChar *nsName, const xmlChar *nsPrefix)

A function called to acquire namespaces (xmlNs) from the wrapper.

Parameters
ctxt a DOM wrapper context
node the context node (element or attribute)
nsName the requested namespace name
nsPrefix the requested namespace prefix
Returns
an xmlNs or NULL in case of an error.

◆  xmlParserInputBuffer

Parser input buffer.

This struct and all related functions should ultimately be removed from the public interface.

◆  xmlRegisterNodeFunc

typedef void(* xmlRegisterNodeFunc) (xmlNode *node)

Signature for the registration callback of a created node.

Parameters
node the current node

Enumeration Type Documentation

◆  xmlDocProperties

Set of properties of the document as found by the parser.

Some of them are linked to similarly named xmlParserOption.

Enumerator
XML_DOC_WELLFORMED 

document is XML well formed

XML_DOC_NSVALID 

document is Namespace valid

XML_DOC_OLD10 

parsed with old XML-1.0 parser

XML_DOC_DTDVALID 

DTD validation was successful.

XML_DOC_XINCLUDE 

XInclude substitution was done.

XML_DOC_USERBUILT 

Document was built using the API and not by parsing an instance.

XML_DOC_INTERNAL 

built for internal processing

XML_DOC_HTML 

parsed or built HTML document

◆  xmlElementType

The different element types carried by an XML tree.

NOTE: This is synchronized with DOM Level 1 values. See http://www.w3.org/TR/REC-DOM-Level-1/

Actually this had diverged a bit, and XML_DTD_NODE is used instead of XML_DOCUMENT_TYPE_NODE.

Enumerator
XML_ELEMENT_NODE 

An element.

Objects of this type are an xmlNode.

XML_ATTRIBUTE_NODE 

An attribute.

Objects of this type are an xmlAttr.

XML_TEXT_NODE 

A text node.

Objects of this type are an xmlNode.

XML_CDATA_SECTION_NODE 

A CDATA section.

Objects of this type are an xmlNode.

XML_ENTITY_REF_NODE 

An entity reference.

Objects of this type are an xmlNode. The children member points to the entity declaration if available.

XML_ENTITY_NODE 

unused

XML_PI_NODE 

A processing instruction.

Objects of this type are an xmlNode.

XML_COMMENT_NODE 

A comment.

Objects of this type are an xmlNode.

XML_DOCUMENT_NODE 

A document.

Objects of this type are an xmlDoc.

XML_DOCUMENT_TYPE_NODE 

unused

XML_DOCUMENT_FRAG_NODE 

A document fragment.

Objects of this type are an xmlNode.

XML_NOTATION_NODE 

A notation, unused.

XML_HTML_DOCUMENT_NODE 

An HTML document.

Objects of this type are an xmlDoc.

XML_DTD_NODE 

A document type definition.

Objects of this type are an xmlDtd.

XML_ELEMENT_DECL 

An element declaration.

Objects of this type are an xmlElement.

XML_ATTRIBUTE_DECL 

An attribute declaration.

Objects of this type are an xmlAttribute.

XML_ENTITY_DECL 

An entity declaration.

Objects of this type are an xmlEntity.

XML_NAMESPACE_DECL 

An XPath namespace node.

Can only be returned by the XPath engine. Objects of this type are an xmlNs which has a completely different layout than xmlNode. The next member contains a pointer to the xmlNode element to which the namespace applies.

Nodes of this type must be handled with extreme care to avoid type confusion bugs.

XML_XINCLUDE_START 

An XInclude start marker.

Objects of this type are an xmlNode. Inserted as preceding sibling of XIncluded content.

XML_XINCLUDE_END 

An XInclude end marker.

Objects of this type are an xmlNode. Inserted as following sibling of XIncluded content.

Function Documentation

◆  xmlAddChild()

xmlNode * xmlAddChild ( xmlNode * parent,
xmlNode * cur )

Unlink cur and append it to the children of parent.

If cur is a text node, it may be merged with an adjacent text node and freed. In this case the text node containing the merged content is returned.

If cur is an attribute node, it is appended to the attributes of parent. If the attribute list contains an attribute with a name matching cur, the old attribute is destroyed.

Before version 2.13, this function didn't unlink cur before moving it. Callers must unlink the node manually if it has siblings.

General notes:

Move operations like xmlAddChild can cause element or attribute nodes to reference namespaces that aren't declared in one of their ancestors. This can lead to use-after-free errors if the elements containing the declarations are freed later, especially when moving nodes from one document to another. You should consider calling xmlReconciliateNs after a move operation to normalize namespaces. Another option is to call xmlDOMWrapAdoptNode with the target parent before moving a node.

For the most part, move operations don't check whether the resulting tree structure is valid. Users must make sure that parent nodes only receive children of valid types. Inserted child nodes must never be an ancestor of the parent node to avoid cycles in the tree structure. In general, only document, document fragments, elements and attributes should be used as parent nodes.

When moving a node between documents and a memory allocation fails, the node's content will be corrupted and it will be unlinked. In this case, the node must be freed manually.

Moving DTDs between documents isn't supported.

Parameters
parent the parent node
cur the child node
Returns
cur or a sibling if cur was merged. Returns NULL if arguments are invalid or a memory allocation failed.

◆  xmlAddChildList()

xmlNode * xmlAddChildList ( xmlNode * parent,
xmlNode * cur )

Append a node list to another node.

See xmlAddChild.

Parameters
parent the parent node
cur the first node in the list
Returns
the last child or NULL in case of error.

◆  xmlAddNextSibling()

xmlNode * xmlAddNextSibling ( xmlNode * prev,
xmlNode * cur )

Unlinks cur and inserts it as next sibling after prev.

Unlike xmlAddChild this function does not merge text nodes.

If cur is an attribute node, it is inserted after attribute prev. If the attribute list contains an attribute with a name matching cur, the old attribute is destroyed.

See the notes in xmlAddChild.

Parameters
prev the target node
cur the new node
Returns
cur or a sibling if cur was merged. Returns NULL if arguments are invalid or a memory allocation failed.

◆  xmlAddPrevSibling()

xmlNode * xmlAddPrevSibling ( xmlNode * next,
xmlNode * cur )

Unlinks cur and inserts it as previous sibling before next.

Unlike xmlAddChild this function does not merge text nodes.

If cur is an attribute node, it is inserted before attribute next. If the attribute list contains an attribute with a name matching cur, the old attribute is destroyed.

See the notes in xmlAddChild.

Parameters
next the target node
cur the new node
Returns
cur or a sibling if cur was merged. Returns NULL if arguments are invalid or a memory allocation failed.

◆  xmlAddSibling()

xmlNode * xmlAddSibling ( xmlNode * node,
xmlNode * cur )

Unlinks cur and inserts it as last sibling of node.

If cur is a text node, it may be merged with an adjacent text node and freed. In this case the text node containing the merged content is returned.

If cur is an attribute node, it is appended to the attribute list containing node. If the attribute list contains an attribute with a name matching cur, the old attribute is destroyed.

See the notes in xmlAddChild.

Parameters
node the target node
cur the new node
Returns
cur or a sibling if cur was merged. Returns NULL if arguments are invalid or a memory allocation failed.

◆  xmlAttrSerializeTxtContent()

void xmlAttrSerializeTxtContent ( xmlBuffer * buf,
xmlDoc * doc,
xmlAttr * attr,
const xmlChar * string )

Serialize attribute text to an xmlBuffer.

Parameters
buf the XML buffer output
doc the document
attr the attribute node
string the text content

◆  xmlBufContent()

xmlChar * xmlBufContent ( const xmlBuf * buf )

Get pointer into buffer content.

Parameters
buf the buffer
Returns
the internal content or NULL in case of error

◆  xmlBufEnd()

xmlChar * xmlBufEnd ( xmlBuf * buf )

Return a pointer to the end of the buffer content.

Parameters
buf the buffer
Returns
the end of the internal content or NULL in case of error

◆  xmlBufferAdd()

int xmlBufferAdd ( xmlBuffer * buf,
const xmlChar * str,
int len )

Append bytes to a buffer.

If len is -1, str is assumed to be zero-terminated.

Parameters
buf the buffer
str bytes to add
len number of bytes
Returns
an xmlParserErrors code.

◆  xmlBufferAddHead()

int xmlBufferAddHead ( xmlBuffer * buf,
const xmlChar * str,
int len )

Prepend bytes to a buffer.

If len is -1, str is assumed to be zero-terminated.

Parameters
buf the buffer
str bytes to prepend
len number of bytes
Returns
an xmlParserErrors code.

◆  xmlBufferCat()

int xmlBufferCat ( xmlBuffer * buf,
const xmlChar * str )

Append a zero-terminated string to a buffer.

Parameters
buf the buffer
str string to add
Returns
an xmlParserErrors code.

◆  xmlBufferCCat()

int xmlBufferCCat ( xmlBuffer * buf,
const char * str )

Append a zero-terminated C string to a buffer.

Parameters
buf the buffer
str string to add
Returns
an xmlParserErrors code.

◆  xmlBufferContent()

const xmlChar * xmlBufferContent ( const xmlBuffer * buf )

Get pointer into buffer content.

Parameters
buf the buffer
Returns
the internal content

◆  xmlBufferCreate()

xmlBuffer * xmlBufferCreate ( void )

Create a buffer.

The default initial size is 256.

Returns
the new structure.

◆  xmlBufferCreateSize()

xmlBuffer * xmlBufferCreateSize ( size_t size )

Create a buffer with an initial size.

Parameters
size initial size of buffer
Returns
the new structure.

◆  xmlBufferCreateStatic()

xmlBuffer * xmlBufferCreateStatic ( void * mem,
size_t size )

Create a static buffer.

The memory must be zero-terminated and not be modified for the lifetime of the buffer. A static buffer can't be grown, modified or detached, but it can be shrunk.

Parameters
mem the memory area
size the size in bytes
Returns
a new buffer

◆  xmlBufferDetach()

xmlChar * xmlBufferDetach ( xmlBuffer * buf )

Extract buffer content.

Return the contents of the buffer as an xmlChar string, clearing the buffer.

This doesn't work with static buffers as they can't be reset.

Parameters
buf the buffer
Returns
the buffer content

◆  xmlBufferDump()

int xmlBufferDump ( FILE * file,
xmlBuffer * buf )

Dump a buffer to a FILE.

Parameters
file the output file
buf the buffer
Returns
the number of bytes written

◆  xmlBufferEmpty()

void xmlBufferEmpty ( xmlBuffer * buf )

Empty a buffer.

Parameters
buf the buffer

◆  xmlBufferFree()

void xmlBufferFree ( xmlBuffer * buf )

Free a buffer.

Parameters
buf the buffer to free

◆  xmlBufferGrow()

int xmlBufferGrow ( xmlBuffer * buf,
unsigned int len )

Grow a buffer.

Deprecated
Internal function, don't use.
Parameters
buf the buffer
len number of extra bytes to allocate
Returns
the new available space or -1 in case of error

◆  xmlBufferLength()

int xmlBufferLength ( const xmlBuffer * buf )

Get the size of the buffer content.

Parameters
buf the buffer
Returns
the size of the buffer content in bytes

◆  xmlBufferResize()

int xmlBufferResize ( xmlBuffer * buf,
unsigned int size )

Resize a buffer to a minimum size.

Deprecated
Internal function, don't use.
Parameters
buf the buffer to resize
size the desired size
Returns
1 on succes, 0 in case of error

◆  xmlBufferSetAllocationScheme()

void xmlBufferSetAllocationScheme ( xmlBuffer * buf,

Set the allocation scheme of a buffer.

For libxml2 before 2.14, it is recommended to set this to XML_BUFFER_ALLOC_DOUBLE_IT. Has no effect on 2.14 or later.

Parameters
buf the buffer to tune
scheme allocation scheme to use

◆  xmlBufferShrink()

int xmlBufferShrink ( xmlBuffer * buf,
unsigned int len )

Discard bytes at the start of a buffer.

Deprecated
Internal function, don't use.
Parameters
buf the buffer
len the number of bytes to remove
Returns
the number of bytes removed, or -1 in case of failure.

◆  xmlBufferWriteCHAR()

void xmlBufferWriteCHAR ( xmlBuffer * buf,
const xmlChar * string )

Append a zero-terminated xmlChar string to a buffer.

Parameters
buf the XML buffer
string the string to add

◆  xmlBufferWriteChar()

void xmlBufferWriteChar ( xmlBuffer * buf,
const char * string )

Append a zero-terminated C string to a buffer.

Same as xmlBufferCCat.

Parameters
buf the buffer
string the string to add

◆  xmlBufferWriteQuotedString()

void xmlBufferWriteQuotedString ( xmlBuffer * buf,
const xmlChar * string )

Append a quoted string to a buffer.

Append a string quoted with single or double quotes. If the string contains both single and double quotes, double quotes are escaped with &quot;.

Parameters
buf the buffer
string the string to add

◆  xmlBufGetNodeContent()

int xmlBufGetNodeContent ( xmlBuf * buf,
const xmlNode * cur )

Append the string value of a node to buf.

For text nodes, the string value is the text content. Otherwise, the string value is the concatenation of the string values of the node's descendants.

Entity references are substituted.

Parameters
buf a buffer xmlBuf
cur the node being read
Returns
0 in case of success and -1 in case of error.

◆  xmlBufNodeDump()

size_t xmlBufNodeDump ( xmlBuf * buf,
xmlDoc * doc,
xmlNode * cur,
int level,
int format )

Serialize an XML node to an xmlBuf.

Uses the document's encoding. If the document has no encoding, uses ASCII without an encoding declaration.

Note that format only works if the document was parsed with XML_PARSE_NOBLANKS.

Parameters
buf the XML buffer output
doc the document
cur the current node
level the imbrication level for indenting
format is formatting allowed
Returns
the number of bytes written to the buffer, in case of error 0 is returned or buf stores the error

◆  xmlBufShrink()

size_t xmlBufShrink ( xmlBuf * buf,
size_t len )

Discard bytes at the start of a buffer.

NOTE that the return value differs from xmlBufferShrink as it will return 0 on error instead of -1 due to size_t being used as the return type.

Deprecated
Internal function, don't use.
Parameters
buf the buffer
len the number of bytes to remove
Returns
the number of bytes removed or 0 in case of failure

◆  xmlBufUse()

size_t xmlBufUse ( xmlBuf * buf )

Return the size of the buffer content.

Parameters
buf the buffer
Returns
size of buffer content in bytes

◆  xmlBuildQName()

xmlChar * xmlBuildQName ( const xmlChar * ncname,
const xmlChar * prefix,
xmlChar * memory,
int len )

Build a QName from prefix and local name.

Builds the QName prefix:ncname in memory if there is enough space and prefix is not NULL nor empty, otherwise allocate a new string. If prefix is NULL or empty it returns ncname.

Parameters
ncname the Name
prefix the prefix
memory preallocated memory
len preallocated memory length
Returns
the new string which must be freed by the caller if different from memory and ncname or NULL in case of error

◆  xmlChildElementCount()

unsigned long xmlChildElementCount ( xmlNode * parent )

Count the number of child nodes which are elements.

Note that entity references are not expanded.

Parameters
parent the parent node
Returns
the number of element children or 0 if arguments are invalid.

◆  xmlCopyDoc()

xmlDoc * xmlCopyDoc ( xmlDoc * doc,
int recursive )

Copy a document.

If recursive, the content tree will be copied too as well as DTD, namespaces and entities.

Parameters
doc the document
recursive if not zero do a recursive copy.
Returns
the copied document or NULL if a memory allocation failed.

◆  xmlCopyDtd()

xmlDtd * xmlCopyDtd ( xmlDtd * dtd )

Copy a DTD.

Parameters
dtd the DTD
Returns
the copied DTD or NULL if a memory allocation failed.

◆  xmlCopyNamespace()

xmlNs * xmlCopyNamespace ( xmlNs * cur )

Copy a namespace.

Parameters
cur the namespace
Returns
the copied namespace or NULL if a memory allocation failed.

◆  xmlCopyNamespaceList()

xmlNs * xmlCopyNamespaceList ( xmlNs * cur )

Copy a namespace list.

Parameters
cur the first namespace
Returns
the head of the copied list or NULL if a memory allocation failed.

◆  xmlCopyNode()

xmlNode * xmlCopyNode ( xmlNode * node,
int extended )

Copy a node.

If extended is 0, make a shallow copy.

If extended is 1, make a deep copy (properties, namespaces and children when applicable).

If extended is 2, make a shallow copy including properties and namespaces of elements.

Use of this function is DISCOURAGED in favor of xmlDocCopyNode.

Parameters
node the node
extended mode of operation
Returns
the copied node or NULL if a memory allocation failed.

◆  xmlCopyNodeList()

xmlNode * xmlCopyNodeList ( xmlNode * node )

Copy a node list and all children.

Use of this function is DISCOURAGED in favor of xmlDocCopyNodeList.

Parameters
node the first node in the list.
Returns
the head of the copied list or NULL if a memory allocation failed.

◆  xmlCopyProp()

xmlAttr * xmlCopyProp ( xmlNode * target,
xmlAttr * cur )

Create a copy of the attribute.

This function sets the parent pointer of the copy to target but doesn't set the attribute on the target element. Users should consider to set the attribute by calling xmlAddChild afterwards or reset the parent pointer to NULL.

Parameters
target the element where the attribute will be grafted
cur the attribute
Returns
the copied attribute or NULL if a memory allocation failed.

◆  xmlCopyPropList()

xmlAttr * xmlCopyPropList ( xmlNode * target,
xmlAttr * cur )

Create a copy of an attribute list.

This function sets the parent pointers of the copied attributes to target but doesn't set the attributes on the target element.

Parameters
target the element where the attributes will be grafted
cur the first attribute
Returns
the head of the copied list or NULL if a memory allocation failed.

◆  xmlCreateIntSubset()

xmlDtd * xmlCreateIntSubset ( xmlDoc * doc,
const xmlChar * name,
const xmlChar * publicId,
const xmlChar * systemId )

Create a DTD node.

If a document is provided and it already has an internal subset, the existing DTD object is returned without creating a new object. If the document has no internal subset, it will be set to the created DTD.

Parameters
doc the document pointer (optional)
name the DTD name (optional)
publicId public identifier of the DTD (optional)
systemId system identifier (URL) of the DTD (optional)
Returns
a pointer to the new or existing DTD object or NULL if arguments are invalid or a memory allocation failed.

◆  xmlDeregisterNodeDefault()

xmlDeregisterNodeFunc xmlDeregisterNodeDefault ( xmlDeregisterNodeFunc func )

Registers a callback for node destruction.

Deprecated
don't use
Parameters
func function pointer to the new DeregisterNodeFunc
Returns
the previous value of the deregistration function

◆  xmlDocCopyNode()

xmlNode * xmlDocCopyNode ( xmlNode * node,
xmlDoc * doc,
int extended )

Copy a node into another document.

If extended is 0, make a shallow copy.

If extended is 1, make a deep copy (properties, namespaces and children when applicable).

If extended is 2, make a shallow copy including properties and namespaces of elements.

Parameters
node the node
doc the document
extended mode of operation
Returns
the copied node or NULL if a memory allocation failed.

◆  xmlDocCopyNodeList()

xmlNode * xmlDocCopyNodeList ( xmlDoc * doc,
xmlNode * node )

Copy a node list and all children into a new document.

Parameters
doc the target document
node the first node in the list.
Returns
the head of the copied list or NULL if a memory allocation failed.

◆  xmlDocDump()

int xmlDocDump ( FILE * f,
xmlDoc * cur )

Serialize an XML document to a FILE.

Uses the document's encoding. If the document has no encoding, uses ASCII without an encoding declaration.

Parameters
f the FILE*
cur the document
Returns
the number of bytes written or -1 in case of failure.

◆  xmlDocDumpFormatMemory()

void xmlDocDumpFormatMemory ( xmlDoc * cur,
xmlChar ** mem,
int * size,
int format )

Same as xmlDocDumpFormatMemoryEnc with encoding set to NULL.

Parameters
cur the document
mem OUT: the memory pointer
size OUT: the memory length
format should formatting spaces been added

◆  xmlDocDumpFormatMemoryEnc()

void xmlDocDumpFormatMemoryEnc ( xmlDoc * out_doc,
xmlChar ** doc_txt_ptr,
int * doc_txt_len,
const char * txt_encoding,
int format )

Serialize an XML document to memory.

If encoding is NULL, uses the document's encoding. If the document has no encoding, serializes as ASCII without an encoding declaration.

It is up to the caller of this function to free the returned memory with xmlFree.

Note that format only works if the document was parsed with XML_PARSE_NOBLANKS.

Parameters
out_doc Document to generate XML text from
doc_txt_ptr Memory pointer for allocated XML text
doc_txt_len Length of the generated XML text
txt_encoding Character encoding to use when generating XML text
format should formatting spaces been added

◆  xmlDocDumpMemory()

void xmlDocDumpMemory ( xmlDoc * cur,
xmlChar ** mem,
int * size )

Same as xmlDocDumpFormatMemoryEnc with encoding set to NULL and format set to 0.

Parameters
cur the document
mem OUT: the memory pointer
size OUT: the memory length

◆  xmlDocDumpMemoryEnc()

void xmlDocDumpMemoryEnc ( xmlDoc * out_doc,
xmlChar ** doc_txt_ptr,
int * doc_txt_len,
const char * txt_encoding )

Same as xmlDocDumpFormatMemoryEnc with format set to 0.

Parameters
out_doc Document to generate XML text from
doc_txt_ptr Memory pointer for allocated XML text
doc_txt_len Length of the generated XML text
txt_encoding Character encoding to use when generating XML text

◆  xmlDocFormatDump()

int xmlDocFormatDump ( FILE * f,
xmlDoc * cur,
int format )

Serialize an XML document to a FILE.

Uses the document's encoding. If the document has no encoding, uses ASCII without an encoding declaration.

Note that format only works if the document was parsed with XML_PARSE_NOBLANKS.

Parameters
f the FILE*
cur the document
format should formatting spaces been added
Returns
the number of bytes written or -1 in case of failure.

◆  xmlDocGetRootElement()

xmlNode * xmlDocGetRootElement ( const xmlDoc * doc )

Get the root element of the document.

Searches the document's children for the root element. The first child is not necessarily the root element, but could also be a DTD, comment or PI.

Parameters
doc the document
Returns
the root element or NULL if no element was found.

◆  xmlDocSetRootElement()

xmlNode * xmlDocSetRootElement ( xmlDoc * doc,
xmlNode * root )

If root is NULL no action is taken.

To remove a node from a document, use xmlUnlinkNode instead.

Set the root element of the document (doc->children is a list containing possibly comments, PIs, etc ...).

root must be an element node. It is unlinked before insertion.

Parameters
doc the document
root the new document root element
Returns
the unlinked old root element or NULL if the document didn't have a root element or a memory allocation failed.

◆  xmlDOMWrapAdoptNode()

int xmlDOMWrapAdoptNode ( xmlDOMWrapCtxt * ctxt,
xmlDoc * sourceDoc,
xmlNode * node,
xmlDoc * destDoc,
xmlNode * destParent,
int options )

Fix up namespaces before moving a node.

References of out-of scope ns-decls are remapped to point to destDoc: If destParent is given, then nsDef entries on element-nodes are used. If no destParent is given, then destDoc->oldNs entries are used This is the case when you have an unlinked node and just want to move it to the context of.

If destParent is given, it ensures that the tree is namespace wellformed by creating additional ns-decls where needed. Note that, since prefixes of already existent ns-decls can be shadowed by this process, it could break QNames in attribute values or element content.

NOTE: This function was not intensively tested.

Parameters
ctxt the optional context for custom processing
sourceDoc the optional sourceDoc
node the node to start with
destDoc the destination doc
destParent the optional new parent of node in destDoc
options option flags
Returns
0 if the operation succeeded, 1 if a node of unsupported type was given, 2 if a node of not yet supported type was given and -1 on API/internal errors.

◆  xmlDOMWrapCloneNode()

int xmlDOMWrapCloneNode ( xmlDOMWrapCtxt * ctxt,
xmlDoc * sourceDoc,
xmlNode * node,
xmlNode ** resNode,
xmlDoc * destDoc,
xmlNode * destParent,
int deep,
int options )

Clone a node and fix namespaces.

References of out-of scope ns-decls are remapped to point to destDoc. If destParent is given, then nsDef entries on element-nodes are used. If no destParent is given, then destDoc->oldNs entries are used. This is the case when you don't know already where the cloned branch will be added to.

If destParent is given, it ensures that the tree is namespace wellformed by creating additional ns-decls where needed. Note that, since prefixes of already existent ns-decls can be shadowed by this process, it could break QNames in attribute values or element content.

Parameters
ctxt the optional context for custom processing
sourceDoc the optional sourceDoc
node the node to start with
resNode the clone of the given node
destDoc the destination doc
destParent the optional new parent of node in destDoc
deep descend into child if set
options option flags
Returns
0 if the operation succeeded, 1 if a node of unsupported (or not yet supported) type was given, -1 on API/internal errors.

◆  xmlDOMWrapFreeCtxt()

void xmlDOMWrapFreeCtxt ( xmlDOMWrapCtxt * ctxt )

Frees the DOM-wrapper context.

Parameters
ctxt the DOM-wrapper context

◆  xmlDOMWrapNewCtxt()

xmlDOMWrapCtxt * xmlDOMWrapNewCtxt ( void )

Allocates and initializes a new DOM-wrapper context.

Returns
the xmlDOMWrapCtxt or NULL in case of an internal error.

◆  xmlDOMWrapReconcileNamespaces()

int xmlDOMWrapReconcileNamespaces ( xmlDOMWrapCtxt * ctxt,
xmlNode * elem,
int options )

Fix up namespaces.

Ensures that ns-references point to ns-decls hold on element-nodes. Ensures that the tree is namespace wellformed by creating additional ns-decls where needed. Note that, since prefixes of already existent ns-decls can be shadowed by this process, it could break QNames in attribute values or element content.

NOTE: This function was not intensively tested.

Parameters
ctxt DOM wrapper context, unused at the moment
elem the element-node
options option flags
Returns
0 if succeeded, -1 otherwise and on API/internal errors.

◆  xmlDOMWrapRemoveNode()

int xmlDOMWrapRemoveNode ( xmlDOMWrapCtxt * ctxt,
xmlDoc * doc,
xmlNode * node,
int options )

Unlinks the given node from its owner.

This will substitute ns-references to node->nsDef for ns-references to doc->oldNs, thus ensuring the removed branch to be autark wrt ns-references.

NOTE: This function was not intensively tested.

Parameters
ctxt a DOM wrapper context
doc the doc
node the node to be removed.
options set of options, unused at the moment
Returns
0 on success, 1 if the node is not supported, -1 on API and internal errors.

◆  xmlElemDump()

void xmlElemDump ( FILE * f,
xmlDoc * doc,
xmlNode * cur )

Serialize an XML node to a FILE.

Uses the document's encoding. If the document has no encoding, uses ASCII without an encoding declaration.

Parameters
f the FILE * for the output
doc the document
cur the current node

◆  xmlFirstElementChild()

xmlNode * xmlFirstElementChild ( xmlNode * parent )

Find the first child node which is an element.

Note that entity references are not expanded.

Parameters
parent the parent node
Returns
the first element or NULL if parent has no children.

◆  xmlFreeDoc()

void xmlFreeDoc ( xmlDoc * cur )

Free a document including all children and associated DTDs.

Parameters
cur pointer to the document

◆  xmlFreeDtd()

void xmlFreeDtd ( xmlDtd * cur )

Free a DTD structure.

Parameters
cur the DTD structure to free up

◆  xmlFreeNode()

void xmlFreeNode ( xmlNode * cur )

Free a node including all the children.

This doesn't unlink the node from the tree. Call xmlUnlinkNode first unless cur is a root node.

Parameters
cur the node

◆  xmlFreeNodeList()

void xmlFreeNodeList ( xmlNode * cur )

Free a node list including all children.

Parameters
cur the first node in the list

◆  xmlFreeNs()

void xmlFreeNs ( xmlNs * cur )

Free an xmlNs object.

Parameters
cur the namespace pointer

◆  xmlFreeNsList()

void xmlFreeNsList ( xmlNs * cur )

Free a list of xmlNs objects.

Parameters
cur the first namespace pointer

◆  xmlFreeProp()

void xmlFreeProp ( xmlAttr * cur )

Free an attribute including all children.

Parameters
cur an attribute

◆  xmlFreePropList()

void xmlFreePropList ( xmlAttr * cur )

Free an attribute list including all children.

Parameters
cur the first attribute in the list

◆  xmlGetBufferAllocationScheme()

xmlBufferAllocationScheme xmlGetBufferAllocationScheme ( void )

Get the buffer allocation scheme.

Deprecated
Allocation schemes were removed.
Returns
the current allocation scheme

◆  xmlGetCompressMode()

int xmlGetCompressMode ( void )

Get the global compression level, ZLIB based.

Deprecated
Use xmlGetDocCompressMode
Returns
0 (uncompressed) to 9 (max compression)

◆  xmlGetDocCompressMode()

int xmlGetDocCompressMode ( const xmlDoc * doc )

Get the compression level of a document, ZLIB based.

Parameters
doc the document
Returns
0 (uncompressed) to 9 (max compression)

◆  xmlGetIntSubset()

xmlDtd * xmlGetIntSubset ( const xmlDoc * doc )

Get the internal subset of a document.

Parameters
doc the document pointer
Returns
a pointer to the DTD object or NULL if not found.

◆  xmlGetLastChild()

xmlNode * xmlGetLastChild ( const xmlNode * parent )

Find the last child of a node.

Parameters
parent the parent node
Returns
the last child or NULL if parent has no children.

◆  xmlGetLineNo()

long xmlGetLineNo ( const xmlNode * node )

Get line number of node.

Try to work around the limitation of line numbers being stored as 16 bits ints. Requires xmlParserOption XML_PARSE_BIG_LINES to be set when parsing.

Parameters
node valid node
Returns
the line number if successful, -1 otherwise

◆  xmlGetNodePath()

xmlChar * xmlGetNodePath ( const xmlNode * node )

Build a structure based Path for the given node.

Parameters
node a node
Returns
the new path or NULL in case of error. The caller must free the returned string

◆  xmlGetNoNsProp()

xmlChar * xmlGetNoNsProp ( const xmlNode * node,
const xmlChar * name )

Look up the value of an element's attribute.

Entities are substituted. The returned value must be freed by the caller.

This function looks in DTD attribute declarations for #FIXED or default declaration values.

This function is similar to xmlGetProp except it will accept only an attribute in no namespace.

NOTE: This function doesn't allow to distinguish malloc failures from missing attributes. It's more robust to use xmlNodeGetAttrValue.

Parameters
node the element
name the attribute name
Returns
the attribute value or NULL if not found or a memory allocation failed.

◆  xmlGetNsList()

xmlNs ** xmlGetNsList ( const xmlDoc * doc,
const xmlNode * node )

Find all in-scope namespaces of a node.

Use xmlGetNsListSafe for better error reporting.

Parameters
doc the document
node the current node
Returns
a NULL terminated array of namespace pointers that must be freed by the caller or NULL if no namespaces were found or a memory allocation failed.

◆  xmlGetNsListSafe()

int xmlGetNsListSafe ( const xmlDoc * doc,
const xmlNode * node,
xmlNs *** out )

Find all in-scope namespaces of a node.

out returns a NULL terminated array of namespace pointers that must be freed by the caller.

Since
2.13.0
Parameters
doc the document
node the current node
out the returned namespace array
Returns
0 on success, 1 if no namespaces were found, -1 if a memory allocation failed.

◆  xmlGetNsProp()

xmlChar * xmlGetNsProp ( const xmlNode * node,
const xmlChar * name,
const xmlChar * nameSpace )

Look up the value of an element's attribute.

The attribute has to match the specified namespace. A namespace of NULL means that the attribute must have no namespace.

Entities are substituted. The returned value must be freed by the caller.

This function looks in DTD attribute declaration for #FIXED or default declaration values.

NOTE: This function doesn't allow to distinguish malloc failures from missing attributes. It's more robust to use xmlNodeGetAttrValue.

Parameters
node the element
name the attribute name
nameSpace the URI of the namespace
Returns
the attribute value or NULL if not found or a memory allocation failed.

◆  xmlGetProp()

xmlChar * xmlGetProp ( const xmlNode * node,
const xmlChar * name )

Look up the value of an element's attribute.

Entities are substituted. The returned value must be freed by the caller.

This function looks in DTD attribute declarations for #FIXED or default declaration values.

NOTE: This function is ignores namespaces. Use xmlGetNsProp or xmlGetNoNsProp for namespace aware processing.

NOTE: This function doesn't allow to distinguish malloc failures from missing attributes.

Parameters
node the element
name the attribute name
Returns
the attribute value or NULL if not found or a memory allocation failed.

◆  xmlHasNsProp()

xmlAttr * xmlHasNsProp ( const xmlNode * node,
const xmlChar * name,
const xmlChar * nameSpace )

Search for an attribute of an element.

The attribute has to match the specified namespace. A namespace of NULL means that the attribute must have no namespace.

This function also looks in DTD attribute declaration for #FIXED or default declaration values.

Parameters
node the element
name the attribute name
nameSpace the URI of the namespace
Returns
the attribute or the attribute declaration or NULL if neither was found. Also returns NULL if a memory allocation failed making this function unreliable.

◆  xmlHasProp()

xmlAttr * xmlHasProp ( const xmlNode * node,
const xmlChar * name )

Search for an attribute of an element.

This function also looks in DTD attribute declaration for #FIXED or default declaration values.

Parameters
node the element
name the attribute name
Returns
the attribute or the attribute declaration or NULL if neither was found. Also returns NULL if a memory allocation failed, making this function unreliable.

◆  xmlIsBlankNode()

int xmlIsBlankNode ( const xmlNode * node )

Checks whether this node is an empty or whitespace-only text node.

Parameters
node the node
Returns
1 if yes, 0 if no

◆  xmlIsXHTML()

int xmlIsXHTML ( const xmlChar * systemID,
const xmlChar * publicID )

Try to find if the document correspond to an XHTML DTD.

Parameters
systemID the system identifier
publicID the public identifier
Returns
1 if true, 0 if not and -1 in case of error

◆  xmlLastElementChild()

xmlNode * xmlLastElementChild ( xmlNode * parent )

Find the last child node which is an element.

Note that entity references are not expanded.

Parameters
parent the parent node
Returns
the last element or NULL if parent has no children.

◆  xmlNewCDataBlock()

xmlNode * xmlNewCDataBlock ( xmlDoc * doc,
const xmlChar * content,
int len )

Create a CDATA section node.

Parameters
doc the target document (optional)
content raw text content (optional)
len size of text content
Returns
a pointer to the new node object or NULL if a memory allocation failed.

◆  xmlNewCharRef()

xmlNode * xmlNewCharRef ( xmlDoc * doc,
const xmlChar * name )

Create an empty entity reference node.

This function is MISNAMED. It doesn't create a character reference but an entity reference.

This function doesn't attempt to look up the entity in doc.

Entity names like &entity; are handled as well.

Parameters
doc the target document (optional)
name the entity name
Returns
a pointer to the new node object or NULL if arguments are invalid or a memory allocation failed.

◆  xmlNewChild()

xmlNode * xmlNewChild ( xmlNode * parent,
xmlNs * ns,
const xmlChar * name,
const xmlChar * content )

Create a new child element and append it to a parent element.

If ns is NULL, the newly created element inherits the namespace of the parent.

If provided, content is expected to be a valid XML attribute value possibly containing character and entity references. Text and entity reference node will be added to the child element, see xmlNewDocNode.

Parameters
parent the parent node
ns a namespace (optional)
name the name of the child
content text content with XML references (optional)
Returns
a pointer to the new node object or NULL if arguments are invalid or a memory allocation failed.

◆  xmlNewComment()

xmlNode * xmlNewComment ( const xmlChar * content )

Use of this function is DISCOURAGED in favor of xmlNewDocComment.

Create a comment node.

Parameters
content the comment content (optional)
Returns
a pointer to the new node object or NULL if a memory allocation failed.

◆  xmlNewDoc()

xmlDoc * xmlNewDoc ( const xmlChar * version )

Creates a new XML document.

If version is NULL, "1.0" is used.

Parameters
version XML version string like "1.0" (optional)
Returns
a new document or NULL if a memory allocation failed.

◆  xmlNewDocComment()

xmlNode * xmlNewDocComment ( xmlDoc * doc,
const xmlChar * content )

Create a comment node.

Parameters
doc the document
content the comment content
Returns
a pointer to the new node object or NULL if a memory allocation failed.

◆  xmlNewDocFragment()

xmlNode * xmlNewDocFragment ( xmlDoc * doc )

Create a document fragment node.

Parameters
doc the target document (optional)
Returns
a pointer to the new node object or NULL if a memory allocation failed.

◆  xmlNewDocNode()

xmlNode * xmlNewDocNode ( xmlDoc * doc,
xmlNs * ns,
const xmlChar * name,
const xmlChar * content )

Create an element node.

If provided, content is expected to be a valid XML attribute value possibly containing character and entity references. Syntax errors and references to undeclared entities are ignored silently. Only references are handled, nested elements, comments or PIs are not. See xmlNewDocRawNode for an alternative.

General notes on object creation:

Each node and all its children are associated with the same document. The document should be provided when creating nodes to avoid a performance penalty when adding the node to a document tree. Note that a document only owns nodes reachable from the root node. Unlinked subtrees must be freed manually.

Parameters
doc the target document
ns namespace (optional)
name the node name
content text content with XML references (optional)
Returns
a pointer to the new node object or NULL if arguments are invalid or a memory allocation failed.

◆  xmlNewDocNodeEatName()

xmlNode * xmlNewDocNodeEatName ( xmlDoc * doc,
xmlNs * ns,
xmlChar * name,
const xmlChar * content )

Create an element node.

Like xmlNewDocNode, but the name string will be used directly without making a copy. Takes ownership of name which will also be freed on error.

Parameters
doc the target document
ns namespace (optional)
name the node name
content text content with XML references (optional)
Returns
a pointer to the new node object or NULL if arguments are invalid or a memory allocation failed.

◆  xmlNewDocPI()

xmlNode * xmlNewDocPI ( xmlDoc * doc,
const xmlChar * name,
const xmlChar * content )

Create a processing instruction object.

Parameters
doc the target document (optional)
name the processing instruction target
content the PI content (optional)
Returns
a pointer to the new node object or NULL if arguments are invalid or a memory allocation failed.

◆  xmlNewDocProp()

xmlAttr * xmlNewDocProp ( xmlDoc * doc,
const xmlChar * name,
const xmlChar * value )

Create an attribute node.

If provided, value is expected to be a valid XML attribute value possibly containing character and entity references. Syntax errors and references to undeclared entities are ignored silently. If you want to pass a raw string, see xmlNewProp.

Parameters
doc the target document (optional)
name the name of the attribute
value attribute value with XML references (optional)
Returns
a pointer to the attribute or NULL if arguments are invalid or a memory allocation failed.

◆  xmlNewDocRawNode()

xmlNode * xmlNewDocRawNode ( xmlDoc * doc,
xmlNs * ns,
const xmlChar * name,
const xmlChar * content )

Create an element node.

If provided, value should be a raw, unescaped string.

Parameters
doc the target document
ns namespace (optional)
name the node name
content raw text content (optional)
Returns
a pointer to the new node object or NULL if arguments are invalid or a memory allocation failed.

◆  xmlNewDocText()

xmlNode * xmlNewDocText ( const xmlDoc * doc,
const xmlChar * content )

Create a new text node.

Parameters
doc the target document
content raw text content (optional)
Returns
a pointer to the new node object or NULL if a memory allocation failed.

◆  xmlNewDocTextLen()

xmlNode * xmlNewDocTextLen ( xmlDoc * doc,
const xmlChar * content,
int len )

Create a new text node.

Parameters
doc the target document
content raw text content (optional)
len size of text content
Returns
a pointer to the new node object or NULL if a memory allocation failed.

◆  xmlNewDtd()

xmlDtd * xmlNewDtd ( xmlDoc * doc,
const xmlChar * name,
const xmlChar * publicId,
const xmlChar * systemId )

Create a DTD node.

If a document is provided, it is an error if it already has an external subset. If the document has no external subset, it will be set to the created DTD.

To create an internal subset, use xmlCreateIntSubset.

Parameters
doc the document pointer (optional)
name the DTD name (optional)
publicId public identifier of the DTD (optional)
systemId system identifier (URL) of the DTD (optional)
Returns
a pointer to the new DTD object or NULL if arguments are invalid or a memory allocation failed.

◆  xmlNewNode()

xmlNode * xmlNewNode ( xmlNs * ns,
const xmlChar * name )

Create an element node.

Use of this function is DISCOURAGED in favor of xmlNewDocNode.

Parameters
ns namespace (optional)
name the node name
Returns
a pointer to the new node object or NULL if arguments are invalid or a memory allocation failed.

◆  xmlNewNodeEatName()

xmlNode * xmlNewNodeEatName ( xmlNs * ns,
xmlChar * name )

Create an element node.

Use of this function is DISCOURAGED in favor of xmlNewDocNodeEatName.

Like xmlNewNode, but the name string will be used directly without making a copy. Takes ownership of name which will also be freed on error.

Parameters
ns namespace (optional)
name the node name
Returns
a pointer to the new node object or NULL if arguments are invalid or a memory allocation failed.

◆  xmlNewNs()

xmlNs * xmlNewNs ( xmlNode * node,
const xmlChar * href,
const xmlChar * prefix )

Create a new namespace.

For a default namespace, prefix should be NULL. The namespace URI in href is not checked. You should make sure to pass a valid URI.

If node is provided, it must be an element node. The namespace will be appended to the node's namespace declarations. It is an error if the node already has a definition for the prefix or default namespace.

Parameters
node the element carrying the namespace (optional)
href the URI associated
prefix the prefix for the namespace (optional)
Returns
a new namespace pointer or NULL if arguments are invalid, the prefix is already in use or a memory allocation failed.

◆  xmlNewNsProp()

xmlAttr * xmlNewNsProp ( xmlNode * node,
xmlNs * ns,
const xmlChar * name,
const xmlChar * value )

Create an attribute node.

If provided, value should be a raw, unescaped string.

If node is provided, the created attribute will be appended without checking for duplicate names. It is an error if node is not an element.

Parameters
node the parent node (optional)
ns the namespace (optional)
name the local name of the attribute
value the value of the attribute (optional)
Returns
a pointer to the attribute or NULL if arguments are invalid or a memory allocation failed.

◆  xmlNewNsPropEatName()

xmlAttr * xmlNewNsPropEatName ( xmlNode * node,
xmlNs * ns,
xmlChar * name,
const xmlChar * value )

Create an attribute node.

Like xmlNewNsProp, but the name string will be used directly without making a copy. Takes ownership of name which will also be freed on error.

Parameters
node the parent node (optional)
ns the namespace (optional)
name the local name of the attribute
value the value of the attribute (optional)
Returns
a pointer to the attribute or NULL if arguments are invalid or a memory allocation failed.

◆  xmlNewPI()

xmlNode * xmlNewPI ( const xmlChar * name,
const xmlChar * content )

Create a processing instruction node.

Use of this function is DISCOURAGED in favor of xmlNewDocPI.

Parameters
name the processing instruction target
content the PI content (optional)
Returns
a pointer to the new node object or NULL if arguments are invalid or a memory allocation failed.

◆  xmlNewProp()

xmlAttr * xmlNewProp ( xmlNode * node,
const xmlChar * name,
const xmlChar * value )

Create an attribute node.

If provided, value should be a raw, unescaped string.

If node is provided, the created attribute will be appended without checking for duplicate names. It is an error if node is not an element.

Parameters
node the parent node (optional)
name the name of the attribute
value the value of the attribute (optional)
Returns
a pointer to the attribute or NULL if arguments are invalid or a memory allocation failed.

◆  xmlNewReference()

xmlNode * xmlNewReference ( const xmlDoc * doc,
const xmlChar * name )

Create a new entity reference node, linking the result with the entity in doc if found.

Entity names like &entity; are handled as well.

Parameters
doc the target document (optional)
name the entity name
Returns
a pointer to the new node object or NULL if arguments are invalid or a memory allocation failed.

◆  xmlNewText()

xmlNode * xmlNewText ( const xmlChar * content )

Create a text node.

Use of this function is DISCOURAGED in favor of xmlNewDocText.

Parameters
content raw text content (optional)
Returns
a pointer to the new node object or NULL if a memory allocation failed.

◆  xmlNewTextChild()

xmlNode * xmlNewTextChild ( xmlNode * parent,
xmlNs * ns,
const xmlChar * name,
const xmlChar * content )

Create a new child element and append it to a parent element.

If ns is NULL, the newly created element inherits the namespace of the parent.

If content is provided, a text node will be added to the child element, see xmlNewDocRawNode.

Parameters
parent the parent node
ns a namespace (optional)
name the name of the child
content raw text content of the child (optional)
Returns
a pointer to the new node object or NULL if arguments are invalid or a memory allocation failed.

◆  xmlNewTextLen()

xmlNode * xmlNewTextLen ( const xmlChar * content,
int len )

Create a new text node.

Use of this function is DISCOURAGED in favor of xmlNewDocTextLen.

Parameters
content raw text content (optional)
len size of text content
Returns
a pointer to the new node object or NULL if a memory allocation failed.

◆  xmlNextElementSibling()

xmlNode * xmlNextElementSibling ( xmlNode * node )

Find the closest following sibling which is a element.

Note that entity references are not expanded.

Parameters
node the current node
Returns
the sibling or NULL if no sibling was found.

◆  xmlNodeAddContent()

int xmlNodeAddContent ( xmlNode * cur,
const xmlChar * content )

Append the extra substring to the node content.

NOTE: In contrast to xmlNodeSetContent, content is supposed to be raw text, so unescaped XML special chars are allowed, entity references are not supported.

This doesn't work on attributes before version 2.15.

Parameters
cur the node being modified
content extra content
Returns
0 on success, 1 on error, -1 if a memory allocation failed.

◆  xmlNodeAddContentLen()

int xmlNodeAddContentLen ( xmlNode * cur,
const xmlChar * content,
int len )

Append the extra substring to the node content.

NOTE: In contrast to xmlNodeSetContentLen, content is supposed to be raw text, so unescaped XML special chars are allowed, entity references are not supported.

This doesn't work on attributes before version 2.15.

Parameters
cur the node being modified
content extra content
len the size of content
Returns
0 on success, 1 on error, -1 if a memory allocation failed.

◆  xmlNodeBufGetContent()

int xmlNodeBufGetContent ( xmlBuffer * buffer,
const xmlNode * cur )

Append the string value of a node to buffer.

For text nodes, the string value is the text content. Otherwise, the string value is the concatenation of the string values of the node's descendants.

Entity references are substituted.

Parameters
buffer a buffer
cur the node being read
Returns
0 in case of success and -1 in case of error.

◆  xmlNodeDump()

int xmlNodeDump ( xmlBuffer * buf,
xmlDoc * doc,
xmlNode * cur,
int level,
int format )

Serialize an XML node to an xmlBuffer.

Uses the document's encoding. If the document has no encoding, uses ASCII without an encoding declaration.

Note that format only works if the document was parsed with XML_PARSE_NOBLANKS.

Since this is using xmlBuffer structures it is limited to 2GB and somewhat deprecated, use xmlNodeDumpOutput instead.

Parameters
buf the XML buffer output
doc the document
cur the current node
level the initial indenting level
format is formatting allowed
Returns
the number of bytes written to the buffer or -1 in case of error

◆  xmlNodeDumpOutput()

void xmlNodeDumpOutput ( xmlOutputBuffer * buf,
xmlDoc * doc,
xmlNode * cur,
int level,
int format,
const char * encoding )

Serialize an XML node to an output buffer.

If encoding is NULL, uses the document's encoding. If the document has no encoding, serializes as ASCII without an encoding declaration.

Note that format only works if the document was parsed with XML_PARSE_NOBLANKS.

Parameters
buf the XML buffer output
doc the document
cur the current node
level the imbrication level for indenting
format is formatting allowed
encoding an optional encoding string

◆  xmlNodeGetAttrValue()

int xmlNodeGetAttrValue ( const xmlNode * node,
const xmlChar * name,
const xmlChar * nsUri,
xmlChar ** out )

Look up the value of an element's attribute.

The attribute has to match the specified namespace. A namespace of NULL means that the attribute must have no namespace.

Entities are substituted. The returned value must be freed by the caller.

Since
2.13.0
Parameters
node the element
name the attribute name
nsUri the URI of the namespace
out the returned string
Returns
0 on success, 1 if no attribute was found, -1 if a memory allocation failed.

◆  xmlNodeGetBase()

xmlChar * xmlNodeGetBase ( const xmlDoc * doc,
const xmlNode * cur )

See xmlNodeGetBaseSafe.

This function doesn't allow to distinguish memory allocation failures from a non-existing base.

Parameters
doc the document the node pertains to
cur the node being checked
Returns
a pointer to the base URL, or NULL if not found It's up to the caller to free the memory with xmlFree.

◆  xmlNodeGetBaseSafe()

int xmlNodeGetBaseSafe ( const xmlDoc * doc,
const xmlNode * cur,
xmlChar ** baseOut )

Searches for the base URI.

The code should work on both XML and HTML document even if base mechanisms are completely different. It returns the base as defined in RFC 2396 sections "5.1.1. Base URI within Document Content" and "5.1.2. Base URI from the Encapsulating Entity". However it does not return the document base (5.1.3), use doc->URL in this case.

Since
2.13.0
Parameters
doc the document the node pertains to
cur the node being checked
baseOut pointer to base
Returns
0 in case of success, 1 if a URI or argument is invalid, -1 if a memory allocation failed.

◆  xmlNodeGetContent()

xmlChar * xmlNodeGetContent ( const xmlNode * cur )

Returns the string value of a node.

For text nodes, the string value is the text content. Otherwise, the string value is the concatenation of the string values of the node's descendants.

Entity references are substituted.

It's up to the caller to free the result with xmlFree.

Parameters
cur the node being read
Returns
a new string or NULL if arguments are invalid or a memory allocation failed.

◆  xmlNodeGetLang()

xmlChar * xmlNodeGetLang ( const xmlNode * cur )

Find the xml:lang of a node.

Look up the value of the xml:lang attribute or the one carried by the nearest ancestor.

Parameters
cur the node being checked
Returns
a pointer to the lang value, or NULL if not found It's up to the caller to free the memory with xmlFree.

◆  xmlNodeGetSpacePreserve()

int xmlNodeGetSpacePreserve ( const xmlNode * cur )

Find the xml:space of a node.

Look up the value of the xml:space attribute or the one carried by the nearest ancestor.

Parameters
cur the node being checked
Returns
-1 if xml:space is not inherited, 0 if "default", 1 if "preserve"

◆  xmlNodeIsText()

int xmlNodeIsText ( const xmlNode * node )

Check whether the node is a text node.

Parameters
node the node
Returns
1 if yes, 0 if no

◆  xmlNodeListGetRawString()

xmlChar * xmlNodeListGetRawString ( const xmlDoc * doc,
const xmlNode * list,
int inLine )

Serializes attribute children (text and entity reference nodes) into a string.

If inLine is true, entity references will be substituted. Otherwise, entity references will be kept and special characters like & will be escaped. See xmlEncodeSpecialChars for details.

Parameters
doc a document (unused)
list a node list of attribute children
inLine whether entity references are substituted
Returns
a string or NULL if a memory allocation failed.

◆  xmlNodeListGetString()

xmlChar * xmlNodeListGetString ( xmlDoc * doc,
const xmlNode * list,
int inLine )

Serializes attribute children (text and entity reference nodes) into a string.

If inLine is true, entity references will be substituted. Otherwise, entity references will be kept and special characters like & as well as non-ASCII chars will be escaped. See xmlEncodeEntitiesReentrant for details. If list is the child of an attribute, escaping rules apply are adjusted.

See xmlNodeListGetRawString for an alternative option.

Parameters
doc a document (optional)
list a node list of attribute children
inLine whether entity references are substituted
Returns
a string or NULL if a memory allocation failed.

◆  xmlNodeSetBase()

int xmlNodeSetBase ( xmlNode * cur,
const xmlChar * uri )

Set (or reset) the base URI of a node, i.e.

the value of the xml:base attribute.

Parameters
cur the node being changed
uri the new base URI
Returns
0 on success, -1 on error.

◆  xmlNodeSetContent()

int xmlNodeSetContent ( xmlNode * cur,
const xmlChar * content )

Replace the text content of a node.

Sets the raw text content of text, CDATA, comment or PI nodes.

For element and attribute nodes, removes all children and replaces them by parsing content which is expected to be a valid XML attribute value possibly containing character and entity references. Syntax errors and references to undeclared entities are ignored silently. Unfortunately, there isn't an API to pass raw content directly. An inefficient work-around is to escape the content with xmlEncodeSpecialChars before passing it. A better trick is clearing the old content with xmlNodeSetContent(node, NULL) first and then calling xmlNodeAddContent(node, content). Unlike this function, xmlNodeAddContent accepts raw text.

Parameters
cur the node being modified
content the new value of the content
Returns
0 on success, 1 on error, -1 if a memory allocation failed.

◆  xmlNodeSetContentLen()

int xmlNodeSetContentLen ( xmlNode * cur,
const xmlChar * content,
int len )

See xmlNodeSetContent.

Parameters
cur the node being modified
content the new value of the content
len the size of content
Returns
0 on success, 1 on error, -1 if a memory allocation failed.

◆  xmlNodeSetLang()

int xmlNodeSetLang ( xmlNode * cur,
const xmlChar * lang )

Set the xml:lang attribute of a node.

Parameters
cur the node being changed
lang the language description
Returns
0 on success, 1 if arguments are invalid, -1 if a memory allocation failed.

◆  xmlNodeSetName()

void xmlNodeSetName ( xmlNode * cur,
const xmlChar * name )

Set (or reset) the name of a node.

Parameters
cur the node being changed
name the new tag name

◆  xmlNodeSetSpacePreserve()

int xmlNodeSetSpacePreserve ( xmlNode * cur,
int val )

Set the xml:space attribute of a node.

Parameters
cur the node being changed
val the xml:space value ("0": default, 1: "preserve")
Returns
0 on success, 1 if arguments are invalid, -1 if a memory allocation failed.

◆  xmlPreviousElementSibling()

xmlNode * xmlPreviousElementSibling ( xmlNode * node )

Find the closest preceding sibling which is a element.

Note that entity references are not expanded.

Parameters
node the current node
Returns
the sibling or NULL if no sibling was found.

◆  xmlReconciliateNs()

int xmlReconciliateNs ( xmlDoc * doc,
xmlNode * tree )

This function checks that all the namespaces declared within the given tree are properly declared.

This is needed for example after copy or cut and then paste operations. The subtree may still hold pointers to namespace declarations outside the subtree or invalid/masked. As much as possible the function tries to reuse the existing namespaces found in the new environment. If not possible the new namespaces are redeclared on tree at the top of the given subtree.

Parameters
doc the document
tree a node defining the subtree to reconciliate
Returns
0 on success or -1 in case of error.

◆  xmlRegisterNodeDefault()

xmlRegisterNodeFunc xmlRegisterNodeDefault ( xmlRegisterNodeFunc func )

Registers a callback for node creation.

Deprecated
don't use
Parameters
func function pointer to the new RegisterNodeFunc
Returns
the old value of the registration function

◆  xmlRemoveProp()

int xmlRemoveProp ( xmlAttr * cur )

Unlink and free an attribute including all children.

Note this doesn't work for namespace declarations.

The attribute must have a non-NULL parent pointer.

Parameters
cur an attribute
Returns
0 on success or -1 if the attribute was not found or arguments are invalid.

◆  xmlReplaceNode()

xmlNode * xmlReplaceNode ( xmlNode * old,
xmlNode * cur )

Unlink the old node.

If cur is provided, it is unlinked and inserted in place of old.

It is an error if old has no parent.

Unlike xmlAddChild, this function doesn't merge text nodes or delete duplicate attributes.

See the notes in xmlAddChild.

Parameters
old the old node
cur the node (optional)
Returns
old or NULL if arguments are invalid or a memory allocation failed.

◆  xmlSaveFile()

int xmlSaveFile ( const char * filename,
xmlDoc * cur )

Same as xmlSaveFormatFileEnc with encoding set to NULL and format set to 0.

Parameters
filename the filename (or URL)
cur the document
Returns
the number of bytes written or -1 in case of failure.

◆  xmlSaveFileEnc()

int xmlSaveFileEnc ( const char * filename,
xmlDoc * cur,
const char * encoding )

Same as xmlSaveFormatFileEnc with format set to 0.

Parameters
filename the filename (or URL)
cur the document
encoding the name of an encoding (or NULL)
Returns
the number of bytes written or -1 in case of failure.

◆  xmlSaveFileTo()

int xmlSaveFileTo ( xmlOutputBuffer * buf,
xmlDoc * cur,
const char * encoding )

Same as xmlSaveFormatFileTo with format set to 0.

WARNING: This calls xmlOutputBufferClose and frees buf.

Parameters
buf an output I/O buffer
cur the document
encoding the encoding if any assuming the I/O layer handles the transcoding
Returns
the number of bytes written or -1 in case of failure.

◆  xmlSaveFormatFile()

int xmlSaveFormatFile ( const char * filename,
xmlDoc * cur,
int format )

Same as xmlSaveFormatFileEnc with encoding set to NULL.

Parameters
filename the filename (or URL)
cur the document
format should formatting spaces been added
Returns
the number of bytes written or -1 in case of failure.

◆  xmlSaveFormatFileEnc()

int xmlSaveFormatFileEnc ( const char * filename,
xmlDoc * cur,
const char * encoding,
int format )

Serialize an XML document to a file using the given encoding.

If filename is "-", stdout is used. This is potentially insecure and might be changed in a future version.

If encoding is NULL, uses the document's encoding. If the document has no encoding, serializes as ASCII without an encoding declaration.

Note that format only works if the document was parsed with XML_PARSE_NOBLANKS.

Parameters
filename the filename or URL to output
cur the document being saved
encoding the name of the encoding to use or NULL.
format should formatting spaces be added.
Returns
the number of bytes written or -1 in case of error.

◆  xmlSaveFormatFileTo()

int xmlSaveFormatFileTo ( xmlOutputBuffer * buf,
xmlDoc * cur,
const char * encoding,
int format )

Serialize an XML document to an output buffer.

If the output buffer already uses a (non-default) encoding, encoding is ignored. If the output buffer has no encoding and encoding is NULL, uses the document's encoding or ASCII without an encoding declaration.

Note that format only works if the document was parsed with XML_PARSE_NOBLANKS.

WARNING: This calls xmlOutputBufferClose and frees buf.

Parameters
buf an output I/O buffer
cur the document
encoding the encoding if any assuming the I/O layer handles the transcoding
format should formatting spaces been added
Returns
the number of bytes written or -1 in case of failure.

◆  xmlSearchNs()

xmlNs * xmlSearchNs ( xmlDoc * doc,
xmlNode * node,
const xmlChar * nameSpace )

Search for a namespace with prefix in scope of node.

Recurse on the parents until it finds the defined namespace or return NULL otherwise.

If nameSpace is NULL, the default namespace is looked up.

Namespace search doesn't cross entity boundaries.

Parameters
doc the document
node the current node
nameSpace the namespace prefix
Returns
the namespace pointer or NULL if no namespace was found or a memory allocation failed. Allocations can only fail if the xml namespace is queried.

◆  xmlSearchNsByHref()

xmlNs * xmlSearchNsByHref ( xmlDoc * doc,
xmlNode * node,
const xmlChar * href )

Search for a namespace matching URI in scope of node.

Parameters
doc the document
node the current node
href the namespace value
Returns
the namespace pointer or NULL if no namespace was found or a memory allocation failed. Allocations can only fail if the xml namespace is queried.

◆  xmlSetBufferAllocationScheme()

void xmlSetBufferAllocationScheme ( xmlBufferAllocationScheme scheme )

Set the buffer allocation scheme.

Deprecated
No-op, allocation schemes were removed.
Parameters
scheme allocation method to use

◆  xmlSetCompressMode()

void xmlSetCompressMode ( int mode )

Set the global compression level, ZLIB based.

Deprecated
Use xmlSetDocCompressMode

Correct values: 0 (uncompressed) to 9 (max compression)

Parameters
mode the compression ratio

◆  xmlSetDocCompressMode()

void xmlSetDocCompressMode ( xmlDoc * doc,
int mode )

Set the compression level of a document, ZLIB based.

Correct values: 0 (uncompressed) to 9 (max compression)

Parameters
doc the document
mode the compression ratio

◆  xmlSetListDoc()

int xmlSetListDoc ( xmlNode * list,
xmlDoc * doc )

Associate all subtrees in list with a new document.

Internal function, see xmlSetTreeDoc.

Parameters
list a node list
doc new document
Returns
0 on success. If a memory allocation fails, returns -1. All subtrees will be updated on failure but some strings may be lost.

◆  xmlSetNs()

void xmlSetNs ( xmlNode * node,
xmlNs * ns )

Set the namespace of an element or attribute node.

Passing a NULL namespace unsets the namespace.

Parameters
node a node in the document
ns a namespace pointer (optional)

◆  xmlSetNsProp()

xmlAttr * xmlSetNsProp ( xmlNode * node,
xmlNs * ns,
const xmlChar * name,
const xmlChar * value )

Set (or reset) an element's attribute.

The namespace must be in scope.

Parameters
node the node
ns the namespace definition
name the attribute name
value the attribute value
Returns
the attribute pointer.

◆  xmlSetProp()

xmlAttr * xmlSetProp ( xmlNode * node,
const xmlChar * name,
const xmlChar * value )

Set (or reset) an element's attribute.

If name has a prefix, the corresponding namespace will be used. It is an error if there's no such binding for the prefix in scope.

Parameters
node the node
name the attribute name (a QName)
value the attribute value
Returns
the attribute pointer.

◆  xmlSetTreeDoc()

int xmlSetTreeDoc ( xmlNode * tree,
xmlDoc * doc )

Associate all nodes in a tree with a new document.

This is an internal function which shouldn't be used. It is invoked by functions like xmlAddChild, xmlAddSibling or xmlReplaceNode. tree must be the root node of an unlinked subtree.

Also copy strings from the old document's dictionary and remove ID attributes from the old ID table.

Parameters
tree root of a subtree
doc new document
Returns
0 on success. If a memory allocation fails, returns -1. The whole tree will be updated on failure but some strings may be lost.

◆  xmlSplitQName2()

xmlChar * xmlSplitQName2 ( const xmlChar * name,
xmlChar ** prefix )

Parse an XML qualified name.

Deprecated
This function doesn't report malloc failures.
[NS 5] QName ::= (Prefix ':')? LocalPart
[NS 6] Prefix ::= NCName
[NS 7] LocalPart ::= NCName
Parameters
name the full QName
prefix a xmlChar **
Returns
NULL if the name doesn't have a prefix. Otherwise, returns the local part, and prefix is updated to get the Prefix. Both the return value and the prefix must be freed by the caller.

◆  xmlSplitQName3()

const xmlChar * xmlSplitQName3 ( const xmlChar * name,
int * len )

Parse an XML qualified name.

Parameters
name the full QName
len an int *
Returns
NULL if it is not a Qualified Name, otherwise, update len with the length in byte of the prefix and return a pointer to the start of the name without the prefix

◆  xmlStringGetNodeList()

xmlNode * xmlStringGetNodeList ( const xmlDoc * doc,
const xmlChar * value )

Parse an attribute value and build a node list with text and entity reference nodes.

The resulting nodes will be associated with the document if provided. The document is also used to look up entities.

Deprecated
Internal function, don't use.

The input is not validated. Syntax errors or references to undeclared entities will be ignored silently with unspecified results.

Parameters
doc a document (optional)
value an attribute value
Returns
a pointer to the first child or NULL if the value if empty or a memory allocation failed.

◆  xmlStringLenGetNodeList()

xmlNode * xmlStringLenGetNodeList ( const xmlDoc * doc,
const xmlChar * value,
int len )

See xmlStringGetNodeList.

Deprecated
Internal function, don't use.
Parameters
doc a document (optional)
value an attribute value
len maximum length of the attribute value
Returns
a pointer to the first child or NULL if the value if empty or a memory allocation failed.

◆  xmlTextConcat()

int xmlTextConcat ( xmlNode * node,
const xmlChar * content,
int len )

Concat the given string at the end of the existing node content.

If len is -1, the string length will be calculated.

Parameters
node the node
content the content
len content length
Returns
-1 in case of error, 0 otherwise

◆  xmlTextMerge()

xmlNode * xmlTextMerge ( xmlNode * first,
xmlNode * second )

Merge the second text node into the first.

If first is NULL, second is returned. Otherwise, the second node is unlinked and freed.

Parameters
first the first text node
second the second text node being merged
Returns
the first text node augmented or NULL in case of error.

◆  xmlThrDefDeregisterNodeDefault()

xmlDeregisterNodeFunc xmlThrDefDeregisterNodeDefault ( xmlDeregisterNodeFunc func )

Set per-thread default value.

Deprecated
This feature will be removed.
Parameters
func new value
Returns
the old value

◆  xmlThrDefRegisterNodeDefault()

xmlRegisterNodeFunc xmlThrDefRegisterNodeDefault ( xmlRegisterNodeFunc func )

Set per-thread default value.

Deprecated
This feature will be removed.
Parameters
func new value
Returns
the old value

◆  xmlUnlinkNode()

void xmlUnlinkNode ( xmlNode * cur )

Unlink a node from its tree.

The node is not freed. Unless it is reinserted, it must be managed manually and freed eventually by calling xmlFreeNode.

Parameters
cur the node

◆  xmlUnsetNsProp()

int xmlUnsetNsProp ( xmlNode * node,
xmlNs * ns,
const xmlChar * name )

Remove an attribute of an element.

Parameters
node the element
ns the namespace definition
name the attribute name
Returns
0 if successful, -1 if not found

◆  xmlUnsetProp()

int xmlUnsetProp ( xmlNode * node,
const xmlChar * name )

Remove an attribute of an element.

This handles only attributes in no namespace.

Parameters
node the element
name the attribute name
Returns
0 if successful, -1 if not found

◆  xmlValidateName()

int xmlValidateName ( const xmlChar * value,
int space )

Check that a value conforms to the lexical space of Name.

Parameters
value the value to check
space allow spaces in front and end of the string
Returns
0 if this validates, a positive error code number otherwise and -1 in case of internal or API error.

◆  xmlValidateNCName()

int xmlValidateNCName ( const xmlChar * value,
int space )

Check that a value conforms to the lexical space of NCName.

Parameters
value the value to check
space allow spaces in front and end of the string
Returns
0 if this validates, a positive error code number otherwise and -1 in case of internal or API error.

◆  xmlValidateNMToken()

int xmlValidateNMToken ( const xmlChar * value,
int space )

Check that a value conforms to the lexical space of NMToken.

Parameters
value the value to check
space allow spaces in front and end of the string
Returns
0 if this validates, a positive error code number otherwise and -1 in case of internal or API error.

◆  xmlValidateQName()

int xmlValidateQName ( const xmlChar * value,
int space )

Check that a value conforms to the lexical space of QName.

Parameters
value the value to check
space allow spaces in front and end of the string
Returns
0 if this validates, a positive error code number otherwise and -1 in case of internal or API error.

Generated by doxygen 1.14.0

AltStyle によって変換されたページ (->オリジナル) /