|
libxml2
|
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 | |
| typedef struct _xmlParserInputBuffer | xmlParserInputBuffer |
| 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 | |
| enum | xmlBufferAllocationScheme |
| Removed, buffers always use XML_BUFFER_ALLOC_IO now. | |
| enum | xmlElementType |
| The different element types carried by an XML tree. More... | |
| enum | xmlAttributeType |
| A DTD Attribute type definition. | |
| enum | xmlAttributeDefault |
| A DTD Attribute default definition. | |
| enum | xmlElementContentType |
| Possible definitions of element content types. | |
| enum | xmlElementContentOccur |
| Possible definitions of element content occurrences. | |
| enum | xmlElementTypeVal |
| The different possibilities for an element content type. | |
| enum | xmlDocProperties |
| 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. | |
| xmlDtd * | xmlCopyDtd (xmlDtd *dtd) |
| 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. | |
| xmlNode * | xmlNewNodeEatName (xmlNs *ns, xmlChar *name) |
| 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. | |
| xmlNode * | xmlDocCopyNodeList (xmlDoc *doc, xmlNode *node) |
| Copy a node list and all children into a new document. | |
| xmlNode * | xmlCopyNodeList (xmlNode *node) |
| 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. | |
| xmlNode * | xmlNewDocFragment (xmlDoc *doc) |
| 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. | |
| xmlNode * | xmlDocGetRootElement (const xmlDoc *doc) |
| 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. | |
| xmlNode * | xmlDocSetRootElement (xmlDoc *doc, xmlNode *root) |
| 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. | |
| xmlNode * | xmlReplaceNode (xmlNode *old, xmlNode *cur) |
| Unlink the old node. | |
| xmlNode * | xmlAddPrevSibling (xmlNode *cur, xmlNode *elem) |
| Unlinks cur and inserts it as previous sibling before next. | |
| xmlNode * | xmlAddSibling (xmlNode *cur, xmlNode *elem) |
| Unlinks cur and inserts it as last sibling of node. | |
| xmlNode * | xmlAddNextSibling (xmlNode *cur, xmlNode *elem) |
| 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. | |
| xmlNs * | xmlCopyNamespace (xmlNs *cur) |
| Copy a namespace. | |
| xmlNs * | xmlCopyNamespaceList (xmlNs *cur) |
| 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) |
| See xmlStringGetNodeList. | |
| 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) |
| See xmlNodeSetContent. | |
| 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. | |
| xmlChar * | xmlNodeGetContent (const xmlNode *cur) |
| 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) |
| See xmlNodeGetBaseSafe. | |
| 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. | |
| xmlDOMWrapCtxt * | xmlDOMWrapNewCtxt (void) |
| Allocates and initializes a new DOM-wrapper context. | |
| void | xmlDOMWrapFreeCtxt (xmlDOMWrapCtxt *ctxt) |
| 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. | |
| xmlNode * | xmlNextElementSibling (xmlNode *node) |
| Find the closest following sibling which is a element. | |
| xmlNode * | xmlFirstElementChild (xmlNode *parent) |
| Find the first child node which is an element. | |
| xmlNode * | xmlLastElementChild (xmlNode *parent) |
| Find the last child node which is an element. | |
| xmlNode * | xmlPreviousElementSibling (xmlNode *node) |
| Find the closest preceding sibling which is a element. | |
| xmlRegisterNodeFunc | xmlRegisterNodeDefault (xmlRegisterNodeFunc func) |
| Registers a callback for node creation. | |
| xmlDeregisterNodeFunc | xmlDeregisterNodeDefault (xmlDeregisterNodeFunc func) |
| Registers a callback for node destruction. | |
| xmlRegisterNodeFunc | xmlThrDefRegisterNodeDefault (xmlRegisterNodeFunc func) |
| Set per-thread default value. | |
| xmlDeregisterNodeFunc | xmlThrDefDeregisterNodeDefault (xmlDeregisterNodeFunc func) |
| Set per-thread default value. | |
| void | xmlSetBufferAllocationScheme (xmlBufferAllocationScheme scheme) |
| Set the buffer allocation scheme. | |
| xmlBufferAllocationScheme | xmlGetBufferAllocationScheme (void) |
| Get the buffer allocation scheme. | |
| xmlBuffer * | xmlBufferCreate (void) |
| 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. | |
| xmlChar * | xmlBufferDetach (xmlBuffer *buf) |
| Extract buffer content. | |
| void | xmlBufferSetAllocationScheme (xmlBuffer *buf, xmlBufferAllocationScheme scheme) |
| 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. | |
| xmlChar * | xmlBufEnd (xmlBuf *buf) |
| 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. | |
Document tree API.
Data structures and functions to build, modify, query and serialize XML and HTML document trees. Also contains the buffer API.
| #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.
| #define xmlChildrenNode children |
Macro for compatibility naming layer with libxml1.
Maps to "children."
| #define xmlRootNode children |
Macro for compatibility naming layer with libxml1.
Maps to "children".
| typedef void(* xmlDeregisterNodeFunc) (xmlNode *node) |
Signature for the deregistration callback of a discarded node.
| node | the current node |
| typedef xmlNs *(* xmlDOMWrapAcquireNsFunction) (xmlDOMWrapCtxt *ctxt, xmlNode *node, const xmlChar *nsName, const xmlChar *nsPrefix) |
| typedef struct _xmlParserInputBuffer xmlParserInputBuffer |
Parser input buffer.
This struct and all related functions should ultimately be removed from the public interface.
| typedef void(* xmlRegisterNodeFunc) (xmlNode *node) |
Signature for the registration callback of a created node.
| node | the current node |
| enum xmlDocProperties |
Set of properties of the document as found by the parser.
Some of them are linked to similarly named xmlParserOption.
| enum 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. |
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.
| parent | the parent node |
| cur | the child node |
Append a node list to another node.
See xmlAddChild.
| parent | the parent node |
| cur | the first node in the list |
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.
| prev | the target node |
| cur | the new node |
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.
| next | the target node |
| cur | the new node |
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.
| node | the target node |
| cur | the new node |
| void xmlAttrSerializeTxtContent | ( | xmlBuffer * | buf, |
| xmlDoc * | doc, | ||
| xmlAttr * | attr, | ||
| const xmlChar * | string ) |
Serialize attribute text to an xmlBuffer.
| buf | the XML buffer output |
| doc | the document |
| attr | the attribute node |
| string | the text content |
Get pointer into buffer content.
| buf | the buffer |
Return a pointer to the end of the buffer content.
| buf | the buffer |
Append bytes to a buffer.
If len is -1, str is assumed to be zero-terminated.
| buf | the buffer |
| str | bytes to add |
| len | number of bytes |
Prepend bytes to a buffer.
If len is -1, str is assumed to be zero-terminated.
| buf | the buffer |
| str | bytes to prepend |
| len | number of bytes |
Append a zero-terminated string to a buffer.
| buf | the buffer |
| str | string to add |
| int xmlBufferCCat | ( | xmlBuffer * | buf, |
| const char * | str ) |
Append a zero-terminated C string to a buffer.
| buf | the buffer |
| str | string to add |
Get pointer into buffer content.
| buf | the buffer |
| xmlBuffer * xmlBufferCreate | ( | void | ) |
Create a buffer.
The default initial size is 256.
| xmlBuffer * xmlBufferCreateSize | ( | size_t | size | ) |
Create a buffer with an initial size.
| size | initial size of buffer |
| 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.
| mem | the memory area |
| size | the size in bytes |
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.
| buf | the buffer |
| int xmlBufferDump | ( | FILE * | file, |
| xmlBuffer * | buf ) |
Dump a buffer to a FILE.
| file | the output file |
| buf | the buffer |
| void xmlBufferEmpty | ( | xmlBuffer * | buf | ) |
Empty a buffer.
| buf | the buffer |
| void xmlBufferFree | ( | xmlBuffer * | buf | ) |
Free a buffer.
| buf | the buffer to free |
| int xmlBufferGrow | ( | xmlBuffer * | buf, |
| unsigned int | len ) |
Grow a buffer.
| buf | the buffer |
| len | number of extra bytes to allocate |
| int xmlBufferLength | ( | const xmlBuffer * | buf | ) |
Get the size of the buffer content.
| buf | the buffer |
| int xmlBufferResize | ( | xmlBuffer * | buf, |
| unsigned int | size ) |
Resize a buffer to a minimum size.
| buf | the buffer to resize |
| size | the desired size |
| void xmlBufferSetAllocationScheme | ( | xmlBuffer * | buf, |
| xmlBufferAllocationScheme | scheme ) |
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.
| buf | the buffer to tune |
| scheme | allocation scheme to use |
| int xmlBufferShrink | ( | xmlBuffer * | buf, |
| unsigned int | len ) |
Discard bytes at the start of a buffer.
| buf | the buffer |
| len | the number of bytes to remove |
Append a zero-terminated xmlChar string to a buffer.
| buf | the XML buffer |
| string | the string to add |
| void xmlBufferWriteChar | ( | xmlBuffer * | buf, |
| const char * | string ) |
Append a zero-terminated C string to a buffer.
Same as xmlBufferCCat.
| buf | the buffer |
| string | the string to add |
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 ".
| buf | the buffer |
| string | the string to add |
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.
| buf | a buffer xmlBuf |
| cur | the node being read |
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.
| buf | the XML buffer output |
| doc | the document |
| cur | the current node |
| level | the imbrication level for indenting |
| format | is formatting allowed |
| 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.
| buf | the buffer |
| len | the number of bytes to remove |
| size_t xmlBufUse | ( | xmlBuf * | buf | ) |
Return the size of the buffer content.
| buf | the buffer |
| 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.
| ncname | the Name |
| prefix | the prefix |
| memory | preallocated memory |
| len | preallocated memory length |
| unsigned long xmlChildElementCount | ( | xmlNode * | parent | ) |
Count the number of child nodes which are elements.
Note that entity references are not expanded.
| parent | the parent node |
Copy a document.
If recursive, the content tree will be copied too as well as DTD, namespaces and entities.
| doc | the document |
| recursive | if not zero do a recursive copy. |
Copy a DTD.
| dtd | the DTD |
Copy a namespace.
| cur | the namespace |
Copy a namespace list.
| cur | the first namespace |
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.
| node | the node |
| extended | mode of operation |
Copy a node list and all children.
Use of this function is DISCOURAGED in favor of xmlDocCopyNodeList.
| node | the first node in the list. |
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.
| target | the element where the attribute will be grafted |
| cur | the attribute |
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.
| target | the element where the attributes will be grafted |
| cur | the first attribute |
| 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.
| 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) |
| xmlDeregisterNodeFunc xmlDeregisterNodeDefault | ( | xmlDeregisterNodeFunc | func | ) |
Registers a callback for node destruction.
| func | function pointer to the new DeregisterNodeFunc |
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.
| node | the node |
| doc | the document |
| extended | mode of operation |
Copy a node list and all children into a new document.
| doc | the target document |
| node | the first node in the list. |
| 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.
| f | the FILE* |
| cur | the document |
Same as xmlDocDumpFormatMemoryEnc with encoding set to NULL.
| cur | the document |
| mem | OUT: the memory pointer |
| size | OUT: the memory length |
| format | should formatting spaces been added |
| 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.
| 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 |
Same as xmlDocDumpFormatMemoryEnc with encoding set to NULL and format set to 0.
| cur | the document |
| mem | OUT: the memory pointer |
| size | OUT: the memory length |
| 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.
| 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 |
| 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.
| f | the FILE* |
| cur | the document |
| format | should formatting spaces been added |
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.
| doc | the document |
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.
| doc | the document |
| root | the new document root element |
| 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.
| 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 |
| 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.
| 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 |
| void xmlDOMWrapFreeCtxt | ( | xmlDOMWrapCtxt * | ctxt | ) |
Frees the DOM-wrapper context.
| ctxt | the DOM-wrapper context |
| xmlDOMWrapCtxt * xmlDOMWrapNewCtxt | ( | void | ) |
Allocates and initializes a new DOM-wrapper context.
| 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.
| ctxt | DOM wrapper context, unused at the moment |
| elem | the element-node |
| options | option flags |
| 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.
| ctxt | a DOM wrapper context |
| doc | the doc |
| node | the node to be removed. |
| options | set of options, unused at the moment |
Serialize an XML node to a FILE.
Uses the document's encoding. If the document has no encoding, uses ASCII without an encoding declaration.
| f | the FILE * for the output |
| doc | the document |
| cur | the current node |
Find the first child node which is an element.
Note that entity references are not expanded.
| parent | the parent node |
| void xmlFreeDoc | ( | xmlDoc * | cur | ) |
Free a document including all children and associated DTDs.
| cur | pointer to the document |
| void xmlFreeDtd | ( | xmlDtd * | cur | ) |
Free a DTD structure.
| cur | the DTD structure to free up |
| 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.
| cur | the node |
| void xmlFreeNodeList | ( | xmlNode * | cur | ) |
Free a node list including all children.
| cur | the first node in the list |
| void xmlFreeNsList | ( | xmlNs * | cur | ) |
Free a list of xmlNs objects.
| cur | the first namespace pointer |
| void xmlFreeProp | ( | xmlAttr * | cur | ) |
Free an attribute including all children.
| cur | an attribute |
| void xmlFreePropList | ( | xmlAttr * | cur | ) |
Free an attribute list including all children.
| cur | the first attribute in the list |
| xmlBufferAllocationScheme xmlGetBufferAllocationScheme | ( | void | ) |
Get the buffer allocation scheme.
| int xmlGetCompressMode | ( | void | ) |
Get the global compression level, ZLIB based.
| int xmlGetDocCompressMode | ( | const xmlDoc * | doc | ) |
Get the compression level of a document, ZLIB based.
| doc | the document |
Get the internal subset of a document.
| doc | the document pointer |
Find the last child of a node.
| parent | the parent node |
| 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.
| node | valid node |
Build a structure based Path for the given node.
| node | a node |
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.
| node | the element |
| name | the attribute name |
Find all in-scope namespaces of a node.
Use xmlGetNsListSafe for better error reporting.
| doc | the document |
| node | the current node |
Find all in-scope namespaces of a node.
out returns a NULL terminated array of namespace pointers that must be freed by the caller.
| doc | the document |
| node | the current node |
| out | the returned namespace array |
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.
| node | the element |
| name | the attribute name |
| nameSpace | the URI of the namespace |
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.
| node | the element |
| name | the attribute name |
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.
| node | the element |
| name | the attribute name |
| nameSpace | the URI of the namespace |
Search for an attribute of an element.
This function also looks in DTD attribute declaration for #FIXED or default declaration values.
| node | the element |
| name | the attribute name |
| int xmlIsBlankNode | ( | const xmlNode * | node | ) |
Checks whether this node is an empty or whitespace-only text node.
| node | the node |
Try to find if the document correspond to an XHTML DTD.
| systemID | the system identifier |
| publicID | the public identifier |
Find the last child node which is an element.
Note that entity references are not expanded.
| parent | the parent node |
Create a CDATA section node.
| doc | the target document (optional) |
| content | raw text content (optional) |
| len | size of text content |
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.
| doc | the target document (optional) |
| name | the entity name |
| 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.
| parent | the parent node |
| ns | a namespace (optional) |
| name | the name of the child |
| content | text content with XML references (optional) |
Use of this function is DISCOURAGED in favor of xmlNewDocComment.
Create a comment node.
| content | the comment content (optional) |
Creates a new XML document.
If version is NULL, "1.0" is used.
| version | XML version string like "1.0" (optional) |
Create a comment node.
| doc | the document |
| content | the comment content |
Create a document fragment node.
| doc | the target document (optional) |
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.
| doc | the target document |
| ns | namespace (optional) |
| name | the node name |
| content | text content with XML references (optional) |
| 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.
| doc | the target document |
| ns | namespace (optional) |
| name | the node name |
| content | text content with XML references (optional) |
Create a processing instruction object.
| doc | the target document (optional) |
| name | the processing instruction target |
| content | the PI content (optional) |
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.
| doc | the target document (optional) |
| name | the name of the attribute |
| value | attribute value with XML references (optional) |
| 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.
| doc | the target document |
| ns | namespace (optional) |
| name | the node name |
| content | raw text content (optional) |
Create a new text node.
| doc | the target document |
| content | raw text content (optional) |
Create a new text node.
| doc | the target document |
| content | raw text content (optional) |
| len | size of text content |
| 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.
| 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) |
Create an element node.
Use of this function is DISCOURAGED in favor of xmlNewDocNode.
| ns | namespace (optional) |
| name | the node 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.
| ns | namespace (optional) |
| name | the node name |
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.
| node | the element carrying the namespace (optional) |
| href | the URI associated |
| prefix | the prefix for the namespace (optional) |
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.
| node | the parent node (optional) |
| ns | the namespace (optional) |
| name | the local name of the attribute |
| value | the value of the attribute (optional) |
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.
| node | the parent node (optional) |
| ns | the namespace (optional) |
| name | the local name of the attribute |
| value | the value of the attribute (optional) |
Create a processing instruction node.
Use of this function is DISCOURAGED in favor of xmlNewDocPI.
| name | the processing instruction target |
| content | the PI content (optional) |
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.
| node | the parent node (optional) |
| name | the name of the attribute |
| value | the value of the attribute (optional) |
Create a new entity reference node, linking the result with the entity in doc if found.
Entity names like &entity; are handled as well.
| doc | the target document (optional) |
| name | the entity name |
Create a text node.
Use of this function is DISCOURAGED in favor of xmlNewDocText.
| content | raw text content (optional) |
| 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.
| parent | the parent node |
| ns | a namespace (optional) |
| name | the name of the child |
| content | raw text content of the child (optional) |
Create a new text node.
Use of this function is DISCOURAGED in favor of xmlNewDocTextLen.
| content | raw text content (optional) |
| len | size of text content |
Find the closest following sibling which is a element.
Note that entity references are not expanded.
| node | the current node |
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.
| cur | the node being modified |
| content | extra content |
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.
| cur | the node being modified |
| content | extra content |
| len | the size of content |
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.
| buffer | a buffer |
| cur | the node being read |
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.
| buf | the XML buffer output |
| doc | the document |
| cur | the current node |
| level | the initial indenting level |
| format | is formatting allowed |
| 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.
| 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 |
| 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.
| node | the element |
| name | the attribute name |
| nsUri | the URI of the namespace |
| out | the returned string |
See xmlNodeGetBaseSafe.
This function doesn't allow to distinguish memory allocation failures from a non-existing base.
| doc | the document the node pertains to |
| cur | the node being checked |
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.
| doc | the document the node pertains to |
| cur | the node being checked |
| baseOut | pointer to base |
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.
| cur | the node being read |
Find the xml:lang of a node.
Look up the value of the xml:lang attribute or the one carried by the nearest ancestor.
| cur | the node being checked |
| 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.
| cur | the node being checked |
| int xmlNodeIsText | ( | const xmlNode * | node | ) |
Check whether the node is a text node.
| node | the node |
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.
| doc | a document (unused) |
| list | a node list of attribute children |
| inLine | whether entity references are substituted |
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.
| doc | a document (optional) |
| list | a node list of attribute children |
| inLine | whether entity references are substituted |
Set (or reset) the base URI of a node, i.e.
the value of the xml:base attribute.
| cur | the node being changed |
| uri | the new base URI |
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.
| cur | the node being modified |
| content | the new value of the content |
See xmlNodeSetContent.
| cur | the node being modified |
| content | the new value of the content |
| len | the size of content |
Set the xml:lang attribute of a node.
| cur | the node being changed |
| lang | the language description |
Set (or reset) the name of a node.
| cur | the node being changed |
| name | the new tag name |
| int xmlNodeSetSpacePreserve | ( | xmlNode * | cur, |
| int | val ) |
Set the xml:space attribute of a node.
| cur | the node being changed |
| val | the xml:space value ("0": default, 1: "preserve") |
Find the closest preceding sibling which is a element.
Note that entity references are not expanded.
| node | the current node |
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.
| doc | the document |
| tree | a node defining the subtree to reconciliate |
| xmlRegisterNodeFunc xmlRegisterNodeDefault | ( | xmlRegisterNodeFunc | func | ) |
Registers a callback for node creation.
| func | function pointer to the new RegisterNodeFunc |
| 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.
| cur | an attribute |
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.
| old | the old node |
| cur | the node (optional) |
| int xmlSaveFile | ( | const char * | filename, |
| xmlDoc * | cur ) |
Same as xmlSaveFormatFileEnc with encoding set to NULL and format set to 0.
| filename | the filename (or URL) |
| cur | the document |
| int xmlSaveFileEnc | ( | const char * | filename, |
| xmlDoc * | cur, | ||
| const char * | encoding ) |
Same as xmlSaveFormatFileEnc with format set to 0.
| filename | the filename (or URL) |
| cur | the document |
| encoding | the name of an encoding (or NULL) |
| int xmlSaveFileTo | ( | xmlOutputBuffer * | buf, |
| xmlDoc * | cur, | ||
| const char * | encoding ) |
Same as xmlSaveFormatFileTo with format set to 0.
WARNING: This calls xmlOutputBufferClose and frees buf.
| buf | an output I/O buffer |
| cur | the document |
| encoding | the encoding if any assuming the I/O layer handles the transcoding |
| int xmlSaveFormatFile | ( | const char * | filename, |
| xmlDoc * | cur, | ||
| int | format ) |
Same as xmlSaveFormatFileEnc with encoding set to NULL.
| filename | the filename (or URL) |
| cur | the document |
| format | should formatting spaces been added |
| 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.
| 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. |
| 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.
| 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 |
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.
| doc | the document |
| node | the current node |
| nameSpace | the namespace prefix |
Search for a namespace matching URI in scope of node.
| doc | the document |
| node | the current node |
| href | the namespace value |
| void xmlSetBufferAllocationScheme | ( | xmlBufferAllocationScheme | scheme | ) |
Set the buffer allocation scheme.
| scheme | allocation method to use |
| void xmlSetCompressMode | ( | int | mode | ) |
Set the global compression level, ZLIB based.
Correct values: 0 (uncompressed) to 9 (max compression)
| mode | the compression ratio |
| void xmlSetDocCompressMode | ( | xmlDoc * | doc, |
| int | mode ) |
Set the compression level of a document, ZLIB based.
Correct values: 0 (uncompressed) to 9 (max compression)
| doc | the document |
| mode | the compression ratio |
Associate all subtrees in list with a new document.
Internal function, see xmlSetTreeDoc.
| list | a node list |
| doc | new document |
Set the namespace of an element or attribute node.
Passing a NULL namespace unsets the namespace.
| node | a node in the document |
| ns | a namespace pointer (optional) |
Set (or reset) an element's attribute.
The namespace must be in scope.
| node | the node |
| ns | the namespace definition |
| name | the attribute name |
| value | the attribute 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.
| node | the node |
| name | the attribute name (a QName) |
| value | the attribute value |
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.
| tree | root of a subtree |
| doc | new document |
Parse an XML qualified name.
[NS 5] QName ::= (Prefix ':')? LocalPart [NS 6] Prefix ::= NCName [NS 7] LocalPart ::= NCName
| name | the full QName |
| prefix | a xmlChar ** |
Parse an XML qualified name.
| name | the full QName |
| len | an int * |
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.
The input is not validated. Syntax errors or references to undeclared entities will be ignored silently with unspecified results.
| doc | a document (optional) |
| value | an attribute value |
See xmlStringGetNodeList.
| doc | a document (optional) |
| value | an attribute value |
| len | maximum length of the attribute value |
Concat the given string at the end of the existing node content.
If len is -1, the string length will be calculated.
| node | the node |
| content | the content |
| len | content length |
Merge the second text node into the first.
If first is NULL, second is returned. Otherwise, the second node is unlinked and freed.
| first | the first text node |
| second | the second text node being merged |
| xmlDeregisterNodeFunc xmlThrDefDeregisterNodeDefault | ( | xmlDeregisterNodeFunc | func | ) |
Set per-thread default value.
| func | new value |
| xmlRegisterNodeFunc xmlThrDefRegisterNodeDefault | ( | xmlRegisterNodeFunc | func | ) |
Set per-thread default value.
| func | new value |
| 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.
| cur | the node |
Remove an attribute of an element.
| node | the element |
| ns | the namespace definition |
| name | the attribute name |
Remove an attribute of an element.
This handles only attributes in no namespace.
| node | the element |
| name | the attribute name |
| int xmlValidateName | ( | const xmlChar * | value, |
| int | space ) |
Check that a value conforms to the lexical space of Name.
| value | the value to check |
| space | allow spaces in front and end of the string |
| int xmlValidateNCName | ( | const xmlChar * | value, |
| int | space ) |
Check that a value conforms to the lexical space of NCName.
| value | the value to check |
| space | allow spaces in front and end of the string |
| int xmlValidateNMToken | ( | const xmlChar * | value, |
| int | space ) |
Check that a value conforms to the lexical space of NMToken.
| value | the value to check |
| space | allow spaces in front and end of the string |
| int xmlValidateQName | ( | const xmlChar * | value, |
| int | space ) |
Check that a value conforms to the lexical space of QName.
| value | the value to check |
| space | allow spaces in front and end of the string |