Move "set" methods in a separate file.

Add standard callback methods in a separate file.

Fix some bugs in mxmldoc...
web
Michael R Sweet 21 years ago
parent 337baeddb5
commit 17200e8cfe
  1. 2
      CHANGES
  2. 13
      Makefile.in
  3. 266
      documentation.html
  4. 12
      mxml-file.c
  5. 196
      mxml-node.c
  6. 73
      mxml-private.c
  7. 224
      mxml-set.c
  8. 28
      mxml.h
  9. 156
      mxml.xml
  10. 42
      mxmldoc.c

@ -7,6 +7,8 @@ CHANGES IN Mini-XML 1.2
- Added new formatted text methods mxmlNewTextf() and - Added new formatted text methods mxmlNewTextf() and
mxmlSetTextf() to create/set a text node value using mxmlSetTextf() to create/set a text node value using
printf-style formats. printf-style formats.
- Added new standard callbacks for use with the mxmlLoad
functions.
- Updated the HTML documentation to include examples of - Updated the HTML documentation to include examples of
the walk and load function output. the walk and load function output.
- Added --with/without-ansi configure option to control - Added --with/without-ansi configure option to control

@ -1,5 +1,5 @@
# #
# "$Id: Makefile.in,v 1.12 2003/09/28 12:44:39 mike Exp $" # "$Id: Makefile.in,v 1.13 2003/09/28 21:09:03 mike Exp $"
# #
# Makefile for mini-XML, a small XML-like file parsing library. # Makefile for mini-XML, a small XML-like file parsing library.
# #
@ -75,8 +75,9 @@ MAN3EXT = @MAN3EXT@
# #
DOCFILES = documentation.html README COPYING CHANGES DOCFILES = documentation.html README COPYING CHANGES
LIBOBJS = mxml-attr.o mxml-file.o mxml-node.o mxml-search.o \ PUBLIBOBJS = mxml-attr.o mxml-file.o mxml-node.o mxml-search.o \
mxml-string.o mxml-set.o
LIBOBJS = $(PUBLIBOBJS) mxml-private.o mxml-string.o
OBJS = mxmldoc.o testmxml.o $(LIBOBJS) OBJS = mxmldoc.o testmxml.o $(LIBOBJS)
TARGETS = libmxml.a mxmldoc mxml.$(CAT3EXT) mxmldoc.$(CAT1EXT) \ TARGETS = libmxml.a mxmldoc mxml.$(CAT3EXT) mxmldoc.$(CAT1EXT) \
testmxml mxml.xml testmxml mxml.xml
@ -225,9 +226,9 @@ testmxml.o: mxml.h
# mxml.xml # mxml.xml
# #
mxml.xml: mxmldoc mxml.h $(LIBOBJS:.o=.c) mxml.xml: mxmldoc mxml.h $(PUBLIBOBJS:.o=.c)
$(RM) mxml.xml $(RM) mxml.xml
./mxmldoc mxml.xml mxml.h $(LIBOBJS:.o=.c) >documentation.html ./mxmldoc mxml.xml mxml.h $(PUBLIBOBJS:.o=.c) >documentation.html
# #
@ -238,5 +239,5 @@ $(OBJS): Makefile config.h
# #
# End of "$Id: Makefile.in,v 1.12 2003/09/28 12:44:39 mike Exp $". # End of "$Id: Makefile.in,v 1.13 2003/09/28 21:09:03 mike Exp $".
# #

