Compare commits

...

10 Commits

Author SHA1 Message Date
Dmitry Ilyin
72638a2887
Merge 7d3223e14b into 8ba0e97ec2 2024-11-19 10:08:54 +05:30
Michael R Sweet
8ba0e97ec2
Do some cleanup and fix NuGet packages. 2024-11-18 09:48:30 -05:00
Michael R Sweet
880a461160 Add linux makefiles (Issue #335) 2024-11-18 09:29:28 -05:00
Michael R Sweet
61eddf1b62
Update docos (Issue #334) 2024-11-17 17:15:44 -05:00
Michael R Sweet
818c8a729f
Drop long long config tests (Issue #335) 2024-11-17 16:05:19 -05:00
Michael R Sweet
5e35d50f75
Fix compiler warnings (Issue #333) 2024-11-14 15:26:29 -05:00
Dmitry Ilyin
7d3223e14b Make config.h generatable for CMake 2021-02-27 14:01:38 +03:00
Dmitry Ilyin
dd246ab5f0 Move CMake stuff to separate directory 2021-02-27 13:10:39 +03:00
Dmitry Ilyin
bc02a80705 Fix paths 2021-02-27 12:51:28 +03:00
Dmitry Ilyin
e11139a18c Add CMakeLists.txt stuff 2021-02-27 12:40:49 +03:00
23 changed files with 933 additions and 506 deletions

View File

@ -5,8 +5,12 @@ Changes in Mini-XML
Changes in Mini-XML 4.0.4
-------------------------
- Added Linux-specific build files and dropped unused `long long` config tests
(Issue #335)
- Fixed an issue when reporting errors with a `NULL` options pointer
(Issue #329)
- Fixed some compiler warnings (Issue #333)
- Fixed some documentation issues (Issue #334)
Changes in Mini-XML 4.0.3

67
CMakeLists.txt Normal file
View File

@ -0,0 +1,67 @@
cmake_minimum_required(VERSION 3.8)
set(VERSION 3.2)
project(
mxml
VERSION ${VERSION}
LANGUAGES C)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
include(CheckTypeSize)
check_type_size("long long" HAVE_LONG_LONG)
include(CheckFunctionExists)
check_function_exists(snprintf HAVE_SNPRINTF)
check_function_exists(vasprintf HAVE_VASPRINTF)
check_function_exists(vsnprintf HAVE_VSNPRINTF)
check_function_exists(strdup HAVE_STRDUP)
check_function_exists(strlcat HAVE_STRLCAT)
check_function_exists(strlcpy HAVE_STRLCPY)
set(MXML_VERSION "Mini-XML v${VERSION}")
configure_file(cmake/config.h.in config.h)
set(HEADERS mxml-private.h ${CMAKE_CURRENT_BINARY_DIR}/config.h)
set(SOURCES
mxml-attr.c
mxml-entity.c
mxml-file.c
mxml-get.c
mxml-index.c
mxml-node.c
mxml-private.c
mxml-search.c
mxml-set.c
mxml-string.c)
add_library(${PROJECT_NAME} ${SOURCES} ${HEADERS})
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
add_library(MSweet::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
# install library
install(
TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}Targets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES
DESTINATION include)
install(
EXPORT ${PROJECT_NAME}Targets
DESTINATION lib/cmake/${PROJECT_NAME}
FILE ${PROJECT_NAME}Targets.cmake
NAMESPACE MSweet::)
install(FILES mxml.h DESTINATION include)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(${PROJECT_NAME}ConfigVersion.cmake
COMPATIBILITY SameMajorVersion)
install(FILES cmake/${PROJECT_NAME}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
DESTINATION lib/cmake/${PROJECT_NAME})

View File

@ -179,8 +179,8 @@ clean:
$(RM) mxml4.lib
$(RM) libmxml4.a
$(RM) libmxml4.so
$(RM) libmxml4.so.1
$(RM) libmxml4.1.dylib
$(RM) libmxml4.so.2
$(RM) libmxml4.2.dylib
$(RM) libmxml4.dylib
@ -415,13 +415,18 @@ testmxml-vg: $(LIBOBJS) testmxml.o
testmxml.o: mxml.h
#
# Fuzz-test the library <>
#
.PHONY: afl
afl:
$(MAKE) -$(MAKEFLAGS) CC="afl-clang-fast" COMMONFLAGS="-g" clean all
test afl-output || rm -rf afl-output
afl-fuzz -x xml.dict -i afl-input -o afl-output -V 600 -e xml -t 5000 ./testmxml @@ temps.xml
#
# Analyze code with the Clang static analyzer <https://clang-analyzer.llvm.org>
#

74
cmake/config.h.in Normal file
View File

@ -0,0 +1,74 @@
/*
* Xcode configuration file for Mini-XML, a small XML file parsing library.
*
* https://www.msweet.org/mxml
*
* Copyright © 2003-2020 by Michael R Sweet.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
* information.
*/
/*
* Include necessary headers...
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <ctype.h>
/*
* Version number...
*/
#cmakedefine MXML_VERSION "@MXML_VERSION@"
/*
* Inline function support...
*/
#define inline
/*
* Long long support...
*/
#cmakedefine HAVE_LONG_LONG 1
/*
* Do we have the *printf() functions?
*/
#cmakedefine HAVE_SNPRINTF 1
#cmakedefine HAVE_VASPRINTF 1
#cmakedefine HAVE_VSNPRINTF 1
/*
* Do we have the strXXX() functions?
*/
#cmakedefine HAVE_STRDUP 1
#cmakedefine HAVE_STRLCAT 1
#cmakedefine HAVE_STRLCPY 1
/*
* Do we have threading support?
*/
#define HAVE_PTHREAD_H 1
/*
* Define prototypes for string functions as needed...
*/
extern char *_mxml_strdupf(const char *, ...);
extern char *_mxml_vstrdupf(const char *, va_list);

2
cmake/mxmlConfig.cmake Normal file
View File

@ -0,0 +1,2 @@
include(CMakeFindDependencyMacro)
include("${CMAKE_CURRENT_LIST_DIR}/mxmlTargets.cmake")

View File

@ -32,13 +32,6 @@
# define inline
//
// Long long support
//
# undef HAVE_LONG_LONG_INT
//
// Have <pthread.h>?
//

237
configure vendored
View File

@ -1522,6 +1522,39 @@ fi
} # ac_fn_c_try_compile
# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
# -------------------------------------------------------
# Tests whether HEADER exists and can be compiled using the include files in
# INCLUDES, setting the cache variable VAR accordingly.
ac_fn_c_check_header_compile ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
printf %s "checking for $2... " >&6; }
if eval test \${$3+y}
then :
printf %s "(cached) " >&6
else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
#include <$2>
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
eval "$3=yes"
else $as_nop
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
eval ac_res=\$$3
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
printf "%s\n" "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_compile
# ac_fn_c_try_link LINENO
# -----------------------
# Try to link conftest.$ac_ext, and return whether this succeeded.
@ -1568,82 +1601,6 @@ fi
as_fn_set_status $ac_retval
} # ac_fn_c_try_link
# ac_fn_c_try_run LINENO
# ----------------------
# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that
# executables *can* be run.
ac_fn_c_try_run ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
printf "%s\n" "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
{ { case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
printf "%s\n" "$ac_try_echo"; } >&5
(eval "$ac_try") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }
then :
ac_retval=0
else $as_nop
printf "%s\n" "$as_me: program exited with status $ac_status" >&5
printf "%s\n" "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=$ac_status
fi
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_run
# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
# -------------------------------------------------------
# Tests whether HEADER exists and can be compiled using the include files in
# INCLUDES, setting the cache variable VAR accordingly.
ac_fn_c_check_header_compile ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
printf %s "checking for $2... " >&6; }
if eval test \${$3+y}
then :
printf %s "(cached) " >&6
else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
#include <$2>
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
eval "$3=yes"
else $as_nop
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
eval ac_res=\$$3
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
printf "%s\n" "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_compile
ac_configure_args_raw=
for ac_arg
do
@ -4057,134 +4014,6 @@ esac
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for unsigned long long int" >&5
printf %s "checking for unsigned long long int... " >&6; }
if test ${ac_cv_type_unsigned_long_long_int+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_cv_type_unsigned_long_long_int=yes
case $ac_prog_cc_stdc in
no | c89) ;;
*)
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* For now, do not test the preprocessor; as of 2007 there are too many
implementations with broken preprocessors. Perhaps this can
be revisited in 2012. In the meantime, code should not expect
#if to work with literals wider than 32 bits. */
/* Test literals. */
long long int ll = 9223372036854775807ll;
long long int nll = -9223372036854775807LL;
unsigned long long int ull = 18446744073709551615ULL;
/* Test constant expressions. */
typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
? 1 : -1)];
typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
? 1 : -1)];
int i = 63;
int
main (void)
{
/* Test availability of runtime routines for shift and division. */
long long int llmax = 9223372036854775807ll;
unsigned long long int ullmax = 18446744073709551615ull;
return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
| (llmax / ll) | (llmax % ll)
| (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
| (ullmax / ull) | (ullmax % ull));
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
else $as_nop
ac_cv_type_unsigned_long_long_int=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_unsigned_long_long_int" >&5
printf "%s\n" "$ac_cv_type_unsigned_long_long_int" >&6; }
if test $ac_cv_type_unsigned_long_long_int = yes; then
printf "%s\n" "#define HAVE_UNSIGNED_LONG_LONG_INT 1" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for long long int" >&5
printf %s "checking for long long int... " >&6; }
if test ${ac_cv_type_long_long_int+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_cv_type_long_long_int=yes
case $ac_prog_cc_stdc in
no | c89) ;;
*)
ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int
if test $ac_cv_type_long_long_int = yes; then
if test "$cross_compiling" = yes
then :
:
else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <limits.h>
#ifndef LLONG_MAX
# define HALF \
(1LL << (sizeof (long long int) * CHAR_BIT - 2))
# define LLONG_MAX (HALF - 1 + HALF)
#endif
int
main (void)
{
long long int n = 1;
int i;
for (i = 0; ; i++)
{
long long int m = n << i;
if (m >> i != n)
return 1;
if (LLONG_MAX / 2 < m)
break;
}
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"
then :
else $as_nop
ac_cv_type_long_long_int=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_long_int" >&5
printf "%s\n" "$ac_cv_type_long_long_int" >&6; }
if test $ac_cv_type_long_long_int = yes; then
printf "%s\n" "#define HAVE_LONG_LONG_INT 1" >>confdefs.h
fi
# Check whether --enable-threads was given.
if test ${enable_threads+y}
then :

View File

@ -104,10 +104,6 @@ dnl Inline functions...
AC_C_INLINE
dnl Check for "long long" support...
AC_TYPE_LONG_LONG_INT
dnl Threading support
AC_ARG_ENABLE([threads], AS_HELP_STRING([--disable-threads], [disable multi-threading support, default=no]))

View File

