From 94ad843d3500b385be7513fa7ad64845c29664a3 Mon Sep 17 00:00:00 2001
From: Michael R Sweet
You load an XML file using the
The mxmlLoadString()
function loads XML node trees from a string: The first and third arguments are the same as used for
@@ -199,7 +202,8 @@ functions save XML node trees to strings:
char buffer[8192];
mxml_node_t *tree;
...
- tree = mxmlLoadString(NULL, buffer, MXML_NO_CALLBACK);
+ tree = mxmlLoadString(NULL, buffer,
+ MXML_NO_CALLBACK);
- mxml_node_t *node = mxmlWalkPrev(current, tree, MXML_DESCEND); + mxml_node_t *node; + + node = mxmlWalkPrev(current, tree, MXML_DESCEND); - mxml_node_t *node = mxmlWalkNext(current, tree, MXML_DESCEND); + node = mxmlWalkNext(current, tree, MXML_DESCEND);
In addition, you can find a named element/node using the mxmlFindElement() function:
- mxml_node_t *node = mxmlFindElement(tree, tree, "name", "attr", - "value", MXML_DESCEND); + mxml_node_t *node; + + node = mxmlFindElement(tree, tree, "name", + "attr", "value", + MXML_DESCEND);
The name, attr, and value @@ -242,20 +251,34 @@ e.g.:
/* Find the first "a" element */ - node = mxmlFindElement(tree, tree, "a", NULL, NULL, MXML_DESCEND); + node = mxmlFindElement(tree, tree, "a", + NULL, NULL, + MXML_DESCEND); - /* Find the first "a" element with "href" attribute */ - node = mxmlFindElement(tree, tree, "a", "href", NULL, MXML_DESCEND); + /* Find the first "a" element with "href" + attribute */ + node = mxmlFindElement(tree, tree, "a", + "href", NULL, + MXML_DESCEND); - /* Find the first "a" element with "href" to a URL */ - node = mxmlFindElement(tree, tree, "a", "href", - "http://www.easysw.com/~mike/mxml/", MXML_DESCEND); + /* Find the first "a" element with "href" + to a URL */ + node = mxmlFindElement(tree, tree, "a", + "href", + "http://www.easysw.com/", + MXML_DESCEND); - /* Find the first element with a "src" attribute*/ - node = mxmlFindElement(tree, tree, NULL, "src", NULL, MXML_DESCEND); + /* Find the first element with a "src" + attribute */ + node = mxmlFindElement(tree, tree, NULL, + "src", NULL, + MXML_DESCEND); - /* Find the first element with a "src" = "foo.jpg" */ - node = mxmlFindElement(tree, tree, NULL, "src", "foo.jpg", MXML_DESCEND); + /* Find the first element with a "src" + = "foo.jpg" */ + node = mxmlFindElement(tree, tree, NULL, + "src", "foo.jpg", + MXML_DESCEND);
You can also iterate with the same function:
@@ -263,9 +286,13 @@ e.g.:mxml_node_t *node; - for (node = mxmlFindElement(tree, tree, "name", NULL, NULL, MXML_DESCEND); + for (node = mxmlFindElement(tree, tree, "name", + NULL, NULL, + MXML_DESCEND); node != NULL; - node = mxmlFindElement(node, tree, "name", NULL, NULL, MXML_DESCEND)) + node = mxmlFindElement(node, tree, "name", + NULL, NULL, + MXML_DESCEND)) { ... do something ... } diff --git a/doc/mxml-pocket.book b/doc/mxml-pocket.book new file mode 100644 index 0000000..f851b3a --- /dev/null +++ b/doc/mxml-pocket.book @@ -0,0 +1,10 @@ +#HTMLDOC 1.8.27.1 +-t pdf14 -f "mxml-pocket.pdf" --book --toclevels 3 --no-numbered --toctitle "Table of Contents" --title --titleimage "logo.png" --linkstyle plain --size 4.25x6.875in --left 0.750in --right 0.50in --top 0.50in --bottom 0.50in --header .t. --header1 ... --footer h.1 --nup 1 --tocheader .t. --tocfooter ..i --duplex --portrait --color --no-pscommands --no-xrxcomments --compression=9 --jpeg=95 --fontsize 9.0 --fontspacing 1.2 --headingfont Helvetica --bodyfont Helvetica --headfootsize 8.0 --headfootfont Helvetica-Oblique --charset iso-8859-1 --links --no-embedfonts --pagemode outline --pagelayout single --firstpage c1 --pageeffect none --pageduration 10 --effectduration 1.0 --no-encryption --permissions all --owner-password "" --user-password "" --browserwidth 680 --no-strict --no-overflow +intro.html +install.html +basics.html +advanced.html +mxmldoc.html +license.html +relnotes.html +refapp.html