mirror of
https://github.com/michaelrsweet/mxml.git
synced 2024-11-13 07:15:30 +00:00
Implemment getters for all of mxml_node_t and mxml_index_t fields (STR #118)
Make mxml_node_s and mxml_index_s private (but still in the public header for 2.x).
This commit is contained in:
parent
1a660a57d4
commit
a9012172c1
5
CHANGES
5
CHANGES
@ -1,8 +1,11 @@
|
||||
CHANGES - 2010-11-08
|
||||
CHANGES - 2011-01-01
|
||||
--------------------
|
||||
|
||||
CHANGES IN Mini-XML 2.7
|
||||
|
||||
- Added data accessor ("get") functions and made the mxml_node_t and
|
||||
mxml_index_t structures private but still available in the Mini-XML
|
||||
header to preserve source compatibility (STR #118)
|
||||
- Updated the source headers to reference the Mini-XML license and its
|
||||
exceptions to the LGPL2 (STR #108)
|
||||
- Added a new mxmlFindValue() function to find the value node of a
|
||||
|
@ -82,8 +82,8 @@ DOCFILES = doc/0.gif doc/1.gif doc/2.gif doc/3.gif doc/4.gif \
|
||||
doc/A.gif doc/B.gif doc/C.gif doc/D.gif \
|
||||
doc/mxml.html doc/mxmldoc.xsd \
|
||||
README COPYING CHANGES
|
||||
PUBLIBOBJS = mxml-attr.o mxml-entity.o mxml-file.o mxml-index.o \
|
||||
mxml-node.o mxml-search.o mxml-set.o
|
||||
PUBLIBOBJS = mxml-attr.o mxml-entity.o mxml-file.o mxml-get.o \
|
||||
mxml-index.o mxml-node.o mxml-search.o mxml-set.o
|
||||
LIBOBJS = $(PUBLIBOBJS) mxml-private.o mxml-string.o
|
||||
OBJS = mxmldoc.o testmxml.o $(LIBOBJS)
|
||||
TARGETS = $(LIBMXML) mxmldoc testmxml mxml.xml doc/mxml.man
|
||||
|
@ -1,7 +1,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Mini-XML Programmers Manual, Version 2.7</title>
|
||||
<meta name="copyright" content="Copyright 2003-2010">
|
||||
<meta name="copyright" content="Copyright 2003-2011">
|
||||
<meta name="author" content="Michael R. Sweet">
|
||||
<meta name="keywords" content="XML, C, C++, library">
|
||||
</head>
|
||||
@ -188,7 +188,7 @@ manual:</p>
|
||||
<!-- NEED 6 -->
|
||||
<h2>Legal Stuff</h2>
|
||||
|
||||
<p>The Mini-XML library is copyright 2003-2010 by Michael Sweet. License terms
|
||||
<p>The Mini-XML library is copyright 2003-2011 by Michael Sweet. License terms
|
||||
are described in <a href="#LICENSE">Appendix A - Mini-XML License</a>.</p>
|
||||
|
||||
</body>
|
||||
|
706
doc/mxml.html
706
doc/mxml.html
File diff suppressed because it is too large
Load Diff
@ -156,9 +156,25 @@ Reference</h1>
|
||||
<li><a href="#mxmlEntityRemoveCallback" title="Remove a callback.">mxmlEntityRemoveCallback</a></li>
|
||||
<li><a href="#mxmlFindElement" title="Find the named element.">mxmlFindElement</a></li>
|
||||
<li><a href="#mxmlFindValue" title="Find a value with the given path.">mxmlFindValue</a></li>
|
||||
<li><a href="#mxmlGetCDATA" title="Get the value for a CDATA node.">mxmlGetCDATA</a></li>
|
||||
<li><a href="#mxmlGetCustom" title="Get the value for a custom node.">mxmlGetCustom</a></li>
|
||||
<li><a href="#mxmlGetElement" title="Get the name for an element node.">mxmlGetElement</a></li>
|
||||
<li><a href="#mxmlGetFirstChild" title="Get the first child of an element node.">mxmlGetFirstChild</a></li>
|
||||
<li><a href="#mxmlGetInteger" title="Get the integer value from the specified node or its
|
||||
first child.">mxmlGetInteger</a></li>
|
||||
<li><a href="#mxmlGetLastChild" title="Get the last child of an element node.">mxmlGetLastChild</a></li>
|
||||
<li><a href="#mxmlGetNext" title="Return the node type...">mxmlGetNext</a></li>
|
||||
<li><a href="#mxmlGetOpaque" title="Get an opaque string value for a node or its first child.">mxmlGetOpaque</a></li>
|
||||
<li><a href="#mxmlGetParent" title="Get the parent node.">mxmlGetParent</a></li>
|
||||
<li><a href="#mxmlGetPrevious" title="Get the previous node for the current parent.">mxmlGetPrevious</a></li>
|
||||
<li><a href="#mxmlGetReal" title="Get the real value for a node or its first child.">mxmlGetReal</a></li>
|
||||
<li><a href="#mxmlGetText" title="Get the text value for a node or its first child.">mxmlGetText</a></li>
|
||||
<li><a href="#mxmlGetType" title="Get the node type.">mxmlGetType</a></li>
|
||||
<li><a href="#mxmlGetUserData" title="Get the user data pointer for a node.">mxmlGetUserData</a></li>
|
||||
<li><a href="#mxmlIndexDelete" title="Delete an index.">mxmlIndexDelete</a></li>
|
||||
<li><a href="#mxmlIndexEnum" title="Return the next node in the index.">mxmlIndexEnum</a></li>
|
||||
<li><a href="#mxmlIndexFind" title="Find the next matching node.">mxmlIndexFind</a></li>
|
||||
<li><a href="#mxmlIndexGetCount" title="Get the number of nodes in an index.">mxmlIndexGetCount</a></li>
|
||||
<li><a href="#mxmlIndexNew" title="Create a new index.">mxmlIndexNew</a></li>
|
||||
<li><a href="#mxmlIndexReset" title="Reset the enumeration/find pointer in the index and
|
||||
return the first node in the index.">mxmlIndexReset</a></li>
|
||||
@ -197,17 +213,15 @@ using a SAX callback.">mxmlSAXLoadString</a></li>
|
||||
<li><a href="#mxmlSetReal" title="Set the value of a real number node.">mxmlSetReal</a></li>
|
||||
<li><a href="#mxmlSetText" title="Set the value of a text node.">mxmlSetText</a></li>
|
||||
<li><a href="#mxmlSetTextf" title="Set the value of a text node to a formatted string.">mxmlSetTextf</a></li>
|
||||
<li><a href="#mxmlSetUserData" title="Set the user data pointer for a node.">mxmlSetUserData</a></li>
|
||||
<li><a href="#mxmlSetWrapMargin" title="Set the wrap margin when saving XML data.">mxmlSetWrapMargin</a></li>
|
||||
<li><a href="#mxmlWalkNext" title="Walk to the next logical node in the tree.">mxmlWalkNext</a></li>
|
||||
<li><a href="#mxmlWalkPrev" title="Walk to the previous logical node in the tree.">mxmlWalkPrev</a></li>
|
||||
</ul></li>
|
||||
<li><a href="#TYPES">Data Types</a><ul class="code">
|
||||
<li><a href="#mxml_attr_t" title="An XML element attribute value.">mxml_attr_t</a></li>
|
||||
<li><a href="#mxml_custom_destroy_cb_t" title="Custom data destructor">mxml_custom_destroy_cb_t</a></li>
|
||||
<li><a href="#mxml_custom_load_cb_t" title="Custom data load callback function">mxml_custom_load_cb_t</a></li>
|
||||
<li><a href="#mxml_custom_save_cb_t" title="Custom data save callback function">mxml_custom_save_cb_t</a></li>
|
||||
<li><a href="#mxml_custom_t" title="An XML custom value. ">mxml_custom_t</a></li>
|
||||
<li><a href="#mxml_element_t" title="An XML element value.">mxml_element_t</a></li>
|
||||
<li><a href="#mxml_entity_cb_t" title="Entity callback function">mxml_entity_cb_t</a></li>
|
||||
<li><a href="#mxml_error_cb_t" title="Error callback function">mxml_error_cb_t</a></li>
|
||||
<li><a href="#mxml_index_t" title="An XML node index.">mxml_index_t</a></li>
|
||||
@ -216,20 +230,7 @@ using a SAX callback.">mxmlSAXLoadString</a></li>
|
||||
<li><a href="#mxml_save_cb_t" title="Save callback function">mxml_save_cb_t</a></li>
|
||||
<li><a href="#mxml_sax_cb_t" title="SAX callback function">mxml_sax_cb_t</a></li>
|
||||
<li><a href="#mxml_sax_event_t" title="SAX event type.">mxml_sax_event_t</a></li>
|
||||
<li><a href="#mxml_text_t" title="An XML text value.">mxml_text_t</a></li>
|
||||
<li><a href="#mxml_type_t" title="The XML node type.">mxml_type_t</a></li>
|
||||
<li><a href="#mxml_value_t" title="An XML node value.">mxml_value_t</a></li>
|
||||
</ul></li>
|
||||
<li><a href="#STRUCTURES">Structures</a><ul class="code">
|
||||
<li><a href="#mxml_attr_s" title="An XML element attribute value.">mxml_attr_s</a></li>
|
||||
<li><a href="#mxml_custom_s" title="An XML custom value. ">mxml_custom_s</a></li>
|
||||
<li><a href="#mxml_element_s" title="An XML element value.">mxml_element_s</a></li>
|
||||
<li><a href="#mxml_index_s" title="An XML node index.">mxml_index_s</a></li>
|
||||
<li><a href="#mxml_node_s" title="An XML node.">mxml_node_s</a></li>
|
||||
<li><a href="#mxml_text_s" title="An XML text value.">mxml_text_s</a></li>
|
||||
</ul></li>
|
||||
<li><a href="#UNIONS">Unions</a><ul class="code">
|
||||
<li><a href="#mxml_value_u" title="An XML node value.">mxml_value_u</a></li>
|
||||
</ul></li>
|
||||
<li><a href="#ENUMERATIONS">Constants</a><ul class="code">
|
||||
<li><a href="#mxml_sax_event_e" title="SAX event type.">mxml_sax_event_e</a></li>
|
||||
@ -473,6 +474,248 @@ considered a wildcard for one or more levels of elements. For example,
|
||||
"foo/one/two", "bar/two/one", "*/one", and so forth.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a name="mxmlGetCDATA">mxmlGetCDATA</a></h3>
|
||||
<p class="description">Get the value for a CDATA node.</p>
|
||||
<p class="code">
|
||||
char *mxmlGetCDATA (<br>
|
||||
<a href="#mxml_node_t">mxml_node_t</a> *node<br>
|
||||
);</p>
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>node</dt>
|
||||
<dd class="description">Node to get</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">CDATA value or NULL</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion"><code>NULL</code> is returned if the node is not a CDATA element.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a name="mxmlGetCustom">mxmlGetCustom</a></h3>
|
||||
<p class="description">Get the value for a custom node.</p>
|
||||
<p class="code">
|
||||
void *mxmlGetCustom (<br>
|
||||
<a href="#mxml_node_t">mxml_node_t</a> *node<br>
|
||||
);</p>
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>node</dt>
|
||||
<dd class="description">Node to get</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Custom value or NULL</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion"><code>NULL</code> is returned if the node (or its first child) is not a custom
|
||||
value node.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a name="mxmlGetElement">mxmlGetElement</a></h3>
|
||||
<p class="description">Get the name for an element node.</p>
|
||||
<p class="code">
|
||||
char *mxmlGetElement (<br>
|
||||
<a href="#mxml_node_t">mxml_node_t</a> *node<br>
|
||||
);</p>
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>node</dt>
|
||||
<dd class="description">Node to get</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Element name or NULL</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion"><code>NULL</code> is returned if the node is not an element node.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a name="mxmlGetFirstChild">mxmlGetFirstChild</a></h3>
|
||||
<p class="description">Get the first child of an element node.</p>
|
||||
<p class="code">
|
||||
<a href="#mxml_node_t">mxml_node_t</a> *mxmlGetFirstChild (<br>
|
||||
<a href="#mxml_node_t">mxml_node_t</a> *node<br>
|
||||
);</p>
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>node</dt>
|
||||
<dd class="description">Node to get</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">First child or NULL</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion"><code>NULL</code> is returned if the node is not an element node or if the node
|
||||
has no children.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a name="mxmlGetInteger">mxmlGetInteger</a></h3>
|
||||
<p class="description">Get the integer value from the specified node or its
|
||||
first child.</p>
|
||||
<p class="code">
|
||||
int mxmlGetInteger (<br>
|
||||
<a href="#mxml_node_t">mxml_node_t</a> *node<br>
|
||||
);</p>
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>node</dt>
|
||||
<dd class="description">Node to get</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Integer value or 0</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">0 is returned if the node (or its first child) is not an integer value node.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a name="mxmlGetLastChild">mxmlGetLastChild</a></h3>
|
||||
<p class="description">Get the last child of an element node.</p>
|
||||
<p class="code">
|
||||
<a href="#mxml_node_t">mxml_node_t</a> *mxmlGetLastChild (<br>
|
||||
<a href="#mxml_node_t">mxml_node_t</a> *node<br>
|
||||
);</p>
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>node</dt>
|
||||
<dd class="description">Node to get</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Last child or NULL</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion"><code>NULL</code> is returned if the node is not an element node or if the node
|
||||
has no children.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><a name="mxmlGetNext">mxmlGetNext</a></h3>
|
||||
<p class="description">Return the node type...</p>
|
||||
<p class="code">
|
||||
<a href="#mxml_node_t">mxml_node_t</a> *mxmlGetNext (<br>
|
||||
<a href="#mxml_node_t">mxml_node_t</a> *node<br>
|
||||
);</p>
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>node</dt>
|
||||
<dd class="description">Node to get</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Get the next node for the current parent.</p>
|
||||
<p class="discussion"><code>NULL</code> is returned if this is the last child for the current parent.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a name="mxmlGetOpaque">mxmlGetOpaque</a></h3>
|
||||
<p class="description">Get an opaque string value for a node or its first child.</p>
|
||||
<p class="code">
|
||||
char *mxmlGetOpaque (<br>
|
||||
<a href="#mxml_node_t">mxml_node_t</a> *node<br>
|
||||
);</p>
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>node</dt>
|
||||
<dd class="description">Node to get</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Opaque string or NULL</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion"><code>NULL</code> is returned if the node (or its first child) is not an opaque
|
||||
value node.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a name="mxmlGetParent">mxmlGetParent</a></h3>
|
||||
<p class="description">Get the parent node.</p>
|
||||
<p class="code">
|
||||
<a href="#mxml_node_t">mxml_node_t</a> *mxmlGetParent (<br>
|
||||
<a href="#mxml_node_t">mxml_node_t</a> *node<br>
|
||||
);</p>
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>node</dt>
|
||||
<dd class="description">Node to get</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Parent node or NULL</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion"><code>NULL</code> is returned for a root node.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a name="mxmlGetPrevious">mxmlGetPrevious</a></h3>
|
||||
<p class="description">Get the previous node for the current parent.</p>
|
||||
<p class="code">
|
||||
<a href="#mxml_node_t">mxml_node_t</a> *mxmlGetPrevious (<br>
|
||||
<a href="#mxml_node_t">mxml_node_t</a> *node<br>
|
||||
);</p>
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>node</dt>
|
||||
<dd class="description">Node to get</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Previous node or NULL</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion"><code>NULL</code> is returned if this is the first child for the current parent.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a name="mxmlGetReal">mxmlGetReal</a></h3>
|
||||
<p class="description">Get the real value for a node or its first child.</p>
|
||||
<p class="code">
|
||||
double mxmlGetReal (<br>
|
||||
<a href="#mxml_node_t">mxml_node_t</a> *node<br>
|
||||
);</p>
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>node</dt>
|
||||
<dd class="description">Node to get</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Real value or 0.0</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">0.0 is returned if the node (or its first child) is not a real value node.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a name="mxmlGetText">mxmlGetText</a></h3>
|
||||
<p class="description">Get the text value for a node or its first child.</p>
|
||||
<p class="code">
|
||||
char *mxmlGetText (<br>
|
||||
<a href="#mxml_node_t">mxml_node_t</a> *node,<br>
|
||||
int *whitespace<br>
|
||||
);</p>
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>node</dt>
|
||||
<dd class="description">Node to get</dd>
|
||||
<dt>whitespace</dt>
|
||||
<dd class="description">1 if string is preceded by whitespace, 0 otherwise</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Text string or NULL</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion"><code>NULL</code> is returned if the node (or its first child) is not a text node.
|
||||
The "whitespace" argument can be NULL.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a name="mxmlGetType">mxmlGetType</a></h3>
|
||||
<p class="description">Get the node type.</p>
|
||||
<p class="code">
|
||||
<a href="#mxml_type_t">mxml_type_t</a> mxmlGetType (<br>
|
||||
<a href="#mxml_node_t">mxml_node_t</a> *node<br>
|
||||
);</p>
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>node</dt>
|
||||
<dd class="description">Node to get</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Type of node</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion"><code>MXML_IGNORE</code> is returned if "node" is <code>NULL</code>.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a name="mxmlGetUserData">mxmlGetUserData</a></h3>
|
||||
<p class="description">Get the user data pointer for a node.</p>
|
||||
<p class="code">
|
||||
void *mxmlGetUserData (<br>
|
||||
<a href="#mxml_node_t">mxml_node_t</a> *node<br>
|
||||
);</p>
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>node</dt>
|
||||
<dd class="description">Node to get</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">User data pointer</p>
|
||||
<h3 class="function"><a name="mxmlIndexDelete">mxmlIndexDelete</a></h3>
|
||||
<p class="description">Delete an index.</p>
|
||||
<p class="code">
|
||||
@ -523,6 +766,19 @@ void mxmlIndexDelete (<br>
|
||||
the first time with a particular set of "element" and "value"
|
||||
strings. Passing NULL for both "element" and "value" is equivalent
|
||||
to calling mxmlIndexEnum().</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a name="mxmlIndexGetCount">mxmlIndexGetCount</a></h3>
|
||||
<p class="description">Get the number of nodes in an index.</p>
|
||||
<p class="code">
|
||||
int mxmlIndexGetCount (<br>
|
||||
<a href="#mxml_index_t">mxml_index_t</a> *ind<br>
|
||||
);</p>
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>ind</dt>
|
||||
<dd class="description">Index of nodes</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Number of nodes in index</p>
|
||||
<h3 class="function"><a name="mxmlIndexNew">mxmlIndexNew</a></h3>
|
||||
<p class="description">Create a new index.</p>
|
||||
<p class="code">
|
||||
@ -1331,6 +1587,22 @@ int mxmlSetTextf (<br>
|
||||
<p class="description">0 on success, -1 on failure</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">The node is not changed if it is not a text node.</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.7 </span><a name="mxmlSetUserData">mxmlSetUserData</a></h3>
|
||||
<p class="description">Set the user data pointer for a node.</p>
|
||||
<p class="code">
|
||||
int mxmlSetUserData (<br>
|
||||
<a href="#mxml_node_t">mxml_node_t</a> *node,<br>
|
||||
void *data<br>
|
||||
);</p>
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
<dl>
|
||||
<dt>node</dt>
|
||||
<dd class="description">Node to set</dd>
|
||||
<dt>data</dt>
|
||||
<dd class="description">User data pointer</dd>
|
||||
</dl>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">0 on success, -1 on failure</p>
|
||||
<h3 class="function"><span class="info"> Mini-XML 2.3 </span><a name="mxmlSetWrapMargin">mxmlSetWrapMargin</a></h3>
|
||||
<p class="description">Set the wrap margin when saving XML data.</p>
|
||||
<p class="code">
|
||||
@ -1393,11 +1665,6 @@ the node's children.</p>
|
||||
is considered to be the previous node. The top node argument constrains
|
||||
the walk to the node's children.</p>
|
||||
<h2 class="title"><a name="TYPES">Data Types</a></h2>
|
||||
<h3 class="typedef"><a name="mxml_attr_t">mxml_attr_t</a></h3>
|
||||
<p class="description">An XML element attribute value.</p>
|
||||
<p class="code">
|
||||
typedef struct <a href="#mxml_attr_s">mxml_attr_s</a> mxml_attr_t;
|
||||
</p>
|
||||
<h3 class="typedef"><a name="mxml_custom_destroy_cb_t">mxml_custom_destroy_cb_t</a></h3>
|
||||
<p class="description">Custom data destructor</p>
|
||||
<p class="code">
|
||||
@ -1413,16 +1680,6 @@ typedef int (*mxml_custom_load_cb_t)(<a href="#mxml_node_t">mxml_node_t</a> *, c
|
||||
<p class="code">
|
||||
typedef char *(*mxml_custom_save_cb_t)(<a href="#mxml_node_t">mxml_node_t</a> *);
|
||||
</p>
|
||||
<h3 class="typedef"><span class="info"> Mini-XML 2.1 </span><a name="mxml_custom_t">mxml_custom_t</a></h3>
|
||||
<p class="description">An XML custom value. </p>
|
||||
<p class="code">
|
||||
typedef struct <a href="#mxml_custom_s">mxml_custom_s</a> mxml_custom_t;
|
||||
</p>
|
||||
<h3 class="typedef"><a name="mxml_element_t">mxml_element_t</a></h3>
|
||||
<p class="description">An XML element value.</p>
|
||||
<p class="code">
|
||||
typedef struct <a href="#mxml_element_s">mxml_element_s</a> mxml_element_t;
|
||||
</p>
|
||||
<h3 class="typedef"><a name="mxml_entity_cb_t">mxml_entity_cb_t</a></h3>
|
||||
<p class="description">Entity callback function</p>
|
||||
<p class="code">
|
||||
@ -1463,159 +1720,11 @@ typedef void (*mxml_sax_cb_t)(<a href="#mxml_node_t">mxml_node_t</a> *, mxml_sax
|
||||
<p class="code">
|
||||
typedef enum <a href="#mxml_sax_event_e">mxml_sax_event_e</a> mxml_sax_event_t;
|
||||
</p>
|
||||
<h3 class="typedef"><a name="mxml_text_t">mxml_text_t</a></h3>
|
||||
<p class="description">An XML text value.</p>
|
||||
<p class="code">
|
||||
typedef struct <a href="#mxml_text_s">mxml_text_s</a> mxml_text_t;
|
||||
</p>
|
||||
<h3 class="typedef"><a name="mxml_type_t">mxml_type_t</a></h3>
|
||||
<p class="description">The XML node type.</p>
|
||||
<p class="code">
|
||||
typedef enum <a href="#mxml_type_e">mxml_type_e</a> mxml_type_t;
|
||||
</p>
|
||||
<h3 class="typedef"><a name="mxml_value_t">mxml_value_t</a></h3>
|
||||
<p class="description">An XML node value.</p>
|
||||
<p class="code">
|
||||
typedef union <a href="#mxml_value_u">mxml_value_u</a> mxml_value_t;
|
||||
</p>
|
||||
<h2 class="title"><a name="STRUCTURES">Structures</a></h2>
|
||||
<h3 class="struct"><a name="mxml_attr_s">mxml_attr_s</a></h3>
|
||||
<p class="description">An XML element attribute value.</p>
|
||||
<p class="code">struct mxml_attr_s {<br>
|
||||
char *name;<br>
|
||||
char *value;<br>
|
||||
};</p>
|
||||
<h4 class="members">Members</h4>
|
||||
<dl>
|
||||
<dt>name </dt>
|
||||
<dd class="description">Attribute name</dd>
|
||||
<dt>value </dt>
|
||||
<dd class="description">Attribute value</dd>
|
||||
</dl>
|
||||
<h3 class="struct"><span class="info"> Mini-XML 2.1 </span><a name="mxml_custom_s">mxml_custom_s</a></h3>
|
||||
<p class="description">An XML custom value. </p>
|
||||
<p class="code">struct mxml_custom_s {<br>
|
||||
void *data;<br>
|
||||
<a href="#mxml_custom_destroy_cb_t">mxml_custom_destroy_cb_t</a> destroy;<br>
|
||||
};</p>
|
||||
<h4 class="members">Members</h4>
|
||||
<dl>
|
||||
<dt>data </dt>
|
||||
<dd class="description">Pointer to (allocated) custom data</dd>
|
||||
<dt>destroy </dt>
|
||||
<dd class="description">Pointer to destructor function</dd>
|
||||
</dl>
|
||||
<h3 class="struct"><a name="mxml_element_s">mxml_element_s</a></h3>
|
||||
<p class="description">An XML element value.</p>
|
||||
<p class="code">struct mxml_element_s {<br>
|
||||
<a href="#mxml_attr_t">mxml_attr_t</a> *attrs;<br>
|
||||
char *name;<br>
|
||||
int num_attrs;<br>
|
||||
};</p>
|
||||
<h4 class="members">Members</h4>
|
||||
<dl>
|
||||
<dt>attrs </dt>
|
||||
<dd class="description">Attributes</dd>
|
||||
<dt>name </dt>
|
||||
<dd class="description">Name of element</dd>
|
||||
<dt>num_attrs </dt>
|
||||
<dd class="description">Number of attributes</dd>
|
||||
</dl>
|
||||
<h3 class="struct"><a name="mxml_index_s">mxml_index_s</a></h3>
|
||||
<p class="description">An XML node index.</p>
|
||||
<p class="code">struct mxml_index_s {<br>
|
||||
int alloc_nodes;<br>
|
||||
char *attr;<br>
|
||||
int cur_node;<br>
|
||||
<a href="#mxml_node_t">mxml_node_t</a> **nodes;<br>
|
||||
int num_nodes;<br>
|
||||
};</p>
|
||||
<h4 class="members">Members</h4>
|
||||
<dl>
|
||||
<dt>alloc_nodes </dt>
|
||||
<dd class="description">Allocated nodes in index</dd>
|
||||
<dt>attr </dt>
|
||||
<dd class="description">Attribute used for indexing or NULL</dd>
|
||||
<dt>cur_node </dt>
|
||||
<dd class="description">Current node</dd>
|
||||
<dt>nodes </dt>
|
||||
<dd class="description">Node array</dd>
|
||||
<dt>num_nodes </dt>
|
||||
<dd class="description">Number of nodes in index</dd>
|
||||
</dl>
|
||||
<h3 class="struct"><a name="mxml_node_s">mxml_node_s</a></h3>
|
||||
<p class="description">An XML node.</p>
|
||||
<p class="code">struct mxml_node_s {<br>
|
||||
struct <a href="#mxml_node_s">mxml_node_s</a> *child;<br>
|
||||
struct <a href="#mxml_node_s">mxml_node_s</a> *last_child;<br>
|
||||
struct <a href="#mxml_node_s">mxml_node_s</a> *next;<br>
|
||||
struct <a href="#mxml_node_s">mxml_node_s</a> *parent;<br>
|
||||
struct <a href="#mxml_node_s">mxml_node_s</a> *prev;<br>
|
||||
int ref_count;<br>
|
||||
<a href="#mxml_type_t">mxml_type_t</a> type;<br>
|
||||
void *user_data;<br>
|
||||
<a href="#mxml_value_t">mxml_value_t</a> value;<br>
|
||||
};</p>
|
||||
<h4 class="members">Members</h4>
|
||||
<dl>
|
||||
<dt>child </dt>
|
||||
<dd class="description">First child node</dd>
|
||||
<dt>last_child </dt>
|
||||
<dd class="description">Last child node</dd>
|
||||
<dt>next </dt>
|
||||
<dd class="description">Next node under same parent</dd>
|
||||
<dt>parent </dt>
|
||||
<dd class="description">Parent node</dd>
|
||||
<dt>prev </dt>
|
||||
<dd class="description">Previous node under same parent</dd>
|
||||
<dt>ref_count </dt>
|
||||
<dd class="description">Use count</dd>
|
||||
<dt>type </dt>
|
||||
<dd class="description">Node type</dd>
|
||||
<dt>user_data </dt>
|
||||
<dd class="description">User data</dd>
|
||||
<dt>value </dt>
|
||||
<dd class="description">Node value</dd>
|
||||
</dl>
|
||||
<h3 class="struct"><a name="mxml_text_s">mxml_text_s</a></h3>
|
||||
<p class="description">An XML text value.</p>
|
||||
<p class="code">struct mxml_text_s {<br>
|
||||
char *string;<br>
|
||||
int whitespace;<br>
|
||||
};</p>
|
||||
<h4 class="members">Members</h4>
|
||||
<dl>
|
||||
<dt>string </dt>
|
||||
<dd class="description">Fragment string</dd>
|
||||
<dt>whitespace </dt>
|
||||
<dd class="description">Leading whitespace?</dd>
|
||||
</dl>
|
||||
<h2 class="title"><a name="UNIONS">Unions</a></h2>
|
||||
<h3 class="union"><a name="mxml_value_u">mxml_value_u</a></h3>
|
||||
<p class="description">An XML node value.</p>
|
||||
<p class="code">union mxml_value_u {<br>
|
||||
<a href="#mxml_custom_t">mxml_custom_t</a> custom;<br>
|
||||
<a href="#mxml_element_t">mxml_element_t</a> element;<br>
|
||||
int integer;<br>
|
||||
char *opaque;<br>
|
||||
double real;<br>
|
||||
<a href="#mxml_text_t">mxml_text_t</a> text;<br>
|
||||
};</p>
|
||||
<h4 class="members">Members</h4>
|
||||
<dl>
|
||||
<dt>custom <span class="info"> Mini-XML 2.1 </span></dt>
|
||||
<dd class="description">Custom data </dd>
|
||||
<dt>element </dt>
|
||||
<dd class="description">Element</dd>
|
||||
<dt>integer </dt>
|
||||
<dd class="description">Integer number</dd>
|
||||
<dt>opaque </dt>
|
||||
<dd class="description">Opaque string</dd>
|
||||
<dt>real </dt>
|
||||
<dd class="description">Real number</dd>
|
||||
<dt>text </dt>
|
||||
<dd class="description">Text fragment</dd>
|
||||
</dl>
|
||||
<h2 class="title"><a name="ENUMERATIONS">Constants</a></h2>
|
||||
<h3 class="enumeration"><a name="mxml_sax_event_e">mxml_sax_event_e</a></h3>
|
||||
<p class="description">SAX event type.</p>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<title>Mini-XML Programmers Manual</title>
|
||||
<meta name="author" content="Michael R Sweet">
|
||||
<meta name="copyright" content="Copyright 2003-2010">
|
||||
<meta name="copyright" content="Copyright 2003-2011">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
<tr><td height="100%">
|
||||
|
||||
<H1 ALIGN="CENTER"><FONT SIZE="-1">Mini-XML Programmers Manual<br>
|
||||
Version 2.6</H1>
|
||||
Version 2.7</H1>
|
||||
|
||||
<P ALIGN="CENTER">MICHAEL R. SWEET</P>
|
||||
|
||||
@ -21,7 +21,7 @@ Version 2.6</H1>
|
||||
<!-- NEW PAGE -->
|
||||
<P><FONT SIZE="+1"><B>Mini-XML Programmers Manual, Version 2.7</B></FONT></P>
|
||||
|
||||
<P><B>Copyright © 2003-2010 by Michael R. Sweet</B></P>
|
||||
<P><B>Copyright © 2003-2011 by Michael R. Sweet</B></P>
|
||||
|
||||
<P><SMALL>Permission is granted to copy, distribute and/or modify
|
||||
this document under the terms of the GNU Library General Public
|
||||
|
471
mxml-get.c
Normal file
471
mxml-get.c
Normal file
@ -0,0 +1,471 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Node get functions for Mini-XML, a small XML-like file parsing library.
|
||||
*
|
||||
* Copyright 2011 by Michael R Sweet.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Michael R Sweet and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "COPYING"
|
||||
* which should have been included with this file. If this file is
|
||||
* missing or damaged, see the license at:
|
||||
*
|
||||
* http://www.minixml.org/
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* mxmlGetCDATA() - Get the value for a CDATA node.
|
||||
* mxmlGetCustom() - Get the value for a custom node.
|
||||
* mxmlGetElement() - Get the name for an element node.
|
||||
* mxmlGetFirstChild() - Get the first child of an element node.
|
||||
* mxmlGetInteger() - Get the integer value from the specified node or its
|
||||
* first child.
|
||||
* mxmlGetLastChild() - Get the last child of an element node.
|
||||
* mxmlGetNext() - Get the next node for the current parent.
|
||||
* mxmlGetOpaque() - Get an opaque string value for a node or its first
|
||||
* child.
|
||||
* mxmlGetParent() - Get the parent node.
|
||||
* mxmlGetPrevious() - Get the previous node for the current parent.
|
||||
* mxmlGetReal() - Get the real value for a node or its first child.
|
||||
* mxmlGetText() - Get the text value for a node or its first child.
|
||||
* mxmlGetType() - Get the node type.
|
||||
* mxmlGetUserData() - Get the user data pointer for a node.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "mxml.h"
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlGetCDATA()' - Get the value for a CDATA node.
|
||||
*
|
||||
* @code NULL@ is returned if the node is not a CDATA element.
|
||||
*
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
char * /* O - CDATA value or NULL */
|
||||
mxmlGetCDATA(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!node || node->type != MXML_ELEMENT ||
|
||||
strncmp(node->value.element.name, "![CDATA[", 8))
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Return the text following the CDATA declaration...
|
||||
*/
|
||||
|
||||
return (node->value.element.name + 8);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlGetCustom()' - Get the value for a custom node.
|
||||
*
|
||||
* @code NULL@ is returned if the node (or its first child) is not a custom
|
||||
* value node.
|
||||
*
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
void * /* O - Custom value or NULL */
|
||||
mxmlGetCustom(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!node)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Return the integer value...
|
||||
*/
|
||||
|
||||
if (node->type == MXML_CUSTOM)
|
||||
return (node->value.custom.data);
|
||||
else if (node->type == MXML_ELEMENT &&
|
||||
node->child &&
|
||||
node->child->type == MXML_CUSTOM)
|
||||
return (node->child->value.custom.data);
|
||||
else
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlGetElement()' - Get the name for an element node.
|
||||
*
|
||||
* @code NULL@ is returned if the node is not an element node.
|
||||
*
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
char * /* O - Element name or NULL */
|
||||
mxmlGetElement(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!node || node->type != MXML_ELEMENT)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Return the element name...
|
||||
*/
|
||||
|
||||
return (node->value.element.name);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlGetFirstChild()' - Get the first child of an element node.
|
||||
*
|
||||
* @code NULL@ is returned if the node is not an element node or if the node
|
||||
* has no children.
|
||||
*
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - First child or NULL */
|
||||
mxmlGetFirstChild(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!node || node->type != MXML_ELEMENT)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Return the first child node...
|
||||
*/
|
||||
|
||||
return (node->child);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlGetInteger()' - Get the integer value from the specified node or its
|
||||
* first child.
|
||||
*
|
||||
* 0 is returned if the node (or its first child) is not an integer value node.
|
||||
*
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
int /* O - Integer value or 0 */
|
||||
mxmlGetInteger(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!node)
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* Return the integer value...
|
||||
*/
|
||||
|
||||
if (node->type == MXML_INTEGER)
|
||||
return (node->value.integer);
|
||||
else if (node->type == MXML_ELEMENT &&
|
||||
node->child &&
|
||||
node->child->type == MXML_INTEGER)
|
||||
return (node->child->value.integer);
|
||||
else
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlGetLastChild()' - Get the last child of an element node.
|
||||
*
|
||||
* @code NULL@ is returned if the node is not an element node or if the node
|
||||
* has no children.
|
||||
*
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - Last child or NULL */
|
||||
mxmlGetLastChild(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!node || node->type != MXML_ELEMENT)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Return the node type...
|
||||
*/
|
||||
|
||||
return (node->last_child);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlGetNext()' - Get the next node for the current parent.
|
||||
*
|
||||
* @code NULL@ is returned if this is the last child for the current parent.
|
||||
*
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
mxml_node_t *
|
||||
mxmlGetNext(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!node)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Return the node type...
|
||||
*/
|
||||
|
||||
return (node->next);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlGetOpaque()' - Get an opaque string value for a node or its first child.
|
||||
*
|
||||
* @code NULL@ is returned if the node (or its first child) is not an opaque
|
||||
* value node.
|
||||
*
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
char * /* O - Opaque string or NULL */
|
||||
mxmlGetOpaque(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!node)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Return the integer value...
|
||||
*/
|
||||
|
||||
if (node->type == MXML_OPAQUE)
|
||||
return (node->value.opaque);
|
||||
else if (node->type == MXML_ELEMENT &&
|
||||
node->child &&
|
||||
node->child->type == MXML_OPAQUE)
|
||||
return (node->child->value.opaque);
|
||||
else
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlGetParent()' - Get the parent node.
|
||||
*
|
||||
* @code NULL@ is returned for a root node.
|
||||
*
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - Parent node or NULL */
|
||||
mxmlGetParent(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!node)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Return the node type...
|
||||
*/
|
||||
|
||||
return (node->parent);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlGetPrevious()' - Get the previous node for the current parent.
|
||||
*
|
||||
* @code NULL@ is returned if this is the first child for the current parent.
|
||||
*
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - Previous node or NULL */
|
||||
mxmlGetPrevious(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!node)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Return the node type...
|
||||
*/
|
||||
|
||||
return (node->prev);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlGetReal()' - Get the real value for a node or its first child.
|
||||
*
|
||||
* 0.0 is returned if the node (or its first child) is not a real value node.
|
||||
*
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
double /* O - Real value or 0.0 */
|
||||
mxmlGetReal(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!node)
|
||||
return (0.0);
|
||||
|
||||
/*
|
||||
* Return the integer value...
|
||||
*/
|
||||
|
||||
if (node->type == MXML_REAL)
|
||||
return (node->value.real);
|
||||
else if (node->type == MXML_ELEMENT &&
|
||||
node->child &&
|
||||
node->child->type == MXML_REAL)
|
||||
return (node->child->value.real);
|
||||
else
|
||||
return (0.0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlGetText()' - Get the text value for a node or its first child.
|
||||
*
|
||||
* @code NULL@ is returned if the node (or its first child) is not a text node.
|
||||
* The "whitespace" argument can be NULL.
|
||||
*
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
char * /* O - Text string or NULL */
|
||||
mxmlGetText(mxml_node_t *node, /* I - Node to get */
|
||||
int *whitespace) /* O - 1 if string is preceded by whitespace, 0 otherwise */
|
||||
{
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!node)
|
||||
{
|
||||
if (whitespace)
|
||||
*whitespace = 0;
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the integer value...
|
||||
*/
|
||||
|
||||
if (node->type == MXML_TEXT)
|
||||
{
|
||||
if (whitespace)
|
||||
*whitespace = node->value.text.whitespace;
|
||||
|
||||
return (node->value.text.string);
|
||||
}
|
||||
else if (node->type == MXML_ELEMENT &&
|
||||
node->child &&
|
||||
node->child->type == MXML_TEXT)
|
||||
{
|
||||
if (whitespace)
|
||||
*whitespace = node->child->value.text.whitespace;
|
||||
|
||||
return (node->child->value.text.string);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (whitespace)
|
||||
*whitespace = 0;
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlGetType()' - Get the node type.
|
||||
*
|
||||
* @code MXML_IGNORE@ is returned if "node" is @code NULL@.
|
||||
*
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
mxml_type_t /* O - Type of node */
|
||||
mxmlGetType(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!node)
|
||||
return (MXML_IGNORE);
|
||||
|
||||
/*
|
||||
* Return the node type...
|
||||
*/
|
||||
|
||||
return (node->type);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlGetUserData()' - Get the user data pointer for a node.
|
||||
*
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
void * /* O - User data pointer */
|
||||
mxmlGetUserData(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!node)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Return the user data pointer...
|
||||
*/
|
||||
|
||||
return (node->user_data);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
35
mxml-index.c
35
mxml-index.c
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Index support code for Mini-XML, a small XML-like file parsing library.
|
||||
*
|
||||
* Copyright 2003-2010 by Michael R Sweet.
|
||||
* Copyright 2003-2011 by Michael R Sweet.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Michael R Sweet and are protected by Federal copyright
|
||||
@ -15,15 +15,6 @@
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* mxmlIndexDelete() - Delete an index.
|
||||
* mxmlIndexEnum() - Return the next node in the index.
|
||||
* mxmlIndexFind() - Find the next matching node.
|
||||
* mxmlIndexNew() - Create a new index.
|
||||
* mxmlIndexReset() - Reset the enumeration/find pointer in the index and
|
||||
* return the first node in the index.
|
||||
* index_compare() - Compare two nodes.
|
||||
* index_find() - Compare a node with index values.
|
||||
* index_sort() - Sort the nodes in the index...
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -282,6 +273,30 @@ mxmlIndexFind(mxml_index_t *ind, /* I - Index to search */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlIndexGetCount()' - Get the number of nodes in an index.
|
||||
*
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
int /* I - Number of nodes in index */
|
||||
mxmlIndexGetCount(mxml_index_t *ind) /* I - Index of nodes */
|
||||
{
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!ind)
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* Return the number of nodes in the index...
|
||||
*/
|
||||
|
||||
return (ind->num_nodes);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlIndexNew()' - Create a new index.
|
||||
*
|
||||
|
111
mxml-set.c
111
mxml-set.c
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Node set functions for Mini-XML, a small XML-like file parsing library.
|
||||
*
|
||||
* Copyright 2003-2010 by Michael R Sweet.
|
||||
* Copyright 2003-2011 by Michael R Sweet.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Michael R Sweet and are protected by Federal copyright
|
||||
@ -15,14 +15,15 @@
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* mxmlSetCustom() - Set the data and destructor of a custom data node.
|
||||
* mxmlSetCDATA() - Set the element name of a CDATA node.
|
||||
* 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.
|
||||
* mxmlSetCDATA() - Set the element name of a CDATA node.
|
||||
* mxmlSetCustom() - Set the data and destructor of a custom data node.
|
||||
* 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.
|
||||
* mxmlSetUserData() - Set the user data pointer for a node.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -33,6 +34,39 @@
|
||||
#include "mxml.h"
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlSetCDATA()' - Set the element name of a CDATA node.
|
||||
*
|
||||
* The node is not changed if it is not a CDATA element node.
|
||||
*
|
||||
* @since Mini-XML 2.3@
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on failure */
|
||||
mxmlSetCDATA(mxml_node_t *node, /* I - Node to set */
|
||||
const char *data) /* I - New data string */
|
||||
{
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!node || node->type != MXML_ELEMENT || !data ||
|
||||
strncmp(node->value.element.name, "![CDATA[", 8))
|
||||
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 = _mxml_strdupf("![CDATA[%s]]", data);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlSetCustom()' - Set the data and destructor of a custom data node.
|
||||
*
|
||||
@ -68,39 +102,6 @@ mxmlSetCustom(
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlSetCDATA()' - Set the element name of a CDATA node.
|
||||
*
|
||||
* The node is not changed if it is not a CDATA element node.
|
||||
*
|
||||
* @since Mini-XML 2.3@
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on failure */
|
||||
mxmlSetCDATA(mxml_node_t *node, /* I - Node to set */
|
||||
const char *data) /* I - New data string */
|
||||
{
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!node || node->type != MXML_ELEMENT || !data ||
|
||||
strncmp(node->value.element.name, "![CDATA[", 8))
|
||||
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 = _mxml_strdupf("![CDATA[%s]]", data);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlSetElement()' - Set the name of an element node.
|
||||
*
|
||||
@ -287,6 +288,32 @@ mxmlSetTextf(mxml_node_t *node, /* I - Node to set */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlSetUserData()' - Set the user data pointer for a node.
|
||||
*
|
||||
* @since Mini-XML 2.7@
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on failure */
|
||||
mxmlSetUserData(mxml_node_t *node, /* I - Node to set */
|
||||
void *data) /* I - User data pointer */
|
||||
{
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!node)
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
* Set the user data pointer and return...
|
||||
*/
|
||||
|
||||
node->user_data = data;
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
|
41
mxml.h
41
mxml.h
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Header file for Mini-XML, a small XML-like file parsing library.
|
||||
*
|
||||
* Copyright 2003-2010 by Michael R Sweet.
|
||||
* Copyright 2003-2011 by Michael R Sweet.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Michael R Sweet and are protected by Federal copyright
|
||||
@ -96,32 +96,32 @@ typedef void (*mxml_custom_destroy_cb_t)(void *);
|
||||
typedef void (*mxml_error_cb_t)(const char *);
|
||||
/**** Error callback function ****/
|
||||
|
||||
typedef struct mxml_attr_s /**** An XML element attribute value. ****/
|
||||
typedef struct mxml_attr_s /**** An XML element attribute value. @private@ ****/
|
||||
{
|
||||
char *name; /* Attribute name */
|
||||
char *value; /* Attribute value */
|
||||
} mxml_attr_t;
|
||||
|
||||
typedef struct mxml_element_s /**** An XML element value. ****/
|
||||
typedef struct mxml_element_s /**** An XML element value. @private@ ****/
|
||||
{
|
||||
char *name; /* Name of element */
|
||||
int num_attrs; /* Number of attributes */
|
||||
mxml_attr_t *attrs; /* Attributes */
|
||||
} mxml_element_t;
|
||||
|
||||
typedef struct mxml_text_s /**** An XML text value. ****/
|
||||
typedef struct mxml_text_s /**** An XML text value. @private@ ****/
|
||||
{
|
||||
int whitespace; /* Leading whitespace? */
|
||||
char *string; /* Fragment string */
|
||||
} mxml_text_t;
|
||||
|
||||
typedef struct mxml_custom_s /**** An XML custom value. @since Mini-XML 2.1@ ****/
|
||||
typedef struct mxml_custom_s /**** An XML custom value. @private@ ****/
|
||||
{
|
||||
void *data; /* Pointer to (allocated) custom data */
|
||||
mxml_custom_destroy_cb_t destroy; /* Pointer to destructor function */
|
||||
} mxml_custom_t;
|
||||
|
||||
typedef union mxml_value_u /**** An XML node value. ****/
|
||||
typedef union mxml_value_u /**** An XML node value. @private@ ****/
|
||||
{
|
||||
mxml_element_t element; /* Element */
|
||||
int integer; /* Integer number */
|
||||
@ -131,7 +131,7 @@ typedef union mxml_value_u /**** An XML node value. ****/
|
||||
mxml_custom_t custom; /* Custom data @since Mini-XML 2.1@ */
|
||||
} mxml_value_t;
|
||||
|
||||
typedef struct mxml_node_s /**** An XML node. ****/
|
||||
struct mxml_node_s /**** An XML node. @private@ ****/
|
||||
{
|
||||
mxml_type_t type; /* Node type */
|
||||
struct mxml_node_s *next; /* Next node under same parent */
|
||||
@ -142,16 +142,21 @@ typedef struct mxml_node_s /**** An XML node. ****/
|
||||
mxml_value_t value; /* Node value */
|
||||
int ref_count; /* Use count */
|
||||
void *user_data; /* User data */
|
||||
} mxml_node_t;
|
||||
};
|
||||
|
||||
typedef struct mxml_index_s /**** An XML node index. ****/
|
||||
typedef struct mxml_node_s mxml_node_t; /**** An XML node. ****/
|
||||
|
||||
struct mxml_index_s /**** An XML node index. @private@ ****/
|
||||
{
|
||||
char *attr; /* Attribute used for indexing or NULL */
|
||||
int num_nodes; /* Number of nodes in index */
|
||||
int alloc_nodes; /* Allocated nodes in index */
|
||||
int cur_node; /* Current node */
|
||||
mxml_node_t **nodes; /* Node array */
|
||||
} mxml_index_t;
|
||||
};
|
||||
|
||||
typedef struct mxml_index_s mxml_index_t;
|
||||
/**** An XML node index. ****/
|
||||
|
||||
typedef int (*mxml_custom_load_cb_t)(mxml_node_t *, const char *);
|
||||
/**** Custom data load callback function ****/
|
||||
@ -206,11 +211,26 @@ extern mxml_node_t *mxmlFindElement(mxml_node_t *node, mxml_node_t *top,
|
||||
const char *name, const char *attr,
|
||||
const char *value, int descend);
|
||||
extern mxml_node_t *mxmlFindValue(mxml_node_t *node, const char *path);
|
||||
extern char *mxmlGetCDATA(mxml_node_t *node);
|
||||
extern void *mxmlGetCustom(mxml_node_t *node);
|
||||
extern char *mxmlGetElement(mxml_node_t *node);
|
||||
extern mxml_node_t *mxmlGetFirstChild(mxml_node_t *node);
|
||||
extern int mxmlGetInteger(mxml_node_t *node);
|
||||
extern mxml_node_t *mxmlGetLastChild(mxml_node_t *node);
|
||||
extern mxml_node_t *mxmlGetNext(mxml_node_t *node);
|
||||
extern char *mxmlGetOpaque(mxml_node_t *node);
|
||||
extern mxml_node_t *mxmlGetParent(mxml_node_t *node);
|
||||
extern mxml_node_t *mxmlGetPrevious(mxml_node_t *node);
|
||||
extern double mxmlGetReal(mxml_node_t *node);
|
||||
extern char *mxmlGetText(mxml_node_t *node, int *whitespace);
|
||||
extern mxml_type_t mxmlGetType(mxml_node_t *node);
|
||||
extern void *mxmlGetUserData(mxml_node_t *node);
|
||||
extern void mxmlIndexDelete(mxml_index_t *ind);
|
||||
extern mxml_node_t *mxmlIndexEnum(mxml_index_t *ind);
|
||||
extern mxml_node_t *mxmlIndexFind(mxml_index_t *ind,
|
||||
const char *element,
|
||||
const char *value);
|
||||
extern int mxmlIndexGetCount(mxml_index_t *ind);
|
||||
extern mxml_index_t *mxmlIndexNew(mxml_node_t *node, const char *element,
|
||||
const char *attr);
|
||||
extern mxml_node_t *mxmlIndexReset(mxml_index_t *ind);
|
||||
@ -274,6 +294,7 @@ extern int mxmlSetTextf(mxml_node_t *node, int whitespace,
|
||||
__attribute__ ((__format__ (__printf__, 3, 4)))
|
||||
# endif /* __GNUC__ */
|
||||
;
|
||||
extern int mxmlSetUserData(mxml_node_t *node, void *data);
|
||||
extern void mxmlSetWrapMargin(int column);
|
||||
extern mxml_node_t *mxmlWalkNext(mxml_node_t *node, mxml_node_t *top,
|
||||
int descend);
|
||||
|
272
mxml.xml
272
mxml.xml
@ -218,6 +218,224 @@ considered a wildcard for one or more levels of elements. For example,
|
||||
<description>Path to element</description>
|
||||
</argument>
|
||||
</function>
|
||||
<function name="mxmlGetCDATA">
|
||||
<returnvalue>
|
||||
<type>char *</type>
|
||||
<description>CDATA value or NULL</description>
|
||||
</returnvalue>
|
||||
<description>Get the value for a CDATA node.
|
||||
|
||||
@code NULL@ is returned if the node is not a CDATA element.
|
||||
|
||||
@since Mini-XML 2.7@</description>
|
||||
<argument name="node" direction="I">
|
||||
<type>mxml_node_t *</type>
|
||||
<description>Node to get</description>
|
||||
</argument>
|
||||
</function>
|
||||
<function name="mxmlGetCustom">
|
||||
<returnvalue>
|
||||
<type>void *</type>
|
||||
<description>Custom value or NULL</description>
|
||||
</returnvalue>
|
||||
<description>Get the value for a custom node.
|
||||
|
||||
@code NULL@ is returned if the node (or its first child) is not a custom
|
||||
value node.
|
||||
|
||||
@since Mini-XML 2.7@</description>
|
||||
<argument name="node" direction="I">
|
||||
<type>mxml_node_t *</type>
|
||||
<description>Node to get</description>
|
||||
</argument>
|
||||
</function>
|
||||
<function name="mxmlGetElement">
|
||||
<returnvalue>
|
||||
<type>char *</type>
|
||||
<description>Element name or NULL</description>
|
||||
</returnvalue>
|
||||
<description>Get the name for an element node.
|
||||
|
||||
@code NULL@ is returned if the node is not an element node.
|
||||
|
||||
@since Mini-XML 2.7@</description>
|
||||
<argument name="node" direction="I">
|
||||
<type>mxml_node_t *</type>
|
||||
<description>Node to get</description>
|
||||
</argument>
|
||||
</function>
|
||||
<function name="mxmlGetFirstChild">
|
||||
<returnvalue>
|
||||
<type>mxml_node_t *</type>
|
||||
<description>First child or NULL</description>
|
||||
</returnvalue>
|
||||
<description>Get the first child of an element node.
|
||||
|
||||
@code NULL@ is returned if the node is not an element node or if the node
|
||||
has no children.
|
||||
|
||||
@since Mini-XML 2.7@</description>
|
||||
<argument name="node" direction="I">
|
||||
<type>mxml_node_t *</type>
|
||||
<description>Node to get</description>
|
||||
</argument>
|
||||
</function>
|
||||
<function name="mxmlGetInteger">
|
||||
<returnvalue>
|
||||
<type>int</type>
|
||||
<description>Integer value or 0</description>
|
||||
</returnvalue>
|
||||
<description>Get the integer value from the specified node or its
|
||||
first child.
|
||||
|
||||
0 is returned if the node (or its first child) is not an integer value node.
|
||||
|
||||
@since Mini-XML 2.7@</description>
|
||||
<argument name="node" direction="I">
|
||||
<type>mxml_node_t *</type>
|
||||
<description>Node to get</description>
|
||||
</argument>
|
||||
</function>
|
||||
<function name="mxmlGetLastChild">
|
||||
<returnvalue>
|
||||
<type>mxml_node_t *</type>
|
||||
<description>Last child or NULL</description>
|
||||
</returnvalue>
|
||||
<description>Get the last child of an element node.
|
||||
|
||||
@code NULL@ is returned if the node is not an element node or if the node
|
||||
has no children.
|
||||
|
||||
@since Mini-XML 2.7@</description>
|
||||
<argument name="node" direction="I">
|
||||
<type>mxml_node_t *</type>
|
||||
<description>Node to get</description>
|
||||
</argument>
|
||||
</function>
|
||||
<function name="mxmlGetNext">
|
||||
<returnvalue>
|
||||
<type>mxml_node_t *</type>
|
||||
<description>Get the next node for the current parent.
|
||||
|
||||
@code NULL@ is returned if this is the last child for the current parent.
|
||||
|
||||
@since Mini-XML 2.7@</description>
|
||||
</returnvalue>
|
||||
<description>Return the node type...</description>
|
||||
<argument name="node" direction="I">
|
||||
<type>mxml_node_t *</type>
|
||||
<description>Node to get</description>
|
||||
</argument>
|
||||
</function>
|
||||
<function name="mxmlGetOpaque">
|
||||
<returnvalue>
|
||||
<type>char *</type>
|
||||
<description>Opaque string or NULL</description>
|
||||
</returnvalue>
|
||||
<description>Get an opaque string value for a node or its first child.
|
||||
|
||||
@code NULL@ is returned if the node (or its first child) is not an opaque
|
||||
value node.
|
||||
|
||||
@since Mini-XML 2.7@</description>
|
||||
<argument name="node" direction="I">
|
||||
<type>mxml_node_t *</type>
|
||||
<description>Node to get</description>
|
||||
</argument>
|
||||
</function>
|
||||
<function name="mxmlGetParent">
|
||||
<returnvalue>
|
||||
<type>mxml_node_t *</type>
|
||||
<description>Parent node or NULL</description>
|
||||
</returnvalue>
|
||||
<description>Get the parent node.
|
||||
|
||||
@code NULL@ is returned for a root node.
|
||||
|
||||
@since Mini-XML 2.7@</description>
|
||||
<argument name="node" direction="I">
|
||||
<type>mxml_node_t *</type>
|
||||
<description>Node to get</description>
|
||||
</argument>
|
||||
</function>
|
||||
<function name="mxmlGetPrevious">
|
||||
<returnvalue>
|
||||
<type>mxml_node_t *</type>
|
||||
<description>Previous node or NULL</description>
|
||||
</returnvalue>
|
||||
<description>Get the previous node for the current parent.
|
||||
|
||||
@code NULL@ is returned if this is the first child for the current parent.
|
||||
|
||||
@since Mini-XML 2.7@</description>
|
||||
<argument name="node" direction="I">
|
||||
<type>mxml_node_t *</type>
|
||||
<description>Node to get</description>
|
||||
</argument>
|
||||
</function>
|
||||
<function name="mxmlGetReal">
|
||||
<returnvalue>
|
||||
<type>double</type>
|
||||
<description>Real value or 0.0</description>
|
||||
</returnvalue>
|
||||
<description>Get the real value for a node or its first child.
|
||||
|
||||
0.0 is returned if the node (or its first child) is not a real value node.
|
||||
|
||||
@since Mini-XML 2.7@</description>
|
||||
<argument name="node" direction="I">
|
||||
<type>mxml_node_t *</type>
|
||||
<description>Node to get</description>
|
||||
</argument>
|
||||
</function>
|
||||
<function name="mxmlGetText">
|
||||
<returnvalue>
|
||||
<type>char *</type>
|
||||
<description>Text string or NULL</description>
|
||||
</returnvalue>
|
||||
<description>Get the text value for a node or its first child.
|
||||
|
||||
@code NULL@ is returned if the node (or its first child) is not a text node.
|
||||
The "whitespace" argument can be NULL.
|
||||
|
||||
@since Mini-XML 2.7@</description>
|
||||
<argument name="node" direction="I">
|
||||
<type>mxml_node_t *</type>
|
||||
<description>Node to get</description>
|
||||
</argument>
|
||||
<argument name="whitespace" direction="O">
|
||||
<type>int *</type>
|
||||
<description>1 if string is preceded by whitespace, 0 otherwise</description>
|
||||
</argument>
|
||||
</function>
|
||||
<function name="mxmlGetType">
|
||||
<returnvalue>
|
||||
<type>mxml_type_t</type>
|
||||
<description>Type of node</description>
|
||||
</returnvalue>
|
||||
<description>Get the node type.
|
||||
|
||||
@code MXML_IGNORE@ is returned if "node" is @code NULL@.
|
||||
|
||||
@since Mini-XML 2.7@</description>
|
||||
<argument name="node" direction="I">
|
||||
<type>mxml_node_t *</type>
|
||||
<description>Node to get</description>
|
||||
</argument>
|
||||
</function>
|
||||
<function name="mxmlGetUserData">
|
||||
<returnvalue>
|
||||
<type>void *</type>
|
||||
<description>User data pointer</description>
|
||||
</returnvalue>
|
||||
<description>Get the user data pointer for a node.
|
||||
|
||||
@since Mini-XML 2.7@</description>
|
||||
<argument name="node" direction="I">
|
||||
<type>mxml_node_t *</type>
|
||||
<description>Node to get</description>
|
||||
</argument>
|
||||
</function>
|
||||
<function name="mxmlIndexDelete">
|
||||
<description>Delete an index.</description>
|
||||
<argument name="ind" direction="I">
|
||||
@ -262,6 +480,19 @@ to calling mxmlIndexEnum().</description>
|
||||
<description>Attribute value, if any</description>
|
||||
</argument>
|
||||
</function>
|
||||
<function name="mxmlIndexGetCount">
|
||||
<returnvalue>
|
||||
<type>int</type>
|
||||
<description>Number of nodes in index</description>
|
||||
</returnvalue>
|
||||
<description>Get the number of nodes in an index.
|
||||
|
||||
@since Mini-XML 2.7@</description>
|
||||
<argument name="ind" direction="I">
|
||||
<type>mxml_index_t *</type>
|
||||
<description>Index of nodes</description>
|
||||
</argument>
|
||||
</function>
|
||||
<function name="mxmlIndexNew">
|
||||
<returnvalue>
|
||||
<type>mxml_index_t *</type>
|
||||
@ -1049,6 +1280,23 @@ The node is not changed if it is not a text node.</description>
|
||||
<type /> <description>Additional arguments as needed</description>
|
||||
</argument>
|
||||
</function>
|
||||
<function name="mxmlSetUserData">
|
||||
<returnvalue>
|
||||
<type>int</type>
|
||||
<description>0 on success, -1 on failure</description>
|
||||
</returnvalue>
|
||||
<description>Set the user data pointer for a node.
|
||||
|
||||
@since Mini-XML 2.7@</description>
|
||||
<argument name="node" direction="I">
|
||||
<type>mxml_node_t *</type>
|
||||
<description>Node to set</description>
|
||||
</argument>
|
||||
<argument name="data" direction="I">
|
||||
<type>void *</type>
|
||||
<description>User data pointer</description>
|
||||
</argument>
|
||||
</function>
|
||||
<function name="mxmlSetWrapMargin">
|
||||
<description>Set the wrap margin when saving XML data.
|
||||
|
||||
@ -1107,7 +1355,7 @@ the walk to the node's children.</description>
|
||||
</argument>
|
||||
</function>
|
||||
<struct name="mxml_attr_s">
|
||||
<description>An XML element attribute value.</description>
|
||||
<description>An XML element attribute value. @private@</description>
|
||||
<variable name="name">
|
||||
<type>char *</type>
|
||||
<description>Attribute name</description>
|
||||
@ -1119,7 +1367,7 @@ the walk to the node's children.</description>
|
||||
</struct>
|
||||
<typedef name="mxml_attr_t">
|
||||
<type>struct mxml_attr_s</type>
|
||||
<description>An XML element attribute value.</description>
|
||||
<description>An XML element attribute value. @private@</description>
|
||||
</typedef>
|
||||
<typedef name="mxml_custom_destroy_cb_t">
|
||||
<type>void(*)(void *)</type>
|
||||
@ -1130,7 +1378,7 @@ the walk to the node's children.</description>
|
||||
<description>Custom data load callback function</description>
|
||||
</typedef>
|
||||
<struct name="mxml_custom_s">
|
||||
<description>An XML custom value. @since Mini-XML 2.1@</description>
|
||||
<description>An XML custom value. @private@</description>
|
||||
<variable name="data">
|
||||
<type>void *</type>
|
||||
<description>Pointer to (allocated) custom data</description>
|
||||
@ -1146,10 +1394,10 @@ the walk to the node's children.</description>
|
||||
</typedef>
|
||||
<typedef name="mxml_custom_t">
|
||||
<type>struct mxml_custom_s</type>
|
||||
<description>An XML custom value. @since Mini-XML 2.1@</description>
|
||||
<description>An XML custom value. @private@</description>
|
||||
</typedef>
|
||||
<struct name="mxml_element_s">
|
||||
<description>An XML element value.</description>
|
||||
<description>An XML element value. @private@</description>
|
||||
<variable name="attrs">
|
||||
<type>mxml_attr_t *</type>
|
||||
<description>Attributes</description>
|
||||
@ -1165,7 +1413,7 @@ the walk to the node's children.</description>
|
||||
</struct>
|
||||
<typedef name="mxml_element_t">
|
||||
<type>struct mxml_element_s</type>
|
||||
<description>An XML element value.</description>
|
||||
<description>An XML element value. @private@</description>
|
||||
</typedef>
|
||||
<typedef name="mxml_entity_cb_t">
|
||||
<type>int(*)(const char *)</type>
|
||||
@ -1176,7 +1424,7 @@ the walk to the node's children.</description>
|
||||
<description>Error callback function</description>
|
||||
</typedef>
|
||||
<struct name="mxml_index_s">
|
||||
<description>An XML node index.</description>
|
||||
<description>An XML node index. @private@</description>
|
||||
<variable name="alloc_nodes">
|
||||
<type>int</type>
|
||||
<description>Allocated nodes in index</description>
|
||||
@ -1207,7 +1455,7 @@ the walk to the node's children.</description>
|
||||
<description>Load callback function</description>
|
||||
</typedef>
|
||||
<struct name="mxml_node_s">
|
||||
<description>An XML node.</description>
|
||||
<description>An XML node. @private@</description>
|
||||
<variable name="child">
|
||||
<type>struct mxml_node_s *</type>
|
||||
<description>First child node</description>
|
||||
@ -1283,7 +1531,7 @@ the walk to the node's children.</description>
|
||||
<description>SAX event type.</description>
|
||||
</typedef>
|
||||
<struct name="mxml_text_s">
|
||||
<description>An XML text value.</description>
|
||||
<description>An XML text value. @private@</description>
|
||||
<variable name="string">
|
||||
<type>char *</type>
|
||||
<description>Fragment string</description>
|
||||
@ -1295,7 +1543,7 @@ the walk to the node's children.</description>
|
||||
</struct>
|
||||
<typedef name="mxml_text_t">
|
||||
<type>struct mxml_text_s</type>
|
||||
<description>An XML text value.</description>
|
||||
<description>An XML text value. @private@</description>
|
||||
</typedef>
|
||||
<enumeration name="mxml_type_e">
|
||||
<description>The XML node type.</description>
|
||||
@ -1327,10 +1575,10 @@ the walk to the node's children.</description>
|
||||
</typedef>
|
||||
<typedef name="mxml_value_t">
|
||||
<type>union mxml_value_u</type>
|
||||
<description>An XML node value.</description>
|
||||
<description>An XML node value. @private@</description>
|
||||
</typedef>
|
||||
<union name="mxml_value_u">
|
||||
<description>An XML node value.</description>
|
||||
<description>An XML node value. @private@</description>
|
||||
<variable name="custom">
|
||||
<type>mxml_custom_t</type>
|
||||
<description>Custom data @since Mini-XML 2.1@</description>
|
||||
|
Loading…
Reference in New Issue
Block a user