...
 
Commits (1)
*.bck
*.bak
Makefile
autom4te*.cache
config.cache
config.h
config.log
config.status
libmxml.a
mxml.list
mxmldoc
testmxml
Mini-XML 1.3 adds support for all of the standard HTML entity
names, entities in element names, attribute names, and attribute
values, null attribute values, and a new error callback for
catching errors instead of displaying them to stderr. The new
release also fixes some bugs with handling of poorly formed XML
data and in the mxmldoc utility.
README - 05/16/2004
-------------------
CHANGES IN Mini-XML 2.0
- New programmers manual.
- Added UTF-16 support (input only; all output is UTF-8)
- Added index functions to build a searchable index of
XML nodes.
- Added character entity callback interface to support
additional character entities beyond those defined in
the XHTML specification.
- Added support for XHTML character entities.
- The mxmldoc utility now produces XML output which
conforms to an updated XML schema, described in the file
"doc/mxmldoc.xsd".
- Changed the whitespace callback interface to return
strings instead of a single character, allowing for
greater control over the formatting of XML files
written using Mini-XML. THIS CHANGE WILL REQUIRE
CHANGES TO YOUR 1.x CODE IF YOU USE WHITESPACE
CALLBACKS.
- The mxmldoc utility is now capable of documenting C++
classes, functions, and structures, and correctly
handles C++ comments.
- Added new modular tests for mxmldoc.
- Updated the mxmldoc output to be more compatible with
embedding in manuals produced with HTMLDOC.
- The makefile incorrectly included a "/" separator
between the destination path and install path. This
caused problems when building and installing with
MingW.
CHANGES IN Mini-XML 1.3
- Fixes for mxmldoc.
- Added support for reading standard HTML entity names.
- mxmlLoadString/File() did not decode character
entities in element names, attribute names, or
attribute values.
- mxmlLoadString/File() would crash when loading non-
conformant XML data under an existing parent (top)
node.
- Fixed several bugs in the mxmldoc utility.
- Added new error callback function to catch a variety
of errors and log them to someplace other than stderr.
- The mxmlElementSetAttr() function now allows for NULL
attribute values.
- The load and save functions now properly handle quoted
element and attribute name strings properly, e.g. for
!DOCTYPE declarations.
CHANGES IN Mini-XML 1.2
- Added new "set" methods to set the value of a node.
- Added new formatted text methods mxmlNewTextf() and
mxmlSetTextf() to create/set a text node value using
printf-style formats.
- Added new standard callbacks for use with the mxmlLoad
functions.
- Updated the HTML documentation to include examples of
the walk and load function output.
- Added --with/without-ansi configure option to control
the strdup() function check.
- Added --with/without-snprintf configure option to
control the snprintf() and vsnprintf() function
checks.
CHANGES IN Mini-XML 1.1.2
- The mxml(3) man page wasn't updated for the string
functions.
- mxmlSaveString() returned the wrong number of
characters.
- mxml_add_char() updated the buffer pointer in the
wrong place.
CHANGES IN Mini-XML 1.1.1
- The private mxml_add_ch() function did not update the
start-of-buffer pointer which could cause a crash when
using mxmlSaveString().
- The private mxml_write_ws() function called putc()
instead of using the proper callback which could cause
a crash when using mxmlSaveString().
- Added a mxmlSaveAllocString() convenience function for
saving an XML node tree to an allocated string.
CHANGES IN Mini-XML 1.1
- The mxmlLoadFile() function now uses dynamically
allocated string buffers for element names, attribute
names, and attribute values. Previously they were
capped at 16383, 255, and 255 bytes, respectively.
- Added a new mxmlLoadString() function for loading an
XML node tree from a string.
- Added a new mxmlSaveString() function for saving an
XML node tree to a string.
- Add emulation of strdup() if the local platform does
not provide the function.
CHANGES IN Mini-XML 1.0
- The mxmldoc program now handles function arguments,
structures, unions, enumerations, classes, and
typedefs properly.
- Documentation provided via mxmldoc and more in-line
comments in the code.
- Added man pages and packaging files.
CHANGES IN Mini-XML 0.93
- New mxmldoc example program that is also used to
create and update code documentation using XML and
produce HTML reference pages.
- Added mxmlAdd() and mxmlRemove() functions to add and
remove nodes from a tree. This provides more
flexibility over where the nodes are inserted and
allows nodes to be moved within the tree as needed.
- mxmlLoadFile() now correctly handles comments.
- mxmlLoadFile() now supports the required "gt", "quot",
and "nbsp" character entities.
- mxmlSaveFile() now uses newlines as whitespace
when valid to do so.
- mxmlFindElement() now also takes attribute name and
attribute value string arguments to limit the search
to specific elements with attributes and/or values.
NULL pointers can be used as "wildcards".
- Added uninstall target to makefile, and auto-reconfig
if Makefile.in or configure.in are changed.
- mxmlFindElement(), mxmlWalkNext(), and mxmlWalkPrev()
now all provide "descend" arguments to control whether
they descend into child nodes in the tree.
- Fixed some whitespace issues in mxmlLoadFile().
- Fixed Unicode output and whitespace issues in
mxmlSaveFile().
- mxmlSaveFile() now supports a whitespace callback to
provide more human-readable XML output under program
control.
CHANGES IN Mini-XML 0.92
- mxmlSaveFile() didn't return a value on success.
CHANGES IN Mini-XML 0.91
- mxmlWalkNext() would go into an infinite loop.
CHANGES IN Mini-XML 0.9
- Initial public release.
This diff is collapsed.
#
# "$Id: Makefile.in,v 1.21 2004/05/16 05:25:38 mike Exp $"
#
# Makefile for Mini-XML, a small XML-like file parsing library.
#
# Copyright 2003-2004 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.
#
#
# Compiler tools definitions...
#
AR = @AR@
ARFLAGS = @ARFLAGS@
CC = @CC@
CFLAGS = $(OPTIM) @CFLAGS@ @CPPFLAGS@
CP = @CP@
LDFLAGS = $(OPTIM) @LDFLAGS@
MKDIR = @MKDIR@
NROFF = @NROFF@
OPTIM = @OPTIM@
RANLIB = @RANLIB@
RM = @RM@ -f
SHELL = /bin/sh
#
# Configured directories...
#
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
includedir = @includedir@
libdir = @libdir@
mandir = @mandir@
docdir = @docdir@
BUILDROOT = $(DSTROOT)
#
# Manpage extensions...
#
CAT1EXT = @CAT1EXT@
CAT3EXT = @CAT3EXT@
MAN1EXT = @MAN1EXT@
MAN3EXT = @MAN3EXT@
#
# Rules...
#
.SUFFIXES: .0 .1 .3 .c .man .o
.c.o:
$(CC) $(CFLAGS) -c $<
.man.0 .man.1 .man.3:
$(RM) $@
$(NROFF) -man $< >$@
#
# Targets...
#
DOCFILES = doc/mxml.html doc/mxml.pdf doc/mxmldoc.xsd \
README COPYING CHANGES
PUBLIBOBJS = mxml-attr.o mxml-entity.o mxml-file.o mxml-index.o \
mxml-node.o mxml-search.o mxml-set.o
LIBOBJS = $(PUBLIBOBJS) mxml-private.o mxml-string.o
OBJS = mxmldoc.o testmxml.o $(LIBOBJS)
TARGETS = libmxml.a mxmldoc doc/mxml.$(CAT3EXT) \
doc/mxmldoc.$(CAT1EXT) testmxml mxml.xml
#
# Make everything...
#
all: Makefile configure config.h $(TARGETS)
#
# Clean everything...
#
clean:
$(RM) $(OBJS) $(TARGETS)
$(RM) *.bck *.bak
$(RM) config.cache config.log config.status
$(RM) -r autom4te*.cache
#
# Install everything...
#
install: $(TARGETS)
-$(MKDIR) -p $(BUILDROOT)$(bindir)
$(CP) mxmldoc $(BUILDROOT)$(bindir)
-$(MKDIR) -p $(BUILDROOT)$(docdir)
$(CP) $(DOCFILES) $(BUILDROOT)$(docdir)
-$(MKDIR) -p $(BUILDROOT)$(includedir)
$(CP) mxml.h $(BUILDROOT)$(includedir)
-$(MKDIR) -p $(BUILDROOT)$(libdir)
$(CP) libmxml.a $(BUILDROOT)$(libdir)
-$(MKDIR) -p $(BUILDROOT)$(libdir)/pkgconfig
$(CP) mxml.pc $(BUILDROOT)$(libdir)/pkgconfig
-$(MKDIR) -p $(BUILDROOT)$(mandir)/cat1
$(CP) doc/mxmldoc.$(CAT1EXT) $(BUILDROOT)$(mandir)/cat1/mxmldoc.$(CAT1EXT)
-$(MKDIR) -p $(BUILDROOT)$(mandir)/cat3
$(CP) doc/mxml.$(CAT3EXT) $(BUILDROOT)$(mandir)/cat3/mxml.$(CAT3EXT)
-$(MKDIR) -p $(BUILDROOT)$(mandir)/man1
$(CP) doc/mxmldoc.man $(BUILDROOT)$(mandir)/man1/mxmldoc.$(MAN1EXT)
-$(MKDIR) -p $(BUILDROOT)$(mandir)/man3
$(CP) doc/mxml.man $(BUILDROOT)$(mandir)/man3/mxml.$(MAN3EXT)
#
# Uninstall everything...
#
uninstall:
$(RM) $(BUILDROOT)$(bindir)/mxmldoc
$(RM) -r $(BUILDROOT)$(docdir)
$(RM) $(BUILDROOT)$(includedir)/mxml.h
$(RM) $(BUILDROOT)$(libdir)/libmxml.a
$(RM) $(BUILDROOT)$(libdir)/pkgconfig/mxml.pc
$(RM) $(BUILDROOT)$(mandir)/cat1/mxmldoc.$(CAT1EXT)
$(RM) $(BUILDROOT)$(mandir)/cat3/mxml.$(CAT3EXT)
$(RM) $(BUILDROOT)$(mandir)/man1/mxmldoc.$(MAN1EXT)
$(RM) $(BUILDROOT)$(mandir)/man3/mxml.$(MAN3EXT)
#
# Make packages using EPM (http://www.easysw.com/epm/)
#
epm: all
epm --output-dir dist -v -f native mxml
epm --output-dir dist -v -f portable mxml
#
# autoconf stuff...
#
Makefile: configure Makefile.in
if test -f config.status; then \
./config.status --recheck; \
./config.status; \
else \
./configure; \
fi
touch config.h
configure: configure.in
autoconf
if test -f config.status; then \
./config.status --recheck; \
./config.status; \
else \
./configure; \
fi
touch config.h
config.h: configure config.h.in
autoconf
if test -f config.status; then \
./config.status --recheck; \
./config.status; \
else \
./configure; \
fi
touch config.h
#
# libmxml.a
#
libmxml.a: $(LIBOBJS)
$(RM) $@
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
$(RANLIB) $@
$(LIBOBJS): mxml.h
#
# mxmldoc
#
mxmldoc: libmxml.a mxmldoc.o
$(CC) $(LDFLAGS) -o $@ mxmldoc.o libmxml.a
mxmldoc.o: mxml.h
#
# testmxml
#
testmxml: libmxml.a testmxml.o
$(CC) $(LDFLAGS) -o $@ testmxml.o libmxml.a
@echo Testing library...
./testmxml test.xml >temp1.xml 2>temp1s.xml
./testmxml temp1.xml >temp2.xml 2>temp2s.xml
@if cmp temp1.xml temp2.xml; then \
echo File test passed!; \
$(RM) temp2.xml temp2s.xml; \
else \
echo File test failed!; \
fi
@if cmp temp1.xml temp1s.xml; then \
echo String test passed!; \
$(RM) temp1.xml temp1s.xml; \
else \
echo String test failed!; \
fi
testmxml.o: mxml.h
#
# mxml.xml
#
mxml.xml: mxmldoc mxml.h $(PUBLIBOBJS:.o=.c)
$(RM) mxml.xml
./mxmldoc mxml.xml mxml.h $(PUBLIBOBJS:.o=.c) >doc/reference.html
valgrind: mxmldoc
$(RM) valgrind.xml
valgrind --leak-check=yes ./mxmldoc valgrind.xml mxml.h \
$(PUBLIBOBJS:.o=.c) >valgrind.html 2>valgrind.out
#
# All object files depend on the makefile...
#
$(OBJS): Makefile config.h
#
# End of "$Id: Makefile.in,v 1.21 2004/05/16 05:25:38 mike Exp $".
#
README - 05/01/2004
-------------------
INTRODUCTION
This README file describes the Mini-XML library version 2.0.
Mini-XML is a small XML parsing library that you can use to
read 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 works, as do
most vendors' ANSI C compilers) and a "make" program.
Mini-XML provides the following functionality:
- Reading and writing of UTF-8 encoded XML files and
strings.
- Data is stored in a linked-list tree structure,
preserving the XML data hierarchy.
- Supports arbitrary element names, attributes, and
attribute values with no preset limits, just available
memory.
- Supports integer, real, opaque ("cdata"), and text
data types in "leaf" nodes.
- Functions for creating and managing trees of data.
- "Find" and "walk" functions for easily locating and
navigating trees of data.
Mini-XML doesn't do validation or other types of processing
on the data based upon schema files or other sources of
definition information, nor does it support character
entities other than those required by the XML
specification. Also, since Mini-XML does not support the
UTF-16 encoding, it is technically not a conforming XML
consumer/client.
BUILDING Mini-XML
Mini-XML comes with an autoconf-based configure script; just
type the following command to get things going:
./configure
The default install prefix is /usr/local, which can be
overridden using the --prefix option:
./configure --prefix=/foo
Other configure options can be found using the --help
option:
./configure --help
Once you have configured the software, type "make" to do the
build and run the test program to verify that things are
working, as follows:
make
INSTALLING Mini-XML
The "install" target will install Mini-XML in the lib and
include directories:
make install
Once you have installed it, use the "-lmxml" option to link
your application against it.
DOCUMENTATION
The documentation is available in the "doc" subdirectory in
the files "mxml.html" (HTML) and "mxml.pdf" (PDF). You can
also look at the "testmxml.c" and "mxmldoc.c" source files
for examples of using Mini-XML.
Mini-XML provides a single header file which you include:
#include <mxml.h>
Nodes are defined by the "mxml_node_t" structure; the "type"
member defines the node type (element, integer, opaque,
real, or text) which determines which value you want to look
at in the "value" union. New nodes can be created using the
"mxmlNewElement()", "mxmlNewInteger()", "mxmlNewOpaque()",
"mxmlNewReal()", and "mxmlNewText()" functions. Only
elements can have child nodes, and the top node must be an
element, usually "?xml".
You load an XML file using the "mxmlLoadFile()" function:
FILE *fp;
mxml_node_t *tree;
fp = fopen("filename.xml", "r");
tree = mxmlLoadFile(NULL, fp, MXML_NO_CALLBACK);
fclose(fp);
Similarly, you save an XML file using the "mxmlSaveFile()"
function:
FILE *fp;
mxml_node_t *tree;
fp = fopen("filename.xml", "w");
mxmlSaveFile(tree, fp, MXML_NO_CALLBACK);
fclose(fp);
The "mxmlLoadString()", "mxmlSaveAllocString()", and
"mxmlSaveString()" functions load XML node trees from and
save XML node trees to strings:
char buffer[8192];
char *ptr;
mxml_node_t *tree;
...
tree = mxmlLoadString(NULL, buffer, MXML_NO_CALLBACK);
...
mxmlSaveString(tree, buffer, sizeof(buffer), MXML_NO_CALLBACK);
...
ptr = mxmlSaveAllocString(tree, MXML_NO_CALLBACK);
You can find a named element/node using the
"mxmlFindElement()" function:
mxml_node_t *node = mxmlFindElement(tree, tree, "name", "attr",
"value", MXML_DESCEND);
The "name", "attr", and "value" arguments can be passed as
NULL to act as wildcards, e.g.:
/* Find the first "a" element */
node = mxmlFindElement(tree, tree, "a", NULL, NULL, MXML_DESCEND);
/* Find the first "a" element with "href" attribute */
node = mxmlFindElement(tree, tree, "a", "href", NULL, MXML_DESCEND);
/* Find the first "a" element with "href" to a URL */
node = mxmlFindElement(tree, tree, "a", "href",
"http://www.easysw.com/~mike/mxml/",
MXML_DESCEND);
/* Find the first element with a "src" attribute*/
node = mxmlFindElement(tree, tree, NULL, "src", NULL, MXML_DESCEND);
/* Find the first element with a "src" = "foo.jpg" */
node = mxmlFindElement(tree, tree, NULL, "src", "foo.jpg",
MXML_DESCEND);
You can also iterate with the same function:
mxml_node_t *node;
for (node = mxmlFindElement(tree, tree, "name", NULL, NULL,
MXML_DESCEND);
node != NULL;
node = mxmlFindElement(node, tree, "name", NULL, NULL,
MXML_DESCEND))
{
... do something ...
}
Finally, once you are done with the XML data, use the
"mxmlDelete()" function to recursively free the memory that
is used for a particular node or the entire tree:
mxmlDelete(tree);
GETTING HELP AND REPORTING PROBLEMS
You can email me at "mxml@easysw.com" to report problems
and/or ask for help. Just don't expect an instant response,
as I get a *lot* of email...
LEGAL STUFF
The Mini-XML library is Copyright 2003-2004 by Michael Sweet.
This library 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 of the License, or (at your option) any
later version.
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 Library General Public License for
more details.
You should have received a copy of the GNU Library General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
02139, USA.
TODO - 05/16/2004
-----------------
- New documentation.
-- Use HTMLDOC to generate
-- Provide more tutorials
-- Release notes
- Add access methods and make node structure opaque.
-- To allow for C++ migration
-- To make future binary compatibility easier
- Add VC++/VC++.NET project files.
-- Include DLL .def file for making a DLL.
- Add C++ class/struct.
-- Make this the core implementation which the C API accesses?
-- Class would allow for subclassing, is that necessary?
- Binary XML support???
/*
* "$Id: config.h.in,v 1.5 2004/05/02 16:04:40 mike Exp $"
*
* Configuration file for Mini-XML, a small XML-like file parsing library.
*
* Copyright 2003-2004 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.
*/
/*
* Include necessary headers...
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <ctype.h>
/*
* Version number...
*/
#define MXML_VERSION ""
/*
* Do we have the snprintf() and vsnprintf() functions?
*/
#undef HAVE_SNPRINTF
#undef HAVE_VSNPRINTF
/*
* Do we have the strXXX() functions?
*/
#undef HAVE_STRDUP
/*
* Define prototypes for string functions as needed...
*/
# ifndef HAVE_STRDUP
extern char *mxml_strdup(const char *);
# define strdup mxml_strdup
# endif /* !HAVE_STRDUP */
extern char *mxml_strdupf(const char *, va_list);
# ifndef HAVE_VSNPRINTF
extern int mxml_vsnprintf(char *, size_t, const char *, va_list);
# define vsnprintf mxml_vsnprintf
# endif /* !HAVE_VSNPRINTF */
/*
* End of "$Id: config.h.in,v 1.5 2004/05/02 16:04:40 mike Exp $".
*/
This diff is collapsed.
dnl
dnl "$Id: configure.in,v 1.11 2004/05/02 22:02:36 mike Exp $"
dnl
dnl Configuration script for Mini-XML, a small XML-like file parsing library.
dnl
dnl Copyright 2003-2004 by Michael Sweet.
dnl
dnl This program is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Library General Public
dnl License as published by the Free Software Foundation; either
dnl version 2, or (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl Specify a source file from the distribution...
AC_INIT(mxml.h)
dnl Set the name of the config header file...
AC_CONFIG_HEADER(config.h)
dnl Version number...
VERSION=2.0rc1
AC_SUBST(VERSION)
AC_DEFINE_UNQUOTED(MXML_VERSION, "Mini-XML v$VERSION")
dnl Clear default debugging options and set normal optimization by
dnl default unless the user asks for debugging specifically.
CFLAGS="${CFLAGS:=}"
CXXFLAGS="${CXXFLAGS:=}"
LDFLAGS="${LDFLAGS:=}"
AC_SUBST(LDFLAGS)
OPTIM="-O"
AC_SUBST(OPTIM)
AC_ARG_WITH(ansi, [ --with-ansi set full ANSI C mode, default=no],
use_ansi="$withval",
use_ansi="no")
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging, default=no],
if eval "test x$enable_debug = xyes"; then
OPTIM="-g"
else
LDFLAGS="$LDFLAGS -s"
fi)
AC_ARG_WITH(docdir, [ --with-docdir set directory for documentation, default=${prefix}/share/doc/mxml],
docdir="$withval",
docdir="NONE")
AC_SUBST(docdir)
AC_ARG_WITH(vsnprintf, [ --with-vsnprintf use vsnprintf emulation functions, default=auto],
use_vsnprintf="$withval",
use_vsnprintf="no")
dnl Get the operating system and version number...
uname=`uname`
uversion=`uname -r | sed -e '1,$s/[[^0-9]]//g'`
if test x$uname = xIRIX64; then
uname="IRIX"
fi
dnl Checks for programs...
AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB
AC_PATH_PROG(AR,ar)
AC_PATH_PROG(CP,cp)
AC_PATH_PROG(MKDIR,mkdir)
AC_PATH_PROG(NROFF,nroff)
if test x$NROFF = x; then
AC_PATH_PROG(GROFF,groff)
if test x$GROFF = x; then
NROFF="echo"
else
NROFF="$GROFF -T ascii"
fi
fi
AC_PATH_PROG(RM,rm)
dnl Flags for "ar" command...
case "$uname" in
Darwin* | *BSD*)
ARFLAGS="-rcv"
;;
*)
ARFLAGS="crvs"
;;
esac
AC_SUBST(ARFLAGS)
dnl Checks for string functions.
if test "x$use_ansi" != xyes; then
AC_CHECK_FUNCS(strdup)
fi
if test "x$use_vsnprintf" != xyes; then
AC_CHECK_FUNCS(vsnprintf)
fi
dnl Add -Wall for GCC...
if test -n "$GCC"; then
CFLAGS="-Wall $CFLAGS"
if test "x$use_ansi" = xyes; then
CFLAGS="-ansi -pedantic $CFLAGS"
fi
fi
dnl Fix "prefix" variable if it hasn't been specified...
if test "$prefix" = "NONE"; then
prefix="/usr/local"
fi
dnl Fix "exec_prefix" variable if it hasn't been specified...
if test "$exec_prefix" = "NONE"; then
exec_prefix="$prefix"
fi
dnl Fix "docdir" variable if it hasn't been specified...
if test "$docdir" = "NONE"; then
docdir="$datadir/doc/mxml"
fi
dnl Fix "mandir" variable if it hasn't been specified...
if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then
case "$uname" in
*BSD* | Darwin* | Linux*)
# BSD, Darwin (MacOS X), and Linux
mandir="/usr/share/man"
;;
IRIX*)
# SGI IRIX
mandir="/usr/share/catman/u_man"
;;
*)
# All others
mandir="/usr/man"
;;
esac
fi
dnl More manpage stuff...
case "$uname" in
*BSD* | Darwin*)
# *BSD
CAT1EXT="0"
MAN1EXT="1"
CAT3EXT="0"
MAN3EXT="3"
;;
*)
# All others
CAT1EXT="1"
MAN1EXT="1"
CAT3EXT="3"
MAN3EXT="3"
;;
esac
AC_SUBST(CAT1EXT)
AC_SUBST(CAT3EXT)
AC_SUBST(MAN1EXT)
AC_SUBST(MAN3EXT)
dnl pkg-config stuff...
if test "$includedir" != /usr/include; then
PC_CFLAGS="-I$includedir"
else
PC_CFLAGS=""
fi
if test "$libdir" != /usr/lib; then
PC_LIBS="-L$libdir -lmxml"
else
PC_LIBS="-lmxml"
fi
AC_SUBST(PC_CFLAGS)
AC_SUBST(PC_LIBS)
dnl Output the makefile, etc...
AC_OUTPUT(Makefile mxml.list mxml.pc)
dnl
dnl End of "$Id: configure.in,v 1.11 2004/05/02 22:02:36 mike Exp $".
dnl
*.bck
*.bak
mxml.0
mxml.3
mxml.d
mxmldoc.0
mxmldoc.1
<html>
<body>
<h1 align='right'><a name='ADVANCED'>3 - More Mini-XML
Programming Techniques</a></h1>
<p>This chapter shows additional ways to use the Mini-XML
library in your programs.</p>
<h2>Load Callbacks</h2>
<h2>Save Callbacks</h2>
<h2>Changing Node Values</h2>
<h2>Formatted Text</h2>
<h2>Indexing</h2>
</body>
</html>
<html>
<body>
<h1 align='right'><a name='BASICS'>2 - Getting Started with
Mini-XML</a></h1>
<p>This chapter describes how to write programs that use
Mini-XML to access data in an XML file.</p>
<h2>The Basics</h2>
<p>Mini-XML provides a single header file which you include:</p>
<pre>
#include &lt;mxml.h&gt;
</pre>
<p>The Mini-XML library is included with your program using the
<kbd>-lmxml</kbd> option:</p>
<pre>
<kbd>gcc -o myprogram myprogram.c -lmxml ENTER</kbd>
</pre>
<p>If you have the <tt>pkg-config(1)</tt> software installed,
you can use it to determine the proper compiler and linker options
for your installation:</p>
<pre>
<kbd>pkg-config --cflags mxml ENTER</kbd>
<kbd>pkg-config --libs mxml ENTER</kbd>
</pre>
<h2>Nodes</h2>
<p>Every piece of information in an XML file (elements, text,
numbers) is stored in memory in "nodes". Nodes are defined by
the <a
href='reference.html#mxml_node_t'><tt>mxml_node_t</tt></a>
structure. The <a
href='reference.html#mxml_type_t'><tt>type</tt></a> member
defines the node type (element, integer, opaque, real, or text)
which determines which value you want to look at in the <a
href='reference.html#mxml_value_t'><tt>value</tt></a> union.</p>
<p>New nodes can be created using the <a
href='reference.html#mxmlNewElement'><tt>mxmlNewElement()</tt></a>,
<a
href='reference.html#mxmlNewInteger'><tt>mxmlNewInteger()</tt></a>,
<a
href='reference.html#mxmlNewOpaque'><tt>mxmlNewOpaque()</tt></a>,
<a href='reference.html#mxmlNewReal'><tt>mxmlNewReal()</tt></a>,
and <a
href='reference.html#mxmlNewText'><tt>mxmlNewText()</tt></a>
functions. Only elements can have child nodes, and the top node
must be an element, usually "?xml".</p>
<p>Each node has pointers for the node above (<tt>parent</tt>),
below (<tt>child</tt>), to the left (<tt>prev</tt>), and to the
right (<tt>next</tt>) of the current node. If you have an XML
file like the following:</p>
<pre>
&lt;?xml version="1.0"?&gt;
&lt;data&gt;
&lt;node&gt;val1&lt;/node&gt;
&lt;node&gt;val2&lt;/node&gt;
&lt;node&gt;val3&lt;/node&gt;
&lt;group&gt;
&lt;node&gt;val4&lt;/node&gt;
&lt;node&gt;val5&lt;/node&gt;
&lt;node&gt;val6&lt;/node&gt;
&lt;/group&gt;
&lt;node&gt;val7&lt;/node&gt;
&lt;node&gt;val8&lt;/node&gt;
&lt;node&gt;val9&lt;/node&gt;
&lt;/data&gt;
</pre>
<p>the node tree returned by <tt>mxmlLoadFile()</tt> would look
like the following in memory:</p>
<pre>
?xml
|
data
|
node - node - node - group - node - node - node
| | | | | | |
val1 val2 val3 | val7 val8 val9
|
node - node - node
| | |
val4 val5 val6
</pre>
<p>where "-" is a pointer to the next node and "|" is a pointer
to the first child node.</p>
<p>Once you are done with the XML data, use the <a
href='reference.html#mxmlDelete'><tt>mxmlDelete()</tt></a>
function to recursively free the memory that is used for a
particular node or the entire tree:</p>
<pre>
mxmlDelete(tree);
</pre>
<h2>Loading and Saving XML Files</h2>
<p>You load an XML file using the <a
href='reference.html#mxmlLoadFile'><tt>mxmlLoadFile()</tt></a>
function:</p>
<pre>
FILE *fp;
<a href='reference.html#mxml_node_t'>mxml_node_t</a> *tree;
fp = fopen("filename.xml", "r");
tree = <a href='reference.html#mxmlLoadFile'>mxmlLoadFile</a>(NULL, fp, MXML_NO_CALLBACK);
fclose(fp);
</pre>
<p>The third argument specifies a callback function which
returns the value type of the immediate children for a new
element node: <tt>MXML_INTEGER</tt>, <tt>MXML_OPAQUE</tt>,
<tt>MXML_REAL</tt>, or <tt>MXML_TEXT</tt>. This function is
called <i>after</i> the element and its attributes have been
read, so you can look at the element name, attributes, and
attribute values to determine the proper value type to return.
The default value type is MXML_TEXT if no callback is used.</p>
<p>Similarly, you save an XML file using the <a
href='reference.html#mxmlSaveFile'><tt>mxmlSaveFile()</tt></a>
function:</p>
<pre>
FILE *fp;
<a href='reference.html#mxml_node_t'>mxml_node_t</a> *tree;
fp = fopen("filename.xml", "w");
<a href='reference.html#mxmlSaveFile'>mxmlSaveFile</a>(tree, fp, MXML_NO_CALLBACK);
fclose(fp);
</pre>
<p>Callback functions for saving are used to optionally insert
whitespace before and after elements in the node tree. Your
function will be called up to four times for each element node
with a pointer to the node and a "where" value of
<tt>MXML_WS_BEFORE_OPEN</tt>, <tt>MXML_WS_AFTER_OPEN</tt>,
<tt>MXML_WS_BEFORE_CLOSE</tt>, or <tt>MXML_WS_AFTER_CLOSE</tt>.
The callback function should return <tt>NULL</tt> if no
whitespace should be added and the string to insert (spaces,
tabs, carriage returns, and newlines) otherwise.</p>
<p>The <a
href='reference.html#mxmlLoadString'><tt>mxmlLoadString()</tt></a>,
<a
href='reference.html#mxmlSaveAllocString'><tt>mxmlSaveAllocString()</tt></a>,
and <a
href='reference.html#mxmlSaveString'><tt>mxmlSaveString()</tt></a>
functions load XML node trees from and save XML node trees to
strings:</p>
<pre>
char buffer[8192];
char *ptr;
<a href='reference.html#mxml_node_t'>mxml_node_t</a> *tree;
...
tree = <a href='reference.html#mxmlLoadString'>mxmlLoadString</a>(NULL, buffer, MXML_NO_CALLBACK);
...
<a href='reference.html#mxmlSaveString'>mxmlSaveString</a>(tree, buffer, sizeof(buffer), MXML_NO_CALLBACK);
...
ptr = <a href='reference.html#mxmlSaveAllocString'>mxmlSaveAllocString</a>(tree, MXML_NO_CALLBACK);
</pre>
<h3>Finding and Iterating Nodes</h3>
<p>The <a
href='reference.html#mxmlWalkPrev'><tt>mxmlWalkPrev()</tt></a>
and <a
href='reference.html#mxmlWalkNext'><tt>mxmlWalkNext()</tt></a>functions
can be used to iterate through the XML node tree:</p>
<pre>
<a href='reference.html#mxml_node_t'>mxml_node_t</a> *node = <a href='reference.html#mxmlWalkPrev'>mxmlWalkPrev</a>(current, tree, MXML_DESCEND);
<a href='reference.html#mxml_node_t'>mxml_node_t</a> *node = <a href='reference.html#mxmlWalkNext'>mxmlWalkNext</a>(current, tree, MXML_DESCEND);
</pre>
<p>In addition, you can find a named element/node using the <a
href='reference.html#mxmlFindElement'><tt>mxmlFindElement()</tt></a>
function:</p>
<pre>
<a href='reference.html#mxml_node_t'>mxml_node_t</a> *node = <a href='reference.html#mxmlFindElement'>mxmlFindElement</a>(tree, tree, "name", "attr",
"value", MXML_DESCEND);
</pre>
<p>The <tt>name</tt>, <tt>attr</tt>, and <tt>value</tt>
arguments can be passed as <tt>NULL</tt> to act as wildcards,
e.g.:</p>
<pre>
/* Find the first "a" element */
node = <a href='reference.html#mxmlFindElement'>mxmlFindElement</a>(tree, tree, "a", NULL, NULL, MXML_DESCEND);
/* Find the first "a" element with "href" attribute */
node = <a href='reference.html#mxmlFindElement'>mxmlFindElement</a>(tree, tree, "a", "href", NULL, MXML_DESCEND);
/* Find the first "a" element with "href" to a URL */
node = <a href='reference.html#mxmlFindElement'>mxmlFindElement</a>(tree, tree, "a", "href",
"http://www.easysw.com/~mike/mxml/", MXML_DESCEND);
/* Find the first element with a "src" attribute*/
node = <a href='reference.html#mxmlFindElement'>mxmlFindElement</a>(tree, tree, NULL, "src", NULL, MXML_DESCEND);
/* Find the first element with a "src" = "foo.jpg" */
node = <a href='reference.html#mxmlFindElement'>mxmlFindElement</a>(tree, tree, NULL, "src", "foo.jpg", MXML_DESCEND);
</pre>
<p>You can also iterate with the same function:</p>
<pre>
<a href='reference.html#mxml_node_t'>mxml_node_t</a> *node;
for (node = <a href='reference.html#mxmlFindElement'>mxmlFindElement</a>(tree, tree, "name", NULL, NULL, MXML_DESCEND);
node != NULL;
node = <a href='reference.html#mxmlFindElement'>mxmlFindElement</a>(node, tree, "name", NULL, NULL, MXML_DESCEND))
{
... do something ...
}
</pre>
<p>The <tt>MXML_DESCEND</tt> argument can actually be one of
three constants:</p>
<ul>
<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.</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.</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:
<pre>
?xml
data
node
val1
node
val2
node
val3
group
node
val4
node
val5
node
val6
node
val7
node
val8
node
val9
</pre>
<p>If you started at "val9" and walked using
<tt>mxmlWalkPrev()</tt>, the order would be reversed,
ending at "?xml".</p></li>
</ul>
</body>
</html>
This diff is collapsed.
<html>
<body>
<h1 align='right'><a name='INSTALL'>1 - Building, Installing,
and Packaging Mini-XML</a></h1>
<p>This chapter describes how to build, install, and package
Mini-XML on your system.</p>
<h2>Compiling Mini-XML</h2>
<p>Mini-XML comes with an autoconf-based configure script; just
type the following command to get things going:</p>
<pre>
<kbd>./configure ENTER</kbd>
</pre>
<p>The default install prefix is <var>/usr/local</var>, which
can be overridden using the <kbd>--prefix</kbd> option:</p>
<pre>
<kbd>./configure --prefix=/foo ENTER</kbd>
</pre>
<p>Other configure options can be found using the
<kbd>--help</kbd> option:</p>
<pre>
<kbd>./configure --help ENTER</kbd>
</pre>
<p>Once you have configured the software, use the
<tt>make(1)</tt> program to do the build and run the test
program to verify that things are working, as follows:</p>
<pre>
<kbd>make ENTER</kbd>
</pre>
<h2>Installing Mini-XML</h2>
<p>Use the <tt>make</tt> command with the <kbd>install</kbd>
target to install Mini-XML in the configured directories:</p>
<pre>
<kbd>make install ENTER</kbd>
</pre>
<h2>Creating Mini-XML Packages</h2>
<p>Mini-XML includes two files that can be used to create binary
packages. The first file is <var>mxml.spec</var> which is used
by the <tt>rpmbuild(8)</tt> software to create Red Hat Package
Manager ("RPM") packages which are commonly used on Linux. Since
<tt>rpmbuild</tt> wants to compile the software on its own, you
can provide it with the Mini-XML tar file to build the
package:</p>
<pre>
<kbd>rpmbuild -ta mxml-<i>version</i>.tar.gz ENTER</kbd>
</pre>
<p>The second file is <var>mxml.list</var> which is used by the
<tt>epm(1)</tt> program to create software packages in a variety
of formats. The <tt>epm</tt> program is available from the
following URL:</p>
<pre>
<a href='http://www.easysw.com/epm/'>http://www.easysw.com/epm/</a>
</pre>
<p>Use the <tt>make</tt> command with the <kbd>epm</kbd> target
to create portable and native packages for your system:</p>
<pre>
<kbd>make epm ENTER</kbd>
</pre>
<p>The packages are stored in a subdirectory named
<var>dist</var> for your convenience. The portable packages
utilize scripts and tar files to install the software on the
target system; this is especially useful when installing on
systems with different Linux distributions. Use the
<var>mxml.install</var> script to install the software and
<var>mxml.remove</var> script to remove the software.</p>
<p>The native packages will be in the local OS's native format:
RPM for Red Hat Linux, DPKG for Debian Linux, PKG for Solaris,
and so forth. Use the corresponding commands to install the
native packages.</p>
</body>
</html>
<html>
<head>
<title>Mini-XML Programmers Manual, Version 2.0</title>
<meta name='copyright' content='Copyright 2003-2004'/>
<meta name='author' content='Michael Sweet'/>
<meta name='keywords' content='XML, C, C++, library'/>
</head>
<body>
<h1 align='right'><a name='INTRO'>Introduction</a></h1>
<p>This programmers manual describes Mini-XML version 2.0, 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 works, as do most vendors' ANSI C
compilers) and a "make" program.</p>
<p>Mini-XML provides the following functionality:</p>
<ul>
<li>Reading of UTF-8 and UTF-16 encoded XML files and
strings.</li>
<li>Writing of UTF-8 encoded XML files and strings.</li>
<li>Data is stored in a linked-list tree structure,
preserving the XML data hierarchy.</li>
<li>Supports arbitrary element names, attributes, and
attribute values with no preset limits, just available
memory.</li>
<li>Supports integer, real, opaque ("cdata"), and text
data types in "leaf" nodes.</li>
<li>Functions for creating and managing trees of
data.</li>
<li>"Find" and "walk" functions for easily locating and
navigating trees of data.</li>
</ul>
<p>Mini-XML doesn't do validation or other types of processing
on the data based upon schema files or other sources of
definition information, nor does it support character entities
other than those required by the XML specification.</p>
<!-- NEED 4in -->
<h2>Legal Stuff</h2>
<p>The Mini-XML library is copyright 2003-2004 by Michael
Sweet.</p>
<p>This library is free software; you can redistribute it and/or
modify it under the terms of the <a
href='license.html#LICENSE'>GNU Library General Public
License</a> as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later
version.</p>
<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 Library General Public License for
more details.</p>
<!-- NEED 4in -->
<h2>History</h2>
<p>Mini-XML was initially developed for the <a
href='http://gimp-print.sf.net/'>Gimp-Print</a> project to
replace the rather large and unwieldy <tt>libxml2</tt> library
with something substantially smaller and easier-to-use. It all
began one morning in June of 2003 when Robert posted the
following sentence to the developer's list:</p>
<blockquote>It's bad enough that we require libxml2, but rolling
our own XML parser is a bit more than we can
handle.</blockquote>
<p>I then replied with:</p>
<blockquote>Given the limited scope of what you use in XML, it
should be trivial to code a mini-XML API in a few hundred lines
of code.</blockquote>
<p>I took my own challenge and coded furiously for two days to
produced the initial public release of Mini-XML, total lines of
code: 696. Robert promptly integrated Mini-XML into Gimp-Print
and removed libxml2.</p>
<p>Thanks to lots of feedback and support from various
developers, Mini-XML has evolved since then to provide a more
complete XML implementation and now stands at a whopping 2,240
lines of code, compared to 96,335 lines of code for libxml2
version 2.6.9. Aside from Gimp-Print, Mini-XML is used for the
following projects/software applications:</p>
<ul>
<li><a href='http://www.cups.org/'>Common UNIX Printing
System</a></li>
<li><a href='http://www.cups.org/ddk.php'>CUPS Driver
Development Kit</a></li>
<li><a href='http://www.easysw.com/printpro/'>ESP Print
Pro</a></li>
<li><a
href='http://zynaddsubfx.sourceforge.net'>ZynAddSubFX</a></li>
</ul>
<p>Please email me (mxml @ easysw . com) if you would like your
project added or removed from this list, or if you have any
comments/quotes you would like me to publish about your
experiences with Mini-XML.</p>
<!-- NEED 3in -->
<h2>Organization of This Document</h2>
<p>This manual is organized into the following chapters and
appendices:</p>
<ul>
<li>Chapter 1, "<a href='install.html#INSTALL'>Building,
Installing, and Packaging Mini-XML</a>", provides
compilation, installation, and packaging instructions for
Mini-XML.</li>
<li>Chapter 2, "<a href='basics.html#BASICS'>Getting
Started with Mini-XML</a>", shows how to use the
Mini-XML library in your programs.</li>
<li>Chapter 3, "<a href='advanced.html#ADVANCED'>More
Mini-XML Programming Techniques</a>", shows additional
ways to use the Mini-XML library.</li>
<li>Chapter 4, "<a href='mxmldoc.html#MXMLDOC'>Using the
mxmldoc Utility</a>", describes how to use the
<tt>mxmldoc(1)</tt> program to generate software
documentation.</li>
<li>Appendix A, "<a href='license.html#LICENSE'>GNU
Library General Public License</a>", provides the terms
and conditions for using and distributing Mini-XML.</li>
<li>Appendix B, "<a
href='relnotes.html#RELNOTES'>Release Notes</a>", lists
the changes in each release of Mini-XML.</li>
<li>Appendix C, "<a href='refapp.html#REFERENCE'>Library
Reference</a>", contains a complete reference for
Mini-XML, generated by <tt>mxmldoc</tt>.</li>
</ul>
<!-- NEED 4in -->
<h2>Notation Conventions</h2>
<p>Various font and syntax conventions are used in this guide.
Examples and their meanings and uses are explained below:</p>
<center><table width='80%'>
<tr>
<th>Example</th>
<td>&nbsp;&nbsp;&nbsp;</td>
<th>Description</th>
</tr>
<tr><td colspan='3'>&nbsp;</td></tr>
<tr valign='top'>
<td><code>lpstat</code><br />
<code>lpstat(1)</code></td>
<td>&nbsp;&nbsp;&nbsp;</td>
<td>The names of commands; the first mention of a command or
function in a chapter is followed by a manual page section
number.</td>
</tr>
<tr><td colspan='3'>&nbsp;</td></tr>
<tr valign='top'>
<td><var>/var</var><br />
<var>/usr/share/cups/data/testprint.ps</var></td>
<td>&nbsp;&nbsp;&nbsp;</td>
<td>File and directory names.</td>
</tr>
<tr><td colspan='3'>&nbsp;</td></tr>
<tr valign='top'>
<td nowrap><tt>Request ID is Printer-123</tt></td>
<td>&nbsp;&nbsp;&nbsp;</td>
<td>Screen output.</td>
</tr>
<tr><td colspan='3'>&nbsp;</td></tr>
<tr valign='top'>
<td nowrap><kbd>lp -d printer filename ENTER</kbd></td>
<td>&nbsp;&nbsp;&nbsp;</td>
<td>Literal user input; special keys like <kbd>ENTER</kbd> are
in ALL CAPS.</td>
</tr>
<tr><td colspan='3'>&nbsp;</td></tr>
<tr valign='top'>
<td>12.3</td>
<td>&nbsp;&nbsp;&nbsp;</td>
<td>Numbers in the text are written using the period (.) to indicate
the decimal point.</td>
</tr>
</table></center>
<!-- NEED 4in -->
<h2>Abbreviations</h2>
<p>The following abbreviations are used throughout this
manual:</p>
<blockquote>
<dl>
<dt>Gb</dt>
<dd>Gigabytes, or 1073741824 bytes<br />&nbsp;</dd>
<dt>kb</dt>
<dd>Kilobytes, or 1024 bytes<br />&nbsp;</dd>
<dt>Mb</dt>
<dd>Megabytes, or 1048576 bytes<br />&nbsp;</dd>
<dt>UTF-8, UTF-16</dt>
<dd>Unicode Transformation Format, 8-bit or 16-bit<br />&nbsp;</dd>
<dt>W3C</dt>
<dd>World Wide Web Consortium<br />&nbsp;</dd>
<dt>XML</dt>
<dd>Extensible Markup Language<br />&nbsp;</dd>
</dl>
</blockquote>
<h2>Other References</h2>
<blockquote>
<dl>
<dt>The Unicode Standard, Version 4.0, Addison-Wesley,
ISBN 0-321-18578-1</dt>
<dd>The definition of the Unicode character set which is
used for XML.<br />&nbsp;</dd>
<dt><a
href='http://www.w3.org/TR/2004/REC-xml-20040204/'>Extensible
Markup Language (XML) 1.0 (Third Edition)</a></dt>
<dd>The XML specification from the World Wide Web
Consortium (W3C)<br />&nbsp;</dd>
</dl>
</blockquote>
</body>
</html>
This diff is collapsed.
#!/bin/sh
#
# "$Id: makedocs.sh,v 1.1 2004/05/03 03:21:16 mike Exp $"
#
# Script to make documentation...
#
# Copyright 2003-2004 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.
#
htmldoc --verbose --batch mxml.book -f mxml.pdf
htmldoc --verbose --batch mxml.book -f mxml.html
rm -rf mxml.d
mkdir mxml.d
htmldoc --verbose --batch mxml.book -t htmlsep -d mxml.d
#
# End of "$Id: makedocs.sh,v 1.1 2004/05/03 03:21:16 mike Exp $".
#
#HTMLDOC 1.8.24b12
-t pdf12 -f mxml.pdf --book --toclevels 3 --no-numbered --toctitle "Table of Contents" --title --linkstyle underline --size Universal --left 1.00in --right 0.50in --top 0.50in --bottom 0.50in --header .t. --footer h.1 --nup 1 --tocheader .t. --tocfooter ..i --duplex --portrait --color --no-pscommands --no-xrxcomments --compression=9 --jpeg=0 --fontsize 11.0 --fontspacing 1.2 --headingfont Helvetica --bodyfont Times --headfootsize 11.0 --headfootfont Helvetica --charset iso-8859-1 --links --embedfonts --pagemode outline --pagelayout single --firstpage c1 --pageeffect none --pageduration 10 --effectduration 1.0 --no-encryption --permissions all --owner-password "" --user-password "" --browserwidth 680
intro.html
install.html
basics.html
advanced.html
mxmldoc.html
license.html
relnotes.html
refapp.html
This diff is collapsed.
.\"
.\" "$Id: mxml.man,v 1.1 2004/05/01 23:41:51 mike Exp $"
.\"
.\" mxml man page for mini-XML, a small XML-like file parsing library.
.\"
.\" Copyright 2003-2004 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" "1 May 2004" "Michael Sweet"
.SH NAME
mxml \- mini-xml library
.SH INCLUDE FILE
#include <mxml.h>
.SH LIBRARY
-lmxml
.SH DESCRIPTION
Mini-XML is a small XML parsing library that you can use to
read 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 works, as do
most vendors' ANSI C compilers) and a "make" program.
.PP
Mini-XML provides the following functionality:
.IP \(bu 4
Reading and writing of UTF-8 encoded XML files.
.IP \(bu 4
Reading and writing of UTF-8 encoded XML strings.
.IP \(bu 4
Data is stored in a linked-list tree structure,
preserving the XML data hierarchy.
.IP \(bu 4
Supports arbitrary element names, attributes, and attribute
values with no preset limits, just available memory.
.IP \(bu 4
Supports integer, real, opaque ("cdata"), and text data types in
"leaf" nodes.
.IP \(bu 4
Functions for creating and managing trees of data.
.IP \(bu 4
"Find" and "walk" functions for easily locating and navigating
trees of data.
.PP
Mini-XML doesn't do validation or other types of processing
on the data based upon schema files or other sources of
definition information, nor does it support character
entities other than those required by the XML
specification. Also, since Mini-XML does not support the
UTF-16 encoding, it is technically not a conforming XML
consumer/client.
.SH USING MINI-XML
Mini-XML provides a single header file which you include:
.nf
#include <mxml.h>
.fi
.PP
Nodes are defined by the "mxml_node_t" structure; the "type"
member defines the node type (element, integer, opaque,
real, or text) which determines which value you want to look
at in the "value" union. New nodes can be created using the
"mxmlNewElement()", "mxmlNewInteger()", "mxmlNewOpaque()",
"mxmlNewReal()", and "mxmlNewText()" functions. Only
elements can have child nodes, and the top node must be an
element, usually "?xml".
.PP
You load an XML file using the "mxmlLoadFile()" function:
.nf
FILE *fp;
mxml_node_t *tree;
fp = fopen("filename.xml", "r");
tree = mxmlLoadFile(NULL, fp, MXML_NO_CALLBACK);
fclose(fp);
.fi
.PP
Similarly, you save an XML file using the "mxmlSaveFile()"
function:
.nf
FILE *fp;
mxml_node_t *tree;
fp = fopen("filename.xml", "w");
mxmlSaveFile(tree, fp, MXML_NO_CALLBACK);