eyBuildLib API Reference : eyBuildLib
ebxmldom - XML document object model library
DOMPrintTree( ) - format a DOM tree and write into a stream
DOMWriteTree( ) - format a DOM tree and write into a stream
DOMWriteDocument( ) - format a DOM document and write into a stream
DOMWriteTreeToBuffer( ) - format a DOM tree and write into a buffer
DOMWriteTreeToBuffer( ) - format a DOM tree and write into a buffer
DOMGetRootElement( ) - get the root element of DOM tree
DOMGetElementByTagName( ) - find the element by tag name
DOMGetNextElementByTagName( ) - find the next element by tag name
DOMGetElementByAttribute( ) - find the next element by attribute
DOMGetNextElementByAttribute( ) - find the next element by attribute
DOMCreate( ) - create a DOM object
DOMDestroy( ) - destroy the DOM object
DOMParseFile( ) - parase XML file and generate a DOM tree.
DOMParseBuffer( ) - parase the XML data in pbuf and add into DOM tree
DOMGetLastError( ) - get the last parsing error
DOMGetCurrentLineNumber( ) - get the last line number when parsing error
DOMGetDocumentVersion( ) - get the XML document version
DOMSetDocumentVersion( ) - get the XML document version
DOMGetDocumentEncoding( ) - get the XML document encoding
DOMSetDocumentEncoding( ) - get the XML document encoding
DOMGetDocumentStandalone( ) - get the XML document is standalone or not
DOMSetDocumentStandalone( ) - set the XML document is standalone or not
DOMDeleteElement( ) - unlink a element or a sub tree from DOM tree.
DOMFreeElement( ) - free element and its children elements in a DOM tree.
DOMElementGetAttribute( ) - get attribute by element attribute name
DOMElementGetAttributeByIndex( ) - get attribute by attribute index
DOMElementGetAttributeNumber( ) - get the number of attributes
DOMElementGetTagName( ) - get the tag name of current element
DOMElementGetText( ) - get the content of current element
DOMElementSetText( ) - change the content text of current element
DOMElementSetCDataText( ) - change the content text of current element
DOMElementDeleteAttribute( ) - delete an attribute for current element
DOMElementSetAttribute( ) - change the attribute for current element
DOMElementIsComment( ) - detect current element is comment or not
DOMElementGetComment( ) - get the comment of current element
DOMElementSetComment( ) - set the comment string for current element
DOMCreateRootElement( ) - create a root element for DOM tree
DOMNewElement( ) - create a new element
DOMDupElement( ) - duplicate an element, exclude the chirdren elements
DOMEvalBuffer( ) - evaluate the XML content of a buffer
DOMCreateElementByPath( ) - recursive create XML elements by path
DOMCreateByPath( ) - recursive create XML elements by path
DOMGetElementByPath( ) - get an XML element by path
DOMGetElementsByPath( ) - get elements in the same layer of DOM tree by path
DOMElementGetTextByPath( ) - get the text of the XML element by path
DOMElementGetAttributeByPath( ) - get the attribute of the XML element by path
DOMElementSetTextByPath( ) - set the text of the XML element by path
DOMElementSetCDataTextByPath( ) - change the text of the XML element by path
DOMElementSetAttributeByPath( ) - chage the attribute of the XML element by path
This library is base on expat XML parser.
DOMPrintTree( ) - format a DOM tree and write into a stream
int DOMPrintTree ( DOM_ELEMENT * pnode, FILE * fp )
This routine formats a DOM tree and write into a stream
OK/ERROR
DOMWriteTree( ) - format a DOM tree and write into a stream
int DOMWriteTree ( DOM_ELEMENT * pnode, DOM_FWRITE fun_fwrite, void * fp )
This routine format a DOM tree and write into a stream with specific callback.
OK/ERROR
DOMWriteDocument( ) - format a DOM document and write into a stream
int DOMWriteDocument ( XML_DOM * pdom, DOM_FWRITE fun_fwrite, void * fp )
This routine format a DOM tree and write into a stream with specific callback.
OK/ERROR
DOMWriteTreeToBuffer( ) - format a DOM tree and write into a buffer
int DOMWriteTreeToBuffer ( DOM_ELEMENT * pnode, char * * ppbuf, size_t buf_size )
This routine format a DOM tree and write into a buffer. If the value of *ppbuf is NULL, it will allocate a new buffer in internal.
OK/ERROR
DOMWriteTreeToBuffer( ) - format a DOM tree and write into a buffer
int DOMWriteDocumentToBuffer ( XML_DOM * pdom, char * * ppbuf, size_t buf_size )
This routine format a DOM tree and write into a buffer. If the value of *ppbuf is NULL, it will allocate a new buffer in internal.
OK/ERROR
DOMGetRootElement( ) - get the root element of DOM tree
DOM_ELEMENT * DOMGetRootElement ( XML_DOM * pdom )
This routine is to gets the root element of DOM tree.
pointer to the root element of DOM tree.
DOMGetElementByTagName( ) - find the element by tag name
DOM_ELEMENT * DOMGetElementByTagName ( DOM_ELEMENT * pnode, const char * tagname )
This routine is to find the element by tag name from current node in the DOM tree.
the element or NULL if not found
DOMGetNextElementByTagName( ) - find the next element by tag name
DOM_ELEMENT * DOMGetNextElementByTagName ( DOM_ELEMENT * pnode, const char * tagname )
This routine is to find the next element by tag name from current node in the DOM tree.
the element or NULL if not found
DOMGetElementByAttribute( ) - find the next element by attribute
DOM_ELEMENT * DOMGetElementByAttribute ( DOM_ELEMENT * pnode, const char * attrname, /* attribute name */ const char * attrvalue /* attribute value */ )
This routine is to find the next element by attribute from current node in the DOM tree.
the element or NULL if not found
DOMGetNextElementByAttribute( ) - find the next element by attribute
DOM_ELEMENT * DOMGetNextElementByAttribute ( DOM_ELEMENT * pnode, const char * attrname, /* attribute name */ const char * attrvalue /* attribute value */ )
This routine is to find the next element by element attribute from current node in the DOM tree.
the element or NULL if not found
DOMCreate( ) - create a DOM object
XML_DOM * DOMCreate ( const char * encoding )
This routine is to create a DOM object with specific encoding. The encoding may be NULL, UTF-8, ISO-8859-1, US-ASCII, or ANSI.
pointer to the DOM object, or NULL if error occur.
DOMDestroy( ) - destroy the DOM object
int DOMDestroy ( XML_DOM * pdom )
This routine will free all the conent of the DOM object.
OK/ERROR
DOMParseFile( ) - parase XML file and generate a DOM tree.
int DOMParseFile ( XML_DOM * pdom, FILE * fp )
This routine is to parase a XML file and generate a DOM tree.
OK, or a error code
DOMParseBuffer( ) - parase the XML data in pbuf and add into DOM tree
int DOMParseBuffer ( XML_DOM * pdom, /* DOM object */ const char * pbuf, /* data buffer */ size_t size, /* length of data */ BOOL done /* it is last buffer or not */ )
This routine parase the XML data in pbuf and add into DOM tree, if it is the last buffer, done should be set to TRUE.
OK, or a error code
DOMGetLastError( ) - get the last parsing error
char * DOMGetLastError ( XML_DOM * pdom )
This routine is to get the last error message of parsing.
the last error message of parsing.
DOMGetCurrentLineNumber( ) - get the last line number when parsing error
size_t DOMGetCurrentLineNumber ( XML_DOM * pdom )
This routine is to get the last line number when parsing error.
the last line number message of parsing.
DOMGetDocumentVersion( ) - get the XML document version
char * DOMGetDocumentVersion ( XML_DOM * pdom )
This routine is to get the XML document version.
the XML document version, or NULL if not define
DOMSetDocumentVersion( ) - get the XML document version
int DOMSetDocumentVersion ( XML_DOM * pdom, const char * version )
This routine is to get the XML document version.
OK/ERROR
DOMGetDocumentEncoding( ) - get the XML document encoding
char * DOMGetDocumentEncoding ( XML_DOM * pdom )
This routine is to get the XML document encoding.
the XML document encoding, or NULL if not define
DOMSetDocumentEncoding( ) - get the XML document encoding
int DOMSetDocumentEncoding ( XML_DOM * pdom, const char * encoding )
This routine is to get the XML document encoding.
OK/ERROR
DOMGetDocumentStandalone( ) - get the XML document is standalone or not
int DOMGetDocumentStandalone ( XML_DOM * pdom )
This routine is to get the XML document is standalone or not
TRUE/FALSE
DOMSetDocumentStandalone( ) - set the XML document is standalone or not
int DOMSetDocumentStandalone ( XML_DOM * pdom, BOOL standalone )
This routine is to the XML document is standalone or not.
OK/ERROR
DOMDeleteElement( ) - unlink a element or a sub tree from DOM tree.
int DOMDeleteElement ( XML_DOM * pdom, DOM_ELEMENT * pnode )
This routine is to unlink a element or a sub tree from DOM tree, It will not free any element. If you want to free a element or a sub tree, you can call DOMFreeElement( ).
OK/ERROR
DOMFreeElement( ) - free element and its children elements in a DOM tree.
int DOMFreeElement ( DOM_ELEMENT * pnode )
This routine is to free spaces of the element and its children elements in a DOM tree.
OK/ERROR
DOMElementGetAttribute( ) - get attribute by element attribute name
char * DOMElementGetAttribute ( DOM_ELEMENT * pnode, const char * attrname )
This routine is to get attribute by element attribute name.
the attribute or NULL if the attribute is not exist
DOMElementGetAttributeByIndex( ) - get attribute by attribute index
char * DOMElementGetAttributeByIndex ( DOM_ELEMENT * pnode, size_t index )
This routine is to get attribute by attribute index of element.
the attribute or NULL if the attribute is not exist
DOMElementGetAttributeNumber( ) - get the number of attributes
int DOMElementGetAttributeNumber ( DOM_ELEMENT * pnode )
This routine is to get the number of attributes of current element.
the number of attributes
DOMElementGetTagName( ) - get the tag name of current element
char * DOMElementGetTagName ( DOM_ELEMENT * pnode )
This routine is to get the tag name of current element. If current element is a comment, it will returns a pointer to {comment}.
pointer to the tag name of current element.
DOMElementGetText( ) - get the content of current element
char * DOMElementGetText ( DOM_ELEMENT * pnode )
This routine is to get the content of current element.
pointer to the content of current element or "".
DOMElementSetText( ) - change the content text of current element
int DOMElementSetText ( DOM_ELEMENT * pnode, const char * text )
This routine is to change the content text of current element. If it returns error, it will not change the previous value.
OK/ERROR
DOMElementSetCDataText( ) - change the content text of current element
int DOMElementSetCDataText ( DOM_ELEMENT * pnode, const char * cdata )
This routine is to change the content text of current element, the data format will be marked with "".
OK/ERROR
DOMElementDeleteAttribute( ) - delete an attribute for current element
int DOMElementDeleteAttribute ( DOM_ELEMENT * pnode, const char * attrname /* attribute name */ )
This routine delete an attribute for current element.
OK/ERROR
DOMElementSetAttribute( ) - change the attribute for current element
int DOMElementSetAttribute ( DOM_ELEMENT * pnode, /* element */ const char * attrname, /* attribute name */ const char * attrvalue /* attribute value */ )
This routine changes the attribute for current element. If the attrname is not exist it will try to add a new attribute; if the attrvalue is empty it will remove this attribute.
OK/ERROR
DOMElementIsComment( ) - detect current element is comment or not
BOOL DOMElementIsComment ( DOM_ELEMENT * pnode )
This routine is to detect current element is comment or not
TRUE/FALSE
DOMElementGetComment( ) - get the comment of current element
char * DOMElementGetComment ( DOM_ELEMENT * pnode )
This routine is to get the comment of current element.
pointer to comment, or NULL if current element is not a comment
DOMElementSetComment( ) - set the comment string for current element
int DOMElementSetComment ( DOM_ELEMENT * pnode, const char * comment )
This routine is to set the comment string for current element. It will force convert current element into a comment element.
OK/ERROR
DOMCreateRootElement( ) - create a root element for DOM tree
DOM_ELEMENT * DOMCreateRootElement ( XML_DOM * pdom, const char * tagname )
This routine is to create a root element for DOM tree.
pointer to root element, NULL if exists or lack of memory
DOMNewElement( ) - create a new element
DOM_ELEMENT * DOMNewElement ( const char * tagname, /* tag name */ const char * text /* element text */ )
This routine is to create a new element.
OK/ERROR
DOMDupElement( ) - duplicate an element, exclude the chirdren elements
DOM_ELEMENT * DOMDupElement ( DOM_ELEMENT * pnode )
This routine is to duplicate an element, it includes the tag name, value and attributes, but exclude the chirdren elements.
OK/ERROR
DOMEvalBuffer( ) - evaluate the XML content of a buffer
DOM_ELEMENT * DOMEvalBuffer ( const char * encoding, const char * pbuf, size_t size )
This routine evaluate the XML content of a buffer and return a DOM tree.
pointer to the root node of DOM tree, or NULL if buffer content is not XML format.
DOMCreateElementByPath( ) - recursive create XML elements by path
int DOMCreateElementByPath ( DOM_ELEMENT * pnode, const char * path )
This routine is to recursive create XML elements by path. Path is splited by "/", such as "/xml/element". The element name can include an index, which is start from 0, with [] to create the repeat element, for exmaple "/book[2]/title" is to create the following DOM tree.
<book></book> <book></book> <book><title></title></book>
OK, or ERROR if path invalid or lack of memory
DOMCreateByPath( ) - recursive create XML elements by path
int DOMCreateByPath ( XML_DOM * pdom, const char * path )
This routine is to recursive create XML elements by path. Path is splited by "/", such as "/xml/element". The element name can include an index, which is start from 0, with [] to create the repeat element, for exmaple "/book[2]/title" is to create the following DOM tree.
<book></book> <book></book> <book><title></title></book>
OK, or ERROR if path invalid or lack of memory
DOMGetElementByPath( ) - get an XML element by path
DOM_ELEMENT * DOMGetElementByPath ( DOM_ELEMENT * pnode, const char * path )
This routine is to get an XML element by path. Path is splited by "/", such as "/xml/element". The element name can include an index, which is start from 0, with [] to get the repeat element, for exmaple "/book[2]/title" is to get the element of the tilte of the third "book3".
<book><title>book1</title></book> <book><title>book2</title></book> <book><title>book3</title></book>
pointer to the element, or NULL if no such node.
DOMGetElementsByPath( ) - get elements in the same layer of DOM tree by path
int DOMGetElementsByPath ( DOM_ELEMENT * pfrom, const char * path, DOM_ELEMENT * pdst[], size_t maxnum )
This routine is to get elements in the same layer of DOM tree by path, and store the result into the array of pdst, if it is not equals to NULL, at most maxnum elements. Path is splited by "/", such as "/xml/element".
the number of elements be found.
DOMElementGetTextByPath( ) - get the text of the XML element by path
char * DOMElementGetTextByPath ( DOM_ELEMENT * pnode, const char * path )
This routine is to get the text of the XML element by path. Path is splited by "/", such as "/xml/element". The element name can include an index, which is start from 0, with [] to get the repeat element, for exmaple "/book[2]/title" will return the "book3".
<book><title>book1</title></book> <book><title>book2</title></book> <book><title>book3</title></book>
pointer to the text of the XML element, or NULL if no such node.
DOMElementGetAttributeByPath( ) - get the attribute of the XML element by path
char * DOMElementGetAttributeByPath ( DOM_ELEMENT * pnode, const char * path, const char * attrname )
This routine is to get the text of the XML element by path. Path is splited by "/", such as "/xml/element".
pointer to the attribute of the XML element, or NULL if no such node.
DOMElementSetTextByPath( ) - set the text of the XML element by path
int DOMElementSetTextByPath ( DOM_ELEMENT * pnode, const char * path, const char * text )
This routine is to set the text of the XML element by path. Path is splited by "/", such as "/xml/element".
OK, or ERROR if no such node or lack of memory.
DOMElementSetCDataTextByPath( ) - change the text of the XML element by path
int DOMElementSetCDataTextByPath ( DOM_ELEMENT * pnode, const char * path, const char * text )
This routine is to change the CDATA text of the XML element by path, the data format will be marked with "". Path is splited by "/", such as "/xml/element".
OK, or ERROR if no such node or lack of memory.
DOMElementSetAttributeByPath( ) - chage the attribute of the XML element by path
int DOMElementSetAttributeByPath ( DOM_ELEMENT * pnode, const char * path, const char * attrname, const char * attrvalue )
This routine is to change the attribute of the XML element by path. Path is splited by "/", such as "/xml/element".
OK, or ERROR if no such node or lack of memory