⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reference.html

📁 minixml2.5最新的版本。 嵌入式xml 解析、查找、生成、遍历 功能,全部实现是标准c,移植很容易。 最新的2.5
💻 HTML
📖 第 1 页 / 共 5 页
字号:
node is closed or after each data, comment, CDATA, or directive node.</p><h3 class="function"><span class="info">&nbsp;Mini-XML 2.3&nbsp;</span><a name="mxmlSAXLoadString">mxmlSAXLoadString</a></h3><p class="description">Load a string into an XML node treeusing a SAX callback.</p><p class="code"><a href="#mxml_node_t">mxml_node_t</a> *mxmlSAXLoadString (<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mxml_node_t">mxml_node_t</a> *top,<br>&nbsp;&nbsp;&nbsp;&nbsp;const char *s,<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mxml_load_cb_t">mxml_load_cb_t</a> cb,<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mxml_sax_cb_t">mxml_sax_cb_t</a> sax_cb,<br>&nbsp;&nbsp;&nbsp;&nbsp;void *sax_data<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>top</dt><dd class="description">Top node</dd><dt>s</dt><dd class="description">String to load</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 string has errors.</p><h4 class="discussion">Discussion</h4><p class="discussion">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 asingle parent node like &lt;?xml&gt; for the entire string. 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"><a name="mxmlSaveAllocString">mxmlSaveAllocString</a></h3><p class="description">Save an XML node tree to an allocated string.</p><p class="code">char *mxmlSaveAllocString (<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mxml_node_t">mxml_node_t</a> *node,<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mxml_save_cb_t">mxml_save_cb_t</a> cb<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>node</dt><dd class="description">Node to write</dd><dt>cb</dt><dd class="description">Whitespace callback or MXML_NO_CALLBACK</dd></dl><h4 class="returnvalue">Return Value</h4><p class="description">Allocated string or NULL</p><h4 class="discussion">Discussion</h4><p class="discussion">This function returns a pointer to a string containing the textualrepresentation of the XML node tree.  The string should be freedusing the free() function when you are done with it.  NULL is returnedif the node would produce an empty string or if the string cannot beallocated.<br><br>The callback argument specifies a function that returns a whitespacestring or NULL before and after each element. If MXML_NO_CALLBACKis specified, whitespace will only be added before MXML_TEXT nodeswith leading whitespace and before attribute names inside openingelement tags.</p><h3 class="function"><a name="mxmlSaveFd">mxmlSaveFd</a></h3><p class="description">Save an XML tree to a file descriptor.</p><p class="code">int mxmlSaveFd (<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mxml_node_t">mxml_node_t</a> *node,<br>&nbsp;&nbsp;&nbsp;&nbsp;int fd,<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mxml_save_cb_t">mxml_save_cb_t</a> cb<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>node</dt><dd class="description">Node to write</dd><dt>fd</dt><dd class="description">File descriptor to write to</dd><dt>cb</dt><dd class="description">Whitespace callback or MXML_NO_CALLBACK</dd></dl><h4 class="returnvalue">Return Value</h4><p class="description">0 on success, -1 on error.</p><h4 class="discussion">Discussion</h4><p class="discussion">The callback argument specifies a function that returns a whitespacestring or NULL before and after each element. If MXML_NO_CALLBACKis specified, whitespace will only be added before MXML_TEXT nodeswith leading whitespace and before attribute names inside openingelement tags.</p><h3 class="function"><a name="mxmlSaveFile">mxmlSaveFile</a></h3><p class="description">Save an XML tree to a file.</p><p class="code">int mxmlSaveFile (<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mxml_node_t">mxml_node_t</a> *node,<br>&nbsp;&nbsp;&nbsp;&nbsp;FILE *fp,<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mxml_save_cb_t">mxml_save_cb_t</a> cb<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>node</dt><dd class="description">Node to write</dd><dt>fp</dt><dd class="description">File to write to</dd><dt>cb</dt><dd class="description">Whitespace callback or MXML_NO_CALLBACK</dd></dl><h4 class="returnvalue">Return Value</h4><p class="description">0 on success, -1 on error.</p><h4 class="discussion">Discussion</h4><p class="discussion">The callback argument specifies a function that returns a whitespacestring or NULL before and after each element. If MXML_NO_CALLBACKis specified, whitespace will only be added before MXML_TEXT nodeswith leading whitespace and before attribute names inside openingelement tags.</p><h3 class="function"><a name="mxmlSaveString">mxmlSaveString</a></h3><p class="description">Save an XML node tree to a string.</p><p class="code">int mxmlSaveString (<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mxml_node_t">mxml_node_t</a> *node,<br>&nbsp;&nbsp;&nbsp;&nbsp;char *buffer,<br>&nbsp;&nbsp;&nbsp;&nbsp;int bufsize,<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mxml_save_cb_t">mxml_save_cb_t</a> cb<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>node</dt><dd class="description">Node to write</dd><dt>buffer</dt><dd class="description">String buffer</dd><dt>bufsize</dt><dd class="description">Size of string buffer</dd><dt>cb</dt><dd class="description">Whitespace callback or MXML_NO_CALLBACK</dd></dl><h4 class="returnvalue">Return Value</h4><p class="description">Size of string</p><h4 class="discussion">Discussion</h4><p class="discussion">This function returns the total number of bytes that would berequired for the string but only copies (bufsize - 1) charactersinto the specified buffer.<br><br>The callback argument specifies a function that returns a whitespacestring or NULL before and after each element. If MXML_NO_CALLBACKis specified, whitespace will only be added before MXML_TEXT nodeswith leading whitespace and before attribute names inside openingelement tags.</p><h3 class="function"><span class="info">&nbsp;Mini-XML 2.3&nbsp;</span><a name="mxmlSetCDATA">mxmlSetCDATA</a></h3><p class="description">Set the element name of a CDATA node.</p><p class="code">int mxmlSetCDATA (<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mxml_node_t">mxml_node_t</a> *node,<br>&nbsp;&nbsp;&nbsp;&nbsp;const char *data<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>node</dt><dd class="description">Node to set</dd><dt>data</dt><dd class="description">New data 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 CDATA element node.</p><h3 class="function"><span class="info">&nbsp;Mini-XML 2.1&nbsp;</span><a name="mxmlSetCustom">mxmlSetCustom</a></h3><p class="description">Set the data and destructor of a custom data node.</p><p class="code">int mxmlSetCustom (<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mxml_node_t">mxml_node_t</a> *node,<br>&nbsp;&nbsp;&nbsp;&nbsp;void *data,<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mxml_custom_destroy_cb_t">mxml_custom_destroy_cb_t</a> destroy<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>node</dt><dd class="description">Node to set</dd><dt>data</dt><dd class="description">New data pointer</dd><dt>destroy</dt><dd class="description">New destructor function</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 custom node.</p><h3 class="function"><a name="mxmlSetCustomHandlers">mxmlSetCustomHandlers</a></h3><p class="description">Set the handling functions for custom data.</p><p class="code">void mxmlSetCustomHandlers (<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mxml_custom_load_cb_t">mxml_custom_load_cb_t</a> load,<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mxml_custom_save_cb_t">mxml_custom_save_cb_t</a> save<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>load</dt><dd class="description">Load function</dd><dt>save</dt><dd class="description">Save function</dd></dl><h4 class="discussion">Discussion</h4><p class="discussion">The load function accepts a node pointer and a data string and mustreturn 0 on success and non-zero on error.<br><br>The save function accepts a node pointer and must return a malloc'dstring on success and NULL on error.</p><h3 class="function"><a name="mxmlSetElement">mxmlSetElement</a></h3><p class="description">Set the name of an element node.</p><p class="code">int mxmlSetElement (<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mxml_node_t">mxml_node_t</a> *node,<br>&nbsp;&nbsp;&nbsp;&nbsp;const char *name<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>node</dt><dd class="description">Node to set</dd><dt>name</dt><dd class="description">New name 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 an element node.</p><h3 class="function"><a name="mxmlSetErrorCallback">mxmlSetErrorCallback</a></h3><p class="description">Set the error message callback.</p><p class="code">void mxmlSetErrorCallback (<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mxml_error_cb_t">mxml_error_cb_t</a> cb<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>cb</dt><dd class="description">Error callback function</dd></dl><h3 class="function"><a name="mxmlSetInteger">mxmlSetInteger</a></h3><p class="description">Set the value of an integer node.</p><p class="code">int mxmlSetInteger (<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mxml_node_t">mxml_node_t</a> *node,<br>&nbsp;&nbsp;&nbsp;&nbsp;int integer<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>node</dt><dd class="description">Node to set</dd><dt>integer</dt><dd class="description">Integer value</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 an integer node.</p><h3 class="function"><a name="mxmlSetOpaque">mxmlSetOpaque</a></h3><p class="description">Set the value of an opaque node.</p><p class="code">int mxmlSetOpaque (<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mxml_node_t">mxml_node_t</a> *node,<br>&nbsp;&nbsp;&nbsp;&nbsp;const char *opaque<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>node</dt><dd class="description">Node to set</dd><dt>opaque</dt><dd class="description">Opaque 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 an opaque node.</p><h3 class="function"><a name="mxmlSetReal">mxmlSetReal</a></h3><p class="description">Set the value of a real number node.</p><p class="code">int mxmlSetReal (<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mxml_node_t">mxml_node_t</a> *node,<br>&nbsp;&nbsp;&nbsp;&nbsp;double real<br>);</p><h4 class="parameters">Parameters</h4><dl><dt>node</dt><dd class="description">Node to set</dd><dt>real</dt><dd class="description">Real number value</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 real number node.</p><h3 class="function"><a name="mxmlSetText">mxmlSetText</a></h3><p class="description">Set the value of a text node.</p><p class="code">int mxmlSetText (<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mxml_node_t">mxml_node_t</a> *node,<br>&nbsp;&nbsp;&nbsp;&nbsp;int whitespace,<br>&nbsp;&nbsp;&nbsp;&nbsp;const char *string<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>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -