this module describes the structures found in an tree resulting from an XML or HTML parsing, as well as the API provided for various processing on that tree Table of Contents#define BASE_BUFFER_SIZE #define LIBXML2_NEW_BUFFER #define XML_GET_CONTENT #define XML_GET_LINE #define XML_LOCAL_NAMESPACE #define XML_XML_ID #define XML_XML_NAMESPACE #define xmlChildrenNode #define xmlRootNode Structure xmlAttr struct _xmlAttr
Typedef xmlAttr * xmlAttrPtr
Structure xmlAttribute struct _xmlAttribute
Enum xmlAttributeDefault
Typedef xmlAttribute * xmlAttributePtr
Enum xmlAttributeType
+ Structure xmlBuf struct _xmlBuf
+The content of this structure is not made public by the API.
+ Typedef xmlBuf * xmlBufPtr
Structure xmlBuffer struct _xmlBuffer
Enum xmlBufferAllocationScheme
Typedef xmlBuffer * xmlBufferPtr
@@ -67,6 +70,12 @@ A:link, A:visited, A:active { text-decoration: underli
xmlNodePtr xmlAddPrevSibling (xmlNodePtr cur, xmlNodePtr elem)
xmlNodePtr xmlAddSibling (xmlNodePtr cur, xmlNodePtr elem)
void xmlAttrSerializeTxtContent (xmlBufferPtr buf, xmlDocPtr doc, xmlAttrPtr attr, const xmlChar * string)
+xmlChar * xmlBufContent (const xmlBufPtr buf)
+xmlChar * xmlBufEnd (const xmlBufPtr buf)
+int xmlBufGetNodeContent (xmlBufPtr buf, xmlNodePtr cur)
+size_t xmlBufNodeDump (xmlBufPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level, int format)
+size_t xmlBufShrink (xmlBufPtr buf, size_t len)
+size_t xmlBufUse (const xmlBufPtr buf)
int xmlBufferAdd (xmlBufferPtr buf, const xmlChar * str, int len)
int xmlBufferAddHead (xmlBufferPtr buf, const xmlChar * str, int len)
int xmlBufferCCat (xmlBufferPtr buf, const char * str)
@@ -75,6 +84,7 @@ A:link, A:visited, A:active { text-decoration: underli
xmlBufferPtr xmlBufferCreate (void)
xmlBufferPtr xmlBufferCreateSize (size_t size)
xmlBufferPtr xmlBufferCreateStatic (void * mem, size_t size)
+xmlChar * xmlBufferDetach (xmlBufferPtr buf)
int xmlBufferDump (FILE * file, xmlBufferPtr buf)
void xmlBufferEmpty (xmlBufferPtr buf)
void xmlBufferFree (xmlBufferPtr buf)
@@ -223,6 +233,7 @@ A:link, A:visited, A:active { text-decoration: underli
int xmlValidateQName (const xmlChar * value, int space)
Description
Macro: BASE_BUFFER_SIZE#define BASE_BUFFER_SIZE default buffer size 4000.
+Macro: 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.
Macro: XML_GET_CONTENT#define XML_GET_CONTENT Macro to extract the content pointer of a node.
Macro: XML_GET_LINE#define XML_GET_LINE Macro to extract the line number of an element node.
Macro: XML_LOCAL_NAMESPACE#define XML_LOCAL_NAMESPACE A namespace declaration node.
@@ -278,7 +289,11 @@ A:link, A:visited, A:active { text-decoration: underli
XML_ATTRIBUTE_ENUMERATION = 9
XML_ATTRIBUTE_NOTATION = 10
}
- Structure xmlBuffer struct _xmlBuffer {
+ Structure xmlBuf struct _xmlBuf {
+The content of this structure is not made public by the API.
+}
+ A pointer to a buffer structure, the actual structure internals are not public
+ Structure xmlBuffer struct _xmlBuffer {
xmlChar * content : The buffer content UTF8
unsigned int use : The buffer size used
unsigned int size : The buffer size
@@ -289,6 +304,7 @@ A:link, A:visited, A:active { text-decoration: underli
XML_BUFFER_ALLOC_EXACT = 2 : grow only to the minimal size
XML_BUFFER_ALLOC_IMMUTABLE = 3 : immutable buffer
XML_BUFFER_ALLOC_IO = 4 : special allocation scheme used for I/O
+ XML_BUFFER_ALLOC_HYBRID = 5 : exact up to a threshold, and doubleit thereafter
}
Structure xmlDOMWrapCtxt struct _xmlDOMWrapCtxt {
void * _private : * The type of this context, just in case
@@ -476,8 +492,8 @@ A:link, A:visited, A:active { text-decoration: underli
xmlOutputWriteCallback writecallback
xmlOutputCloseCallback closecallback
xmlCharEncodingHandlerPtr encoder : I18N conversions to UTF-8
- xmlBufferPtr buffer : Local buffer encoded in UTF-8 or ISOLat
- xmlBufferPtr conv : if encoder != NULL buffer for output
+ xmlBufPtr buffer : Local buffer encoded in UTF-8 or ISOLat
+ xmlBufPtr conv : if encoder != NULL buffer for output
int written : total number of byte written
int error
} Structure xmlParserCtxt struct _xmlParserCtxt {
@@ -568,6 +584,8 @@ A:link, A:visited, A:active { text-decoration: underli
int nodeInfoNr : Depth of the parsing stack
int nodeInfoMax : Max depth of the parsing stack
xmlParserNodeInfo * nodeInfoTab : array of nodeInfos
+ int input_id : we need to label inputs
+ unsigned long sizeentcopy : volume of entity copy
} Structure xmlParserInput struct _xmlParserInput {
xmlParserInputBufferPtr buf : UTF-8 encoded buffer
const char * filename : The file analyzed, if any
@@ -589,8 +607,8 @@ A:link, A:visited, A:active { text-decoration: underli
xmlInputReadCallback readcallback
xmlInputCloseCallback closecallback
xmlCharEncodingHandlerPtr encoder : I18N conversions to UTF-8
- xmlBufferPtr buffer : Local buffer encoded in UTF-8
- xmlBufferPtr raw : if encoder != NULL buffer for raw input
+ xmlBufPtr buffer : Local buffer encoded in UTF-8
+ xmlBufPtr raw : if encoder != NULL buffer for raw input
int compressed : -1=unknown, 0=not compressed, 1=compres
int error
unsigned long rawconsumed : amount consumed from raw
@@ -650,7 +668,19 @@ A:link, A:visited, A:active { text-decoration: underli
Add a new element @elem to the list of siblings of @cur merging adjacent TEXT nodes (@elem may be freed) If the new element was already inserted in a document it is first unlinked from its existing context.
cur: | the child node | elem: | the new node | Returns: | the new element or NULL in case of error. |
Function: xmlAttrSerializeTxtContentvoid xmlAttrSerializeTxtContent (xmlBufferPtr buf, xmlDocPtr doc, xmlAttrPtr attr, const xmlChar * string)
Serialize text attribute values to an xml simple buffer
-buf: | the XML buffer output | doc: | the document | attr: | the attribute node | string: | the text content |
Function: xmlBufferAddint xmlBufferAdd (xmlBufferPtr buf, const xmlChar * str, int len)
+buf: | the XML buffer output | doc: | the document | attr: | the attribute node | string: | the text content |
Function: xmlBufContentxmlChar * xmlBufContent (const xmlBufPtr buf)
+ Function to extract the content of a buffer
+buf: | the buffer | Returns: | the internal content |
Function: xmlBufEndxmlChar * xmlBufEnd (const xmlBufPtr buf)
+ Function to extract the end of the content of a buffer
+buf: | the buffer | Returns: | the end of the internal content or NULL in case of error |
Function: xmlBufGetNodeContentint xmlBufGetNodeContent (xmlBufPtr buf, xmlNodePtr cur)
+ Read the value of a node @cur, this can be either the text carried directly by this node if it's a TEXT node or the aggregate string of the values carried by this node child's (TEXT and ENTITY_REF). Entity references are substituted. Fills up the buffer @buffer with this value
+buf: | a buffer xmlBufPtr | cur: | the node being read | Returns: | 0 in case of success and -1 in case of error. |
Function: xmlBufNodeDumpsize_t xmlBufNodeDump (xmlBufPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level, int format)
+ Dump an XML node, recursive behaviour,children are printed too. Note that @format = 1 provide node indenting only if xmlIndentTreeOutput = 1 or xmlKeepBlanksDefault(0) was called
+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 |
Function: xmlBufShrinksize_t xmlBufShrink (xmlBufPtr buf, size_t len)
+ Remove the beginning of an XML buffer. NOTE that this routine behaviour 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 to dump | len: | the number of xmlChar to remove | Returns: | the number of byte removed or 0 in case of failure |
Function: xmlBufUsesize_t xmlBufUse (const xmlBufPtr buf)
+ Function to get the length of a buffer
+buf: | the buffer | Returns: | the length of data in the internal content |
Function: xmlBufferAddint xmlBufferAdd (xmlBufferPtr buf, const xmlChar * str, int len)
Add a string range to an XML buffer. if len == -1, the length of str is recomputed.
buf: | the buffer to dump | str: | the #xmlChar string | len: | the number of #xmlChar to add | Returns: | 0 successful, a positive error code number otherwise and -1 in case of internal or API error. |
Function: xmlBufferAddHeadint xmlBufferAddHead (xmlBufferPtr buf, const xmlChar * str, int len)
Add a string range to the beginning of an XML buffer. if len == -1, the length of @str is recomputed.
@@ -666,7 +696,9 @@ A:link, A:visited, A:active { text-decoration: underli
routine to create an XML buffer.
size: | initial size of buffer | Returns: | the new structure. |
Function: xmlBufferCreateStaticxmlBufferPtr xmlBufferCreateStatic (void * mem, size_t size)
routine to create an XML buffer from an immutable memory area. The area won't be modified nor copied, and is expected to be present until the end of the buffer lifetime.
-mem: | the memory area | size: | the size in byte | Returns: | the new structure. |
Function: xmlBufferDumpint xmlBufferDump (FILE * file, xmlBufferPtr buf)
+mem: | the memory area | size: | the size in byte | Returns: | the new structure. |
Function: xmlBufferDetachxmlChar * xmlBufferDetach (xmlBufferPtr buf)
+ Remove the string contained in a buffer and gie it back to the caller. The buffer is reset to an empty content. This doesn't work with immutable buffers as they can't be reset.
+buf: | the buffer | Returns: | the previous string contained by the buffer. |
Function: xmlBufferDumpint xmlBufferDump (FILE * file, xmlBufferPtr buf)
Dumps an XML buffer to a FILE *.
file: | the file output | buf: | the buffer to dump | Returns: | the number of #xmlChar written |
Function: xmlBufferEmptyvoid xmlBufferEmpty (xmlBufferPtr buf)
empty a buffer.
@@ -766,7 +798,7 @@ A:link, A:visited, A:active { text-decoration: underli
Function: xmlFreePropListvoid xmlFreePropList (xmlAttrPtr cur)
Free a property and all its siblings, all the children are freed too.
cur: | the first property in the list |
Function: xmlGetBufferAllocationSchemexmlBufferAllocationScheme xmlGetBufferAllocationScheme (void)
- Types are XML_BUFFER_ALLOC_EXACT - use exact sizes, keeps memory usage down XML_BUFFER_ALLOC_DOUBLEIT - double buffer when extra needed, improves performance
+ Types are XML_BUFFER_ALLOC_EXACT - use exact sizes, keeps memory usage down XML_BUFFER_ALLOC_DOUBLEIT - double buffer when extra needed, improves performance XML_BUFFER_ALLOC_HYBRID - use exact sizes on small strings to keep memory usage tight in normal usage, and doubleit on large strings to avoid pathological performance.
Returns: | the current allocation scheme |
Function: xmlGetCompressModeint xmlGetCompressMode (void)
get the default compression mode used, ZLIB based.
Returns: | 0 (uncompressed) to 9 (max compression) |
Function: xmlGetDocCompressModeint xmlGetDocCompressMode (xmlDocPtr doc)
@@ -776,7 +808,7 @@ A:link, A:visited, A:active { text-decoration: underli
doc: | the document pointer | Returns: | a pointer to the DTD structure or NULL if not found |
Function: xmlGetLastChildxmlNodePtr xmlGetLastChild (xmlNodePtr parent)
Search the last child of a node.
parent: | the parent node | Returns: | the last child or NULL if none. |
Function: xmlGetLineNolong xmlGetLineNo (xmlNodePtr node)
- Get line number of @node. This requires activation of this option before invoking the parser by calling xmlLineNumbersDefault(1)
+ Get line number of @node. Try to override the limitation of lines being store in 16 bits ints if XML_PARSE_BIG_LINES parser option was used
node: | valid node | Returns: | the line number if successful, -1 otherwise |
Function: xmlGetNoNsPropxmlChar * xmlGetNoNsProp (xmlNodePtr node, const xmlChar * name)
Search and get the value of an attribute associated to a node This does the entity substitution. This function looks in DTD attribute declaration for #FIXED or default declaration values unless DTD use has been turned off. This function is similar to xmlGetProp except it will accept only an attribute in no namespace.
node: | the node | name: | the attribute name | Returns: | the attribute value or NULL if not found. It's up to the caller to free the memory with xmlFree(). |
Function: xmlGetNodePathxmlChar * xmlGetNodePath (xmlNodePtr node)
@@ -860,7 +892,7 @@ A:link, A:visited, A:active { text-decoration: underli
cur: | the node being modified | content: | extra content | len: | the size of @content |
Function: xmlNodeBufGetContentint xmlNodeBufGetContent (xmlBufferPtr buffer, xmlNodePtr cur)
Read the value of a node @cur, this can be either the text carried directly by this node if it's a TEXT node or the aggregate string of the values carried by this node child's (TEXT and ENTITY_REF). Entity references are substituted. Fills up the buffer @buffer with this value
buffer: | a buffer | cur: | the node being read | Returns: | 0 in case of success and -1 in case of error. |
Function: xmlNodeDumpint xmlNodeDump (xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level, int format)
- Dump an XML node, recursive behaviour,children are printed too. Note that @format = 1 provide node indenting only if xmlIndentTreeOutput = 1 or xmlKeepBlanksDefault(0) was called
+ Dump an XML node, recursive behaviour,children are printed too. Note that @format = 1 provide node indenting only if xmlIndentTreeOutput = 1 or xmlKeepBlanksDefault(0) was called Since this is using xmlBuffer structures it is limited to 2GB and somehow deprecated, use xmlBufNodeDump() instead.
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 or -1 in case of error |
Function: xmlNodeDumpOutputvoid xmlNodeDumpOutput (xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level, int format, const char * encoding)
Dump an XML node, recursive behaviour, children are printed too. Note that @format = 1 provide node indenting only if xmlIndentTreeOutput = 1 or xmlKeepBlanksDefault(0) was called
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 |
Function: xmlNodeGetBasexmlChar * xmlNodeGetBase (xmlDocPtr doc, xmlNodePtr cur)
@@ -933,7 +965,7 @@ A:link, A:visited, A:active { text-decoration: underli
parse an XML qualified name string [NS 5] QName ::= (Prefix ':')? LocalPart [NS 6] Prefix ::= NCName [NS 7] LocalPart ::= NCName
name: | the full QName | prefix: | a xmlChar ** | Returns: | NULL if not a QName, otherwise the local part, and prefix is updated to get the Prefix if any. |
Function: xmlSplitQName3const xmlChar * xmlSplitQName3 (const xmlChar * name, int * len)
parse an XML qualified name string,i
-name: | the full QName | len: | an int * | Returns: | NULL if it is not a Qualified Name, otherwise, update len with the lenght in byte of the prefix and return a pointer to the start of the name without the prefix |
Function: xmlStringGetNodeListxmlNodePtr xmlStringGetNodeList (xmlDocPtr doc, const xmlChar * value)
+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 |
Function: xmlStringGetNodeListxmlNodePtr xmlStringGetNodeList (xmlDocPtr doc, const xmlChar * value)
Parse the value string and build the node list associated. Should produce a flat tree with only TEXTs and ENTITY_REFs.
doc: | the document | value: | the value of the attribute | Returns: | a pointer to the first child |
Function: xmlStringLenGetNodeListxmlNodePtr xmlStringLenGetNodeList (xmlDocPtr doc, const xmlChar * value, int len)
Parse the value string and build the node list associated. Should produce a flat tree with only TEXTs and ENTITY_REFs.
@@ -942,7 +974,7 @@ A:link, A:visited, A:active { text-decoration: underli
node: | the node | content: | the content | len: | @content length | Returns: | -1 in case of error, 0 otherwise |
Function: xmlTextMergexmlNodePtr xmlTextMerge (xmlNodePtr first, xmlNodePtr second)
Merge two text nodes into one
first: | the first text node | second: | the second text node being merged | Returns: | the first text node augmented |
Function: xmlUnlinkNodevoid xmlUnlinkNode (xmlNodePtr cur)
- Unlink a node from it's current context, the node is not freed
+ Unlink a node from it's current context, the node is not freed If one need to free the node, use xmlFreeNode() routine after the unlink to discard it. Note that namespace nodes can't be unlinked as they do not have pointer to their parent.
Function: xmlUnsetNsPropint xmlUnsetNsProp (xmlNodePtr node, xmlNsPtr ns, const xmlChar * name)
Remove an attribute carried by a node.
node: | the node | ns: | the namespace definition | name: | the attribute name | Returns: | 0 if successful, -1 if not found |
Function: xmlUnsetPropint xmlUnsetProp (xmlNodePtr node, const xmlChar * name)
|