Commit bf73da67 authored by Michael R Sweet's avatar Michael R Sweet

Save work on documentation.

Add SAX load APIs.

Add man page output for mxmldoc.

Add types for various callback functions.
parent 0f8052e7
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
......
......@@ -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...
#
......
......@@ -346,6 +346,7 @@ function:</p>
</pre>
<!-- NEED 20 -->
<h2>Changing Node Values</h2>
<p>All of the examples so far have concentrated on creating and
......@@ -483,5 +484,147 @@ function:</p>
mxmlIndexDelete(ind);
</pre>
<h2>SAX (Stream) Loading of Documents</h2>
<p>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.</p>
<p>The <a href='#mxmlSAXLoad'><tt>mxmlSAXLoadFd</tt></a>, <a
href='#mxmlSAXLoadFile'><tt>mxmlSAXLoadFile</tt></a>, and <a
href='#mxmlSAXLoadString'><tt>mxmlSAXLoadString</tt></a> functions
provide the SAX loading APIs. Each function works like the
corresponding <tt>mxmlLoad</tt> function but uses a callback to
process each node as it is read.</p>
<p>The callback function receives the node, an event code, and
a user data pointer you supply:</p>
<pre>
void
sax_cb(mxml_node_t *node, mxml_sax_event_t event,
void *data)
{
... do something ...
}
</pre>
<p>The event will be one of the following:</p>
<ul>
<li><tt>MXML_SAX_CDATA</tt> - CDATA was just read</li>
<li><tt>MXML_SAX_COMMENT</tt> - A comment was just read</li>
<li><tt>MXML_SAX_DATA</tt> - Data (custom, integer, opaque, real, or text) was just read</li>
<li><tt>MXML_SAX_DIRECTIVE</tt> - A processing directive was just read</li>
<li><tt>MXML_SAX_ELEMENT_CLOSE</tt> - An open element was just read (<tt>&lt;element&gt;</tt>)</li>
<li><tt>MXML_SAX_ELEMENT_OPEN</tt> - A close element was just read (<tt>&lt;/element&gt;</tt>)</li>
</ul>
<p>Elements are <em>released</em> after the close element is
processed. All other nodes are released after they are processed.
The SAX callback can <em>retain</em> the node using the <a
href='#mxmlRetain'><tt>mxmlRetain</tt></a> function. For example,
the following SAX callback will retain all nodes, effectively
simulating a normal in-memory load:</p>
<pre>
void
sax_cb(mxml_node_t *node, mxml_sax_event_t event,
void *data)
{
if (event != MXML_SAX_ELEMENT_CLOSE)
mxmlRetain(node);
}
</pre>
<p>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 <tt>&lt;html&gt;</tt>, <tt>&lt;head&gt;</tt>, and <tt>&lt;body&gt;</tt>, and processing
directives like <tt>&lt;?xml ... ?&gt;</tt> and <tt>&lt;!DOCTYPE ... &gt;</tt>:</p>
<!-- NEED 10 -->
<pre>
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 &amp;&amp;
node->parent->ref_count > 1)
{
/*
* If the parent was retained, then retain
* this data node as well.
*/
mxmlRetain(node);
}
}
</pre>
<p>The resulting skeleton document tree can then be searched just
like one loaded using the <tt>mxmlLoad</tt> 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:</p>
<pre>
mxml_node_t *doc, *title, *body, *heading;
doc = mxmlSAXLoadFd(NULL, 0,
MXML_TEXT_CALLBACK,
<b>sax_cb</b>, 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);
}
</pre>
</body>
</html>
......@@ -417,27 +417,31 @@ three constants:</p>
<li><tt>MXML_NO_DESCEND</tt> 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.<br><br></li>
<li><tt>MXML_DESCEND_FIRST</tt> 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
<tt>MXML_DESCEND</tt> since every call is a first
time.<br><br></li>
node or top-of-tree is reached.
<p>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.<br><br></p></li>
<li><tt>MXML_DESCEND_FIRST</tt> 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.
<p>This mode is only applicable to the search function; the
walk functions treat this as <tt>MXML_DESCEND</tt> since
every call is a first time.<br><br></p></li>
<li><tt>MXML_DESCEND</tt> 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 <tt>mxmlWalkNext()</tt>, the order would be:
be the first node element under "group".
<p>If you were to walk from the root node "?xml" to the end
of the tree with <tt>mxmlWalkNext()</tt>, the order would
be:</p>
<p><tt>?xml data node val1 node val2 node val3 group node
val4 node val5 node val6 node val7 node val8</tt></p>
......
......@@ -148,9 +148,9 @@ appendices:</p>
<tt>mxmldoc(1)</tt> program to generate software
documentation.</li>
<li>Appendix A, "<a href='#LICENSE'>GNU
Library General Public License</a>", provides the terms
and conditions for using and distributing Mini-XML.</li>
<li>Appendix A, "<a href='#LICENSE'>Mini-XML License</a>",
provides the terms and conditions for using and distributing
Mini-XML.</li>
<li>Appendix B, "<a href='#RELNOTES'>Release Notes</a>",
lists the changes in each release of Mini-XML.</li>
......
.\"
.\" "$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 <mxml.h>
.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.
......@@ -3,8 +3,6 @@
<h1 align='right'><a name='LICENSE'>A - Mini-XML License</a></h1>
<p align='center'>October 18, 2005</p>
<p>The Mini-XML library and included programs are provided under
the terms of the GNU Library General Public License (LGPL) with
the following exceptions:</p>
......@@ -32,9 +30,9 @@ the following exceptions:</p>
</ol>
<hr noshade>
<!-- NEW PAGE -->
<p align=center><big>GNU LIBRARY GENERAL PUBLIC LICENSE</big></p>
<p align=center><b>GNU LIBRARY GENERAL PUBLIC LICENSE</b></p>
<p align='center'>Version 2, June 1991
<br />Copyright (C) 1991 Free Software Foundation, Inc.
<br />59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
......@@ -43,7 +41,7 @@ this license document, but changing it is not allowed.
<br />[This is the first released version of the library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]</p>
<p><big>Preamble</big></p>
<p><b>Preamble</b></p>
<p>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.</p>
ordinary General Public License rather than by this special
one.</p>
<p align='center'><big>TERMS AND CONDITIONS FOR COPYING,
DISTRIBUTION AND MODIFICATION</big></p>
<p align='center'><b>TERMS AND CONDITIONS FOR COPYING,
DISTRIBUTION AND MODIFICATION</b></p>
<p><strong>0.</strong> 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.</p>
<p align='center'><big>NO WARRANTY</big></p>
<p align='center'><b>NO WARRANTY</b></p>
<p><strong>15.</strong> 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.</p>
<p align='center'><big>END OF TERMS AND CONDITIONS</big></p>
<p align='center'><b>END OF TERMS AND CONDITIONS</b></p>
<p><b>How to Apply These Terms to Your New Libraries</b></p>
<p><big>How to Apply These Terms to Your New Libraries</big></p>
<p>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).
<p>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).
<p>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.
<p>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.
<ul>
<pre>
<var>one line to give the library's name and an idea of what it does.</var>
<p><var>one line to give the library's name and an idea of what it
does.</var><br>
Copyright (C) <var>year</var> <var>name of author</var>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
<p>This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
<p>This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
<p>You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
</pre>
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA
</ul>
<p>Also add information on how to contact you by electronic and paper mail.
<p>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:
<p>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:
<ul>
<p>Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James
Random Hacker.
<pre>
Yoyodyne, Inc., hereby disclaims all copyright interest in
the library `Frob' (a library for tweaking knobs) written
by James Random Hacker.
<p><var>signature of Ty Coon</var>, 1 April 1990 Ty Coon, President
of Vice
<var>signature of Ty Coon</var>, 1 April 1990
Ty Coon, President of Vice
</pre>
</ul>
<p>That's all there is to it!
......
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<!-- SECTION: Man Pages -->
<head>
<style type='text/css'><!--
h1, h2, h3, p { font-family: sans-serif; text-align: justify; }
tt, pre a:link, pre a:visited, tt a:link, tt a:visited { font-weight: bold; color: #7f0000; }
pre { font-weight: bold; color: #7f0000; margin-left: 2em; }
h1.title, h2.title, h3.title { border-bottom: solid 2px #000000; }
--></style>
<title>mxmldoc</title>
</head>
<body>
<!-- NEW PAGE -->
<h2 class='title'><a name='mxmldoc.1'>mxmldoc(1)</a></h2>
<h3 _hd_omit_toc>Name</h3>
mxmldoc - mini-xml documentation generator
<h3 _hd_omit_toc>Synopsis</h3>
<b>mxmldoc
</b>[ --intro
<i>introfile.html
</i>] [ --section
<i>section
</i>] [ --title
<i>title
</i>] [
<i>filename.xml
</i>] [
<i>source file(s)
</i>] >
<i>filename.html
</i><h3 _hd_omit_toc>Description</h3>
<i>mxmldoc</i> scans the specified C and C++ source files to
<h1 align='right'><a name='MXMLDOC'>4 - Using the mxmldoc
Utility</a></h1>
<p>Originally developed to generate the Mini-XML and CUPS API
documentation, the <tt>mxmldoc(1)</tt> 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.</p>
<h2>The Basics</h2>
<h2>Commenting Your Code</h2>
<h2>Creating HTML Documentation</h2>
<h2>Creating Man Pages</h2>
<h2>The XML Schema</h2>
<p><i>mxmldoc</i> 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
......
......@@ -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$".
.\"
This diff is collapsed.
......@@ -10,6 +10,9 @@
<li>Added two exceptions to the LGPL to support static
linking of applications against Mini-XML</li>
<li>The mxmldoc utility can now generate man pages,
too.</li>
<li>Added a mxmlNewXML() function</li>
<li>Added a mxmlElementSetAttrf() function (STR #43)</li>
......
......@@ -145,6 +145,8 @@ mxmlElementSetAttr(mxml_node_t *node, /* I - Element node */
* 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.
*
* @since Mini-XML 2.3@
*/
void
......
This diff is collapsed.
......@@ -331,10 +331,10 @@ mxmlNewCDATA(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */
*/
mxml_node_t * /* O - New node */
mxmlNewCustom(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */
void *data, /* I - Pointer to data */
void (*destroy)(void *))
/* I - Function to destroy data */
mxmlNewCustom(
mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */
void *data, /* I - Pointer to data */
mxml_custom_destroy_cb_t destroy) /* I - Function to destroy data */
{
mxml_node_t *node; /* New node */
......
......@@ -3,7 +3,7 @@
*
* Node set functions 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
......@@ -44,10 +44,10 @@
*/
int /* O - 0 on success, -1 on failure */
mxmlSetCustom(mxml_node_t *node, /* I - Node to set */
void *data, /* I - New data pointer */
void (*destroy)(void *))
/* I - New destructor function */
mxmlSetCustom(
mxml_node_t *node, /* I - Node to set */
void *data, /* I - New data pointer */
mxml_custom_destroy_cb_t destroy) /* I - New destructor function */
{
/*
* Range check input...
......
......@@ -71,6 +71,16 @@
* Data types...
*/
typedef enum mxml_sax_event_e /**** SAX event type. ****/
{
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_sax_event_t;
typedef enum mxml_type_e /**** The XML node type. ****/
{
MXML_IGNORE = -1, /* Ignore/throw away node @since Mini-XML 2.3@ */
......@@ -82,6 +92,12 @@ typedef enum mxml_type_e /**** The XML node type. ****/
MXML_CUSTOM /* Custom data @since Mini-XML 2.1@ */
} mxml_type_t;
typedef void (*mxml_custom_destroy_cb_t)(void *);
/**** Custom data destructor ****/
typedef void (*mxml_error_cb_t)(const char *);
/**** Error callback function ****/
typedef struct mxml_attr_s /**** An XML element attribute value. ****/
{
char *name; /* Attribute name */
......@@ -104,8 +120,7 @@ typedef struct mxml_text_s /**** An XML text value. ****/
typedef struct mxml_custom_s /**** An XML custom value. @since Mini-XML 2.1@ ****/
{
void *data; /* Pointer to (allocated) custom data */
void (*destroy)(void *);
/* Pointer to destructor function */
mxml_custom_destroy_cb_t destroy; /* Pointer to destructor function */
} mxml_custom_t;
typedef union mxml_value_u /**** An XML node value. ****/
......@@ -146,6 +161,15 @@ typedef int (*mxml_custom_load_cb_t)(mxml_node_t *, const char *);
typedef char *(*mxml_custom_save_cb_t)(mxml_node_t *);
/**** Custom data save callback function ****/
typedef mxml_type_t (*mxml_load_cb_t)(mxml_node_t *);
/**** Load callback function ****/
typedef const char *(*mxml_save_cb_t)(mxml_node_t *, int);
/**** Save callback function ****/
typedef void (*mxml_sax_cb_t)(mxml_node_t *, mxml_sax_event_t, void *);
/**** SAX callback function ****/
/*
* C++ support...
......@@ -194,7 +218,7 @@ extern mxml_node_t *mxmlLoadString(mxml_node_t *top, const char *s,
mxml_type_t (*cb)(mxml_node_t *));
extern mxml_node_t *mxmlNewCDATA(mxml_node_t *parent, const char *string);
extern mxml_node_t *mxmlNewCustom(mxml_node_t *parent, void *data,
void (*destroy)(void *));
mxml_custom_destroy_cb_t destroy);
extern mxml_node_t *mxmlNewElement(mxml_node_t *parent, const char *name);
extern mxml_node_t *mxmlNewInteger(mxml_node_t *parent, int integer);
extern mxml_node_t *mxmlNewOpaque(mxml_node_t *parent, const char *opaque);
......@@ -212,21 +236,29 @@ extern int mxmlRelease(mxml_node_t *node);
extern void mxmlRemove(mxml_node_t *node);
extern int mxmlRetain(mxml_node_t *node);
extern char *mxmlSaveAllocString(mxml_node_t *node,
const char *(*cb)(mxml_node_t *, int));
mxml_save_cb_t cb);
extern int mxmlSaveFd(mxml_node_t *node, int fd,
const char *(*cb)(mxml_node_t *, int));
mxml_save_cb_t cb);
extern int mxmlSaveFile(mxml_node_t *node, FILE *fp,
const char *(*cb)(mxml_node_t *, int));
mxml_save_cb_t cb);
extern int mxmlSaveString(mxml_node_t *node, char *buffer,
int bufsize,
const char *(*cb)(mxml_node_t *, int));
int bufsize, mxml_save_cb_t cb);
extern mxml_node_t *mxmlSAXLoadFd(mxml_node_t *top, int fd,
mxml_type_t (*cb)(mxml_node_t *),
mxml_sax_cb_t sax, void *sax_data);
extern mxml_node_t *mxmlSAXLoadFile(mxml_node_t *top, FILE *fp,
mxml_type_t (*cb)(mxml_node_t *),
mxml_sax_cb_t sax, void *sax_data);
extern mxml_node_t *mxmlSAXLoadString(mxml_node_t *top, const char *s,
mxml_type_t (*cb)(mxml_node_t *),
mxml_sax_cb_t sax, void *sax_data);
extern int mxmlSetCDATA(mxml_node_t *node, const char *data);
extern int mxmlSetCustom(mxml_node_t *node, void *data,
void (*destroy)(void *));
mxml_custom_destroy_cb_t destroy);
extern void mxmlSetCustomHandlers(mxml_custom_load_cb_t load,
mxml_custom_save_cb_t save);
extern int mxmlSetElement(mxml_node_t *node, const char *name);
extern void mxmlSetErrorCallback(void (*cb)(const char *));
extern void mxmlSetErrorCallback(mxml_error_cb_t cb);
extern int mxmlSetInteger(mxml_node_t *node, int integer);
extern int mxmlSetOpaque(mxml_node_t *node, const char *opaque);
extern int mxmlSetReal(mxml_node_t *node, double real);
......
This diff is collapsed.
This diff is collapsed.
......@@ -3,7 +3,7 @@
*
* Test program for Mini-XML, a small XML-like file parsing library.
*
* Copyright 2003-2005 by Michael Sweet.
* Copyright 2003-2007 by Michael Sweet.