DOM API functions.
Typedefs | |
typedef int | OSRTDOMError |
0 - OK <0 - Error code (see rtxsrc/rtxErrCodes.h) >0 - Supplementary code | |
Functions | |
EXTERNDOM void | domParserInit () |
Inits parser. | |
EXTERNDOM void | domParserShutdown () |
Shutdowns parser. | |
EXTERNDOM OSRTDOMError | domParseFile (const char *fileSpec, OSRTDOMDocPtr *pXmlDoc) |
Parse the file into a DOM document. | |
EXTERNDOM OSRTDOMError | domGetRootElement (OSRTDOMDocPtr xmlDoc, OSRTDOMNodePtr *pNode) |
Returns root node for the document. | |
EXTERNDOM OSRTDOMError | domGetDoc (OSRTDOMNodePtr node, OSRTDOMDocPtr *pXmlDoc) |
Returns the document for the given element. | |
EXTERNDOM void | domFreeDoc (OSRTDOMDocPtr xmlDoc) |
Frees document. | |
EXTERNDOM OSRTDOMError | domGetNext (const OSRTDOMNodePtr curNode, OSRTDOMNodePtr *pNextNode) |
Returns next element node (down sibling). | |
EXTERNDOM OSRTDOMError | domGetChild (const OSRTDOMNodePtr curNode, OSRTDOMNodePtr *pChildNode) |
Returns first (top) child node. | |
EXTERNDOM OSRTDOMError | domGetElementName (const OSRTDOMNodePtr curNode, const OSUTF8CHAR **ppName, const OSUTF8CHAR **ppNsPrefix, const OSUTF8CHAR **ppNsUri) |
Returns node's name and prefix (if any). | |
EXTERNDOM int | domGetNodeContent (OSRTDOMContCtxtPtr *ppCtxt, const OSRTDOMNodePtr curNode, const OSUTF8CHAR **ppValue, size_t *pValueLen, OSBOOL *pCdataProcessed) |
Gets the node's content. | |
EXTERNDOM OSRTDOMError | domGetNodeFirstAttribute (OSRTDOMAttrCtxtPtr *ppCtxt, const OSRTDOMNodePtr curNode, OSRTDOMAttrPtr *pTopAttrNode) |
Returns the pointer to the first (top) attribute of the node. | |
EXTERNDOM int | domGetNodeAttributesNum (const OSRTDOMNodePtr curNode) |
Returns number of attributes in the node. | |
EXTERNDOM OSRTDOMError | domGetNextAttr (OSRTDOMAttrCtxtPtr *ppCtxt, const OSRTDOMAttrPtr curAttrNode, OSRTDOMAttrPtr *pAttrNode) |
Returns the next attribute. | |
EXTERNDOM OSRTDOMError | domGetAttrData (const OSRTDOMAttrPtr curAttrNode, const OSUTF8CHAR **ppAttrName, const OSUTF8CHAR **ppAttrValue, const OSUTF8CHAR **ppAttrPrefix, const OSUTF8CHAR **ppAttrUri) |
Returns the attribute's name and value. | |
EXTERNDOM OSRTDOMError | domSaveDoc (OSRTDOMDocPtr xmlDoc, const char *filename) |
Saves DOM document to a file. | |
EXTERNDOM OSRTDOMError | domCreateDocument (OSCTXT *pctxt, OSRTDOMDocPtr *pXmlDoc, const OSUTF8CHAR *pNodeName, OSXMLNamespace *pNS, OSRTDList *pNSAttrs) |
Creates a new document and a root element. | |
EXTERNDOM OSRTDOMError | domCreateChild (OSCTXT *pctxt, OSRTDOMNodePtr parentNode, const OSUTF8CHAR *pNodeName, OSXMLNamespace *pNS, OSRTDList *pNSAttrs, OSRTDOMNodePtr *pNewNode) |
Creates new child node. | |
EXTERNDOM OSRTDOMError | domAddAttribute (OSCTXT *pctxt, OSRTDOMNodePtr node, const OSUTF8CHAR *pAttrName, const OSUTF8CHAR *pAttrValue, OSXMLNamespace *pNS, OSRTDList *pNSAttrs) |
Creates new attribute and adds it to the node. | |
EXTERNDOM OSRTDOMError | domAddContent (OSRTDOMNodePtr node, const OSUTF8CHAR *pContent, size_t contentLen) |
Adds content (text) to the node. | |
EXTERNDOM OSRTDOMError | domAddCdata (OSRTDOMNodePtr node, const OSUTF8CHAR *pContent, size_t contentLen) |
Adds CDATA section to the node. |
Function Documentation
EXTERNDOM OSRTDOMError domAddAttribute | ( | OSCTXT * | pctxt, | |
OSRTDOMNodePtr | node, | |||
const OSUTF8CHAR * | pAttrName, | |||
const OSUTF8CHAR * | pAttrValue, | |||
OSXMLNamespace * | pNS, | |||
OSRTDList * | pNSAttrs | |||
) |
Creates new attribute and adds it to the node.
- Parameters:
-
pctxt Pointer to context block structure. node Pointer to the node where attribute to be added. pAttrName Pointer to the null-terminated string containing name of the attribute. pAttrValue Pointer to the null-terminated string containing name of the value. pNS XML namespace information (prefix and URI). pNSAttrs List of namespace attributes to be added to element.
- Returns:
- 0 - success, otherwise error code.
EXTERNDOM OSRTDOMError domAddCdata | ( | OSRTDOMNodePtr | node, | |
const OSUTF8CHAR * | pContent, | |||
size_t | contentLen | |||
) |
Adds CDATA section to the node.
- Parameters:
-
node Pointer to the node where content to be added. pContent Pointer to UTF-8 encoded content to be wrapped by CDATA section. contentLen Length of the content
- Returns:
- 0 - success, otherwise error code.
EXTERNDOM OSRTDOMError domAddContent | ( | OSRTDOMNodePtr | node, | |
const OSUTF8CHAR * | pContent, | |||
size_t | contentLen | |||
) |
Adds content (text) to the node.
- Parameters:
-
node Pointer to the node where content to be added. pContent Pointer to UTF-8 encoded content. contentLen Length of the content
- Returns:
- 0 - success, otherwise error code.
EXTERNDOM OSRTDOMError domCreateChild | ( | OSCTXT * | pctxt, | |
OSRTDOMNodePtr | parentNode, | |||
const OSUTF8CHAR * | pNodeName, | |||
OSXMLNamespace * | pNS, | |||
OSRTDList * | pNSAttrs, | |||
OSRTDOMNodePtr * | pNewNode | |||
) |
Creates new child node.
- Parameters:
-
pctxt Pointer to context block structure. parentNode Pointer to the parent node pNodeName Name of the node pNS XML namespace information (prefix and URI). pNSAttrs List of namespace attributes to be added to element. pNewNode Pointer to pointer to newly created node.
- Returns:
- 0 - success, otherwise error code.
EXTERNDOM OSRTDOMError domCreateDocument | ( | OSCTXT * | pctxt, | |
OSRTDOMDocPtr * | pXmlDoc, | |||
const OSUTF8CHAR * | pNodeName, | |||
OSXMLNamespace * | pNS, | |||
OSRTDList * | pNSAttrs | |||
) |
Creates a new document and a root element.
- Parameters:
-
pctxt Pointer to context block structure. pXmlDoc Pointer to pointer to the newly created empty DOM document. pNodeName Name of the node pNS XML namespace information (prefix and URI). pNSAttrs List of namespace attributes to be added to element.
- Returns:
- 0 - success, otherwise error code.
EXTERNDOM void domFreeDoc | ( | OSRTDOMDocPtr | xmlDoc | ) |
Frees document.
- Parameters:
-
xmlDoc Pointer to the DOM document context
EXTERNDOM OSRTDOMError domGetAttrData | ( | const OSRTDOMAttrPtr | curAttrNode, | |
const OSUTF8CHAR ** | ppAttrName, | |||
const OSUTF8CHAR ** | ppAttrValue, | |||
const OSUTF8CHAR ** | ppAttrPrefix, | |||
const OSUTF8CHAR ** | ppAttrUri | |||
) |
Returns the attribute's name and value.
- Parameters:
-
curAttrNode Pointer to current attribute node, ppAttrName Pointer to pointer to receive attribute's name. ppAttrValue Pointer to pointer to receive attribute's value. ppAttrPrefix Pointer to pointer to receive namespace's prefix. ppAttrUri Pointer to pointer to receive namespace's uri.
- Returns:
- 0 - success, otherwise error code.
EXTERNDOM OSRTDOMError domGetChild | ( | const OSRTDOMNodePtr | curNode, | |
OSRTDOMNodePtr * | pChildNode | |||
) |
Returns first (top) child node.
- Parameters:
-
curNode Pointer to current node, pChildNode Pointer to pointer to receive the child node.
- Returns:
- 0 - success, otherwise error code.
EXTERNDOM OSRTDOMError domGetDoc | ( | OSRTDOMNodePtr | node, | |
OSRTDOMDocPtr * | pXmlDoc | |||
) |
Returns the document for the given element.
- Parameters:
-
node Pointer to a node. pXmlDoc Pointer to a pointer to the DOM document context
- Returns:
- 0 - success, otherwise error code.
EXTERNDOM OSRTDOMError domGetElementName | ( | const OSRTDOMNodePtr | curNode, | |
const OSUTF8CHAR ** | ppName, | |||
const OSUTF8CHAR ** | ppNsPrefix, | |||
const OSUTF8CHAR ** | ppNsUri | |||
) |
Returns node's name and prefix (if any).
- Parameters:
-
curNode Pointer to current node, ppName Pointer to pointer to receive the node's local name. ppNsPrefix Pointer to pointer to receive the node's prefix. May be NULL, if prefix is not important. ppNsUri Pointer to pointer to receive the namespace's Uri.
- Returns:
- 0 - success, otherwise error code.
EXTERNDOM OSRTDOMError domGetNext | ( | const OSRTDOMNodePtr | curNode, | |
OSRTDOMNodePtr * | pNextNode | |||
) |
Returns next element node (down sibling).
- Parameters:
-
curNode Pointer to current node, pNextNode Pointer to pointer to receive the next node.
- Returns:
- 0 - success, otherwise error code.
EXTERNDOM OSRTDOMError domGetNextAttr | ( | OSRTDOMAttrCtxtPtr * | ppCtxt, | |
const OSRTDOMAttrPtr | curAttrNode, | |||
OSRTDOMAttrPtr * | pAttrNode | |||
) |
Returns the next attribute.
- Parameters:
-
ppCtxt Pointer to an implementation-specific context pointer, curAttrNode Pointer to current attribute node, pAttrNode Pointer to pointer to receive the next attribute node.
- Returns:
- 0 - success, otherwise error code.
EXTERNDOM int domGetNodeAttributesNum | ( | const OSRTDOMNodePtr | curNode | ) |
Returns number of attributes in the node.
- Parameters:
-
curNode Pointer to current node,
- Returns:
- Number of attributes in the node.
EXTERNDOM int domGetNodeContent | ( | OSRTDOMContCtxtPtr * | ppCtxt, | |
const OSRTDOMNodePtr | curNode, | |||
const OSUTF8CHAR ** | ppValue, | |||
size_t * | pValueLen, | |||
OSBOOL * | pCdataProcessed | |||
) |
Gets the node's content.
- Parameters:
-
ppCtxt Pointer to an implementation-specific content context pointer; curNode Pointer to the current node; ppValue Pointer to pointer to receive value; pValueLen Pointer to value length; may be NULL. pCdataProcessed Pointer to boolean value; this value will be set to TRUE if CDATA section was proceeded; otherwise FALSE.
- Returns:
- 0 - if content retrieved successfully <0 - the error code;
EXTERNDOM OSRTDOMError domGetNodeFirstAttribute | ( | OSRTDOMAttrCtxtPtr * | ppCtxt, | |
const OSRTDOMNodePtr | curNode, | |||
OSRTDOMAttrPtr * | pTopAttrNode | |||
) |
Returns the pointer to the first (top) attribute of the node.
The context pointer will be passed to subsequent calls to domGetNextAttr.
- Parameters:
-
ppCtxt Pointer to an implementation-specific context pointer, curNode Pointer to current node, pTopAttrNode Pointer to pointer to receive the first attribute node. domGetNextAttr/domGetPrevAttr functions may be used to get next/previous attributes.
- Returns:
- 0 - success, otherwise error code.
EXTERNDOM OSRTDOMError domGetRootElement | ( | OSRTDOMDocPtr | xmlDoc, | |
OSRTDOMNodePtr * | pNode | |||
) |
Returns root node for the document.
- Parameters:
-
xmlDoc Pointer to the DOM document context pNode Pointer to pointer to receive the root node.
- Returns:
- 0 - success, otherwise error code.
EXTERNDOM OSRTDOMError domParseFile | ( | const char * | fileSpec, | |
OSRTDOMDocPtr * | pXmlDoc | |||
) |
Parse the file into a DOM document.
- Parameters:
-
fileSpec File name pXmlDoc Pointer to a pointer to newly created DOM document.
- Returns:
- 0 - success, otherwise error code.
EXTERNDOM OSRTDOMError domSaveDoc | ( | OSRTDOMDocPtr | xmlDoc, | |
const char * | filename | |||
) |
Saves DOM document to a file.
This function is supplementary and it is not obligatory to implement it.
- Parameters:
-
xmlDoc Pointer to the DOM document context. filename Pointer to file name.
- Returns:
- 0 - success, otherwise error code.