📄 reference.html
字号:
<dt>string</dt><dd class="description">String</dd></dl><h4 class="returnvalue">Return Value</h4><p class="description">0 on success, -1 on failure</p><h4 class="discussion">Discussion</h4><p class="discussion">The node is not changed if it is not a text node.</p><h3 class="function"><a name="mxmlSetTextf">mxmlSetTextf</a></h3><p class="description">Set the value of a text node to a formatted string.</p><p class="code">int mxmlSetTextf (<br> <a href="#mxml_node_t">mxml_node_t</a> *node,<br> int whitespace,<br> const char *format,<br> ...<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>node</dt><dd class="description">Node to set</dd><dt>whitespace</dt><dd class="description">1 = leading whitespace, 0 = no whitespace</dd><dt>format</dt><dd class="description">Printf-style format string</dd><dt>...</dt><dd class="description">Additional arguments as needed</dd></dl><h4 class="returnvalue">Return Value</h4><p class="description">0 on success, -1 on failure</p><h4 class="discussion">Discussion</h4><p class="discussion">The node is not changed if it is not a text node.</p><h3 class="function"><span class="info"> Mini-XML 2.3 </span><a name="mxmlSetWrapMargin">mxmlSetWrapMargin</a></h3><p class="description">Set the the wrap margin when saving XML data.</p><p class="code">void mxmlSetWrapMargin (<br> int column<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>column</dt><dd class="description">Column for wrapping</dd></dl><h4 class="discussion">Discussion</h4><p class="discussion">Wrapping is disabled when "column" is <= 0.</p><h3 class="function"><a name="mxmlWalkNext">mxmlWalkNext</a></h3><p class="description">Walk to the next logical node in the tree.</p><p class="code"><a href="#mxml_node_t">mxml_node_t</a> *mxmlWalkNext (<br> <a href="#mxml_node_t">mxml_node_t</a> *node,<br> <a href="#mxml_node_t">mxml_node_t</a> *top,<br> int descend<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>node</dt><dd class="description">Current node</dd><dt>top</dt><dd class="description">Top node</dd><dt>descend</dt><dd class="description">Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST</dd></dl><h4 class="returnvalue">Return Value</h4><p class="description">Next node or NULL</p><h4 class="discussion">Discussion</h4><p class="discussion">The descend argument controls whether the first child is consideredto be the next node. The top node argument constrains the walk tothe node's children.</p><h3 class="function"><a name="mxmlWalkPrev">mxmlWalkPrev</a></h3><p class="description">Walk to the previous logical node in the tree.</p><p class="code"><a href="#mxml_node_t">mxml_node_t</a> *mxmlWalkPrev (<br> <a href="#mxml_node_t">mxml_node_t</a> *node,<br> <a href="#mxml_node_t">mxml_node_t</a> *top,<br> int descend<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>node</dt><dd class="description">Current node</dd><dt>top</dt><dd class="description">Top node</dd><dt>descend</dt><dd class="description">Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST</dd></dl><h4 class="returnvalue">Return Value</h4><p class="description">Previous node or NULL</p><h4 class="discussion">Discussion</h4><p class="discussion">The descend argument controls whether the previous node's last childis considered to be the previous node. The top node argument constrainsthe walk to the node's children.</p><h2 class="title"><a name="TYPES">Data Types</a></h2><h3 class="typedef"><a name="mxml_attr_t">mxml_attr_t</a></h3><p class="description">An XML element attribute value.</p><p class="code">typedef struct <a href="#mxml_attr_s">mxml_attr_s</a> mxml_attr_t;</p><h3 class="typedef"><a name="mxml_custom_destroy_cb_t">mxml_custom_destroy_cb_t</a></h3><p class="description">Custom data destructor</p><p class="code">typedef void (*mxml_custom_destroy_cb_t)(void *);</p><h3 class="typedef"><a name="mxml_custom_load_cb_t">mxml_custom_load_cb_t</a></h3><p class="description">Custom data load callback function</p><p class="code">typedef int (*mxml_custom_load_cb_t)(<a href="#mxml_node_t">mxml_node_t</a> *, const char *);</p><h3 class="typedef"><a name="mxml_custom_save_cb_t">mxml_custom_save_cb_t</a></h3><p class="description">Custom data save callback function</p><p class="code">typedef char *(*mxml_custom_save_cb_t)(<a href="#mxml_node_t">mxml_node_t</a> *);</p><h3 class="typedef"><span class="info"> Mini-XML 2.1 </span><a name="mxml_custom_t">mxml_custom_t</a></h3><p class="description">An XML custom value. </p><p class="code">typedef struct <a href="#mxml_custom_s">mxml_custom_s</a> mxml_custom_t;</p><h3 class="typedef"><a name="mxml_element_t">mxml_element_t</a></h3><p class="description">An XML element value.</p><p class="code">typedef struct <a href="#mxml_element_s">mxml_element_s</a> mxml_element_t;</p><h3 class="typedef"><a name="mxml_error_cb_t">mxml_error_cb_t</a></h3><p class="description">Error callback function</p><p class="code">typedef void (*mxml_error_cb_t)(const char *);</p><h3 class="typedef"><a name="mxml_index_t">mxml_index_t</a></h3><p class="description">An XML node index.</p><p class="code">typedef struct <a href="#mxml_index_s">mxml_index_s</a> mxml_index_t;</p><h3 class="typedef"><a name="mxml_load_cb_t">mxml_load_cb_t</a></h3><p class="description">Load callback function</p><p class="code">typedef mxml_type_t (*mxml_load_cb_t)(<a href="#mxml_node_t">mxml_node_t</a> *);</p><h3 class="typedef"><a name="mxml_node_t">mxml_node_t</a></h3><p class="description">An XML node.</p><p class="code">typedef struct <a href="#mxml_node_s">mxml_node_s</a> mxml_node_t;</p><h3 class="typedef"><a name="mxml_save_cb_t">mxml_save_cb_t</a></h3><p class="description">Save callback function</p><p class="code">typedef const char *(*mxml_save_cb_t)(<a href="#mxml_node_t">mxml_node_t</a> *, int);</p><h3 class="typedef"><a name="mxml_sax_cb_t">mxml_sax_cb_t</a></h3><p class="description">SAX callback function</p><p class="code">typedef void (*mxml_sax_cb_t)(<a href="#mxml_node_t">mxml_node_t</a> *, mxml_sax_event_t, void *);</p><h3 class="typedef"><a name="mxml_sax_event_t">mxml_sax_event_t</a></h3><p class="description">SAX event type.</p><p class="code">typedef enum <a href="#mxml_sax_event_e">mxml_sax_event_e</a> mxml_sax_event_t;</p><h3 class="typedef"><a name="mxml_text_t">mxml_text_t</a></h3><p class="description">An XML text value.</p><p class="code">typedef struct <a href="#mxml_text_s">mxml_text_s</a> mxml_text_t;</p><h3 class="typedef"><a name="mxml_value_t">mxml_value_t</a></h3><p class="description">An XML node value.</p><p class="code">typedef union <a href="#mxml_value_u">mxml_value_u</a> mxml_value_t;</p><h2 class="title"><a name="STRUCTURES">Structures</a></h2><h3 class="struct"><a name="mxml_attr_s">mxml_attr_s</a></h3><p class="description">An XML element attribute value.</p><p class="code">struct mxml_attr_s {<br> char *name;<br> char *value;<br>};</p><h4 class="members">Members</h4><dl><dt>name </dt><dd class="description">Attribute name</dd><dt>value </dt><dd class="description">Attribute value</dd></dl><h3 class="struct"><span class="info"> Mini-XML 2.1 </span><a name="mxml_custom_s">mxml_custom_s</a></h3><p class="description">An XML custom value. </p><p class="code">struct mxml_custom_s {<br> void *data;<br> <a href="#mxml_custom_destroy_cb_t">mxml_custom_destroy_cb_t</a> destroy;<br>};</p><h4 class="members">Members</h4><dl><dt>data </dt><dd class="description">Pointer to (allocated) custom data</dd><dt>destroy </dt><dd class="description">Pointer to destructor function</dd></dl><h3 class="struct"><a name="mxml_element_s">mxml_element_s</a></h3><p class="description">An XML element value.</p><p class="code">struct mxml_element_s {<br> <a href="#mxml_attr_t">mxml_attr_t</a> *attrs;<br> char *name;<br> int num_attrs;<br>};</p><h4 class="members">Members</h4><dl><dt>attrs </dt><dd class="description">Attributes</dd><dt>name </dt><dd class="description">Name of element</dd><dt>num_attrs </dt><dd class="description">Number of attributes</dd></dl><h3 class="struct"><a name="mxml_index_s">mxml_index_s</a></h3><p class="description">An XML node index.</p><p class="code">struct mxml_index_s {<br> int alloc_nodes;<br> char *attr;<br> int cur_node;<br> <a href="#mxml_node_t">mxml_node_t</a> **nodes;<br> int num_nodes;<br>};</p><h4 class="members">Members</h4><dl><dt>alloc_nodes </dt><dd class="description">Allocated nodes in index</dd><dt>attr </dt><dd class="description">Attribute used for indexing or NULL</dd><dt>cur_node </dt><dd class="description">Current node</dd><dt>nodes </dt><dd class="description">Node array</dd><dt>num_nodes </dt><dd class="description">Number of nodes in index</dd></dl><h3 class="struct"><a name="mxml_node_s">mxml_node_s</a></h3><p class="description">An XML node.</p><p class="code">struct mxml_node_s {<br> struct <a href="#mxml_node_s">mxml_node_s</a> *child;<br> struct <a href="#mxml_node_s">mxml_node_s</a> *last_child;<br> struct <a href="#mxml_node_s">mxml_node_s</a> *next;<br> struct <a href="#mxml_node_s">mxml_node_s</a> *parent;<br> struct <a href="#mxml_node_s">mxml_node_s</a> *prev;<br> int ref_count;<br> mxml_type_t type;<br> void *user_data;<br> <a href="#mxml_value_t">mxml_value_t</a> value;<br>};</p><h4 class="members">Members</h4><dl><dt>child </dt><dd class="description">First child node</dd><dt>last_child </dt><dd class="description">Last child node</dd><dt>next </dt><dd class="description">Next node under same parent</dd><dt>parent </dt><dd class="description">Parent node</dd><dt>prev </dt><dd class="description">Previous node under same parent</dd><dt>ref_count </dt><dd class="description">Use count</dd><dt>type </dt><dd class="description">Node type</dd><dt>user_data </dt><dd class="description">User data</dd><dt>value </dt><dd class="description">Node value</dd></dl><h3 class="struct"><a name="mxml_text_s">mxml_text_s</a></h3><p class="description">An XML text value.</p><p class="code">struct mxml_text_s {<br> char *string;<br> int whitespace;<br>};</p><h4 class="members">Members</h4><dl><dt>string </dt><dd class="description">Fragment string</dd><dt>whitespace </dt><dd class="description">Leading whitespace?</dd></dl><h2 class="title"><a name="UNIONS">Unions</a></h2><h3 class="union"><a name="mxml_value_u">mxml_value_u</a></h3><p class="description">An XML node value.</p><p class="code">union mxml_value_u {<br> <a href="#mxml_custom_t">mxml_custom_t</a> custom;<br> <a href="#mxml_element_t">mxml_element_t</a> element;<br> int integer;<br> char *opaque;<br> double real;<br> <a href="#mxml_text_t">mxml_text_t</a> text;<br>};</p><h4 class="members">Members</h4><dl><dt>custom <span class="info"> Mini-XML 2.1 </span></dt><dd class="description">Custom data </dd><dt>element </dt><dd class="description">Element</dd><dt>integer </dt><dd class="description">Integer number</dd><dt>opaque </dt><dd class="description">Opaque string</dd><dt>real </dt><dd class="description">Real number</dd><dt>text </dt><dd class="description">Text fragment</dd></dl><h2 class="title"><a name="ENUMERATIONS">Constants</a></h2><h3 class="enumeration"><a name="mxml_sax_event_e">mxml_sax_event_e</a></h3><p class="description">SAX event type.</p><h4 class="constants">Constants</h4><dl><dt>MXM
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -