Contents Previous Next

 Mini-XML 2.3 mxmlSAXLoadFd()

Description

Load a file descriptor into an XML node tree using a SAX callback.

The nodes in the specified file are added to the specified top node. If no top node is provided, the XML file MUST be well-formed with a single parent node like <?xml> for the entire file. 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 *
mxmlSAXLoadFd( mxml_node_t * top, int fd, mxml_load_cb_t cb, mxml_sax_cb_t sax_cb, void * sax_data);

Arguments

NameDescription
topTop node
fdFile descriptor to read from
cbCallback function or MXML_NO_CALLBACK
sax_cbSAX callback or MXML_NO_CALLBACK
sax_dataSAX user data

Returns

First node or NULL if the file could not be read.


Contents Previous Next