|
|
@ -44,7 +44,20 @@ A { text-decoration: none } |
|
|
|
<B><A HREF="#BASICS">Getting Started with Mini-XML</A></B> |
|
|
|
<B><A HREF="#BASICS">Getting Started with Mini-XML</A></B> |
|
|
|
<UL> |
|
|
|
<UL> |
|
|
|
<LI><A HREF="#3_1">The Basics</A></LI> |
|
|
|
<LI><A HREF="#3_1">The Basics</A></LI> |
|
|
|
<LI><A HREF="#3_2">Nodes</A></LI> |
|
|
|
<LI><A HREF="#3_2">Nodes</A> |
|
|
|
|
|
|
|
<UL> |
|
|
|
|
|
|
|
<LI><A HREF="#3_2_1">CDATA Nodes</A></LI> |
|
|
|
|
|
|
|
<LI><A HREF="#3_2_2">Custom Nodes</A></LI> |
|
|
|
|
|
|
|
<LI><A HREF="#3_2_3">Comment Nodes</A></LI> |
|
|
|
|
|
|
|
<LI><A HREF="#3_2_4">Element Nodes</A></LI> |
|
|
|
|
|
|
|
<LI><A HREF="#3_2_5">Integer Nodes</A></LI> |
|
|
|
|
|
|
|
<LI><A HREF="#3_2_6">Opaque Nodes</A></LI> |
|
|
|
|
|
|
|
<LI><A HREF="#3_2_7">Text Nodes</A></LI> |
|
|
|
|
|
|
|
<LI><A HREF="#3_2_8">Processing Instruction Nodes</A></LI> |
|
|
|
|
|
|
|
<LI><A HREF="#3_2_9">Real Number Nodes</A></LI> |
|
|
|
|
|
|
|
<LI><A HREF="#3_2_10">XML Declaration Nodes</A></LI> |
|
|
|
|
|
|
|
</UL> |
|
|
|
|
|
|
|
</LI> |
|
|
|
<LI><A HREF="#3_3">Creating XML Documents</A></LI> |
|
|
|
<LI><A HREF="#3_3">Creating XML Documents</A></LI> |
|
|
|
<LI><A HREF="#3_4">Loading XML</A></LI> |
|
|
|
<LI><A HREF="#3_4">Loading XML</A></LI> |
|
|
|
<LI><A HREF="#3_5">Saving XML</A> |
|
|
|
<LI><A HREF="#3_5">Saving XML</A> |
|
|
@ -52,8 +65,9 @@ A { text-decoration: none } |
|
|
|
<LI><A HREF="#3_5_1">Controlling Line Wrapping</A></LI> |
|
|
|
<LI><A HREF="#3_5_1">Controlling Line Wrapping</A></LI> |
|
|
|
</UL> |
|
|
|
</UL> |
|
|
|
</LI> |
|
|
|
</LI> |
|
|
|
<LI><A HREF="#3_6">Finding and Iterating Nodes</A></LI> |
|
|
|
<LI><A HREF="#3_6">Memory Management</A></LI> |
|
|
|
<LI><A HREF="#3_7">Finding Value Nodes</A></LI> |
|
|
|
<LI><A HREF="#3_7">Finding and Iterating Nodes</A></LI> |
|
|
|
|
|
|
|
<LI><A HREF="#3_8">Finding Specific Nodes</A></LI> |
|
|
|
</UL> |
|
|
|
</UL> |
|
|
|
<B><A HREF="#ADVANCED">More Mini-XML Programming Techniques</A></B> |
|
|
|
<B><A HREF="#ADVANCED">More Mini-XML Programming Techniques</A></B> |
|
|
|
<UL> |
|
|
|
<UL> |
|
|
@ -96,51 +110,52 @@ A { text-decoration: none } |
|
|
|
<LI><A HREF="#mxmlEntityGetValue">mxmlEntityGetValue</A></LI> |
|
|
|
<LI><A HREF="#mxmlEntityGetValue">mxmlEntityGetValue</A></LI> |
|
|
|
<LI><A HREF="#mxmlEntityRemoveCallback">mxmlEntityRemoveCallback</A></LI> |
|
|
|
<LI><A HREF="#mxmlEntityRemoveCallback">mxmlEntityRemoveCallback</A></LI> |
|
|
|
<LI><A HREF="#mxmlFindElement">mxmlFindElement</A></LI> |
|
|
|
<LI><A HREF="#mxmlFindElement">mxmlFindElement</A></LI> |
|
|
|
<LI><A HREF="#8_2_12">mxmlFindValue</A></LI> |
|
|
|
<LI><A HREF="#8_2_12">mxmlFindPath</A></LI> |
|
|
|
<LI><A HREF="#8_2_13">mxmlGetCDATA</A></LI> |
|
|
|
<LI><A HREF="#8_2_13">mxmlGetCDATA</A></LI> |
|
|
|
<LI><A HREF="#8_2_14">mxmlGetCustom</A></LI> |
|
|
|
<LI><A HREF="#8_2_14">mxmlGetCustom</A></LI> |
|
|
|
<LI><A HREF="#8_2_15">mxmlGetElement</A></LI> |
|
|
|
<LI><A HREF="#8_2_15">mxmlGetElement</A></LI> |
|
|
|
<LI><A HREF="#8_2_16">mxmlGetFirstChild</A></LI> |
|
|
|
<LI><A HREF="#8_2_16">mxmlGetFirstChild</A></LI> |
|
|
|
<LI><A HREF="#8_2_17">mxmlGetInteger</A></LI> |
|
|
|
<LI><A HREF="#8_2_17">mxmlGetInteger</A></LI> |
|
|
|
<LI><A HREF="#8_2_18">mxmlGetLastChild</A></LI> |
|
|
|
<LI><A HREF="#8_2_18">mxmlGetLastChild</A></LI> |
|
|
|
<LI><A HREF="#mxmlGetNext">mxmlGetNext</A></LI> |
|
|
|
<LI><A HREF="#mxmlGetNextSibling">mxmlGetNextSibling</A></LI> |
|
|
|
<LI><A HREF="#8_2_20">mxmlGetOpaque</A></LI> |
|
|
|
<LI><A HREF="#8_2_20">mxmlGetOpaque</A></LI> |
|
|
|
<LI><A HREF="#8_2_21">mxmlGetParent</A></LI> |
|
|
|
<LI><A HREF="#8_2_21">mxmlGetParent</A></LI> |
|
|
|
<LI><A HREF="#8_2_22">mxmlGetPrevious</A></LI> |
|
|
|
<LI><A HREF="#8_2_22">mxmlGetPrevSibling</A></LI> |
|
|
|
<LI><A HREF="#8_2_23">mxmlGetReal</A></LI> |
|
|
|
<LI><A HREF="#8_2_23">mxmlGetReal</A></LI> |
|
|
|
<LI><A HREF="#8_2_24">mxmlGetText</A></LI> |
|
|
|
<LI><A HREF="#8_2_24">mxmlGetRefCount</A></LI> |
|
|
|
<LI><A HREF="#8_2_25">mxmlGetType</A></LI> |
|
|
|
<LI><A HREF="#8_2_25">mxmlGetText</A></LI> |
|
|
|
<LI><A HREF="#8_2_26">mxmlGetUserData</A></LI> |
|
|
|
<LI><A HREF="#8_2_26">mxmlGetType</A></LI> |
|
|
|
|
|
|
|
<LI><A HREF="#8_2_27">mxmlGetUserData</A></LI> |
|
|
|
<LI><A HREF="#mxmlIndexDelete">mxmlIndexDelete</A></LI> |
|
|
|
<LI><A HREF="#mxmlIndexDelete">mxmlIndexDelete</A></LI> |
|
|
|
<LI><A HREF="#mxmlIndexEnum">mxmlIndexEnum</A></LI> |
|
|
|
<LI><A HREF="#mxmlIndexEnum">mxmlIndexEnum</A></LI> |
|
|
|
<LI><A HREF="#mxmlIndexFind">mxmlIndexFind</A></LI> |
|
|
|
<LI><A HREF="#mxmlIndexFind">mxmlIndexFind</A></LI> |
|
|
|
<LI><A HREF="#8_2_30">mxmlIndexGetCount</A></LI> |
|
|
|
<LI><A HREF="#8_2_31">mxmlIndexGetCount</A></LI> |
|
|
|
<LI><A HREF="#mxmlIndexNew">mxmlIndexNew</A></LI> |
|
|
|
<LI><A HREF="#mxmlIndexNew">mxmlIndexNew</A></LI> |
|
|
|
<LI><A HREF="#mxmlIndexReset">mxmlIndexReset</A></LI> |
|
|
|
<LI><A HREF="#mxmlIndexReset">mxmlIndexReset</A></LI> |
|
|
|
<LI><A HREF="#mxmlLoadFd">mxmlLoadFd</A></LI> |
|
|
|
<LI><A HREF="#mxmlLoadFd">mxmlLoadFd</A></LI> |
|
|
|
<LI><A HREF="#mxmlLoadFile">mxmlLoadFile</A></LI> |
|
|
|
<LI><A HREF="#mxmlLoadFile">mxmlLoadFile</A></LI> |
|
|
|
<LI><A HREF="#mxmlLoadString">mxmlLoadString</A></LI> |
|
|
|
<LI><A HREF="#mxmlLoadString">mxmlLoadString</A></LI> |
|
|
|
<LI><A HREF="#8_2_36">mxmlNewCDATA</A></LI> |
|
|
|
<LI><A HREF="#8_2_37">mxmlNewCDATA</A></LI> |
|
|
|
<LI><A HREF="#8_2_37">mxmlNewCustom</A></LI> |
|
|
|
<LI><A HREF="#8_2_38">mxmlNewCustom</A></LI> |
|
|
|
<LI><A HREF="#mxmlNewElement">mxmlNewElement</A></LI> |
|
|
|
<LI><A HREF="#mxmlNewElement">mxmlNewElement</A></LI> |
|
|
|
<LI><A HREF="#mxmlNewInteger">mxmlNewInteger</A></LI> |
|
|
|
<LI><A HREF="#mxmlNewInteger">mxmlNewInteger</A></LI> |
|
|
|
<LI><A HREF="#mxmlNewOpaque">mxmlNewOpaque</A></LI> |
|
|
|
<LI><A HREF="#mxmlNewOpaque">mxmlNewOpaque</A></LI> |
|
|
|
<LI><A HREF="#mxmlNewReal">mxmlNewReal</A></LI> |
|
|
|
<LI><A HREF="#mxmlNewReal">mxmlNewReal</A></LI> |
|
|
|
<LI><A HREF="#mxmlNewText">mxmlNewText</A></LI> |
|
|
|
<LI><A HREF="#mxmlNewText">mxmlNewText</A></LI> |
|
|
|
<LI><A HREF="#mxmlNewTextf">mxmlNewTextf</A></LI> |
|
|
|
<LI><A HREF="#mxmlNewTextf">mxmlNewTextf</A></LI> |
|
|
|
<LI><A HREF="#8_2_44">mxmlNewXML</A></LI> |
|
|
|
<LI><A HREF="#8_2_45">mxmlNewXML</A></LI> |
|
|
|
<LI><A HREF="#8_2_45">mxmlRelease</A></LI> |
|
|
|
<LI><A HREF="#8_2_46">mxmlRelease</A></LI> |
|
|
|
<LI><A HREF="#mxmlRemove">mxmlRemove</A></LI> |
|
|
|
<LI><A HREF="#mxmlRemove">mxmlRemove</A></LI> |
|
|
|
<LI><A HREF="#8_2_47">mxmlRetain</A></LI> |
|
|
|
<LI><A HREF="#8_2_48">mxmlRetain</A></LI> |
|
|
|
<LI><A HREF="#8_2_48">mxmlSAXLoadFd</A></LI> |
|
|
|
<LI><A HREF="#8_2_49">mxmlSAXLoadFd</A></LI> |
|
|
|
<LI><A HREF="#8_2_49">mxmlSAXLoadFile</A></LI> |
|
|
|
<LI><A HREF="#8_2_50">mxmlSAXLoadFile</A></LI> |
|
|
|
<LI><A HREF="#8_2_50">mxmlSAXLoadString</A></LI> |
|
|
|
<LI><A HREF="#8_2_51">mxmlSAXLoadString</A></LI> |
|
|
|
<LI><A HREF="#mxmlSaveAllocString">mxmlSaveAllocString</A></LI> |
|
|
|
<LI><A HREF="#mxmlSaveAllocString">mxmlSaveAllocString</A></LI> |
|
|
|
<LI><A HREF="#mxmlSaveFd">mxmlSaveFd</A></LI> |
|
|
|
<LI><A HREF="#mxmlSaveFd">mxmlSaveFd</A></LI> |
|
|
|
<LI><A HREF="#mxmlSaveFile">mxmlSaveFile</A></LI> |
|
|
|
<LI><A HREF="#mxmlSaveFile">mxmlSaveFile</A></LI> |
|
|
|
<LI><A HREF="#mxmlSaveString">mxmlSaveString</A></LI> |
|
|
|
<LI><A HREF="#mxmlSaveString">mxmlSaveString</A></LI> |
|
|
|
<LI><A HREF="#8_2_55">mxmlSetCDATA</A></LI> |
|
|
|
<LI><A HREF="#8_2_56">mxmlSetCDATA</A></LI> |
|
|
|
<LI><A HREF="#8_2_56">mxmlSetCustom</A></LI> |
|
|
|
<LI><A HREF="#8_2_57">mxmlSetCustom</A></LI> |
|
|
|
<LI><A HREF="#mxmlSetCustomHandlers">mxmlSetCustomHandlers</A></LI> |
|
|
|
<LI><A HREF="#mxmlSetCustomHandlers">mxmlSetCustomHandlers</A></LI> |
|
|
|
<LI><A HREF="#mxmlSetElement">mxmlSetElement</A></LI> |
|
|
|
<LI><A HREF="#mxmlSetElement">mxmlSetElement</A></LI> |
|
|
|
<LI><A HREF="#mxmlSetErrorCallback">mxmlSetErrorCallback</A></LI> |
|
|
|
<LI><A HREF="#mxmlSetErrorCallback">mxmlSetErrorCallback</A></LI> |
|
|
@ -149,8 +164,8 @@ A { text-decoration: none } |
|
|
|
<LI><A HREF="#mxmlSetReal">mxmlSetReal</A></LI> |
|
|
|
<LI><A HREF="#mxmlSetReal">mxmlSetReal</A></LI> |
|
|
|
<LI><A HREF="#mxmlSetText">mxmlSetText</A></LI> |
|
|
|
<LI><A HREF="#mxmlSetText">mxmlSetText</A></LI> |
|
|
|
<LI><A HREF="#mxmlSetTextf">mxmlSetTextf</A></LI> |
|
|
|
<LI><A HREF="#mxmlSetTextf">mxmlSetTextf</A></LI> |
|
|
|
<LI><A HREF="#8_2_65">mxmlSetUserData</A></LI> |
|
|
|
<LI><A HREF="#8_2_66">mxmlSetUserData</A></LI> |
|
|
|
<LI><A HREF="#8_2_66">mxmlSetWrapMargin</A></LI> |
|
|
|
<LI><A HREF="#8_2_67">mxmlSetWrapMargin</A></LI> |
|
|
|
<LI><A HREF="#mxmlWalkNext">mxmlWalkNext</A></LI> |
|
|
|
<LI><A HREF="#mxmlWalkNext">mxmlWalkNext</A></LI> |
|
|
|
<LI><A HREF="#mxmlWalkPrev">mxmlWalkPrev</A></LI> |
|
|
|
<LI><A HREF="#mxmlWalkPrev">mxmlWalkPrev</A></LI> |
|
|
|
</UL> |
|
|
|
</UL> |
|
|
@ -203,7 +218,7 @@ libxml2</TT> library with something substantially smaller and |
|
|
|
libxml2.</P> |
|
|
|
libxml2.</P> |
|
|
|
<P>Thanks to lots of feedback and support from various developers, |
|
|
|
<P>Thanks to lots of feedback and support from various developers, |
|
|
|
Mini-XML has evolved since then to provide a more complete XML |
|
|
|
Mini-XML has evolved since then to provide a more complete XML |
|
|
|
implementation and now stands at a whopping 3,747 lines of code, |
|
|
|
implementation and now stands at a whopping 3,965 lines of code, |
|
|
|
compared to 103,893 lines of code for libxml2 version 2.6.9.</P> |
|
|
|
compared to 103,893 lines of code for libxml2 version 2.6.9.</P> |
|
|
|
<P>Aside from Gutenprint, Mini-XML is used for the following |
|
|
|
<P>Aside from Gutenprint, Mini-XML is used for the following |
|
|
|
projects/software applications:</P> |
|
|
|
projects/software applications:</P> |
|
|
@ -386,7 +401,7 @@ rpmbuild(8)</TT> software to create Red Hat Package Manager ("RPM") |
|
|
|
epm(1)</TT> program to create software packages in a variety of formats. |
|
|
|
epm(1)</TT> program to create software packages in a variety of formats. |
|
|
|
The <TT>epm</TT> program is available from the following URL:</P> |
|
|
|
The <TT>epm</TT> program is available from the following URL:</P> |
|
|
|
<PRE> |
|
|
|
<PRE> |
|
|
|
<A href="http://www.easysw.com/epm/">http://www.easysw.com/epm/</A> |
|
|
|
<A href="http://www.epmhome.org/">http://www.epmhome.org/</A> |
|
|
|
</PRE> |
|
|
|
</PRE> |
|
|
|
<P>Use the <TT>make</TT> command with the <KBD>epm</KBD> target to |
|
|
|
<P>Use the <TT>make</TT> command with the <KBD>epm</KBD> target to |
|
|
|
create portable and native packages for your system:</P> |
|
|
|
create portable and native packages for your system:</P> |
|
|
@ -413,7 +428,7 @@ hspace="10" src="2.gif" width="100"></A>Getting Started with Mini-XML</H1> |
|
|
|
<LI>Writing of UTF-8 encoded XML files and strings.</LI> |
|
|
|
<LI>Writing of UTF-8 encoded XML files and strings.</LI> |
|
|
|
<LI>Support for arbitrary element names, attributes, and attribute |
|
|
|
<LI>Support for arbitrary element names, attributes, and attribute |
|
|
|
values with no preset limits, just available memory.</LI> |
|
|
|
values with no preset limits, just available memory.</LI> |
|
|
|
<LI>Support for integer, real, opaque ("cdata"), and text data types in |
|
|
|
<LI>Support for integer, real, opaque ("CDATA"), and text data types in |
|
|
|
"leaf" nodes.</LI> |
|
|
|
"leaf" nodes.</LI> |
|
|
|
<LI>"Find", "index", and "walk" functions for easily accessing data in |
|
|
|
<LI>"Find", "index", and "walk" functions for easily accessing data in |
|
|
|
an XML document.</LI> |
|
|
|
an XML document.</LI> |
|
|
@ -440,47 +455,12 @@ hspace="10" src="2.gif" width="100"></A>Getting Started with Mini-XML</H1> |
|
|
|
<KBD>pkg-config --libs mxml ENTER</KBD> |
|
|
|
<KBD>pkg-config --libs mxml ENTER</KBD> |
|
|
|
</PRE> |
|
|
|
</PRE> |
|
|
|
<H2><A NAME="3_2">Nodes</A></H2> |
|
|
|
<H2><A NAME="3_2">Nodes</A></H2> |
|
|
|
<P>Every piece of information in an XML file (elements, text, numbers) |
|
|
|
<P>Every piece of information in an XML file is stored in memory in |
|
|
|
is stored in memory in "nodes". Nodes are defined by the <A href="#mxml_node_t"> |
|
|
|
"nodes". Nodes are defined by the <A href="#mxml_node_t"><TT> |
|
|
|
<TT>mxml_node_t</TT></A> structure. The <A href="#mxml_type_t"><TT>type</TT> |
|
|
|
mxml_node_t</TT></A> structure. Each node has a typed value, optional |
|
|
|
</A> member defines the node type (element, integer, opaque, real, or |
|
|
|
user data, a parent node, sibling nodes (previous and next), and |
|
|
|
text) which determines which value you want to look at in the <A href="#mxml_value_t"> |
|
|
|
potentially child nodes.</P> |
|
|
|
<TT>value</TT></A> union.</P> |
|
|
|
<P>For example, if you have an XML file like the following:</P> |
|
|
|
|
|
|
|
|
|
|
|
<!-- NEED 10 --> |
|
|
|
|
|
|
|
<CENTER> |
|
|
|
|
|
|
|
<TABLE border="1" cellpadding="5" cellspacing="0" summary="Mini-XML Node Value Members" |
|
|
|
|
|
|
|
width="80%"><CAPTION align="bottom"><I> Table 2-1: Mini-XML Node Value |
|
|
|
|
|
|
|
Members</I></CAPTION> |
|
|
|
|
|
|
|
<TR bgcolor="#cccccc"><TH>Value</TH><TH>Type</TH><TH>Node member</TH></TR> |
|
|
|
|
|
|
|
<TR><TD>Custom</TD><TD><TT>void *</TT></TD><TD><TT> |
|
|
|
|
|
|
|
node->value.custom.data</TT></TD></TR> |
|
|
|
|
|
|
|
<TR><TD>Element</TD><TD><TT>char *</TT></TD><TD><TT> |
|
|
|
|
|
|
|
node->value.element.name</TT></TD></TR> |
|
|
|
|
|
|
|
<TR><TD>Integer</TD><TD><TT>int</TT></TD><TD><TT>node->value.integer</TT> |
|
|
|
|
|
|
|
</TD></TR> |
|
|
|
|
|
|
|
<TR><TD>Opaque (string)</TD><TD><TT>char *</TT></TD><TD><TT> |
|
|
|
|
|
|
|
node->value.opaque</TT></TD></TR> |
|
|
|
|
|
|
|
<TR><TD>Real</TD><TD><TT>double</TT></TD><TD><TT>node->value.real</TT></TD> |
|
|
|
|
|
|
|
</TR> |
|
|
|
|
|
|
|
<TR><TD>Text</TD><TD><TT>char *</TT></TD><TD><TT>node->value.text.string</TT> |
|
|
|
|
|
|
|
</TD></TR> |
|
|
|
|
|
|
|
</TABLE> |
|
|
|
|
|
|
|
</CENTER> |
|
|
|
|
|
|
|
<P>Each node also has a <TT>user_data</TT> member which allows you to |
|
|
|
|
|
|
|
associate application-specific data with each node as needed.</P> |
|
|
|
|
|
|
|
<P>New nodes are created using the <A href="#mxmlNewElement"><TT> |
|
|
|
|
|
|
|
mxmlNewElement</TT></A>, <A href="#mxmlNewInteger"><TT>mxmlNewInteger</TT> |
|
|
|
|
|
|
|
</A>, <A href="#mxmlNewOpaque"><TT>mxmlNewOpaque</TT></A>, <A href="#mxmlNewReal"> |
|
|
|
|
|
|
|
<TT>mxmlNewReal</TT></A>, <A href="#mxmlNewText"><TT>mxmlNewText</TT></A> |
|
|
|
|
|
|
|
, <A href="#mxmlNewTextf"><TT>mxmlNewTextf</TT></A>, and <A href="#mxmlNewXML"> |
|
|
|
|
|
|
|
<TT>mxmlNewXML</TT></A> functions. Only elements can have child nodes, |
|
|
|
|
|
|
|
and the top node must be an element, usually the <TT><?xml |
|
|
|
|
|
|
|
version="1.0" encoding="utf-8"?></TT> node created by <TT>mxmlNewXML()</TT> |
|
|
|
|
|
|
|
.</P> |
|
|
|
|
|
|
|
<P>Nodes have pointers to the node above (<TT>parent</TT>), below (<TT> |
|
|
|
|
|
|
|
child</TT>), left (<TT>prev</TT>), and right (<TT>next</TT>) of the |
|
|
|
|
|
|
|
current node. If you have an XML file like the following:</P> |
|
|
|
|
|
|
|
<PRE> |
|
|
|
<PRE> |
|
|
|
<?xml version="1.0" encoding="utf-8"?> |
|
|
|
<?xml version="1.0" encoding="utf-8"?> |
|
|
|
<data> |
|
|
|
<data> |
|
|
@ -510,15 +490,96 @@ child</TT>), left (<TT>prev</TT>), and right (<TT>next</TT>) of the |
|
|
|
| | | |
|
|
|
| | | |
|
|
|
val4 val5 val6 |
|
|
|
val4 val5 val6 |
|
|
|
</PRE> |
|
|
|
</PRE> |
|
|
|
<P>where "-" is a pointer to the next node and "|" is a pointer to the |
|
|
|
<P>where "-" is a pointer to the sibling node and "|" is a pointer to |
|
|
|
first child node.</P> |
|
|
|
the first child or parent node.</P> |
|
|
|
<P>Once you are done with the XML data, use the <A href="#mxmlDelete"><TT> |
|
|
|
<P>The <A href="#mxmlGetType"><TT>mxmlGetType</TT></A> function gets the |
|
|
|
mxmlDelete</TT></A> function to recursively free the memory that is used |
|
|
|
type of a node, one of <TT>MXML_CUSTOM</TT>, <TT>MXML_ELEMENT</TT>, <TT> |
|
|
|
for a particular node or the entire tree:</P> |
|
|
|
MXML_INTEGER</TT>, <TT>MXML_OPAQUE</TT>, <TT>MXML_REAL</TT>, or <TT> |
|
|
|
<PRE> |
|
|
|
MXML_TEXT</TT>. The parent and sibling nodes are accessed using the <A href="#mxmlGetParent"> |
|
|
|
mxmlDelete(tree); |
|
|
|
<TT>mxmlGetParent</TT></A>, <A href="#mxmlGetNext"><TT>mxmlGetNext</TT></A> |
|
|
|
</PRE> |
|
|
|
, and <A href="#mxmlGetPrevious"><TT>mxmlGetPrevious</TT></A> functions. |
|
|
|
|
|
|
|
The <A href="#mxmlGetUserData"><TT>mxmlGetUserData</TT></A> function |
|
|
|
|
|
|
|
gets any user data associated with the node.</P> |
|
|
|
|
|
|
|
<H3><A NAME="3_2_1">CDATA Nodes</A></H3> |
|
|
|
|
|
|
|
<P>CDATA (<TT>MXML_ELEMENT</TT>) nodes are created using the <A href="#mxmlNewCDATA"> |
|
|
|
|
|
|
|
<TT>mxmlNewCDATA</TT></A> function. The <A href="#mxmlGetCDATA"><TT> |
|
|
|
|
|
|
|
mxmlGetCDATA</TT></A> function retrieves the CDATA string pointer for a |
|
|
|
|
|
|
|
node.</P> |
|
|
|
|
|
|
|
<BLOCKQUOTE><B>Note:</B> |
|
|
|
|
|
|
|
<P>CDATA nodes are currently stored in memory as special elements. This |
|
|
|
|
|
|
|
will be changed in a future major release of Mini-XML.</P> |
|
|
|
|
|
|
|
</BLOCKQUOTE> |
|
|
|
|
|
|
|
<H3><A NAME="3_2_2">Custom Nodes</A></H3> |
|
|
|
|
|
|
|
<P>Custom (<TT>MXML_CUSTOM</TT>) nodes are created using the <A href="#mxmlNewCustom"> |
|
|
|
|
|
|
|
<TT>mxmlNewCustom</TT></A> function or using a custom load callback |
|
|
|
|
|
|
|
specified using the <A href="#mxmlSetCustomHandlers"><TT> |
|
|
|
|
|
|
|
mxmlSetCustomHandlers</TT></A> function. The <A href="#mxmlGetCustom"><TT> |
|
|
|
|
|
|
|
mxmlGetCustom</TT></A> function retrieves the custom value pointer for a |
|
|
|
|
|
|
|
node.</P> |
|
|
|
|
|
|
|
<H3><A NAME="3_2_3">Comment Nodes</A></H3> |
|
|
|
|
|
|
|
<P>Comment (<TT>MXML_ELEMENT</TT>) nodes are created using the <A href="#mxmlNewElement"> |
|
|
|
|
|
|
|
<TT>mxmlNewElement</TT></A> function. The <A href="#mxmlGetElement"><TT> |
|
|
|
|
|
|
|
mxmlGetElement</TT></A> function retrieves the comment string pointer |
|
|
|
|
|
|
|
for a node, including the surrounding "!--" and "--" characters.</P> |
|
|
|
|
|
|
|
<BLOCKQUOTE><B>Note:</B> |
|
|
|
|
|
|
|
<P>Comment nodes are currently stored in memory as special elements. |
|
|
|
|
|
|
|
This will be changed in a future major release of Mini-XML.</P> |
|
|
|
|
|
|
|
</BLOCKQUOTE> |
|
|
|
|
|
|
|
<H3><A NAME="3_2_4">Element Nodes</A></H3> |
|
|
|
|
|
|
|
<P>Element (<TT>MXML_ELEMENT</TT>) nodes are created using the <A href="#mxmlNewElement"> |
|
|
|
|
|
|
|
<TT>mxmlNewElement</TT></A> function. The <A href="#mxmlGetElement"><TT> |
|
|
|
|
|
|
|
mxmlGetElement</TT></A> function retrieves the element name, the <A href="#mxmlElementGetAttr"> |
|
|
|
|
|
|
|
<TT>mxmlElementGetAttr</TT></A> function retrieves the value string for |
|
|
|
|
|
|
|
a named attribute associated with the element, and the <A href="#mxmlGetFirstChild"> |
|
|
|
|
|
|
|
<TT>mxmlGetFirstChild</TT></A> and <A href="#mxmlGetLastChild"><TT> |
|
|
|
|
|
|
|
mxmlGetLastChild</TT></A> functions retrieve the first and last child |
|
|
|
|
|
|
|
nodes for the element, respectively.</P> |
|
|
|
|
|
|
|
<H3><A NAME="3_2_5">Integer Nodes</A></H3> |
|
|
|
|
|
|
|
<P>Integer (<TT>MXML_INTEGER</TT>) nodes are created using the <A href="#mxmlNewInteger"> |
|
|
|
|
|
|
|
<TT>mxmlNewInteger</TT></A> function. The <A href="#mxmlGetInteger"><TT> |
|
|
|
|
|
|
|
mxmlGetInteger</TT></A> function retrieves the integer value for a node.</P> |
|
|
|
|
|
|
|
<H3><A NAME="3_2_6">Opaque Nodes</A></H3> |
|
|
|
|
|
|
|
<P>Opaque (<TT>MXML_OPAQUE</TT>) nodes are created using the <A href="#mxmlNewOpaque"> |
|
|
|
|
|
|
|
<TT>mxmlNewOpaque</TT></A> function. The <A href="#mxmlGetOpaque"><TT> |
|
|
|
|
|
|
|
mxmlGetOpaque</TT></A> function retrieves the opaque string pointer for |
|
|
|
|
|
|
|
a node. Opaque nodes are like string nodes but preserve all whitespace |
|
|
|
|
|
|
|
between nodes.</P> |
|
|
|
|
|
|
|
<H3><A NAME="3_2_7">Text Nodes</A></H3> |
|
|
|
|
|
|
|
<P>Text (<TT>MXML_TEXT</TT>) nodes are created using the <A href="#mxmlNewText"> |
|
|
|
|
|
|
|
<TT>mxmlNewText</TT></A> and <A href="#mxmlNewTextf"><TT>mxmlNewTextf</TT> |
|
|
|
|
|
|
|
</A> functions. Each text node consists of a text string and (leading) |
|
|
|
|
|
|
|
whitespace value - the <A href="#mxmlGetText"><TT>mxmlGetText</TT></A> |
|
|
|
|
|
|
|
function retrieves the text string pointer and whitespace value for a |
|
|
|
|
|
|
|
node.</P> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- NEED 12 --> |
|
|
|
|
|
|
|
<H3><A NAME="3_2_8">Processing Instruction Nodes</A></H3> |
|
|
|
|
|
|
|
<P>Processing instruction (<TT>MXML_ELEMENT</TT>) nodes are created |
|
|
|
|
|
|
|
using the <A href="#mxmlNewElement"><TT>mxmlNewElement</TT></A> |
|
|
|
|
|
|
|
function. The <A href="#mxmlGetElement"><TT>mxmlGetElement</TT></A> |
|
|
|
|
|
|
|
function retrieves the processing instruction string for a node, |
|
|
|
|
|
|
|
including the surrounding "?" characters.</P> |
|
|
|
|
|
|
|
<BLOCKQUOTE><B>Note:</B> |
|
|
|
|
|
|
|
<P>Processing instruction nodes are currently stored in memory as |
|
|
|
|
|
|
|
special elements. This will be changed in a future major release of |
|
|
|
|
|
|
|
Mini-XML.</P> |
|
|
|
|
|
|
|
</BLOCKQUOTE> |
|
|
|
|
|
|
|
<H3><A NAME="3_2_9">Real Number Nodes</A></H3> |
|
|
|
|
|
|
|
<P>Real number (<TT>MXML_REAL</TT>) nodes are created using the <A href="#mxmlNewReal"> |
|
|
|
|
|
|
|
<TT>mxmlNewReal</TT></A> function. The <A href="#mxmlGetReal"><TT> |
|
|
|
|
|
|
|
mxmlGetReal</TT></A> function retrieves the CDATA string pointer for a |
|
|
|
|
|
|
|
node.</P> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- NEED 15 --> |
|
|
|
|
|
|
|
<H3><A NAME="3_2_10">XML Declaration Nodes</A></H3> |
|
|
|
|
|
|
|
<P>XML declaration (<TT>MXML_ELEMENT</TT>) nodes are created using the <A |
|
|
|
|
|
|
|
href="#mxmlNewXML"><TT>mxmlNewXML</TT></A> function. The <A href="#mxmlGetElement"> |
|
|
|
|
|
|
|
<TT>mxmlGetElement</TT></A> function retrieves the XML declaration |
|
|
|
|
|
|
|
string for a node, including the surrounding "?" characters.</P> |
|
|
|
|
|
|
|
<BLOCKQUOTE><B>Note:</B> |
|
|
|
|
|
|
|
<P>XML declaration nodes are currently stored in memory as special |
|
|
|
|
|
|
|
elements. This will be changed in a future major release of Mini-XML.</P> |
|
|
|
|
|
|
|
</BLOCKQUOTE> |
|
|
|
<!-- NEW PAGE --> |
|
|
|
<!-- NEW PAGE --> |
|
|
|
<H2><A NAME="3_3">Creating XML Documents</A></H2> |
|
|
|
<H2><A NAME="3_3">Creating XML Documents</A></H2> |
|
|
|
<P>You can create and update XML documents in memory using the various <TT> |
|
|
|
<P>You can create and update XML documents in memory using the various <TT> |
|
|
@ -555,9 +616,10 @@ mxmlNew</TT> functions. The following code will create the XML document |
|
|
|
node = mxmlNewElement(data, "node"); |
|
|
|
node = mxmlNewElement(data, "node"); |
|
|
|
mxmlNewText(node, 0, "val8"); |
|
|
|
mxmlNewText(node, 0, "val8"); |
|
|
|
</PRE> |
|
|
|
</PRE> |
|
|
|
<P>We start by creating the <TT><?xml version="1.0" encoding="utf-8"?></TT> |
|
|
|
|
|
|
|
node common to all XML files using the <A href="#mxmlNewXML"><TT> |
|
|
|
<!-- NEED 6 --> |
|
|
|
mxmlNewXML</TT></A> function:</P> |
|
|
|
<P>We start by creating the declaration node common to all XML files |
|
|
|
|
|
|
|
using the <A href="#mxmlNewXML"><TT>mxmlNewXML</TT></A> function:</P> |
|
|
|
<PRE> |
|
|
|
<PRE> |
|
|
|
xml = mxmlNewXML("1.0"); |
|
|
|
xml = mxmlNewXML("1.0"); |
|
|
|
</PRE> |
|
|
|
</PRE> |
|
|
@ -581,7 +643,7 @@ mxmlNewElement</TT> and <A href="#mxmlNewText"><TT>mxmlNewText</TT></A> |
|
|
|
<P>The resulting in-memory XML document can then be saved or processed |
|
|
|
<P>The resulting in-memory XML document can then be saved or processed |
|
|
|
just like one loaded from disk or a string.</P> |
|
|
|
just like one loaded from disk or a string.</P> |
|
|
|
|
|
|
|
|
|
|
|
<!-- NEW PAGE --> |
|
|
|
<!-- NEED 15 --> |
|
|
|
<H2><A NAME="3_4">Loading XML</A></H2> |
|
|
|
<H2><A NAME="3_4">Loading XML</A></H2> |
|
|
|
<P>You load an XML file using the <A href="#mxmlLoadFile"><TT> |
|
|
|
<P>You load an XML file using the <A href="#mxmlLoadFile"><TT> |
|
|
|
mxmlLoadFile</TT></A> function:</P> |
|
|
|
mxmlLoadFile</TT></A> function:</P> |
|
|
@ -629,7 +691,7 @@ mxmlLoadFile()</TT>. The second argument specifies the string or |
|
|
|
character buffer to load and must be a complete XML document including |
|
|
|
character buffer to load and must be a complete XML document including |
|
|
|
the <TT>?xml</TT> element if the parent node is <TT>NULL</TT>.</P> |
|
|
|
the <TT>?xml</TT> element if the parent node is <TT>NULL</TT>.</P> |
|
|
|
|
|
|
|
|
|
|
|
<!-- NEW PAGE --> |
|
|
|
<!-- NEED 15 --> |
|
|
|
<H2><A NAME="3_5">Saving XML</A></H2> |
|
|
|
<H2><A NAME="3_5">Saving XML</A></H2> |
|
|
|
<P>You save an XML file using the <A href="#mxmlSaveFile"><TT> |
|
|
|
<P>You save an XML file using the <A href="#mxmlSaveFile"><TT> |
|
|
|
mxmlSaveFile</TT></A> function:</P> |
|
|
|
mxmlSaveFile</TT></A> function:</P> |
|
|
@ -670,6 +732,8 @@ mxmlSaveFile()</TT>. The <TT>mxmlSaveString</TT> function takes pointer |
|
|
|
and size arguments for saving the XML document to a fixed-size buffer, |
|
|
|
and size arguments for saving the XML document to a fixed-size buffer, |
|
|
|
while <TT>mxmlSaveAllocString()</TT> returns a string buffer that was |
|
|
|
while <TT>mxmlSaveAllocString()</TT> returns a string buffer that was |
|
|
|
allocated using <TT>malloc()</TT>.</P> |
|
|
|
allocated using <TT>malloc()</TT>.</P> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- NEED 15 --> |
|
|
|
<H3><A NAME="3_5_1">Controlling Line Wrapping</A></H3> |
|
|
|
<H3><A NAME="3_5_1">Controlling Line Wrapping</A></H3> |
|
|
|
<P>When saving XML documents, Mini-XML normally wraps output lines at |
|
|
|
<P>When saving XML documents, Mini-XML normally wraps output lines at |
|
|
|
column 75 so that the text is readable in terminal windows. The <A href="#mxmlSetWrapMargin"> |
|
|
|
column 75 so that the text is readable in terminal windows. The <A href="#mxmlSetWrapMargin"> |
|
|
@ -682,9 +746,22 @@ mxmlSaveFile()</TT>. The <TT>mxmlSaveString</TT> function takes pointer |
|
|
|
/* Disable wrapping */ |
|
|
|
/* Disable wrapping */ |
|
|
|
mxmlSetWrapMargin(0); |
|
|
|
mxmlSetWrapMargin(0); |
|
|
|
</PRE> |
|
|
|
</PRE> |
|
|
|
|
|
|
|
<H2><A NAME="3_6">Memory Management</A></H2> |
|
|
|
|
|
|
|
<P>Once you are done with the XML data, use the <A href="#mxmlDelete"><TT> |
|
|
|
|
|
|
|
mxmlDelete</TT></A> function to recursively free the memory that is used |
|
|
|
|
|
|
|
for a particular node or the entire tree:</P> |
|
|
|
|
|
|
|
<PRE> |
|
|
|
|
|
|
|
mxmlDelete(tree); |
|
|
|
|
|
|
|
</PRE> |
|
|
|
|
|
|
|
<P>You can also use reference counting to manage memory usage. The <A href="#mxmlRetain"> |
|
|
|
|
|
|
|
<TT>mxmlRetain</TT></A> and <A href="#mxmlRelease"><TT>mxmlRelease</TT></A> |
|
|
|
|
|
|
|
functions increment and decrement a node's use count, respectively. |
|
|
|
|
|
|
|
When the use count goes to 0, <TT>mxmlRelease</TT> will automatically |
|
|
|
|
|
|
|
call <TT>mxmlDelete</TT> to actually free the memory used by the node |
|
|
|
|
|
|
|
tree. New nodes automatically start with a use count of 1.</P> |
|
|
|
|
|
|
|
|
|
|
|
<!-- NEW PAGE--> |
|
|
|
<!-- NEW PAGE--> |
|
|
|
<H2><A NAME="3_6">Finding and Iterating Nodes</A></H2> |
|
|
|
<H2><A NAME="3_7">Finding and Iterating Nodes</A></H2> |
|
|
|
<P>The <A href="#mxmlWalkPrev"><TT>mxmlWalkPrev</TT></A> and <A href="#mxmlWalkNext"> |
|
|
|
<P>The <A href="#mxmlWalkPrev"><TT>mxmlWalkPrev</TT></A> and <A href="#mxmlWalkNext"> |
|
|
|
<TT>mxmlWalkNext</TT></A>functions can be used to iterate through the |
|
|
|
<TT>mxmlWalkNext</TT></A>functions can be used to iterate through the |
|
|
|
XML node tree:</P> |
|
|
|
XML node tree:</P> |
|
|
@ -806,11 +883,13 @@ mxmlSaveFile()</TT>. The <TT>mxmlSaveString</TT> function takes pointer |
|
|
|
the order would be reversed, ending at "?xml".</P> |
|
|
|
the order would be reversed, ending at "?xml".</P> |
|
|
|
</LI> |
|
|
|
</LI> |
|
|
|
</UL> |
|
|
|
</UL> |
|
|
|
<H2><A NAME="3_7">Finding Value Nodes</A></H2> |
|
|
|
<H2><A NAME="3_8">Finding Specific Nodes</A></H2> |
|
|
|
<P>You can find the value of a specific node in the tree using the <A href="#mxmlFindValue"> |
|
|
|
<P>You can find specific nodes in the tree using the <A href="#mxmlFindValue"> |
|
|
|
<TT>mxmlFindValue</TT></A>, for example:</P> |
|
|
|
<TT>mxmlFindPath</TT></A>, for example:</P> |
|
|
|
<PRE> |
|
|
|
<PRE> |
|
|
|
mxml_node_t *value = mxmlFindValue(tree, "path/to/*/foo/bar"); |
|
|
|
mxml_node_t *value; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
value = mxmlFindPath(tree, "path/to/*/foo/bar"); |
|
|
|
</PRE> |
|
|
|
</PRE> |
|
|
|
<P>The second argument is a "path" to the parent node. Each component of |
|
|
|
<P>The second argument is a "path" to the parent node. Each component of |
|
|
|
the path is separated by a slash (/) and represents a named element in |
|
|
|
the path is separated by a slash (/) and represents a named element in |
|
|
@ -865,7 +944,7 @@ MXML_REAL</TT>, or <TT>MXML_TEXT</TT>. The function is called<I> after</I> |
|
|
|
|
|
|
|
|
|
|
|
type = mxmlElementGetAttr(node, "type"); |
|
|
|
type = mxmlElementGetAttr(node, "type"); |
|
|
|
if (type == NULL) |
|
|
|
if (type == NULL) |
|
|
|
type = node->value.element.name; |
|
|
|
type = mxmlGetElement(node); |
|
|
|
|
|
|
|
|
|
|
|
if (!strcmp(type, "integer")) |
|
|
|
if (!strcmp(type, "integer")) |
|
|
|
return (MXML_INTEGER); |
|
|
|
return (MXML_INTEGER); |
|
|
@ -916,7 +995,7 @@ MXML_WS_BEFORE_CLOSE</TT>, or <TT>MXML_WS_AFTER_CLOSE</TT>. The callback |
|
|
|
* just common HTML elements... |
|
|
|
* just common HTML elements... |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
name = node->value.element.name; |
|
|
|
name = mxmlGetElement(node); |
|
|
|
|
|
|
|
|
|
|
|
if (!strcmp(name, "html") || |
|
|
|
if (!strcmp(name, "html") || |
|
|
|
!strcmp(name, "head") || |
|
|
|
!strcmp(name, "head") || |
|
|
@ -1080,8 +1159,7 @@ MXML_WS_BEFORE_CLOSE</TT>, or <TT>MXML_WS_AFTER_CLOSE</TT>. The callback |
|
|
|
* function pointers... |
|
|
|
* function pointers... |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
node->value.custom.data = dt; |
|
|
|
mxmlSetCustom(node, data, destroy); |
|
|
|
node->value.custom.destroy = free; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
* Return with no errors... |
|
|
|
* Return with no errors... |
|
|
@ -1095,6 +1173,8 @@ MXML_WS_BEFORE_CLOSE</TT>, or <TT>MXML_WS_AFTER_CLOSE</TT>. The callback |
|
|
|
contain a <TT>void</TT> pointer to the allocated custom data for the |
|
|
|
contain a <TT>void</TT> pointer to the allocated custom data for the |
|
|
|
node and a pointer to a destructor function which will free the custom |
|
|
|
node and a pointer to a destructor function which will free the custom |
|
|
|
data when the node is deleted.</P> |
|
|
|
data when the node is deleted.</P> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- NEED 15 --> |
|
|
|
<P>The save callback receives the node pointer and returns an allocated |
|
|
|
<P>The save callback receives the node pointer and returns an allocated |
|
|
|
string containing the custom data value. The following save callback |
|
|
|
string containing the custom data value. The following save callback |
|
|
|
could be used for our ISO date/time type:</P> |
|
|
|
could be used for our ISO date/time type:</P> |
|
|
@ -1106,7 +1186,7 @@ MXML_WS_BEFORE_CLOSE</TT>, or <TT>MXML_WS_AFTER_CLOSE</TT>. The callback |
|
|
|
iso_date_time_t *dt; |
|
|
|
iso_date_time_t *dt; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dt = (iso_date_time_t *)node->custom.data; |
|
|
|
dt = (iso_date_time_t *)mxmlGetCustom(node); |
|
|
|
|
|
|
|
|
|
|
|
snprintf(data, sizeof(data), |
|
|
|
snprintf(data, sizeof(data), |
|
|
|
"%04u-%02u-%02uT%02u:%02u:%02uZ", |
|
|
|
"%04u-%02u-%02uT%02u:%02u:%02uZ", |
|
|
@ -1297,7 +1377,7 @@ mxmlRetain</TT></A> function. For example, the following SAX callback |
|
|
|
* Retain headings and titles... |
|
|
|
* Retain headings and titles... |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
char *name = node->value.element.name; |
|
|
|
char *name = mxmlGetElement(node); |
|
|
|
|
|
|
|
|
|
|
|
if (!strcmp(name, "html") || |
|
|
|
if (!strcmp(name, "html") || |
|
|
|
!strcmp(name, "head") || |
|
|
|
!strcmp(name, "head") || |
|
|
@ -1313,8 +1393,9 @@ mxmlRetain</TT></A> function. For example, the following SAX callback |
|
|
|
} |
|
|
|
} |
|
|
|
else if (event == MXML_SAX_DIRECTIVE) |
|
|
|
else if (event == MXML_SAX_DIRECTIVE) |
|
|
|
mxmlRetain(node); |
|
|
|
mxmlRetain(node); |
|
|
|
else if (event == MXML_SAX_DATA && |
|
|
|
else if (event == MXML_SAX_DATA) |
|
|
|
node->parent->ref_count > 1) |
|
|
|
{ |
|
|
|
|
|
|
|
if (mxmlGetRefCount(mxmlGetParent(node)) > 1) |
|
|
|
{ |
|
|
|
{ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* If the parent was retained, then retain |
|
|
|
* If the parent was retained, then retain |
|
|
@ -1324,6 +1405,7 @@ mxmlRetain</TT></A> function. For example, the following SAX callback |
|
|
|
mxmlRetain(node); |
|
|
|
mxmlRetain(node); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
</PRE> |
|
|
|
</PRE> |
|
|
|
<P>The resulting skeleton document tree can then be searched just like |
|
|
|
<P>The resulting skeleton document tree can then be searched just like |
|
|
|
one loaded using the <TT>mxmlLoad</TT> functions. For example, a filter |
|
|
|
one loaded using the <TT>mxmlLoad</TT> functions. For example, a filter |
|
|
@ -1349,9 +1431,9 @@ mxmlRetain</TT></A> function. For example, the following SAX callback |
|
|
|
|
|
|
|
|
|
|
|
if (body) |
|
|
|
if (body) |
|
|
|
{ |
|
|
|
{ |
|
|
|
for (heading = body->child; |
|
|
|
for (heading = mxmlGetFirstChild(body); |
|
|
|
heading; |
|
|
|
heading; |
|
|
|
heading = heading->next) |
|
|
|
heading = mxmlGetNextSibling(heading)) |
|
|
|
print_children(heading); |
|
|
|
print_children(heading); |
|
|
|
} |
|
|
|
} |
|
|
|
</PRE> |
|
|
|
</PRE> |
|
|
@ -1417,7 +1499,7 @@ hspace="10" src="4.gif" width="100"></A>Using the mxmldoc Utility</H1> |
|
|
|
will document all public names it finds in your source files - any |
|
|
|
will document all public names it finds in your source files - any |
|
|
|
names starting with the underscore character (_) or names that are |
|
|
|
names starting with the underscore character (_) or names that are |
|
|
|
documented with the <A HREF="#ATDIRECTIVES">@private@</A> directive are |
|
|
|
documented with the <A HREF="#ATDIRECTIVES">@private@</A> directive are |
|
|
|
treated as private and are undocumented.</P> |
|
|
|
treated as private and are not documented.</P> |
|
|
|
<P>Comments appearing directly before a function or type definition are |
|
|
|
<P>Comments appearing directly before a function or type definition are |
|
|
|
used to document that function or type. Comments appearing after |
|
|
|
used to document that function or type. Comments appearing after |
|
|
|
argument, definition, return type, or variable declarations are used to |
|
|
|
argument, definition, return type, or variable declarations are used to |
|
|
@ -1472,8 +1554,8 @@ hspace="10" src="4.gif" width="100"></A>Using the mxmldoc Utility</H1> |
|
|
|
included in the documentation</LI> |
|
|
|
included in the documentation</LI> |
|
|
|
<LI><TT>@since ...@</TT> - flags the item as new since a particular |
|
|
|
<LI><TT>@since ...@</TT> - flags the item as new since a particular |
|
|
|
release. The text following the <TT>@since</TT> up to the closing <TT>@</TT> |
|
|
|
release. The text following the <TT>@since</TT> up to the closing <TT>@</TT> |
|
|
|
is highlighted in the generated documentation, e.g. <TT>@since CUPS |
|
|
|
is highlighted in the generated documentation, e.g. <TT>@since Mini-XML |
|
|
|
1.3@</TT>.</LI> |
|
|
|
2.7@</TT>.</LI> |
|
|
|
</UL> |
|
|
|
</UL> |
|
|
|
|
|
|
|
|
|
|
|
<!-- NEED 10 --> |
|
|
|
<!-- NEED 10 --> |
|
|
@ -1513,22 +1595,19 @@ hspace="10" src="A.gif" width="100"></A>Mini-XML License</H1> |
|
|
|
<P>The Mini-XML library and included programs are provided under the |
|
|
|
<P>The Mini-XML library and included programs are provided under the |
|
|
|
terms of the GNU Library General Public License version 2 (LGPL2) with |
|
|
|
terms of the GNU Library General Public License version 2 (LGPL2) with |
|
|
|
the following exceptions:</P> |
|
|
|
the following exceptions:</P> |
|
|
|
<OL> |
|
|
|
<P><B>1.</B> Static linking of applications to the Mini-XML library does |
|
|
|
<LI>Static linking of applications to the Mini-XML library does not |
|
|
|
not constitute a derivative work and does not require the author to |
|
|
|
constitute a derivative work and does not require the author to provide |
|
|
|
provide source code for the application, use the shared Mini-XML |
|
|
|
source code for the application, use the shared Mini-XML libraries, or |
|
|
|
libraries, or link their applications against a user-supplied version |
|
|
|
link their applications against a user-supplied version of Mini-XML. |
|
|
|
of Mini-XML.</P> |
|
|
|
<P><I>If you link the application to a modified version of Mini-XML, |
|
|
|
<P><I>If you link the application to a modified version of Mini-XML, |
|
|
|
then the changes to Mini-XML must be provided under the terms of the |
|
|
|
then the changes to Mini-XML must be provided under the terms of the |
|
|
|
LGPL2 in sections 1, 2, and 4.</I></P> |
|
|
|
LGPL2 in sections 1, 2, and 4.</I></P> |
|
|
|
</LI> |
|
|
|
<P><B>2.</B> You do not have to provide a copy of the Mini-XML license |
|
|
|
<LI>You do not have to provide a copy of the Mini-XML license with |
|
|
|
with programs that are linked to the Mini-XML library, nor do you have |
|
|
|
programs that are linked to the Mini-XML library, nor do you have to |
|
|
|
to identify the Mini-XML license in your program or documentation as |
|
|
|
identify the Mini-XML license in your program or documentation as |
|
|
|
required by section 6 of the LGPL2.</P> |
|
|
|
required by section 6 of the LGPL2.</LI> |
|
|
|
<P> </P> |
|
|
|
</OL> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- NEW PAGE --> |
|
|
|
|
|
|
|
<P align="center"><B>GNU LIBRARY GENERAL PUBLIC LICENSE</B></P> |
|
|
|
<P align="center"><B>GNU LIBRARY GENERAL PUBLIC LICENSE</B></P> |
|
|
|
<P align="center">Version 2, June 1991 |
|
|
|
<P align="center">Version 2, June 1991 |
|
|
|
<BR> Copyright (C) 1991 Free Software Foundation, Inc. |
|
|
|
<BR> Copyright (C) 1991 Free Software Foundation, Inc. |
|
|
@ -1947,9 +2026,12 @@ hspace="10" src="A.gif" width="100"></A>Mini-XML License</H1> |
|
|
|
hspace="10" src="B.gif" width="100"></A>Release Notes</H1> |
|
|
|
hspace="10" src="B.gif" width="100"></A>Release Notes</H1> |
|
|
|
<H2><A NAME="7_1">Changes in Mini-XML 2.7</A></H2> |
|
|
|
<H2><A NAME="7_1">Changes in Mini-XML 2.7</A></H2> |
|
|
|
<UL> |
|
|
|
<UL> |
|
|
|
|
|
|
|
<LI>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)</LI> |
|
|
|
<LI>Updated the source headers to reference the Mini-XML license and its |
|
|
|
<LI>Updated the source headers to reference the Mini-XML license and its |
|
|
|
exceptions to the LGPL2 (STR #108)</LI> |
|
|
|
exceptions to the LGPL2 (STR #108)</LI> |
|
|
|
<LI>Added a new mxmlFindValue() function to find the value node of a |
|
|
|
<LI>Added a new mxmlFindPath() function to find the value node of a |
|
|
|
named element (STR #110)</LI> |
|
|
|
named element (STR #110)</LI> |
|
|
|
<LI>Building a static version of the library did not work on Windows |
|
|
|
<LI>Building a static version of the library did not work on Windows |
|
|
|
(STR #112)</LI> |
|
|
|
(STR #112)</LI> |
|
|
@ -2261,8 +2343,8 @@ mxmlEntityGetValue</A></LI> |
|
|
|
mxmlEntityRemoveCallback</A></LI> |
|
|
|
mxmlEntityRemoveCallback</A></LI> |
|
|
|
<LI><A href="#mxmlFindElement" title="Find the named element."> |
|
|
|
<LI><A href="#mxmlFindElement" title="Find the named element."> |
|
|
|
mxmlFindElement</A></LI> |
|
|
|
mxmlFindElement</A></LI> |
|
|
|
<LI><A href="#mxmlFindValue" title="Find a value with the given path."> |
|
|
|
<LI><A href="#mxmlFindPath" title="Find a node with the given path."> |
|
|
|
mxmlFindValue</A></LI> |
|
|
|
mxmlFindPath</A></LI> |
|
|
|
<LI><A href="#mxmlGetCDATA" title="Get the value for a CDATA node."> |
|
|
|
<LI><A href="#mxmlGetCDATA" title="Get the value for a CDATA node."> |
|
|
|
mxmlGetCDATA</A></LI> |
|
|
|
mxmlGetCDATA</A></LI> |
|
|
|
<LI><A href="#mxmlGetCustom" title="Get the value for a custom node."> |
|
|
|
<LI><A href="#mxmlGetCustom" title="Get the value for a custom node."> |
|
|
@ -2275,16 +2357,18 @@ mxmlGetFirstChild</A></LI> |
|
|
|
mxmlGetInteger</A></LI> |
|
|
|
mxmlGetInteger</A></LI> |
|
|
|
<LI><A href="#mxmlGetLastChild" title="Get the last child of an element node."> |
|
|
|
<LI><A href="#mxmlGetLastChild" title="Get the last child of an element node."> |
|
|
|
mxmlGetLastChild</A></LI> |
|
|
|
mxmlGetLastChild</A></LI> |
|
|
|
<LI><A href="#mxmlGetNext" title="Return the node type...">mxmlGetNext</A> |
|
|
|
<LI><A href="#mxmlGetNextSibling" title="Return the node type..."> |
|
|
|
</LI> |
|
|
|
mxmlGetNextSibling</A></LI> |
|
|
|
<LI><A href="#mxmlGetOpaque" title="Get an opaque string value for a node or its first child."> |
|
|
|
<LI><A href="#mxmlGetOpaque" title="Get an opaque string value for a node or its first child."> |
|
|
|
mxmlGetOpaque</A></LI> |
|
|
|
mxmlGetOpaque</A></LI> |
|
|
|
<LI><A href="#mxmlGetParent" title="Get the parent node.">mxmlGetParent</A> |
|
|
|
<LI><A href="#mxmlGetParent" title="Get the parent node.">mxmlGetParent</A> |
|
|
|
</LI> |
|
|
|
</LI> |
|
|
|
<LI><A href="#mxmlGetPrevious" title="Get the previous node for the current parent."> |
|
|
|
<LI><A href="#mxmlGetPrevSibling" title="Get the previous node for the current parent."> |
|
|
|
mxmlGetPrevious</A></LI> |
|
|
|
mxmlGetPrevSibling</A></LI> |
|
|
|
<LI><A href="#mxmlGetReal" title="Get the real value for a node or its first child."> |
|
|
|
<LI><A href="#mxmlGetReal" title="Get the real value for a node or its first child."> |
|
|
|
mxmlGetReal</A></LI> |
|
|
|
mxmlGetReal</A></LI> |
|
|
|
|
|
|
|
<LI><A href="#mxmlGetRefCount" title="Get the current reference (use) count for a node."> |
|
|
|
|
|
|
|
mxmlGetRefCount</A></LI> |
|
|
|
<LI><A href="#mxmlGetText" title="Get the text value for a node or its first child."> |
|
|
|
<LI><A href="#mxmlGetText" title="Get the text value for a node or its first child."> |
|
|
|
mxmlGetText</A></LI> |
|
|
|
mxmlGetText</A></LI> |
|
|
|
<LI><A href="#mxmlGetType" title="Get the node type.">mxmlGetType</A></LI> |
|
|
|
<LI><A href="#mxmlGetType" title="Get the node type.">mxmlGetType</A></LI> |
|
|
@ -2624,9 +2708,9 @@ mxmlEntityRemoveCallback</A></H3> |
|
|
|
children.</P> |
|
|
|
children.</P> |
|
|
|
<H3 class="function"><A NAME="8_2_12"> |
|
|
|
<H3 class="function"><A NAME="8_2_12"> |
|
|
|
<!--span class="info"--> |
|
|
|
<!--span class="info"--> |
|
|
|
Mini-XML 2.7 <A name="mxmlFindValue">mxmlFindValue</A></A></H3> |
|
|
|
Mini-XML 2.7 <A name="mxmlFindPath">mxmlFindPath</A></A></H3> |
|
|
|
<P class="description">Find a value with the given path.</P> |
|
|
|
<P class="description">Find a node with the given path.</P> |
|
|
|
<P class="code"> <A href="#mxml_node_t">mxml_node_t</A> *mxmlFindValue ( |
|
|
|
<P class="code"> <A href="#mxml_node_t">mxml_node_t</A> *mxmlFindPath ( |
|
|
|
<BR> <A href="#mxml_node_t">mxml_node_t</A> *top, |
|
|
|
<BR> <A href="#mxml_node_t">mxml_node_t</A> *top, |
|
|
|
<BR> const char *path |
|
|
|
<BR> const char *path |
|
|
|
<BR> );</P> |
|
|
|
<BR> );</P> |
|
|
@ -2638,17 +2722,20 @@ mxmlEntityRemoveCallback</A></H3> |
|
|
|
<DD class="description">Path to element</DD> |
|
|
|
<DD class="description">Path to element</DD> |
|
|
|
</DL> |
|
|
|
</DL> |
|
|
|
<H4 class="returnvalue">Return Value</H4> |
|
|
|
<H4 class="returnvalue">Return Value</H4> |
|
|
|
<P class="description">First value node or NULL</P> |
|
|
|
<P class="description">Found node or NULL</P> |
|
|
|
<H4 class="discussion">Discussion</H4> |
|
|
|
<H4 class="discussion">Discussion</H4> |
|
|
|
<P class="discussion">The "path" is a slash-separated list of element |
|
|
|
<P class="discussion">The "path" is a slash-separated list of element |
|
|
|
names. The name "*" is considered a wildcard for one or more levels of |
|
|
|
names. The name "*" is considered a wildcard for one or more levels of |
|
|
|
elements. For example, "foo/one/two", "bar/two/one", "*/one", and so |
|
|
|
elements. For example, "foo/one/two", "bar/two/one", "*/one", and so |
|
|
|
forth.</P> |
|
|
|
forth. |
|
|
|
|
|
|
|
<BR> |
|
|
|
|
|
|
|
<BR> The first child node of the found node is returned if the given |
|
|
|
|
|
|
|
node has children and the first child is a value node.</P> |
|
|
|
<H3 class="function"><A NAME="8_2_13"> |
|
|
|
<H3 class="function"><A NAME="8_2_13"> |
|
|
|
<!--span class="info"--> |
|
|
|
<!--span class="info"--> |
|
|
|
Mini-XML 2.7 <A name="mxmlGetCDATA">mxmlGetCDATA</A></A></H3> |
|
|
|
Mini-XML 2.7 <A name="mxmlGetCDATA">mxmlGetCDATA</A></A></H3> |
|
|
|
<P class="description">Get the value for a CDATA node.</P> |
|
|
|
<P class="description">Get the value for a CDATA node.</P> |
|
|
|
<P class="code"> char *mxmlGetCDATA ( |
|
|
|
<P class="code"> const char *mxmlGetCDATA ( |
|
|
|
<BR> <A href="#mxml_node_t">mxml_node_t</A> *node |
|
|
|
<BR> <A href="#mxml_node_t">mxml_node_t</A> *node |
|
|
|
<BR> );</P> |
|
|
|
<BR> );</P> |
|
|
|
<H4 class="parameters">Parameters</H4> |
|
|
|
<H4 class="parameters">Parameters</H4> |
|
|
@ -2665,7 +2752,7 @@ mxmlEntityRemoveCallback</A></H3> |
|
|
|
<!--span class="info"--> |
|
|
|
<!--span class="info"--> |
|
|
|
Mini-XML 2.7 <A name="mxmlGetCustom">mxmlGetCustom</A></A></H3> |
|
|
|
Mini-XML 2.7 <A name="mxmlGetCustom">mxmlGetCustom</A></A></H3> |
|
|
|
<P class="description">Get the value for a custom node.</P> |
|
|
|
<P class="description">Get the value for a custom node.</P> |
|
|
|
<P class="code"> void *mxmlGetCustom ( |
|
|
|
<P class="code"> const void *mxmlGetCustom ( |
|
|
|
<BR> <A href="#mxml_node_t">mxml_node_t</A> *node |
|
|
|
<BR> <A href="#mxml_node_t">mxml_node_t</A> *node |
|
|
|
<BR> );</P> |
|
|
|
<BR> );</P> |
|
|
|
<H4 class="parameters">Parameters</H4> |
|
|
|
<H4 class="parameters">Parameters</H4> |
|
|
@ -2682,7 +2769,7 @@ mxmlEntityRemoveCallback</A></H3> |
|
|
|
<!--span class="info"--> |
|
|
|
<!--span class="info"--> |
|
|
|
Mini-XML 2.7 <A name="mxmlGetElement">mxmlGetElement</A></A></H3> |
|
|
|
Mini-XML 2.7 <A name="mxmlGetElement">mxmlGetElement</A></A></H3> |
|
|
|
<P class="description">Get the name for an element node.</P> |
|
|
|
<P class="description">Get the name for an element node.</P> |
|
|
|
<P class="code"> char *mxmlGetElement ( |
|
|
|
<P class="code"> const char *mxmlGetElement ( |
|
|
|
<BR> <A href="#mxml_node_t">mxml_node_t</A> *node |
|
|
|
<BR> <A href="#mxml_node_t">mxml_node_t</A> *node |
|
|
|
<BR> );</P> |
|
|
|
<BR> );</P> |
|
|
|
<H4 class="parameters">Parameters</H4> |
|
|
|
<H4 class="parameters">Parameters</H4> |
|
|
@ -2749,9 +2836,10 @@ mxmlEntityRemoveCallback</A></H3> |
|
|
|
<H4 class="discussion">Discussion</H4> |
|
|
|
<H4 class="discussion">Discussion</H4> |
|
|
|
<P class="discussion"><CODE>NULL</CODE> is returned if the node is not |
|
|
|
<P class="discussion"><CODE>NULL</CODE> is returned if the node is not |
|
|
|
an element node or if the node has no children.</P> |
|
|
|
an element node or if the node has no children.</P> |
|
|
|
<H3 class="function"><A name="mxmlGetNext">mxmlGetNext</A></H3> |
|
|
|
<H3 class="function"><A name="mxmlGetNextSibling">mxmlGetNextSibling</A></H3> |
|
|
|
<P class="description">Return the node type...</P> |
|
|
|
<P class="description">Return the node type...</P> |
|
|
|
<P class="code"> <A href="#mxml_node_t">mxml_node_t</A> *mxmlGetNext ( |
|
|
|
<P class="code"> <A href="#mxml_node_t">mxml_node_t</A> |
|
|
|
|
|
|
|
*mxmlGetNextSibling ( |
|
|
|
<BR> <A href="#mxml_node_t">mxml_node_t</A> *node |
|
|
|
<BR> <A href="#mxml_node_t">mxml_node_t</A> *node |
|
|
|
<BR> );</P> |
|
|
|
<BR> );</P> |
|
|
|
<H4 class="parameters">Parameters</H4> |
|
|
|
<H4 class="parameters">Parameters</H4> |
|
|
@ -2768,7 +2856,7 @@ mxmlEntityRemoveCallback</A></H3> |
|
|
|
Mini-XML 2.7 <A name="mxmlGetOpaque">mxmlGetOpaque</A></A></H3> |
|
|
|
Mini-XML 2.7 <A name="mxmlGetOpaque">mxmlGetOpaque</A></A></H3> |
|
|
|
<P class="description">Get an opaque string value for a node or its |
|
|
|
<P class="description">Get an opaque string value for a node or its |
|
|
|
first child.</P> |
|
|
|
first child.</P> |
|
|
|
<P class="code"> char *mxmlGetOpaque ( |
|
|
|
<P class="code"> const char *mxmlGetOpaque ( |
|
|
|
<BR> <A href="#mxml_node_t">mxml_node_t</A> *node |
|
|
|
<BR> <A href="#mxml_node_t">mxml_node_t</A> *node |
|
|
|
<BR> );</P> |
|
|
|
<BR> );</P> |
|
|
|
<H4 class="parameters">Parameters</H4> |
|
|
|
<H4 class="parameters">Parameters</H4> |
|
|
@ -2799,10 +2887,10 @@ mxmlEntityRemoveCallback</A></H3> |
|
|
|
<P class="discussion"><CODE>NULL</CODE> is returned for a root node.</P> |
|
|
|
<P class="discussion"><CODE>NULL</CODE> is returned for a root node.</P> |
|
|
|
<H3 class="function"><A NAME="8_2_22"> |
|
|
|
<H3 class="function"><A NAME="8_2_22"> |
|
|
|
<!--span class="info"--> |
|
|
|
<!--span class="info"--> |
|
|
|
Mini-XML 2.7 <A name="mxmlGetPrevious">mxmlGetPrevious</A></A></H3> |
|
|
|
Mini-XML 2.7 <A name="mxmlGetPrevSibling">mxmlGetPrevSibling</A></A></H3> |
|
|
|
<P class="description">Get the previous node for the current parent.</P> |
|
|
|
<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 |
|
|
|
<P class="code"> <A href="#mxml_node_t">mxml_node_t</A> |
|
|
|
( |
|
|
|
*mxmlGetPrevSibling ( |
|
|
|
<BR> <A href="#mxml_node_t">mxml_node_t</A> *node |
|
|
|
<BR> <A href="#mxml_node_t">mxml_node_t</A> *node |
|
|
|
<BR> );</P> |
|
|
|
<BR> );</P> |
|
|
|
<H4 class="parameters">Parameters</H4> |
|
|
|
<H4 class="parameters">Parameters</H4> |
|
|
@ -2834,9 +2922,28 @@ mxmlEntityRemoveCallback</A></H3> |
|
|
|
is not a real value node.</P> |
|
|
|
is not a real value node.</P> |
|
|
|
<H3 class="function"><A NAME="8_2_24"> |
|
|
|
<H3 class="function"><A NAME="8_2_24"> |
|
|
|
<!--span class="info"--> |
|
|
|
<!--span class="info"--> |
|
|
|
|
|
|
|
Mini-XML 2.7 <A name="mxmlGetRefCount">mxmlGetRefCount</A></A></H3> |
|
|
|
|
|
|
|
<P class="description">Get the current reference (use) count for a node.</P> |
|
|
|
|
|
|
|
<P class="code"> int mxmlGetRefCount ( |
|
|
|
|
|
|
|
<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</DD> |
|
|
|
|
|
|
|
</DL> |
|
|
|
|
|
|
|
<H4 class="returnvalue">Return Value</H4> |
|
|
|
|
|
|
|
<P class="description">Reference count</P> |
|
|
|
|
|
|
|
<H4 class="discussion">Discussion</H4> |
|
|
|
|
|
|
|
<P class="discussion">The initial reference count of new nodes is 1. Use |
|
|
|
|
|
|
|
the <A href="#mxmlRetain"><CODE>mxmlRetain</CODE></A> and <A href="#mxmlRelease"> |
|
|
|
|
|
|
|
<CODE>mxmlRelease</CODE></A> functions to increment and decrement a |
|
|
|
|
|
|
|
node's reference count. .</P> |
|
|
|
|
|
|
|
<H3 class="function"><A NAME="8_2_25"> |
|
|
|
|
|
|
|
<!--span class="info"--> |
|
|
|
Mini-XML 2.7 <A name="mxmlGetText">mxmlGetText</A></A></H3> |
|
|
|
Mini-XML 2.7 <A name="mxmlGetText">mxmlGetText</A></A></H3> |
|
|
|
<P class="description">Get the text value for a node or its first child.</P> |
|
|
|
<P class="description">Get the text value for a node or its first child.</P> |
|
|
|
<P class="code"> char *mxmlGetText ( |
|
|
|
<P class="code"> const char *mxmlGetText ( |
|
|
|
<BR> <A href="#mxml_node_t">mxml_node_t</A> *node, |
|
|
|
<BR> <A href="#mxml_node_t">mxml_node_t</A> *node, |
|
|
|
<BR> int *whitespace |
|
|
|
<BR> int *whitespace |
|
|
|
<BR> );</P> |
|
|
|
<BR> );</P> |
|
|
@ -2853,7 +2960,7 @@ mxmlEntityRemoveCallback</A></H3> |
|
|
|
<H4 class="discussion">Discussion</H4> |
|
|
|
<H4 class="discussion">Discussion</H4> |
|
|
|
<P class="discussion"><CODE>NULL</CODE> is returned if the node (or its |
|
|
|
<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> |
|
|
|
first child) is not a text node. The "whitespace" argument can be NULL.</P> |
|
|
|
<H3 class="function"><A NAME="8_2_25"> |
|
|
|
<H3 class="function"><A NAME="8_2_26"> |
|
|
|
<!--span class="info"--> |
|
|
|
<!--span class="info"--> |
|
|
|
Mini-XML 2.7 <A name="mxmlGetType">mxmlGetType</A></A></H3> |
|
|
|
Mini-XML 2.7 <A name="mxmlGetType">mxmlGetType</A></A></H3> |
|
|
|
<P class="description">Get the node type.</P> |
|
|
|
<P class="description">Get the node type.</P> |
|
|
@ -2870,7 +2977,7 @@ mxmlEntityRemoveCallback</A></H3> |
|
|
|
<H4 class="discussion">Discussion</H4> |
|
|
|
<H4 class="discussion">Discussion</H4> |
|
|
|
<P class="discussion"><CODE>MXML_IGNORE</CODE> is returned if "node" is <CODE> |
|
|
|
<P class="discussion"><CODE>MXML_IGNORE</CODE> is returned if "node" is <CODE> |
|
|
|
NULL</CODE>.</P> |
|
|
|
NULL</CODE>.</P> |
|
|
|
<H3 class="function"><A NAME="8_2_26"> |
|
|
|
<H3 class="function"><A NAME="8_2_27"> |
|
|
|
<!--span class="info"--> |
|
|
|
<!--span class="info"--> |
|
|
|
Mini-XML 2.7 <A name="mxmlGetUserData">mxmlGetUserData</A></A></H3> |
|
|
|
Mini-XML 2.7 <A name="mxmlGetUserData">mxmlGetUserData</A></A></H3> |
|
|
|
<P class="description">Get the user data pointer for a node.</P> |
|
|
|
<P class="description">Get the user data pointer for a node.</P> |
|
|
@ -2932,7 +3039,7 @@ NULL</CODE>.</P> |
|
|
|
this function for the first time with a particular set of "element" and |
|
|
|
this function for the first time with a particular set of "element" and |
|
|
|
"value" strings. Passing NULL for both "element" and "value" is |
|
|
|
"value" strings. Passing NULL for both "element" and "value" is |
|
|
|
equivalent to calling mxmlIndexEnum().</P> |
|
|
|
equivalent to calling mxmlIndexEnum().</P> |
|
|
|
<H3 class="function"><A NAME="8_2_30"> |
|
|
|
<H3 class="function"><A NAME="8_2_31"> |
|
|
|
<!--span class="info"--> |
|
|
|
<!--span class="info"--> |
|
|
|
Mini-XML 2.7 <A name="mxmlIndexGetCount">mxmlIndexGetCount</A></A></H3> |
|
|
|
Mini-XML 2.7 <A name="mxmlIndexGetCount">mxmlIndexGetCount</A></A></H3> |
|
|
|
<P class="description">Get the number of nodes in an index.</P> |
|
|
|
<P class="description">Get the number of nodes in an index.</P> |
|
|
@ -3076,7 +3183,7 @@ NULL</CODE>.</P> |
|
|
|
<BR> The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, |
|
|
|
<BR> The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, |
|
|
|
MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading |
|
|
|
MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading |
|
|
|
child nodes of the specified type.</P> |
|
|
|
child nodes of the specified type.</P> |
|
|
|
<H3 class="function"><A NAME="8_2_36"> |
|
|
|
<H3 class="function"><A NAME="8_2_37"> |
|
|
|
<!--span class="info"--> |
|
|
|
<!--span class="info"--> |
|
|
|
Mini-XML 2.3 <A name="mxmlNewCDATA">mxmlNewCDATA</A></A></H3> |
|
|
|
Mini-XML 2.3 <A name="mxmlNewCDATA">mxmlNewCDATA</A></A></H3> |
|
|
|
<P class="description">Create a new CDATA node.</P> |
|
|
|
<P class="description">Create a new CDATA node.</P> |
|
|
@ -3099,7 +3206,7 @@ NULL</CODE>.</P> |
|
|
|
to specify that the new CDATA node has no parent. The data string must |
|
|
|
to specify that the new CDATA node has no parent. The data string must |
|
|
|
be nul-terminated and is copied into the new node. CDATA nodes use the |
|
|
|
be nul-terminated and is copied into the new node. CDATA nodes use the |
|
|
|
MXML_ELEMENT type.</P> |
|
|
|
MXML_ELEMENT type.</P> |
|
|
|
<H3 class="function"><A NAME="8_2_37"> |
|
|
|
<H3 class="function"><A NAME="8_2_38"> |
|
|
|
<!--span class="info"--> |
|
|
|
<!--span class="info"--> |
|
|
|
Mini-XML 2.1 <A name="mxmlNewCustom">mxmlNewCustom</A></A></H3> |
|
|
|
Mini-XML 2.1 <A name="mxmlNewCustom">mxmlNewCustom</A></A></H3> |
|
|
|
<P class="description">Create a new custom data node.</P> |
|
|
|
<P class="description">Create a new custom data node.</P> |
|
|
@ -3258,7 +3365,7 @@ NULL</CODE>.</P> |
|
|
|
parameter is used to specify whether leading whitespace is present |
|
|
|
parameter is used to specify whether leading whitespace is present |
|
|
|
before the node. The format string must be nul-terminated and is |
|
|
|
before the node. The format string must be nul-terminated and is |
|
|
|
formatted into the new node.</P> |
|
|
|
formatted into the new node.</P> |
|
|
|
<H3 class="function"><A NAME="8_2_44"> |
|
|
|
<H3 class="function"><A NAME="8_2_45"> |
|
|
|
<!--span class="info"--> |
|
|
|
<!--span class="info"--> |
|
|
|
Mini-XML 2.3 <A name="mxmlNewXML">mxmlNewXML</A></A></H3> |
|
|
|
Mini-XML 2.3 <A name="mxmlNewXML">mxmlNewXML</A></A></H3> |
|
|
|
<P class="description">Create a new XML document tree.</P> |
|
|
|
<P class="description">Create a new XML document tree.</P> |
|
|
@ -3276,7 +3383,7 @@ NULL</CODE>.</P> |
|
|
|
<P class="discussion">The "version" argument specifies the version |
|
|
|
<P class="discussion">The "version" argument specifies the version |
|
|
|
number to put in the ?xml element node. If NULL, version 1.0 is |
|
|
|
number to put in the ?xml element node. If NULL, version 1.0 is |
|
|
|
assumed.</P> |
|
|
|
assumed.</P> |
|
|
|
<H3 class="function"><A NAME="8_2_45"> |
|
|
|
<H3 class="function"><A NAME="8_2_46"> |
|
|
|
<!--span class="info"--> |
|
|
|
<!--span class="info"--> |
|
|
|
Mini-XML 2.3 <A name="mxmlRelease">mxmlRelease</A></A></H3> |
|
|
|
Mini-XML 2.3 <A name="mxmlRelease">mxmlRelease</A></A></H3> |
|
|
|
<P class="description">Release a node.</P> |
|
|
|
<P class="description">Release a node.</P> |
|
|
@ -3307,7 +3414,7 @@ NULL</CODE>.</P> |
|
|
|
<P class="discussion">Does not free memory used by the node - use |
|
|
|
<P class="discussion">Does not free memory used by the node - use |
|
|
|
mxmlDelete() for that. This function does nothing if the node has no |
|
|
|
mxmlDelete() for that. This function does nothing if the node has no |
|
|
|
parent.</P> |
|
|
|
parent.</P> |
|
|
|
<H3 class="function"><A NAME="8_2_47"> |
|
|
|
<H3 class="function"><A NAME="8_2_48"> |
|
|
|
<!--span class="info"--> |
|
|
|
<!--span class="info"--> |
|
|
|
Mini-XML 2.3 <A name="mxmlRetain">mxmlRetain</A></A></H3> |
|
|
|
Mini-XML 2.3 <A name="mxmlRetain">mxmlRetain</A></A></H3> |
|
|
|
<P class="description">Retain a node.</P> |
|
|
|
<P class="description">Retain a node.</P> |
|
|
@ -3321,7 +3428,7 @@ NULL</CODE>.</P> |
|
|
|
</DL> |
|
|
|
</DL> |
|
|
|
<H4 class="returnvalue">Return Value</H4> |
|
|
|
<H4 class="returnvalue">Return Value</H4> |
|
|
|
<P class="description">New reference count</P> |
|
|
|
<P class="description">New reference count</P> |
|
|
|
<H3 class="function"><A NAME="8_2_48"> |
|
|
|
<H3 class="function"><A NAME="8_2_49"> |
|
|
|
<!--span class="info"--> |
|
|
|
<!--span class="info"--> |
|
|
|
Mini-XML 2.3 <A name="mxmlSAXLoadFd">mxmlSAXLoadFd</A></A></H3> |
|
|
|
Mini-XML 2.3 <A name="mxmlSAXLoadFd">mxmlSAXLoadFd</A></A></H3> |
|
|
|
<P class="description">Load a file descriptor into an XML node tree |
|
|
|
<P class="description">Load a file descriptor into an XML node tree |
|
|
@ -3363,7 +3470,7 @@ NULL</CODE>.</P> |
|
|
|
<BR> The SAX callback must call mxmlRetain() for any nodes that need to |
|
|
|
<BR> The SAX callback must call mxmlRetain() for any nodes that need to |
|
|
|
be kept for later use. Otherwise, nodes are deleted when the parent |
|
|
|
be kept for later use. Otherwise, nodes are deleted when the parent |
|
|
|
node is closed or after each data, comment, CDATA, or directive node.</P> |
|
|
|
node is closed or after each data, comment, CDATA, or directive node.</P> |
|
|
|
<H3 class="function"><A NAME="8_2_49"> |
|
|
|
<H3 class="function"><A NAME="8_2_50"> |
|
|
|
<!--span class="info"--> |
|
|
|
<!--span class="info"--> |
|
|
|
Mini-XML 2.3 <A name="mxmlSAXLoadFile">mxmlSAXLoadFile</A></A></H3> |
|
|
|
Mini-XML 2.3 <A name="mxmlSAXLoadFile">mxmlSAXLoadFile</A></A></H3> |
|
|
|
<P class="description">Load a file into an XML node tree using a SAX |
|
|
|
<P class="description">Load a file into an XML node tree using a SAX |
|
|
@ -3406,7 +3513,7 @@ NULL</CODE>.</P> |
|
|
|
<BR> The SAX callback must call mxmlRetain() for any nodes that need to |
|
|
|
<BR> The SAX callback must call mxmlRetain() for any nodes that need to |
|
|
|
be kept for later use. Otherwise, nodes are deleted when the parent |
|
|
|
be kept for later use. Otherwise, nodes are deleted when the parent |
|
|
|
node is closed or after each data, comment, CDATA, or directive node.</P> |
|
|
|
node is closed or after each data, comment, CDATA, or directive node.</P> |
|
|
|
<H3 class="function"><A NAME="8_2_50"> |
|
|
|
<H3 class="function"><A NAME="8_2_51"> |
|
|
|
<!--span class="info"--> |
|
|
|
<!--span class="info"--> |
|
|
|
Mini-XML 2.3 <A name="mxmlSAXLoadString">mxmlSAXLoadString</A></A></H3> |
|
|
|
Mini-XML 2.3 <A name="mxmlSAXLoadString">mxmlSAXLoadString</A></A></H3> |
|
|
|
<P class="description">Load a string into an XML node tree using a SAX |
|
|
|
<P class="description">Load a string into an XML node tree using a SAX |
|
|
@ -3556,7 +3663,7 @@ NULL</CODE>.</P> |
|
|
|
MXML_NO_CALLBACK is specified, whitespace will only be added before |
|
|
|
MXML_NO_CALLBACK is specified, whitespace will only be added before |
|
|
|
MXML_TEXT nodes with leading whitespace and before attribute names |
|
|
|
MXML_TEXT nodes with leading whitespace and before attribute names |
|
|
|
inside opening element tags.</P> |
|
|
|
inside opening element tags.</P> |
|
|
|
<H3 class="function"><A NAME="8_2_55"> |
|
|
|
<H3 class="function"><A NAME="8_2_56"> |
|
|
|
<!--span class="info"--> |
|
|
|
<!--span class="info"--> |
|
|
|
Mini-XML 2.3 <A name="mxmlSetCDATA">mxmlSetCDATA</A></A></H3> |
|
|
|
Mini-XML 2.3 <A name="mxmlSetCDATA">mxmlSetCDATA</A></A></H3> |
|
|
|
<P class="description">Set the element name of a CDATA node.</P> |
|
|
|
<P class="description">Set the element name of a CDATA node.</P> |
|
|
@ -3576,7 +3683,7 @@ NULL</CODE>.</P> |
|
|
|
<H4 class="discussion">Discussion</H4> |
|
|
|
<H4 class="discussion">Discussion</H4> |
|
|
|
<P class="discussion">The node is not changed if it is not a CDATA |
|
|
|
<P class="discussion">The node is not changed if it is not a CDATA |
|
|
|
element node.</P> |
|
|
|
element node.</P> |
|
|
|
<H3 class="function"><A NAME="8_2_56"> |
|
|
|
<H3 class="function"><A NAME="8_2_57"> |
|
|
|
<!--span class="info"--> |
|
|
|
<!--span class="info"--> |
|
|
|
Mini-XML 2.1 <A name="mxmlSetCustom">mxmlSetCustom</A></A></H3> |
|
|
|
Mini-XML 2.1 <A name="mxmlSetCustom">mxmlSetCustom</A></A></H3> |
|
|
|
<P class="description">Set the data and destructor of a custom data |
|
|
|
<P class="description">Set the data and destructor of a custom data |
|
|
@ -3749,7 +3856,7 @@ mxmlSetCustomHandlers</A></H3> |
|
|
|
<P class="description">0 on success, -1 on failure</P> |
|
|
|
<P class="description">0 on success, -1 on failure</P> |
|
|
|
<H4 class="discussion">Discussion</H4> |
|
|
|
<H4 class="discussion">Discussion</H4> |
|
|
|
<P class="discussion">The node is not changed if it is not a text node.</P> |
|
|
|
<P class="discussion">The node is not changed if it is not a text node.</P> |
|
|
|
<H3 class="function"><A NAME="8_2_65"> |
|
|
|
<H3 class="function"><A NAME="8_2_66"> |
|
|
|
<!--span class="info"--> |
|
|
|
<!--span class="info"--> |
|
|
|
Mini-XML 2.7 <A name="mxmlSetUserData">mxmlSetUserData</A></A></H3> |
|
|
|
Mini-XML 2.7 <A name="mxmlSetUserData">mxmlSetUserData</A></A></H3> |
|
|
|
<P class="description">Set the user data pointer for a node.</P> |
|
|
|
<P class="description">Set the user data pointer for a node.</P> |
|
|
@ -3766,7 +3873,7 @@ mxmlSetCustomHandlers</A></H3> |
|
|
|
</DL> |
|
|
|
</DL> |
|
|
|
<H4 class="returnvalue">Return Value</H4> |
|
|
|
<H4 class="returnvalue">Return Value</H4> |
|
|
|
<P class="description">0 on success, -1 on failure</P> |
|
|
|
<P class="description">0 on success, -1 on failure</P> |
|
|
|
<H3 class="function"><A NAME="8_2_66"> |
|
|
|
<H3 class="function"><A NAME="8_2_67"> |
|
|
|
<!--span class="info"--> |
|
|
|
<!--span class="info"--> |
|
|
|
Mini-XML 2.3 <A name="mxmlSetWrapMargin">mxmlSetWrapMargin</A></A></H3> |
|
|
|
Mini-XML 2.3 <A name="mxmlSetWrapMargin">mxmlSetWrapMargin</A></A></H3> |
|
|
|
<P class="description">Set the wrap margin when saving XML data.</P> |
|
|
|
<P class="description">Set the wrap margin when saving XML data.</P> |
|
|
@ -3923,7 +4030,7 @@ hspace="10" src="D.gif" width="100"></A>XML Schema</H1> |
|
|
|
<P>This appendix provides the XML schema that is used for the XML files |
|
|
|
<P>This appendix provides the XML schema that is used for the XML files |
|
|
|
produced by <TT>mxmldoc</TT>. This schema is available on-line at:</P> |
|
|
|
produced by <TT>mxmldoc</TT>. This schema is available on-line at:</P> |
|
|
|
<PRE> |
|
|
|
<PRE> |
|
|
|
http://www.easysw.com/~mike/mxmldoc.xsd |
|
|
|
http://www.minixml.org/mxmldoc.xsd |
|
|
|
</PRE> |
|
|
|
</PRE> |
|
|
|
<H2><A NAME="9_1">mxmldoc.xsd</A></H2> |
|
|
|
<H2><A NAME="9_1">mxmldoc.xsd</A></H2> |
|
|
|
<PRE><SMALL> |
|
|
|
<PRE><SMALL> |
|
|
@ -3931,8 +4038,8 @@ hspace="10" src="D.gif" width="100"></A>XML Schema</H1> |
|
|
|
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> |
|
|
|
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> |
|
|
|
<xsd:annotation> |
|
|
|
<xsd:annotation> |
|
|
|
<xsd:documentation xml:lang="en"> |
|
|
|
<xsd:documentation xml:lang="en"> |
|
|
|
Mini-XML 2.3 documentation schema for mxmldoc output. |
|
|
|
Mini-XML 2.7 documentation schema for mxmldoc output. |
|
|
|
Copyright 2003-2007 by Michael Sweet. |
|
|
|
Copyright 2003-2011 by Michael Sweet. |
|
|
|
</xsd:documentation> |
|
|
|
</xsd:documentation> |
|
|
|
</xsd:annotation> |
|
|
|
</xsd:annotation> |
|
|
|
|
|
|
|
|
|
|
|