@ -17,11 +17,11 @@
<li><a href="#_types">Types</a></li> <li><a href="#_types">Types</a></li>
<li><a href="#_unions">Unions</a></li> <li><a href="#_unions">Unions</a></li>
</ul> </ul>
<hr noshade/>
<h1><a name="_enumerations">Enumerations</a></h1> <h1><a name="_enumerations">Enumerations</a></h1>
<ul> <ul>
<li><a href="#mxml_type_e"><tt>mxml_type_e</tt></a></li> <li><a href="#mxml_type_e"><tt>mxml_type_e</tt></a></li>
</ul> </ul>
<hr noshade/>
<h2><a name="mxml_type_e">mxml_type_e</a></h2> <h2><a name="mxml_type_e">mxml_type_e</a></h2>
<p>The XML node type.</p> <p>The XML node type.</p>
<h3>Values</h3> <h3>Values</h3>
@ -34,6 +34,7 @@
<tr><td><tt>MXML_REAL</tt></td><td>Real value</td></tr> <tr><td><tt>MXML_REAL</tt></td><td>Real value</td></tr>
<tr><td><tt>MXML_TEXT</tt></td><td>Text fragment</td></tr> <tr><td><tt>MXML_TEXT</tt></td><td>Text fragment</td></tr>
</tbody></table></p> </tbody></table></p>
<hr noshade/>
<h1><a name="_functions">Functions</a></h1> <h1><a name="_functions">Functions</a></h1>
<ul> <ul>
<li><a href="#mxmlAdd"><tt>mxmlAdd()</tt></a></li> <li><a href="#mxmlAdd"><tt>mxmlAdd()</tt></a></li>
@ -61,11 +62,7 @@
<li><a href="#mxmlSetTextf"><tt>mxmlSetTextf()</tt></a></li> <li><a href="#mxmlSetTextf"><tt>mxmlSetTextf()</tt></a></li>
<li><a href="#mxmlWalkNext"><tt>mxmlWalkNext()</tt></a></li> <li><a href="#mxmlWalkNext"><tt>mxmlWalkNext()</tt></a></li>
<li><a href="#mxmlWalkPrev"><tt>mxmlWalkPrev()</tt></a></li> <li><a href="#mxmlWalkPrev"><tt>mxmlWalkPrev()</tt></a></li>
<li><a href="#mxml_strdup"><tt>mxml_strdup()</tt></a></li>
<li><a href="#mxml_strdupf"><tt>mxml_strdupf()</tt></a></li>
<li><a href="#mxml_vsnprintf"><tt>mxml_vsnprintf()</tt></a></li>
</ul> </ul>
<hr noshade/>
<h2><a name="mxmlAdd">mxmlAdd()</a></h2> <h2><a name="mxmlAdd">mxmlAdd()</a></h2>
<p>Add a node to a tree. <p>Add a node to a tree.
@ -79,17 +76,22 @@ MXML_ADD_TO_PARENT can be used to specify a NULL child pointer.</p>
<pre> <pre>
void void
mxmlAdd( mxmlAdd(
<a href="#mxml_node_t">mxml_node_t</a> *parent, int where, <a href="#mxml_node_t">mxml_node_t</a> *child, <a href="#mxml_node_t">mxml_node_t</a> * node); <a href="#mxml_node_t">mxml_node_t</a> * parent,
int where,
<a href="#mxml_node_t">mxml_node_t</a> * child,
<a href="#mxml_node_t">mxml_node_t</a> * node);
</pre> </pre>
<h3>Arguments</h3> <h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%"> <p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead> <thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody> <tbody>
<tr><td><tt>parent</tt></td><td>Parent node</td></tr>
<tr><td><tt>where</tt></td><td>Where to add, MXML_ADD_BEFORE or MXML_ADD_AFTER</td></tr>
<tr><td><tt>child</tt></td><td>Child node for where or MXML_ADD_TO_PARENT</td></tr>
<tr><td><tt>node</tt></td><td>Node to add</td></tr> <tr><td><tt>node</tt></td><td>Node to add</td></tr>
</tbody></table></p> </tbody></table></p>
<h3>Returns</h3> <h3>Returns</h3>
<p>Nothing.</p> <p>Nothing.</p>
<hr noshade/>
<h2><a name="mxmlDelete">mxmlDelete()</a></h2> <h2><a name="mxmlDelete">mxmlDelete()</a></h2>
<p>Delete a node and all of its children. <p>Delete a node and all of its children.
@ -109,7 +111,6 @@ mxmlDelete(
</tbody></table></p> </tbody></table></p>
<h3>Returns</h3> <h3>Returns</h3>
<p>Nothing.</p> <p>Nothing.</p>
<hr noshade/>
<h2><a name="mxmlElementGetAttr">mxmlElementGetAttr()</a></h2> <h2><a name="mxmlElementGetAttr">mxmlElementGetAttr()</a></h2>
<p>Get an attribute. <p>Get an attribute.
@ -119,17 +120,18 @@ named attribute does not exist.</p>
<pre> <pre>
const char * const char *
mxmlElementGetAttr( mxmlElementGetAttr(
<a href="#mxml_node_t">mxml_node_t</a> *node, const char * name); <a href="#mxml_node_t">mxml_node_t</a> * node,
const char * name);
</pre> </pre>
<h3>Arguments</h3> <h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%"> <p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead> <thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody> <tbody>
<tr><td><tt>node</tt></td><td>Element node</td></tr>
<tr><td><tt>name</tt></td><td>Name of attribute</td></tr> <tr><td><tt>name</tt></td><td>Name of attribute</td></tr>
</tbody></table></p> </tbody></table></p>
<h3>Returns</h3> <h3>Returns</h3>
<p>Attribute value or NULL</p> <p>Attribute value or NULL</p>
<hr noshade/>
<h2><a name="mxmlElementSetAttr">mxmlElementSetAttr()</a></h2> <h2><a name="mxmlElementSetAttr">mxmlElementSetAttr()</a></h2>
<p>Set an attribute. <p>Set an attribute.
@ -141,17 +143,20 @@ not an element.</p>
<pre> <pre>
void void
mxmlElementSetAttr( mxmlElementSetAttr(
<a href="#mxml_node_t">mxml_node_t</a> *node, const char *name, const char * value); <a href="#mxml_node_t">mxml_node_t</a> * node,
const char * name,
const char * value);
</pre> </pre>
<h3>Arguments</h3> <h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%"> <p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead> <thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody> <tbody>
<tr><td><tt>node</tt></td><td>Element node</td></tr>
<tr><td><tt>name</tt></td><td>Name of attribute</td></tr>
<tr><td><tt>value</tt></td><td>Attribute value</td></tr> <tr><td><tt>value</tt></td><td>Attribute value</td></tr>
</tbody></table></p> </tbody></table></p>
<h3>Returns</h3> <h3>Returns</h3>
<p>Nothing.</p> <p>Nothing.</p>
<hr noshade/>
<h2><a name="mxmlFindElement">mxmlFindElement()</a></h2> <h2><a name="mxmlFindElement">mxmlFindElement()</a></h2>
<p>Find the named element. <p>Find the named element.
@ -167,17 +172,26 @@ constrains the search to a particular node's children.</p>
<pre> <pre>
<a href="#mxml_node_t">mxml_node_t</a> * <a href="#mxml_node_t">mxml_node_t</a> *
mxmlFindElement( mxmlFindElement(
<a href="#mxml_node_t">mxml_node_t</a> *node, <a href="#mxml_node_t">mxml_node_t</a> *top, const char *name, const char *attr, const char *value, int descend); <a href="#mxml_node_t">mxml_node_t</a> * node,
<a href="#mxml_node_t">mxml_node_t</a> * top,
const char * name,
const char * attr,
const char * value,
int descend);
</pre> </pre>
<h3>Arguments</h3> <h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%"> <p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead> <thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody> <tbody>
<tr><td><tt>node</tt></td><td>Current node</td></tr>
<tr><td><tt>top</tt></td><td>Top node</td></tr>
<tr><td><tt>name</tt></td><td>Element name or NULL for any</td></tr>
<tr><td><tt>attr</tt></td><td>Attribute name, or NULL for none</td></tr>
<tr><td><tt>value</tt></td><td>Attribute value, or NULL for any</td></tr>
<tr><td><tt>descend</tt></td><td>Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST</td></tr> <tr><td><tt>descend</tt></td><td>Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST</td></tr>
</tbody></table></p> </tbody></table></p>
<h3>Returns</h3> <h3>Returns</h3>
<p>Element node or NULL</p> <p>Element node or NULL</p>
<hr noshade/>
<h2><a name="mxmlLoadFile">mxmlLoadFile()</a></h2> <h2><a name="mxmlLoadFile">mxmlLoadFile()</a></h2>
<p>Load a file into an XML node tree. <p>Load a file into an XML node tree.
@ -186,22 +200,29 @@ If no top node is provided, the XML file MUST be well-formed with a
single parent node like &lt;?xml&gt; for the entire file. The callback single parent node like &lt;?xml&gt; for the entire file. The callback
function returns the value type that should be used for child nodes. 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 If MXML_NO_CALLBACK is specified then all child nodes will be either
MXML_ELEMENT or MXML_TEXT nodes.</p> 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.</p>
<h3>Syntax</h3> <h3>Syntax</h3>
<pre> <pre>
<a href="#mxml_node_t">mxml_node_t</a> * <a href="#mxml_node_t">mxml_node_t</a> *
mxmlLoadFile( mxmlLoadFile(
<a href="#mxml_node_t">mxml_node_t</a> *top, FILE *fp, <a href="#mxml_type_t">mxml_type_t</a> (*cb)(mxml_node_t *node)); <a href="#mxml_node_t">mxml_node_t</a> * top,
FILE * fp,
<a href="#mxml_type_t">mxml_type_t</a> (*cb)(mxml_node_t *node));
</pre> </pre>
<h3>Arguments</h3> <h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%"> <p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead> <thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody> <tbody>
<tr><td><tt>top</tt></td><td>Top node</td></tr>
<tr><td><tt>fp</tt></td><td>File to read from</td></tr>
<tr><td><tt>(*cb)(mxml_node_t *node)</tt></td><td>Callback function or MXML_NO_CALLBACK</td></tr> <tr><td><tt>(*cb)(mxml_node_t *node)</tt></td><td>Callback function or MXML_NO_CALLBACK</td></tr>
</tbody></table></p> </tbody></table></p>
<h3>Returns</h3> <h3>Returns</h3>
<p>First node or NULL if the file could not be read.</p> <p>First node or NULL if the file could not be read.</p>
<hr noshade/>
<h2><a name="mxmlLoadString">mxmlLoadString()</a></h2> <h2><a name="mxmlLoadString">mxmlLoadString()</a></h2>
<p>Load a string into an XML node tree. <p>Load a string into an XML node tree.
@ -210,22 +231,29 @@ If no top node is provided, the XML string MUST be well-formed with a
single parent node like &lt;?xml&gt; for the entire string. The callback single parent node like &lt;?xml&gt; for the entire string. The callback
function returns the value type that should be used for child nodes. 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 If MXML_NO_CALLBACK is specified then all child nodes will be either
MXML_ELEMENT or MXML_TEXT nodes.</p> 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.</p>
<h3>Syntax</h3> <h3>Syntax</h3>
<pre> <pre>
<a href="#mxml_node_t">mxml_node_t</a> * <a href="#mxml_node_t">mxml_node_t</a> *
mxmlLoadString( mxmlLoadString(
<a href="#mxml_node_t">mxml_node_t</a> *top, const char *s, <a href="#mxml_type_t">mxml_type_t</a> (*cb)(mxml_node_t *node)); <a href="#mxml_node_t">mxml_node_t</a> * top,
const char * s,
<a href="#mxml_type_t">mxml_type_t</a> (*cb)(mxml_node_t *node));
</pre> </pre>
<h3>Arguments</h3> <h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%"> <p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead> <thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody> <tbody>
<tr><td><tt>top</tt></td><td>Top node</td></tr>
<tr><td><tt>s</tt></td><td>String to load</td></tr>
<tr><td><tt>(*cb)(mxml_node_t *node)</tt></td><td>Callback function or MXML_NO_CALLBACK</td></tr> <tr><td><tt>(*cb)(mxml_node_t *node)</tt></td><td>Callback function or MXML_NO_CALLBACK</td></tr>
</tbody></table></p> </tbody></table></p>
<h3>Returns</h3> <h3>Returns</h3>
<p>First node or NULL if the string has errors.</p> <p>First node or NULL if the string has errors.</p>
<hr noshade/>
<h2><a name="mxmlNewElement">mxmlNewElement()</a></h2> <h2><a name="mxmlNewElement">mxmlNewElement()</a></h2>
<p>Create a new element node. <p>Create a new element node.
@ -236,17 +264,18 @@ element node has no parent.</p>
<pre> <pre>
<a href="#mxml_node_t">mxml_node_t</a> * <a href="#mxml_node_t">mxml_node_t</a> *
mxmlNewElement( mxmlNewElement(
<a href="#mxml_node_t">mxml_node_t</a> *parent, const char * name); <a href="#mxml_node_t">mxml_node_t</a> * parent,
const char * name);
</pre> </pre>
<h3>Arguments</h3> <h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%"> <p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead> <thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody> <tbody>
<tr><td><tt>parent</tt></td><td>Parent node or MXML_NO_PARENT</td></tr>
<tr><td><tt>name</tt></td><td>Name of element</td></tr> <tr><td><tt>name</tt></td><td>Name of element</td></tr>
</tbody></table></p> </tbody></table></p>
<h3>Returns</h3> <h3>Returns</h3>
<p>New node</p> <p>New node</p>
<hr noshade/>
<h2><a name="mxmlNewInteger">mxmlNewInteger()</a></h2> <h2><a name="mxmlNewInteger">mxmlNewInteger()</a></h2>
<p>Create a new integer node. <p>Create a new integer node.
@ -257,17 +286,18 @@ integer node has no parent.</p>
<pre> <pre>
<a href="#mxml_node_t">mxml_node_t</a> * <a href="#mxml_node_t">mxml_node_t</a> *
mxmlNewInteger( mxmlNewInteger(
<a href="#mxml_node_t">mxml_node_t</a> *parent, int integer); <a href="#mxml_node_t">mxml_node_t</a> * parent,
int integer);
</pre> </pre>
<h3>Arguments</h3> <h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%"> <p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead> <thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody> <tbody>
<tr><td><tt>parent</tt></td><td>Parent node or MXML_NO_PARENT</td></tr>
<tr><td><tt>integer</tt></td><td>Integer value</td></tr> <tr><td><tt>integer</tt></td><td>Integer value</td></tr>
</tbody></table></p> </tbody></table></p>
<h3>Returns</h3> <h3>Returns</h3>
<p>New node</p> <p>New node</p>
<hr noshade/>
<h2><a name="mxmlNewOpaque">mxmlNewOpaque()</a></h2> <h2><a name="mxmlNewOpaque">mxmlNewOpaque()</a></h2>
<p>Create a new opaque string. <p>Create a new opaque string.
@ -279,17 +309,18 @@ is copied into the new node.</p>
<pre> <pre>
<a href="#mxml_node_t">mxml_node_t</a> * <a href="#mxml_node_t">mxml_node_t</a> *
mxmlNewOpaque( mxmlNewOpaque(
<a href="#mxml_node_t">mxml_node_t</a> *parent, const char * opaque); <a href="#mxml_node_t">mxml_node_t</a> * parent,
const char * opaque);
</pre> </pre>
<h3>Arguments</h3> <h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%"> <p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead> <thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody> <tbody>
<tr><td><tt>parent</tt></td><td>Parent node or MXML_NO_PARENT</td></tr>
<tr><td><tt>opaque</tt></td><td>Opaque string</td></tr> <tr><td><tt>opaque</tt></td><td>Opaque string</td></tr>
</tbody></table></p> </tbody></table></p>
<h3>Returns</h3> <h3>Returns</h3>
<p>New node</p> <p>New node</p>
<hr noshade/>
<h2><a name="mxmlNewReal">mxmlNewReal()</a></h2> <h2><a name="mxmlNewReal">mxmlNewReal()</a></h2>
<p>Create a new real number node. <p>Create a new real number node.
@ -300,17 +331,18 @@ the new real number node has no parent.</p>
<pre> <pre>
<a href="#mxml_node_t">mxml_node_t</a> * <a href="#mxml_node_t">mxml_node_t</a> *
mxmlNewReal( mxmlNewReal(
<a href="#mxml_node_t">mxml_node_t</a> *parent, double real); <a href="#mxml_node_t">mxml_node_t</a> * parent,
double real);
</pre> </pre>
<h3>Arguments</h3> <h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%"> <p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead> <thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody> <tbody>
<tr><td><tt>parent</tt></td><td>Parent node or MXML_NO_PARENT</td></tr>
<tr><td><tt>real</tt></td><td>Real number value</td></tr> <tr><td><tt>real</tt></td><td>Real number value</td></tr>
</tbody></table></p> </tbody></table></p>
<h3>Returns</h3> <h3>Returns</h3>
<p>New node</p> <p>New node</p>
<hr noshade/>
<h2><a name="mxmlNewText">mxmlNewText()</a></h2> <h2><a name="mxmlNewText">mxmlNewText()</a></h2>
<p>Create a new text fragment node. <p>Create a new text fragment node.
@ -323,17 +355,20 @@ string must be nul-terminated and is copied into the new node.</p>
<pre> <pre>
<a href="#mxml_node_t">mxml_node_t</a> * <a href="#mxml_node_t">mxml_node_t</a> *
mxmlNewText( mxmlNewText(
<a href="#mxml_node_t">mxml_node_t</a> *parent, int whitespace, const char * string); <a href="#mxml_node_t">mxml_node_t</a> * parent,
int whitespace,
const char * string);
</pre> </pre>
<h3>Arguments</h3> <h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%"> <p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead> <thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody> <tbody>
<tr><td><tt>parent</tt></td><td>Parent node or MXML_NO_PARENT</td></tr>
<tr><td><tt>whitespace</tt></td><td>1 = leading whitespace, 0 = no whitespace</td></tr>
<tr><td><tt>string</tt></td><td>String</td></tr> <tr><td><tt>string</tt></td><td>String</td></tr>
</tbody></table></p> </tbody></table></p>
<h3>Returns</h3> <h3>Returns</h3>
<p>New node</p> <p>New node</p>
<hr noshade/>
<h2><a name="mxmlNewTextf">mxmlNewTextf()</a></h2> <h2><a name="mxmlNewTextf">mxmlNewTextf()</a></h2>
<p>Create a new formatted text fragment node. <p>Create a new formatted text fragment node.
@ -346,17 +381,22 @@ string must be nul-terminated and is formatted into the new node.</p>
<pre> <pre>
<a href="#mxml_node_t">mxml_node_t</a> * <a href="#mxml_node_t">mxml_node_t</a> *
mxmlNewTextf( mxmlNewTextf(
<a href="#mxml_node_t">mxml_node_t</a> *parent, int whitespace, const char * format,); <a href="#mxml_node_t">mxml_node_t</a> * parent,
int whitespace,
const char * format,
...);
</pre> </pre>
<h3>Arguments</h3> <h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%"> <p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead> <thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody> <tbody>
<tr><td><tt>format,</tt></td><td>Additional args as needed</td></tr> <tr><td><tt>parent</tt></td><td>Parent node or MXML_NO_PARENT</td></tr>
<tr><td><tt>whitespace</tt></td><td>1 = leading whitespace, 0 = no whitespace</td></tr>
<tr><td><tt>format</tt></td><td>Printf-style frmat string</td></tr>
<tr><td><tt>...</tt></td><td>Additional args as needed</td></tr>
</tbody></table></p> </tbody></table></p>
<h3>Returns</h3> <h3>Returns</h3>
<p>New node</p> <p>New node</p>
<hr noshade/>
<h2><a name="mxmlRemove">mxmlRemove()</a></h2> <h2><a name="mxmlRemove">mxmlRemove()</a></h2>
<p>Remove a node from its parent. <p>Remove a node from its parent.
@ -376,7 +416,6 @@ mxmlRemove(
</tbody></table></p> </tbody></table></p>
<h3>Returns</h3> <h3>Returns</h3>
<p>Nothing.</p> <p>Nothing.</p>
<hr noshade/>
<h2><a name="mxmlSaveAllocString">mxmlSaveAllocString()</a></h2> <h2><a name="mxmlSaveAllocString">mxmlSaveAllocString()</a></h2>
<p>Save an XML node tree to an allocated string. <p>Save an XML node tree to an allocated string.
@ -389,17 +428,18 @@ allocated.</p>
<pre> <pre>
char * char *
mxmlSaveAllocString( mxmlSaveAllocString(
<a href="#mxml_node_t">mxml_node_t</a> *node, int (*cb)(mxml_node_t *node, int ws)); <a href="#mxml_node_t">mxml_node_t</a> * node,
int (*cb)(mxml_node_t *node, int ws));
</pre> </pre>
<h3>Arguments</h3> <h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%"> <p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead> <thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody> <tbody>
<tr><td><tt>node</tt></td><td>Node to write</td></tr>
<tr><td><tt>(*cb)(mxml_node_t *node, int ws)</tt></td><td>Whitespace callback or MXML_NO_CALLBACK</td></tr> <tr><td><tt>(*cb)(mxml_node_t *node, int ws)</tt></td><td>Whitespace callback or MXML_NO_CALLBACK</td></tr>
</tbody></table></p> </tbody></table></p>
<h3>Returns</h3> <h3>Returns</h3>
<p>Allocated string or NULL</p> <p>Allocated string or NULL</p>
<hr noshade/>
<h2><a name="mxmlSaveFile">mxmlSaveFile()</a></h2> <h2><a name="mxmlSaveFile">mxmlSaveFile()</a></h2>
<p>Save an XML tree to a file. <p>Save an XML tree to a file.
@ -412,17 +452,20 @@ element tags.</p>
<pre> <pre>
int int
mxmlSaveFile( mxmlSaveFile(
<a href="#mxml_node_t">mxml_node_t</a> *node, FILE *fp, int (*cb)(mxml_node_t *node, int ws)); <a href="#mxml_node_t">mxml_node_t</a> * node,
FILE * fp,
int (*cb)(mxml_node_t *node, int ws));
</pre> </pre>
<h3>Arguments</h3> <h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%"> <p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead> <thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody> <tbody>
<tr><td><tt>node</tt></td><td>Node to write</td></tr>
<tr><td><tt>fp</tt></td><td>File to write to</td></tr>
<tr><td><tt>(*cb)(mxml_node_t *node, int ws)</tt></td><td>Whitespace callback or MXML_NO_CALLBACK</td></tr> <tr><td><tt>(*cb)(mxml_node_t *node, int ws)</tt></td><td>Whitespace callback or MXML_NO_CALLBACK</td></tr>
</tbody></table></p> </tbody></table></p>
<h3>Returns</h3> <h3>Returns</h3>
<p>0 on success, -1 on error.</p> <p>0 on success, -1 on error.</p>
<hr noshade/>
<h2><a name="mxmlSaveString">mxmlSaveString()</a></h2> <h2><a name="mxmlSaveString">mxmlSaveString()</a></h2>
<p>Save an XML node tree to a string. <p>Save an XML node tree to a string.
@ -433,131 +476,148 @@ into the specified buffer.</p>
<pre> <pre>
int int
mxmlSaveString( mxmlSaveString(
<a href="#mxml_node_t">mxml_node_t</a> *node, char *buffer, int bufsize, int (*cb)(mxml_node_t *node, int ws)); <a href="#mxml_node_t">mxml_node_t</a> * node,
char * buffer,
int bufsize,
int (*cb)(mxml_node_t *node, int ws));
</pre> </pre>
<h3>Arguments</h3> <h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%"> <p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead> <thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody> <tbody>
<tr><td><tt>node</tt></td><td>Node to write</td></tr>
<tr><td><tt>buffer</tt></td><td>String buffer</td></tr>
<tr><td><tt>bufsize</tt></td><td>Size of string buffer</td></tr>
<tr><td><tt>(*cb)(mxml_node_t *node, int ws)</tt></td><td>Whitespace callback or MXML_NO_CALLBACK</td></tr> <tr><td><tt>(*cb)(mxml_node_t *node, int ws)</tt></td><td>Whitespace callback or MXML_NO_CALLBACK</td></tr>
</tbody></table></p> </tbody></table></p>
<h3>Returns</h3> <h3>Returns</h3>
<p>Size of string</p> <p>Size of string</p>
<hr noshade/>
<h2><a name="mxmlSetElement">mxmlSetElement()</a></h2> <h2><a name="mxmlSetElement">mxmlSetElement()</a></h2>
<p>Set the name of an element node. <p>Set the name of an element node.
If the node is not changed if it is not an element node.</p> The node is not changed if it is not an element node.</p>
<h3>Syntax</h3> <h3>Syntax</h3>
<pre> <pre>
int int
mxmlSetElement( mxmlSetElement(
<a href="#mxml_node_t">mxml_node_t</a> *node, const char * name); <a href="#mxml_node_t">mxml_node_t</a> * node,
const char * name);
</pre> </pre>
<h3>Arguments</h3> <h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%"> <p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead> <thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody> <tbody>
<tr><td><tt>node</tt></td><td>Node to set</td></tr>
<tr><td><tt>name</tt></td><td>New name string</td></tr> <tr><td><tt>name</tt></td><td>New name string</td></tr>
</tbody></table></p> </tbody></table></p>
<h3>Returns</h3> <h3>Returns</h3>
<p>0 on success, -1 on failure</p> <p>0 on success, -1 on failure</p>
<hr noshade/>
<h2><a name="mxmlSetInteger">mxmlSetInteger()</a></h2> <h2><a name="mxmlSetInteger">mxmlSetInteger()</a></h2>
<p>Set the value of an integer node. <p>Set the value of an integer node.
If the node is not changed if it is not an integer node.</p> The node is not changed if it is not an integer node.</p>
<h3>Syntax</h3> <h3>Syntax</h3>
<pre> <pre>
int int
mxmlSetInteger( mxmlSetInteger(
<a href="#mxml_node_t">mxml_node_t</a> *node, int integer); <a href="#mxml_node_t">mxml_node_t</a> * node,
int integer);
</pre> </pre>
<h3>Arguments</h3> <h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%"> <p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead> <thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody> <tbody>
<tr><td><tt>node</tt></td><td>Node to set</td></tr>
<tr><td><tt>integer</tt></td><td>Integer value</td></tr> <tr><td><tt>integer</tt></td><td>Integer value</td></tr>
</tbody></table></p> </tbody></table></p>
<h3>Returns</h3> <h3>Returns</h3>
<p>0 on success, -1 on failure</p> <p>0 on success, -1 on failure</p>
<hr noshade/>
<h2><a name="mxmlSetOpaque">mxmlSetOpaque()</a></h2> <h2><a name="mxmlSetOpaque">mxmlSetOpaque()</a></h2>
<p>Set the value of an opaque node. <p>Set the value of an opaque node.
If the node is not changed if it is not an opaque node.</p> The node is not changed if it is not an opaque node.</p>
<h3>Syntax</h3> <h3>Syntax</h3>
<pre> <pre>
int int
mxmlSetOpaque( mxmlSetOpaque(
<a href="#mxml_node_t">mxml_node_t</a> *node, const char * opaque); <a href="#mxml_node_t">mxml_node_t</a> * node,
const char * opaque);
</pre> </pre>
<h3>Arguments</h3> <h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%"> <p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead> <thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody> <tbody>
<tr><td><tt>node</tt></td><td>Node to set</td></tr>
<tr><td><tt>opaque</tt></td><td>Opaque string</td></tr> <tr><td><tt>opaque</tt></td><td>Opaque string</td></tr>
</tbody></table></p> </tbody></table></p>
<h3>Returns</h3> <h3>Returns</h3>
<p>0 on success, -1 on failure</p> <p>0 on success, -1 on failure</p>
<hr noshade/>
<h2><a name="mxmlSetReal">mxmlSetReal()</a></h2> <h2><a name="mxmlSetReal">mxmlSetReal()</a></h2>
<p>Set the value of a real number node. <p>Set the value of a real number node.
If the node is not changed if it is not a real number node.</p> The node is not changed if it is not a real number node.</p>
<h3>Syntax</h3> <h3>Syntax</h3>
<pre> <pre>
int int
mxmlSetReal( mxmlSetReal(
<a href="#mxml_node_t">mxml_node_t</a> *node, double real); <a href="#mxml_node_t">mxml_node_t</a> * node,
double real);
</pre> </pre>
<h3>Arguments</h3> <h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%"> <p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead> <thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody> <tbody>
<tr><td><tt>node</tt></td><td>Node to set</td></tr>
<tr><td><tt>real</tt></td><td>Real number value</td></tr> <tr><td><tt>real</tt></td><td>Real number value</td></tr>
</tbody></table></p> </tbody></table></p>
<h3>Returns</h3> <h3>Returns</h3>
<p>0 on success, -1 on failure</p> <p>0 on success, -1 on failure</p>
<hr noshade/>
<h2><a name="mxmlSetText">mxmlSetText()</a></h2> <h2><a name="mxmlSetText">mxmlSetText()</a></h2>
<p>Set the value of a text node. <p>Set the value of a text node.
If the node is not changed if it is not a text node.</p> The node is not changed if it is not a text node.</p>
<h3>Syntax</h3> <h3>Syntax</h3>
<pre> <pre>
int int
mxmlSetText( mxmlSetText(
<a href="#mxml_node_t">mxml_node_t</a> *node, int whitespace, const char * string); <a href="#mxml_node_t">mxml_node_t</a> * node,
int whitespace,
const char * string);
</pre> </pre>
<h3>Arguments</h3> <h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%"> <p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead> <thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody> <tbody>
<tr><td><tt>node</tt></td><td>Node to set</td></tr>
<tr><td><tt>whitespace</tt></td><td>1 = leading whitespace, 0 = no whitespace</td></tr>
<tr><td><tt>string</tt></td><td>String</td></tr> <tr><td><tt>string</tt></td><td>String</td></tr>
</tbody></table></p> </tbody></table></p>
<h3>Returns</h3> <h3>Returns</h3>
<p>0 on success, -1 on failure</p> <p>0 on success, -1 on failure</p>
<hr noshade/>
<h2><a name="mxmlSetTextf">mxmlSetTextf()</a></h2> <h2><a name="mxmlSetTextf">mxmlSetTextf()</a></h2>
<p>Set the value of a text node to a formatted string. <p>Set the value of a text node to a formatted string.
If the node is not changed if it is not a text node.</p> The node is not changed if it is not a text node.</p>
<h3>Syntax</h3> <h3>Syntax</h3>
<pre> <pre>
int int
mxmlSetTextf( mxmlSetTextf(
<a href="#mxml_node_t">mxml_node_t</a> *node, int whitespace, const char * format,); <a href="#mxml_node_t">mxml_node_t</a> * node,
int whitespace,
const char * format,
...);
</pre> </pre>
<h3>Arguments</h3> <h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%"> <p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead> <thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody> <tbody>
<tr><td><tt>format,</tt></td><td>Additional arguments as needed</td></tr> <tr><td><tt>node</tt></td><td>Node to set</td></tr>
<tr><td><tt>whitespace</tt></td><td>1 = leading whitespace, 0 = no whitespace</td></tr>
<tr><td><tt>format</tt></td><td>Printf-style format string</td></tr>
<tr><td><tt>...</tt></td><td>Additional arguments as needed</td></tr>
</tbody></table></p> </tbody></table></p>
<h3>Returns</h3> <h3>Returns</h3>
<p>0 on success, -1 on failure</p> <p>0 on success, -1 on failure</p>
<hr noshade/>
<h2><a name="mxmlWalkNext">mxmlWalkNext()</a></h2> <h2><a name="mxmlWalkNext">mxmlWalkNext()</a></h2>
<p>Walk to the next logical node in the tree. <p>Walk to the next logical node in the tree.
@ -568,17 +628,20 @@ the node's children.</p>
<pre> <pre>
<a href="#mxml_node_t">mxml_node_t</a> * <a href="#mxml_node_t">mxml_node_t</a> *
mxmlWalkNext( mxmlWalkNext(
<a href="#mxml_node_t">mxml_node_t</a> *node, <a href="#mxml_node_t">mxml_node_t</a> *top, int descend); <a href="#mxml_node_t">mxml_node_t</a> * node,
<a href="#mxml_node_t">mxml_node_t</a> * top,
int descend);
</pre> </pre>
<h3>Arguments</h3> <h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%"> <p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead> <thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody> <tbody>
<tr><td><tt>node</tt></td><td>Current node</td></tr>
<tr><td><tt>top</tt></td><td>Top node</td></tr>
<tr><td><tt>descend</tt></td><td>Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST</td></tr> <tr><td><tt>descend</tt></td><td>Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST</td></tr>
</tbody></table></p> </tbody></table></p>
<h3>Returns</h3> <h3>Returns</h3>
<p>Next node or NULL</p> <p>Next node or NULL</p>
<hr noshade/>
<h2><a name="mxmlWalkPrev">mxmlWalkPrev()</a></h2> <h2><a name="mxmlWalkPrev">mxmlWalkPrev()</a></h2>
<p>Walk to the previous logical node in the tree. <p>Walk to the previous logical node in the tree.
@ -589,67 +652,21 @@ the walk to the node's children.</p>
<pre> <pre>
<a href="#mxml_node_t">mxml_node_t</a> * <a href="#mxml_node_t">mxml_node_t</a> *
mxmlWalkPrev( mxmlWalkPrev(
<a href="#mxml_node_t">mxml_node_t</a> *node, <a href="#mxml_node_t">mxml_node_t</a> *top, int descend); <a href="#mxml_node_t">mxml_node_t</a> * node,
<a href="#mxml_node_t">mxml_node_t</a> * top,
int descend);
</pre> </pre>
<h3>Arguments</h3> <h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%"> <p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead> <thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody> <tbody>
<tr><td><tt>node</tt></td><td>Current node</td></tr>
<tr><td><tt>top</tt></td><td>Top node</td></tr>
<tr><td><tt>descend</tt></td><td>Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST</td></tr> <tr><td><tt>descend</tt></td><td>Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST</td></tr>
</tbody></table></p> </tbody></table></p>
<h3>Returns</h3> <h3>Returns</h3>
<p>Previous node or NULL</p> <p>Previous node or NULL</p>
<hr noshade/> <hr noshade/>
<h2><a name="mxml_strdup">mxml_strdup()</a></h2>
<p>Duplicate a string.</p>
<h3>Syntax</h3>
<pre>
char *
mxml_strdup(
const char * s);
</pre>
<h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody>
<tr><td><tt>s</tt></td><td>String to duplicate</td></tr>
</tbody></table></p>
<h3>Returns</h3>
<p>New string pointer</p>
<hr noshade/>
<h2><a name="mxml_strdupf">mxml_strdupf()</a></h2>
<p>Format and duplicate a string.</p>
<h3>Syntax</h3>
<pre>
char *
mxml_strdupf(
const char *format, va_list ap);
</pre>
<h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody>
<tr><td><tt>ap</tt></td><td>Pointer to additional arguments</td></tr>
</tbody></table></p>
<h3>Returns</h3>
<p>New string pointer</p>
<hr noshade/>
<h2><a name="mxml_vsnprintf">mxml_vsnprintf()</a></h2>
<p>Format a string into a fixed size buffer.</p>
<h3>Syntax</h3>
<pre>
int
mxml_vsnprintf(
char *buffer, size_t bufsize, const char *format, va_list ap);
</pre>
<h3>Arguments</h3>
<p class="table"><table align="center" border="1" width="80%">
<thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody>
<tr><td><tt>ap</tt></td><td>Pointer to additional arguments</td></tr>
</tbody></table></p>
<h3>Returns</h3>
<p>Number of bytes formatted</p>
<h1><a name="_structures">Structures</a></h1> <h1><a name="_structures">Structures</a></h1>
<ul> <ul>
<li><a href="#mxml_attr_s"><tt>mxml_attr_s</tt></a></li> <li><a href="#mxml_attr_s"><tt>mxml_attr_s</tt></a></li>
@ -657,7 +674,6 @@ mxml_vsnprintf(
<li><a href="#mxml_text_s"><tt>mxml_text_s</tt></a></li> <li><a href="#mxml_text_s"><tt>mxml_text_s</tt></a></li>
<li><a href="#mxml_value_s"><tt>mxml_value_s</tt></a></li> <li><a href="#mxml_value_s"><tt>mxml_value_s</tt></a></li>
</ul> </ul>
<hr noshade/>
<h2><a name="mxml_attr_s">mxml_attr_s</a></h2> <h2><a name="mxml_attr_s">mxml_attr_s</a></h2>
<p>An XML element attribute value.</p> <p>An XML element attribute value.</p>
<h3>Definition</h3> <h3>Definition</h3>
@ -675,18 +691,17 @@ struct mxml_attr_s
<tr><td><tt>name</tt></td><td>Attribute name</td></tr> <tr><td><tt>name</tt></td><td>Attribute name</td></tr>
<tr><td><tt>value</tt></td><td>Attribute value</td></tr> <tr><td><tt>value</tt></td><td>Attribute value</td></tr>
</tbody></table></p> </tbody></table></p>
<hr noshade/>
<h2><a name="mxml_node_s">mxml_node_s</a></h2> <h2><a name="mxml_node_s">mxml_node_s</a></h2>
<p>Data types...</p> <p>An XML node.</p>
<h3>Definition</h3> <h3>Definition</h3>
<pre> <pre>
struct mxml_node_s struct mxml_node_s
{ {
<a href="#mxml_node_t">mxml_node_t</a> * child; struct <a href="#mxml_node_s">mxml_node_s</a> * child;
<a href="#mxml_node_t">mxml_node_t</a> * last_child; struct <a href="#mxml_node_s">mxml_node_s</a> * last_child;
<a href="#mxml_node_t">mxml_node_t</a> * next; struct <a href="#mxml_node_s">mxml_node_s</a> * next;
<a href="#mxml_node_t">mxml_node_t</a> * parent; struct <a href="#mxml_node_s">mxml_node_s</a> * parent;
<a href="#mxml_node_t">mxml_node_t</a> * prev; struct <a href="#mxml_node_s">mxml_node_s</a> * prev;
<a href="#mxml_type_t">mxml_type_t</a> type; <a href="#mxml_type_t">mxml_type_t</a> type;
<a href="#mxml_value_t">mxml_value_t</a> value; <a href="#mxml_value_t">mxml_value_t</a> value;
}; };
@ -703,7 +718,6 @@ struct mxml_node_s
<tr><td><tt>type</tt></td><td>Node type</td></tr> <tr><td><tt>type</tt></td><td>Node type</td></tr>
<tr><td><tt>value</tt></td><td>Node value</td></tr> <tr><td><tt>value</tt></td><td>Node value</td></tr>
</tbody></table></p> </tbody></table></p>
<hr noshade/>
<h2><a name="mxml_text_s">mxml_text_s</a></h2> <h2><a name="mxml_text_s">mxml_text_s</a></h2>
<p>An XML text value.</p> <p>An XML text value.</p>
<h3>Definition</h3> <h3>Definition</h3>
@ -721,7 +735,6 @@ struct mxml_text_s
<tr><td><tt>string</tt></td><td>Fragment string</td></tr> <tr><td><tt>string</tt></td><td>Fragment string</td></tr>
<tr><td><tt>whitespace</tt></td><td>Leading whitespace?</td></tr> <tr><td><tt>whitespace</tt></td><td>Leading whitespace?</td></tr>
</tbody></table></p> </tbody></table></p>
<hr noshade/>
<h2><a name="mxml_value_s">mxml_value_s</a></h2> <h2><a name="mxml_value_s">mxml_value_s</a></h2>
<p>An XML element value.</p> <p>An XML element value.</p>
<h3>Definition</h3> <h3>Definition</h3>
@ -741,6 +754,7 @@ struct mxml_value_s
<tr><td><tt>name</tt></td><td>Name of element</td></tr> <tr><td><tt>name</tt></td><td>Name of element</td></tr>
<tr><td><tt>num_attrs</tt></td><td>Number of attributes</td></tr> <tr><td><tt>num_attrs</tt></td><td>Number of attributes</td></tr>
</tbody></table></p> </tbody></table></p>
<hr noshade/>
<h1><a name="_types">Types</a></h1> <h1><a name="_types">Types</a></h1>
<ul> <ul>
<li><a href="#mxml_attr_t"><tt>mxml_attr_t</tt></a></li> <li><a href="#mxml_attr_t"><tt>mxml_attr_t</tt></a></li>
@ -750,53 +764,47 @@ struct mxml_value_s
<li><a href="#mxml_type_t"><tt>mxml_type_t</tt></a></li> <li><a href="#mxml_type_t"><tt>mxml_type_t</tt></a></li>
<li><a href="#mxml_value_t"><tt>mxml_value_t</tt></a></li> <li><a href="#mxml_value_t"><tt>mxml_value_t</tt></a></li>
</ul> </ul>
<hr noshade/>
<h2><a name="mxml_attr_t">mxml_attr_t</a></h2> <h2><a name="mxml_attr_t">mxml_attr_t</a></h2>
<p>An XML element attribute value.</p> <p>An XML element attribute value.</p>
<h3>Definition</h3> <h3>Definition</h3>
<pre> <pre>
typedef struct <a href="#mxml_attr_s">mxml_attr_s</a> mxml_attr_t; typedef struct <a href="#mxml_attr_s">mxml_attr_s</a> mxml_attr_t;
</pre> </pre>
<hr noshade/>
<h2><a name="mxml_element_t">mxml_element_t</a></h2> <h2><a name="mxml_element_t">mxml_element_t</a></h2>
<p>An XML element value.</p> <p>An XML element value.</p>
<h3>Definition</h3> <h3>Definition</h3>
<pre> <pre>
typedef struct <a href="#mxml_value_s">mxml_value_s</a> mxml_element_t; typedef struct <a href="#mxml_value_s">mxml_value_s</a> mxml_element_t;
</pre> </pre>
<hr noshade/>
<h2><a name="mxml_node_t">mxml_node_t</a></h2> <h2><a name="mxml_node_t">mxml_node_t</a></h2>
<p>An XML node.</p> <p>An XML node.</p>
<h3>Definition</h3> <h3>Definition</h3>
<pre> <pre>
typedef struct <a href="#mxml_node_s">mxml_node_s</a> mxml_node_t; typedef struct <a href="#mxml_node_s">mxml_node_s</a> mxml_node_t;
</pre> </pre>
<hr noshade/>
<h2><a name="mxml_text_t">mxml_text_t</a></h2> <h2><a name="mxml_text_t">mxml_text_t</a></h2>
<p>An XML text value.</p> <p>An XML text value.</p>
<h3>Definition</h3> <h3>Definition</h3>
<pre> <pre>
typedef struct <a href="#mxml_text_s">mxml_text_s</a> mxml_text_t; typedef struct <a href="#mxml_text_s">mxml_text_s</a> mxml_text_t;
</pre> </pre>
<hr noshade/>
<h2><a name="mxml_type_t">mxml_type_t</a></h2> <h2><a name="mxml_type_t">mxml_type_t</a></h2>
<p>The XML node type.</p> <p>The XML node type.</p>
<h3>Definition</h3> <h3>Definition</h3>
<pre> <pre>
typedef enum <a href="#mxml_type_e">mxml_type_e</a> mxml_type_t; typedef enum <a href="#mxml_type_e">mxml_type_e</a> mxml_type_t;
</pre> </pre>
<hr noshade/>
<h2><a name="mxml_value_t">mxml_value_t</a></h2> <h2><a name="mxml_value_t">mxml_value_t</a></h2>
<p>An XML node value.</p> <p>An XML node value.</p>
<h3>Definition</h3> <h3>Definition</h3>
<pre> <pre>
typedef union <a href="#mxml_value_u">mxml_value_u</a> mxml_value_t; typedef union <a href="#mxml_value_u">mxml_value_u</a> mxml_value_t;
</pre> </pre>
<hr noshade/>
<h1><a name="_unions">Unions</a></h1> <h1><a name="_unions">Unions</a></h1>
<ul> <ul>
<li><a href="#mxml_value_u"><tt>mxml_value_u</tt></a></li> <li><a href="#mxml_value_u"><tt>mxml_value_u</tt></a></li>
</ul> </ul>
<hr noshade/>
<h2><a name="mxml_value_u">mxml_value_u</a></h2> <h2><a name="mxml_value_u">mxml_value_u</a></h2>
<p>An XML node value.</p> <p>An XML node value.</p>
<h3>Definition</h3> <h3>Definition</h3>

@ -1,5 +1,5 @@
/* /*
* "$Id: mxml-file.c,v 1.20 2003/07/27 23:11:40 mike Exp $" * "$Id: mxml-file.c,v 1.21 2003/09/28 21:09:04 mike Exp $"
* *
* File loading code for mini-XML, a small XML-like file parsing library. * File loading code for mini-XML, a small XML-like file parsing library.
* *
@ -75,6 +75,10 @@ static int mxml_write_ws(mxml_node_t *node, void *p,
* function returns the value type that should be used for child nodes. * 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 * If MXML_NO_CALLBACK is specified then all child nodes will be either
* MXML_ELEMENT or MXML_TEXT nodes. * 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.
*/ */
mxml_node_t * /* O - First node or NULL if the file could not be read. */ mxml_node_t * /* O - First node or NULL if the file could not be read. */
@ -96,6 +100,10 @@ mxmlLoadFile(mxml_node_t *top, /* I - Top node */
* function returns the value type that should be used for child nodes. * 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 * If MXML_NO_CALLBACK is specified then all child nodes will be either
* MXML_ELEMENT or MXML_TEXT nodes. * 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.
*/ */
mxml_node_t * /* O - First node or NULL if the string has errors. */ mxml_node_t * /* O - First node or NULL if the string has errors. */
@ -1432,5 +1440,5 @@ mxml_write_ws(mxml_node_t *node, /* I - Current node */
/* /*
* End of "$Id: mxml-file.c,v 1.20 2003/07/27 23:11:40 mike Exp $". * End of "$Id: mxml-file.c,v 1.21 2003/09/28 21:09:04 mike Exp $".
*/ */

@ -1,5 +1,5 @@
/* /*
* "$Id: mxml-node.c,v 1.8 2003/09/28 12:44:39 mike Exp $" * "$Id: mxml-node.c,v 1.9 2003/09/28 21:09:04 mike Exp $"
* *
* Node support code for mini-XML, a small XML-like file parsing library. * Node support code for mini-XML, a small XML-like file parsing library.
* *
@ -26,12 +26,6 @@
* mxmlNewText() - Create a new text fragment node. * mxmlNewText() - Create a new text fragment node.
* mxmlNewTextf() - Create a new formatted text fragment node. * mxmlNewTextf() - Create a new formatted text fragment node.
* mxmlRemove() - Remove a node from its parent. * mxmlRemove() - Remove a node from its parent.
* mxmlSetElement() - Set the name of an element node.
* mxmlSetInteger() - Set the value of an integer node.
* mxmlSetOpaque() - Set the value of an opaque node.
* mxmlSetReal() - Set the value of a real number node.
* mxmlSetText() - Set the value of a text node.
* mxmlSetTextf() - Set the value of a text node to a formatted string.
* mxml_new() - Create a new node. * mxml_new() - Create a new node.
*/ */
@ -502,192 +496,6 @@ mxmlRemove(mxml_node_t *node) /* I - Node to remove */
} }
/*
* 'mxmlSetElement()' - Set the name of an element node.
*
* If the node is not changed if it is not an element node.
*/
int /* O - 0 on success, -1 on failure */
mxmlSetElement(mxml_node_t *node, /* I - Node to set */
const char *name) /* I - New name string */
{
/*
* Range check input...
*/
if (!node || node->type != MXML_ELEMENT || !name)
return (-1);
/*
* Free any old element value and set the new value...
*/
if (node->value.element.name)
free(node->value.element.name);
node->value.element.name = strdup(name);
return (0);
}
/*
* 'mxmlSetInteger()' - Set the value of an integer node.
*
* If the node is not changed if it is not an integer node.
*/
int /* O - 0 on success, -1 on failure */
mxmlSetInteger(mxml_node_t *node, /* I - Node to set */
int integer) /* I - Integer value */
{
/*
* Range check input...
*/
if (!node || node->type != MXML_INTEGER)
return (-1);
/*
* Set the new value and return...
*/
node->value.integer = integer;
return (0);
}
/*
* 'mxmlSetOpaque()' - Set the value of an opaque node.
*
* If the node is not changed if it is not an opaque node.
*/
int /* O - 0 on success, -1 on failure */
mxmlSetOpaque(mxml_node_t *node, /* I - Node to set */
const char *opaque) /* I - Opaque string */
{
/*
* Range check input...
*/
if (!node || node->type != MXML_OPAQUE || !opaque)
return (-1);
/*
* Free any old opaque value and set the new value...
*/
if (node->value.opaque)
free(node->value.opaque);
node->value.opaque = strdup(opaque);
return (0);
}
/*
* 'mxmlSetReal()' - Set the value of a real number node.
*
* If the node is not changed if it is not a real number node.
*/
int /* O - 0 on success, -1 on failure */
mxmlSetReal(mxml_node_t *node, /* I - Node to set */
double real) /* I - Real number value */
{
/*
* Range check input...
*/
if (!node || node->type != MXML_REAL)
return (-1);
/*
* Set the new value and return...
*/
node->value.real = real;
return (0);
}
/*
* 'mxmlSetText()' - Set the value of a text node.
*
* If the node is not changed if it is not a text node.
*/
int /* O - 0 on success, -1 on failure */
mxmlSetText(mxml_node_t *node, /* I - Node to set */
int whitespace, /* I - 1 = leading whitespace, 0 = no whitespace */
const char *string) /* I - String */
{
/*
* Range check input...
*/
if (!node || node->type != MXML_TEXT || !string)
return (-1);
/*
* Free any old string value and set the new value...
*/
if (node->value.text.string)
free(node->value.text.string);
node->value.text.whitespace = whitespace;
node->value.text.string = strdup(string);
return (0);
}
/*
* 'mxmlSetTextf()' - Set the value of a text node to a formatted string.
*
* If the node is not changed if it is not a text node.
*/
int /* O - 0 on success, -1 on failure */
mxmlSetTextf(mxml_node_t *node, /* I - Node to set */
int whitespace, /* I - 1 = leading whitespace, 0 = no whitespace */
const char *format, /* I - Printf-style format string */
...) /* I - Additional arguments as needed */
{
va_list ap; /* Pointer to arguments */
/*
* Range check input...
*/
if (!node || node->type != MXML_TEXT || !format)
return (-1);
/*
* Free any old string value and set the new value...
*/
if (node->value.text.string)
free(node->value.text.string);
va_start(ap, format);
node->value.text.whitespace = whitespace;
node->value.text.string = mxml_strdupf(format, ap);
va_end(ap);
return (0);
}
/* /*
* 'mxml_new()' - Create a new node. * 'mxml_new()' - Create a new node.
*/ */
@ -728,5 +536,5 @@ mxml_new(mxml_node_t *parent, /* I - Parent node */
/* /*
* End of "$Id: mxml-node.c,v 1.8 2003/09/28 12:44:39 mike Exp $". * End of "$Id: mxml-node.c,v 1.9 2003/09/28 21:09:04 mike Exp $".
*/ */

@ -0,0 +1,73 @@
/*
* "$Id: mxml-private.c,v 1.1 2003/09/28 21:09:04 mike Exp $"
*
* Private functions for mini-XML, a small XML-like file parsing library.
*
* Copyright 2003 by Michael Sweet.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* Contents:
*
* mxml_integer_cb() - Default callback for integer values.
* mxml_opaque_cb() - Default callback for opaque values.
* mxml_real_cb() - Default callback for real number values.
*/
/*
* Include necessary headers...
*/
#include "mxml.h"
/*
* 'mxml_integer_cb()' - Default callback for integer values.
*/
mxml_type_t /* O - Node type */
mxml_integer_cb(mxml_node_t *node) /* I - Current node */
{
(void)node;
return (MXML_INTEGER);
}
/*
* 'mxml_opaque_cb()' - Default callback for opaque values.
*/
mxml_type_t /* O - Node type */
mxml_opaque_cb(mxml_node_t *node) /* I - Current node */
{
(void)node;
return (MXML_OPAQUE);
}
/*
* 'mxml_real_cb()' - Default callback for real number values.
*/
mxml_type_t /* O - Node type */
mxml_real_cb(mxml_node_t *node) /* I - Current node */
{
(void)node;
return (MXML_REAL);
}
/*
* End of "$Id: mxml-private.c,v 1.1 2003/09/28 21:09:04 mike Exp $".
*/

@ -0,0 +1,224 @@
/*
* "$Id: mxml-set.c,v 1.1 2003/09/28 21:09:04 mike Exp $"
*
* Node set functions for mini-XML, a small XML-like file parsing library.
*
* Copyright 2003 by Michael Sweet.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* Contents:
*
* mxmlSetElement() - Set the name of an element node.
* mxmlSetInteger() - Set the value of an integer node.
* mxmlSetOpaque() - Set the value of an opaque node.
* mxmlSetReal() - Set the value of a real number node.
* mxmlSetText() - Set the value of a text node.
* mxmlSetTextf() - Set the value of a text node to a formatted string.
*/
/*
* Include necessary headers...
*/
#include "config.h"
#include "mxml.h"
/*
* 'mxmlSetElement()' - Set the name of an element node.
*
* The node is not changed if it is not an element node.
*/
int /* O - 0 on success, -1 on failure */
mxmlSetElement(mxml_node_t *node, /* I - Node to set */
const char *name) /* I - New name string */
{
/*
* Range check input...
*/
if (!node || node->type != MXML_ELEMENT || !name)
return (-1);
/*
* Free any old element value and set the new value...
*/
if (node->value.element.name)
free(node->value.element.name);
node->value.element.name = strdup(name);
return (0);
}
/*
* 'mxmlSetInteger()' - Set the value of an integer node.
*
* The node is not changed if it is not an integer node.
*/
int /* O - 0 on success, -1 on failure */
mxmlSetInteger(mxml_node_t *node, /* I - Node to set */
int integer) /* I - Integer value */
{
/*
* Range check input...
*/
if (!node || node->type != MXML_INTEGER)
return (-1);
/*
* Set the new value and return...
*/
node->value.integer = integer;
return (0);
}
/*
* 'mxmlSetOpaque()' - Set the value of an opaque node.
*
* The node is not changed if it is not an opaque node.
*/
int /* O - 0 on success, -1 on failure */
mxmlSetOpaque(mxml_node_t *node, /* I - Node to set */
const char *opaque) /* I - Opaque string */
{
/*
* Range check input...
*/
if (!node || node->type != MXML_OPAQUE || !opaque)
return (-1);
/*
* Free any old opaque value and set the new value...
*/
if (node->value.opaque)
free(node->value.opaque);
node->value.opaque = strdup(opaque);
return (0);
}
/*
* 'mxmlSetReal()' - Set the value of a real number node.
*
* The node is not changed if it is not a real number node.
*/
int /* O - 0 on success, -1 on failure */
mxmlSetReal(mxml_node_t *node, /* I - Node to set */
double real) /* I - Real number value */
{
/*
* Range check input...
*/
if (!node || node->type != MXML_REAL)
return (-1);
/*
* Set the new value and return...
*/
node->value.real = real;
return (0);
}
/*
* 'mxmlSetText()' - Set the value of a text node.
*
* The node is not changed if it is not a text node.
*/
int /* O - 0 on success, -1 on failure */
mxmlSetText(mxml_node_t *node, /* I - Node to set */
int whitespace, /* I - 1 = leading whitespace, 0 = no whitespace */
const char *string) /* I - String */
{
/*
* Range check input...
*/
if (!node || node->type != MXML_TEXT || !string)
return (-1);
/*
* Free any old string value and set the new value...
*/
if (node->value.text.string)
free(node->value.text.string);
node->value.text.whitespace = whitespace;
node->value.text.string = strdup(string);
return (0);
}
/*
* 'mxmlSetTextf()' - Set the value of a text node to a formatted string.
*
* The node is not changed if it is not a text node.
*/
int /* O - 0 on success, -1 on failure */
mxmlSetTextf(mxml_node_t *node, /* I - Node to set */
int whitespace, /* I - 1 = leading whitespace, 0 = no whitespace */
const char *format, /* I - Printf-style format string */
...) /* I - Additional arguments as needed */
{
va_list ap; /* Pointer to arguments */
/*
* Range check input...
*/
if (!node || node->type != MXML_TEXT || !format)
return (-1);
/*
* Free any old string value and set the new value...
*/
if (node->value.text.string)
free(node->value.text.string);
va_start(ap, format);
node->value.text.whitespace = whitespace;
node->value.text.string = mxml_strdupf(format, ap);
va_end(ap);
return (0);
}
/*
* End of "$Id: mxml-set.c,v 1.1 2003/09/28 21:09:04 mike Exp $".
*/

@ -1,5 +1,5 @@
/* /*
* "$Id: mxml.h,v 1.13 2003/09/28 12:44:39 mike Exp $" * "$Id: mxml.h,v 1.14 2003/09/28 21:09:04 mike Exp $"
* *
* Header file for mini-XML, a small XML-like file parsing library. * Header file for mini-XML, a small XML-like file parsing library.
* *
@ -42,8 +42,14 @@
# define MXML_TAB 8 /* Tabs every N columns */ # define MXML_TAB 8 /* Tabs every N columns */
# define MXML_NO_CALLBACK 0 /* Don't use a type callback */ # define MXML_NO_CALLBACK 0 /* Don't use a type callback */
# define MXML_OPAQUE_CALLBACK _mxml_opaque_cb # define MXML_INTEGER_CALLBACK mxml_integer_cb
/* Treat all data as integers */
# define MXML_OPAQUE_CALLBACK mxml_opaque_cb
/* Treat all data as opaque */ /* Treat all data as opaque */
# define MXML_REAL_CALLBACK mxml_real_cb
/* Treat all data as real numbers */
# define MXML_TEXT_CALLBACK 0 /* Treat all data as text */
# define MXML_NO_PARENT 0 /* No parent for the node */ # define MXML_NO_PARENT 0 /* No parent for the node */
# define MXML_DESCEND 1 /* Descend when finding/walking */ # define MXML_DESCEND 1 /* Descend when finding/walking */
@ -101,18 +107,16 @@ typedef union mxml_value_u /**** An XML node value. ****/
mxml_text_t text; /* Text fragment */ mxml_text_t text; /* Text fragment */
} mxml_value_t; } mxml_value_t;
typedef struct mxml_node_s mxml_node_t; /**** An XML node. ****/ typedef struct mxml_node_s /**** An XML node. ****/
struct mxml_node_s /**** An XML node. ****/
{ {
mxml_type_t type; /* Node type */ mxml_type_t type; /* Node type */
mxml_node_t *next; /* Next node under same parent */ struct mxml_node_s *next; /* Next node under same parent */
mxml_node_t *prev; /* Previous node under same parent */ struct mxml_node_s *prev; /* Previous node under same parent */
mxml_node_t *parent; /* Parent node */ struct mxml_node_s *parent; /* Parent node */
mxml_node_t *child; /* First child node */ struct mxml_node_s *child; /* First child node */
mxml_node_t *last_child; /* Last child node */ struct mxml_node_s *last_child; /* Last child node */
mxml_value_t value; /* Node value */ mxml_value_t value; /* Node value */
}; } mxml_node_t;
/* /*
@ -196,5 +200,5 @@ extern mxml_type_t _mxml_opaque_cb(mxml_node_t *node);
/* /*
* End of "$Id: mxml.h,v 1.13 2003/09/28 12:44:39 mike Exp $". * End of "$Id: mxml.h,v 1.14 2003/09/28 21:09:04 mike Exp $".
*/ */

@ -7,8 +7,10 @@ on the value of the where argument. If the child argument is NULL,
puts the new node at the beginning of the child list (MXML_ADD_BEFORE) puts the new node at the beginning of the child list (MXML_ADD_BEFORE)
or at the end of the child list (MXML_ADD_AFTER). The constant or at the end of the child list (MXML_ADD_AFTER). The constant
MXML_ADD_TO_PARENT can be used to specify a NULL child pointer.</description><argument MXML_ADD_TO_PARENT can be used to specify a NULL child pointer.</description><argument
name="node" direction="I"><type>mxml_node_t *parent, int where, mxml_node_t name="parent" direction="I"><type>mxml_node_t *</type><description>Parent node</description></argument>
*child, mxml_node_t *</type><description>Node to add</description></argument> <argument name="where" direction="I"><type>int</type><description>Where to add, MXML_ADD_BEFORE or MXML_ADD_AFTER</description></argument>
<argument name="child" direction="I"><type>mxml_node_t *</type><description>Child node for where or MXML_ADD_TO_PARENT</description></argument>
<argument name="node" direction="I"><type>mxml_node_t *</type><description>Node to add</description></argument>
</function> </function>
<function name="mxmlDelete"><description>Delete a node and all of its children. <function name="mxmlDelete"><description>Delete a node and all of its children.
@ -22,7 +24,8 @@ char *</type></returnvalue>
This function returns NULL if the node is not an element or the This function returns NULL if the node is not an element or the
named attribute does not exist.</description><argument named attribute does not exist.</description><argument
name="name" direction="I"><type>mxml_node_t *node, const char *</type><description>Name of attribute</description></argument> name="node" direction="I"><type>mxml_node_t *</type><description>Element node</description></argument>
<argument name="name" direction="I"><type>const char *</type><description>Name of attribute</description></argument>
</function> </function>
<function name="mxmlElementSetAttr"><description>Set an attribute. <function name="mxmlElementSetAttr"><description>Set an attribute.
@ -30,8 +33,9 @@ If the named attribute already exists, the value of the attribute
is replaced by the new string value. The string value is copied is replaced by the new string value. The string value is copied
into the element node. This function does nothing if the node is into the element node. This function does nothing if the node is
not an element.</description><argument not an element.</description><argument
name="value" direction="I"><type>mxml_node_t *node, const char *name, const name="node" direction="I"><type>mxml_node_t *</type><description>Element node</description></argument>
char *</type><description>Attribute value</description></argument> <argument name="name" direction="I"><type>const char *</type><description>Name of attribute</description></argument>
<argument name="value" direction="I"><type>const char *</type><description>Attribute value</description></argument>
</function> </function>
<function name="mxmlFindElement"><returnvalue><description>Element node or NULL</description><type>mxml_node_t <function name="mxmlFindElement"><returnvalue><description>Element node or NULL</description><type>mxml_node_t
*</type></returnvalue> *</type></returnvalue>
@ -45,8 +49,12 @@ whether the search descends into child nodes; normally you will use
MXML_DESCEND_FIRST for the initial search and MXML_NO_DESCEND to find MXML_DESCEND_FIRST for the initial search and MXML_NO_DESCEND to find
additional direct descendents of the node. The top node argument additional direct descendents of the node. The top node argument
constrains the search to a particular node's children.</description><argument constrains the search to a particular node's children.</description><argument
name="descend" direction="I"><type>mxml_node_t *node, mxml_node_t *top, const name="node" direction="I"><type>mxml_node_t *</type><description>Current node</description></argument>
char *name, const char *attr, const char *value, int</type><description>Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST</description></argument> <argument name="top" direction="I"><type>mxml_node_t *</type><description>Top node</description></argument>
<argument name="name" direction="I"><type>const char *</type><description>Element name or NULL for any</description></argument>
<argument name="attr" direction="I"><type>const char *</type><description>Attribute name, or NULL for none</description></argument>
<argument name="value" direction="I"><type>const char *</type><description>Attribute value, or NULL for any</description></argument>
<argument name="descend" direction="I"><type>int</type><description>Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST</description></argument>
</function> </function>
<function name="mxmlLoadFile"><returnvalue><description>First node or NULL if the file could not be read.</description><type>mxml_node_t <function name="mxmlLoadFile"><returnvalue><description>First node or NULL if the file could not be read.</description><type>mxml_node_t
*</type></returnvalue> *</type></returnvalue>
@ -57,9 +65,14 @@ If no top node is provided, the XML file MUST be well-formed with a
single parent node like &lt;?xml&gt; for the entire file. The callback single parent node like &lt;?xml&gt; for the entire file. The callback
function returns the value type that should be used for child nodes. 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 If MXML_NO_CALLBACK is specified then all child nodes will be either
MXML_ELEMENT or MXML_TEXT nodes.</description><argument MXML_ELEMENT or MXML_TEXT nodes.
name="(*cb)(mxml_node_t *node)" direction="I"><type>mxml_node_t *top, FILE
*fp, mxml_type_t</type><description>Callback function or MXML_NO_CALLBACK</description></argument> 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.</description><argument
name="top" direction="I"><type>mxml_node_t *</type><description>Top node</description></argument>
<argument name="fp" direction="I"><type>FILE *</type><description>File to read from</description></argument>
<argument name="(*cb)(mxml_node_t *node)" direction="I"><type>mxml_type_t</type><description>Callback function or MXML_NO_CALLBACK</description></argument>
</function> </function>
<function name="mxmlLoadString"><returnvalue><description>First node or NULL if the string has errors.</description><type>mxml_node_t <function name="mxmlLoadString"><returnvalue><description>First node or NULL if the string has errors.</description><type>mxml_node_t
*</type></returnvalue> *</type></returnvalue>
@ -70,9 +83,14 @@ If no top node is provided, the XML string MUST be well-formed with a
single parent node like &lt;?xml&gt; for the entire string. The callback single parent node like &lt;?xml&gt; for the entire string. The callback
function returns the value type that should be used for child nodes. 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 If MXML_NO_CALLBACK is specified then all child nodes will be either
MXML_ELEMENT or MXML_TEXT nodes.</description><argument MXML_ELEMENT or MXML_TEXT nodes.
name="(*cb)(mxml_node_t *node)" direction="I"><type>mxml_node_t *top, const
char *s, mxml_type_t</type><description>Callback function or MXML_NO_CALLBACK</description></argument> 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.</description><argument
name="top" direction="I"><type>mxml_node_t *</type><description>Top node</description></argument>
<argument name="s" direction="I"><type>const char *</type><description>String to load</description></argument>
<argument name="(*cb)(mxml_node_t *node)" direction="I"><type>mxml_type_t</type><description>Callback function or MXML_NO_CALLBACK</description></argument>
</function> </function>
<function name="mxmlNewElement"><returnvalue><description>New node</description><type>mxml_node_t <function name="mxmlNewElement"><returnvalue><description>New node</description><type>mxml_node_t
*</type></returnvalue> *</type></returnvalue>
@ -81,7 +99,8 @@ char *s, mxml_type_t</type><description>Callback function or MXML_NO_CALLBACK</d
The new element node is added to the end of the specified parent's child The new element node is added to the end of the specified parent's child
list. The constant MXML_NO_PARENT can be used to specify that the new list. The constant MXML_NO_PARENT can be used to specify that the new
element node has no parent.</description><argument element node has no parent.</description><argument
name="name" direction="I"><type>mxml_node_t *parent, const char *</type><description>Name of element</description></argument> name="parent" direction="I"><type>mxml_node_t *</type><description>Parent node or MXML_NO_PARENT</description></argument>
<argument name="name" direction="I"><type>const char *</type><description>Name of element</description></argument>
</function> </function>
<function name="mxmlNewInteger"><returnvalue><description>New node</description><type>mxml_node_t <function name="mxmlNewInteger"><returnvalue><description>New node</description><type>mxml_node_t
*</type></returnvalue> *</type></returnvalue>
@ -90,7 +109,8 @@ name="name" direction="I"><type>mxml_node_t *parent, const char *</type><descrip
The new integer node is added to the end of the specified parent's child The new integer node is added to the end of the specified parent's child
list. The constant MXML_NO_PARENT can be used to specify that the new list. The constant MXML_NO_PARENT can be used to specify that the new
integer node has no parent.</description><argument integer node has no parent.</description><argument
name="integer" direction="I"><type>mxml_node_t *parent, int</type><description>Integer value</description></argument> name="parent" direction="I"><type>mxml_node_t *</type><description>Parent node or MXML_NO_PARENT</description></argument>
<argument name="integer" direction="I"><type>int</type><description>Integer value</description></argument>
</function> </function>
<function name="mxmlNewOpaque"><returnvalue><description>New node</description><type>mxml_node_t <function name="mxmlNewOpaque"><returnvalue><description>New node</description><type>mxml_node_t
*</type></returnvalue> *</type></returnvalue>
@ -100,7 +120,8 @@ The new opaque node is added to the end of the specified parent's child
list. The constant MXML_NO_PARENT can be used to specify that the new list. The constant MXML_NO_PARENT can be used to specify that the new
opaque node has no parent. The opaque string must be nul-terminated and opaque node has no parent. The opaque string must be nul-terminated and
is copied into the new node.</description><argument is copied into the new node.</description><argument
name="opaque" direction="I"><type>mxml_node_t *parent, const char *</type><description>Opaque string</description></argument> name="parent" direction="I"><type>mxml_node_t *</type><description>Parent node or MXML_NO_PARENT</description></argument>
<argument name="opaque" direction="I"><type>const char *</type><description>Opaque string</description></argument>
</function> </function>
<function name="mxmlNewReal"><returnvalue><description>New node</description><type>mxml_node_t <function name="mxmlNewReal"><returnvalue><description>New node</description><type>mxml_node_t
*</type></returnvalue> *</type></returnvalue>
@ -109,7 +130,8 @@ name="opaque" direction="I"><type>mxml_node_t *parent, const char *</type><descr
The new real number node is added to the end of the specified parent's The new real number node is added to the end of the specified parent's
child list. The constant MXML_NO_PARENT can be used to specify that child list. The constant MXML_NO_PARENT can be used to specify that
the new real number node has no parent.</description><argument the new real number node has no parent.</description><argument
name="real" direction="I"><type>mxml_node_t *parent, double</type><description>Real number value</description></argument> name="parent" direction="I"><type>mxml_node_t *</type><description>Parent node or MXML_NO_PARENT</description></argument>
<argument name="real" direction="I"><type>double</type><description>Real number value</description></argument>
</function> </function>
<function name="mxmlNewText"><returnvalue><description>New node</description><type>mxml_node_t <function name="mxmlNewText"><returnvalue><description>New node</description><type>mxml_node_t
*</type></returnvalue> *</type></returnvalue>
@ -120,8 +142,9 @@ list. The constant MXML_NO_PARENT can be used to specify that the new
text node has no parent. The whitespace parameter is used to specify text node has no parent. The whitespace parameter is used to specify
whether leading whitespace is present before the node. The text whether leading whitespace is present before the node. The text
string must be nul-terminated and is copied into the new node.</description><argument string must be nul-terminated and is copied into the new node.</description><argument
name="string" direction="I"><type>mxml_node_t *parent, int whitespace, const name="parent" direction="I"><type>mxml_node_t *</type><description>Parent node or MXML_NO_PARENT</description></argument>
char *</type><description>String</description></argument> <argument name="whitespace" direction="I"><type>int</type><description>1 = leading whitespace, 0 = no whitespace</description></argument>
<argument name="string" direction="I"><type>const char *</type><description>String</description></argument>
</function> </function>
<function name="mxmlNewTextf"><returnvalue><description>New node</description><type>mxml_node_t <function name="mxmlNewTextf"><returnvalue><description>New node</description><type>mxml_node_t
*</type></returnvalue> *</type></returnvalue>
@ -132,8 +155,10 @@ list. The constant MXML_NO_PARENT can be used to specify that the new
text node has no parent. The whitespace parameter is used to specify text node has no parent. The whitespace parameter is used to specify
whether leading whitespace is present before the node. The format whether leading whitespace is present before the node. The format
string must be nul-terminated and is formatted into the new node.</description><argument string must be nul-terminated and is formatted into the new node.</description><argument
name="format," direction="I"><type>mxml_node_t *parent, int whitespace, const name="parent" direction="I"><type>mxml_node_t *</type><description>Parent node or MXML_NO_PARENT</description></argument>
char *</type><description>Additional args as needed</description></argument> <argument name="whitespace" direction="I"><type>int</type><description>1 = leading whitespace, 0 = no whitespace</description></argument>
<argument name="format" direction="I"><type>const char *</type><description>Printf-style frmat string</description></argument>
<argument name="..." direction="I"><type/><description>Additional args as needed</description></argument>
</function> </function>
<function name="mxmlRemove"><description>Remove a node from its parent. <function name="mxmlRemove"><description>Remove a node from its parent.
@ -150,8 +175,8 @@ representation of the XML node tree. The string should be freed
using the free() function when you are done with it. NULL is returned using the free() function when you are done with it. NULL is returned
if the node would produce an empty string or if the string cannot be if the node would produce an empty string or if the string cannot be
allocated.</description><argument allocated.</description><argument
name="(*cb)(mxml_node_t *node, int ws)" direction="I"><type>mxml_node_t *node, name="node" direction="I"><type>mxml_node_t *</type><description>Node to write</description></argument>
int</type><description>Whitespace callback or MXML_NO_CALLBACK</description></argument> <argument name="(*cb)(mxml_node_t *node, int ws)" direction="I"><type>int</type><description>Whitespace callback or MXML_NO_CALLBACK</description></argument>
</function> </function>
<function name="mxmlSaveFile"><returnvalue><description>0 on success, -1 on error.</description><type>int</type></returnvalue> <function name="mxmlSaveFile"><returnvalue><description>0 on success, -1 on error.</description><type>int</type></returnvalue>
<description>Save an XML tree to a file. <description>Save an XML tree to a file.
@ -161,8 +186,9 @@ character or nul (0) before and after each element. If MXML_NO_CALLBACK
is specified, whitespace will only be added before MXML_TEXT nodes is specified, whitespace will only be added before MXML_TEXT nodes
with leading whitespace and before attribute names inside opening with leading whitespace and before attribute names inside opening
element tags.</description><argument element tags.</description><argument
name="(*cb)(mxml_node_t *node, int ws)" direction="I"><type>mxml_node_t *node, name="node" direction="I"><type>mxml_node_t *</type><description>Node to write</description></argument>
FILE *fp, int</type><description>Whitespace callback or MXML_NO_CALLBACK</description></argument> <argument name="fp" direction="I"><type>FILE *</type><description>File to write to</description></argument>
<argument name="(*cb)(mxml_node_t *node, int ws)" direction="I"><type>int</type><description>Whitespace callback or MXML_NO_CALLBACK</description></argument>
</function> </function>
<function name="mxmlSaveString"><returnvalue><description>Size of string</description><type>int</type></returnvalue> <function name="mxmlSaveString"><returnvalue><description>Size of string</description><type>int</type></returnvalue>
<description>Save an XML node tree to a string. <description>Save an XML node tree to a string.
@ -170,46 +196,55 @@ FILE *fp, int</type><description>Whitespace callback or MXML_NO_CALLBACK</descri
This function returns the total number of bytes that would be This function returns the total number of bytes that would be
required for the string but only copies (bufsize - 1) characters required for the string but only copies (bufsize - 1) characters
into the specified buffer.</description><argument into the specified buffer.</description><argument
name="(*cb)(mxml_node_t *node, int ws)" direction="I"><type>mxml_node_t *node, name="node" direction="I"><type>mxml_node_t *</type><description>Node to write</description></argument>
char *buffer, int bufsize, int</type><description>Whitespace callback or MXML_NO_CALLBACK</description></argument> <argument name="buffer" direction="I"><type>char *</type><description>String buffer</description></argument>
<argument name="bufsize" direction="I"><type>int</type><description>Size of string buffer</description></argument>
<argument name="(*cb)(mxml_node_t *node, int ws)" direction="I"><type>int</type><description>Whitespace callback or MXML_NO_CALLBACK</description></argument>
</function> </function>
<function name="mxmlSetElement"><returnvalue><description>0 on success, -1 on failure</description><type>int</type></returnvalue> <function name="mxmlSetElement"><returnvalue><description>0 on success, -1 on failure</description><type>int</type></returnvalue>
<description>Set the name of an element node. <description>Set the name of an element node.
If the node is not changed if it is not an element node.</description><argument The node is not changed if it is not an element node.</description><argument
name="name" direction="I"><type>mxml_node_t *node, const char *</type><description>New name string</description></argument> name="node" direction="I"><type>mxml_node_t *</type><description>Node to set</description></argument>
<argument name="name" direction="I"><type>const char *</type><description>New name string</description></argument>
</function> </function>
<function name="mxmlSetInteger"><returnvalue><description>0 on success, -1 on failure</description><type>int</type></returnvalue> <function name="mxmlSetInteger"><returnvalue><description>0 on success, -1 on failure</description><type>int</type></returnvalue>
<description>Set the value of an integer node. <description>Set the value of an integer node.
If the node is not changed if it is not an integer node.</description><argument The node is not changed if it is not an integer node.</description><argument
name="integer" direction="I"><type>mxml_node_t *node, int</type><description>Integer value</description></argument> name="node" direction="I"><type>mxml_node_t *</type><description>Node to set</description></argument>
<argument name="integer" direction="I"><type>int</type><description>Integer value</description></argument>
</function> </function>
<function name="mxmlSetOpaque"><returnvalue><description>0 on success, -1 on failure</description><type>int</type></returnvalue> <function name="mxmlSetOpaque"><returnvalue><description>0 on success, -1 on failure</description><type>int</type></returnvalue>
<description>Set the value of an opaque node. <description>Set the value of an opaque node.
If the node is not changed if it is not an opaque node.</description><argument The node is not changed if it is not an opaque node.</description><argument
name="opaque" direction="I"><type>mxml_node_t *node, const char *</type><description>Opaque string</description></argument> name="node" direction="I"><type>mxml_node_t *</type><description>Node to set</description></argument>
<argument name="opaque" direction="I"><type>const char *</type><description>Opaque string</description></argument>
</function> </function>
<function name="mxmlSetReal"><returnvalue><description>0 on success, -1 on failure</description><type>int</type></returnvalue> <function name="mxmlSetReal"><returnvalue><description>0 on success, -1 on failure</description><type>int</type></returnvalue>
<description>Set the value of a real number node. <description>Set the value of a real number node.
If the node is not changed if it is not a real number node.</description><argument The node is not changed if it is not a real number node.</description><argument
name="real" direction="I"><type>mxml_node_t *node, double</type><description>Real number value</description></argument> name="node" direction="I"><type>mxml_node_t *</type><description>Node to set</description></argument>
<argument name="real" direction="I"><type>double</type><description>Real number value</description></argument>
</function> </function>
<function name="mxmlSetText"><returnvalue><description>0 on success, -1 on failure</description><type>int</type></returnvalue> <function name="mxmlSetText"><returnvalue><description>0 on success, -1 on failure</description><type>int</type></returnvalue>
<description>Set the value of a text node. <description>Set the value of a text node.
If the node is not changed if it is not a text node.</description><argument The node is not changed if it is not a text node.</description><argument
name="string" direction="I"><type>mxml_node_t *node, int whitespace, const name="node" direction="I"><type>mxml_node_t *</type><description>Node to set</description></argument>
char *</type><description>String</description></argument> <argument name="whitespace" direction="I"><type>int</type><description>1 = leading whitespace, 0 = no whitespace</description></argument>
<argument name="string" direction="I"><type>const char *</type><description>String</description></argument>
</function> </function>
<function name="mxmlSetTextf"><returnvalue><description>0 on success, -1 on failure</description><type>int</type></returnvalue> <function name="mxmlSetTextf"><returnvalue><description>0 on success, -1 on failure</description><type>int</type></returnvalue>
<description>Set the value of a text node to a formatted string. <description>Set the value of a text node to a formatted string.
If the node is not changed if it is not a text node.</description><argument The node is not changed if it is not a text node.</description><argument
name="format," direction="I"><type>mxml_node_t *node, int whitespace, const name="node" direction="I"><type>mxml_node_t *</type><description>Node to set</description></argument>
char *</type><description>Additional arguments as needed</description></argument> <argument name="whitespace" direction="I"><type>int</type><description>1 = leading whitespace, 0 = no whitespace</description></argument>
<argument name="format" direction="I"><type>const char *</type><description>Printf-style format string</description></argument>
<argument name="..." direction="I"><type/><description>Additional arguments as needed</description></argument>
</function> </function>
<function name="mxmlWalkNext"><returnvalue><description>Next node or NULL</description><type>mxml_node_t <function name="mxmlWalkNext"><returnvalue><description>Next node or NULL</description><type>mxml_node_t
*</type></returnvalue> *</type></returnvalue>
@ -218,7 +253,9 @@ char *</type><description>Additional arguments as needed</description></argument
The descend argument controls whether the first child is considered The descend argument controls whether the first child is considered
to be the next node. The top node argument constrains the walk to to be the next node. The top node argument constrains the walk to
the node's children.</description><argument the node's children.</description><argument
name="descend" direction="I"><type>mxml_node_t *node, mxml_node_t *top, int</type><description>Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST</description></argument> name="node" direction="I"><type>mxml_node_t *</type><description>Current node</description></argument>
<argument name="top" direction="I"><type>mxml_node_t *</type><description>Top node</description></argument>
<argument name="descend" direction="I"><type>int</type><description>Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST</description></argument>
</function> </function>
<function name="mxmlWalkPrev"><returnvalue><description>Previous node or NULL</description><type>mxml_node_t <function name="mxmlWalkPrev"><returnvalue><description>Previous node or NULL</description><type>mxml_node_t
*</type></returnvalue> *</type></returnvalue>
@ -227,7 +264,9 @@ name="descend" direction="I"><type>mxml_node_t *node, mxml_node_t *top, int</typ
The descend argument controls whether the previous node's last child The descend argument controls whether the previous node's last child
is considered to be the previous node. The top node argument constrains is considered to be the previous node. The top node argument constrains
the walk to the node's children.</description><argument the walk to the node's children.</description><argument
name="descend" direction="I"><type>mxml_node_t *node, mxml_node_t *top, int</type><description>Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST</description></argument> name="node" direction="I"><type>mxml_node_t *</type><description>Current node</description></argument>
<argument name="top" direction="I"><type>mxml_node_t *</type><description>Top node</description></argument>
<argument name="descend" direction="I"><type>int</type><description>Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST</description></argument>
</function> </function>
<struct name="mxml_attr_s"><description>An XML element attribute value.</description><variable <struct name="mxml_attr_s"><description>An XML element attribute value.</description><variable
name="name"><type>char *</type><description>Attribute name</description></variable> name="name"><type>char *</type><description>Attribute name</description></variable>
@ -237,26 +276,17 @@ name="name"><type>char *</type><description>Attribute name</description></variab
mxml_attr_s</type></typedef> mxml_attr_s</type></typedef>
<typedef name="mxml_element_t"><description>An XML element value.</description><type>struct <typedef name="mxml_element_t"><description>An XML element value.</description><type>struct
mxml_value_s</type></typedef> mxml_value_s</type></typedef>
<struct name="mxml_node_s"><description>Data types...</description><variable <struct name="mxml_node_s"><description>An XML node.</description><variable
name="child"><type>mxml_node_t *</type><description>First child node</description></variable> name="child"><type>struct mxml_node_s *</type><description>First child node</description></variable>
<variable name="last_child"><type>mxml_node_t *</type><description>Last child node</description></variable> <variable name="last_child"><type>struct mxml_node_s *</type><description>Last child node</description></variable>
<variable name="next"><type>mxml_node_t *</type><description>Next node under same parent</description></variable> <variable name="next"><type>struct mxml_node_s *</type><description>Next node under same parent</description></variable>
<variable name="parent"><type>mxml_node_t *</type><description>Parent node</description></variable> <variable name="parent"><type>struct mxml_node_s *</type><description>Parent node</description></variable>
<variable name="prev"><type>mxml_node_t *</type><description>Previous node under same parent</description></variable> <variable name="prev"><type>struct mxml_node_s *</type><description>Previous node under same parent</description></variable>
<variable name="type"><type>mxml_type_t</type><description>Node type</description></variable> <variable name="type"><type>mxml_type_t</type><description>Node type</description></variable>
<variable name="value"><type>mxml_value_t</type><description>Node value</description></variable> <variable name="value"><type>mxml_value_t</type><description>Node value</description></variable>
</struct> </struct>
<typedef name="mxml_node_t"><type>struct mxml_node_s</type><description>An XML node.</description><description>An XML node.</description></typedef> <typedef name="mxml_node_t"><description>An XML node.</description><type>struct
<function name="mxml_strdup"><returnvalue><description>New string pointer</description><type>char mxml_node_s</type></typedef>
*</type></returnvalue>
<description>Duplicate a string.</description><argument name="s"
direction="I"><type>const char *</type><description>String to duplicate</description></argument>
</function>
<function name="mxml_strdupf"><returnvalue><description>New string pointer</description><type>char
*</type></returnvalue>
<description>Format and duplicate a string.</description><argument
name="ap" direction="I"><type>const char *format, va_list</type><description>Pointer to additional arguments</description></argument>
</function>
<struct name="mxml_text_s"><description>An XML text value.</description><variable <struct name="mxml_text_s"><description>An XML text value.</description><variable
name="string"><type>char *</type><description>Fragment string</description></variable> name="string"><type>char *</type><description>Fragment string</description></variable>
<variable name="whitespace"><type>int</type><description>Leading whitespace?</description></variable> <variable name="whitespace"><type>int</type><description>Leading whitespace?</description></variable>
@ -285,8 +315,4 @@ name="element"><type>mxml_element_t</type><description>Element</description></va
<variable name="opaque"><type>char *</type><description>Opaque string</description></variable> <variable name="opaque"><type>char *</type><description>Opaque string</description></variable>
<variable name="real"><type>double</type><description>Real number</description></variable> <variable name="real"><type>double</type><description>Real number</description></variable>
<variable name="text"><type>mxml_text_t</type><description>Text fragment</description></variable> <variable name="text"><type>mxml_text_t</type><description>Text fragment</description></variable>
</union><function name="mxml_vsnprintf"><returnvalue><description>Number of bytes formatted</description><type>int</type></returnvalue> </union>
<description>Format a string into a fixed size buffer.</description><argument
name="ap" direction="I"><type>char *buffer, size_t bufsize, const char *format,
va_list</type><description>Pointer to additional arguments</description></argument>
</function>

@ -1,5 +1,5 @@
/* /*
* "$Id: mxmldoc.c,v 1.16 2003/07/27 23:11:40 mike Exp $" * "$Id: mxmldoc.c,v 1.17 2003/09/28 21:09:04 mike Exp $"
* *
* Documentation generator using mini-XML, a small XML-like file parsing * Documentation generator using mini-XML, a small XML-like file parsing
* library. * library.
@ -673,7 +673,7 @@ scan_file(const char *filename, /* I - Filename */
break; break;
default : /* Other */ default : /* Other */
if (isalpha(ch) || ch == '_') if (isalpha(ch) || ch == '_' || ch == '.')
{ {
state = STATE_IDENTIFIER; state = STATE_IDENTIFIER;
bufptr = buffer; bufptr = buffer;
@ -961,8 +961,8 @@ scan_file(const char *filename, /* I - Filename */
break; break;
case STATE_IDENTIFIER : /* Inside a keyword or identifier */ case STATE_IDENTIFIER : /* Inside a keyword or identifier */
if (isalnum(ch) || ch == '_' || ch == '[' || ch == ']' || ch == ':' || if (isalnum(ch) || ch == '_' || ch == '[' || ch == ']' ||
(parens && ch == ',')) (ch == ',' && parens > 1) || ch == ':' || ch == '.')
{ {
if (bufptr < (buffer + sizeof(buffer) - 1)) if (bufptr < (buffer + sizeof(buffer) - 1))
*bufptr++ = ch; *bufptr++ = ch;
@ -1376,7 +1376,8 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */
mxml_node_t *function, /* Current function */ mxml_node_t *function, /* Current function */
*scut, /* Struct/class/union/typedef */ *scut, /* Struct/class/union/typedef */
*arg, /* Current argument */ *arg, /* Current argument */
*description; /* Description of function/var */ *description, /* Description of function/var */
*type; /* Type for argument */
const char *name; /* Name of function/type */ const char *name; /* Name of function/type */
char prefix; /* Prefix character */ char prefix; /* Prefix character */
@ -1427,6 +1428,7 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */
if (mxmlFindElement(doc, doc, "class", NULL, NULL, MXML_DESCEND_FIRST)) if (mxmlFindElement(doc, doc, "class", NULL, NULL, MXML_DESCEND_FIRST))
{ {
puts("<hr noshade/>");
puts("<h1><a name=\"_classes\">Classes</a></h1>"); puts("<h1><a name=\"_classes\">Classes</a></h1>");
puts("<ul>"); puts("<ul>");
@ -1449,7 +1451,6 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */
MXML_NO_DESCEND)) MXML_NO_DESCEND))
{ {
name = mxmlElementGetAttr(scut, "name"); name = mxmlElementGetAttr(scut, "name");
puts("<hr noshade/>");
printf("<h2><a name=\"%s\">%s</a></h2>\n", name, name); printf("<h2><a name=\"%s\">%s</a></h2>\n", name, name);
description = mxmlFindElement(scut, scut, "description", NULL, description = mxmlFindElement(scut, scut, "description", NULL,
@ -1509,6 +1510,7 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */
if (mxmlFindElement(doc, doc, "enumeration", NULL, NULL, MXML_DESCEND_FIRST)) if (mxmlFindElement(doc, doc, "enumeration", NULL, NULL, MXML_DESCEND_FIRST))
{ {
puts("<hr noshade/>");
puts("<h1><a name=\"_enumerations\">Enumerations</a></h1>"); puts("<h1><a name=\"_enumerations\">Enumerations</a></h1>");
puts("<ul>"); puts("<ul>");
@ -1531,7 +1533,6 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */
MXML_NO_DESCEND)) MXML_NO_DESCEND))
{ {
name = mxmlElementGetAttr(scut, "name"); name = mxmlElementGetAttr(scut, "name");
puts("<hr noshade/>");
printf("<h2><a name=\"%s\">%s</a></h2>\n", name, name); printf("<h2><a name=\"%s\">%s</a></h2>\n", name, name);
description = mxmlFindElement(scut, scut, "description", NULL, description = mxmlFindElement(scut, scut, "description", NULL,
@ -1573,6 +1574,7 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */
if (mxmlFindElement(doc, doc, "function", NULL, NULL, MXML_DESCEND_FIRST)) if (mxmlFindElement(doc, doc, "function", NULL, NULL, MXML_DESCEND_FIRST))
{ {
puts("<hr noshade/>");
puts("<h1><a name=\"_functions\">Functions</a></h1>"); puts("<h1><a name=\"_functions\">Functions</a></h1>");
puts("<ul>"); puts("<ul>");
@ -1595,7 +1597,6 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */
MXML_NO_DESCEND)) MXML_NO_DESCEND))
{ {
name = mxmlElementGetAttr(function, "name"); name = mxmlElementGetAttr(function, "name");
puts("<hr noshade/>");
printf("<h2><a name=\"%s\">%s()</a></h2>\n", name, name); printf("<h2><a name=\"%s\">%s()</a></h2>\n", name, name);
description = mxmlFindElement(function, function, "description", NULL, description = mxmlFindElement(function, function, "description", NULL,
@ -1626,10 +1627,12 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */
arg = mxmlFindElement(arg, function, "argument", NULL, NULL, arg = mxmlFindElement(arg, function, "argument", NULL, NULL,
MXML_NO_DESCEND), prefix = ',') MXML_NO_DESCEND), prefix = ',')
{ {
type = mxmlFindElement(arg, arg, "type", NULL, NULL,
MXML_DESCEND_FIRST);
printf("%c\n ", prefix); printf("%c\n ", prefix);
write_element(doc, mxmlFindElement(arg, arg, "type", NULL, write_element(doc, type);
NULL, MXML_DESCEND_FIRST)); printf("%s%s", type->child ? " " : "", mxmlElementGetAttr(arg, "name"));
printf(" %s", mxmlElementGetAttr(arg, "name"));
} }
if (prefix == '(') if (prefix == '(')
@ -1687,6 +1690,7 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */
if (mxmlFindElement(doc, doc, "struct", NULL, NULL, MXML_DESCEND_FIRST)) if (mxmlFindElement(doc, doc, "struct", NULL, NULL, MXML_DESCEND_FIRST))
{ {
puts("<hr noshade/>");
puts("<h1><a name=\"_structures\">Structures</a></h1>"); puts("<h1><a name=\"_structures\">Structures</a></h1>");
puts("<ul>"); puts("<ul>");
@ -1709,7 +1713,6 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */
MXML_NO_DESCEND)) MXML_NO_DESCEND))
{ {
name = mxmlElementGetAttr(scut, "name"); name = mxmlElementGetAttr(scut, "name");
puts("<hr noshade/>");
printf("<h2><a name=\"%s\">%s</a></h2>\n", name, name); printf("<h2><a name=\"%s\">%s</a></h2>\n", name, name);
description = mxmlFindElement(scut, scut, "description", NULL, description = mxmlFindElement(scut, scut, "description", NULL,
@ -1769,6 +1772,7 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */
if (mxmlFindElement(doc, doc, "typedef", NULL, NULL, MXML_DESCEND_FIRST)) if (mxmlFindElement(doc, doc, "typedef", NULL, NULL, MXML_DESCEND_FIRST))
{ {
puts("<hr noshade/>");
puts("<h1><a name=\"_types\">Types</a></h1>"); puts("<h1><a name=\"_types\">Types</a></h1>");
puts("<ul>"); puts("<ul>");
@ -1791,7 +1795,6 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */
MXML_NO_DESCEND)) MXML_NO_DESCEND))
{ {
name = mxmlElementGetAttr(scut, "name"); name = mxmlElementGetAttr(scut, "name");
puts("<hr noshade/>");
printf("<h2><a name=\"%s\">%s</a></h2>\n", name, name); printf("<h2><a name=\"%s\">%s</a></h2>\n", name, name);
description = mxmlFindElement(scut, scut, "description", NULL, description = mxmlFindElement(scut, scut, "description", NULL,
@ -1819,6 +1822,7 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */
if (mxmlFindElement(doc, doc, "union", NULL, NULL, MXML_DESCEND_FIRST)) if (mxmlFindElement(doc, doc, "union", NULL, NULL, MXML_DESCEND_FIRST))
{ {
puts("<hr noshade/>");
puts("<h1><a name=\"_unions\">Unions</a></h1>"); puts("<h1><a name=\"_unions\">Unions</a></h1>");
puts("<ul>"); puts("<ul>");
@ -1841,7 +1845,6 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */
MXML_NO_DESCEND)) MXML_NO_DESCEND))
{ {
name = mxmlElementGetAttr(scut, "name"); name = mxmlElementGetAttr(scut, "name");
puts("<hr noshade/>");
printf("<h2><a name=\"%s\">%s</a></h2>\n", name, name); printf("<h2><a name=\"%s\">%s</a></h2>\n", name, name);
description = mxmlFindElement(scut, scut, "description", NULL, description = mxmlFindElement(scut, scut, "description", NULL,
@ -1901,6 +1904,7 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */
if (mxmlFindElement(doc, doc, "variable", NULL, NULL, MXML_DESCEND_FIRST)) if (mxmlFindElement(doc, doc, "variable", NULL, NULL, MXML_DESCEND_FIRST))
{ {
puts("<hr noshade/>");
puts("<h1><a name=\"_variables\">Variables</a></h1>"); puts("<h1><a name=\"_variables\">Variables</a></h1>");
puts("<ul>"); puts("<ul>");
@ -1923,7 +1927,6 @@ write_documentation(mxml_node_t *doc) /* I - XML documentation */
MXML_NO_DESCEND)) MXML_NO_DESCEND))
{ {
name = mxmlElementGetAttr(arg, "name"); name = mxmlElementGetAttr(arg, "name");
puts("<hr noshade/>");
printf("<h2><a name=\"%s\">%s</a></h2>\n", name, name); printf("<h2><a name=\"%s\">%s</a></h2>\n", name, name);
description = mxmlFindElement(arg, arg, "description", NULL, description = mxmlFindElement(arg, arg, "description", NULL,
@ -1966,9 +1969,12 @@ write_element(mxml_node_t *doc, /* I - Document tree */
mxml_node_t *node; /* Current node */ mxml_node_t *node; /* Current node */
for (node = mxmlWalkNext(element, element, MXML_DESCEND); if (!element)
return;
for (node = element->child;
node; node;
node = mxmlWalkNext(node, element, MXML_DESCEND)) node = mxmlWalkNext(node, element, MXML_NO_DESCEND))
if (node->type == MXML_TEXT) if (node->type == MXML_TEXT)
{ {
if (node->value.text.whitespace) if (node->value.text.whitespace)
@ -2081,5 +2087,5 @@ ws_cb(mxml_node_t *node, /* I - Element node */
/* /*
* End of "$Id: mxmldoc.c,v 1.16 2003/07/27 23:11:40 mike Exp $". * End of "$Id: mxmldoc.c,v 1.17 2003/09/28 21:09:04 mike Exp $".
*/ */

Loading…
Cancel
Save