diff --git a/CHANGES b/CHANGES index 72d49be..9b8452f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,10 +1,11 @@ -CHANGES - 2007-04-19 +CHANGES - 2007-04-22 -------------------- CHANGES IN Mini-XML 2.3 - Added two exceptions to the LGPL to support static linking of applications against Mini-XML + - The mxmldoc utility can now generate man pages, too. - Added a mxmlNewXML() function - Added a mxmlElementSetAttrf() function (STR #43) - Added snprintf() emulation function for test program (STR diff --git a/Makefile.in b/Makefile.in index d631923..9fd7445 100644 --- a/Makefile.in +++ b/Makefile.in @@ -113,7 +113,7 @@ all: Makefile config.h $(TARGETS) # clean: - $(RM) $(OBJS) $(TARGETS) + $(RM) $(OBJS) $(TARGETS) doc/mxml.man $(RM) mxmldoc-static libmxml.a @@ -349,6 +349,16 @@ valgrind: mxmldoc-static >valgrind.html 2>valgrind.out +# +# doc/mxml.man +# + +doc/mxml.man: mxmldoc-static mxml.xml + $(RM) doc/mxml.man + ./mxmldoc-static --man mxml --title "Mini-XML API" \ + --intro doc/intro.man mxml.xml >doc/mxml.man + + # # All object files depend on the makefile... # diff --git a/doc/advanced.html b/doc/advanced.html index 54689d6..1acd7d1 100644 --- a/doc/advanced.html +++ b/doc/advanced.html @@ -346,6 +346,7 @@ function:

+

Changing Node Values

All of the examples so far have concentrated on creating and @@ -483,5 +484,147 @@ function:

mxmlIndexDelete(ind); +

SAX (Stream) Loading of Documents

+ +

Mini-XML supports an implementation of the Simple API for XML +(SAX) which allows you to load and process an XML document as a +stream of nodes. Aside from allowing you to process XML documents of +any size, the Mini-XML implementation also allows you to retain +portions of the document in memory for later processing.

+ +

The mxmlSAXLoadFd, mxmlSAXLoadFile, and mxmlSAXLoadString functions +provide the SAX loading APIs. Each function works like the +corresponding mxmlLoad function but uses a callback to +process each node as it is read.

+ +

The callback function receives the node, an event code, and +a user data pointer you supply:

+ +
+    void
+    sax_cb(mxml_node_t *node, mxml_sax_event_t event,
+           void *data)
+    {
+      ... do something ...
+    }
+
+ +

The event will be one of the following:

+ + + +

Elements are released after the close element is +processed. All other nodes are released after they are processed. +The SAX callback can retain the node using the mxmlRetain function. For example, +the following SAX callback will retain all nodes, effectively +simulating a normal in-memory load:

+ +
+    void
+    sax_cb(mxml_node_t *node, mxml_sax_event_t event,
+           void *data)
+    {
+      if (event != MXML_SAX_ELEMENT_CLOSE)
+        mxmlRetain(node);
+    }
+
+ +

More typically the SAX callback will only retain a small portion +of the document that is needed for post-processing. For example, the +following SAX callback will retain the title and headings in an +XHTML file. It also retains the (parent) elements like <html>, <head>, and <body>, and processing +directives like <?xml ... ?> and <!DOCTYPE ... >:

+ + +
+    void
+    sax_cb(mxml_node_t *node,
+           mxml_sax_event_t event,
+           void *data)
+    {
+      if (event == MXML_SAX_ELEMENT_OPEN)
+      {
+       /*
+        * Retain headings and titles...
+        */
+
+        const char *name = node->value.element.name;
+
+        if (!strcmp(name, "html") ||
+            !strcmp(name, "head") ||
+            !strcmp(name, "title") ||
+            !strcmp(name, "body") ||
+            !strcmp(name, "h1") ||
+            !strcmp(name, "h2") ||
+            !strcmp(name, "h3") ||
+            !strcmp(name, "h4") ||
+            !strcmp(name, "h5") ||
+            !strcmp(name, "h6"))
+          mxmlRetain(node);
+      }
+      else if (event == MXML_SAX_DIRECTIVE)
+        mxmlRetain(node);
+      else if (event == MXML_SAX_DATA &&
+               node->parent->ref_count > 1)
+      {
+       /*
+        * If the parent was retained, then retain
+        * this data node as well.
+        */
+
+        mxmlRetain(node);
+      }
+    }
+
+ +

The resulting skeleton document tree can then be searched just +like one loaded using the mxmlLoad functions. For example, +a filter that reads an XHTML document from stdin and then shows the +title and headings in the document would look like:

+ +
+    mxml_node_t *doc, *title, *body, *heading;
+
+    doc = mxmlSAXLoadFd(NULL, 0,
+                        MXML_TEXT_CALLBACK,
+                        sax_cb, NULL);
+
+    title = mxmlFindElement(doc, doc, "title",
+                            NULL, NULL,
+                            MXML_DESCEND);
+
+    if (title)
+      print_children(title);
+
+    body = mxmlFindElement(doc, doc, "body",
+                           NULL, NULL,
+                           MXML_DESCEND);
+
+    if (body)
+    {
+      for (heading = body->child;
+           heading;
+           heading = heading->next)
+        print_children(heading);
+    }
+
+ diff --git a/doc/basics.html b/doc/basics.html index 7d4afc4..126c06f 100644 --- a/doc/basics.html +++ b/doc/basics.html @@ -417,27 +417,31 @@ three constants:

  • MXML_NO_DESCEND means to not to look at any child nodes in the element hierarchy, just look at siblings at the same level or parent nodes until the top - node or top-of-tree is reached. The previous node from - "group" would be the "node" element to the left, while - the next node from "group" would be the "node" element - to the right.

  • - -
  • MXML_DESCEND_FIRST means that it is OK to - descend to the first child of a node, but not to descend - further when searching. You'll normally use this when - iterating through direct children of a parent node, e.g. - all of the "node" elements under the "?xml" parent node - in the example above. This mode is only applicable to - the search function; the walk functions treat this as - MXML_DESCEND since every call is a first - time.

  • + node or top-of-tree is reached. + +

    The previous node from "group" would be the "node" + element to the left, while the next node from "group" would + be the "node" element to the right.

    + +
  • MXML_DESCEND_FIRST means that it is OK to + descend to the first child of a node, but not to descend + further when searching. You'll normally use this when + iterating through direct children of a parent node, e.g. all + of the "node" and "group" elements under the "?xml" parent + node in the example above. + +

    This mode is only applicable to the search function; the + walk functions treat this as MXML_DESCEND since + every call is a first time.

  • MXML_DESCEND means to keep descending until you hit the bottom of the tree. The previous node from "group" would be the "val3" node and the next node would - be the first node element under "group". If you were to - walk from the root node "?xml" to the end of the tree - with mxmlWalkNext(), the order would be: + be the first node element under "group". + +

    If you were to walk from the root node "?xml" to the end + of the tree with mxmlWalkNext(), the order would + be:

    ?xml data node val1 node val2 node val3 group node val4 node val5 node val6 node val7 node val8

    diff --git a/doc/intro.html b/doc/intro.html index 46d6b55..2a212e2 100644 --- a/doc/intro.html +++ b/doc/intro.html @@ -148,9 +148,9 @@ appendices:

    mxmldoc(1) program to generate software documentation.
  • -
  • Appendix A, "GNU - Library General Public License", provides the terms - and conditions for using and distributing Mini-XML.
  • +
  • Appendix A, "Mini-XML License", + provides the terms and conditions for using and distributing + Mini-XML.
  • Appendix B, "Release Notes", lists the changes in each release of Mini-XML.
  • diff --git a/doc/mxml.man b/doc/intro.man similarity index 84% rename from doc/mxml.man rename to doc/intro.man index daf3a78..c531167 100644 --- a/doc/mxml.man +++ b/doc/intro.man @@ -1,23 +1,3 @@ -.\" -.\" "$Id$" -.\" -.\" mxml man page for mini-XML, a small XML-like file parsing library. -.\" -.\" Copyright 2003-2005 by Michael Sweet. -.\" -.\" This program is free software; you can redistribute it and/or -.\" modify it under the terms of the GNU Library General Public -.\" License as published by the Free Software Foundation; either -.\" version 2, or (at your option) any later version. -.\" -.\" This program is distributed in the hope that it will be useful, -.\" but WITHOUT ANY WARRANTY; without even the implied warranty of -.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -.\" GNU General Public License for more details. -.\" -.TH mxml 3 "mini-XML" "2 December 2005" "Michael Sweet" -.SH NAME -mxml \- mini-xml library .SH INCLUDE FILE #include .SH LIBRARY @@ -171,7 +151,4 @@ is used for a particular node or the entire tree: .SH SEE ALSO mxmldoc(1), Mini-XML Programmers Manual, http://www.easysw.com/~mike/mxml/ .SH COPYRIGHT -Copyright 2003-2005 by Michael Sweet. -.\" -.\" End of "$Id$". -.\" +Copyright 2003-2007 by Michael Sweet. diff --git a/doc/license.html b/doc/license.html index 0bba3af..54c4917 100644 --- a/doc/license.html +++ b/doc/license.html @@ -3,8 +3,6 @@

    A - Mini-XML License

    -

    October 18, 2005

    -

    The Mini-XML library and included programs are provided under the terms of the GNU Library General Public License (LGPL) with the following exceptions:

    @@ -32,9 +30,9 @@ the following exceptions:

    -
    + -

    GNU LIBRARY GENERAL PUBLIC LICENSE

    +

    GNU LIBRARY GENERAL PUBLIC LICENSE

    Version 2, June 1991
    Copyright (C) 1991 Free Software Foundation, Inc.
    59 Temple Place - Suite 330, Boston, MA 02111-1307, USA @@ -43,7 +41,7 @@ this license document, but changing it is not allowed.
    [This is the first released version of the library GPL. It is numbered 2 because it goes with version 2 of the ordinary GPL.]

    -

    Preamble

    +

    Preamble

    The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses @@ -145,8 +143,8 @@ library.

    ordinary General Public License rather than by this special one.

    -

    TERMS AND CONDITIONS FOR COPYING, -DISTRIBUTION AND MODIFICATION

    +

    TERMS AND CONDITIONS FOR COPYING, +DISTRIBUTION AND MODIFICATION

    0. This License Agreement applies to any software library which contains a notice placed by the copyright @@ -511,7 +509,7 @@ by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.

    -

    NO WARRANTY

    +

    NO WARRANTY

    15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT @@ -537,54 +535,61 @@ OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

    -

    END OF TERMS AND CONDITIONS

    +

    END OF TERMS AND CONDITIONS

    + +

    How to Apply These Terms to Your New Libraries

    -

    How to Apply These Terms to Your New Libraries

    +

    If you develop a new library, and you want it to be of the +greatest possible use to the public, we recommend making it free +software that everyone can redistribute and change. You can do so +by permitting redistribution under these terms (or, alternatively, +under the terms of the ordinary General Public License). -

    If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). +

    To apply these terms, attach the following notices to the +library. It is safest to attach them to the start of each source +file to most effectively convey the exclusion of warranty; and each +file should have at least the "copyright" line and a pointer to +where the full notice is found. -

    To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. +

    Also add information on how to contact you by electronic and paper mail. -

    You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: +

    You should also get your employer (if you work as a programmer) +or your school, if any, to sign a "copyright disclaimer" for the +library, if necessary. Here is a sample; alter the names: + +

    That's all there is to it! diff --git a/doc/mxmldoc.html b/doc/mxmldoc.html index 4803b0a..e90572b 100644 --- a/doc/mxmldoc.html +++ b/doc/mxmldoc.html @@ -1,36 +1,26 @@ - - - - - mxmldoc - - -

    mxmldoc(1)

    -

    Name

    -mxmldoc - mini-xml documentation generator -

    Synopsis

    -mxmldoc -[ --intro -introfile.html -] [ --section -section -] [ --title -title -] [ -filename.xml -] [ -source file(s) -] > -filename.html -

    Description

    -mxmldoc scans the specified C and C++ source files to + +

    4 - Using the mxmldoc +Utility

    + +

    Originally developed to generate the Mini-XML and CUPS API +documentation, the mxmldoc(1) program converts C and C++ +source files into an intermediate XML format and uses in-line +comments rather than comment headers to annotate functions, types, +and constants. This chapter describes how to use it.

    + +

    The Basics

    + +

    Commenting Your Code

    + +

    Creating HTML Documentation

    + +

    Creating Man Pages

    + +

    The XML Schema

    + +

    mxmldoc scans the specified C and C++ source files to produce an XML representation of globally accessible classes, constants, enumerations, functions, structures, typedefs, unions, and variables. The XML file is updated as necessary and diff --git a/doc/mxmldoc.man b/doc/mxmldoc.man index 32ac1f8..d90c56e 100644 --- a/doc/mxmldoc.man +++ b/doc/mxmldoc.man @@ -3,7 +3,7 @@ .\" .\" mxmldoc man page for mini-XML, a small XML-like file parsing library. .\" -.\" Copyright 2003-2005 by Michael Sweet. +.\" Copyright 2003-2007 by Michael Sweet. .\" .\" This program is free software; you can redistribute it and/or .\" modify it under the terms of the GNU Library General Public @@ -15,13 +15,20 @@ .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" -.TH mxmldoc 1 "mini-XML" "2 December 2005" "Michael Sweet" +.TH mxmldoc 1 "Mini-XML" "22 April 2007" "Michael Sweet" .SH NAME mxmldoc \- mini-xml documentation generator .SH SYNOPSIS .B mxmldoc +--no-output [ +.I filename.xml +] +.I source file(s) +] +.br +.B mxmldoc [ --intro -.I introfile.html +.I introfile ] [ --section .I section ] [ --title @@ -32,26 +39,53 @@ mxmldoc \- mini-xml documentation generator .I source file(s) ] > .I filename.html +.br +.B mxmldoc +--man +.I manpage +[ --intro +.I introfile +] [ --section +.I section +] [ --title +.I title +] [ +.I filename.xml +] [ +.I source file(s) +] > +.I filename.man .SH DESCRIPTION -\fImxmldoc\fR scans the specified C and C++ source files to -produce an XML representation of globally accessible classes, -constants, enumerations, functions, structures, typedefs, -unions, and variables. The XML file is updated as necessary and -a HTML representation of the XML file is written to the standard -output. If no source files are specified then the current XML -file is converted to HTML on the standard output. +\fImxmldoc\fR scans the specified C and C++ source files to produce +an XML representation of globally accessible classes, constants, +enumerations, functions, structures, typedefs, unions, and variables +- the XML file is updated as necessary. By default, a HTML +representation of the XML file is written to the standard output. +Use the \fI--no-output\fR option to disable the HTML output. +.PP +Man page source can be generated using the \fI--man\fR option. .PP -In general, any C or C++ source code is handled by -\fImxmldoc\fR, however it was specifically written to handle -code with documentation that is formatted according to the CUPS -Configuration Management Plan which is available at -"http://www.cups.org/documentation.php". +If no source files are specified then the current XML file is +converted to the standard output. +.PP +In general, any C or C++ source code is handled by \fImxmldoc\fR, +however it was specifically written to handle code with +documentation that is formatted according to the CUPS Developer +Guide which is available at "http://www.cups.org/documentation.php". .SH OPTIONS .TP 5 -\--intro introfile.html +\--intro introfile .br Inserts the specified file at the top of the output documentation. .TP 5 +\--man manpage +.br +Generated a man page instead of HTML documentation. +.TP 5 +\--no-output +.br +Disables generation of documentation on the standard output. +.TP 5 \--section section .br Sets the section/keywords in the output documentation. @@ -62,7 +96,7 @@ Sets the title of the output documentation. .SH SEE ALSO mxml(3), Mini-XML Programmers Manual, http://www.easysw.com/~mike/mxml/ .SH COPYRIGHT -Copyright 2003-2005 by Michael Sweet. +Copyright 2003-2007 by Michael Sweet. .\" .\" End of "$Id$". .\" diff --git a/doc/reference.html b/doc/reference.html index 23a3b77..d90019d 100644 --- a/doc/reference.html +++ b/doc/reference.html @@ -24,23 +24,52 @@

    Enumerations

    +

    mxml_sax_event_e

    +

    Description

    +

    SAX event type. +

    Values

    +
    + + + + + + + + +
    NameDescription
    MXML_SAX_CDATA CDATA node +
    MXML_SAX_COMMENT Comment node +
    MXML_SAX_DATA Data node +
    MXML_SAX_DIRECTIVE Processing directive node +
    MXML_SAX_ELEMENT_CLOSE Element closed +
    MXML_SAX_ELEMENT_OPEN Element opened +
    +

    mxml_type_e

    Description

    -

    The XML node type.

    +

    The XML node type.

    Values

    -
    +
    - - - - - - - + + + + + + +
    NameDescription
    MXML_CUSTOM  Mini-XML 2.1 Custom data
    MXML_ELEMENT XML element with attributes
    MXML_IGNORE  Mini-XML 2.3 Ignore/throw away node
    MXML_INTEGER Integer value
    MXML_OPAQUE Opaque string
    MXML_REAL Real value
    MXML_TEXT Text fragment
    MXML_CUSTOM  Mini-XML 2.1 Custom data +
    MXML_ELEMENT XML element with attributes +
    MXML_IGNORE  Mini-XML 2.3 Ignore/throw away node +
    MXML_INTEGER Integer value +
    MXML_OPAQUE Opaque string +
    MXML_REAL Real value +
    MXML_TEXT Text fragment +

    Functions

    @@ -49,7 +78,7 @@
  • mxmlDelete()
  • mxmlElementGetAttr()
  • mxmlElementSetAttr()
  • -
  • mxmlElementSetAttrf()
  • +
  • mxmlElementSetAttrf()  Mini-XML 2.3 
  • mxmlEntityAddCallback()
  • mxmlEntityGetName()
  • mxmlEntityGetValue()
  • @@ -75,6 +104,9 @@
  • mxmlRelease()  Mini-XML 2.3 
  • mxmlRemove()
  • mxmlRetain()  Mini-XML 2.3 
  • +
  • mxmlSAXLoadFd()  Mini-XML 2.3 
  • +
  • mxmlSAXLoadFile()  Mini-XML 2.3 
  • +
  • mxmlSAXLoadString()  Mini-XML 2.3 
  • mxmlSaveAllocString()
  • mxmlSaveFd()
  • mxmlSaveFile()
  • @@ -97,24 +129,23 @@

    mxmlAdd()

    Description

    Add a node to a tree. - -Adds the specified node to the parent. If the child argument is not +

    Adds the specified node to the parent. If the child argument is not NULL, puts the new node before or after the specified child depending on the value of the where argument. If the child argument is NULL, puts the new node at the beginning of the child list (MXML_ADD_BEFORE) or at the end of the child list (MXML_ADD_AFTER). The constant -MXML_ADD_TO_PARENT can be used to specify a NULL child pointer.

    +MXML_ADD_TO_PARENT can be used to specify a NULL child pointer.

    Syntax

    -
    -void
    +

    +void
    mxmlAdd( mxml_node_t * parent, int where, mxml_node_t * child, mxml_node_t * node); -

    +

    Arguments

    -
    +
    @@ -128,17 +159,16 @@ mxmlAdd(

    mxmlDelete()

    Description

    Delete a node and all of its children. - -If the specified node has a parent, this function first removes the -node from its parent using the mxmlRemove() function.

    +

    If the specified node has a parent, this function first removes the +node from its parent using the mxmlRemove() function.

    Syntax

    -
    -void
    +

    +void
    mxmlDelete( mxml_node_t * node); -

    +

    Arguments

    -
    NameDescription
    parentParent node
    +
    @@ -149,18 +179,17 @@ mxmlDelete(

    mxmlElementGetAttr()

    Description

    Get an attribute. - -This function returns NULL if the node is not an element or the -named attribute does not exist.

    +

    This function returns NULL if the node is not an element or the +named attribute does not exist.

    Syntax

    -
    -const char *
    +

    +const char *
    mxmlElementGetAttr( mxml_node_t * node, const char * name); -

    +

    Arguments

    -
    NameDescription
    nodeNode to delete
    +
    @@ -172,21 +201,20 @@ mxmlElementGetAttr(

    mxmlElementSetAttr()

    Description

    Set an attribute. - -If the named attribute already exists, the value of the attribute +

    If the named attribute already exists, the value of the attribute is replaced by the new string value. The string value is copied into the element node. This function does nothing if the node is -not an element.

    +not an element.

    Syntax

    -
    -void
    +

    +void
    mxmlElementSetAttr( mxml_node_t * node, const char * name, const char * value); -

    +

    Arguments

    -
    NameDescription
    nodeElement node
    +
    @@ -196,25 +224,26 @@ mxmlElementSetAttr(

    Returns

    Nothing.

    -

    mxmlElementSetAttrf()

    +

     Mini-XML 2.3 mxmlElementSetAttrf()

    Description

    Set an attribute with a formatted value. - -If the named attribute already exists, the value of the attribute +

    If the named attribute already exists, the value of the attribute is replaced by the new formatted string. The formatted string value is copied into the element node. This function does nothing if the node -is not an element.

    +is not an element. + +

    Syntax

    -
    -void
    +

    +void
    mxmlElementSetAttrf( mxml_node_t * node, const char * name, const char * format, ...); -

    +

    Arguments

    -
    NameDescription
    nodeElement node
    +
    @@ -227,12 +256,12 @@ mxmlElementSetAttrf(

    mxmlEntityAddCallback()

    Description

    -

    Add a callback to convert entities to Unicode.

    +

    Add a callback to convert entities to Unicode.

    Syntax

    -
    -int
    +

    +int
    mxmlEntityAddCallback(void); -

    +

    Arguments

    None.

    Returns

    @@ -241,16 +270,15 @@ mxmlEntityAddCallback(void);

    mxmlEntityGetName()

    Description

    Get the name that corresponds to the character value. - -If val does not need to be represented by a named entity, NULL is returned.

    +

    If val does not need to be represented by a named entity, NULL is returned.

    Syntax

    -
    -const char *
    +

    +const char *
    mxmlEntityGetName( int val); -

    +

    Arguments

    -
    NameDescription
    nodeElement node
    +
    @@ -261,17 +289,16 @@ mxmlEntityGetName(

    mxmlEntityGetValue()

    Description

    Get the character corresponding to a named entity. - -The entity name can also be a numeric constant. -1 is returned if the -name is not known.

    +

    The entity name can also be a numeric constant. -1 is returned if the +name is not known.

    Syntax

    -
    -int
    +

    +int
    mxmlEntityGetValue( const char * name); -

    +

    Arguments

    -
    NameDescription
    valCharacter value
    +
    @@ -281,12 +308,12 @@ mxmlEntityGetValue(

    mxmlEntityRemoveCallback()

    Description

    -

    Remove a callback.

    +

    Remove a callback.

    Syntax

    -
    -void
    +

    +void
    mxmlEntityRemoveCallback(void); -

    +

    Arguments

    None.

    Returns

    @@ -295,18 +322,17 @@ mxmlEntityRemoveCallback(void);

    mxmlFindElement()

    Description

    Find the named element. - -The search is constrained by the name, attribute name, and value; any +

    The search is constrained by the name, attribute name, and value; any NULL names or values are treated as wildcards, so different kinds of searches can be implemented by looking for all elements of a given name or all elements with a specific attribute. The descend argument determines whether the search descends into child nodes; normally you will use MXML_DESCEND_FIRST for the initial search and MXML_NO_DESCEND to find additional direct descendents of the node. The top node argument -constrains the search to a particular node's children.

    +constrains the search to a particular node's children.

    Syntax

    -
    -mxml_node_t *
    +

    +mxml_node_t *
    mxmlFindElement( mxml_node_t * node, mxml_node_t * top, @@ -314,9 +340,9 @@ mxmlFindElement( const char * attr, const char * value, int descend); -

    +

    Arguments

    -
    NameDescription
    nameEntity name
    +
    @@ -331,15 +357,15 @@ mxmlFindElement(

    mxmlIndexDelete()

    Description

    -

    Delete an index.

    +

    Delete an index.

    Syntax

    -
    -void
    +

    +void
    mxmlIndexDelete( mxml_index_t * ind); -

    +

    Arguments

    -
    NameDescription
    nodeCurrent node
    +
    @@ -350,16 +376,15 @@ mxmlIndexDelete(

    mxmlIndexEnum()

    Description

    Return the next node in the index. - -Nodes are returned in the sorted order of the index.

    +

    Nodes are returned in the sorted order of the index.

    Syntax

    -
    -mxml_node_t *
    +

    +mxml_node_t *
    mxmlIndexEnum( mxml_index_t * ind); -

    +

    Arguments

    -
    NameDescription
    indIndex to delete
    +
    @@ -370,21 +395,20 @@ mxmlIndexEnum(

    mxmlIndexFind()

    Description

    Find the next matching node. - -You should call mxmlIndexReset() prior to using this function for +

    You should call mxmlIndexReset() prior to using this function for the first time with a particular set of "element" and "value" strings. Passing NULL for both "element" and "value" is equivalent -to calling mxmlIndexEnum().

    +to calling mxmlIndexEnum().

    Syntax

    -
    -mxml_node_t *
    +

    +mxml_node_t *
    mxmlIndexFind( mxml_index_t * ind, const char * element, const char * value); -

    +

    Arguments

    -
    NameDescription
    indIndex to enumerate
    +
    @@ -397,22 +421,21 @@ mxmlIndexFind(

    mxmlIndexNew()

    Description

    Create a new index. - -The index will contain all nodes that contain the named element and/or +

    The index will contain all nodes that contain the named element and/or attribute. If both "element" and "attr" are NULL, then the index will contain a sorted list of the elements in the node tree. Nodes are sorted by element name and optionally by attribute value if the "attr" -argument is not NULL.

    +argument is not NULL.

    Syntax

    -
    -mxml_index_t *
    +

    +mxml_index_t *
    mxmlIndexNew( mxml_node_t * node, const char * element, const char * attr); -

    +

    Arguments

    -
    NameDescription
    indIndex to search
    +
    @@ -426,17 +449,16 @@ mxmlIndexNew(

    Description

    Reset the enumeration/find pointer in the index and return the first node in the index. - -This function should be called prior to using mxmlIndexEnum() or -mxmlIndexFind() for the first time.

    +

    This function should be called prior to using mxmlIndexEnum() or +mxmlIndexFind() for the first time.

    Syntax

    -
    -mxml_node_t *
    +

    +mxml_node_t *
    mxmlIndexReset( mxml_index_t * ind); -

    +

    Arguments

    -
    NameDescription
    nodeXML node tree
    +
    @@ -447,30 +469,30 @@ mxmlIndexReset(

    mxmlLoadFd()

    Description

    Load a file descriptor into an XML node tree. - -The nodes in the specified file are added to the specified top node. +

    The nodes in the specified file are added to the specified top node. If no top node is provided, the XML file MUST be well-formed with a single parent node like <?xml> for the entire file. The callback function returns the value type that should be used for child nodes. If MXML_NO_CALLBACK is specified then all child nodes will be either MXML_ELEMENT or MXML_TEXT nodes. - -The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, +

    The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading -child nodes of the specified type.

    +child nodes of the specified type.

    Syntax

    -
    -mxml_node_t *
    +

    +mxml_node_t *
    mxmlLoadFd( mxml_node_t * top, - int fd); -

    + int fd, + mxml_load_cb_t cb); +

    Arguments

    -
    NameDescription
    indIndex to reset
    +
    +
    NameDescription
    topTop node
    fdFile descriptor to read from
    cbCallback function or MXML_NO_CALLBACK

    Returns

    First node or NULL if the file could not be read.

    @@ -478,30 +500,30 @@ mxmlLoadFd(

    mxmlLoadFile()

    Description

    Load a file into an XML node tree. - -The nodes in the specified file are added to the specified top node. +

    The nodes in the specified file are added to the specified top node. If no top node is provided, the XML file MUST be well-formed with a single parent node like <?xml> for the entire file. The callback function returns the value type that should be used for child nodes. If MXML_NO_CALLBACK is specified then all child nodes will be either MXML_ELEMENT or MXML_TEXT nodes. - -The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, +

    The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading -child nodes of the specified type.

    +child nodes of the specified type.

    Syntax

    -
    -mxml_node_t *
    +

    +mxml_node_t *
    mxmlLoadFile( mxml_node_t * top, - FILE * fp); -

    + FILE * fp, + mxml_load_cb_t cb); +

    Arguments

    -
    +
    +
    NameDescription
    topTop node
    fpFile to read from
    cbCallback function or MXML_NO_CALLBACK

    Returns

    First node or NULL if the file could not be read.

    @@ -509,30 +531,30 @@ mxmlLoadFile(

    mxmlLoadString()

    Description

    Load a string into an XML node tree. - -The nodes in the specified string are added to the specified top node. +

    The nodes in the specified string are added to the specified top node. If no top node is provided, the XML string MUST be well-formed with a single parent node like <?xml> for the entire string. The callback function returns the value type that should be used for child nodes. If MXML_NO_CALLBACK is specified then all child nodes will be either MXML_ELEMENT or MXML_TEXT nodes. - -The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, +

    The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading -child nodes of the specified type.

    +child nodes of the specified type.

    Syntax

    -
    -mxml_node_t *
    +

    +mxml_node_t *
    mxmlLoadString( mxml_node_t * top, - const char * s); -

    + const char * s, + mxml_load_cb_t cb); +

    Arguments

    -
    +
    +
    NameDescription
    topTop node
    sString to load
    cbCallback function or MXML_NO_CALLBACK

    Returns

    First node or NULL if the string has errors.

    @@ -540,22 +562,21 @@ mxmlLoadString(

     Mini-XML 2.3 mxmlNewCDATA()

    Description

    Create a new CDATA node. - -The new CDATA node is added to the end of the specified parent's child +

    The new CDATA node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used 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 MXML_ELEMENT type. -

    +

    Syntax

    -
    -mxml_node_t *
    +

    +mxml_node_t *
    mxmlNewCDATA( mxml_node_t * parent, const char * data); -

    +

    Arguments

    -
    +
    @@ -567,26 +588,27 @@ mxmlNewCDATA(

     Mini-XML 2.1 mxmlNewCustom()

    Description

    Create a new custom data node. - -The new custom node is added to the end of the specified parent's child +

    The new custom node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new element node has no parent. NULL can be passed when the data in the node is not dynamically allocated or is separately managed. -

    +

    Syntax

    -
    -mxml_node_t *
    +

    +mxml_node_t *
    mxmlNewCustom( mxml_node_t * parent, - void * data); -

    + void * data, + mxml_custom_destroy_cb_t destroy); +

    Arguments

    -
    NameDescription
    parentParent node or MXML_NO_PARENT
    +
    +
    NameDescription
    parentParent node or MXML_NO_PARENT
    dataPointer to data
    destroyFunction to destroy data

    Returns

    New node

    @@ -594,19 +616,18 @@ mxmlNewCustom(

    mxmlNewElement()

    Description

    Create a new element node. - -The new element node is added to the end of the specified parent's child +

    The new element node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new -element node has no parent.

    +element node has no parent.

    Syntax

    -
    -mxml_node_t *
    +

    +mxml_node_t *
    mxmlNewElement( mxml_node_t * parent, const char * name); -

    +

    Arguments

    -
    +
    @@ -618,19 +639,18 @@ mxmlNewElement(

    mxmlNewInteger()

    Description

    Create a new integer node. - -The new integer node is added to the end of the specified parent's child +

    The new integer node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new -integer node has no parent.

    +integer node has no parent.

    Syntax

    -
    -mxml_node_t *
    +

    +mxml_node_t *
    mxmlNewInteger( mxml_node_t * parent, int integer); -

    +

    Arguments

    -
    NameDescription
    parentParent node or MXML_NO_PARENT
    +
    @@ -642,20 +662,19 @@ mxmlNewInteger(

    mxmlNewOpaque()

    Description

    Create a new opaque string. - -The new opaque node is added to the end of the specified parent's child +

    The new opaque node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new opaque node has no parent. The opaque string must be nul-terminated and -is copied into the new node.

    +is copied into the new node.

    Syntax

    -
    -mxml_node_t *
    +

    +mxml_node_t *
    mxmlNewOpaque( mxml_node_t * parent, const char * opaque); -

    +

    Arguments

    -
    NameDescription
    parentParent node or MXML_NO_PARENT
    +
    @@ -667,19 +686,18 @@ mxmlNewOpaque(

    mxmlNewReal()

    Description

    Create a new real number node. - -The new real number node is added to the end of the specified parent's +

    The new real number node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that -the new real number node has no parent.

    +the new real number node has no parent.

    Syntax

    -
    -mxml_node_t *
    +

    +mxml_node_t *
    mxmlNewReal( mxml_node_t * parent, double real); -

    +

    Arguments

    -
    NameDescription
    parentParent node or MXML_NO_PARENT
    +
    @@ -691,22 +709,21 @@ mxmlNewReal(

    mxmlNewText()

    Description

    Create a new text fragment node. - -The new text node is added to the end of the specified parent's child +

    The new text node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new text node has no parent. The whitespace parameter is used to specify whether leading whitespace is present before the node. The text -string must be nul-terminated and is copied into the new node.

    +string must be nul-terminated and is copied into the new node.

    Syntax

    -
    -mxml_node_t *
    +

    +mxml_node_t *
    mxmlNewText( mxml_node_t * parent, int whitespace, const char * string); -

    +

    Arguments

    -
    NameDescription
    parentParent node or MXML_NO_PARENT
    +
    @@ -719,23 +736,22 @@ mxmlNewText(

    mxmlNewTextf()

    Description

    Create a new formatted text fragment node. - -The new text node is added to the end of the specified parent's child +

    The new text node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new text node has no parent. The whitespace parameter is used to specify whether leading whitespace is present before the node. The format -string must be nul-terminated and is formatted into the new node.

    +string must be nul-terminated and is formatted into the new node.

    Syntax

    -
    -mxml_node_t *
    +

    +mxml_node_t *
    mxmlNewTextf( mxml_node_t * parent, int whitespace, const char * format, ...); -

    +

    Arguments

    -
    NameDescription
    parentParent node or MXML_NO_PARENT
    +
    @@ -749,19 +765,18 @@ mxmlNewTextf(

     Mini-XML 2.3 mxmlNewXML()

    Description

    Create a new XML document tree. - -The "version" argument specifies the version number to put in the +

    The "version" argument specifies the version number to put in the ?xml element node. If NULL, version 1.0 is assumed. -

    +

    Syntax

    -
    -mxml_node_t *
    +

    +mxml_node_t *
    mxmlNewXML( const char * version); -

    +

    Arguments

    -
    NameDescription
    parentParent node or MXML_NO_PARENT
    +
    @@ -772,19 +787,18 @@ mxmlNewXML(

     Mini-XML 2.3 mxmlRelease()

    Description

    Release a node. - -When the reference count reaches zero, the node (and any children) +

    When the reference count reaches zero, the node (and any children) is deleted via mxmlDelete(). -

    +

    Syntax

    -
    -int
    +

    +int
    mxmlRelease( mxml_node_t * node); -

    +

    Arguments

    -
    NameDescription
    versionVersion number to use
    +
    @@ -795,17 +809,16 @@ mxmlRelease(

    mxmlRemove()

    Description

    Remove a node from its parent. - -Does not free memory used by the node - use mxmlDelete() for that. -This function does nothing if the node has no parent.

    +

    Does not free memory used by the node - use mxmlDelete() for that. +This function does nothing if the node has no parent.

    Syntax

    -
    -void
    +

    +void
    mxmlRemove( mxml_node_t * node); -

    +

    Arguments

    -
    NameDescription
    nodeNode
    +
    @@ -817,15 +830,15 @@ mxmlRemove(

    Description

    Retain a node. -

    +

    Syntax

    -
    -int
    +

    +int
    mxmlRetain( mxml_node_t * node); -

    +

    Arguments

    -
    NameDescription
    nodeNode to remove
    +
    @@ -833,32 +846,155 @@ mxmlRetain(

    Returns

    New reference count

    +

     Mini-XML 2.3 mxmlSAXLoadFd()

    +

    Description

    +

    Load a file descriptor into an XML node tree +using a SAX callback. +

    The nodes in the specified file are added to the specified top node. +If no top node is provided, the XML file MUST be well-formed with a +single parent node like <?xml> for the entire file. The callback +function returns the value type that should be used for child nodes. +If MXML_NO_CALLBACK is specified then all child nodes will be either +MXML_ELEMENT or MXML_TEXT nodes. +

    The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, +MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading +child nodes of the specified type. +

    The SAX callback must call mxmlRetain() for any nodes that need to +be kept for later use. Otherwise, nodes are deleted when the parent +node is closed or after each data, comment, CDATA, or directive node. + + +

    Syntax

    +

    +mxml_node_t *
    +mxmlSAXLoadFd( + mxml_node_t * top, + int fd, + mxml_load_cb_t cb, + mxml_sax_cb_t sax_cb, + void * sax_data); +

    +

    Arguments

    +
    NameDescription
    nodeNode
    + + + + + + + +
    NameDescription
    topTop node
    fdFile descriptor to read from
    cbCallback function or MXML_NO_CALLBACK
    sax_cbSAX callback or MXML_NO_CALLBACK
    sax_dataSAX user data
    +

    Returns

    +

    First node or NULL if the file could not be read.

    + +

     Mini-XML 2.3 mxmlSAXLoadFile()

    +

    Description

    +

    Load a file into an XML node tree +using a SAX callback. +

    The nodes in the specified file are added to the specified top node. +If no top node is provided, the XML file MUST be well-formed with a +single parent node like <?xml> for the entire file. The callback +function returns the value type that should be used for child nodes. +If MXML_NO_CALLBACK is specified then all child nodes will be either +MXML_ELEMENT or MXML_TEXT nodes. +

    The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, +MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading +child nodes of the specified type. +

    The SAX callback must call mxmlRetain() for any nodes that need to +be kept for later use. Otherwise, nodes are deleted when the parent +node is closed or after each data, comment, CDATA, or directive node. + + +

    Syntax

    +

    +mxml_node_t *
    +mxmlSAXLoadFile( + mxml_node_t * top, + FILE * fp, + mxml_load_cb_t cb, + mxml_sax_cb_t sax_cb, + void * sax_data); +

    +

    Arguments

    +
    + + + + + + + +
    NameDescription
    topTop node
    fpFile to read from
    cbCallback function or MXML_NO_CALLBACK
    sax_cbSAX callback or MXML_NO_CALLBACK
    sax_dataSAX user data
    +

    Returns

    +

    First node or NULL if the file could not be read.

    + +

     Mini-XML 2.3 mxmlSAXLoadString()

    +

    Description

    +

    Load a string into an XML node tree +using a SAX callback. +

    The nodes in the specified string are added to the specified top node. +If no top node is provided, the XML string MUST be well-formed with a +single parent node like <?xml> for the entire string. The callback +function returns the value type that should be used for child nodes. +If MXML_NO_CALLBACK is specified then all child nodes will be either +MXML_ELEMENT or MXML_TEXT nodes. +

    The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, +MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading +child nodes of the specified type. +

    The SAX callback must call mxmlRetain() for any nodes that need to +be kept for later use. Otherwise, nodes are deleted when the parent +node is closed or after each data, comment, CDATA, or directive node. + + +

    Syntax

    +

    +mxml_node_t *
    +mxmlSAXLoadString( + mxml_node_t * top, + const char * s, + mxml_load_cb_t cb, + mxml_sax_cb_t sax_cb, + void * sax_data); +

    +

    Arguments

    +
    + + + + + + + +
    NameDescription
    topTop node
    sString to load
    cbCallback function or MXML_NO_CALLBACK
    sax_cbSAX callback or MXML_NO_CALLBACK
    sax_dataSAX user data
    +

    Returns

    +

    First node or NULL if the string has errors.

    +

    mxmlSaveAllocString()

    Description

    Save an XML node tree to an allocated string. - -This function returns a pointer to a string containing the textual +

    This function returns a pointer to a string containing the textual representation of the XML node tree. The string should be freed using the free() function when you are done with it. NULL is returned if the node would produce an empty string or if the string cannot be allocated. - -The callback argument specifies a function that returns a whitespace +

    The callback argument specifies a function that returns a whitespace string or NULL before and after each element. If MXML_NO_CALLBACK is specified, whitespace will only be added before MXML_TEXT nodes with leading whitespace and before attribute names inside opening -element tags.

    +element tags.

    Syntax

    -
    -char *
    +

    +char *
    mxmlSaveAllocString( - mxml_node_t * node); -

    + mxml_node_t * node, + mxml_save_cb_t cb); +

    Arguments

    -
    +
    +
    NameDescription
    nodeNode to write
    cbWhitespace callback or MXML_NO_CALLBACK

    Returns

    Allocated string or NULL

    @@ -866,25 +1002,26 @@ mxmlSaveAllocString(

    mxmlSaveFd()

    Description

    Save an XML tree to a file descriptor. - -The callback argument specifies a function that returns a whitespace +

    The callback argument specifies a function that returns a whitespace string or NULL before and after each element. If MXML_NO_CALLBACK is specified, whitespace will only be added before MXML_TEXT nodes with leading whitespace and before attribute names inside opening -element tags.

    +element tags.

    Syntax

    -
    -int
    +

    +int
    mxmlSaveFd( mxml_node_t * node, - int fd); -

    + int fd, + mxml_save_cb_t cb); +

    Arguments

    -
    +
    +
    NameDescription
    nodeNode to write
    fdFile descriptor to write to
    cbWhitespace callback or MXML_NO_CALLBACK

    Returns

    0 on success, -1 on error.

    @@ -892,25 +1029,26 @@ mxmlSaveFd(

    mxmlSaveFile()

    Description

    Save an XML tree to a file. - -The callback argument specifies a function that returns a whitespace +

    The callback argument specifies a function that returns a whitespace string or NULL before and after each element. If MXML_NO_CALLBACK is specified, whitespace will only be added before MXML_TEXT nodes with leading whitespace and before attribute names inside opening -element tags.

    +element tags.

    Syntax

    -
    -int
    +

    +int
    mxmlSaveFile( mxml_node_t * node, - FILE * fp); -

    + FILE * fp, + mxml_save_cb_t cb); +

    Arguments

    -
    +
    +
    NameDescription
    nodeNode to write
    fpFile to write to
    cbWhitespace callback or MXML_NO_CALLBACK

    Returns

    0 on success, -1 on error.

    @@ -918,31 +1056,31 @@ mxmlSaveFile(

    mxmlSaveString()

    Description

    Save an XML node tree to a string. - -This function returns the total number of bytes that would be +

    This function returns the total number of bytes that would be required for the string but only copies (bufsize - 1) characters into the specified buffer. - -The callback argument specifies a function that returns a whitespace +

    The callback argument specifies a function that returns a whitespace string or NULL before and after each element. If MXML_NO_CALLBACK is specified, whitespace will only be added before MXML_TEXT nodes with leading whitespace and before attribute names inside opening -element tags.

    +element tags.

    Syntax

    -
    -int
    +

    +int
    mxmlSaveString( mxml_node_t * node, char * buffer, - int bufsize); -

    + int bufsize, + mxml_save_cb_t cb); +

    Arguments

    -
    +
    +
    NameDescription
    nodeNode to write
    bufferString buffer
    bufsizeSize of string buffer
    cbWhitespace callback or MXML_NO_CALLBACK

    Returns

    Size of string

    @@ -950,19 +1088,18 @@ mxmlSaveString(

     Mini-XML 2.3 mxmlSetCDATA()

    Description

    Set the element name of a CDATA node. +

    The node is not changed if it is not a CDATA element node. -The node is not changed if it is not a CDATA element node. -

    Syntax

    -
    -int
    +

    +int
    mxmlSetCDATA( mxml_node_t * node, const char * data); -

    +

    Arguments

    -
    +
    @@ -974,23 +1111,24 @@ mxmlSetCDATA(

     Mini-XML 2.1 mxmlSetCustom()

    Description

    Set the data and destructor of a custom data node. +

    The node is not changed if it is not a custom node. -The node is not changed if it is not a custom node. -

    Syntax

    -
    -int
    +

    +int
    mxmlSetCustom( mxml_node_t * node, - void * data); -

    + void * data, + mxml_custom_destroy_cb_t destroy); +

    Arguments

    -
    NameDescription
    nodeNode to set
    +
    +
    NameDescription
    nodeNode to set
    dataNew data pointer
    destroyNew destructor function

    Returns

    0 on success, -1 on failure

    @@ -998,21 +1136,19 @@ mxmlSetCustom(

    mxmlSetCustomHandlers()

    Description

    Set the handling functions for custom data. - -The load function accepts a node pointer and a data string and must +

    The load function accepts a node pointer and a data string and must return 0 on success and non-zero on error. - -The save function accepts a node pointer and must return a malloc'd -string on success and NULL on error.

    +

    The save function accepts a node pointer and must return a malloc'd +string on success and NULL on error.

    Syntax

    -
    -void
    +

    +void
    mxmlSetCustomHandlers( mxml_custom_load_cb_t load, mxml_custom_save_cb_t save); -

    +

    Arguments

    -
    +
    @@ -1024,17 +1160,16 @@ mxmlSetCustomHandlers(

    mxmlSetElement()

    Description

    Set the name of an element node. - -The node is not changed if it is not an element node.

    +

    The node is not changed if it is not an element node.

    Syntax

    -
    -int
    +

    +int
    mxmlSetElement( mxml_node_t * node, const char * name); -

    +

    Arguments

    -
    NameDescription
    loadLoad function
    +
    @@ -1045,31 +1180,35 @@ mxmlSetElement(

    mxmlSetErrorCallback()

    Description

    -

    Set the error message callback.

    +

    Set the error message callback.

    Syntax

    -
    -void
    -mxmlSetErrorCallback(void);
    -
    +

    +void
    +mxmlSetErrorCallback( + mxml_error_cb_t cb); +

    Arguments

    -

    None.

    +
    NameDescription
    nodeNode to set
    + + + +
    NameDescription
    cbError callback function

    Returns

    Nothing.

    mxmlSetInteger()

    Description

    Set the value of an integer node. - -The node is not changed if it is not an integer node.

    +

    The node is not changed if it is not an integer node.

    Syntax

    -
    -int
    +

    +int
    mxmlSetInteger( mxml_node_t * node, int integer); -

    +

    Arguments

    -
    +
    @@ -1081,17 +1220,16 @@ mxmlSetInteger(

    mxmlSetOpaque()

    Description

    Set the value of an opaque node. - -The node is not changed if it is not an opaque node.

    +

    The node is not changed if it is not an opaque node.

    Syntax

    -
    -int
    +

    +int
    mxmlSetOpaque( mxml_node_t * node, const char * opaque); -

    +

    Arguments

    -
    NameDescription
    nodeNode to set
    +
    @@ -1103,17 +1241,16 @@ mxmlSetOpaque(

    mxmlSetReal()

    Description

    Set the value of a real number node. - -The node is not changed if it is not a real number node.

    +

    The node is not changed if it is not a real number node.

    Syntax

    -
    -int
    +

    +int
    mxmlSetReal( mxml_node_t * node, double real); -

    +

    Arguments

    -
    NameDescription
    nodeNode to set
    +
    @@ -1125,18 +1262,17 @@ mxmlSetReal(

    mxmlSetText()

    Description

    Set the value of a text node. - -The node is not changed if it is not a text node.

    +

    The node is not changed if it is not a text node.

    Syntax

    -
    -int
    +

    +int
    mxmlSetText( mxml_node_t * node, int whitespace, const char * string); -

    +

    Arguments

    -
    NameDescription
    nodeNode to set
    +
    @@ -1149,19 +1285,18 @@ mxmlSetText(

    mxmlSetTextf()

    Description

    Set the value of a text node to a formatted string. - -The node is not changed if it is not a text node.

    +

    The node is not changed if it is not a text node.

    Syntax

    -
    -int
    +

    +int
    mxmlSetTextf( mxml_node_t * node, int whitespace, const char * format, ...); -

    +

    Arguments

    -
    NameDescription
    nodeNode to set
    +
    @@ -1175,18 +1310,17 @@ mxmlSetTextf(

     Mini-XML 2.3 mxmlSetWrapMargin()

    Description

    Set the the wrap margin when saving XML data. +

    Wrapping is disabled when "column" is <= 0. -Wrapping is disabled when "column" is <= 0. -

    Syntax

    -
    -void
    +

    +void
    mxmlSetWrapMargin( int column); -

    +

    Arguments

    -
    NameDescription
    nodeNode to set
    +
    @@ -1197,20 +1331,19 @@ mxmlSetWrapMargin(

    mxmlWalkNext()

    Description

    Walk to the next logical node in the tree. - -The descend argument controls whether the first child is considered +

    The descend argument controls whether the first child is considered to be the next node. The top node argument constrains the walk to -the node's children.

    +the node's children.

    Syntax

    -
    -mxml_node_t *
    +

    +mxml_node_t *
    mxmlWalkNext( mxml_node_t * node, mxml_node_t * top, int descend); -

    +

    Arguments

    -
    NameDescription
    columnColumn for wrapping
    +
    @@ -1223,20 +1356,19 @@ mxmlWalkNext(

    mxmlWalkPrev()

    Description

    Walk to the previous logical node in the tree. - -The descend argument controls whether the previous node's last child +

    The descend argument controls whether the previous node's last child is considered to be the previous node. The top node argument constrains -the walk to the node's children.

    +the walk to the node's children.

    Syntax

    -
    -mxml_node_t *
    +

    +mxml_node_t *
    mxmlWalkPrev( mxml_node_t * node, mxml_node_t * top, int descend); -

    +

    Arguments

    -
    NameDescription
    nodeCurrent node
    +
    @@ -1258,222 +1390,295 @@ mxmlWalkPrev(

    mxml_attr_s

    Description

    -

    Data types...

    +

    Data types...

    Definition

    -
    -struct mxml_attr_s
    -{
    -  char * name;
    -  char * value;
    -};
    -
    +

    +struct mxml_attr_s
    +{
    +  char * name;
    +  char * value;
    +};

    Members

    -
    NameDescription
    nodeCurrent node
    +
    - - + +
    NameDescription
    name Attribute name
    value Attribute value
    name Attribute name +
    value Attribute value +

     Mini-XML 2.1 mxml_custom_s

    Description

    -

    An XML custom value.

    +

    An XML custom value.

    Definition

    -
    -struct mxml_custom_s
    -{
    -  void * data;
    -};
    -
    +

    +struct mxml_custom_s
    +{
    +  void * data;
    +  mxml_custom_destroy_cb_t destroy;
    +};

    Members

    -
    +
    - + +
    NameDescription
    data Pointer to (allocated) custom data
    data Pointer to (allocated) custom data +
    destroy Pointer to destructor function +

    mxml_element_s

    Description

    -

    An XML element value.

    +

    An XML element value.

    Definition

    -
    -struct mxml_element_s
    -{
    -  mxml_attr_t * attrs;
    -  char * name;
    -  int num_attrs;
    -};
    -
    +

    +struct mxml_element_s
    +{
    +  mxml_attr_t * attrs;
    +  char * name;
    +  int num_attrs;
    +};

    Members

    -
    +
    - - - + + +
    NameDescription
    attrs Attributes
    name Name of element
    num_attrs Number of attributes
    attrs Attributes +
    name Name of element +
    num_attrs Number of attributes +

    mxml_index_s

    Description

    -

    An XML node index.

    +

    An XML node index.

    Definition

    -
    -struct mxml_index_s
    -{
    -  int alloc_nodes;
    -  char * attr;
    -  int cur_node;
    -  mxml_node_t ** nodes;
    -  int num_nodes;
    -};
    -
    +

    +struct mxml_index_s
    +{
    +  int alloc_nodes;
    +  char * attr;
    +  int cur_node;
    +  mxml_node_t ** nodes;
    +  int num_nodes;
    +};

    Members

    -
    +
    - - - - - + + + + +
    NameDescription
    alloc_nodes Allocated nodes in index
    attr Attribute used for indexing or NULL
    cur_node Current node
    nodes Node array
    num_nodes Number of nodes in index
    alloc_nodes Allocated nodes in index +
    attr Attribute used for indexing or NULL +
    cur_node Current node +
    nodes Node array +
    num_nodes Number of nodes in index +

    mxml_node_s

    Description

    -

    An XML node.

    +

    An XML node.

    Definition

    -
    -struct mxml_node_s
    -{
    -  struct mxml_node_s * child;
    -  struct mxml_node_s * last_child;
    -  struct mxml_node_s * next;
    -  struct mxml_node_s * parent;
    -  struct mxml_node_s * prev;
    -  int ref_count;
    -  mxml_type_t type;
    -  void * user_data;
    -  mxml_value_t value;
    -};
    -
    +

    +struct mxml_node_s
    +{
    +  struct mxml_node_s * child;
    +  struct mxml_node_s * last_child;
    +  struct mxml_node_s * next;
    +  struct mxml_node_s * parent;
    +  struct mxml_node_s * prev;
    +  int ref_count;
    +  mxml_type_t type;
    +  void * user_data;
    +  mxml_value_t value;
    +};

    Members

    -
    +
    - - - - - - - - - + + + + + + + + +
    NameDescription
    child First child node
    last_child Last child node
    next Next node under same parent
    parent Parent node
    prev Previous node under same parent
    ref_count Use count
    type Node type
    user_data User data
    value Node value
    child First child node +
    last_child Last child node +
    next Next node under same parent +
    parent Parent node +
    prev Previous node under same parent +
    ref_count Use count +
    type Node type +
    user_data User data +
    value Node value +

    mxml_text_s

    Description

    -

    An XML text value.

    +

    An XML text value.

    Definition

    -
    -struct mxml_text_s
    -{
    -  char * string;
    -  int whitespace;
    -};
    -
    +

    +struct mxml_text_s
    +{
    +  char * string;
    +  int whitespace;
    +};

    Members

    -
    +
    - - + +
    NameDescription
    string Fragment string
    whitespace Leading whitespace?
    string Fragment string +
    whitespace Leading whitespace? +

    Types

    mxml_attr_t

    Description

    -

    Data types...

    +

    Data types...

    Definition

    -
    +

    typedef struct mxml_attr_s mxml_attr_t; -

    +

    + +

    mxml_custom_destroy_cb_t

    +

    Description

    +

    Custom data destructor +

    Definition

    +

    +typedef void (*mxml_custom_destroy_cb_t)(void *); +

    mxml_custom_load_cb_t

    Description

    -

    Custom data load callback function

    +

    Custom data load callback function

    Definition

    -
    +

    typedef int (*mxml_custom_load_cb_t)(mxml_node_t *, const char *); -

    +

    mxml_custom_save_cb_t

    Description

    -

    Custom data save callback function

    +

    Custom data save callback function

    Definition

    -
    +

    typedef char * (*mxml_custom_save_cb_t)(mxml_node_t *); -

    +

     Mini-XML 2.1 mxml_custom_t

    Description

    -

    An XML custom value.

    +

    An XML custom value.

    Definition

    -
    +

    typedef struct mxml_custom_s mxml_custom_t; -

    +

    mxml_element_t

    Description

    -

    An XML element value.

    +

    An XML element value.

    Definition

    -
    +

    typedef struct mxml_element_s mxml_element_t; -

    +

    + +

    mxml_error_cb_t

    +

    Description

    +

    Error callback function +

    Definition

    +

    +typedef void (*mxml_error_cb_t)(const char *); +

    mxml_index_t

    Description

    -

    An XML node index.

    +

    An XML node index.

    Definition

    -
    +

    typedef struct mxml_index_s mxml_index_t; -

    +

    + +

    mxml_load_cb_t

    +

    Description

    +

    Load callback function +

    Definition

    +

    +typedef mxml_type_t (*mxml_load_cb_t)(mxml_node_t *); +

    mxml_node_t

    Description

    -

    An XML node.

    +

    An XML node.

    Definition

    -
    +

    typedef struct mxml_node_s mxml_node_t; -

    +

    + +

    mxml_save_cb_t

    +

    Description

    +

    Save callback function +

    Definition

    +

    +typedef const char * (*mxml_save_cb_t)(mxml_node_t *, int); +

    + +

    mxml_sax_cb_t

    +

    Description

    +

    SAX callback function +

    Definition

    +

    +typedef void (*mxml_sax_cb_t)(mxml_node_t *, mxml_sax_event_t, void *); +

    + +

    mxml_sax_event_t

    +

    Description

    +

    SAX event type. +

    Definition

    +

    +typedef enum mxml_sax_event_e mxml_sax_event_t; +

    mxml_text_t

    Description

    -

    An XML text value.

    +

    An XML text value.

    Definition

    -
    +

    typedef struct mxml_text_s mxml_text_t; -

    +

    mxml_value_t

    Description

    -

    An XML node value.

    +

    An XML node value.

    Definition

    -
    +

    typedef union mxml_value_u mxml_value_t; -

    +

    Unions