DOM runtime encode/decode functions.


Functions

EXTERNDOM int rtDomAddAttr (OSCTXT *pctxt, OSRTDOMDocPtr domDoc, OSRTDOMNodePtr node, const OSUTF8CHAR *attrName, OSXMLNamespace *pNS, OSRTDList *pNSAttrs)
 Adds attribute to the node.
EXTERNDOM int rtDomAddNode (OSCTXT *pctxt, OSRTDOMDocPtr domDoc, OSRTDOMNodePtr parentNode, const OSUTF8CHAR *elemName, OSXMLNamespace *pNS, OSRTDList *pNSAttrs)
 Adds child node to the parent's node.
EXTERNDOM int rtDomAddNSAttrs (OSCTXT *pctxt, OSRTDOMDocPtr domDoc, OSRTDOMNodePtr rootNode, OSRTDList *pNSAttrs)
 Adds namespace attributes to the root node.
EXTERNDOM int rtDomEncXSIAttrs (OSCTXT *pctxt, OSRTDOMDocPtr domDoc, OSRTDOMNodePtr node, OSBOOL needXSI)
 Adds XSI attributes to the node.
EXTERNDOM int rtDomDecodeDoc (OSRTDOMDocPtr domDoc, struct OSSAXHandlerBase *pSaxBase)
 This function starts decoding of the DOM document.
EXTERNDOM int rtDomEncStringValue (OSCTXT *pctxt, const OSUTF8CHAR *pvalue)
 This function encodes a variable of the XSD string type.
EXTERNDOM int rtDomEncString (OSCTXT *pctxt, OSXMLSTRING *pvalue)
 This function encodes a variable of the XSD string type.
EXTERNDOM int rtDomEncAny (OSCTXT *pctxt, OSRTDOMDocPtr domDoc, OSRTDOMNodePtr parentNode, const OSXMLSTRING *pXmlData, const OSUTF8CHAR *elemName, OSXMLNamespace *pNS, OSRTDList *pNSAttrs)
 This function encodes a variable of the XSD any type.
EXTERNDOM int rtDomEncAnyAttr (OSCTXT *pctxt, OSRTDOMDocPtr domDoc, OSRTDOMNodePtr node, OSRTDList *pAnyAttrList)
 This function encodes a list of OSAnyAttr attributes in which the name and value are given as a UTF-8 string.
EXTERNDOM int rtDomSetNode (OSCTXT *pctxt, OSRTDOMDocPtr domDoc, OSRTDOMNodePtr curNode)
 Adds content or CDATA section to the node.
EXTERNDOM int rtDomAddSubTree (OSCTXT *pctxt, OSRTDOMDocPtr xmlDoc, OSRTDOMNodePtr node, const OSUTF8CHAR *pXmlData, size_t dataLen)
 This function adds the subtree to the specified node.

Function Documentation

EXTERNDOM int rtDomAddAttr ( OSCTXT *  pctxt,
OSRTDOMDocPtr  domDoc,
OSRTDOMNodePtr  node,
const OSUTF8CHAR *  attrName,
OSXMLNamespace pNS,
OSRTDList *  pNSAttrs 
)

Adds attribute to the node.

The value is taken from the context's buffer (pctxt->buffer.data with the length pctxt->buffer.byteIndex). This function resets pctxt->buffer.byteIndex to 0.

Parameters:
pctxt A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
domDoc A pointer to a DOM-document.
node A pointer to a node where attribute to be added.
attrName A pointer to attribute's name.
pNS XML namespace information (prefix and URI).
pNSAttrs List of namespace attributes to be added to element.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNDOM int rtDomAddNode ( OSCTXT *  pctxt,
OSRTDOMDocPtr  domDoc,
OSRTDOMNodePtr  parentNode,
const OSUTF8CHAR *  elemName,
OSXMLNamespace pNS,
OSRTDList *  pNSAttrs 
)

Adds child node to the parent's node.

The content (text) is taken from the context's buffer (pctxt->buffer.data with the length pctxt->buffer.byteIndex). If pctxt->buffer.byteIndex is 0 then empty element is added. This function resets pctxt->buffer.byteIndex to 0.

