From 94ad843d3500b385be7513fa7ad64845c29664a3 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Thu, 19 Apr 2007 03:31:10 +0000 Subject: [PATCH] Formatting changes. --- doc/basics.html | 71 ++++++++++++++++++++++++++++++-------------- doc/mxml-pocket.book | 10 +++++++ 2 files changed, 59 insertions(+), 22 deletions(-) create mode 100644 doc/mxml-pocket.book diff --git a/doc/basics.html b/doc/basics.html index ca20594..1c53d46 100644 --- a/doc/basics.html +++ b/doc/basics.html @@ -106,6 +106,7 @@ particular node or the entire tree:

mxmlDelete(tree); +

Loading XML

You load an XML file using the

The mxmlLoadString() function loads XML node trees from a string:

+
     char buffer[8192];
     mxml_node_t *tree;
 
     ...
-    tree = mxmlLoadString(NULL, buffer, MXML_NO_CALLBACK);
+    tree = mxmlLoadString(NULL, buffer,
+                          MXML_NO_CALLBACK);
 

The first and third arguments are the same as used for @@ -199,7 +202,8 @@ functions save XML node trees to strings:

mxml_node_t *tree; ... - mxmlSaveString(tree, buffer, sizeof(buffer), MXML_NO_CALLBACK); + mxmlSaveString(tree, buffer, sizeof(buffer), + MXML_NO_CALLBACK); ... ptr = mxmlSaveAllocString(tree, MXML_NO_CALLBACK); @@ -222,9 +226,11 @@ href='#mxmlWalkNext'>mxmlWalkNext()functions can be used to iterate through the XML node tree:

-    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);
-
-    /* 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 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);
+    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"
+       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"
+       = "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