|
|
@ -26,14 +26,14 @@ functionality:</p> |
|
|
|
<p>Mini-XML provides a single header file which you include:</p> |
|
|
|
<p>Mini-XML provides a single header file which you include:</p> |
|
|
|
|
|
|
|
|
|
|
|
<pre> |
|
|
|
<pre> |
|
|
|
#include <mxml.h> |
|
|
|
#include <mxml.h> |
|
|
|
</pre> |
|
|
|
</pre> |
|
|
|
|
|
|
|
|
|
|
|
<p>The Mini-XML library is included with your program using the |
|
|
|
<p>The Mini-XML library is included with your program using the |
|
|
|
<kbd>-lmxml</kbd> option:</p> |
|
|
|
<kbd>-lmxml</kbd> option:</p> |
|
|
|
|
|
|
|
|
|
|
|
<pre> |
|
|
|
<pre> |
|
|
|
<kbd>gcc -o myprogram myprogram.c -lmxml ENTER</kbd> |
|
|
|
<kbd>gcc -o myprogram myprogram.c -lmxml ENTER</kbd> |
|
|
|
</pre> |
|
|
|
</pre> |
|
|
|
|
|
|
|
|
|
|
|
<p>If you have the <tt>pkg-config(1)</tt> software installed, |
|
|
|
<p>If you have the <tt>pkg-config(1)</tt> software installed, |
|
|
@ -41,8 +41,8 @@ you can use it to determine the proper compiler and linker options |
|
|
|
for your installation:</p> |
|
|
|
for your installation:</p> |
|
|
|
|
|
|
|
|
|
|
|
<pre> |
|
|
|
<pre> |
|
|
|
<kbd>pkg-config --cflags mxml ENTER</kbd> |
|
|
|
<kbd>pkg-config --cflags mxml ENTER</kbd> |
|
|
|
<kbd>pkg-config --libs mxml ENTER</kbd> |
|
|
|
<kbd>pkg-config --libs mxml ENTER</kbd> |
|
|
|
</pre> |
|
|
|
</pre> |
|
|
|
|
|
|
|
|
|
|
|
<h2>Nodes</h2> |
|
|
|
<h2>Nodes</h2> |
|
|
@ -55,8 +55,8 @@ sibling nodes (previous and next), and potentially child nodes.</p> |
|
|
|
<p>For example, if you have an XML file like the following:</p> |
|
|
|
<p>For example, 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> |
|
|
|
<node>val1</node> |
|
|
|
<node>val1</node> |
|
|
|
<node>val2</node> |
|
|
|
<node>val2</node> |
|
|
|
<node>val3</node> |
|
|
|
<node>val3</node> |
|
|
@ -67,19 +67,19 @@ sibling nodes (previous and next), and potentially child nodes.</p> |
|
|
|
</group> |
|
|
|
</group> |
|
|
|
<node>val7</node> |
|
|
|
<node>val7</node> |
|
|
|
<node>val8</node> |
|
|
|
<node>val8</node> |
|
|
|
</data> |
|
|
|
</data> |
|
|
|
</pre> |
|
|
|
</pre> |
|
|
|
|
|
|
|
|
|
|
|
<p>the node tree for the file would look like the following in memory:</p> |
|
|
|
<p>the node tree for the file would look like the following in memory:</p> |
|
|
|
|
|
|
|
|
|
|
|
<pre> |
|
|
|
<pre> |
|
|
|
?xml version="1.0" encoding="utf-8"? |
|
|
|
?xml version="1.0" encoding="utf-8"? |
|
|
|
| |
|
|
|
| |
|
|
|
data |
|
|
|
data |
|
|
|
| |
|
|
|
| |
|
|
|
node - node - node - group - node - node |
|
|
|
node - node - node - group - node - node |
|
|
|
| | | | | | |
|
|
|
| | | | | | |
|
|
|
val1 val2 val3 | val7 val8 |
|
|
|
val1 val2 val3 | val7 val8 |
|
|
|
| |
|
|
|
| |
|
|
|
node - node - node |
|
|
|
node - node - node |
|
|
|
| | | |
|
|
|
| | | |
|
|
@ -154,22 +154,22 @@ first and last child nodes for the element, respectively.</p> |
|
|
|
<a href="#mxmlGetInteger"><tt>mxmlGetInteger</tt></a> function retrieves the |
|
|
|
<a href="#mxmlGetInteger"><tt>mxmlGetInteger</tt></a> function retrieves the |
|
|
|
integer value for a node.</p> |
|
|
|
integer value for a node.</p> |
|
|
|
|
|
|
|
|
|
|
|
<h3>Opaque Nodes</h3> |
|
|
|
<h3>Opaque String Nodes</h3> |
|
|
|
|
|
|
|
|
|
|
|
<p>Opaque (<tt>MXML_OPAQUE</tt>) nodes are created using the |
|
|
|
<p>Opaque string (<tt>MXML_OPAQUE</tt>) nodes are created using the |
|
|
|
<a href="#mxmlNewOpaque"><tt>mxmlNewOpaque</tt></a> function. The |
|
|
|
<a href="#mxmlNewOpaque"><tt>mxmlNewOpaque</tt></a> function. The |
|
|
|
<a href="#mxmlGetOpaque"><tt>mxmlGetOpaque</tt></a> function retrieves the |
|
|
|
<a href="#mxmlGetOpaque"><tt>mxmlGetOpaque</tt></a> function retrieves the |
|
|
|
opaque string pointer for a node. Opaque nodes are like string nodes but |
|
|
|
opaque string pointer for a node. Opaque nodes are like string nodes but |
|
|
|
preserve all whitespace between nodes.</p> |
|
|
|
preserve all whitespace between nodes.</p> |
|
|
|
|
|
|
|
|
|
|
|
<h3>Text Nodes</h3> |
|
|
|
<h3>Text String Nodes</h3> |
|
|
|
|
|
|
|
|
|
|
|
<p>Text (<tt>MXML_TEXT</tt>) nodes are created using the |
|
|
|
<p>Text string (<tt>MXML_TEXT</tt>) nodes are created using the |
|
|
|
<a href="#mxmlNewText"><tt>mxmlNewText</tt></a> and |
|
|
|
<a href="#mxmlNewText"><tt>mxmlNewText</tt></a> and |
|
|
|
<a href="#mxmlNewTextf"><tt>mxmlNewTextf</tt></a> functions. Each text node |
|
|
|
<a href="#mxmlNewTextf"><tt>mxmlNewTextf</tt></a> functions. Each text node |
|
|
|
consists of a text string and (leading) whitespace value - the |
|
|
|
consists of a single word string and (leading) whitespace value - the |
|
|
|
<a href="#mxmlGetText"><tt>mxmlGetText</tt></a> function retrieves the |
|
|
|
<a href="#mxmlGetText"><tt>mxmlGetText</tt></a> function retrieves the |
|
|
|
text string pointer and whitespace value for a node.</p> |
|
|
|
string pointer and whitespace value for a node.</p> |
|
|
|
|
|
|
|
|
|
|
|
<!-- NEED 12 --> |
|
|
|
<!-- NEED 12 --> |
|
|
|
<h3>Processing Instruction Nodes</h3> |
|
|
|
<h3>Processing Instruction Nodes</h3> |
|
|
@ -216,14 +216,14 @@ various <tt>mxmlNew</tt> functions. The following code will |
|
|
|
create the XML document described in the previous section:</p> |
|
|
|
create the XML document described in the previous section:</p> |
|
|
|
|
|
|
|
|
|
|
|
<pre> |
|
|
|
<pre> |
|
|
|
mxml_node_t *xml; /* <?xml ... ?> */ |
|
|
|
mxml_node_t *xml; /* <?xml ... ?> */ |
|
|
|
mxml_node_t *data; /* <data> */ |
|
|
|
mxml_node_t *data; /* <data> */ |
|
|
|
mxml_node_t *node; /* <node> */ |
|
|
|
mxml_node_t *node; /* <node> */ |
|
|
|
mxml_node_t *group; /* <group> */ |
|
|
|
mxml_node_t *group; /* <group> */ |
|
|
|
|
|
|
|
|
|
|
|
xml = mxmlNewXML("1.0"); |
|
|
|
xml = mxmlNewXML("1.0"); |
|
|
|
|
|
|
|
|
|
|
|
data = mxmlNewElement(xml, "data"); |
|
|
|
data = mxmlNewElement(xml, "data"); |
|
|
|
|
|
|
|
|
|
|
|
node = mxmlNewElement(data, "node"); |
|
|
|
node = mxmlNewElement(data, "node"); |
|
|
|
mxmlNewText(node, 0, "val1"); |
|
|
|
mxmlNewText(node, 0, "val1"); |
|
|
@ -252,7 +252,7 @@ create the XML document described in the previous section:</p> |
|
|
|
<a href="#mxmlNewXML"><tt>mxmlNewXML</tt></a> function:</p> |
|
|
|
<a href="#mxmlNewXML"><tt>mxmlNewXML</tt></a> function:</p> |
|
|
|
|
|
|
|
|
|
|
|
<pre> |
|
|
|
<pre> |
|
|
|
xml = mxmlNewXML("1.0"); |
|
|
|
xml = mxmlNewXML("1.0"); |
|
|
|
</pre> |
|
|
|
</pre> |
|
|
|
|
|
|
|
|
|
|
|
<p>We then create the <tt><data></tt> node used for this document using |
|
|
|
<p>We then create the <tt><data></tt> node used for this document using |
|
|
@ -261,7 +261,7 @@ argument specifies the parent node (<tt>xml</tt>) while the second specifies the |
|
|
|
element name (<tt>data</tt>):</p> |
|
|
|
element name (<tt>data</tt>):</p> |
|
|
|
|
|
|
|
|
|
|
|
<pre> |
|
|
|
<pre> |
|
|
|
data = mxmlNewElement(xml, "data"); |
|
|
|
data = mxmlNewElement(xml, "data"); |
|
|
|
</pre> |
|
|
|
</pre> |
|
|
|
|
|
|
|
|
|
|
|
<p>Each <tt><node>...</node></tt> in the file is created using the |
|
|
|
<p>Each <tt><node>...</node></tt> in the file is created using the |
|
|
@ -272,8 +272,8 @@ the text - 0 or false in this case. The last argument specifies the actual text |
|
|
|
to add:</p> |
|
|
|
to add:</p> |
|
|
|
|
|
|
|
|
|
|
|
<pre> |
|
|
|
<pre> |
|
|
|
node = mxmlNewElement(data, "node"); |
|
|
|
node = mxmlNewElement(data, "node"); |
|
|
|
mxmlNewText(node, 0, "val1"); |
|
|
|
mxmlNewText(node, 0, "val1"); |
|
|
|
</pre> |
|
|
|
</pre> |
|
|
|
|
|
|
|
|
|
|
|
<p>The resulting in-memory XML document can then be saved or processed just like |
|
|
|
<p>The resulting in-memory XML document can then be saved or processed just like |
|
|
@ -287,13 +287,13 @@ href='#mxmlLoadFile'><tt>mxmlLoadFile</tt></a> |
|
|
|
function:</p> |
|
|
|
function:</p> |
|
|
|
|
|
|
|
|
|
|
|
<pre> |
|
|
|
<pre> |
|
|
|
FILE *fp; |
|
|
|
FILE *fp; |
|
|
|
mxml_node_t *tree; |
|
|
|
mxml_node_t *tree; |
|
|
|
|
|
|
|
|
|
|
|
fp = fopen("filename.xml", "r"); |
|
|
|
fp = fopen("filename.xml", "r"); |
|
|
|
tree = mxmlLoadFile(NULL, fp, |
|
|
|
tree = mxmlLoadFile(NULL, fp, |
|
|
|
MXML_TEXT_CALLBACK); |
|
|
|
MXML_OPAQUE_CALLBACK); |
|
|
|
fclose(fp); |
|
|
|
fclose(fp); |
|
|
|
</pre> |
|
|
|
</pre> |
|
|
|
|
|
|
|
|
|
|
|
<p>The first argument specifies an existing XML parent node, if |
|
|
|
<p>The first argument specifies an existing XML parent node, if |
|
|
@ -313,24 +313,24 @@ the value type of the immediate children for a new element node: |
|
|
|
<tt>MXML_INTEGER</tt>, <tt>MXML_OPAQUE</tt>, <tt>MXML_REAL</tt>, |
|
|
|
<tt>MXML_INTEGER</tt>, <tt>MXML_OPAQUE</tt>, <tt>MXML_REAL</tt>, |
|
|
|
or <tt>MXML_TEXT</tt>. Load callbacks are described in detail in |
|
|
|
or <tt>MXML_TEXT</tt>. Load callbacks are described in detail in |
|
|
|
<a href='#LOAD_CALLBACKS'>Chapter 3</a>. The example code uses |
|
|
|
<a href='#LOAD_CALLBACKS'>Chapter 3</a>. The example code uses |
|
|
|
the <tt>MXML_TEXT_CALLBACK</tt> constant which specifies that all |
|
|
|
the <tt>MXML_OPAQUE_CALLBACK</tt> constant which specifies that all |
|
|
|
data nodes in the document contain whitespace-separated text |
|
|
|
data nodes in the document contain opaque string values with whitespace |
|
|
|
values. Other standard callbacks include |
|
|
|
preserved. Other standard callbacks include |
|
|
|
<tt>MXML_IGNORE_CALLBACK</tt>, <tt>MXML_INTEGER_CALLBACK</tt>, |
|
|
|
<tt>MXML_IGNORE_CALLBACK</tt>, <tt>MXML_INTEGER_CALLBACK</tt>, |
|
|
|
<tt>MXML_OPAQUE_CALLBACK</tt>, and |
|
|
|
<tt>MXML_REAL_CALLBACK</tt>, and |
|
|
|
<tt>MXML_REAL_CALLBACK</tt>.</p> |
|
|
|
<tt>MXML_TEXT_CALLBACK</tt>.</p> |
|
|
|
|
|
|
|
|
|
|
|
<p>The <a href='#mxmlLoadString'><tt>mxmlLoadString</tt></a> |
|
|
|
<p>The <a href='#mxmlLoadString'><tt>mxmlLoadString</tt></a> |
|
|
|
function loads XML node trees from a string:</p> |
|
|
|
function loads XML node trees from a string:</p> |
|
|
|
|
|
|
|
|
|
|
|
<!-- NEED 10 --> |
|
|
|
<!-- NEED 10 --> |
|
|
|
<pre> |
|
|
|
<pre> |
|
|
|
char buffer[8192]; |
|
|
|
char buffer[8192]; |
|
|
|
mxml_node_t *tree; |
|
|
|
mxml_node_t *tree; |
|
|
|
|
|
|
|
|
|
|
|
... |
|
|
|
... |
|
|
|
tree = mxmlLoadString(NULL, buffer, |
|
|
|
tree = mxmlLoadString(NULL, buffer, |
|
|
|
MXML_TEXT_CALLBACK); |
|
|
|
MXML_OPAQUE_CALLBACK); |
|
|
|
</pre> |
|
|
|
</pre> |
|
|
|
|
|
|
|
|
|
|
|
<p>The first and third arguments are the same as used for |
|
|
|
<p>The first and third arguments are the same as used for |
|
|
@ -347,12 +347,12 @@ is <tt>NULL</tt>.</p> |
|
|
|
href='#mxmlSaveFile'><tt>mxmlSaveFile</tt></a> function:</p> |
|
|
|
href='#mxmlSaveFile'><tt>mxmlSaveFile</tt></a> function:</p> |
|
|
|
|
|
|
|
|
|
|
|
<pre> |
|
|
|
<pre> |
|
|
|
FILE *fp; |
|
|
|
FILE *fp; |
|
|
|
mxml_node_t *tree; |
|
|
|
mxml_node_t *tree; |
|
|
|
|
|
|
|
|
|
|
|
fp = fopen("filename.xml", "w"); |
|
|
|
fp = fopen("filename.xml", "w"); |
|
|
|
mxmlSaveFile(tree, fp, MXML_NO_CALLBACK); |
|
|
|
mxmlSaveFile(tree, fp, MXML_NO_CALLBACK); |
|
|
|
fclose(fp); |
|
|
|
fclose(fp); |
|
|
|
</pre> |
|
|
|
</pre> |
|
|
|
|
|
|
|
|
|
|
|
<p>The first argument is the XML node tree to save. It should |
|
|
|
<p>The first argument is the XML node tree to save. It should |
|
|
@ -376,16 +376,16 @@ and <a href='#mxmlSaveString'><tt>mxmlSaveString</tt></a> |
|
|
|
functions save XML node trees to strings:</p> |
|
|
|
functions save XML node trees to strings:</p> |
|
|
|
|
|
|
|
|
|
|
|
<pre> |
|
|
|
<pre> |
|
|
|
char buffer[8192]; |
|
|
|
char buffer[8192]; |
|
|
|
char *ptr; |
|
|
|
char *ptr; |
|
|
|
mxml_node_t *tree; |
|
|
|
mxml_node_t *tree; |
|
|
|
|
|
|
|
|
|
|
|
... |
|
|
|
... |
|
|
|
mxmlSaveString(tree, buffer, sizeof(buffer), |
|
|
|
mxmlSaveString(tree, buffer, sizeof(buffer), |
|
|
|
MXML_NO_CALLBACK); |
|
|
|
MXML_NO_CALLBACK); |
|
|
|
|
|
|
|
|
|
|
|
... |
|
|
|
... |
|
|
|
ptr = mxmlSaveAllocString(tree, MXML_NO_CALLBACK); |
|
|
|
ptr = mxmlSaveAllocString(tree, MXML_NO_CALLBACK); |
|
|
|
</pre> |
|
|
|
</pre> |
|
|
|
|
|
|
|
|
|
|
|
<p>The first and last arguments are the same as used for |
|
|
|
<p>The first and last arguments are the same as used for |
|
|
@ -405,11 +405,11 @@ href='#mxmlSetWrapMargin'><tt>mxmlSetWrapMargin</tt></a> function |
|
|
|
overrides the default wrap margin:</p> |
|
|
|
overrides the default wrap margin:</p> |
|
|
|
|
|
|
|
|
|
|
|
<pre> |
|
|
|
<pre> |
|
|
|
/* Set the margin to 132 columns */ |
|
|
|
/* Set the margin to 132 columns */ |
|
|
|
mxmlSetWrapMargin(132); |
|
|
|
mxmlSetWrapMargin(132); |
|
|
|
|
|
|
|
|
|
|
|
/* Disable wrapping */ |
|
|
|
/* Disable wrapping */ |
|
|
|
mxmlSetWrapMargin(0); |
|
|
|
mxmlSetWrapMargin(0); |
|
|
|
</pre> |
|
|
|
</pre> |
|
|
|
|
|
|
|
|
|
|
|
<h2>Memory Management</h2> |
|
|
|
<h2>Memory Management</h2> |
|
|
@ -420,7 +420,7 @@ free the memory that is used for a particular node or the entire |
|
|
|
tree:</p> |
|
|
|
tree:</p> |
|
|
|
|
|
|
|
|
|
|
|
<pre> |
|
|
|
<pre> |
|
|
|
mxmlDelete(tree); |
|
|
|
mxmlDelete(tree); |
|
|
|
</pre> |
|
|
|
</pre> |
|
|
|
|
|
|
|
|
|
|
|
<p>You can also use reference counting to manage memory usage. The |
|
|
|
<p>You can also use reference counting to manage memory usage. The |
|
|
@ -442,12 +442,12 @@ href='#mxmlWalkNext'><tt>mxmlWalkNext</tt></a>functions |
|
|
|
can be used to iterate through the XML node tree:</p> |
|
|
|
can be used to iterate through the XML node tree:</p> |
|
|
|
|
|
|
|
|
|
|
|
<pre> |
|
|
|
<pre> |
|
|
|
mxml_node_t *node; |
|
|
|
mxml_node_t *node; |
|
|
|
|
|
|
|
|
|
|
|
node = mxmlWalkPrev(current, tree, |
|
|
|
node = mxmlWalkPrev(current, tree, |
|
|
|
MXML_DESCEND); |
|
|
|
MXML_DESCEND); |
|
|
|
|
|
|
|
|
|
|
|
node = mxmlWalkNext(current, tree, |
|
|
|
node = mxmlWalkNext(current, tree, |
|
|
|
MXML_DESCEND); |
|
|
|
MXML_DESCEND); |
|
|
|
</pre> |
|
|
|
</pre> |
|
|
|
|
|
|
|
|
|
|
@ -456,9 +456,9 @@ href='#mxmlFindElement'><tt>mxmlFindElement</tt></a> |
|
|
|
function:</p> |
|
|
|
function:</p> |
|
|
|
|
|
|
|
|
|
|
|
<pre> |
|
|
|
<pre> |
|
|
|
mxml_node_t *node; |
|
|
|
mxml_node_t *node; |
|
|
|
|
|
|
|
|
|
|
|
node = mxmlFindElement(tree, tree, "name", |
|
|
|
node = mxmlFindElement(tree, tree, "name", |
|
|
|
"attr", "value", |
|
|
|
"attr", "value", |
|
|
|
MXML_DESCEND); |
|
|
|
MXML_DESCEND); |
|
|
|
</pre> |
|
|
|
</pre> |
|
|
@ -469,41 +469,41 @@ e.g.:</p> |
|
|
|
|
|
|
|
|
|
|
|
<!-- NEED 4 --> |
|
|
|
<!-- NEED 4 --> |
|
|
|
<pre> |
|
|
|
<pre> |
|
|
|
/* Find the first "a" element */ |
|
|
|
/* Find the first "a" element */ |
|
|
|
node = mxmlFindElement(tree, tree, "a", |
|
|
|
node = mxmlFindElement(tree, tree, "a", |
|
|
|
NULL, NULL, |
|
|
|
NULL, NULL, |
|
|
|
MXML_DESCEND); |
|
|
|
MXML_DESCEND); |
|
|
|
</pre> |
|
|
|
</pre> |
|
|
|
<!-- NEED 5 --> |
|
|
|
<!-- NEED 5 --> |
|
|
|
<pre> |
|
|
|
<pre> |
|
|
|
/* Find the first "a" element with "href" |
|
|
|
/* Find the first "a" element with "href" |
|
|
|
attribute */ |
|
|
|
attribute */ |
|
|
|
node = mxmlFindElement(tree, tree, "a", |
|
|
|
node = mxmlFindElement(tree, tree, "a", |
|
|
|
"href", NULL, |
|
|
|
"href", NULL, |
|
|
|
MXML_DESCEND); |
|
|
|
MXML_DESCEND); |
|
|
|
</pre> |
|
|
|
</pre> |
|
|
|
<!-- NEED 6 --> |
|
|
|
<!-- NEED 6 --> |
|
|
|
<pre> |
|
|
|
<pre> |
|
|
|
/* Find the first "a" element with "href" |
|
|
|
/* Find the first "a" element with "href" |
|
|
|
to a URL */ |
|
|
|
to a URL */ |
|
|
|
node = mxmlFindElement(tree, tree, "a", |
|
|
|
node = mxmlFindElement(tree, tree, "a", |
|
|
|
"href", |
|
|
|
"href", |
|
|
|
"http://www.easysw.com/", |
|
|
|
"http://www.example.com/", |
|
|
|
MXML_DESCEND); |
|
|
|
MXML_DESCEND); |
|
|
|
</pre> |
|
|
|
</pre> |
|
|
|
<!-- NEED 5 --> |
|
|
|
<!-- NEED 5 --> |
|
|
|
<pre> |
|
|
|
<pre> |
|
|
|
/* Find the first element with a "src" |
|
|
|
/* Find the first element with a "src" |
|
|
|
attribute */ |
|
|
|
attribute */ |
|
|
|
node = mxmlFindElement(tree, tree, NULL, |
|
|
|
node = mxmlFindElement(tree, tree, NULL, |
|
|
|
"src", NULL, |
|
|
|
"src", NULL, |
|
|
|
MXML_DESCEND); |
|
|
|
MXML_DESCEND); |
|
|
|
</pre> |
|
|
|
</pre> |
|
|
|
<!-- NEED 5 --> |
|
|
|
<!-- NEED 5 --> |
|
|
|
<pre> |
|
|
|
<pre> |
|
|
|
/* Find the first element with a "src" |
|
|
|
/* Find the first element with a "src" |
|
|
|
= "foo.jpg" */ |
|
|
|
= "foo.jpg" */ |
|
|
|
node = mxmlFindElement(tree, tree, NULL, |
|
|
|
node = mxmlFindElement(tree, tree, NULL, |
|
|
|
"src", "foo.jpg", |
|
|
|
"src", "foo.jpg", |
|
|
|
MXML_DESCEND); |
|
|
|
MXML_DESCEND); |
|
|
|
</pre> |
|
|
|
</pre> |
|
|
@ -511,9 +511,9 @@ e.g.:</p> |
|
|
|
<p>You can also iterate with the same function:</p> |
|
|
|
<p>You can also iterate with the same function:</p> |
|
|
|
|
|
|
|
|
|
|
|
<pre> |
|
|
|
<pre> |
|
|
|
mxml_node_t *node; |
|
|
|
mxml_node_t *node; |
|
|
|
|
|
|
|
|
|
|
|
for (node = mxmlFindElement(tree, tree, |
|
|
|
for (node = mxmlFindElement(tree, tree, |
|
|
|
"name", |
|
|
|
"name", |
|
|
|
NULL, NULL, |
|
|
|
NULL, NULL, |
|
|
|
MXML_DESCEND); |
|
|
|
MXML_DESCEND); |
|
|
@ -522,9 +522,9 @@ e.g.:</p> |
|
|
|
"name", |
|
|
|
"name", |
|
|
|
NULL, NULL, |
|
|
|
NULL, NULL, |
|
|
|
MXML_DESCEND)) |
|
|
|
MXML_DESCEND)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
... do something ... |
|
|
|
... do something ... |
|
|
|
} |
|
|
|
} |
|
|
|
</pre> |
|
|
|
</pre> |
|
|
|
|
|
|
|
|
|
|
|
<!-- NEED 10 --> |
|
|
|
<!-- NEED 10 --> |
|
|
@ -577,9 +577,9 @@ three constants:</p> |
|
|
|
href='#mxmlFindValue'><tt>mxmlFindPath</tt></a>, for example: |
|
|
|
href='#mxmlFindValue'><tt>mxmlFindPath</tt></a>, for example: |
|
|
|
|
|
|
|
|
|
|
|
<pre> |
|
|
|
<pre> |
|
|
|
mxml_node_t *value; |
|
|
|
mxml_node_t *value; |
|
|
|
|
|
|
|
|
|
|
|
value = mxmlFindPath(tree, "path/to/*/foo/bar"); |
|
|
|
value = mxmlFindPath(tree, "path/to/*/foo/bar"); |
|
|
|
</pre> |
|
|
|
</pre> |
|
|
|
|
|
|
|
|
|
|
|
<p>The second argument is a "path" to the parent node. Each component of the |
|
|
|
<p>The second argument is a "path" to the parent node. Each component of the |
|
|
|