Commit 0f8052e7 authored by Michael R Sweet's avatar Michael R Sweet

Add mxmlNewXML() function and use it.

More updates to the manual.
parent 94ad843d
CHANGES - 2007-04-18
CHANGES - 2007-04-19
--------------------
CHANGES IN Mini-XML 2.3
- Added two exceptions to the LGPL to support static
linking of applications against Mini-XML.
- Added mxmlElementSetAttrf() function (STR #43)
linking of applications against Mini-XML
- Added a mxmlNewXML() function
- Added a mxmlElementSetAttrf() function (STR #43)
- Added snprintf() emulation function for test program (STR
#32)
- Added the _CRT_SECURE_NO_DEPRECATE definition when
......@@ -15,31 +16,31 @@ CHANGES IN Mini-XML 2.3
- mxmlLoad*() did not detect missing close tags at the end
of an XML document (STR #45)
- Added user_data and ref_count members to mxml_node_t
structure.
structure
- Added mxmlReleaseNode() and mxmlRetainNode() APIs for
reference-counted nodes.
reference-counted nodes
- Added mxmlSetWrapMargin() to control the wrapping of XML
output.
output
- Added conditional check for EINTR error code for
certain Windows compilers that do not define it (STR
#33)
- The mxmldoc program now generates correct HTML 4.0
output (previously it generated invalid XHTML...)
output - previously it generated invalid XHTML
- The mxmldoc program now supports "@deprecated@,
"@private@", and "@since version@" comments.
"@private@", and "@since version@" comments
- Fixed function and enumeration type bugs in mxmldoc.
- Fixed XML schema for mxmldoc.
- Fixed the XML schema for mxmldoc
- The mxmldoc program now supports --intro, --section,
and --title options.
and --title options
- The mxmlLoad*() functions could leak a node on an error
(STR #27)
- The mxml_vsnprintf() function could get in an infinite
loop on a buffer overflow (STR #25)
- Added new mxmlNewCDATA() and mxmlSetCDATA() functions
to create and set CDATA nodes, which are really just
special element nodes.
special element nodes
- Added new MXML_IGNORE type and MXML_IGNORE_CB callback
to ignore non-element nodes (i.e. whitespace)
to ignore non-element nodes, e.g. whitespace
- mxmlLoad*() crashed when reporting an error in some
invalid XML (STR #23)
......
This diff is collapsed.
This diff is collapsed.
......@@ -71,6 +71,7 @@
<li><a href='#mxmlNewReal'><tt>mxmlNewReal()</tt></a> </li>
<li><a href='#mxmlNewText'><tt>mxmlNewText()</tt></a> </li>
<li><a href='#mxmlNewTextf'><tt>mxmlNewTextf()</tt></a> </li>
<li><a href='#mxmlNewXML'><tt>mxmlNewXML()</tt></a> <span class='info'>&nbsp;Mini-XML 2.3&nbsp;</span></li>
<li><a href='#mxmlRelease'><tt>mxmlRelease()</tt></a> <span class='info'>&nbsp;Mini-XML 2.3&nbsp;</span></li>
<li><a href='#mxmlRemove'><tt>mxmlRemove()</tt></a> </li>
<li><a href='#mxmlRetain'><tt>mxmlRetain()</tt></a> <span class='info'>&nbsp;Mini-XML 2.3&nbsp;</span></li>
......@@ -745,6 +746,29 @@ mxmlNewTextf(
<h4>Returns</h4>
<p>New node</p>
<!-- NEW PAGE -->
<h3 class='title'><span class='info'>&nbsp;Mini-XML 2.3&nbsp;</span><a name='mxmlNewXML'>mxmlNewXML()</a></h3>
<h4>Description</h4>
<p>Create a new XML document tree.
The &quot;version&quot; argument specifies the version number to put in the
?xml element node. If NULL, version 1.0 is assumed.
</p>
<h4>Syntax</h4>
<pre>
<a href='#mxml_node_t'>mxml_node_t</a> *
mxmlNewXML(
const char * version);
</pre>
<h4>Arguments</h4>
<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0'>
<thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody>
<tr><td><tt>version</tt></td><td>Version number to use</td></tr>
</tbody></table></div>
<h4>Returns</h4>
<p>New ?xml node</p>
<!-- NEW PAGE -->
<h3 class='title'><span class='info'>&nbsp;Mini-XML 2.3&nbsp;</span><a name='mxmlRelease'>mxmlRelease()</a></h3>
<h4>Description</h4>
<p>Release a node.
......
......@@ -8,12 +8,14 @@
<ul>
<li>Added two exceptions to the LGPL to support static
linking of applications against Mini-XML.</li>
linking of applications against Mini-XML</li>
<li>Added mxmlElementSetAttrf() function (STR #43)</li>
<li>Added a mxmlNewXML() function</li>
<li>Added snprintf() emulation function for test program
(STR #32)</li>
<li>Added a mxmlElementSetAttrf() function (STR #43)</li>
<li>Added a snprintf() emulation function for the test
program (STR #32)</li>
<li>Added the _CRT_SECURE_NO_DEPRECATE definition when
building on VC++ 2005 (STR #36)</li>
......@@ -21,52 +23,52 @@
<li>mxmlLoad*() did not detect missing > characters in
elements (STR #41)</li>
<li>mxmlLoad*() did not detect missing close tags at the end
of an XML document (STR #45)</li>
<li>mxmlLoad*() did not detect missing close tags at the
end of an XML document (STR #45)</li>
<li>Added user_data and ref_count members to mxml_node_t
structure.</li>
structure</li>
<li>Added mxmlReleaseNode() and mxmlRetainNode() APIs for
reference-counted nodes.</li>
reference-counted nodes</li>
<li>Added mxmlSetWrapMargin() to control the wrapping of XML
output.</li>
<li>Added mxmlSetWrapMargin() to control the wrapping of
XML output</li>
<li>Added conditional check for EINTR error code for
certain Windows compilers that do not define it (STR
#33)</li>
<li>The mxmldoc program now generates correct HTML 4.0
output (previously it generated invalid XHTML...)</li>
output - previously it generated invalid XHTML</li>
<li>The mxmldoc program now supports "@deprecated@,
"@private@", and "@since version@" comments.</li>
"@private@", and "@since version@" comments</li>
<li>Fixed function and enumeraion type bugs in
mxmldoc.</li>
<li>Fixed function and enumeration type bugs in
mxmldoc</li>
<li>Fixed XML schema for mxmldoc.</li>
<li>Fixed the XML schema for mxmldoc</li>
<li>The mxmldoc program now supports --intro, --section,
and --title options.</li>
and --title options</li>
<li>The mxmlLoad*() functions could leak a node on an
error (STR #27)</li>
<li>The mxml_vsnprintf() function could get in an infinite
loop on a buffer overflow (STR #25)</li>
<li>The mxml_vsnprintf() function could get in an
infinite loop on a buffer overflow (STR #25)</li>
<li>Added new mxmlNewCDATA() and mxmlSetCDATA() functions
to create and set CDATA nodes, which are really just
special element nodes.</li>
special element nodes</li>
<li>Added new MXML_IGNORE type and MXML_IGNORE_CB
callback to ignore non-element nodes (i.e.
whitespace)</li>
callback to ignore non-element nodes, e.g.
whitespace</li>
<li>mxmlLoad*() did not treat custom data as opaque, so
whitespace characters would be lost.</li>
whitespace characters would be lost</li>
</ul>
......
......@@ -27,6 +27,7 @@
* mxmlNewReal() - Create a new real number node.
* mxmlNewText() - Create a new text fragment node.
* mxmlNewTextf() - Create a new formatted text fragment node.
* mxmlNewXML() - Create a new XML document tree.
* mxmlRelease() - Release a node.
* mxmlRemove() - Remove a node from its parent.
* mxmlRetain() - Retain a node.
......@@ -655,6 +656,28 @@ mxmlRemove(mxml_node_t *node) /* I - Node to remove */
}
/*
* 'mxmlNewXML()' - Create a new XML document tree.
*
* The "version" argument specifies the version number to put in the
* ?xml element node. If NULL, version 1.0 is assumed.
*
* @since Mini-XML 2.3@
*/
mxml_node_t * /* O - New ?xml node */
mxmlNewXML(const char *version) /* I - Version number to use */
{
char element[1024]; /* Element text */
snprintf(element, sizeof(element), "?xml version=\"%s\"?",
version ? version : "1.0");
return (mxmlNewElement(NULL, element));
}
/*
* 'mxmlRelease()' - Release a node.
*
......
......@@ -207,6 +207,7 @@ extern mxml_node_t *mxmlNewTextf(mxml_node_t *parent, int whitespace,
__attribute__ ((__format__ (__printf__, 3, 4)))
# endif /* __GNUC__ */
;
extern mxml_node_t *mxmlNewXML(const char *version);
extern int mxmlRelease(mxml_node_t *node);
extern void mxmlRemove(mxml_node_t *node);
extern int mxmlRetain(mxml_node_t *node);
......
......@@ -512,6 +512,22 @@ string must be nul-terminated and is formatted into the new node.</description>
<type /> <description>Additional args as needed</description>
</argument>
</function>
<function name="mxmlNewXML">
<returnvalue>
<type>mxml_node_t *</type>
<description>New ?xml node</description>
</returnvalue>
<description>Create a new XML document tree.
The &quot;version&quot; argument specifies the version number to put in the
?xml element node. If NULL, version 1.0 is assumed.
@since Mini-XML 2.3@</description>
<argument name="version" direction="I">
<type>const char *</type>
<description>Version number to use</description>
</argument>
</function>
<function name="mxmlRelease">
<returnvalue>
<type>int</type>
......
......@@ -645,7 +645,7 @@ new_documentation(mxml_node_t **mxmldoc)/* O - mxmldoc node */
* Create an empty XML documentation file...
*/
doc = mxmlNewElement(NULL, "?xml version=\"1.0\"?");
doc = mxmlNewXML(NULL);
*mxmldoc = mxmlNewElement(doc, "mxmldoc");
......
......@@ -613,7 +613,7 @@ whitespace_cb(mxml_node_t *node, /* I - Element node */
else if (where == MXML_WS_AFTER_CLOSE)
return ("\n");
}
else if (!strcmp(name, "?xml"))
else if (!strncmp(name, "?xml", 4))
{
return (NULL);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment