Add mxmlNewCDATA() and mxmlSetCDATA() functions.

Bump version to 2.2.3.

Update docos.
pull/193/head
Michael R Sweet 19 years ago
parent 35b7bc18e3
commit cc95be7bed
  1. 9
      CHANGES
  2. 3
      config.h.in
  3. 641
      configure
  4. 2
      configure.in
  5. 4
      doc/intro.html
  6. 154
      doc/mxml.html
  7. 53
      doc/reference.html
  8. 15
      doc/relnotes.html
  9. 41
      mxml-node.c
  10. 33
      mxml-set.c
  11. 28
      mxml-string.c
  12. 2
      mxml.h
  13. 37
      mxml.xml

@ -1,6 +1,13 @@
CHANGES - 06/07/2005
CHANGES - 08/05/2005
--------------------
CHANGES IN Mini-XML 2.2.4
- Added new mxmlNewCDATA() and mxmlSetCDATA() functions
to create and set CDATA nodes, which are really just
special element nodes.
CHANGES IN Mini-XML 2.2.3
- Added new MXML_IGNORE type and MXML_IGNORE_CB callback

@ -57,7 +57,8 @@ extern char *mxml_strdup(const char *);
# define strdup mxml_strdup
# endif /* !HAVE_STRDUP */
extern char *mxml_strdupf(const char *, va_list);
extern char *mxml_strdupf(const char *, ...);
extern char *mxml_vstrdupf(const char *, va_list);
# ifndef HAVE_VSNPRINTF
extern int mxml_vsnprintf(char *, size_t, const char *, va_list);

641
configure vendored

File diff suppressed because it is too large Load Diff

@ -23,7 +23,7 @@ dnl Set the name of the config header file...
AC_CONFIG_HEADER(config.h)
dnl Version number...
VERSION=2.2.3
VERSION=2.2.4
AC_SUBST(VERSION)
AC_DEFINE_UNQUOTED(MXML_VERSION, "Mini-XML v$VERSION")

@ -1,6 +1,6 @@
<html>
<head>
<title>Mini-XML Programmers Manual, Version 2.2.1</title>
<title>Mini-XML Programmers Manual, Version 2.2.3</title>
<meta name='copyright' content='Copyright 2003-2005'/>
<meta name='author' content='Michael Sweet'/>
<meta name='keywords' content='XML, C, C++, library'/>
@ -9,7 +9,7 @@
<h1 align='right'><a name='INTRO'>Introduction</a></h1>
<p>This programmers manual describes Mini-XML version 2.2.1, a
<p>This programmers manual describes Mini-XML version 2.2.3, a
small XML parsing library that you can use to read and write XML
and XML-like data files in your application without requiring
large non-standard libraries. Mini-XML only requires an ANSI C

@ -1,7 +1,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>Mini-XML Programmers Manual, Version 2.2.1</TITLE>
<TITLE>Mini-XML Programmers Manual, Version 2.2.3</TITLE>
<META NAME="author" CONTENT="Michael Sweet">
<META NAME="copyright" CONTENT="Copyright 2003-2005">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1">
@ -19,8 +19,8 @@ PRE { font-family: monospace }
--></STYLE>
</HEAD>
<BODY>
<CENTER><A HREF="#CONTENTS"><IMG SRC="logo.png" BORDER="0" WIDTH="256" HEIGHT="256" ALT="Mini-XML Programmers Manual, Version 2.2.1"><BR>
<H1>Mini-XML Programmers Manual, Version 2.2.1</H1></A><BR>
<CENTER><A HREF="#CONTENTS"><IMG SRC="logo.png" BORDER="0" WIDTH="256" HEIGHT="256" ALT="Mini-XML Programmers Manual, Version 2.2.3"><BR>
<H1>Mini-XML Programmers Manual, Version 2.2.3</H1></A><BR>
Michael Sweet<BR>
Copyright 2003-2005<BR>
</CENTER>
@ -83,21 +83,22 @@ Copyright 2003-2005<BR>
</UL>
<B><A HREF="#RELNOTES">B - Release Notes</A></B>
<UL>
<LI><A HREF="#7_1">Changes in Mini-XML 2.2.2</A></LI>
<LI><A HREF="#7_2">Changes in Mini-XML 2.2.1</A></LI>
<LI><A HREF="#7_3">Changes in Mini-XML 2.2</A></LI>
<LI><A HREF="#7_4">Changes in Mini-XML 2.1</A></LI>
<LI><A HREF="#7_5">Changes in Mini-XML 2.0</A></LI>
<LI><A HREF="#7_6">Changes in Mini-XML 1.3</A></LI>
<LI><A HREF="#7_7">Changes in Mini-XML 1.2</A></LI>
<LI><A HREF="#7_8">Changes in Mini-XML 1.1.2</A></LI>
<LI><A HREF="#7_9">Changes in Mini-XML 1.1.1</A></LI>
<LI><A HREF="#7_10">Changes in Mini-XML 1.1</A></LI>
<LI><A HREF="#7_11">Changes in Mini-XML 1.0</A></LI>
<LI><A HREF="#7_12">Changes in Mini-XML 0.93</A></LI>
<LI><A HREF="#7_13">Changes in Mini-XML 0.92</A></LI>
<LI><A HREF="#7_14">Changes in Mini-XML 0.91</A></LI>
<LI><A HREF="#7_15">Changes in Mini-XML 0.9</A></LI>
<LI><A HREF="#7_1">Changes in Mini-XML 2.2.3</A></LI>
<LI><A HREF="#7_2">Changes in Mini-XML 2.2.2</A></LI>
<LI><A HREF="#7_3">Changes in Mini-XML 2.2.1</A></LI>
<LI><A HREF="#7_4">Changes in Mini-XML 2.2</A></LI>
<LI><A HREF="#7_5">Changes in Mini-XML 2.1</A></LI>
<LI><A HREF="#7_6">Changes in Mini-XML 2.0</A></LI>
<LI><A HREF="#7_7">Changes in Mini-XML 1.3</A></LI>
<LI><A HREF="#7_8">Changes in Mini-XML 1.2</A></LI>
<LI><A HREF="#7_9">Changes in Mini-XML 1.1.2</A></LI>
<LI><A HREF="#7_10">Changes in Mini-XML 1.1.1</A></LI>
<LI><A HREF="#7_11">Changes in Mini-XML 1.1</A></LI>
<LI><A HREF="#7_12">Changes in Mini-XML 1.0</A></LI>
<LI><A HREF="#7_13">Changes in Mini-XML 0.93</A></LI>
<LI><A HREF="#7_14">Changes in Mini-XML 0.92</A></LI>
<LI><A HREF="#7_15">Changes in Mini-XML 0.91</A></LI>
<LI><A HREF="#7_16">Changes in Mini-XML 0.9</A></LI>
</UL>
<B><A HREF="#REFERENCE">C - Library Reference</A></B>
<UL>
@ -126,6 +127,7 @@ Copyright 2003-2005<BR>
<LI><A HREF="#mxmlLoadFd">mxmlLoadFd()</A></LI>
<LI><A HREF="#mxmlLoadFile">mxmlLoadFile()</A></LI>
<LI><A HREF="#mxmlLoadString">mxmlLoadString()</A></LI>
<LI><A HREF="#mxmlNewCDATA">mxmlNewCDATA()</A></LI>
<LI><A HREF="#mxmlNewCustom">mxmlNewCustom()</A></LI>
<LI><A HREF="#mxmlNewElement">mxmlNewElement()</A></LI>
<LI><A HREF="#mxmlNewInteger">mxmlNewInteger()</A></LI>
@ -138,6 +140,7 @@ Copyright 2003-2005<BR>
<LI><A HREF="#mxmlSaveFd">mxmlSaveFd()</A></LI>
<LI><A HREF="#mxmlSaveFile">mxmlSaveFile()</A></LI>
<LI><A HREF="#mxmlSaveString">mxmlSaveString()</A></LI>
<LI><A HREF="#mxmlSetCDATA">mxmlSetCDATA()</A></LI>
<LI><A HREF="#mxmlSetCustom">mxmlSetCustom()</A></LI>
<LI><A HREF="#mxmlSetCustomHandlers">mxmlSetCustomHandlers()</A></LI>
<LI><A HREF="#mxmlSetElement">mxmlSetElement()</A></LI>
@ -169,7 +172,6 @@ Copyright 2003-2005<BR>
<LI><A HREF="#mxml_index_t">mxml_index_t</A></LI>
<LI><A HREF="#mxml_node_t">mxml_node_t</A></LI>
<LI><A HREF="#mxml_text_t">mxml_text_t</A></LI>
<LI><A HREF="#mxml_type_t">mxml_type_t</A></LI>
<LI><A HREF="#mxml_value_t">mxml_value_t</A></LI>
</UL>
</LI>
@ -181,7 +183,7 @@ Copyright 2003-2005<BR>
</UL>
<HR NOSHADE>
<H1 align="right"><A name="INTRO">Introduction</A></H1>
<P>This programmers manual describes Mini-XML version 2.2.1, a small XML
<P>This programmers manual describes Mini-XML version 2.2.3, a small XML
parsing library that you can use to read and write XML and XML-like
data files in your application without requiring large non-standard
libraries. Mini-XML only requires an ANSI C compatible compiler (GCC
@ -1827,12 +1829,19 @@ Ty Coon, President of Vice
<P>That's all there is to it!</P>
<HR NOSHADE>
<H1 align="right"><A name="RELNOTES">B - Release Notes</A></H1>
<H2><A NAME="7_1">Changes in Mini-XML 2.2.2</A></H2>
<H2><A NAME="7_1">Changes in Mini-XML 2.2.3</A></H2>
<UL>
<LI>Added new mxmlNewCDATA() and mxmlSetCDATA() functions to create and
set CDATA nodes, which are really just special element nodes.</LI>
</UL>
<H2><A NAME="7_2">Changes in Mini-XML 2.2.2</A></H2>
<UL>
<LI>Added new MXML_IGNORE type and MXML_IGNORE_CB callback to ignore
non-element nodes (i.e. whitespace)</LI>
<LI>mxmlLoad*() did not treat custom data as opaque, so whitespace
characters would be lost.</LI>
</UL>
<H2><A NAME="7_2">Changes in Mini-XML 2.2.1</A></H2>
<H2><A NAME="7_3">Changes in Mini-XML 2.2.1</A></H2>
<UL>
<LI>mxmlLoadFd(), mxmlLoadFile(), and mxmlLoadString() now correctly
return NULL on error (STR #21)</LI>
@ -1843,7 +1852,7 @@ Ty Coon, President of Vice
proper permissions on UNIX/Linux/OSX.</LI>
<LI>Fixed a MingW/Cygwin compilation problem (STR #18)</LI>
</UL>
<H2><A NAME="7_3">Changes in Mini-XML 2.2</A></H2>
<H2><A NAME="7_4">Changes in Mini-XML 2.2</A></H2>
<UL>
<LI>Added shared library support (STR #17)</LI>
<LI>mxmlLoad*() now returns an error when an XML stream contains illegal
@ -1857,7 +1866,7 @@ Ty Coon, President of Vice
<LI>Added checking for invalid comment termination (&quot;---&gt;&quot; is not
allowed)</LI>
</UL>
<H2><A NAME="7_4">Changes in Mini-XML 2.1</A></H2>
<H2><A NAME="7_5">Changes in Mini-XML 2.1</A></H2>
<UL>
<LI>Added support for custom data nodes (STR #6)</LI>
<LI>Now treat UTF-8 sequences which are longer than necessary as an
@ -1868,7 +1877,7 @@ Ty Coon, President of Vice
<LI>Added mxmlLoadFd() and mxmlSaveFd() functions.</LI>
<LI>Fixed multi-word UTF-16 handling.</LI>
</UL>
<H2><A NAME="7_5">Changes in Mini-XML 2.0</A></H2>
<H2><A NAME="7_6">Changes in Mini-XML 2.0</A></H2>
<UL>
<LI>New programmers manual.</LI>
<LI>Added Visual C++ project files for Microsoft Windows users.</LI>
@ -1901,7 +1910,7 @@ Ty Coon, President of Vice
destination path and install path. This caused problems when building
and installing with MingW.</LI>
</UL>
<H2><A NAME="7_6">Changes in Mini-XML 1.3</A></H2>
<H2><A NAME="7_7">Changes in Mini-XML 1.3</A></H2>
<UL>
<LI>Fixes for mxmldoc.</LI>
<LI>Added support for reading standard HTML entity names.</LI>
@ -1917,7 +1926,7 @@ Ty Coon, President of Vice
<LI>The load and save functions now properly handle quoted element and
attribute name strings properly, e.g. for !DOCTYPE declarations.</LI>
</UL>
<H2><A NAME="7_7">Changes in Mini-XML 1.2</A></H2>
<H2><A NAME="7_8">Changes in Mini-XML 1.2</A></H2>
<UL>
<LI>Added new &quot;set&quot; methods to set the value of a node.</LI>
<LI>Added new formatted text methods mxmlNewTextf() and mxmlSetTextf()
@ -1930,13 +1939,13 @@ Ty Coon, President of Vice
<LI>Added --with/without-snprintf configure option to control the
snprintf() and vsnprintf() function checks.</LI>
</UL>
<H2><A NAME="7_8">Changes in Mini-XML 1.1.2</A></H2>
<H2><A NAME="7_9">Changes in Mini-XML 1.1.2</A></H2>
<UL>
<LI>The mxml(3) man page wasn't updated for the string functions.</LI>
<LI>mxmlSaveString() returned the wrong number of characters.</LI>
<LI>mxml_add_char() updated the buffer pointer in the wrong place.</LI>
</UL>
<H2><A NAME="7_9">Changes in Mini-XML 1.1.1</A></H2>
<H2><A NAME="7_10">Changes in Mini-XML 1.1.1</A></H2>
<UL>
<LI>The private mxml_add_ch() function did not update the
start-of-buffer pointer which could cause a crash when using
@ -1947,7 +1956,7 @@ Ty Coon, President of Vice
<LI>Added a mxmlSaveAllocString() convenience function for saving an XML
node tree to an allocated string.</LI>
</UL>
<H2><A NAME="7_10">Changes in Mini-XML 1.1</A></H2>
<H2><A NAME="7_11">Changes in Mini-XML 1.1</A></H2>
<UL>
<LI>The mxmlLoadFile() function now uses dynamically allocated string
buffers for element names, attribute names, and attribute values.
@ -1959,7 +1968,7 @@ Ty Coon, President of Vice
<LI>Add emulation of strdup() if the local platform does not provide the
function.</LI>
</UL>
<H2><A NAME="7_11">Changes in Mini-XML 1.0</A></H2>
<H2><A NAME="7_12">Changes in Mini-XML 1.0</A></H2>
<UL>
<LI>The mxmldoc program now handles function arguments, structures,
unions, enumerations, classes, and typedefs properly.</LI>
@ -1967,7 +1976,7 @@ Ty Coon, President of Vice
code.</LI>
<LI>Added man pages and packaging files.</LI>
</UL>
<H2><A NAME="7_12">Changes in Mini-XML 0.93</A></H2>
<H2><A NAME="7_13">Changes in Mini-XML 0.93</A></H2>
<UL>
<LI>New mxmldoc example program that is also used to create and update
code documentation using XML and produce HTML reference pages.</LI>
@ -1992,15 +2001,15 @@ Ty Coon, President of Vice
<LI>mxmlSaveFile() now supports a whitespace callback to provide more
human-readable XML output under program control.</LI>
</UL>
<H2><A NAME="7_13">Changes in Mini-XML 0.92</A></H2>
<H2><A NAME="7_14">Changes in Mini-XML 0.92</A></H2>
<UL>
<LI>mxmlSaveFile() didn't return a value on success.</LI>
</UL>
<H2><A NAME="7_14">Changes in Mini-XML 0.91</A></H2>
<H2><A NAME="7_15">Changes in Mini-XML 0.91</A></H2>
<UL>
<LI>mxmlWalkNext() would go into an infinite loop.</LI>
</UL>
<H2><A NAME="7_15">Changes in Mini-XML 0.9</A></H2>
<H2><A NAME="7_16">Changes in Mini-XML 0.9</A></H2>
<UL>
<LI>Initial public release.</LI>
</UL>
@ -2034,6 +2043,7 @@ Ty Coon, President of Vice
<TBODY></TBODY>
<TR><TD><TT>MXML_CUSTOM</TT></TD><TD>Custom data</TD></TR>
<TR><TD><TT>MXML_ELEMENT</TT></TD><TD>XML element with attributes</TD></TR>
<TR><TD><TT>MXML_IGNORE</TT></TD><TD>Ignore/throw away node</TD></TR>
<TR><TD><TT>MXML_INTEGER</TT></TD><TD>Integer value</TD></TR>
<TR><TD><TT>MXML_OPAQUE</TT></TD><TD>Opaque string</TD></TR>
<TR><TD><TT>MXML_REAL</TT></TD><TD>Real value</TD></TR>
@ -2062,6 +2072,7 @@ Ty Coon, President of Vice
<LI><A href="#mxmlLoadFd"><TT>mxmlLoadFd()</TT></A></LI>
<LI><A href="#mxmlLoadFile"><TT>mxmlLoadFile()</TT></A></LI>
<LI><A href="#mxmlLoadString"><TT>mxmlLoadString()</TT></A></LI>
<LI><A href="#mxmlNewCDATA"><TT>mxmlNewCDATA()</TT></A></LI>
<LI><A href="#mxmlNewCustom"><TT>mxmlNewCustom()</TT></A></LI>
<LI><A href="#mxmlNewElement"><TT>mxmlNewElement()</TT></A></LI>
<LI><A href="#mxmlNewInteger"><TT>mxmlNewInteger()</TT></A></LI>
@ -2074,6 +2085,7 @@ Ty Coon, President of Vice
<LI><A href="#mxmlSaveFd"><TT>mxmlSaveFd()</TT></A></LI>
<LI><A href="#mxmlSaveFile"><TT>mxmlSaveFile()</TT></A></LI>
<LI><A href="#mxmlSaveString"><TT>mxmlSaveString()</TT></A></LI>
<LI><A href="#mxmlSetCDATA"><TT>mxmlSetCDATA()</TT></A></LI>
<LI><A href="#mxmlSetCustom"><TT>mxmlSetCustom()</TT></A></LI>
<LI><A href="#mxmlSetCustomHandlers"><TT>mxmlSetCustomHandlers()</TT></A>
</LI>
@ -2483,7 +2495,7 @@ mxmlIndexReset(
mxmlLoadFd(
<A href="#mxml_node_t">mxml_node_t</A> * top,
int fd,
<A href="#mxml_type_t">mxml_type_t</A> (*cb)(mxml_node_t *node));
mxml_type_t (*cb)(mxml_node_t *node));
</PRE>
<H4>Arguments</H4>
<P class="table"></P>
@ -2518,7 +2530,7 @@ mxmlLoadFd(
mxmlLoadFile(
<A href="#mxml_node_t">mxml_node_t</A> * top,
FILE * fp,
<A href="#mxml_type_t">mxml_type_t</A> (*cb)(mxml_node_t *node));
mxml_type_t (*cb)(mxml_node_t *node));
</PRE>
<H4>Arguments</H4>
<P class="table"></P>
@ -2553,7 +2565,7 @@ mxmlLoadFile(
mxmlLoadString(
<A href="#mxml_node_t">mxml_node_t</A> * top,
const char * s,
<A href="#mxml_type_t">mxml_type_t</A> (*cb)(mxml_node_t *node));
mxml_type_t (*cb)(mxml_node_t *node));
</PRE>
<H4>Arguments</H4>
<P class="table"></P>
@ -2569,6 +2581,34 @@ mxmlLoadString(
<H4>Returns</H4>
<P>First node or NULL if the string has errors.</P>
<!-- NEW PAGE -->
<H3><A name="mxmlNewCDATA">mxmlNewCDATA()</A></H3>
<HR noshade/>
<H4>Description</H4>
<P>Create a new CDATA node. 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.</P>
<H4>Syntax</H4>
<PRE>
<A href="#mxml_node_t">mxml_node_t</A> *
mxmlNewCDATA(
<A href="#mxml_node_t">mxml_node_t</A> * parent,
const char * data);
</PRE>
<H4>Arguments</H4>
<P class="table"></P>
<TABLE align="center" border="1" cellpadding="5" cellspacing="0" width="80%">
<THEAD></THEAD>
<TR bgcolor="#cccccc"><TH>Name</TH><TH>Description</TH></TR>
<TBODY></TBODY>
<TR><TD><TT>parent</TT></TD><TD>Parent node or MXML_NO_PARENT</TD></TR>
<TR><TD><TT>data</TT></TD><TD>Data string</TD></TR>
</TABLE>
<H4>Returns</H4>
<P>New node</P>
<!-- NEW PAGE -->
<H3><A name="mxmlNewCustom">mxmlNewCustom()</A></H3>
<HR noshade/>
@ -2926,6 +2966,31 @@ mxmlSaveString(
<H4>Returns</H4>
<P>Size of string</P>
<!-- NEW PAGE -->
<H3><A name="mxmlSetCDATA">mxmlSetCDATA()</A></H3>
<HR noshade/>
<H4>Description</H4>
<P>Set the element name of a CDATA node. The node is not changed if it
is not a CDATA element node.</P>
<H4>Syntax</H4>
<PRE>
int
mxmlSetCDATA(
<A href="#mxml_node_t">mxml_node_t</A> * node,
const char * data);
</PRE>
<H4>Arguments</H4>
<P class="table"></P>
<TABLE align="center" border="1" cellpadding="5" cellspacing="0" width="80%">
<THEAD></THEAD>
<TR bgcolor="#cccccc"><TH>Name</TH><TH>Description</TH></TR>
<TBODY></TBODY>
<TR><TD><TT>node</TT></TD><TD>Node to set</TD></TR>
<TR><TD><TT>data</TT></TD><TD>New data string</TD></TR>
</TABLE>
<H4>Returns</H4>
<P>0 on success, -1 on failure</P>
<!-- NEW PAGE -->
<H3><A name="mxmlSetCustom">mxmlSetCustom()</A></H3>
<HR noshade/>
@ -3318,7 +3383,7 @@ struct mxml_node_s
struct <A href="#mxml_node_s">mxml_node_s</A> * next;
struct <A href="#mxml_node_s">mxml_node_s</A> * parent;
struct <A href="#mxml_node_s">mxml_node_s</A> * prev;
<A href="#mxml_type_t">mxml_type_t</A> type;
mxml_type_t type;
<A href="#mxml_value_t">mxml_value_t</A> value;
};
</PRE>
@ -3394,7 +3459,6 @@ struct mxml_value_s
<LI><A href="#mxml_index_t"><TT>mxml_index_t</TT></A></LI>
<LI><A href="#mxml_node_t"><TT>mxml_node_t</TT></A></LI>
<LI><A href="#mxml_text_t"><TT>mxml_text_t</TT></A></LI>
<LI><A href="#mxml_type_t"><TT>mxml_type_t</TT></A></LI>
<LI><A href="#mxml_value_t"><TT>mxml_value_t</TT></A></LI>
</UL>
@ -3458,16 +3522,6 @@ typedef struct <A href="#mxml_node_s">mxml_node_s</A> mxml_node_t;
typedef struct <A href="#mxml_text_s">mxml_text_s</A> mxml_text_t;
</PRE>
<!-- NEW PAGE -->
<H3><A name="mxml_type_t">mxml_type_t</A></H3>
<HR noshade/>
<H4>Description</H4>
<P>The XML node type.</P>
<H4>Definition</H4>
<PRE>
typedef enum <A href="#mxml_type_e">mxml_type_e</A> mxml_type_t;
</PRE>
<!-- NEW PAGE -->
<H3><A name="mxml_value_t">mxml_value_t</A></H3>
<HR noshade/>

@ -2,7 +2,7 @@
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
<head>
<title>Documentation</title>
<meta name='creator' content='Mini-XML v2.2.3'/>
<meta name='creator' content='Mini-XML v2.2.4'/>
<style><!--
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; }
@ -60,6 +60,7 @@
<li><a href='#mxmlLoadFd'><tt>mxmlLoadFd()</tt></a></li>
<li><a href='#mxmlLoadFile'><tt>mxmlLoadFile()</tt></a></li>
<li><a href='#mxmlLoadString'><tt>mxmlLoadString()</tt></a></li>
<li><a href='#mxmlNewCDATA'><tt>mxmlNewCDATA()</tt></a></li>
<li><a href='#mxmlNewCustom'><tt>mxmlNewCustom()</tt></a></li>
<li><a href='#mxmlNewElement'><tt>mxmlNewElement()</tt></a></li>
<li><a href='#mxmlNewInteger'><tt>mxmlNewInteger()</tt></a></li>
@ -72,6 +73,7 @@
<li><a href='#mxmlSaveFd'><tt>mxmlSaveFd()</tt></a></li>
<li><a href='#mxmlSaveFile'><tt>mxmlSaveFile()</tt></a></li>
<li><a href='#mxmlSaveString'><tt>mxmlSaveString()</tt></a></li>
<li><a href='#mxmlSetCDATA'><tt>mxmlSetCDATA()</tt></a></li>
<li><a href='#mxmlSetCustom'><tt>mxmlSetCustom()</tt></a></li>
<li><a href='#mxmlSetCustomHandlers'><tt>mxmlSetCustomHandlers()</tt></a></li>
<li><a href='#mxmlSetElement'><tt>mxmlSetElement()</tt></a></li>
@ -532,6 +534,32 @@ mxmlLoadString(
<h4>Returns</h4>
<p>First node or NULL if the string has errors.</p>
<!-- NEW PAGE -->
<h3><a name='mxmlNewCDATA'>mxmlNewCDATA()</a></h3>
<hr noshade/>
<h4>Description</h4>
<p>Create a new CDATA node.
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.</p>
<h4>Syntax</h4>
<pre>
<a href='#mxml_node_t'>mxml_node_t</a> *
mxmlNewCDATA(
<a href='#mxml_node_t'>mxml_node_t</a> * parent,
const char * data);
</pre>
<h4>Arguments</h4>
<p class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' width='80%'>
<thead><tr bgcolor='#cccccc'><th>Name</th><th>Description</th></tr></thead>
<tbody>
<tr><td><tt>parent</tt></td><td>Parent node or MXML_NO_PARENT</td></tr>
<tr><td><tt>data</tt></td><td>Data string</td></tr>
</tbody></table></p>
<h4>Returns</h4>
<p>New node</p>
<!-- NEW PAGE -->
<h3><a name='mxmlNewCustom'>mxmlNewCustom()</a></h3>
<hr noshade/>
<h4>Description</h4>
@ -869,6 +897,29 @@ mxmlSaveString(
<h4>Returns</h4>
<p>Size of string</p>
<!-- NEW PAGE -->
<h3><a name='mxmlSetCDATA'>mxmlSetCDATA()</a></h3>
<hr noshade/>
<h4>Description</h4>
<p>Set the element name of a CDATA node.
The node is not changed if it is not a CDATA element node.</p>
<h4>Syntax</h4>
<pre>
int
mxmlSetCDATA(
<a href='#mxml_node_t'>mxml_node_t</a> * node,
const char * data);
</pre>
<h4>Arguments</h4>
<p class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' width='80%'>
<thead><tr bgcolor='#cccccc'><th>Name</th><th>Description</th></tr></thead>
<tbody>
<tr><td><tt>node</tt></td><td>Node to set</td></tr>
<tr><td><tt>data</tt></td><td>New data string</td></tr>
</tbody></table></p>
<h4>Returns</h4>
<p>0 on success, -1 on failure</p>
<!-- NEW PAGE -->
<h3><a name='mxmlSetCustom'>mxmlSetCustom()</a></h3>
<hr noshade/>
<h4>Description</h4>

@ -3,10 +3,25 @@
<h1 align='right'><a name='RELNOTES'>B - Release Notes</a></h1>
<h2>Changes in Mini-XML 2.2.3</h2>
<ul>
<li>Added new mxmlNewCDATA() and mxmlSetCDATA() functions
to create and set CDATA nodes, which are really just
special element nodes.</li>
</ul>
<h2>Changes in Mini-XML 2.2.2</h2>
<ul>
<li>Added new MXML_IGNORE type and MXML_IGNORE_CB
callback to ignore non-element nodes (i.e.
whitespace)</li>
<li>mxmlLoad*() did not treat custom data as opaque, so
whitespace characters would be lost.</li>

@ -273,6 +273,45 @@ mxmlDelete(mxml_node_t *node) /* I - Node to delete */
}
/*
* 'mxmlNewCDATA()' - Create a new CDATA node.
*
* 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.
*/
mxml_node_t * /* O - New node */
mxmlNewCDATA(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */
const char *data) /* I - Data string */
{
mxml_node_t *node; /* New node */
#ifdef DEBUG
fprintf(stderr, "mxmlNewCDATA(parent=%p, data=\"%s\")\n",
parent, data ? data : "(null)");
#endif /* DEBUG */
/*
* Range check input...
*/
if (!data)
return (NULL);
/*
* Create the node and set the name value...
*/
if ((node = mxml_new(parent, MXML_ELEMENT)) != NULL)
node->value.element.name = mxml_strdupf("![CDATA[%s]]", data);
return (node);
}
/*
* 'mxmlNewCustom()' - Create a new custom data node.
*
@ -532,7 +571,7 @@ mxmlNewTextf(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */
va_start(ap, format);
node->value.text.whitespace = whitespace;
node->value.text.string = mxml_strdupf(format, ap);
node->value.text.string = mxml_vstrdupf(format, ap);
va_end(ap);
}

@ -17,6 +17,8 @@
*
* Contents:
*
* mxmlSetCustom() - Set the data and destructor of a custom data node.
* mxmlSetCDATA() - Set the element name of a CDATA node.
* mxmlSetElement() - Set the name of an element node.
* mxmlSetInteger() - Set the value of an integer node.
* mxmlSetOpaque() - Set the value of an opaque node.
@ -66,6 +68,37 @@ mxmlSetCustom(mxml_node_t *node, /* I - Node to set */
}
/*
* 'mxmlSetCDATA()' - Set the element name of a CDATA node.
*
* The node is not changed if it is not a CDATA element node.
*/
int /* O - 0 on success, -1 on failure */
mxmlSetCDATA(mxml_node_t *node, /* I - Node to set */
const char *data) /* I - New data string */
{
/*
* Range check input...
*/
if (!node || node->type != MXML_ELEMENT || !data ||
strncmp(node->value.element.name, "![CDATA[", 8))
return (-1);
/*
* Free any old element value and set the new value...
*/
if (node->value.element.name)
free(node->value.element.name);
node->value.element.name = mxml_strdupf("![CDATA[%s]]", data);
return (0);
}
/*
* 'mxmlSetElement()' - Set the name of an element node.
*

@ -19,6 +19,7 @@
*
* mxml_strdup() - Duplicate a string.
* mxml_strdupf() - Format and duplicate a string.
* mxml_vstrdupf() - Format and duplicate a string.
* mxml_vsnprintf() - Format a string into a fixed size buffer.
*/
@ -57,7 +58,32 @@ mxml_strdup(const char *s) /* I - String to duplicate */
char * /* O - New string pointer */
mxml_strdupf(const char *format, /* I - Printf-style format string */
va_list ap) /* I - Pointer to additional arguments */
...) /* I - Additional arguments as needed */
{
va_list ap; /* Pointer to additional arguments */
char *s; /* Pointer to formatted string */
/*
* Get a pointer to the additional arguments, format the string,
* and return it...
*/
va_start(ap, format);
s = mxml_vstrdupf(format, ap);
va_end(ap);
return (s);
}
/*
* 'mxml_vstrdupf()' - Format and duplicate a string.
*/
char * /* O - New string pointer */
mxml_vstrdupf(const char *format, /* I - Printf-style format string */
va_list ap) /* I - Pointer to additional arguments */
{
int bytes; /* Number of bytes required */
char *buffer, /* String buffer */

@ -185,6 +185,7 @@ extern mxml_node_t *mxmlLoadFile(mxml_node_t *top, FILE *fp,
mxml_type_t (*cb)(mxml_node_t *));
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 *));
extern mxml_node_t *mxmlNewElement(mxml_node_t *parent, const char *name);
@ -209,6 +210,7 @@ extern int mxmlSaveFile(mxml_node_t *node, FILE *fp,
extern int mxmlSaveString(mxml_node_t *node, char *buffer,
int bufsize,
const char *(*cb)(mxml_node_t *, int));
extern int mxmlSetCDATA(mxml_node_t *node, const char *data);
extern int mxmlSetCustom(mxml_node_t *node, void *data,
void (*destroy)(void *));
extern void mxmlSetCustomHandlers(mxml_custom_load_cb_t load,

@ -332,6 +332,26 @@ child nodes of the specified type.</description>
<description>Callback function or MXML_NO_CALLBACK</description>
</argument>
</function>
<function name="mxmlNewCDATA">
<returnvalue>
<type>mxml_node_t *</type>
<description>New node</description>
</returnvalue>
<description>Create a new CDATA node.
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.</description>
<argument name="parent" direction="I">
<type>mxml_node_t *</type>
<description>Parent node or MXML_NO_PARENT</description>
</argument>
<argument name="data" direction="I">
<type>const char *</type>
<description>Data string</description>
</argument>
</function>
<function name="mxmlNewCustom">
<returnvalue>
<type>mxml_node_t *</type>
@ -606,6 +626,23 @@ element tags.</description>
<description>Whitespace callback or MXML_NO_CALLBACK</description>
</argument>
</function>
<function name="mxmlSetCDATA">
<returnvalue>
<type>int</type>
<description>0 on success, -1 on failure</description>
</returnvalue>
<description>Set the element name of a CDATA node.
The node is not changed if it is not a CDATA element node.</description>
<argument name="node" direction="I">
<type>mxml_node_t *</type>
<description>Node to set</description>
</argument>
<argument name="data" direction="I">
<type>const char *</type>
<description>New data string</description>
</argument>
</function>
<function name="mxmlSetCustom">
<returnvalue>
<type>int</type>

Loading…
Cancel
Save