@ -1,4 +1,4 @@
.TH mxml 3 "Mini-XML API" "2024-03-20" "Mini-XML API"
.TH mxml 3 "Mini-XML API" "2024-11-17" "Mini-XML API"
.SH NAME
mxml \- Mini-XML API
.SH INCLUDE FILE
@ -852,10 +852,9 @@ mxml_node_t * mxmlNewCDATA (
.fi
.PP
The new CDATA node is added to the end of the specified parent's child
list. The constant \fBMXML_NO_PARENT\fR 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 currently use the
\fBMXML_TYPE_ELEMENT\fR type.
list. The constant \fBNULL\fR 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.
.SS mxmlNewCDATAf
Create a new formatted CDATA node.
.PP
@ -867,10 +866,10 @@ mxml_node_t * mxmlNewCDATAf (
);
.fi
.PP
The new CDATA node is added to the end of the specified parent's
child list. The constant \fBMXML_NO_PARENT\fR can be used to specify that
the new opaque string node has no parent. The format string must be
nul-terminated and is formatted into the new node.
The new CDATA node is added to the end of the specified parent's child list.
The constant \fBNULL\fR can be used to specify that the new opaque string node
has no parent. The format string must be nul-terminated and is formatted
into the new node.
.SS mxmlNewComment
Create a new comment node.
.PP
@ -882,9 +881,9 @@ mxml_node_t * mxmlNewComment (
.fi
.PP
The new comment node is added to the end of the specified parent's child
list. The constant \fBMXML_NO_PARENT\fR can be used to specify that the new
comment node has no parent. The comment string must be nul-terminated and
is copied into the new node.
list. The constant \fBNULL\fR can be used to specify that the new comment node
has no parent. The comment string must be nul-terminated and is copied into
the new node.
.SS mxmlNewCommentf
Create a new formatted comment string node.
.PP
@ -897,9 +896,9 @@ mxml_node_t * mxmlNewCommentf (
.fi
.PP
The new comment string node is added to the end of the specified parent's
child list. The constant \fBMXML_NO_PARENT\fR can be used to specify that
the new opaque string node has no parent. The format string must be
nul-terminated and is formatted into the new node.
child list. The constant \fBNULL\fR can be used to specify that the new opaque
string node has no parent. The format string must be nul-terminated and is
formatted into the new node.
.SS mxmlNewCustom
Create a new custom data node.
.PP
@ -926,7 +925,7 @@ mxml_node_t * mxmlNewDeclaration (
.fi
.PP
The new declaration node is added to the end of the specified parent's child
list. The constant \fBMXML_NO_PARENT\fR can be used to specify that the new
list. The constant \fBNULL\fR can be used to specify that the new
declaration node has no parent. The declaration string must be nul-
terminated and is copied into the new node.
.SS mxmlNewDeclarationf
@ -941,7 +940,7 @@ mxml_node_t * mxmlNewDeclarationf (
.fi
.PP
The new declaration node is added to the end of the specified parent's
child list. The constant \fBMXML_NO_PARENT\fR can be used to specify that
child list. The constant \fBNULL\fR can be used to specify that
the new opaque string node has no parent. The format string must be
nul-terminated and is formatted into the new node.
.SS mxmlNewDirective
@ -955,9 +954,9 @@ mxml_node_t * mxmlNewDirective (
.fi
.PP
The new processing instruction node is added to the end of the specified
parent's child list. The constant \fBMXML_NO_PARENT\fR can be used to specify
that the new processing instruction node has no parent. The data string must
be nul-terminated and is copied into the new node.
parent's child list. The constant \fBNULL\fR can be used to specify that the new
processing instruction node has no parent. The data string must be
nul-terminated and is copied into the new node.
.SS mxmlNewDirectivef
Create a new formatted processing instruction node.
.PP
@ -969,9 +968,9 @@ mxml_node_t * mxmlNewDirectivef (
);
.fi
.PP
The new processing instruction node is added to the end of the specified parent's
child list. The constant \fBMXML_NO_PARENT\fR can be used to specify that
the new opaque string node has no parent. The format string must be
The new processing instruction node is added to the end of the specified
parent's child list. The constant \fBNULL\fR can be used to specify that the new
opaque string node has no parent. The format string must be
nul-terminated and is formatted into the new node.
.SS mxmlNewElement
Create a new element node.
@ -984,8 +983,8 @@ mxml_node_t * mxmlNewElement (
.fi
.PP
The new element node is added to the end of the specified parent's child
list. The constant \fBMXML_NO_PARENT\fR can be used to specify that the new
element node has no parent.
list. The constant \fBNULL\fR can be used to specify that the new element node
has no parent.
.SS mxmlNewInteger
Create a new integer node.
.PP
@ -997,8 +996,8 @@ mxml_node_t * mxmlNewInteger (
.fi
.PP
The new integer node is added to the end of the specified parent's child
list. The constant \fBMXML_NO_PARENT\fR can be used to specify that the new
integer node has no parent.
list. The constant \fBNULL\fR can be used to specify that the new integer node
has no parent.
.SS mxmlNewOpaque
Create a new opaque string.
.PP
@ -1010,9 +1009,9 @@ mxml_node_t * mxmlNewOpaque (
.fi
.PP
The new opaque string node is added to the end of the specified parent's
child list. The constant \fBMXML_NO_PARENT\fR can be used to specify that
the new opaque string node has no parent. The opaque string must be nul-
terminated and is copied into the new node.
child list. The constant \fBNULL\fR can be used to specify that the new opaque
string node has no parent. The opaque string must be nul-terminated and is
copied into the new node.
.SS mxmlNewOpaquef
Create a new formatted opaque string node.
.PP
@ -1025,9 +1024,9 @@ mxml_node_t * mxmlNewOpaquef (
.fi
.PP
The new opaque string node is added to the end of the specified parent's
child list. The constant \fBMXML_NO_PARENT\fR can be used to specify that
the new opaque string node has no parent. The format string must be
nul-terminated and is formatted into the new node.
child list. The constant \fBNULL\fR can be used to specify that the new opaque
string node has no parent. The format string must be nul-terminated and is
formatted into the new node.
.SS mxmlNewReal
Create a new real number node.
.PP
@ -1039,8 +1038,8 @@ mxml_node_t * mxmlNewReal (
.fi
.PP
The new real number node is added to the end of the specified parent's
child list. The constant \fBMXML_NO_PARENT\fR can be used to specify that
the new real number node has no parent.
child list. The constant \fBNULL\fR can be used to specify that the new real
number node has no parent.
.SS mxmlNewText
Create a new text fragment node.
.PP
@ -1053,10 +1052,10 @@ mxml_node_t * mxmlNewText (
.fi
.PP
The new text node is added to the end of the specified parent's child
list. The constant \fBMXML_NO_PARENT\fR can be used to specify that the new
text node has no parent. The whitespace parameter is used to specify
whether leading whitespace is present before the node. The text
string must be nul-terminated and is copied into the new node.
list. The constant \fBNULL\fR can be used to specify that the new text node has
no parent. The whitespace parameter is used to specify whether leading
whitespace is present before the node. The text string must be
nul-terminated and is copied into the new node.
.SS mxmlNewTextf
Create a new formatted text fragment node.
.PP
@ -1070,10 +1069,10 @@ mxml_node_t * mxmlNewTextf (
.fi
.PP
The new text node is added to the end of the specified parent's child
list. The constant \fBMXML_NO_PARENT\fR can be used to specify that the new
text node has no parent. The whitespace parameter is used to specify
whether leading whitespace is present before the node. The format
string must be nul-terminated and is formatted into the new node.
list. The constant \fBNULL\fR can be used to specify that the new text node has
no parent. The whitespace parameter is used to specify whether leading
whitespace is present before the node. The format string must be
nul-terminated and is formatted into the new node.
.SS mxmlNewXML
Create a new XML document tree.
.PP

Binary file not shown.

View File

@ -191,13 +191,13 @@ span.comment {
color: darkgreen;
}
span.directive {
color: purple;
color: red;
}
span.number {
color: brown;
}
span.reserved {
color: darkcyan;
color: blue;
}
span.string {
color: magenta;
@ -472,19 +472,19 @@ span.string {
<h3 class="title" id="api-basics">API Basics</h3>
<p>Every piece of information in an XML file is stored in memory in &quot;nodes&quot;. Nodes are represented by <code>mxml_node_t</code> pointers. Each node has an associated type, value(s), a parent node, sibling nodes (previous and next), potentially first and last child nodes, and an optional user data pointer.</p>
<p>For example, if you have an XML file like the following:</p>
<pre><code class="language-xml">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&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;/data&gt;
<pre><code class="language-xml"><span class="directive">&lt;?xml version=</span><span class="string">&quot;1.0&quot;</span><span class="directive"> encoding=</span><span class="string">&quot;utf-8&quot;</span><span class="directive">?&gt;</span>
<span class="reserved">&lt;data&gt;</span>
<span class="reserved">&lt;node&gt;</span>val1<span class="reserved">&lt;/node&gt;</span>
<span class="reserved">&lt;node&gt;</span>val2<span class="reserved">&lt;/node&gt;</span>
<span class="reserved">&lt;node&gt;</span>val3<span class="reserved">&lt;/node&gt;</span>
<span class="reserved">&lt;group&gt;</span>
<span class="reserved">&lt;node&gt;</span>val4<span class="reserved">&lt;/node&gt;</span>
<span class="reserved">&lt;node&gt;</span>val5<span class="reserved">&lt;/node&gt;</span>
<span class="reserved">&lt;node&gt;</span>val6<span class="reserved">&lt;/node&gt;</span>
<span class="reserved">&lt;/group&gt;</span>
<span class="reserved">&lt;node&gt;</span>val7<span class="reserved">&lt;/node&gt;</span>
<span class="reserved">&lt;node&gt;</span>val8<span class="reserved">&lt;/node&gt;</span>
<span class="reserved">&lt;/data&gt;</span>
</code></pre>
<p>the node tree for the file would look like the following in memory:</p>
<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
@ -562,7 +562,7 @@ xml = mxmlLoadFilename(<span class="comment">/*top*/</span>NULL, <span class="co
<pre><code class="language-c">mxmlOptionsSetTypeValue(options, MXML_TYPE_OPAQUE);
</code></pre>
<p>For more complex XML documents, you can specify a callback that returns the type of value for a given element node using the <a href="#mxmlOptionsSetTypeCallback">mxmlOptionsSetTypeCallback</a> function. For example, to specify a callback function called <code>my_type_cb</code> that has no callback data:</p>
<pre><code class="language-c">mxmlOptionsSetTypeValue(options, my_type_cb, <span class="comment">/*cbdata*/</span>NULL);
<pre><code class="language-c">mxmlOptionsSetTypeCallback(options, my_type_cb, <span class="comment">/*cbdata*/</span>NULL);
</code></pre>
<p>The <code>my_type_cb</code> function accepts the callback data pointer (<code>NULL</code> in this case) and the <code>mxml_node_t</code> pointer for the current element and returns a <code>mxml_type_t</code> enumeration value specifying the value type for child nodes. For example, the following function looks at the &quot;type&quot; attribute and the element name to determine the value types of the node's children:</p>
<pre><code class="language-c">mxml_type_t
@ -1445,7 +1445,7 @@ free_all_strings(&amp;pool);
<h3 class="function"><a id="mxmlAdd">mxmlAdd</a></h3>
<p class="description">Add a node to a tree.</p>
<p class="code">
void mxmlAdd(<a href="#mxml_node_t">mxml_node_t</a> *parent, <a href="#mxml_add_t">mxml_add_t</a> add, <a href="#mxml_node_t">mxml_node_t</a> *child, <a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<span class="reserved">void</span> mxmlAdd(<a href="#mxml_node_t">mxml_node_t</a> *parent, <a href="#mxml_add_t">mxml_add_t</a> add, <a href="#mxml_node_t">mxml_node_t</a> *child, <a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>parent</th>
@ -1466,7 +1466,7 @@ is <code>NULL</code>, the new node is placed at the beginning of the child list
<h3 class="function"><a id="mxmlDelete">mxmlDelete</a></h3>
<p class="description">Delete a node and all of its children.</p>
<p class="code">
void mxmlDelete(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<span class="reserved">void</span> mxmlDelete(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -1479,7 +1479,7 @@ parent using the <a href="#mxmlRemove"><code>mxmlRemove</code></a> function.</p>
<h3 class="function"><a id="mxmlElementClearAttr">mxmlElementClearAttr</a></h3>
<p class="description">Remove an attribute from an element.</p>
<p class="code">
void mxmlElementClearAttr(<a href="#mxml_node_t">mxml_node_t</a> *node, const char *name);</p>
<span class="reserved">void</span> mxmlElementClearAttr(<a href="#mxml_node_t">mxml_node_t</a> *node, <span class="reserved">const</span> <span class="reserved">char</span> *name);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -1492,7 +1492,7 @@ void mxmlElementClearAttr(<a href="#mxml_node_t">mxml_node_t</a> *node, const ch
<h3 class="function"><a id="mxmlElementGetAttr">mxmlElementGetAttr</a></h3>
<p class="description">Get the value of an attribute.</p>
<p class="code">
const char *mxmlElementGetAttr(<a href="#mxml_node_t">mxml_node_t</a> *node, const char *name);</p>
<span class="reserved">const</span> <span class="reserved">char</span> *mxmlElementGetAttr(<a href="#mxml_node_t">mxml_node_t</a> *node, <span class="reserved">const</span> <span class="reserved">char</span> *name);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -1509,7 +1509,7 @@ attribute does not exist.</p>
<h3 class="function"><a id="mxmlElementGetAttrByIndex">mxmlElementGetAttrByIndex</a></h3>
<p class="description">Get an attribute by index.</p>
<p class="code">
const char *mxmlElementGetAttrByIndex(<a href="#mxml_node_t">mxml_node_t</a> *node, size_t idx, const char **name);</p>
<span class="reserved">const</span> <span class="reserved">char</span> *mxmlElementGetAttrByIndex(<a href="#mxml_node_t">mxml_node_t</a> *node, size_t idx, <span class="reserved">const</span> <span class="reserved">char</span> **name);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -1543,7 +1543,7 @@ element.</p>
<h3 class="function"><a id="mxmlElementSetAttr">mxmlElementSetAttr</a></h3>
<p class="description">Set an attribute for an element.</p>
<p class="code">
void mxmlElementSetAttr(<a href="#mxml_node_t">mxml_node_t</a> *node, const char *name, const char *value);</p>
<span class="reserved">void</span> mxmlElementSetAttr(<a href="#mxml_node_t">mxml_node_t</a> *node, <span class="reserved">const</span> <span class="reserved">char</span> *name, <span class="reserved">const</span> <span class="reserved">char</span> *value);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -1560,7 +1560,7 @@ is replaced by the new string value. The string value is copied.</p>
<h3 class="function"><a id="mxmlElementSetAttrf">mxmlElementSetAttrf</a></h3>
<p class="description">Set an attribute with a formatted value.</p>
<p class="code">
void mxmlElementSetAttrf(<a href="#mxml_node_t">mxml_node_t</a> *node, const char *name, const char *format, ...);</p>
<span class="reserved">void</span> mxmlElementSetAttrf(<a href="#mxml_node_t">mxml_node_t</a> *node, <span class="reserved">const</span> <span class="reserved">char</span> *name, <span class="reserved">const</span> <span class="reserved">char</span> *format, ...);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -1579,7 +1579,7 @@ attribute is replaced by the new formatted string value.</p>
<h3 class="function"><a id="mxmlFindElement">mxmlFindElement</a></h3>
<p class="description">Find the named element.</p>
<p class="code">
<a href="#mxml_node_t">mxml_node_t</a> *mxmlFindElement(<a href="#mxml_node_t">mxml_node_t</a> *node, <a href="#mxml_node_t">mxml_node_t</a> *top, const char *element, const char *attr, const char *value, <a href="#mxml_descend_t">mxml_descend_t</a> descend);</p>
<a href="#mxml_node_t">mxml_node_t</a> *mxmlFindElement(<a href="#mxml_node_t">mxml_node_t</a> *node, <a href="#mxml_node_t">mxml_node_t</a> *top, <span class="reserved">const</span> <span class="reserved">char</span> *element, <span class="reserved">const</span> <span class="reserved">char</span> *attr, <span class="reserved">const</span> <span class="reserved">char</span> *value, <a href="#mxml_descend_t">mxml_descend_t</a> descend);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -1610,7 +1610,7 @@ nodes; normally you will use <code>MXML_DESCEND_FIRST</code> for the initial sea
<h3 class="function"><a id="mxmlFindPath">mxmlFindPath</a></h3>
<p class="description">Find a node with the given path.</p>
<p class="code">
<a href="#mxml_node_t">mxml_node_t</a> *mxmlFindPath(<a href="#mxml_node_t">mxml_node_t</a> *top, const char *path);</p>
<a href="#mxml_node_t">mxml_node_t</a> *mxmlFindPath(<a href="#mxml_node_t">mxml_node_t</a> *top, <span class="reserved">const</span> <span class="reserved">char</span> *path);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>top</th>
@ -1631,7 +1631,7 @@ children and the first child is a value node.</p>
<h3 class="function"><a id="mxmlGetCDATA">mxmlGetCDATA</a></h3>
<p class="description">Get the value for a CDATA node.</p>
<p class="code">
const char *mxmlGetCDATA(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<span class="reserved">const</span> <span class="reserved">char</span> *mxmlGetCDATA(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -1645,7 +1645,7 @@ the node is not a CDATA element.</p>
<h3 class="function"><a id="mxmlGetComment">mxmlGetComment</a></h3>
<p class="description">Get the value for a comment node.</p>
<p class="code">
const char *mxmlGetComment(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<span class="reserved">const</span> <span class="reserved">char</span> *mxmlGetComment(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -1659,7 +1659,7 @@ if the node is not a comment.</p>
<h3 class="function"><a id="mxmlGetCustom">mxmlGetCustom</a></h3>
<p class="description">Get the value for a custom node.</p>
<p class="code">
const void *mxmlGetCustom(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<span class="reserved">const</span> <span class="reserved">void</span> *mxmlGetCustom(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -1673,7 +1673,7 @@ the node (or its first child) is not a custom value node.</p>
<h3 class="function"><a id="mxmlGetDeclaration">mxmlGetDeclaration</a></h3>
<p class="description">Get the value for a declaration node.</p>
<p class="code">
const char *mxmlGetDeclaration(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<span class="reserved">const</span> <span class="reserved">char</span> *mxmlGetDeclaration(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -1687,7 +1687,7 @@ returned if the node is not a declaration.</p>
<h3 class="function"><a id="mxmlGetDirective">mxmlGetDirective</a></h3>
<p class="description">Get the value for a processing instruction node.</p>
<p class="code">
const char *mxmlGetDirective(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<span class="reserved">const</span> <span class="reserved">char</span> *mxmlGetDirective(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -1701,7 +1701,7 @@ returned if the node is not a processing instruction.</p>
<h3 class="function"><a id="mxmlGetElement">mxmlGetElement</a></h3>
<p class="description">Get the name for an element node.</p>
<p class="code">
const char *mxmlGetElement(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<span class="reserved">const</span> <span class="reserved">char</span> *mxmlGetElement(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -1730,7 +1730,7 @@ has no children.</p>
<p class="description">Get the integer value from the specified node or its
first child.</p>
<p class="code">
long mxmlGetInteger(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<span class="reserved">long</span> mxmlGetInteger(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -1771,7 +1771,7 @@ if this is the last child for the current parent.</p>
<h3 class="function"><a id="mxmlGetOpaque">mxmlGetOpaque</a></h3>
<p class="description">Get an opaque string value for a node or its first child.</p>
<p class="code">
const char *mxmlGetOpaque(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<span class="reserved">const</span> <span class="reserved">char</span> *mxmlGetOpaque(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -1812,7 +1812,7 @@ returned if this is the first child for the current parent.</p>
<h3 class="function"><a id="mxmlGetReal">mxmlGetReal</a></h3>
<p class="description">Get the real value for a node or its first child.</p>
<p class="code">
double mxmlGetReal(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<span class="reserved">double</span> mxmlGetReal(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -1841,7 +1841,7 @@ reference count.</p>
<h3 class="function"><a id="mxmlGetText">mxmlGetText</a></h3>
<p class="description">Get the text value for a node or its first child.</p>
<p class="code">
const char *mxmlGetText(<a href="#mxml_node_t">mxml_node_t</a> *node, bool *whitespace);</p>
<span class="reserved">const</span> <span class="reserved">char</span> *mxmlGetText(<a href="#mxml_node_t">mxml_node_t</a> *node, <span class="reserved">bool</span> *whitespace);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -1879,7 +1879,7 @@ using the <a href="#mxmlGetOpaque"><code>mxmlGetOpaque</code></a> function inste
<h3 class="function"><a id="mxmlGetUserData">mxmlGetUserData</a></h3>
<p class="description">Get the user data pointer for a node.</p>
<p class="code">
void *mxmlGetUserData(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<span class="reserved">void</span> *mxmlGetUserData(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -1892,7 +1892,7 @@ void *mxmlGetUserData(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<h3 class="function"><a id="mxmlIndexDelete">mxmlIndexDelete</a></h3>
<p class="description">Delete an index.</p>
<p class="code">
void mxmlIndexDelete(<a href="#mxml_index_t">mxml_index_t</a> *ind);</p>
<span class="reserved">void</span> mxmlIndexDelete(<a href="#mxml_index_t">mxml_index_t</a> *ind);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ind</th>
@ -1918,7 +1918,7 @@ index.</p>
<h3 class="function"><a id="mxmlIndexFind">mxmlIndexFind</a></h3>
<p class="description">Find the next matching node.</p>
<p class="code">
<a href="#mxml_node_t">mxml_node_t</a> *mxmlIndexFind(<a href="#mxml_index_t">mxml_index_t</a> *ind, const char *element, const char *value);</p>
<a href="#mxml_node_t">mxml_node_t</a> *mxmlIndexFind(<a href="#mxml_index_t">mxml_index_t</a> *ind, <span class="reserved">const</span> <span class="reserved">char</span> *element, <span class="reserved">const</span> <span class="reserved">char</span> *value);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>ind</th>
@ -1951,7 +1951,7 @@ size_t mxmlIndexGetCount(<a href="#mxml_index_t">mxml_index_t</a> *ind);</p>
<h3 class="function"><a id="mxmlIndexNew">mxmlIndexNew</a></h3>
<p class="description">Create a new index.</p>
<p class="code">
<a href="#mxml_index_t">mxml_index_t</a> *mxmlIndexNew(<a href="#mxml_node_t">mxml_node_t</a> *node, const char *element, const char *attr);</p>
<a href="#mxml_index_t">mxml_index_t</a> *mxmlIndexNew(<a href="#mxml_node_t">mxml_node_t</a> *node, <span class="reserved">const</span> <span class="reserved">char</span> *element, <span class="reserved">const</span> <span class="reserved">char</span> *attr);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -1990,7 +1990,7 @@ first time.</p>
<h3 class="function"><a id="mxmlLoadFd">mxmlLoadFd</a></h3>
<p class="description">Load a file descriptor into an XML node tree.</p>
<p class="code">
<a href="#mxml_node_t">mxml_node_t</a> *mxmlLoadFd(<a href="#mxml_node_t">mxml_node_t</a> *top, <a href="#mxml_options_t">mxml_options_t</a> *options, int fd);</p>
<a href="#mxml_node_t">mxml_node_t</a> *mxmlLoadFd(<a href="#mxml_node_t">mxml_node_t</a> *top, <a href="#mxml_options_t">mxml_options_t</a> *options, <span class="reserved">int</span> fd);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>top</th>
@ -2038,7 +2038,7 @@ function to create options when loading XML data.</p>
<h3 class="function"><a id="mxmlLoadFilename">mxmlLoadFilename</a></h3>
<p class="description">Load a file into an XML node tree.</p>
<p class="code">
<a href="#mxml_node_t">mxml_node_t</a> *mxmlLoadFilename(<a href="#mxml_node_t">mxml_node_t</a> *top, <a href="#mxml_options_t">mxml_options_t</a> *options, const char *filename);</p>
<a href="#mxml_node_t">mxml_node_t</a> *mxmlLoadFilename(<a href="#mxml_node_t">mxml_node_t</a> *top, <a href="#mxml_options_t">mxml_options_t</a> *options, <span class="reserved">const</span> <span class="reserved">char</span> *filename);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>top</th>
@ -2062,7 +2062,7 @@ function to create options when loading XML data.</p>
<h3 class="function"><a id="mxmlLoadIO">mxmlLoadIO</a></h3>
<p class="description">Load an XML node tree using a read callback.</p>
<p class="code">
<a href="#mxml_node_t">mxml_node_t</a> *mxmlLoadIO(<a href="#mxml_node_t">mxml_node_t</a> *top, <a href="#mxml_options_t">mxml_options_t</a> *options, <a href="#mxml_io_cb_t">mxml_io_cb_t</a> io_cb, void *io_cbdata);</p>
<a href="#mxml_node_t">mxml_node_t</a> *mxmlLoadIO(<a href="#mxml_node_t">mxml_node_t</a> *top, <a href="#mxml_options_t">mxml_options_t</a> *options, <a href="#mxml_io_cb_t">mxml_io_cb_t</a> io_cb, <span class="reserved">void</span> *io_cbdata);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>top</th>
@ -2101,7 +2101,7 @@ size_t my_io_cb(void <em>cbdata, void </em>buffer, size_t bytes)
<h3 class="function"><a id="mxmlLoadString">mxmlLoadString</a></h3>
<p class="description">Load a string into an XML node tree.</p>
<p class="code">
<a href="#mxml_node_t">mxml_node_t</a> *mxmlLoadString(<a href="#mxml_node_t">mxml_node_t</a> *top, <a href="#mxml_options_t">mxml_options_t</a> *options, const char *s);</p>
<a href="#mxml_node_t">mxml_node_t</a> *mxmlLoadString(<a href="#mxml_node_t">mxml_node_t</a> *top, <a href="#mxml_options_t">mxml_options_t</a> *options, <span class="reserved">const</span> <span class="reserved">char</span> *s);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>top</th>
@ -2125,11 +2125,11 @@ function to create options when loading XML data.</p>
<h3 class="function"><a id="mxmlNewCDATA">mxmlNewCDATA</a></h3>
<p class="description">Create a new CDATA node.</p>
<p class="code">
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewCDATA(<a href="#mxml_node_t">mxml_node_t</a> *parent, const char *data);</p>
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewCDATA(<a href="#mxml_node_t">mxml_node_t</a> *parent, <span class="reserved">const</span> <span class="reserved">char</span> *data);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>parent</th>
<td class="description">Parent node or <code>MXML_NO_PARENT</code></td></tr>
<td class="description">Parent node or <code>NULL</code></td></tr>
<tr><th>data</th>
<td class="description">Data string</td></tr>
</tbody></table>
@ -2137,18 +2137,17 @@ function to create options when loading XML data.</p>
<p class="description">New node</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">The new CDATA node is added to the end of the specified parent's child
list. The constant <code>MXML_NO_PARENT</code> 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 currently use the
<code>MXML_TYPE_ELEMENT</code> type.</p>
list. The constant <code>NULL</code> 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.</p>
<h3 class="function"><a id="mxmlNewCDATAf">mxmlNewCDATAf</a></h3>
<p class="description">Create a new formatted CDATA node.</p>
<p class="code">
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewCDATAf(<a href="#mxml_node_t">mxml_node_t</a> *parent, const char *format, ...);</p>
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewCDATAf(<a href="#mxml_node_t">mxml_node_t</a> *parent, <span class="reserved">const</span> <span class="reserved">char</span> *format, ...);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>parent</th>
<td class="description">Parent node or <code>MXML_NO_PARENT</code></td></tr>
<td class="description">Parent node or <code>NULL</code></td></tr>
<tr><th>format</th>
<td class="description">Printf-style format string</td></tr>
<tr><th>...</th>
@ -2157,18 +2156,18 @@ is copied into the new node. CDATA nodes currently use the
<h4 class="returnvalue">Return Value</h4>
<p class="description">New node</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">The new CDATA node is added to the end of the specified parent's
child list. The constant <code>MXML_NO_PARENT</code> can be used to specify that
the new opaque string node has no parent. The format string must be
nul-terminated and is formatted into the new node.</p>
<p class="discussion">The new CDATA node is added to the end of the specified parent's child list.
The constant <code>NULL</code> can be used to specify that the new opaque string node
has no parent. The format string must be nul-terminated and is formatted
into the new node.</p>
<h3 class="function"><a id="mxmlNewComment">mxmlNewComment</a></h3>
<p class="description">Create a new comment node.</p>
<p class="code">
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewComment(<a href="#mxml_node_t">mxml_node_t</a> *parent, const char *comment);</p>
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewComment(<a href="#mxml_node_t">mxml_node_t</a> *parent, <span class="reserved">const</span> <span class="reserved">char</span> *comment);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>parent</th>
<td class="description">Parent node or <code>MXML_NO_PARENT</code></td></tr>
<td class="description">Parent node or <code>NULL</code></td></tr>
<tr><th>comment</th>
<td class="description">Comment string</td></tr>
</tbody></table>
@ -2176,17 +2175,17 @@ nul-terminated and is formatted into the new node.</p>
<p class="description">New node</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">The new comment node is added to the end of the specified parent's child
list. The constant <code>MXML_NO_PARENT</code> can be used to specify that the new
comment node has no parent. The comment string must be nul-terminated and
is copied into the new node.</p>
list. The constant <code>NULL</code> can be used to specify that the new comment node
has no parent. The comment string must be nul-terminated and is copied into
the new node.</p>
<h3 class="function"><a id="mxmlNewCommentf">mxmlNewCommentf</a></h3>
<p class="description">Create a new formatted comment string node.</p>
<p class="code">
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewCommentf(<a href="#mxml_node_t">mxml_node_t</a> *parent, const char *format, ...);</p>
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewCommentf(<a href="#mxml_node_t">mxml_node_t</a> *parent, <span class="reserved">const</span> <span class="reserved">char</span> *format, ...);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>parent</th>
<td class="description">Parent node or <code>MXML_NO_PARENT</code></td></tr>
<td class="description">Parent node or <code>NULL</code></td></tr>
<tr><th>format</th>
<td class="description">Printf-style format string</td></tr>
<tr><th>...</th>
@ -2196,17 +2195,17 @@ is copied into the new node.</p>
<p class="description">New node</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">The new comment string node is added to the end of the specified parent's
child list. The constant <code>MXML_NO_PARENT</code> can be used to specify that
the new opaque string node has no parent. The format string must be
nul-terminated and is formatted into the new node.</p>
child list. The constant <code>NULL</code> can be used to specify that the new opaque
string node has no parent. The format string must be nul-terminated and is
formatted into the new node.</p>
<h3 class="function"><a id="mxmlNewCustom">mxmlNewCustom</a></h3>
<p class="description">Create a new custom data node.</p>
<p class="code">
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewCustom(<a href="#mxml_node_t">mxml_node_t</a> *parent, void *data, <a href="#mxml_custfree_cb_t">mxml_custfree_cb_t</a> free_cb, void *free_cbdata);</p>
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewCustom(<a href="#mxml_node_t">mxml_node_t</a> *parent, <span class="reserved">void</span> *data, <a href="#mxml_custfree_cb_t">mxml_custfree_cb_t</a> free_cb, <span class="reserved">void</span> *free_cbdata);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>parent</th>
<td class="description">Parent node or <code>MXML_NO_PARENT</code></td></tr>
<td class="description">Parent node or <code>NULL</code></td></tr>
<tr><th>data</th>
<td class="description">Pointer to data</td></tr>
<tr><th>free_cb</th>
@ -2223,11 +2222,11 @@ data when the node is deleted.</p>
<h3 class="function"><a id="mxmlNewDeclaration">mxmlNewDeclaration</a></h3>
<p class="description">Create a new declaraction node.</p>
<p class="code">
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewDeclaration(<a href="#mxml_node_t">mxml_node_t</a> *parent, const char *declaration);</p>
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewDeclaration(<a href="#mxml_node_t">mxml_node_t</a> *parent, <span class="reserved">const</span> <span class="reserved">char</span> *declaration);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>parent</th>
<td class="description">Parent node or <code>MXML_NO_PARENT</code></td></tr>
<td class="description">Parent node or <code>NULL</code></td></tr>
<tr><th>declaration</th>
<td class="description">Declaration string</td></tr>
</tbody></table>
@ -2235,17 +2234,17 @@ data when the node is deleted.</p>
<p class="description">New node</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">The new declaration node is added to the end of the specified parent's child
list. The constant <code>MXML_NO_PARENT</code> can be used to specify that the new
list. The constant <code>NULL</code> can be used to specify that the new
declaration node has no parent. The declaration string must be nul-
terminated and is copied into the new node.</p>
<h3 class="function"><a id="mxmlNewDeclarationf">mxmlNewDeclarationf</a></h3>
<p class="description">Create a new formatted declaration node.</p>
<p class="code">
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewDeclarationf(<a href="#mxml_node_t">mxml_node_t</a> *parent, const char *format, ...);</p>
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewDeclarationf(<a href="#mxml_node_t">mxml_node_t</a> *parent, <span class="reserved">const</span> <span class="reserved">char</span> *format, ...);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>parent</th>
<td class="description">Parent node or <code>MXML_NO_PARENT</code></td></tr>
<td class="description">Parent node or <code>NULL</code></td></tr>
<tr><th>format</th>
<td class="description">Printf-style format string</td></tr>
<tr><th>...</th>
@ -2255,17 +2254,17 @@ terminated and is copied into the new node.</p>
<p class="description">New node</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">The new declaration node is added to the end of the specified parent's
child list. The constant <code>MXML_NO_PARENT</code> can be used to specify that
child list. The constant <code>NULL</code> can be used to specify that
the new opaque string node has no parent. The format string must be
nul-terminated and is formatted into the new node.</p>
<h3 class="function"><a id="mxmlNewDirective">mxmlNewDirective</a></h3>
<p class="description">Create a new processing instruction node.</p>
<p class="code">
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewDirective(<a href="#mxml_node_t">mxml_node_t</a> *parent, const char *directive);</p>
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewDirective(<a href="#mxml_node_t">mxml_node_t</a> *parent, <span class="reserved">const</span> <span class="reserved">char</span> *directive);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>parent</th>
<td class="description">Parent node or <code>MXML_NO_PARENT</code></td></tr>
<td class="description">Parent node or <code>NULL</code></td></tr>
<tr><th>directive</th>
<td class="description">Directive string</td></tr>
</tbody></table>
@ -2273,17 +2272,17 @@ nul-terminated and is formatted into the new node.</p>
<p class="description">New node</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">The new processing instruction node is added to the end of the specified
parent's child list. The constant <code>MXML_NO_PARENT</code> can be used to specify
that the new processing instruction node has no parent. The data string must
be nul-terminated and is copied into the new node.</p>
parent's child list. The constant <code>NULL</code> can be used to specify that the new
processing instruction node has no parent. The data string must be
nul-terminated and is copied into the new node.</p>
<h3 class="function"><a id="mxmlNewDirectivef">mxmlNewDirectivef</a></h3>
<p class="description">Create a new formatted processing instruction node.</p>
<p class="code">
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewDirectivef(<a href="#mxml_node_t">mxml_node_t</a> *parent, const char *format, ...);</p>
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewDirectivef(<a href="#mxml_node_t">mxml_node_t</a> *parent, <span class="reserved">const</span> <span class="reserved">char</span> *format, ...);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>parent</th>
<td class="description">Parent node or <code>MXML_NO_PARENT</code></td></tr>
<td class="description">Parent node or <code>NULL</code></td></tr>
<tr><th>format</th>
<td class="description">Printf-style format string</td></tr>
<tr><th>...</th>
@ -2292,18 +2291,18 @@ be nul-terminated and is copied into the new node.</p>
<h4 class="returnvalue">Return Value</h4>
<p class="description">New node</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">The new processing instruction node is added to the end of the specified parent's
child list. The constant <code>MXML_NO_PARENT</code> can be used to specify that
the new opaque string node has no parent. The format string must be
<p class="discussion">The new processing instruction node is added to the end of the specified
parent's child list. The constant <code>NULL</code> can be used to specify that the new
opaque string node has no parent. The format string must be
nul-terminated and is formatted into the new node.</p>
<h3 class="function"><a id="mxmlNewElement">mxmlNewElement</a></h3>
<p class="description">Create a new element node.</p>
<p class="code">
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewElement(<a href="#mxml_node_t">mxml_node_t</a> *parent, const char *name);</p>
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewElement(<a href="#mxml_node_t">mxml_node_t</a> *parent, <span class="reserved">const</span> <span class="reserved">char</span> *name);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>parent</th>
<td class="description">Parent node or <code>MXML_NO_PARENT</code></td></tr>
<td class="description">Parent node or <code>NULL</code></td></tr>
<tr><th>name</th>
<td class="description">Name of element</td></tr>
</tbody></table>
@ -2311,16 +2310,16 @@ nul-terminated and is formatted into the new node.</p>
<p class="description">New node</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">The new element node is added to the end of the specified parent's child
list. The constant <code>MXML_NO_PARENT</code> can be used to specify that the new
element node has no parent.</p>
list. The constant <code>NULL</code> can be used to specify that the new element node
has no parent.</p>
<h3 class="function"><a id="mxmlNewInteger">mxmlNewInteger</a></h3>
<p class="description">Create a new integer node.</p>
<p class="code">
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewInteger(<a href="#mxml_node_t">mxml_node_t</a> *parent, long integer);</p>
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewInteger(<a href="#mxml_node_t">mxml_node_t</a> *parent, <span class="reserved">long</span> integer);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>parent</th>
<td class="description">Parent node or <code>MXML_NO_PARENT</code></td></tr>
<td class="description">Parent node or <code>NULL</code></td></tr>
<tr><th>integer</th>
<td class="description">Integer value</td></tr>
</tbody></table>
@ -2328,16 +2327,16 @@ element node has no parent.</p>
<p class="description">New node</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">The new integer node is added to the end of the specified parent's child
list. The constant <code>MXML_NO_PARENT</code> can be used to specify that the new
integer node has no parent.</p>
list. The constant <code>NULL</code> can be used to specify that the new integer node
has no parent.</p>
<h3 class="function"><a id="mxmlNewOpaque">mxmlNewOpaque</a></h3>
<p class="description">Create a new opaque string.</p>
<p class="code">
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewOpaque(<a href="#mxml_node_t">mxml_node_t</a> *parent, const char *opaque);</p>
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewOpaque(<a href="#mxml_node_t">mxml_node_t</a> *parent, <span class="reserved">const</span> <span class="reserved">char</span> *opaque);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>parent</th>
<td class="description">Parent node or <code>MXML_NO_PARENT</code></td></tr>
<td class="description">Parent node or <code>NULL</code></td></tr>
<tr><th>opaque</th>
<td class="description">Opaque string</td></tr>
</tbody></table>
@ -2345,17 +2344,17 @@ integer node has no parent.</p>
<p class="description">New node</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">The new opaque string node is added to the end of the specified parent's
child list. The constant <code>MXML_NO_PARENT</code> can be used to specify that
the new opaque string node has no parent. The opaque string must be nul-
terminated and is copied into the new node.</p>
child list. The constant <code>NULL</code> can be used to specify that the new opaque
string node has no parent. The opaque string must be nul-terminated and is
copied into the new node.</p>
<h3 class="function"><a id="mxmlNewOpaquef">mxmlNewOpaquef</a></h3>
<p class="description">Create a new formatted opaque string node.</p>
<p class="code">
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewOpaquef(<a href="#mxml_node_t">mxml_node_t</a> *parent, const char *format, ...);</p>
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewOpaquef(<a href="#mxml_node_t">mxml_node_t</a> *parent, <span class="reserved">const</span> <span class="reserved">char</span> *format, ...);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>parent</th>
<td class="description">Parent node or <code>MXML_NO_PARENT</code></td></tr>
<td class="description">Parent node or <code>NULL</code></td></tr>
<tr><th>format</th>
<td class="description">Printf-style format string</td></tr>
<tr><th>...</th>
@ -2365,17 +2364,17 @@ terminated and is copied into the new node.</p>
<p class="description">New node</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">The new opaque string node is added to the end of the specified parent's
child list. The constant <code>MXML_NO_PARENT</code> can be used to specify that
the new opaque string node has no parent. The format string must be
nul-terminated and is formatted into the new node.</p>
child list. The constant <code>NULL</code> can be used to specify that the new opaque
string node has no parent. The format string must be nul-terminated and is
formatted into the new node.</p>
<h3 class="function"><a id="mxmlNewReal">mxmlNewReal</a></h3>
<p class="description">Create a new real number node.</p>
<p class="code">
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewReal(<a href="#mxml_node_t">mxml_node_t</a> *parent, double real);</p>
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewReal(<a href="#mxml_node_t">mxml_node_t</a> *parent, <span class="reserved">double</span> real);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>parent</th>
<td class="description">Parent node or <code>MXML_NO_PARENT</code></td></tr>
<td class="description">Parent node or <code>NULL</code></td></tr>
<tr><th>real</th>
<td class="description">Real number value</td></tr>
</tbody></table>
@ -2383,16 +2382,16 @@ nul-terminated and is formatted into the new node.</p>
<p class="description">New node</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">The new real number node is added to the end of the specified parent's
child list. The constant <code>MXML_NO_PARENT</code> can be used to specify that
the new real number node has no parent.</p>
child list. The constant <code>NULL</code> can be used to specify that the new real
number node has no parent.</p>
<h3 class="function"><a id="mxmlNewText">mxmlNewText</a></h3>
<p class="description">Create a new text fragment node.</p>
<p class="code">
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewText(<a href="#mxml_node_t">mxml_node_t</a> *parent, bool whitespace, const char *string);</p>
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewText(<a href="#mxml_node_t">mxml_node_t</a> *parent, <span class="reserved">bool</span> whitespace, <span class="reserved">const</span> <span class="reserved">char</span> *string);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>parent</th>
<td class="description">Parent node or <code>MXML_NO_PARENT</code></td></tr>
<td class="description">Parent node or <code>NULL</code></td></tr>
<tr><th>whitespace</th>
<td class="description"><code>true</code> = leading whitespace, <code>false</code> = no whitespace</td></tr>
<tr><th>string</th>
@ -2402,18 +2401,18 @@ the new real number node has no parent.</p>
<p class="description">New node</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">The new text node is added to the end of the specified parent's child
list. The constant <code>MXML_NO_PARENT</code> can be used to specify that the new
text node has no parent. The whitespace parameter is used to specify
whether leading whitespace is present before the node. The text
string must be nul-terminated and is copied into the new node.</p>
list. The constant <code>NULL</code> can be used to specify that the new text node has
no parent. The whitespace parameter is used to specify whether leading
whitespace is present before the node. The text string must be
nul-terminated and is copied into the new node.</p>
<h3 class="function"><a id="mxmlNewTextf">mxmlNewTextf</a></h3>
<p class="description">Create a new formatted text fragment node.</p>
<p class="code">
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewTextf(<a href="#mxml_node_t">mxml_node_t</a> *parent, bool whitespace, const char *format, ...);</p>
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewTextf(<a href="#mxml_node_t">mxml_node_t</a> *parent, <span class="reserved">bool</span> whitespace, <span class="reserved">const</span> <span class="reserved">char</span> *format, ...);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>parent</th>
<td class="description">Parent node or <code>MXML_NO_PARENT</code></td></tr>
<td class="description">Parent node or <code>NULL</code></td></tr>
<tr><th>whitespace</th>
<td class="description"><code>true</code> = leading whitespace, <code>false</code> = no whitespace</td></tr>
<tr><th>format</th>
@ -2425,14 +2424,14 @@ string must be nul-terminated and is copied into the new node.</p>
<p class="description">New node</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">The new text node is added to the end of the specified parent's child
list. The constant <code>MXML_NO_PARENT</code> can be used to specify that the new
text node has no parent. The whitespace parameter is used to specify
whether leading whitespace is present before the node. The format
string must be nul-terminated and is formatted into the new node.</p>
list. The constant <code>NULL</code> can be used to specify that the new text node has
no parent. The whitespace parameter is used to specify whether leading
whitespace is present before the node. The format string must be
nul-terminated and is formatted into the new node.</p>
<h3 class="function"><a id="mxmlNewXML">mxmlNewXML</a></h3>
<p class="description">Create a new XML document tree.</p>
<p class="code">
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewXML(const char *version);</p>
<a href="#mxml_node_t">mxml_node_t</a> *mxmlNewXML(<span class="reserved">const</span> <span class="reserved">char</span> *version);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>version</th>
@ -2446,7 +2445,7 @@ string must be nul-terminated and is formatted into the new node.</p>
<h3 class="function"><a id="mxmlOptionsDelete">mxmlOptionsDelete</a></h3>
<p class="description">Free load/save options.</p>
<p class="code">
void mxmlOptionsDelete(<a href="#mxml_options_t">mxml_options_t</a> *options);</p>
<span class="reserved">void</span> mxmlOptionsDelete(<a href="#mxml_options_t">mxml_options_t</a> *options);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>options</th>
@ -2455,7 +2454,7 @@ void mxmlOptionsDelete(<a href="#mxml_options_t">mxml_options_t</a> *options);</
<h3 class="function"><a id="mxmlOptionsNew">mxmlOptionsNew</a></h3>
<p class="description">Allocate load/save options.</p>
<p class="code">
<a href="#mxml_options_t">mxml_options_t</a> *mxmlOptionsNew(void);</p>
<a href="#mxml_options_t">mxml_options_t</a> *mxmlOptionsNew(<span class="reserved">void</span>);</p>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Options</p>
<h4 class="discussion">Discussion</h4>
@ -2488,7 +2487,7 @@ inline text as a series of whitespace-delimited words, instead of using the
<h3 class="function"><a id="mxmlOptionsSetCustomCallbacks">mxmlOptionsSetCustomCallbacks</a></h3>
<p class="description">Set the custom data callbacks.</p>
<p class="code">
void mxmlOptionsSetCustomCallbacks(<a href="#mxml_options_t">mxml_options_t</a> *options, <a href="#mxml_custload_cb_t">mxml_custload_cb_t</a> load_cb, <a href="#mxml_custsave_cb_t">mxml_custsave_cb_t</a> save_cb, void *cbdata);</p>
<span class="reserved">void</span> mxmlOptionsSetCustomCallbacks(<a href="#mxml_options_t">mxml_options_t</a> *options, <a href="#mxml_custload_cb_t">mxml_custload_cb_t</a> load_cb, <a href="#mxml_custsave_cb_t">mxml_custsave_cb_t</a> save_cb, <span class="reserved">void</span> *cbdata);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>options</th>
@ -2596,7 +2595,7 @@ my_custom_save_cb(void *cbdata, mxml_node_t *node)
<h3 class="function"><a id="mxmlOptionsSetEntityCallback">mxmlOptionsSetEntityCallback</a></h3>
<p class="description">Set the entity lookup callback to use when loading XML data.</p>
<p class="code">
void mxmlOptionsSetEntityCallback(<a href="#mxml_options_t">mxml_options_t</a> *options, <a href="#mxml_entity_cb_t">mxml_entity_cb_t</a> cb, void *cbdata);</p>
<span class="reserved">void</span> mxmlOptionsSetEntityCallback(<a href="#mxml_options_t">mxml_options_t</a> *options, <a href="#mxml_entity_cb_t">mxml_entity_cb_t</a> cb, <span class="reserved">void</span> *cbdata);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>options</th>
@ -2631,7 +2630,7 @@ entities which are required by the base XML specification.</pre>
<h3 class="function"><a id="mxmlOptionsSetErrorCallback">mxmlOptionsSetErrorCallback</a></h3>
<p class="description">Set the error message callback.</p>
<p class="code">
void mxmlOptionsSetErrorCallback(<a href="#mxml_options_t">mxml_options_t</a> *options, <a href="#mxml_error_cb_t">mxml_error_cb_t</a> cb, void *cbdata);</p>
<span class="reserved">void</span> mxmlOptionsSetErrorCallback(<a href="#mxml_options_t">mxml_options_t</a> *options, <a href="#mxml_error_cb_t">mxml_error_cb_t</a> cb, <span class="reserved">void</span> *cbdata);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>options</th>
@ -2660,7 +2659,7 @@ ack supports the &quot;euro&quot; entity:<br>
<h3 class="function"><a id="mxmlOptionsSetSAXCallback">mxmlOptionsSetSAXCallback</a></h3>
<p class="description">Set the SAX callback to use when reading XML data.</p>
<p class="code">
void mxmlOptionsSetSAXCallback(<a href="#mxml_options_t">mxml_options_t</a> *options, <a href="#mxml_sax_cb_t">mxml_sax_cb_t</a> cb, void *cbdata);</p>
<span class="reserved">void</span> mxmlOptionsSetSAXCallback(<a href="#mxml_options_t">mxml_options_t</a> *options, <a href="#mxml_sax_cb_t">mxml_sax_cb_t</a> cb, <span class="reserved">void</span> *cbdata);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>options</th>
@ -2707,7 +2706,7 @@ using the [mxmlRetain](@@) function.</pre>
<h3 class="function"><a id="mxmlOptionsSetTypeCallback">mxmlOptionsSetTypeCallback</a></h3>
<p class="description">Set the type callback for child/value nodes.</p>
<p class="code">
void mxmlOptionsSetTypeCallback(<a href="#mxml_options_t">mxml_options_t</a> *options, <a href="#mxml_type_cb_t">mxml_type_cb_t</a> cb, void *cbdata);</p>
<span class="reserved">void</span> mxmlOptionsSetTypeCallback(<a href="#mxml_options_t">mxml_options_t</a> *options, <a href="#mxml_type_cb_t">mxml_type_cb_t</a> cb, <span class="reserved">void</span> *cbdata);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>options</th>
@ -2752,7 +2751,7 @@ my_type_cb(void <em>cbdata, mxml_node_t </em>node)
<h3 class="function"><a id="mxmlOptionsSetTypeValue">mxmlOptionsSetTypeValue</a></h3>
<p class="description">Set the type to use for all child/value nodes.</p>
<p class="code">
void mxmlOptionsSetTypeValue(<a href="#mxml_options_t">mxml_options_t</a> *options, <a href="#mxml_type_t">mxml_type_t</a> type);</p>
<span class="reserved">void</span> mxmlOptionsSetTypeValue(<a href="#mxml_options_t">mxml_options_t</a> *options, <a href="#mxml_type_t">mxml_type_t</a> type);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>options</th>
@ -2765,7 +2764,7 @@ void mxmlOptionsSetTypeValue(<a href="#mxml_options_t">mxml_options_t</a> *optio
<h3 class="function"><a id="mxmlOptionsSetWhitespaceCallback">mxmlOptionsSetWhitespaceCallback</a></h3>
<p class="description">Set the whitespace callback.</p>
<p class="code">
void mxmlOptionsSetWhitespaceCallback(<a href="#mxml_options_t">mxml_options_t</a> *options, <a href="#mxml_ws_cb_t">mxml_ws_cb_t</a> cb, void *cbdata);</p>
<span class="reserved">void</span> mxmlOptionsSetWhitespaceCallback(<a href="#mxml_options_t">mxml_options_t</a> *options, <a href="#mxml_ws_cb_t">mxml_ws_cb_t</a> cb, <span class="reserved">void</span> *cbdata);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>options</th>
@ -2794,7 +2793,7 @@ const char <em>my_whitespace_cb(void </em>cbdata, mxml_node_t *node, mxml_ws_t w
<h3 class="function"><a id="mxmlOptionsSetWrapMargin">mxmlOptionsSetWrapMargin</a></h3>
<p class="description">Set the wrap margin when saving XML data.</p>
<p class="code">
void mxmlOptionsSetWrapMargin(<a href="#mxml_options_t">mxml_options_t</a> *options, int column);</p>
<span class="reserved">void</span> mxmlOptionsSetWrapMargin(<a href="#mxml_options_t">mxml_options_t</a> *options, <span class="reserved">int</span> column);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>options</th>
@ -2808,7 +2807,7 @@ disabled when <code>column</code> is <code>0</code>.</p>
<h3 class="function"><a id="mxmlRelease">mxmlRelease</a></h3>
<p class="description">Release a node.</p>
<p class="code">
int mxmlRelease(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<span class="reserved">int</span> mxmlRelease(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -2822,7 +2821,7 @@ is deleted via <a href="#mxmlDelete"><code>mxmlDelete</code></a>.</p>
<h3 class="function"><a id="mxmlRemove">mxmlRemove</a></h3>
<p class="description">Remove a node from its parent.</p>
<p class="code">
void mxmlRemove(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<span class="reserved">void</span> mxmlRemove(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -2834,7 +2833,7 @@ for that. This function does nothing if the node has no parent.</p>
<h3 class="function"><a id="mxmlRetain">mxmlRetain</a></h3>
<p class="description">Retain a node.</p>
<p class="code">
int mxmlRetain(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<span class="reserved">int</span> mxmlRetain(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -2845,7 +2844,7 @@ int mxmlRetain(<a href="#mxml_node_t">mxml_node_t</a> *node);</p>
<h3 class="function"><a id="mxmlSaveAllocString">mxmlSaveAllocString</a></h3>
<p class="description">Save an XML tree to an allocated string.</p>
<p class="code">
char *mxmlSaveAllocString(<a href="#mxml_node_t">mxml_node_t</a> *node, <a href="#mxml_options_t">mxml_options_t</a> *options);</p>
<span class="reserved">char</span> *mxmlSaveAllocString(<a href="#mxml_node_t">mxml_node_t</a> *node, <a href="#mxml_options_t">mxml_options_t</a> *options);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -2869,7 +2868,7 @@ output will be wrapped at column 72 with no additional whitespace. Use the
<h3 class="function"><a id="mxmlSaveFd">mxmlSaveFd</a></h3>
<p class="description">Save an XML tree to a file descriptor.</p>
<p class="code">
bool mxmlSaveFd(<a href="#mxml_node_t">mxml_node_t</a> *node, <a href="#mxml_options_t">mxml_options_t</a> *options, int fd);</p>
<span class="reserved">bool</span> mxmlSaveFd(<a href="#mxml_node_t">mxml_node_t</a> *node, <a href="#mxml_options_t">mxml_options_t</a> *options, <span class="reserved">int</span> fd);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -2890,7 +2889,7 @@ output will be wrapped at column 72 with no additional whitespace. Use the
<h3 class="function"><a id="mxmlSaveFile">mxmlSaveFile</a></h3>
<p class="description">Save an XML tree to a file.</p>
<p class="code">
bool mxmlSaveFile(<a href="#mxml_node_t">mxml_node_t</a> *node, <a href="#mxml_options_t">mxml_options_t</a> *options, FILE *fp);</p>
<span class="reserved">bool</span> mxmlSaveFile(<a href="#mxml_node_t">mxml_node_t</a> *node, <a href="#mxml_options_t">mxml_options_t</a> *options, FILE *fp);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -2911,7 +2910,7 @@ output will be wrapped at column 72 with no additional whitespace. Use the
<h3 class="function"><a id="mxmlSaveFilename">mxmlSaveFilename</a></h3>
<p class="description">Save an XML tree to a file.</p>
<p class="code">
bool mxmlSaveFilename(<a href="#mxml_node_t">mxml_node_t</a> *node, <a href="#mxml_options_t">mxml_options_t</a> *options, const char *filename);</p>
<span class="reserved">bool</span> mxmlSaveFilename(<a href="#mxml_node_t">mxml_node_t</a> *node, <a href="#mxml_options_t">mxml_options_t</a> *options, <span class="reserved">const</span> <span class="reserved">char</span> *filename);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -2932,7 +2931,7 @@ output will be wrapped at column 72 with no additional whitespace. Use the
<h3 class="function"><a id="mxmlSaveIO">mxmlSaveIO</a></h3>
<p class="description">Save an XML tree using a callback.</p>
<p class="code">
bool mxmlSaveIO(<a href="#mxml_node_t">mxml_node_t</a> *node, <a href="#mxml_options_t">mxml_options_t</a> *options, <a href="#mxml_io_cb_t">mxml_io_cb_t</a> io_cb, void *io_cbdata);</p>
<span class="reserved">bool</span> mxmlSaveIO(<a href="#mxml_node_t">mxml_node_t</a> *node, <a href="#mxml_options_t">mxml_options_t</a> *options, <a href="#mxml_io_cb_t">mxml_io_cb_t</a> io_cb, <span class="reserved">void</span> *io_cbdata);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -2972,7 +2971,7 @@ output will be wrapped at column 72 with no additional whitespace. Use the
<h3 class="function"><a id="mxmlSaveString">mxmlSaveString</a></h3>
<p class="description">Save an XML node tree to a string.</p>
<p class="code">
size_t mxmlSaveString(<a href="#mxml_node_t">mxml_node_t</a> *node, <a href="#mxml_options_t">mxml_options_t</a> *options, char *buffer, size_t bufsize);</p>
size_t mxmlSaveString(<a href="#mxml_node_t">mxml_node_t</a> *node, <a href="#mxml_options_t">mxml_options_t</a> *options, <span class="reserved">char</span> *buffer, size_t bufsize);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -2995,7 +2994,7 @@ output will be wrapped at column 72 with no additional whitespace. Use the
<h3 class="function"><a id="mxmlSetCDATA">mxmlSetCDATA</a></h3>
<p class="description">Set the data for a CDATA node.</p>
<p class="code">
bool mxmlSetCDATA(<a href="#mxml_node_t">mxml_node_t</a> *node, const char *data);</p>
<span class="reserved">bool</span> mxmlSetCDATA(<a href="#mxml_node_t">mxml_node_t</a> *node, <span class="reserved">const</span> <span class="reserved">char</span> *data);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -3011,7 +3010,7 @@ changed if it (or its first child) is not a CDATA node.</p>
<h3 class="function"><a id="mxmlSetCDATAf">mxmlSetCDATAf</a></h3>
<p class="description">Set the data for a CDATA to a formatted string.</p>
<p class="code">
bool mxmlSetCDATAf(<a href="#mxml_node_t">mxml_node_t</a> *node, const char *format, ...);</p>
<span class="reserved">bool</span> mxmlSetCDATAf(<a href="#mxml_node_t">mxml_node_t</a> *node, <span class="reserved">const</span> <span class="reserved">char</span> *format, ...);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -3029,7 +3028,7 @@ not changed if it (or its first child) is not a CDATA node.</p>
<h3 class="function"><a id="mxmlSetComment">mxmlSetComment</a></h3>
<p class="description">Set a comment to a literal string.</p>
<p class="code">
bool mxmlSetComment(<a href="#mxml_node_t">mxml_node_t</a> *node, const char *comment);</p>
<span class="reserved">bool</span> mxmlSetComment(<a href="#mxml_node_t">mxml_node_t</a> *node, <span class="reserved">const</span> <span class="reserved">char</span> *comment);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -3044,7 +3043,7 @@ bool mxmlSetComment(<a href="#mxml_node_t">mxml_node_t</a> *node, const char *co
<h3 class="function"><a id="mxmlSetCommentf">mxmlSetCommentf</a></h3>
<p class="description">Set a comment to a formatted string.</p>
<p class="code">
bool mxmlSetCommentf(<a href="#mxml_node_t">mxml_node_t</a> *node, const char *format, ...);</p>
<span class="reserved">bool</span> mxmlSetCommentf(<a href="#mxml_node_t">mxml_node_t</a> *node, <span class="reserved">const</span> <span class="reserved">char</span> *format, ...);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -3061,7 +3060,7 @@ bool mxmlSetCommentf(<a href="#mxml_node_t">mxml_node_t</a> *node, const char *f
<h3 class="function"><a id="mxmlSetCustom">mxmlSetCustom</a></h3>
<p class="description">Set the data and destructor of a custom data node.</p>
<p class="code">
bool mxmlSetCustom(<a href="#mxml_node_t">mxml_node_t</a> *node, void *data, <a href="#mxml_custfree_cb_t">mxml_custfree_cb_t</a> free_cb, void *free_cbdata);</p>
<span class="reserved">bool</span> mxmlSetCustom(<a href="#mxml_node_t">mxml_node_t</a> *node, <span class="reserved">void</span> *data, <a href="#mxml_custfree_cb_t">mxml_custfree_cb_t</a> free_cb, <span class="reserved">void</span> *free_cbdata);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -3082,7 +3081,7 @@ first child) is not a custom node.</p>
<h3 class="function"><a id="mxmlSetDeclaration">mxmlSetDeclaration</a></h3>
<p class="description">Set a declaration to a literal string.</p>
<p class="code">
bool mxmlSetDeclaration(<a href="#mxml_node_t">mxml_node_t</a> *node, const char *declaration);</p>
<span class="reserved">bool</span> mxmlSetDeclaration(<a href="#mxml_node_t">mxml_node_t</a> *node, <span class="reserved">const</span> <span class="reserved">char</span> *declaration);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -3097,7 +3096,7 @@ bool mxmlSetDeclaration(<a href="#mxml_node_t">mxml_node_t</a> *node, const char
<h3 class="function"><a id="mxmlSetDeclarationf">mxmlSetDeclarationf</a></h3>
<p class="description">Set a declaration to a formatted string.</p>
<p class="code">
bool mxmlSetDeclarationf(<a href="#mxml_node_t">mxml_node_t</a> *node, const char *format, ...);</p>
<span class="reserved">bool</span> mxmlSetDeclarationf(<a href="#mxml_node_t">mxml_node_t</a> *node, <span class="reserved">const</span> <span class="reserved">char</span> *format, ...);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -3114,7 +3113,7 @@ bool mxmlSetDeclarationf(<a href="#mxml_node_t">mxml_node_t</a> *node, const cha
<h3 class="function"><a id="mxmlSetDirective">mxmlSetDirective</a></h3>
<p class="description">Set a processing instruction to a literal string.</p>
<p class="code">
bool mxmlSetDirective(<a href="#mxml_node_t">mxml_node_t</a> *node, const char *directive);</p>
<span class="reserved">bool</span> mxmlSetDirective(<a href="#mxml_node_t">mxml_node_t</a> *node, <span class="reserved">const</span> <span class="reserved">char</span> *directive);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -3129,7 +3128,7 @@ bool mxmlSetDirective(<a href="#mxml_node_t">mxml_node_t</a> *node, const char *
<h3 class="function"><a id="mxmlSetDirectivef">mxmlSetDirectivef</a></h3>
<p class="description">Set a processing instruction to a formatted string.</p>
<p class="code">
bool mxmlSetDirectivef(<a href="#mxml_node_t">mxml_node_t</a> *node, const char *format, ...);</p>
<span class="reserved">bool</span> mxmlSetDirectivef(<a href="#mxml_node_t">mxml_node_t</a> *node, <span class="reserved">const</span> <span class="reserved">char</span> *format, ...);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -3147,7 +3146,7 @@ node.</p>
<h3 class="function"><a id="mxmlSetElement">mxmlSetElement</a></h3>
<p class="description">Set the name of an element node.</p>
<p class="code">
bool mxmlSetElement(<a href="#mxml_node_t">mxml_node_t</a> *node, const char *name);</p>
<span class="reserved">bool</span> mxmlSetElement(<a href="#mxml_node_t">mxml_node_t</a> *node, <span class="reserved">const</span> <span class="reserved">char</span> *name);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -3163,7 +3162,7 @@ it is not an element node.</p>
<h3 class="function"><a id="mxmlSetInteger">mxmlSetInteger</a></h3>
<p class="description">Set the value of an integer node.</p>
<p class="code">
bool mxmlSetInteger(<a href="#mxml_node_t">mxml_node_t</a> *node, long integer);</p>
<span class="reserved">bool</span> mxmlSetInteger(<a href="#mxml_node_t">mxml_node_t</a> *node, <span class="reserved">long</span> integer);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -3179,7 +3178,7 @@ it (or its first child) is not an integer node.</p>
<h3 class="function"><a id="mxmlSetOpaque">mxmlSetOpaque</a></h3>
<p class="description">Set the value of an opaque node.</p>
<p class="code">
bool mxmlSetOpaque(<a href="#mxml_node_t">mxml_node_t</a> *node, const char *opaque);</p>
<span class="reserved">bool</span> mxmlSetOpaque(<a href="#mxml_node_t">mxml_node_t</a> *node, <span class="reserved">const</span> <span class="reserved">char</span> *opaque);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -3195,7 +3194,7 @@ changed if it (or its first child) is not an opaque node.</p>
<h3 class="function"><a id="mxmlSetOpaquef">mxmlSetOpaquef</a></h3>
<p class="description">Set the value of an opaque string node to a formatted string.</p>
<p class="code">
bool mxmlSetOpaquef(<a href="#mxml_node_t">mxml_node_t</a> *node, const char *format, ...);</p>
<span class="reserved">bool</span> mxmlSetOpaquef(<a href="#mxml_node_t">mxml_node_t</a> *node, <span class="reserved">const</span> <span class="reserved">char</span> *format, ...);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -3213,7 +3212,7 @@ not changed if it (or its first child) is not an opaque node.</p>
<h3 class="function"><a id="mxmlSetReal">mxmlSetReal</a></h3>
<p class="description">Set the value of a real value node.</p>
<p class="code">
bool mxmlSetReal(<a href="#mxml_node_t">mxml_node_t</a> *node, double real);</p>
<span class="reserved">bool</span> mxmlSetReal(<a href="#mxml_node_t">mxml_node_t</a> *node, <span class="reserved">double</span> real);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -3229,7 +3228,7 @@ if it (or its first child) is not a real value node.</p>
<h3 class="function"><a id="mxmlSetText">mxmlSetText</a></h3>
<p class="description">Set the value of a text node.</p>
<p class="code">
bool mxmlSetText(<a href="#mxml_node_t">mxml_node_t</a> *node, bool whitespace, const char *string);</p>
<span class="reserved">bool</span> mxmlSetText(<a href="#mxml_node_t">mxml_node_t</a> *node, <span class="reserved">bool</span> whitespace, <span class="reserved">const</span> <span class="reserved">char</span> *string);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -3247,7 +3246,7 @@ is not changed if it (or its first child) is not a text node.</p>
<h3 class="function"><a id="mxmlSetTextf">mxmlSetTextf</a></h3>
<p class="description">Set the value of a text node to a formatted string.</p>
<p class="code">
bool mxmlSetTextf(<a href="#mxml_node_t">mxml_node_t</a> *node, bool whitespace, const char *format, ...);</p>
<span class="reserved">bool</span> mxmlSetTextf(<a href="#mxml_node_t">mxml_node_t</a> *node, <span class="reserved">bool</span> whitespace, <span class="reserved">const</span> <span class="reserved">char</span> *format, ...);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>
@ -3267,7 +3266,7 @@ The node is not changed if it (or its first child) is not a text node.</p>
<h3 class="function"><a id="mxmlSetUserData">mxmlSetUserData</a></h3>
<p class="description">Set the user data pointer for a node.</p>
<p class="code">
bool mxmlSetUserData(<a href="#mxml_node_t">mxml_node_t</a> *node, void *data);</p>
<span class="reserved">bool</span> mxmlSetUserData(<a href="#mxml_node_t">mxml_node_t</a> *node, <span class="reserved">void</span> *data);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>node</th>

394
linux/Makefile Normal file
View File

@ -0,0 +1,394 @@
#
# Linux makefile for Mini-XML, a small XML-like file parsing library.
#
# https://www.msweet.org/mxml
#
# Copyright © 2003-2024 by Michael R Sweet.
#
# Licensed under Apache License v2.0. See the file "LICENSE" for more
# information.
#
#
# This is a POSIX makefile
#
.POSIX:
#
# Mini-XML version...
#
MXML_VERSION = 4.0.4
#
# Programs...
#
AR = /usr/bin/ar
CC = gcc
DSO = $(CC)
INSTALL = /home/mike/c/mxml/install-sh
LN = /usr/bin/ln -sf
MKDIR = /usr/bin/mkdir -p
RANLIB = ranlib
RM = /usr/bin/rm -f
RMDIR = /usr/bin/rmdir
SHELL = /bin/sh
#
# Installation programs...
#
INSTALL_BIN = $(INSTALL) -c -m 755
INSTALL_DATA = $(INSTALL) -c -m 444
INSTALL_DIR = $(INSTALL) -d -m 755
INSTALL_LIB = $(INSTALL) -c -m 755
INSTALL_MAN = $(INSTALL) -c -m 444
#
# Libraries...
#
LIBMXML = libmxml4.so.2
LIBMXML_BASE = libmxml4
LIBMXML_STATIC = libmxml4.a
MXML_MAN = mxml4.3
MXML_PC = mxml4.pc
#
# Install static libraries?
#
INSTALL_STATIC = install-libmxml4.a
#
# Code signing...
#
CODE_SIGN = /usr/bin/true
CODESIGN_IDENTITY = -
CSFLAGS = -s "$(CODESIGN_IDENTITY)" -o runtime --timestamp
#
# Library archiver...
#
ARFLAGS = cr
#
# C compiler and preprocessor...
#
CFLAGS = -fPIC $(CPPFLAGS) $(OPTIM) $(WARNINGS)
CPPFLAGS = -D_THREAD_SAFE -D_REENTRANT -D_FORTIFY_SOURCE=3 -D__USE_MISC -D_GNU_SOURCE
WARNINGS = -Wall -Wunused -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format-truncation -Wno-format-y2k -Wno-switch -Wno-unused-result
#
# Linker options...
#
DSOFLAGS = -Wl,-soname,`basename $@` -shared $(OPTIM)
LDFLAGS = -fPIE -pie -Wl,-z,relro,-z,now $(OPTIM)
LIBS = -lpthread -lm
#
# Optimization and architecture options for both the compiler and linker.
#
OPTIM = -g -Os
#
# Directories...
#
bindir = ${exec_prefix}/bin
datadir = ${datarootdir}
datarootdir = ${prefix}/share
docdir = ${prefix}/share/doc/mxml4
exec_prefix = ${prefix}
includedir = ${prefix}/include/libmxml4
infodir = ${datarootdir}/info
libdir = ${exec_prefix}/lib
libexecdir = ${exec_prefix}/libexec
localstatedir = ${prefix}/var
mandir = ${datarootdir}/man
oldincludedir = /usr/include
prefix = /usr/local
sbindir = ${exec_prefix}/sbin
sharedstatedir = ${prefix}/com
srcdir = .
sysconfdir = ${prefix}/etc
top_srcdir = .
BUILDROOT = $(DSTROOT)$(DESTDIR)
#
# Silent build...
#
.SILENT:
#
# Targets...
#
DOCFILES = doc/mxml.epub doc/mxml.html doc/mxml-cover.png \
CHANGES.md LICENSE NOTICE README.md
PUBLIBOBJS = mxml-attr.o mxml-file.o mxml-get.o mxml-index.o \
mxml-node.o mxml-options.o mxml-search.o mxml-set.o
LIBOBJS = $(PUBLIBOBJS) mxml-private.o
OBJS = testmxml.o $(LIBOBJS)
ALLTARGETS = $(LIBMXML) testmxml
CROSSTARGETS = $(LIBMXML)
TARGETS = $(ALLTARGETS)
#
# Make everything...
#
all: $(TARGETS)
#
# Clean everything...
#
clean:
echo Cleaning build files...
$(RM) $(OBJS) $(ALLTARGETS)
$(RM) libmxml4.a
$(RM) libmxml4.so
$(RM) libmxml4.so.2
#
# Really clean everything...
#
distclean: clean
echo Cleaning distribution files...
$(RM) test.xmlfd
$(RM) temp1.xml temp1.xmlfd temp1s.xml
$(RM) temp2.xml temp2s.xml
$(RM) -r clang
#
# Install everything...
#
.NOTPARALLEL: install install-$(LIBMXML) $(INSTALL_STATIC)
install: $(TARGETS) install-$(LIBMXML) $(INSTALL_STATIC)
echo Installing documentation in $(BUILDROOT)$(docdir)...
$(INSTALL_DIR) $(BUILDROOT)$(docdir)
for file in $(DOCFILES); do \
$(INSTALL_MAN) ../$$file $(BUILDROOT)$(docdir)/`basename $$file .md`; \
done
echo Installing header files in $(BUILDROOT)$(includedir)...
$(INSTALL_DIR) $(BUILDROOT)$(includedir)
$(INSTALL_DATA) ../mxml.h $(BUILDROOT)$(includedir)
echo Installing pkgconfig files in $(BUILDROOT)$(libdir)/pkgconfig...
$(INSTALL_DIR) $(BUILDROOT)$(libdir)/pkgconfig
$(INSTALL_DATA) mxml4.pc $(BUILDROOT)$(libdir)/pkgconfig/$(MXML_PC)
echo Installing man pages in $(BUILDROOT)$(mandir)...
$(INSTALL_DIR) $(BUILDROOT)$(mandir)/man3
$(INSTALL_MAN) ../doc/mxml.3 $(BUILDROOT)$(mandir)/man3/$(MXML_MAN)
install-libmxml.a: libmxml.a
echo Installing libmxml.a to $(BUILDROOT)$(libdir)...
$(INSTALL_DIR) $(BUILDROOT)$(libdir)
$(INSTALL_LIB) libmxml.a $(BUILDROOT)$(libdir)
$(RANLIB) $(BUILDROOT)$(libdir)/libmxml.a
install-libmxml.so.2: libmxml.so.2
echo Installing libmxml.so to $(BUILDROOT)$(libdir)...
$(INSTALL_DIR) $(BUILDROOT)$(libdir)
$(INSTALL_LIB) libmxml.so.2 $(BUILDROOT)$(libdir)
$(RM) $(BUILDROOT)$(libdir)/libmxml.so
$(LN) libmxml.so.2 $(BUILDROOT)$(libdir)/libmxml.so
$(LDCONFIG)
install-libmxml4.a: libmxml4.a
echo Installing libmxml4.a to $(BUILDROOT)$(libdir)...
$(INSTALL_DIR) $(BUILDROOT)$(libdir)
$(INSTALL_LIB) libmxml4.a $(BUILDROOT)$(libdir)
$(RANLIB) $(BUILDROOT)$(libdir)/libmxml4.a
install-libmxml4.so.2: libmxml4.so.2
echo Installing libmxml4.so to $(BUILDROOT)$(libdir)...
$(INSTALL_DIR) $(BUILDROOT)$(libdir)
$(INSTALL_LIB) libmxml4.so.2 $(BUILDROOT)$(libdir)
$(RM) $(BUILDROOT)$(libdir)/libmxml4.so
$(LN) libmxml4.so.2 $(BUILDROOT)$(libdir)/libmxml4.so
$(LDCONFIG)
#
# Uninstall everything...
#
uninstall: uninstall-$(LIBMXML) uninstall-libmxml4.a
echo Uninstalling documentation from $(BUILDROOT)$(docdir)...
$(RM) -r $(BUILDROOT)$(docdir)
echo Uninstalling headers from $(BUILDROOT)$(includedir)...
$(RM) $(BUILDROOT)$(includedir)/mxml.h
echo Uninstalling pkgconfig files from $(BUILDROOT)$(libdir)/pkgconfig...
$(RM) $(BUILDROOT)$(libdir)/pkgconfig/$(MXML_PC)
echo Uninstalling man pages from $(BUILDROOT)$(mandir)...
$(RM) $(BUILDROOT)$(mandir)/man3/$(MXML_MAN)
uninstall-libmxml.a:
echo Uninstalling libmxml.a from $(BUILDROOT)$(libdir)...
$(RM) $(BUILDROOT)$(libdir)/libmxml.a
uninstall-libmxml.so.2:
echo Uninstalling libmxml.so from $(BUILDROOT)$(libdir)...
$(RM) $(BUILDROOT)$(libdir)/libmxml.so
$(RM) $(BUILDROOT)$(libdir)/libmxml.so.2
$(LDCONFIG)
uninstall-libmxml4.a:
echo Uninstalling libmxml4.a from $(BUILDROOT)$(libdir)...
$(RM) $(BUILDROOT)$(libdir)/libmxml4.a
uninstall-libmxml4.so.2:
echo Uninstalling libmxml4.so from $(BUILDROOT)$(libdir)...
$(RM) $(BUILDROOT)$(libdir)/libmxml4.so
$(RM) $(BUILDROOT)$(libdir)/libmxml4.so.2
$(LDCONFIG)
#
# Test everything...
#
test: testmxml
@echo Testing library...
./testmxml ../test.xml temp1s.xml >temp1.xml
./testmxml temp1.xml temp2s.xml >temp2.xml
@if cmp temp1.xml temp2.xml; then \
echo Stdio file test passed!; \
$(RM) temp2.xml temp2s.xml; \
else \
echo Stdio file test failed!; \
exit 1; \
fi
@if cmp temp1.xml temp1s.xml; then \
echo String test passed!; \
$(RM) temp1.xml temp1s.xml; \
else \
echo String test failed!; \
exit 1; \
fi
@if cmp ../test.xml ../test.xmlfd; then \
echo File descriptor test passed!; \
$(RM) test.xmlfd temp1.xmlfd; \
else \
echo File descriptor test failed!; \
exit 1; \
fi
#
# libmxml.a
#
libmxml.a libmxml4.a: $(LIBOBJS)
echo Creating $@...
$(RM) $@
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
$(RANLIB) $@
#
# libmxml.so.2
#
libmxml.so.2 libmxml4.so.2: $(LIBOBJS)
echo Creating $@...
$(DSO) $(DSOFLAGS) -o $@ $(LIBOBJS) $(LIBS)
$(RM) `basename $@ .2`
$(LN) $@ `basename $@ .2`
#
# testmxml
#
testmxml: $(LIBMXML_STATIC) testmxml.o
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testmxml.o $(LIBMXML_STATIC) $(LIBS)
#
# Documentation (depends on separate codedoc utility)
#
.PHONY: doc
doc: ../mxml.h $(PUBLIBOBJS:.o=.c) \
../doc/body.md ../doc/body.man ../doc/footer.man \
../doc/mxml-cover.png
echo Generating API documentation...
$(RM) mxml.xml
codedoc --body ../doc/body.md \
--coverimage ../doc/mxml-cover.png \
mxml.xml mxml.h $(PUBLIBOBJS:.o=.c) >../doc/mxml.html
codedoc --body ../doc/body.md \
--coverimage ../doc/mxml-cover.png \
--epub ../doc/mxml.epub mxml.xml
codedoc --man mxml --title "Mini-XML API" \
--body ../doc/body.man --footer ../doc/footer.man \
mxml.xml >../doc/mxml.3
$(RM) mxml.xml
#
# All object files depend on the makefile and config header...
#
mxml-attr.o: ../mxml-attr.c ../mxml.h ../mxml-private.h Makefile config.h
echo Compiling $<
$(CC) $(CFLAGS) -c -o $@ $<
mxml-file.o: ../mxml-file.c ../mxml.h ../mxml-private.h Makefile config.h
echo Compiling $<
$(CC) $(CFLAGS) -c -o $@ $<
mxml-get.o: ../mxml-get.c ../mxml.h ../mxml-private.h Makefile config.h
echo Compiling $<
$(CC) $(CFLAGS) -c -o $@ $<
mxml-index.o: ../mxml-index.c ../mxml.h ../mxml-private.h Makefile config.h
echo Compiling $<
$(CC) $(CFLAGS) -c -o $@ $<
mxml-node.o: ../mxml-node.c ../mxml.h ../mxml-private.h Makefile config.h
echo Compiling $<
$(CC) $(CFLAGS) -c -o $@ $<
mxml-options.o: ../mxml-options.c ../mxml.h ../mxml-private.h Makefile config.h
echo Compiling $<
$(CC) $(CFLAGS) -c -o $@ $<
mxml-private.o: ../mxml-private.c ../mxml.h ../mxml-private.h Makefile config.h
echo Compiling $<
$(CC) $(CFLAGS) -c -o $@ $<
mxml-search.o: ../mxml-search.c ../mxml.h ../mxml-private.h Makefile config.h
echo Compiling $<
$(CC) $(CFLAGS) -c -o $@ $<
mxml-set.o: ../mxml-set.c ../mxml.h ../mxml-private.h Makefile config.h
echo Compiling $<
$(CC) $(CFLAGS) -c -o $@ $<
testmxml.o: ../testmxml.c ../mxml.h ../mxml-private.h Makefile config.h
echo Compiling $<
$(CC) $(CFLAGS) -c -o $@ $<

42
linux/config.h Normal file
View File

@ -0,0 +1,42 @@
//
// Linux configuration file for Mini-XML, a small XML file parsing library.
//
// https://www.msweet.org/mxml
//
// Copyright © 2003-2024 by Michael R Sweet.
//
// Licensed under Apache License v2.0. See the file "LICENSE" for more
// information.
//
#ifndef MXML_CONFIG_H
# define MXML_CONFIG_H
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <stdarg.h>
# include <ctype.h>
//
// Version number
//
# define MXML_VERSION "Mini-XML v4.0.4"
//
// Inline function support
//
# define inline
//
// Have <pthread.h>?
//
# define HAVE_PTHREAD_H 1
#endif // !MXML_CONFIG_H

10
linux/mxml4.pc Normal file
View File

@ -0,0 +1,10 @@
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include/libmxml4
Name: Mini-XML
Description: Lightweight XML support library
Version: 4.0.4
Libs: -lmxml4
Cflags: -I${includedir}

View File

@ -49,6 +49,16 @@ if ! grep -q "Version: $version" mxml.spec; then
status=1
fi
if test "$(grep MXML_VERSION linux/config.h | awk '${print $5}')" != "v$version\""; then
echo "Update MXML_VERSION in linux/config.h."
status=1
fi
if test "$(grep MXML_VERSION vcnet/config.h | awk '${print $5}')" != "v$version\""; then
echo "Update MXML_VERSION in vcnet/config.h."
status=1
fi
if ! grep -q "<version>$version</version>" vcnet/libmxml4_native.nuspec; then
echo "Update vcnet/libmxml4_native.nuspec."
status=1
@ -63,6 +73,11 @@ if ! grep -q "<version>$version</version>" vcnet/libmxml4_native.redist.nuspec;
status=1
fi
if test "$(grep MXML_VERSION xcode/config.h | awk '${print $5}')" != "v$version\""; then
echo "Update MXML_VERSION in xcode/config.h."
status=1
fi
if test $status = 1; then
exit 1
fi

View File

@ -232,7 +232,7 @@ mxml_set_attr(mxml_node_t *node, // I - Element node
const char *name, // I - Attribute name
char *value) // I - Attribute value
{
int i; // Looping var
size_t i; // Looping var
_mxml_attr_t *attr; // New attribute

View File

@ -18,7 +18,7 @@
static int index_compare(mxml_index_t *ind, mxml_node_t *first, mxml_node_t *second);
static int index_find(mxml_index_t *ind, const char *element, const char *value, mxml_node_t *node);
static void index_sort(mxml_index_t *ind, int left, int right);
static void index_sort(mxml_index_t *ind, size_t left, size_t right);
//
@ -80,8 +80,8 @@ mxmlIndexFind(mxml_index_t *ind, // I - Index to search
const char *element, // I - Element name to find, if any
const char *value) // I - Attribute value, if any
{
int diff, // Difference between names
current, // Current entity in search
int diff; // Difference between names
size_t current, // Current entity in search
first, // First entity in search
last; // Last entity in search
@ -369,12 +369,12 @@ index_find(mxml_index_t *ind, // I - Index
static void
index_sort(mxml_index_t *ind, // I - Index to sort
int left, // I - Left node in partition
int right) // I - Right node in partition
size_t left, // I - Left node in partition
size_t right) // I - Right node in partition
{
mxml_node_t *pivot, // Pivot node
*temp; // Swap node
int templ, // Temporary left node
size_t templ, // Temporary left node
tempr; // Temporary right node

View File

@ -186,14 +186,13 @@ mxmlGetRefCount(mxml_node_t *node) // I - Node
// '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 currently use the
// `MXML_TYPE_ELEMENT` type.
// list. The constant `NULL` 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.
//
mxml_node_t * // O - New node
mxmlNewCDATA(mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
mxmlNewCDATA(mxml_node_t *parent, // I - Parent node or `NULL`
const char *data) // I - Data string
{
mxml_node_t *node; // New node
@ -222,14 +221,14 @@ mxmlNewCDATA(mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
//
// 'mxmlNewCDATAf()' - Create a new formatted 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 opaque string node has no parent. The format string must be
// nul-terminated and is formatted into the new node.
// The new CDATA node is added to the end of the specified parent's child list.
// The constant `NULL` can be used to specify that the new opaque string node
// has no parent. The format string must be nul-terminated and is formatted
// into the new node.
//
mxml_node_t * // O - New node
mxmlNewCDATAf(mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
mxmlNewCDATAf(mxml_node_t *parent, // I - Parent node or `NULL`
const char *format, // I - Printf-style format string
...) // I - Additional args as needed
{
@ -262,13 +261,13 @@ mxmlNewCDATAf(mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
// 'mxmlNewComment()' - Create a new comment node.
//
// The new comment 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
// comment node has no parent. The comment string must be nul-terminated and
// is copied into the new node.
// list. The constant `NULL` can be used to specify that the new comment node
// has no parent. The comment string must be nul-terminated and is copied into
// the new node.
//
mxml_node_t * // O - New node
mxmlNewComment(mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
mxmlNewComment(mxml_node_t *parent, // I - Parent node or `NULL`
const char *comment) // I - Comment string
{
mxml_node_t *node; // New node
@ -298,13 +297,13 @@ mxmlNewComment(mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
// 'mxmlNewCommentf()' - Create a new formatted comment string node.
//
// The new comment string node is added to the end of the specified parent's
// child list. The constant `MXML_NO_PARENT` can be used to specify that
// the new opaque string node has no parent. The format string must be
// nul-terminated and is formatted into the new node.
// child list. The constant `NULL` can be used to specify that the new opaque
// string node has no parent. The format string must be nul-terminated and is
// formatted into the new node.
//
mxml_node_t * // O - New node
mxmlNewCommentf(mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
mxmlNewCommentf(mxml_node_t *parent, // I - Parent node or `NULL`
const char *format, // I - Printf-style format string
...) // I - Additional args as needed
{
@ -343,7 +342,7 @@ mxmlNewCommentf(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`
mxml_node_t *parent, // I - Parent node or `NULL`
void *data, // I - Pointer to data
mxml_custfree_cb_t free_cb, // I - Free callback function or `NULL` if none needed
void *free_cbdata) // I - Free callback data
@ -369,14 +368,14 @@ mxmlNewCustom(
// 'mxmlNewDeclaration()' - Create a new declaraction node.
//
// The new declaration 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
// list. The constant `NULL` can be used to specify that the new
// declaration node has no parent. The declaration string must be nul-
// terminated and is copied into the new node.
//
mxml_node_t * // O - New node
mxmlNewDeclaration(
mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
mxml_node_t *parent, // I - Parent node or `NULL`
const char *declaration) // I - Declaration string
{
mxml_node_t *node; // New node
@ -406,14 +405,14 @@ mxmlNewDeclaration(
// 'mxmlNewDeclarationf()' - Create a new formatted declaration node.
//
// The new declaration node is added to the end of the specified parent's
// child list. The constant `MXML_NO_PARENT` can be used to specify that
// child list. The constant `NULL` can be used to specify that
// the new opaque string node has no parent. The format string must be
// nul-terminated and is formatted into the new node.
//
mxml_node_t * // O - New node
mxmlNewDeclarationf(
mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
mxml_node_t *parent, // I - Parent node or `NULL`
const char *format, // I - Printf-style format string
...) // I - Additional args as needed
{
@ -446,13 +445,13 @@ mxmlNewDeclarationf(
// 'mxmlNewDirective()' - Create a new processing instruction node.
//
// The new processing instruction 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 processing instruction node has no parent. The data string must
// be nul-terminated and is copied into the new node.
// parent's child list. The constant `NULL` can be used to specify that the new
// processing instruction node has no parent. The data string must be
// nul-terminated and is copied into the new node.
//
mxml_node_t * // O - New node
mxmlNewDirective(mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
mxmlNewDirective(mxml_node_t *parent, // I - Parent node or `NULL`
const char *directive)// I - Directive string
{
mxml_node_t *node; // New node
@ -481,14 +480,14 @@ mxmlNewDirective(mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
//
// 'mxmlNewDirectivef()' - Create a new formatted processing instruction node.
//
// The new processing instruction node is added to the end of the specified parent's
// child list. The constant `MXML_NO_PARENT` can be used to specify that
// the new opaque string node has no parent. The format string must be
// The new processing instruction node is added to the end of the specified
// parent's child list. The constant `NULL` can be used to specify that the new
// opaque string node has no parent. The format string must be
// nul-terminated and is formatted into the new node.
//
mxml_node_t * // O - New node
mxmlNewDirectivef(mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
mxmlNewDirectivef(mxml_node_t *parent, // I - Parent node or `NULL`
const char *format, // I - Printf-style format string
...) // I - Additional args as needed
{
@ -521,12 +520,12 @@ mxmlNewDirectivef(mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
// 'mxmlNewElement()' - Create a new element node.
//
// The new element node is added to the end of the specified parent's child
// list. The constant `MXML_NO_PARENT` can be used to specify that the new
// element node has no parent.
// list. The constant `NULL` can be used to specify that the new element node
// has no parent.
//
mxml_node_t * // O - New node
mxmlNewElement(mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
mxmlNewElement(mxml_node_t *parent, // I - Parent node or `NULL`
const char *name) // I - Name of element
{
mxml_node_t *node; // New node
@ -550,12 +549,12 @@ mxmlNewElement(mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
// 'mxmlNewInteger()' - Create a new integer node.
//
// The new integer node is added to the end of the specified parent's child
// list. The constant `MXML_NO_PARENT` can be used to specify that the new
// integer node has no parent.
// list. The constant `NULL` can be used to specify that the new integer node
// has no parent.
//
mxml_node_t * // O - New node
mxmlNewInteger(mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
mxmlNewInteger(mxml_node_t *parent, // I - Parent node or `NULL`
long integer) // I - Integer value
{
mxml_node_t *node; // New node
@ -575,13 +574,13 @@ mxmlNewInteger(mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
// 'mxmlNewOpaque()' - Create a new opaque string.
//
// The new opaque string node is added to the end of the specified parent's
// child list. The constant `MXML_NO_PARENT` can be used to specify that
// the new opaque string node has no parent. The opaque string must be nul-
// terminated and is copied into the new node.
// child list. The constant `NULL` can be used to specify that the new opaque
// string node has no parent. The opaque string must be nul-terminated and is
// copied into the new node.
//
mxml_node_t * // O - New node
mxmlNewOpaque(mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
mxmlNewOpaque(mxml_node_t *parent, // I - Parent node or `NULL`
const char *opaque) // I - Opaque string
{
mxml_node_t *node; // New node
@ -605,13 +604,13 @@ mxmlNewOpaque(mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
// 'mxmlNewOpaquef()' - Create a new formatted opaque string node.
//
// The new opaque string node is added to the end of the specified parent's
// child list. The constant `MXML_NO_PARENT` can be used to specify that
// the new opaque string node has no parent. The format string must be
// nul-terminated and is formatted into the new node.
// child list. The constant `NULL` can be used to specify that the new opaque
// string node has no parent. The format string must be nul-terminated and is
// formatted into the new node.
//
mxml_node_t * // O - New node
mxmlNewOpaquef(mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
mxmlNewOpaquef(mxml_node_t *parent, // I - Parent node or `NULL`
const char *format, // I - Printf-style format string
...) // I - Additional args as needed
{
@ -644,12 +643,12 @@ mxmlNewOpaquef(mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
// 'mxmlNewReal()' - Create a new real number node.
//
// The new real number node is added to the end of the specified parent's
// child list. The constant `MXML_NO_PARENT` can be used to specify that
// the new real number node has no parent.
// child list. The constant `NULL` can be used to specify that the new real
// number node has no parent.
//
mxml_node_t * // O - New node
mxmlNewReal(mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
mxmlNewReal(mxml_node_t *parent, // I - Parent node or `NULL`
double real) // I - Real number value
{
mxml_node_t *node; // New node
@ -669,14 +668,14 @@ mxmlNewReal(mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
// 'mxmlNewText()' - Create a new text fragment node.
//
// The new text node is added to the end of the specified parent's child
// list. The constant `MXML_NO_PARENT` can be used to specify that the new
// text node has no parent. The whitespace parameter is used to specify
// whether leading whitespace is present before the node. The text
// string must be nul-terminated and is copied into the new node.
// list. The constant `NULL` can be used to specify that the new text node has
// no parent. The whitespace parameter is used to specify whether leading
// whitespace is present before the node. The text string must be
// nul-terminated and is copied into the new node.
//
mxml_node_t * // O - New node
mxmlNewText(mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
mxmlNewText(mxml_node_t *parent, // I - Parent node or `NULL`
bool whitespace, // I - `true` = leading whitespace, `false` = no whitespace
const char *string) // I - String
{
@ -704,14 +703,14 @@ mxmlNewText(mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
// 'mxmlNewTextf()' - Create a new formatted text fragment node.
//
// The new text node is added to the end of the specified parent's child
// list. The constant `MXML_NO_PARENT` can be used to specify that the new
// text node has no parent. The whitespace parameter is used to specify
// whether leading whitespace is present before the node. The format
// string must be nul-terminated and is formatted into the new node.
// list. The constant `NULL` can be used to specify that the new text node has
// no parent. The whitespace parameter is used to specify whether leading
// whitespace is present before the node. The format string must be
// nul-terminated and is formatted into the new node.
//
mxml_node_t * // O - New node
mxmlNewTextf(mxml_node_t *parent, // I - Parent node or `MXML_NO_PARENT`
mxmlNewTextf(mxml_node_t *parent, // I - Parent node or `NULL`
bool whitespace, // I - `true` = leading whitespace, `false` = no whitespace
const char *format, // I - Printf-style format string
...) // I - Additional args as needed
@ -811,9 +810,13 @@ mxmlRelease(mxml_node_t *node) // I - Node
mxmlDelete(node);
return (0);
}
else if (node->ref_count < INT_MAX)
{
return ((int)node->ref_count);
}
else
{
return (node->ref_count);
return (INT_MAX);
}
}
else
@ -831,9 +834,18 @@ int // O - New reference count
mxmlRetain(mxml_node_t *node) // I - Node
{
if (node)
return (++ node->ref_count);
{
node->ref_count ++;
if (node->ref_count < INT_MAX)
return ((int)node->ref_count);
else
return (INT_MAX);
}
else
{
return (-1);
}
}

View File

@ -67,13 +67,6 @@
# define inline _inline
//
// Long long support
//
# define HAVE_LONG_LONG_INT 1
//
// Have <pthread.h>?
//

View File

@ -1,9 +1,9 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>libmxml2_native</id>
<id>libmxml4_native</id>
<title>Small XML File Parsing Library for VS2019+</title>
<version>4.0.3</version>
<version>4.0.4</version>
<authors>Michael R Sweet</authors>
<owners>michaelrsweet</owners>
<projectUrl>https://github.com/michaelrsweet/mxml</projectUrl>
@ -16,15 +16,15 @@
<copyright>Copyright © 2003-2024 by Michael R Sweet</copyright>
<tags>xml</tags>
<dependencies>
<dependency id="libmxml2_native.redist" version="4.0.3" />
<dependency id="libmxml4_native.redist" version="4.0.4" />
</dependencies>
</metadata>
<files>
<file src="..\doc\mxml-128.png" target="build\native" />
<file src="..\README.md" target="build\native" />
<file src="libmxml2_native.props" target="build\native" />
<file src="libmxml4_native.props" target="build\native" />
<file src="..\mxml.h" target="build\native\include" />
<!--<file src="Win32\**\libmxml2.lib" target="build\native\lib\Win32" />-->
<file src="x64\**\libmxml2.lib" target="build\native\lib\x64" />
<!--<file src="Win32\**\mxml4.lib" target="build\native\lib\Win32" />-->
<file src="x64\**\mxml4.lib" target="build\native\lib\x64" />
</files>
</package>

View File

@ -5,7 +5,7 @@
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalDependencies>$(MSBuildThisFileDirectory)\lib\$(Platform)\$(Configuration)\libmxml2.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>$(MSBuildThisFileDirectory)\lib\$(Platform)\$(Configuration)\mxml4.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
</Project>

View File

@ -1,9 +1,9 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>libmxml2_native.redist</id>
<id>libmxml4_native.redist</id>
<title>Small XML File Parsing Library for VS2019+ Redist</title>
<version>4.0.3</version>
<version>4.0.4</version>
<authors>Michael R Sweet</authors>
<owners>michaelrsweet</owners>
<projectUrl>https://github.com/michaelrsweet/mxml</projectUrl>
@ -19,7 +19,7 @@
<files>
<file src="..\doc\mxml-128.png" target="build\native" />
<file src="..\README.md" target="build\native" />
<!--<file src="Win32\**\libmxml2.dll" target="build\native\bin\Win32" />-->
<file src="x64\**\libmxml2.dll" target="build\native\bin\x64" />
<!--<file src="Win32\**\mxml4.dll" target="build\native\bin\Win32" />-->
<file src="x64\**\mxml4.dll" target="build\native\bin\x64" />
</files>
</package>

View File

@ -32,13 +32,6 @@
# define inline
//
// Long long support
//
# define HAVE_LONG_LONG_INT 1
//
// Have <pthread.h>?
//