📄 reference.html
字号:
</dl><h4 class="returnvalue">Return Value</h4><p class="description">New node</p><h4 class="discussion">Discussion</h4><p class="discussion">The new CDATA node is added to the end of the specified parent's childlist. The constant MXML_NO_PARENT can be used to specify that the newCDATA node has no parent. The data string must be nul-terminated andis copied into the new node. CDATA nodes use the MXML_ELEMENT type.</p><h3 class="function"><span class="info"> Mini-XML 2.1 </span><a name="mxmlNewCustom">mxmlNewCustom</a></h3><p class="description">Create a new custom data node.</p><p class="code"><a href="#mxml_node_t">mxml_node_t</a> *mxmlNewCustom (<br> <a href="#mxml_node_t">mxml_node_t</a> *parent,<br> void *data,<br> <a href="#mxml_custom_destroy_cb_t">mxml_custom_destroy_cb_t</a> destroy<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>parent</dt><dd class="description">Parent node or MXML_NO_PARENT</dd><dt>data</dt><dd class="description">Pointer to data</dd><dt>destroy</dt><dd class="description">Function to destroy data</dd></dl><h4 class="returnvalue">Return Value</h4><p class="description">New node</p><h4 class="discussion">Discussion</h4><p class="discussion">The new custom node is added to the end of the specified parent's childlist. The constant MXML_NO_PARENT can be used to specify that the newelement node has no parent. NULL can be passed when the data in thenode is not dynamically allocated or is separately managed.</p><h3 class="function"><a name="mxmlNewElement">mxmlNewElement</a></h3><p class="description">Create a new element node.</p><p class="code"><a href="#mxml_node_t">mxml_node_t</a> *mxmlNewElement (<br> <a href="#mxml_node_t">mxml_node_t</a> *parent,<br> const char *name<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>parent</dt><dd class="description">Parent node or MXML_NO_PARENT</dd><dt>name</dt><dd class="description">Name of element</dd></dl><h4 class="returnvalue">Return Value</h4><p class="description">New node</p><h4 class="discussion">Discussion</h4><p class="discussion">The new element node is added to the end of the specified parent's childlist. The constant MXML_NO_PARENT can be used to specify that the newelement node has no parent.</p><h3 class="function"><a name="mxmlNewInteger">mxmlNewInteger</a></h3><p class="description">Create a new integer node.</p><p class="code"><a href="#mxml_node_t">mxml_node_t</a> *mxmlNewInteger (<br> <a href="#mxml_node_t">mxml_node_t</a> *parent,<br> int integer<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>parent</dt><dd class="description">Parent node or MXML_NO_PARENT</dd><dt>integer</dt><dd class="description">Integer value</dd></dl><h4 class="returnvalue">Return Value</h4><p class="description">New node</p><h4 class="discussion">Discussion</h4><p class="discussion">The new integer node is added to the end of the specified parent's childlist. The constant MXML_NO_PARENT can be used to specify that the newinteger node has no parent.</p><h3 class="function"><a name="mxmlNewOpaque">mxmlNewOpaque</a></h3><p class="description">Create a new opaque string.</p><p class="code"><a href="#mxml_node_t">mxml_node_t</a> *mxmlNewOpaque (<br> <a href="#mxml_node_t">mxml_node_t</a> *parent,<br> const char *opaque<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>parent</dt><dd class="description">Parent node or MXML_NO_PARENT</dd><dt>opaque</dt><dd class="description">Opaque string</dd></dl><h4 class="returnvalue">Return Value</h4><p class="description">New node</p><h4 class="discussion">Discussion</h4><p class="discussion">The new opaque node is added to the end of the specified parent's childlist. The constant MXML_NO_PARENT can be used to specify that the newopaque node has no parent. The opaque string must be nul-terminated andis copied into the new node.</p><h3 class="function"><a name="mxmlNewReal">mxmlNewReal</a></h3><p class="description">Create a new real number node.</p><p class="code"><a href="#mxml_node_t">mxml_node_t</a> *mxmlNewReal (<br> <a href="#mxml_node_t">mxml_node_t</a> *parent,<br> double real<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>parent</dt><dd class="description">Parent node or MXML_NO_PARENT</dd><dt>real</dt><dd class="description">Real number value</dd></dl><h4 class="returnvalue">Return Value</h4><p class="description">New node</p><h4 class="discussion">Discussion</h4><p class="discussion">The new real number node is added to the end of the specified parent'schild list. The constant MXML_NO_PARENT can be used to specify thatthe new real number node has no parent.</p><h3 class="function"><a name="mxmlNewText">mxmlNewText</a></h3><p class="description">Create a new text fragment node.</p><p class="code"><a href="#mxml_node_t">mxml_node_t</a> *mxmlNewText (<br> <a href="#mxml_node_t">mxml_node_t</a> *parent,<br> int whitespace,<br> const char *string<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>parent</dt><dd class="description">Parent node or MXML_NO_PARENT</dd><dt>whitespace</dt><dd class="description">1 = leading whitespace, 0 = no whitespace</dd><dt>string</dt><dd class="description">String</dd></dl><h4 class="returnvalue">Return Value</h4><p class="description">New node</p><h4 class="discussion">Discussion</h4><p class="discussion">The new text node is added to the end of the specified parent's childlist. The constant MXML_NO_PARENT can be used to specify that the newtext node has no parent. The whitespace parameter is used to specifywhether leading whitespace is present before the node. The textstring must be nul-terminated and is copied into the new node.</p><h3 class="function"><a name="mxmlNewTextf">mxmlNewTextf</a></h3><p class="description">Create a new formatted text fragment node.</p><p class="code"><a href="#mxml_node_t">mxml_node_t</a> *mxmlNewTextf (<br> <a href="#mxml_node_t">mxml_node_t</a> *parent,<br> int whitespace,<br> const char *format,<br> ...<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>parent</dt><dd class="description">Parent node or MXML_NO_PARENT</dd><dt>whitespace</dt><dd class="description">1 = leading whitespace, 0 = no whitespace</dd><dt>format</dt><dd class="description">Printf-style frmat string</dd><dt>...</dt><dd class="description">Additional args as needed</dd></dl><h4 class="returnvalue">Return Value</h4><p class="description">New node</p><h4 class="discussion">Discussion</h4><p class="discussion">The new text node is added to the end of the specified parent's childlist. The constant MXML_NO_PARENT can be used to specify that the newtext node has no parent. The whitespace parameter is used to specifywhether leading whitespace is present before the node. The formatstring must be nul-terminated and is formatted into the new node.</p><h3 class="function"><span class="info"> Mini-XML 2.3 </span><a name="mxmlNewXML">mxmlNewXML</a></h3><p class="description">Create a new XML document tree.</p><p class="code"><a href="#mxml_node_t">mxml_node_t</a> *mxmlNewXML (<br> const char *version<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>version</dt><dd class="description">Version number to use</dd></dl><h4 class="returnvalue">Return Value</h4><p class="description">New ?xml node</p><h4 class="discussion">Discussion</h4><p class="discussion">The "version" argument specifies the version number to put in the?xml element node. If NULL, version 1.0 is assumed.</p><h3 class="function"><span class="info"> Mini-XML 2.3 </span><a name="mxmlRelease">mxmlRelease</a></h3><p class="description">Release a node.</p><p class="code">int mxmlRelease (<br> <a href="#mxml_node_t">mxml_node_t</a> *node<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>node</dt><dd class="description">Node</dd></dl><h4 class="returnvalue">Return Value</h4><p class="description">New reference count</p><h4 class="discussion">Discussion</h4><p class="discussion">When the reference count reaches zero, the node (and any children)is deleted via mxmlDelete().</p><h3 class="function"><a name="mxmlRemove">mxmlRemove</a></h3><p class="description">Remove a node from its parent.</p><p class="code">void mxmlRemove (<br> <a href="#mxml_node_t">mxml_node_t</a> *node<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>node</dt><dd class="description">Node to remove</dd></dl><h4 class="discussion">Discussion</h4><p class="discussion">Does not free memory used by the node - use mxmlDelete() for that.This function does nothing if the node has no parent.</p><h3 class="function"><span class="info"> Mini-XML 2.3 </span><a name="mxmlRetain">mxmlRetain</a></h3><p class="description">Retain a node.</p><p class="code">int mxmlRetain (<br> <a href="#mxml_node_t">mxml_node_t</a> *node<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>node</dt><dd class="description">Node</dd></dl><h4 class="returnvalue">Return Value</h4><p class="description">New reference count</p><h3 class="function"><span class="info"> Mini-XML 2.3 </span><a name="mxmlSAXLoadFd">mxmlSAXLoadFd</a></h3><p class="description">Load a file descriptor into an XML node treeusing a SAX callback.</p><p class="code"><a href="#mxml_node_t">mxml_node_t</a> *mxmlSAXLoadFd (<br> <a href="#mxml_node_t">mxml_node_t</a> *top,<br> int fd,<br> <a href="#mxml_load_cb_t">mxml_load_cb_t</a> cb,<br> <a href="#mxml_sax_cb_t">mxml_sax_cb_t</a> sax_cb,<br> void *sax_data<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>top</dt><dd class="description">Top node</dd><dt>fd</dt><dd class="description">File descriptor to read from</dd><dt>cb</dt><dd class="description">Callback function or MXML_NO_CALLBACK</dd><dt>sax_cb</dt><dd class="description">SAX callback or MXML_NO_CALLBACK</dd><dt>sax_data</dt><dd class="description">SAX user data</dd></dl><h4 class="returnvalue">Return Value</h4><p class="description">First node or NULL if the file could not be read.</p><h4 class="discussion">Discussion</h4><p class="discussion">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 asingle parent node like <?xml> for the entire file. The callbackfunction returns the value type that should be used for child nodes.If MXML_NO_CALLBACK is specified then all child nodes will be eitherMXML_ELEMENT or MXML_TEXT nodes.<br><br>The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loadingchild nodes of the specified type.<br><br>The SAX callback must call mxmlRetain() for any nodes that need tobe kept for later use. Otherwise, nodes are deleted when the parentnode is closed or after each data, comment, CDATA, or directive node.</p><h3 class="function"><span class="info"> Mini-XML 2.3 </span><a name="mxmlSAXLoadFile">mxmlSAXLoadFile</a></h3><p class="description">Load a file into an XML node treeusing a SAX callback.</p><p class="code"><a href="#mxml_node_t">mxml_node_t</a> *mxmlSAXLoadFile (<br> <a href="#mxml_node_t">mxml_node_t</a> *top,<br> FILE *fp,<br> <a href="#mxml_load_cb_t">mxml_load_cb_t</a> cb,<br> <a href="#mxml_sax_cb_t">mxml_sax_cb_t</a> sax_cb,<br> void *sax_data<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>top</dt><dd class="description">Top node</dd><dt>fp</dt><dd class="description">File to read from</dd><dt>cb</dt><dd class="description">Callback function or MXML_NO_CALLBACK</dd><dt>sax_cb</dt><dd class="description">SAX callback or MXML_NO_CALLBACK</dd><dt>sax_data</dt><dd class="description">SAX user data</dd></dl><h4 class="returnvalue">Return Value</h4><p class="description">First node or NULL if the file could not be read.</p><h4 class="discussion">Discussion</h4><p class="discussion">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 asingle parent node like <?xml> for the entire file. The callbackfunction returns the value type that should be used for child nodes.If MXML_NO_CALLBACK is specified then all child nodes will be eitherMXML_ELEMENT or MXML_TEXT nodes.<br><br>The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loadingchild nodes of the specified type.<br><br>The SAX callback must call mxmlRetain() for any nodes that need tobe kept for later use. Otherwise, nodes are deleted when the parent
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -