Contents Previous Next

 Mini-XML 2.3 mxmlSAXLoadString()

Description

Load a string into an XML node tree using a SAX callback.

The nodes in the specified string are added to the specified top node. If no top node is provided, the XML string MUST be well-formed with a single parent node like <?xml> for the entire string. The callback function returns the value type that should be used for child nodes. If MXML_NO_CALLBACK is specified then all child nodes will be either MXML_ELEMENT or MXML_TEXT nodes.

The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type.

The SAX callback must call mxmlRetain() for any nodes that need to be kept for later use. Otherwise, nodes are deleted when the parent node is closed or after each data, comment, CDATA, or directive node.

Syntax

mxml_node_t *
mxmlSAXLoadString( mxml_node_t * top, const char * s, mxml_load_cb_t cb, mxml_sax_cb_t sax_cb, void * sax_data);

Arguments

NameDescription
topTop node
sString to load
cbCallback function or MXML_NO_CALLBACK
sax_cbSAX callback or MXML_NO_CALLBACK
sax_dataSAX user data

Returns

First node or NULL if the string has errors.


Contents Previous Next