Parameters:
pctxt A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
domDoc A pointer to a DOM-document.
parentNode A pointer to a parent node.
elemName A pointer to element's name.
pNS XML namespace information (prefix and URI).
pNSAttrs List of namespace attributes to be added to element.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNDOM int rtDomAddNSAttrs ( OSCTXT *  pctxt,
OSRTDOMDocPtr  domDoc,
OSRTDOMNodePtr  rootNode,
OSRTDList *  pNSAttrs 
)

Adds namespace attributes to the root node.

Parameters:
pctxt A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
domDoc A pointer to a DOM-document.
rootNode A pointer to a root node.
pNSAttrs A pointer to a list of namespace attrs.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNDOM int rtDomAddSubTree ( OSCTXT *  pctxt,
OSRTDOMDocPtr  xmlDoc,
OSRTDOMNodePtr  node,
const OSUTF8CHAR *  pXmlData,
size_t  dataLen 
)

This function adds the subtree to the specified node.

The pXmlData contains the fragment of XML data. This fragment is parsed to sub-tree and then inserted as children to the 'node'.

Parameters:
pctxt Pointer to the context structure. This context might be used for memory allocations, if necessary.
xmlDoc Pointer to the document
node Pointer to the node where sub-tree to be inserted.
pXmlData Pointer to UTF-8 string representing fragment of XML data. For example, "<elem>data</elem>".
dataLen Length of XML data.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNDOM int rtDomDecodeDoc ( OSRTDOMDocPtr  domDoc,
struct OSSAXHandlerBase *  pSaxBase 
)

This function starts decoding of the DOM document.

Parameters:
domDoc A pointer to a DOM-document.
pSaxBase A pointer to SAX handler's base.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNDOM int rtDomEncAny ( OSCTXT *  pctxt,
OSRTDOMDocPtr  domDoc,
OSRTDOMNodePtr  parentNode,
const OSXMLSTRING *  pXmlData,
const OSUTF8CHAR *  elemName,
OSXMLNamespace pNS,
OSRTDList *  pNSAttrs 
)

This function encodes a variable of the XSD any type.

This is considered to be a fully-wrapped element of any type (for example: <myType>myData</myType>)

Parameters:
pctxt Pointer to context block structure.
domDoc A pointer to a DOM-document.
parentNode A pointer to a parent node.
pXmlData Value to be encoded. This is a string containing the fully-encoded XML text to be copied to the output stream.
elemName XML element name. A name must be provided. If NULL pointer is passed, no element tag is added to the encoded value.
pNS XML namespace information (prefix and URI).
pNSAttrs List of namespace attributes to be added to element.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNDOM int rtDomEncAnyAttr ( OSCTXT *  pctxt,
OSRTDOMDocPtr  domDoc,
OSRTDOMNodePtr  node,
OSRTDList *  pAnyAttrList 
)

This function encodes a list of OSAnyAttr attributes in which the name and value are given as a UTF-8 string.

Parameters:
pctxt Pointer to context block structure.
domDoc A pointer to a DOM-document.
node A pointer to a node where attributes to be added.
pAnyAttrList List of attributes.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNDOM int rtDomEncString ( OSCTXT *  pctxt,
OSXMLSTRING *  pvalue 
)

This function encodes a variable of the XSD string type.

Parameters:
pctxt Pointer to context block structure.
pvalue XML string value to be encoded.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNDOM int rtDomEncStringValue ( OSCTXT *  pctxt,
const OSUTF8CHAR *  pvalue 
)

This function encodes a variable of the XSD string type.

Parameters:
pctxt Pointer to context block structure.
pvalue Null-terminated XML string value to be encoded.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNDOM int rtDomEncXSIAttrs ( OSCTXT *  pctxt,
OSRTDOMDocPtr  domDoc,
OSRTDOMNodePtr  node,
OSBOOL  needXSI 
)

Adds XSI attributes to the node.

Parameters:
pctxt A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
domDoc A pointer to a DOM-document.
node A pointer to a node.
needXSI Determines whether XSI namespace declaration needed.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNDOM int rtDomSetNode ( OSCTXT *  pctxt,
OSRTDOMDocPtr  domDoc,
OSRTDOMNodePtr  curNode 
)

Adds content or CDATA section to the node.

The content (text) is taken from the context's buffer (pctxt->buffer.data with the length pctxt->buffer.byteIndex). This function resets pctxt->buffer.byteIndex to 0.

Parameters:
pctxt A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
domDoc A pointer to a DOM-document.
curNode A pointer to a current node.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.