aboutsummaryrefslogtreecommitdiff
path: root/libxml2-2.9.10/doc/examples
diff options
context:
space:
mode:
Diffstat (limited to 'libxml2-2.9.10/doc/examples')
-rw-r--r--libxml2-2.9.10/doc/examples/Makefile.am136
-rw-r--r--libxml2-2.9.10/doc/examples/Makefile.in1026
-rw-r--r--libxml2-2.9.10/doc/examples/examples.xml751
-rw-r--r--libxml2-2.9.10/doc/examples/examples.xsl174
-rw-r--r--libxml2-2.9.10/doc/examples/index.html14
-rwxr-xr-xlibxml2-2.9.10/doc/examples/index.py315
-rw-r--r--libxml2-2.9.10/doc/examples/io1.c166
-rw-r--r--libxml2-2.9.10/doc/examples/io1.res5
-rw-r--r--libxml2-2.9.10/doc/examples/io2.c58
-rw-r--r--libxml2-2.9.10/doc/examples/io2.res2
-rw-r--r--libxml2-2.9.10/doc/examples/parse1.c56
-rw-r--r--libxml2-2.9.10/doc/examples/parse2.c72
-rw-r--r--libxml2-2.9.10/doc/examples/parse3.c60
-rw-r--r--libxml2-2.9.10/doc/examples/parse4.c143
-rw-r--r--libxml2-2.9.10/doc/examples/reader1.c107
-rw-r--r--libxml2-2.9.10/doc/examples/reader1.res14
-rw-r--r--libxml2-2.9.10/doc/examples/reader2.c122
-rw-r--r--libxml2-2.9.10/doc/examples/reader3.c120
-rw-r--r--libxml2-2.9.10/doc/examples/reader3.res13
-rw-r--r--libxml2-2.9.10/doc/examples/reader4.c122
-rw-r--r--libxml2-2.9.10/doc/examples/reader4.res3
-rw-r--r--libxml2-2.9.10/doc/examples/test1.xml1
-rw-r--r--libxml2-2.9.10/doc/examples/test2.xml13
-rw-r--r--libxml2-2.9.10/doc/examples/test3.xml39
-rw-r--r--libxml2-2.9.10/doc/examples/testWriter.c1198
-rw-r--r--libxml2-2.9.10/doc/examples/tree1.c94
-rw-r--r--libxml2-2.9.10/doc/examples/tree1.res4
-rw-r--r--libxml2-2.9.10/doc/examples/tree2.c117
-rw-r--r--libxml2-2.9.10/doc/examples/tree2.res18
-rw-r--r--libxml2-2.9.10/doc/examples/tst.xml7
-rw-r--r--libxml2-2.9.10/doc/examples/writer.xml2
-rw-r--r--libxml2-2.9.10/doc/examples/xpath1.c250
-rw-r--r--libxml2-2.9.10/doc/examples/xpath1.res5
-rw-r--r--libxml2-2.9.10/doc/examples/xpath2.c190
-rw-r--r--libxml2-2.9.10/doc/examples/xpath2.res30
35 files changed, 5447 insertions, 0 deletions
diff --git a/libxml2-2.9.10/doc/examples/Makefile.am b/libxml2-2.9.10/doc/examples/Makefile.am
new file mode 100644
index 0000000..ef59fce
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/Makefile.am
@@ -0,0 +1,136 @@
+##
+## This file is auto-generated by index.py
+## DO NOT EDIT !!!
+##
+
+AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir)/include
+AM_CFLAGS = $(THREAD_CFLAGS) $(Z_CFLAGS)
+LDADD = $(RDL_LIBS) $(STATIC_BINARIES) $(top_builddir)/libxml2.la $(THREAD_LIBS) $(Z_LIBS) $(ICONV_LIBS) -lm $(WIN32_EXTRA_LIBADD)
+
+CLEANFILES = *.tmp
+
+if REBUILD_DOCS
+rebuild: examples.xml index.html
+.PHONY: rebuild
+
+examples.xml: index.py $(check_PROGRAMS:=.c)
+ cd $(srcdir) && $(PYTHON) index.py
+ $(MAKE) Makefile
+
+index.html: examples.xml examples.xsl
+ cd $(srcdir) && xsltproc examples.xsl examples.xml && echo "Rebuilt web page"
+ -cd $(srcdir) && xmllint --valid --noout index.html
+endif
+
+install-data-local:
+ $(MKDIR_P) $(DESTDIR)$(HTML_DIR)
+ -$(INSTALL) -m 0644 $(srcdir)/*.html $(srcdir)/*.c $(srcdir)/*.xml $(srcdir)/*.xsl $(srcdir)/*.res $(DESTDIR)$(HTML_DIR)
+
+clean-local:
+ test -f Makefile.am || rm -f test?.xml
+
+EXTRA_DIST = \
+ examples.xml \
+ examples.xsl \
+ index.html \
+ index.py \
+ io1.res \
+ io2.res \
+ reader1.res \
+ reader3.res \
+ reader4.res \
+ test1.xml \
+ test2.xml \
+ test3.xml \
+ tree1.res \
+ tree2.res \
+ tst.xml \
+ writer.xml \
+ xpath1.res \
+ xpath2.res
+
+check_PROGRAMS = \
+ io1 \
+ io2 \
+ parse1 \
+ parse2 \
+ parse3 \
+ parse4 \
+ reader1 \
+ reader2 \
+ reader3 \
+ reader4 \
+ testWriter \
+ tree1 \
+ tree2 \
+ xpath1 \
+ xpath2
+
+io1_SOURCES = io1.c
+
+io2_SOURCES = io2.c
+
+parse1_SOURCES = parse1.c
+
+parse2_SOURCES = parse2.c
+
+parse3_SOURCES = parse3.c
+
+parse4_SOURCES = parse4.c
+
+reader1_SOURCES = reader1.c
+
+reader2_SOURCES = reader2.c
+
+reader3_SOURCES = reader3.c
+
+reader4_SOURCES = reader4.c
+
+testWriter_SOURCES = testWriter.c
+
+tree1_SOURCES = tree1.c
+
+tree2_SOURCES = tree2.c
+
+xpath1_SOURCES = xpath1.c
+
+xpath2_SOURCES = xpath2.c
+
+valgrind:
+ $(MAKE) CHECKER='valgrind' tests
+
+tests: $(check_PROGRAMS)
+ @test -f Makefile.am || test -f test1.xml || $(LN_S) $(srcdir)/test?.xml .
+ @(echo '## examples regression tests')
+ @(echo > .memdump)
+ @$(CHECKER) ./io1 > io1.tmp && diff io1.tmp $(srcdir)/io1.res
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./io2 > io2.tmp && diff io2.tmp $(srcdir)/io2.res
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./parse1 test1.xml
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./parse2 test2.xml
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./parse3
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./parse4 test3.xml
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./reader1 test2.xml > reader1.tmp && diff reader1.tmp $(srcdir)/reader1.res
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./reader2 test2.xml > reader1.tmp && diff reader1.tmp $(srcdir)/reader1.res
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./reader3 > reader3.tmp && diff reader3.tmp $(srcdir)/reader3.res
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./reader4 test1.xml test2.xml test3.xml > reader4.tmp && diff reader4.tmp $(srcdir)/reader4.res
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./testWriter && for i in 1 2 3 4 ; do diff $(srcdir)/writer.xml writer$$i.tmp || break ; done
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./tree1 test2.xml > tree1.tmp && diff tree1.tmp $(srcdir)/tree1.res
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./tree2 > tree2.tmp && diff tree2.tmp $(srcdir)/tree2.res
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./xpath1 test3.xml '//child2' > xpath1.tmp && diff xpath1.tmp $(srcdir)/xpath1.res
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./xpath2 test3.xml '//discarded' discarded > xpath2.tmp && diff xpath2.tmp $(srcdir)/xpath2.res
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @rm *.tmp
diff --git a/libxml2-2.9.10/doc/examples/Makefile.in b/libxml2-2.9.10/doc/examples/Makefile.in
new file mode 100644
index 0000000..9e56e32
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/Makefile.in
@@ -0,0 +1,1026 @@
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+check_PROGRAMS = io1$(EXEEXT) io2$(EXEEXT) parse1$(EXEEXT) \
+ parse2$(EXEEXT) parse3$(EXEEXT) parse4$(EXEEXT) \
+ reader1$(EXEEXT) reader2$(EXEEXT) reader3$(EXEEXT) \
+ reader4$(EXEEXT) testWriter$(EXEEXT) tree1$(EXEEXT) \
+ tree2$(EXEEXT) xpath1$(EXEEXT) xpath2$(EXEEXT)
+subdir = doc/examples
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am_io1_OBJECTS = io1.$(OBJEXT)
+io1_OBJECTS = $(am_io1_OBJECTS)
+io1_LDADD = $(LDADD)
+am__DEPENDENCIES_1 =
+io1_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(top_builddir)/libxml2.la $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+am_io2_OBJECTS = io2.$(OBJEXT)
+io2_OBJECTS = $(am_io2_OBJECTS)
+io2_LDADD = $(LDADD)
+io2_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(top_builddir)/libxml2.la $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_parse1_OBJECTS = parse1.$(OBJEXT)
+parse1_OBJECTS = $(am_parse1_OBJECTS)
+parse1_LDADD = $(LDADD)
+parse1_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(top_builddir)/libxml2.la $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_parse2_OBJECTS = parse2.$(OBJEXT)
+parse2_OBJECTS = $(am_parse2_OBJECTS)
+parse2_LDADD = $(LDADD)
+parse2_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(top_builddir)/libxml2.la $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_parse3_OBJECTS = parse3.$(OBJEXT)
+parse3_OBJECTS = $(am_parse3_OBJECTS)
+parse3_LDADD = $(LDADD)
+parse3_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(top_builddir)/libxml2.la $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_parse4_OBJECTS = parse4.$(OBJEXT)
+parse4_OBJECTS = $(am_parse4_OBJECTS)
+parse4_LDADD = $(LDADD)
+parse4_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(top_builddir)/libxml2.la $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_reader1_OBJECTS = reader1.$(OBJEXT)
+reader1_OBJECTS = $(am_reader1_OBJECTS)
+reader1_LDADD = $(LDADD)
+reader1_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(top_builddir)/libxml2.la $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_reader2_OBJECTS = reader2.$(OBJEXT)
+reader2_OBJECTS = $(am_reader2_OBJECTS)
+reader2_LDADD = $(LDADD)
+reader2_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(top_builddir)/libxml2.la $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_reader3_OBJECTS = reader3.$(OBJEXT)
+reader3_OBJECTS = $(am_reader3_OBJECTS)
+reader3_LDADD = $(LDADD)
+reader3_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(top_builddir)/libxml2.la $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_reader4_OBJECTS = reader4.$(OBJEXT)
+reader4_OBJECTS = $(am_reader4_OBJECTS)
+reader4_LDADD = $(LDADD)
+reader4_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(top_builddir)/libxml2.la $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_testWriter_OBJECTS = testWriter.$(OBJEXT)
+testWriter_OBJECTS = $(am_testWriter_OBJECTS)
+testWriter_LDADD = $(LDADD)
+testWriter_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(top_builddir)/libxml2.la $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_tree1_OBJECTS = tree1.$(OBJEXT)
+tree1_OBJECTS = $(am_tree1_OBJECTS)
+tree1_LDADD = $(LDADD)
+tree1_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(top_builddir)/libxml2.la $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_tree2_OBJECTS = tree2.$(OBJEXT)
+tree2_OBJECTS = $(am_tree2_OBJECTS)
+tree2_LDADD = $(LDADD)
+tree2_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(top_builddir)/libxml2.la $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_xpath1_OBJECTS = xpath1.$(OBJEXT)
+xpath1_OBJECTS = $(am_xpath1_OBJECTS)
+xpath1_LDADD = $(LDADD)
+xpath1_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(top_builddir)/libxml2.la $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_xpath2_OBJECTS = xpath2.$(OBJEXT)
+xpath2_OBJECTS = $(am_xpath2_OBJECTS)
+xpath2_LDADD = $(LDADD)
+xpath2_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(top_builddir)/libxml2.la $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/io1.Po ./$(DEPDIR)/io2.Po \
+ ./$(DEPDIR)/parse1.Po ./$(DEPDIR)/parse2.Po \
+ ./$(DEPDIR)/parse3.Po ./$(DEPDIR)/parse4.Po \
+ ./$(DEPDIR)/reader1.Po ./$(DEPDIR)/reader2.Po \
+ ./$(DEPDIR)/reader3.Po ./$(DEPDIR)/reader4.Po \
+ ./$(DEPDIR)/testWriter.Po ./$(DEPDIR)/tree1.Po \
+ ./$(DEPDIR)/tree2.Po ./$(DEPDIR)/xpath1.Po \
+ ./$(DEPDIR)/xpath2.Po
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(io1_SOURCES) $(io2_SOURCES) $(parse1_SOURCES) \
+ $(parse2_SOURCES) $(parse3_SOURCES) $(parse4_SOURCES) \
+ $(reader1_SOURCES) $(reader2_SOURCES) $(reader3_SOURCES) \
+ $(reader4_SOURCES) $(testWriter_SOURCES) $(tree1_SOURCES) \
+ $(tree2_SOURCES) $(xpath1_SOURCES) $(xpath2_SOURCES)
+DIST_SOURCES = $(io1_SOURCES) $(io2_SOURCES) $(parse1_SOURCES) \
+ $(parse2_SOURCES) $(parse3_SOURCES) $(parse4_SOURCES) \
+ $(reader1_SOURCES) $(reader2_SOURCES) $(reader3_SOURCES) \
+ $(reader4_SOURCES) $(testWriter_SOURCES) $(tree1_SOURCES) \
+ $(tree2_SOURCES) $(xpath1_SOURCES) $(xpath2_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_THREAD_LIBS = @BASE_THREAD_LIBS@
+C14N_OBJ = @C14N_OBJ@
+CATALOG_OBJ = @CATALOG_OBJ@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+CYGWIN_EXTRA_LDFLAGS = @CYGWIN_EXTRA_LDFLAGS@
+CYGWIN_EXTRA_PYTHON_LIBADD = @CYGWIN_EXTRA_PYTHON_LIBADD@
+DEBUG_OBJ = @DEBUG_OBJ@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DOCB_OBJ = @DOCB_OBJ@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+EXTRA_CFLAGS = @EXTRA_CFLAGS@
+FGREP = @FGREP@
+FTP_OBJ = @FTP_OBJ@
+GREP = @GREP@
+HAVE_ISINF = @HAVE_ISINF@
+HAVE_ISNAN = @HAVE_ISNAN@
+HTML_DIR = @HTML_DIR@
+HTML_OBJ = @HTML_OBJ@
+HTTP_OBJ = @HTTP_OBJ@
+ICONV_LIBS = @ICONV_LIBS@
+ICU_CFLAGS = @ICU_CFLAGS@
+ICU_LIBS = @ICU_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBXML_MAJOR_VERSION = @LIBXML_MAJOR_VERSION@
+LIBXML_MICRO_VERSION = @LIBXML_MICRO_VERSION@
+LIBXML_MINOR_VERSION = @LIBXML_MINOR_VERSION@
+LIBXML_VERSION = @LIBXML_VERSION@
+LIBXML_VERSION_EXTRA = @LIBXML_VERSION_EXTRA@
+LIBXML_VERSION_INFO = @LIBXML_VERSION_INFO@
+LIBXML_VERSION_NUMBER = @LIBXML_VERSION_NUMBER@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+LZMA_CFLAGS = @LZMA_CFLAGS@
+LZMA_LIBS = @LZMA_LIBS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MODULE_EXTENSION = @MODULE_EXTENSION@
+MODULE_PLATFORM_LIBS = @MODULE_PLATFORM_LIBS@
+MV = @MV@
+M_LIBS = @M_LIBS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PYTHON = @PYTHON@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_SITE_PACKAGES = @PYTHON_SITE_PACKAGES@
+PYTHON_SUBDIR = @PYTHON_SUBDIR@
+PYTHON_TESTS = @PYTHON_TESTS@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+RDL_LIBS = @RDL_LIBS@
+READER_TEST = @READER_TEST@
+RELDATE = @RELDATE@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STATIC_BINARIES = @STATIC_BINARIES@
+STRIP = @STRIP@
+TAR = @TAR@
+TEST_C14N = @TEST_C14N@
+TEST_CATALOG = @TEST_CATALOG@
+TEST_DEBUG = @TEST_DEBUG@
+TEST_HTML = @TEST_HTML@
+TEST_MODULES = @TEST_MODULES@
+TEST_PATTERN = @TEST_PATTERN@
+TEST_PHTML = @TEST_PHTML@
+TEST_PUSH = @TEST_PUSH@
+TEST_REGEXPS = @TEST_REGEXPS@
+TEST_SAX = @TEST_SAX@
+TEST_SCHEMAS = @TEST_SCHEMAS@
+TEST_SCHEMATRON = @TEST_SCHEMATRON@
+TEST_THREADS = @TEST_THREADS@
+TEST_VALID = @TEST_VALID@
+TEST_VTIME = @TEST_VTIME@
+TEST_XINCLUDE = @TEST_XINCLUDE@
+TEST_XPATH = @TEST_XPATH@
+TEST_XPTR = @TEST_XPTR@
+THREAD_CFLAGS = @THREAD_CFLAGS@
+THREAD_LIBS = @THREAD_LIBS@
+VERSION = @VERSION@
+VERSION_SCRIPT_FLAGS = @VERSION_SCRIPT_FLAGS@
+WGET = @WGET@
+WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@
+WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@
+WIN32_EXTRA_PYTHON_LIBADD = @WIN32_EXTRA_PYTHON_LIBADD@
+WITH_C14N = @WITH_C14N@
+WITH_CATALOG = @WITH_CATALOG@
+WITH_DEBUG = @WITH_DEBUG@
+WITH_DOCB = @WITH_DOCB@
+WITH_FTP = @WITH_FTP@
+WITH_HTML = @WITH_HTML@
+WITH_HTTP = @WITH_HTTP@
+WITH_ICONV = @WITH_ICONV@
+WITH_ICU = @WITH_ICU@
+WITH_ISO8859X = @WITH_ISO8859X@
+WITH_LEGACY = @WITH_LEGACY@
+WITH_LZMA = @WITH_LZMA@
+WITH_MEM_DEBUG = @WITH_MEM_DEBUG@
+WITH_MODULES = @WITH_MODULES@
+WITH_OUTPUT = @WITH_OUTPUT@
+WITH_PATTERN = @WITH_PATTERN@
+WITH_PUSH = @WITH_PUSH@
+WITH_READER = @WITH_READER@
+WITH_REGEXPS = @WITH_REGEXPS@
+WITH_RUN_DEBUG = @WITH_RUN_DEBUG@
+WITH_SAX1 = @WITH_SAX1@
+WITH_SCHEMAS = @WITH_SCHEMAS@
+WITH_SCHEMATRON = @WITH_SCHEMATRON@
+WITH_THREADS = @WITH_THREADS@
+WITH_THREAD_ALLOC = @WITH_THREAD_ALLOC@
+WITH_TREE = @WITH_TREE@
+WITH_TRIO = @WITH_TRIO@
+WITH_VALID = @WITH_VALID@
+WITH_WRITER = @WITH_WRITER@
+WITH_XINCLUDE = @WITH_XINCLUDE@
+WITH_XPATH = @WITH_XPATH@
+WITH_XPTR = @WITH_XPTR@
+WITH_ZLIB = @WITH_ZLIB@
+XINCLUDE_OBJ = @XINCLUDE_OBJ@
+XMLLINT = @XMLLINT@
+XML_CFLAGS = @XML_CFLAGS@
+XML_INCLUDEDIR = @XML_INCLUDEDIR@
+XML_LIBDIR = @XML_LIBDIR@
+XML_LIBS = @XML_LIBS@
+XML_LIBTOOLLIBS = @XML_LIBTOOLLIBS@
+XML_PRIVATE_LIBS = @XML_PRIVATE_LIBS@
+XPATH_OBJ = @XPATH_OBJ@
+XPTR_OBJ = @XPTR_OBJ@
+XSLTPROC = @XSLTPROC@
+Z_CFLAGS = @Z_CFLAGS@
+Z_LIBS = @Z_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pythondir = @pythondir@
+runstatedir = @runstatedir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir)/include
+AM_CFLAGS = $(THREAD_CFLAGS) $(Z_CFLAGS)
+LDADD = $(RDL_LIBS) $(STATIC_BINARIES) $(top_builddir)/libxml2.la $(THREAD_LIBS) $(Z_LIBS) $(ICONV_LIBS) -lm $(WIN32_EXTRA_LIBADD)
+CLEANFILES = *.tmp
+EXTRA_DIST = \
+ examples.xml \
+ examples.xsl \
+ index.html \
+ index.py \
+ io1.res \
+ io2.res \
+ reader1.res \
+ reader3.res \
+ reader4.res \
+ test1.xml \
+ test2.xml \
+ test3.xml \
+ tree1.res \
+ tree2.res \
+ tst.xml \
+ writer.xml \
+ xpath1.res \
+ xpath2.res
+
+io1_SOURCES = io1.c
+io2_SOURCES = io2.c
+parse1_SOURCES = parse1.c
+parse2_SOURCES = parse2.c
+parse3_SOURCES = parse3.c
+parse4_SOURCES = parse4.c
+reader1_SOURCES = reader1.c
+reader2_SOURCES = reader2.c
+reader3_SOURCES = reader3.c
+reader4_SOURCES = reader4.c
+testWriter_SOURCES = testWriter.c
+tree1_SOURCES = tree1.c
+tree2_SOURCES = tree2.c
+xpath1_SOURCES = xpath1.c
+xpath2_SOURCES = xpath2.c
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/examples/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu doc/examples/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+io1$(EXEEXT): $(io1_OBJECTS) $(io1_DEPENDENCIES) $(EXTRA_io1_DEPENDENCIES)
+ @rm -f io1$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(io1_OBJECTS) $(io1_LDADD) $(LIBS)
+
+io2$(EXEEXT): $(io2_OBJECTS) $(io2_DEPENDENCIES) $(EXTRA_io2_DEPENDENCIES)
+ @rm -f io2$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(io2_OBJECTS) $(io2_LDADD) $(LIBS)
+
+parse1$(EXEEXT): $(parse1_OBJECTS) $(parse1_DEPENDENCIES) $(EXTRA_parse1_DEPENDENCIES)
+ @rm -f parse1$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(parse1_OBJECTS) $(parse1_LDADD) $(LIBS)
+
+parse2$(EXEEXT): $(parse2_OBJECTS) $(parse2_DEPENDENCIES) $(EXTRA_parse2_DEPENDENCIES)
+ @rm -f parse2$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(parse2_OBJECTS) $(parse2_LDADD) $(LIBS)
+
+parse3$(EXEEXT): $(parse3_OBJECTS) $(parse3_DEPENDENCIES) $(EXTRA_parse3_DEPENDENCIES)
+ @rm -f parse3$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(parse3_OBJECTS) $(parse3_LDADD) $(LIBS)
+
+parse4$(EXEEXT): $(parse4_OBJECTS) $(parse4_DEPENDENCIES) $(EXTRA_parse4_DEPENDENCIES)
+ @rm -f parse4$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(parse4_OBJECTS) $(parse4_LDADD) $(LIBS)
+
+reader1$(EXEEXT): $(reader1_OBJECTS) $(reader1_DEPENDENCIES) $(EXTRA_reader1_DEPENDENCIES)
+ @rm -f reader1$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(reader1_OBJECTS) $(reader1_LDADD) $(LIBS)
+
+reader2$(EXEEXT): $(reader2_OBJECTS) $(reader2_DEPENDENCIES) $(EXTRA_reader2_DEPENDENCIES)
+ @rm -f reader2$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(reader2_OBJECTS) $(reader2_LDADD) $(LIBS)
+
+reader3$(EXEEXT): $(reader3_OBJECTS) $(reader3_DEPENDENCIES) $(EXTRA_reader3_DEPENDENCIES)
+ @rm -f reader3$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(reader3_OBJECTS) $(reader3_LDADD) $(LIBS)
+
+reader4$(EXEEXT): $(reader4_OBJECTS) $(reader4_DEPENDENCIES) $(EXTRA_reader4_DEPENDENCIES)
+ @rm -f reader4$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(reader4_OBJECTS) $(reader4_LDADD) $(LIBS)
+
+testWriter$(EXEEXT): $(testWriter_OBJECTS) $(testWriter_DEPENDENCIES) $(EXTRA_testWriter_DEPENDENCIES)
+ @rm -f testWriter$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(testWriter_OBJECTS) $(testWriter_LDADD) $(LIBS)
+
+tree1$(EXEEXT): $(tree1_OBJECTS) $(tree1_DEPENDENCIES) $(EXTRA_tree1_DEPENDENCIES)
+ @rm -f tree1$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(tree1_OBJECTS) $(tree1_LDADD) $(LIBS)
+
+tree2$(EXEEXT): $(tree2_OBJECTS) $(tree2_DEPENDENCIES) $(EXTRA_tree2_DEPENDENCIES)
+ @rm -f tree2$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(tree2_OBJECTS) $(tree2_LDADD) $(LIBS)
+
+xpath1$(EXEEXT): $(xpath1_OBJECTS) $(xpath1_DEPENDENCIES) $(EXTRA_xpath1_DEPENDENCIES)
+ @rm -f xpath1$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(xpath1_OBJECTS) $(xpath1_LDADD) $(LIBS)
+
+xpath2$(EXEEXT): $(xpath2_OBJECTS) $(xpath2_DEPENDENCIES) $(EXTRA_xpath2_DEPENDENCIES)
+ @rm -f xpath2$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(xpath2_OBJECTS) $(xpath2_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/io1.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/io2.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse1.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse2.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse3.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse4.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reader1.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reader2.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reader3.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reader4.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testWriter.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tree1.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tree2.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xpath1.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xpath2.Po@am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+ @$(MKDIR_P) $(@D)
+ @echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -f ./$(DEPDIR)/io1.Po
+ -rm -f ./$(DEPDIR)/io2.Po
+ -rm -f ./$(DEPDIR)/parse1.Po
+ -rm -f ./$(DEPDIR)/parse2.Po
+ -rm -f ./$(DEPDIR)/parse3.Po
+ -rm -f ./$(DEPDIR)/parse4.Po
+ -rm -f ./$(DEPDIR)/reader1.Po
+ -rm -f ./$(DEPDIR)/reader2.Po
+ -rm -f ./$(DEPDIR)/reader3.Po
+ -rm -f ./$(DEPDIR)/reader4.Po
+ -rm -f ./$(DEPDIR)/testWriter.Po
+ -rm -f ./$(DEPDIR)/tree1.Po
+ -rm -f ./$(DEPDIR)/tree2.Po
+ -rm -f ./$(DEPDIR)/xpath1.Po
+ -rm -f ./$(DEPDIR)/xpath2.Po
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-data-local
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f ./$(DEPDIR)/io1.Po
+ -rm -f ./$(DEPDIR)/io2.Po
+ -rm -f ./$(DEPDIR)/parse1.Po
+ -rm -f ./$(DEPDIR)/parse2.Po
+ -rm -f ./$(DEPDIR)/parse3.Po
+ -rm -f ./$(DEPDIR)/parse4.Po
+ -rm -f ./$(DEPDIR)/reader1.Po
+ -rm -f ./$(DEPDIR)/reader2.Po
+ -rm -f ./$(DEPDIR)/reader3.Po
+ -rm -f ./$(DEPDIR)/reader4.Po
+ -rm -f ./$(DEPDIR)/testWriter.Po
+ -rm -f ./$(DEPDIR)/tree1.Po
+ -rm -f ./$(DEPDIR)/tree2.Po
+ -rm -f ./$(DEPDIR)/xpath1.Po
+ -rm -f ./$(DEPDIR)/xpath2.Po
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
+ clean-checkPROGRAMS clean-generic clean-libtool clean-local \
+ cscopelist-am ctags ctags-am distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-data-local install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am
+
+.PRECIOUS: Makefile
+
+
+@REBUILD_DOCS_TRUE@rebuild: examples.xml index.html
+@REBUILD_DOCS_TRUE@.PHONY: rebuild
+
+@REBUILD_DOCS_TRUE@examples.xml: index.py $(check_PROGRAMS:=.c)
+@REBUILD_DOCS_TRUE@ cd $(srcdir) && $(PYTHON) index.py
+@REBUILD_DOCS_TRUE@ $(MAKE) Makefile
+
+@REBUILD_DOCS_TRUE@index.html: examples.xml examples.xsl
+@REBUILD_DOCS_TRUE@ cd $(srcdir) && xsltproc examples.xsl examples.xml && echo "Rebuilt web page"
+@REBUILD_DOCS_TRUE@ -cd $(srcdir) && xmllint --valid --noout index.html
+
+install-data-local:
+ $(MKDIR_P) $(DESTDIR)$(HTML_DIR)
+ -$(INSTALL) -m 0644 $(srcdir)/*.html $(srcdir)/*.c $(srcdir)/*.xml $(srcdir)/*.xsl $(srcdir)/*.res $(DESTDIR)$(HTML_DIR)
+
+clean-local:
+ test -f Makefile.am || rm -f test?.xml
+
+valgrind:
+ $(MAKE) CHECKER='valgrind' tests
+
+tests: $(check_PROGRAMS)
+ @test -f Makefile.am || test -f test1.xml || $(LN_S) $(srcdir)/test?.xml .
+ @(echo '## examples regression tests')
+ @(echo > .memdump)
+ @$(CHECKER) ./io1 > io1.tmp && diff io1.tmp $(srcdir)/io1.res
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./io2 > io2.tmp && diff io2.tmp $(srcdir)/io2.res
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./parse1 test1.xml
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./parse2 test2.xml
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./parse3
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./parse4 test3.xml
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./reader1 test2.xml > reader1.tmp && diff reader1.tmp $(srcdir)/reader1.res
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./reader2 test2.xml > reader1.tmp && diff reader1.tmp $(srcdir)/reader1.res
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./reader3 > reader3.tmp && diff reader3.tmp $(srcdir)/reader3.res
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./reader4 test1.xml test2.xml test3.xml > reader4.tmp && diff reader4.tmp $(srcdir)/reader4.res
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./testWriter && for i in 1 2 3 4 ; do diff $(srcdir)/writer.xml writer$$i.tmp || break ; done
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./tree1 test2.xml > tree1.tmp && diff tree1.tmp $(srcdir)/tree1.res
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./tree2 > tree2.tmp && diff tree2.tmp $(srcdir)/tree2.res
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./xpath1 test3.xml '//child2' > xpath1.tmp && diff xpath1.tmp $(srcdir)/xpath1.res
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @$(CHECKER) ./xpath2 test3.xml '//discarded' discarded > xpath2.tmp && diff xpath2.tmp $(srcdir)/xpath2.res
+ @grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0
+ @rm *.tmp
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libxml2-2.9.10/doc/examples/examples.xml b/libxml2-2.9.10/doc/examples/examples.xml
new file mode 100644
index 0000000..cc791ed
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/examples.xml
@@ -0,0 +1,751 @@
+<examples>
+ <example filename='io1.c'>
+ <synopsis>Example of custom Input/Output</synopsis>
+ <purpose>Demonstrate the use of xmlRegisterInputCallbacks to build a custom I/O layer, this is used in an XInclude method context to show how dynamic document can be built in a clean way.</purpose>
+ <usage>io1</usage>
+ <test>io1 &gt; io1.tmp &amp;&amp; diff io1.tmp $(srcdir)/io1.res</test>
+ <author>Daniel Veillard</author>
+ <copy>see Copyright for the status of this software. </copy>
+ <section>InputOutput</section>
+ <includes>
+ <include>&lt;libxml/parser.h&gt;</include>
+ <include>&lt;libxml/xmlIO.h&gt;</include>
+ <include>&lt;libxml/xinclude.h&gt;</include>
+ <include>&lt;libxml/tree.h&gt;</include>
+ </includes>
+ <uses>
+ <function line='143' file='tree' name='xmlDocDump'/>
+ <function line='158' file='xmlmemory' name='xmlMemoryDump'/>
+ <function line='149' file='tree' name='xmlFreeDoc'/>
+ <function line='154' file='parser' name='xmlCleanupParser'/>
+ <macro line='117' file='xmlversion' name='LIBXML_TEST_VERSION'/>
+ <function line='134' file='xinclude' name='xmlXIncludeProcess'/>
+ <function line='117' file='xmlIO' name='xmlRegisterInputCallbacks'/>
+ <function line='124' file='parser' name='xmlReadMemory'/>
+ <typedef line='105' file='tree' name='xmlDocPtr'/>
+ </uses>
+ </example>
+ <example filename='io2.c'>
+ <synopsis>Output to char buffer</synopsis>
+ <purpose>Demonstrate the use of xmlDocDumpMemory to output document to a character buffer</purpose>
+ <usage>io2</usage>
+ <test>io2 &gt; io2.tmp &amp;&amp; diff io2.tmp $(srcdir)/io2.res</test>
+ <author>John Fleck</author>
+ <copy>see Copyright for the status of this software. </copy>
+ <section>InputOutput</section>
+ <includes>
+ <include>&lt;libxml/parser.h&gt;</include>
+ </includes>
+ <uses>
+ <function line='29' file='tree' name='xmlNodeSetContent'/>
+ <function line='36' file='tree' name='xmlDocDumpFormatMemory'/>
+ <variable line='42' file='globals' name='xmlFree'/>
+ <function line='30' file='tree' name='xmlDocSetRootElement'/>
+ <typedef line='20' file='tree' name='xmlDocPtr'/>
+ <function line='43' file='tree' name='xmlFreeDoc'/>
+ <typedef line='19' file='tree' name='xmlNodePtr'/>
+ <function line='27' file='tree' name='xmlNewDoc'/>
+ <function line='28' file='tree' name='xmlNewNode'/>
+ </uses>
+ </example>
+ <example filename='parse1.c'>
+ <synopsis>Parse an XML file to a tree and free it</synopsis>
+ <purpose>Demonstrate the use of xmlReadFile() to read an XML file into a tree and xmlFreeDoc() to free the resulting tree</purpose>
+ <usage>parse1 test1.xml</usage>
+ <test>parse1 test1.xml</test>
+ <author>Daniel Veillard</author>
+ <copy>see Copyright for the status of this software. </copy>
+ <section>Parsing</section>
+ <includes>
+ <include>&lt;libxml/tree.h&gt;</include>
+ <include>&lt;libxml/parser.h&gt;</include>
+ </includes>
+ <uses>
+ <function line='54' file='xmlmemory' name='xmlMemoryDump'/>
+ <function line='50' file='parser' name='xmlCleanupParser'/>
+ <macro line='45' file='xmlversion' name='LIBXML_TEST_VERSION'/>
+ <typedef line='24' file='tree' name='xmlDocPtr'/>
+ <function line='31' file='tree' name='xmlFreeDoc'/>
+ <function line='26' file='parser' name='xmlReadFile'/>
+ </uses>
+ </example>
+ <example filename='parse2.c'>
+ <synopsis>Parse and validate an XML file to a tree and free the result</synopsis>
+ <purpose>Create a parser context for an XML file, then parse and validate the file, creating a tree, check the validation result and xmlFreeDoc() to free the resulting tree.</purpose>
+ <usage>parse2 test2.xml</usage>
+ <test>parse2 test2.xml</test>
+ <author>Daniel Veillard</author>
+ <copy>see Copyright for the status of this software. </copy>
+ <section>Parsing</section>
+ <includes>
+ <include>&lt;libxml/tree.h&gt;</include>
+ <include>&lt;libxml/parser.h&gt;</include>
+ </includes>
+ <uses>
+ <function line='47' file='parser' name='xmlFreeParserCtxt'/>
+ <enum line='35' file='parser' name='XML_PARSE_DTDVALID'/>
+ <function line='29' file='parser' name='xmlNewParserCtxt'/>
+ <typedef line='25' file='tree' name='xmlParserCtxtPtr'/>
+ <function line='35' file='parser' name='xmlCtxtReadFile'/>
+ <function line='66' file='parser' name='xmlCleanupParser'/>
+ <macro line='61' file='xmlversion' name='LIBXML_TEST_VERSION'/>
+ <function line='44' file='tree' name='xmlFreeDoc'/>
+ <typedef line='26' file='tree' name='xmlDocPtr'/>
+ <function line='70' file='xmlmemory' name='xmlMemoryDump'/>
+ </uses>
+ </example>
+ <example filename='parse3.c'>
+ <synopsis>Parse an XML document in memory to a tree and free it</synopsis>
+ <purpose>Demonstrate the use of xmlReadMemory() to read an XML file into a tree and xmlFreeDoc() to free the resulting tree</purpose>
+ <usage>parse3</usage>
+ <test>parse3</test>
+ <author>Daniel Veillard</author>
+ <copy>see Copyright for the status of this software. </copy>
+ <section>Parsing</section>
+ <includes>
+ <include>&lt;libxml/tree.h&gt;</include>
+ <include>&lt;libxml/parser.h&gt;</include>
+ </includes>
+ <uses>
+ <function line='33' file='parser' name='xmlReadMemory'/>
+ <function line='58' file='xmlmemory' name='xmlMemoryDump'/>
+ <function line='54' file='parser' name='xmlCleanupParser'/>
+ <macro line='49' file='xmlversion' name='LIBXML_TEST_VERSION'/>
+ <function line='38' file='tree' name='xmlFreeDoc'/>
+ <typedef line='27' file='tree' name='xmlDocPtr'/>
+ </uses>
+ </example>
+ <example filename='parse4.c'>
+ <synopsis>Parse an XML document chunk by chunk to a tree and free it</synopsis>
+ <purpose>Demonstrate the use of xmlCreatePushParserCtxt() and xmlParseChunk() to read an XML file progressively into a tree and xmlFreeDoc() to free the resulting tree</purpose>
+ <usage>parse4 test3.xml</usage>
+ <test>parse4 test3.xml</test>
+ <author>Daniel Veillard</author>
+ <copy>see Copyright for the status of this software. </copy>
+ <section>Parsing</section>
+ <includes>
+ <include>&lt;libxml/tree.h&gt;</include>
+ <include>&lt;libxml/parser.h&gt;</include>
+ </includes>
+ <uses>
+ <function line='94' file='parser' name='xmlFreeParserCtxt'/>
+ <function line='86' file='parser' name='xmlParseChunk'/>
+ <function line='103' file='tree' name='xmlFreeDoc'/>
+ <function line='135' file='xmlmemory' name='xmlMemoryDump'/>
+ <function line='67' file='parser' name='xmlCreatePushParserCtxt'/>
+ <function line='131' file='parser' name='xmlCleanupParser'/>
+ <macro line='120' file='xmlversion' name='LIBXML_TEST_VERSION'/>
+ <typedef line='45' file='tree' name='xmlParserCtxtPtr'/>
+ <typedef line='47' file='tree' name='xmlDocPtr'/>
+ </uses>
+ </example>
+ <example filename='reader1.c'>
+ <synopsis>Parse an XML file with an xmlReader</synopsis>
+ <purpose>Demonstrate the use of xmlReaderForFile() to parse an XML file and dump the informations about the nodes found in the process. (Note that the XMLReader functions require libxml2 version later than 2.6.)</purpose>
+ <usage>reader1 &lt;filename&gt;</usage>
+ <test>reader1 test2.xml &gt; reader1.tmp &amp;&amp; diff reader1.tmp $(srcdir)/reader1.res</test>
+ <author>Daniel Veillard</author>
+ <copy>see Copyright for the status of this software. </copy>
+ <section>xmlReader</section>
+ <includes>
+ <include>&lt;libxml/xmlreader.h&gt;</include>
+ </includes>
+ <uses>
+ <function line='44' file='xmlstring' name='xmlStrlen'/>
+ <function line='94' file='parser' name='xmlCleanupParser'/>
+ <function line='37' file='xmlreader' name='xmlTextReaderNodeType'/>
+ <typedef line='59' file='xmlreader' name='xmlTextReaderPtr'/>
+ <function line='98' file='xmlmemory' name='xmlMemoryDump'/>
+ <function line='33' file='xmlreader' name='xmlTextReaderConstValue'/>
+ <function line='36' file='xmlreader' name='xmlTextReaderDepth'/>
+ <function line='69' file='xmlreader' name='xmlFreeTextReader'/>
+ <macro line='89' file='xmlversion' name='LIBXML_TEST_VERSION'/>
+ <function line='29' file='xmlreader' name='xmlTextReaderConstName'/>
+ <function line='40' file='xmlreader' name='xmlTextReaderHasValue'/>
+ <function line='67' file='xmlreader' name='xmlTextReaderRead'/>
+ <function line='39' file='xmlreader' name='xmlTextReaderIsEmptyElement'/>
+ <function line='62' file='xmlreader' name='xmlReaderForFile'/>
+ </uses>
+ </example>
+ <example filename='reader2.c'>
+ <synopsis>Parse and validate an XML file with an xmlReader</synopsis>
+ <purpose>Demonstrate the use of xmlReaderForFile() to parse an XML file validating the content in the process and activating options like entities substitution, and DTD attributes defaulting. (Note that the XMLReader functions require libxml2 version later than 2.6.)</purpose>
+ <usage>reader2 &lt;valid_xml_filename&gt;</usage>
+ <test>reader2 test2.xml &gt; reader1.tmp &amp;&amp; diff reader1.tmp $(srcdir)/reader1.res</test>
+ <author>Daniel Veillard</author>
+ <copy>see Copyright for the status of this software. </copy>
+ <section>xmlReader</section>
+ <includes>
+ <include>&lt;libxml/xmlreader.h&gt;</include>
+ </includes>
+ <uses>
+ <function line='45' file='xmlstring' name='xmlStrlen'/>
+ <function line='38' file='xmlreader' name='xmlTextReaderNodeType'/>
+ <typedef line='60' file='xmlreader' name='xmlTextReaderPtr'/>
+ <function line='34' file='xmlreader' name='xmlTextReaderConstValue'/>
+ <enum line='70' file='parser' name='XML_PARSE_NOENT'/>
+ <function line='37' file='xmlreader' name='xmlTextReaderDepth'/>
+ <enum line='71' file='parser' name='XML_PARSE_DTDVALID'/>
+ <enum line='69' file='parser' name='XML_PARSE_DTDATTR'/>
+ <function line='84' file='xmlreader' name='xmlFreeTextReader'/>
+ <function line='30' file='xmlreader' name='xmlTextReaderConstName'/>
+ <function line='41' file='xmlreader' name='xmlTextReaderHasValue'/>
+ <function line='76' file='xmlreader' name='xmlTextReaderRead'/>
+ <function line='40' file='xmlreader' name='xmlTextReaderIsEmptyElement'/>
+ <function line='68' file='xmlreader' name='xmlReaderForFile'/>
+ <function line='81' file='xmlreader' name='xmlTextReaderIsValid'/>
+ </uses>
+ </example>
+ <example filename='reader3.c'>
+ <synopsis>Show how to extract subdocuments with xmlReader</synopsis>
+ <purpose>Demonstrate the use of xmlTextReaderPreservePattern() to parse an XML file with the xmlReader while collecting only some subparts of the document. (Note that the XMLReader functions require libxml2 version later than 2.6.)</purpose>
+ <usage>reader3</usage>
+ <test>reader3 &gt; reader3.tmp &amp;&amp; diff reader3.tmp $(srcdir)/reader3.res</test>
+ <author>Daniel Veillard</author>
+ <copy>see Copyright for the status of this software. </copy>
+ <section>xmlReader</section>
+ <includes>
+ <include>&lt;libxml/xmlreader.h&gt;</include>
+ </includes>
+ <uses>
+ <typedef line='32' file='xmlreader' name='xmlTextReaderPtr'/>
+ <function line='66' file='xmlreader' name='xmlFreeTextReader'/>
+ <function line='96' file='tree' name='xmlDocDump'/>
+ <function line='52' file='xmlreader' name='xmlTextReaderRead'/>
+ <function line='62' file='xmlreader' name='xmlTextReaderCurrentDoc'/>
+ <function line='43' file='xmlreader' name='xmlTextReaderPreservePattern'/>
+ <function line='38' file='xmlreader' name='xmlReaderForFile'/>
+ </uses>
+ </example>
+ <example filename='reader4.c'>
+ <synopsis>Parse multiple XML files reusing an xmlReader</synopsis>
+ <purpose>Demonstrate the use of xmlReaderForFile() and xmlReaderNewFile to parse XML files while reusing the reader object and parser context. (Note that the XMLReader functions require libxml2 version later than 2.6.)</purpose>
+ <usage>reader4 &lt;filename&gt; [ filename ... ]</usage>
+ <test>reader4 test1.xml test2.xml test3.xml &gt; reader4.tmp &amp;&amp; diff reader4.tmp $(srcdir)/reader4.res</test>
+ <author>Graham Bennett</author>
+ <copy>see Copyright for the status of this software. </copy>
+ <section>xmlReader</section>
+ <includes>
+ <include>&lt;libxml/xmlreader.h&gt;</include>
+ </includes>
+ <uses>
+ <typedef line='54' file='xmlreader' name='xmlTextReaderPtr'/>
+ <function line='83' file='xmlreader' name='xmlReaderNewFile'/>
+ <function line='104' file='xmlreader' name='xmlFreeTextReader'/>
+ <function line='26' file='xmlreader' name='xmlTextReaderRead'/>
+ <function line='97' file='xmlreader' name='xmlTextReaderCurrentDoc'/>
+ <function line='72' file='xmlreader' name='xmlReaderForFile'/>
+ </uses>
+ </example>
+ <example filename='testWriter.c'>
+ <synopsis>use various APIs for the xmlWriter</synopsis>
+ <purpose>tests a number of APIs for the xmlWriter, especially the various methods to write to a filename, to a memory buffer, to a new document, or to a subtree. It shows how to do encoding string conversions too. The resulting documents are then serialized.</purpose>
+ <usage>testWriter</usage>
+ <test>testWriter &amp;&amp; for i in 1 2 3 4 ; do diff $(srcdir)/writer.xml writer$$i.tmp || break ; done</test>
+ <author>Alfred Mickautsch</author>
+ <copy>see Copyright for the status of this software. </copy>
+ <section>xmlWriter</section>
+ <includes>
+ <include>&lt;libxml/encoding.h&gt;</include>
+ <include>&lt;libxml/xmlwriter.h&gt;</include>
+ </includes>
+ <uses>
+ <function line='913' file='xmlwriter' name='xmlTextWriterStartDocument'/>
+ <function line='1121' file='xmlwriter' name='xmlTextWriterEndDocument'/>
+ <variable line='1183' file='globals' name='xmlRealloc'/>
+ <function line='925' file='xmlwriter' name='xmlTextWriterWriteComment'/>
+ <function line='1156' file='encoding' name='xmlFindCharEncodingHandler'/>
+ <variable line='1166' file='globals' name='xmlMalloc'/>
+ <typedef line='341' file='tree' name='xmlBufferPtr'/>
+ <macro line='885' file='parser' name='XML_DEFAULT_VERSION'/>
+ <function line='901' file='tree' name='xmlDocSetRootElement'/>
+ <function line='1127' file='xmlwriter' name='xmlFreeTextWriter'/>
+ <function line='1096' file='xmlwriter' name='xmlTextWriterStartElement'/>
+ <function line='347' file='tree' name='xmlBufferCreate'/>
+ <function line='1111' file='xmlwriter' name='xmlTextWriterEndElement'/>
+ <function line='76' file='xmlwriter' name='xmlNewTextWriterFilename'/>
+ <function line='959' file='xmlwriter' name='xmlTextWriterWriteFormatComment'/>
+ <function line='1073' file='xmlwriter' name='xmlTextWriterWriteFormatElement'/>
+ <typedef line='1151' file='encoding' name='xmlCharEncodingHandlerPtr'/>
+ <typedef line='880' file='tree' name='xmlNodePtr'/>
+ <function line='949' file='xmlwriter' name='xmlTextWriterWriteAttribute'/>
+ <function line='632' file='xmlwriter' name='xmlNewTextWriterDoc'/>
+ <function line='894' file='tree' name='xmlNewDocNode'/>
+ <function line='1129' file='tree' name='xmlSaveFileEnc'/>
+ <function line='904' file='xmlwriter' name='xmlNewTextWriterTree'/>
+ <function line='355' file='xmlwriter' name='xmlNewTextWriterMemory'/>
+ <variable line='1180' file='globals' name='xmlFree'/>
+ <function line='613' file='tree' name='xmlBufferFree'/>
+ <typedef line='878' file='xmlwriter' name='xmlTextWriterPtr'/>
+ <function line='1103' file='xmlwriter' name='xmlTextWriterWriteElement'/>
+ <function line='885' file='tree' name='xmlNewDoc'/>
+ </uses>
+ </example>
+ <example filename='tree1.c'>
+ <synopsis>Navigates a tree to print element names</synopsis>
+ <purpose>Parse a file to a tree, use xmlDocGetRootElement() to get the root element, then walk the document and print all the element name in document order.</purpose>
+ <usage>tree1 filename_or_URL</usage>
+ <test>tree1 test2.xml &gt; tree1.tmp &amp;&amp; diff tree1.tmp $(srcdir)/tree1.res</test>
+ <author>Dodji Seketeli</author>
+ <copy>see Copyright for the status of this software. </copy>
+ <section>Tree</section>
+ <includes>
+ <include>&lt;libxml/tree.h&gt;</include>
+ <include>&lt;libxml/parser.h&gt;</include>
+ </includes>
+ <uses>
+ <enum line='36' file='tree' name='XML_ELEMENT_NODE'/>
+ <function line='74' file='tree' name='xmlDocGetRootElement'/>
+ <function line='67' file='parser' name='xmlReadFile'/>
+ </uses>
+ </example>
+ <example filename='tree2.c'>
+ <synopsis>Creates a tree</synopsis>
+ <purpose>Shows how to create document, nodes and dump it to stdout or file.</purpose>
+ <usage>tree2 &lt;filename&gt; -Default output: stdout</usage>
+ <test>tree2 &gt; tree2.tmp &amp;&amp; diff tree2.tmp $(srcdir)/tree2.res</test>
+ <author>Lucas Brasilino &lt;brasilino@recife.pe.gov.br&gt;</author>
+ <copy>see Copyright for the status of this software </copy>
+ <section>Tree</section>
+ <includes>
+ <include>&lt;libxml/tree.h&gt;</include>
+ <include>&lt;libxml/parser.h&gt;</include>
+ </includes>
+ <uses>
+ <function line='74' file='tree' name='xmlNewText'/>
+ <function line='95' file='tree' name='xmlSaveFormatFileEnc'/>
+ <function line='77' file='tree' name='xmlAddChild'/>
+ <function line='40' file='tree' name='xmlDocSetRootElement'/>
+ <function line='88' file='tree' name='xmlNewProp'/>
+ <function line='87' file='tree' name='xmlNewChild'/>
+ <function line='73' file='tree' name='xmlNewNode'/>
+ <function line='45' file='tree' name='xmlCreateIntSubset'/>
+ <function line='38' file='tree' name='xmlNewDoc'/>
+ </uses>
+ </example>
+ <example filename='xpath1.c'>
+ <synopsis>Evaluate XPath expression and prints result node set.</synopsis>
+ <purpose>Shows how to evaluate XPath expression and register known namespaces in XPath context.</purpose>
+ <usage>xpath1 &lt;xml-file&gt; &lt;xpath-expr&gt; [&lt;known-ns-list&gt;]</usage>
+ <test>xpath1 test3.xml &apos;//child2&apos; &gt; xpath1.tmp &amp;&amp; diff xpath1.tmp $(srcdir)/xpath1.res</test>
+ <author>Aleksey Sanin</author>
+ <copy>see Copyright for the status of this software. </copy>
+ <section>XPath</section>
+ <includes>
+ <include>&lt;libxml/parser.h&gt;</include>
+ <include>&lt;libxml/xpath.h&gt;</include>
+ <include>&lt;libxml/xpathInternals.h&gt;</include>
+ <include>&lt;libxml/tree.h&gt;</include>
+ </includes>
+ <uses>
+ <enum line='229' file='tree' name='XML_ELEMENT_NODE'/>
+ <typedef line='88' file='xpath' name='xmlXPathObjectPtr'/>
+ <function line='117' file='xpath' name='xmlXPathEvalExpression'/>
+ <function line='94' file='parser' name='xmlParseFile'/>
+ <function line='186' file='xpathInternals' name='xmlXPathRegisterNs'/>
+ <function line='129' file='xpath' name='xmlXPathFreeObject'/>
+ <variable line='193' file='globals' name='xmlFree'/>
+ <typedef line='218' file='tree' name='xmlNsPtr'/>
+ <function line='101' file='xpath' name='xmlXPathNewContext'/>
+ <typedef line='87' file='xpath' name='xmlXPathContextPtr'/>
+ <function line='130' file='xpath' name='xmlXPathFreeContext'/>
+ <function line='39' file='parser' name='xmlInitParser'/>
+ <function line='156' file='xmlstring' name='xmlStrdup'/>
+ <function line='180' file='xmlstring' name='xmlStrchr'/>
+ <typedef line='206' file='tree' name='xmlNodePtr'/>
+ <enum line='217' file='tree' name='XML_NAMESPACE_DECL'/>
+ </uses>
+ </example>
+ <example filename='xpath2.c'>
+ <synopsis>Load a document, locate subelements with XPath, modify said elements and save the resulting document.</synopsis>
+ <purpose>Shows how to make a full round-trip from a load/edit/save</purpose>
+ <usage>xpath2 &lt;xml-file&gt; &lt;xpath-expr&gt; &lt;new-value&gt;</usage>
+ <test>xpath2 test3.xml &apos;//discarded&apos; discarded &gt; xpath2.tmp &amp;&amp; diff xpath2.tmp $(srcdir)/xpath2.res</test>
+ <author>Aleksey Sanin and Daniel Veillard</author>
+ <copy>see Copyright for the status of this software. </copy>
+ <section>XPath</section>
+ <includes>
+ <include>&lt;libxml/parser.h&gt;</include>
+ <include>&lt;libxml/xpath.h&gt;</include>
+ <include>&lt;libxml/xpathInternals.h&gt;</include>
+ <include>&lt;libxml/tree.h&gt;</include>
+ </includes>
+ <uses>
+ <function line='162' file='tree' name='xmlNodeSetContent'/>
+ <function line='127' file='tree' name='xmlDocDump'/>
+ <typedef line='88' file='xpath' name='xmlXPathObjectPtr'/>
+ <function line='110' file='xpath' name='xmlXPathEvalExpression'/>
+ <function line='95' file='parser' name='xmlParseFile'/>
+ <function line='123' file='xpath' name='xmlXPathFreeObject'/>
+ <function line='102' file='xpath' name='xmlXPathNewContext'/>
+ <typedef line='87' file='xpath' name='xmlXPathContextPtr'/>
+ <function line='124' file='xpath' name='xmlXPathFreeContext'/>
+ <function line='41' file='parser' name='xmlInitParser'/>
+ <enum line='180' file='tree' name='XML_NAMESPACE_DECL'/>
+ </uses>
+ </example>
+ <symbols>
+ <symbol name='LIBXML_TEST_VERSION'>
+ <ref filename='io1.c'/>
+ <ref filename='parse1.c'/>
+ <ref filename='parse2.c'/>
+ <ref filename='parse3.c'/>
+ <ref filename='parse4.c'/>
+ <ref filename='reader1.c'/>
+ </symbol>
+ <symbol name='XML_DEFAULT_VERSION'>
+ <ref filename='testWriter.c'/>
+ </symbol>
+ <symbol name='XML_ELEMENT_NODE'>
+ <ref filename='tree1.c'/>
+ <ref filename='xpath1.c'/>
+ </symbol>
+ <symbol name='XML_NAMESPACE_DECL'>
+ <ref filename='xpath1.c'/>
+ <ref filename='xpath2.c'/>
+ </symbol>
+ <symbol name='XML_PARSE_DTDATTR'>
+ <ref filename='reader2.c'/>
+ </symbol>
+ <symbol name='XML_PARSE_DTDVALID'>
+ <ref filename='parse2.c'/>
+ <ref filename='reader2.c'/>
+ </symbol>
+ <symbol name='XML_PARSE_NOENT'>
+ <ref filename='reader2.c'/>
+ </symbol>
+ <symbol name='xmlAddChild'>
+ <ref filename='tree2.c'/>
+ </symbol>
+ <symbol name='xmlBufferCreate'>
+ <ref filename='testWriter.c'/>
+ </symbol>
+ <symbol name='xmlBufferFree'>
+ <ref filename='testWriter.c'/>
+ </symbol>
+ <symbol name='xmlBufferPtr'>
+ <ref filename='testWriter.c'/>
+ </symbol>
+ <symbol name='xmlCharEncodingHandlerPtr'>
+ <ref filename='testWriter.c'/>
+ </symbol>
+ <symbol name='xmlCleanupParser'>
+ <ref filename='io1.c'/>
+ <ref filename='parse1.c'/>
+ <ref filename='parse2.c'/>
+ <ref filename='parse3.c'/>
+ <ref filename='parse4.c'/>
+ <ref filename='reader1.c'/>
+ </symbol>
+ <symbol name='xmlCreateIntSubset'>
+ <ref filename='tree2.c'/>
+ </symbol>
+ <symbol name='xmlCreatePushParserCtxt'>
+ <ref filename='parse4.c'/>
+ </symbol>
+ <symbol name='xmlCtxtReadFile'>
+ <ref filename='parse2.c'/>
+ </symbol>
+ <symbol name='xmlDocDump'>
+ <ref filename='io1.c'/>
+ <ref filename='reader3.c'/>
+ <ref filename='xpath2.c'/>
+ </symbol>
+ <symbol name='xmlDocDumpFormatMemory'>
+ <ref filename='io2.c'/>
+ </symbol>
+ <symbol name='xmlDocGetRootElement'>
+ <ref filename='tree1.c'/>
+ </symbol>
+ <symbol name='xmlDocPtr'>
+ <ref filename='io1.c'/>
+ <ref filename='io2.c'/>
+ <ref filename='parse1.c'/>
+ <ref filename='parse2.c'/>
+ <ref filename='parse3.c'/>
+ <ref filename='parse4.c'/>
+ </symbol>
+ <symbol name='xmlDocSetRootElement'>
+ <ref filename='io2.c'/>
+ <ref filename='testWriter.c'/>
+ <ref filename='tree2.c'/>
+ </symbol>
+ <symbol name='xmlFindCharEncodingHandler'>
+ <ref filename='testWriter.c'/>
+ </symbol>
+ <symbol name='xmlFree'>
+ <ref filename='io2.c'/>
+ <ref filename='testWriter.c'/>
+ <ref filename='xpath1.c'/>
+ </symbol>
+ <symbol name='xmlFreeDoc'>
+ <ref filename='io1.c'/>
+ <ref filename='io2.c'/>
+ <ref filename='parse1.c'/>
+ <ref filename='parse2.c'/>
+ <ref filename='parse3.c'/>
+ <ref filename='parse4.c'/>
+ </symbol>
+ <symbol name='xmlFreeParserCtxt'>
+ <ref filename='parse2.c'/>
+ <ref filename='parse4.c'/>
+ </symbol>
+ <symbol name='xmlFreeTextReader'>
+ <ref filename='reader1.c'/>
+ <ref filename='reader2.c'/>
+ <ref filename='reader3.c'/>
+ <ref filename='reader4.c'/>
+ </symbol>
+ <symbol name='xmlFreeTextWriter'>
+ <ref filename='testWriter.c'/>
+ </symbol>
+ <symbol name='xmlInitParser'>
+ <ref filename='xpath1.c'/>
+ <ref filename='xpath2.c'/>
+ </symbol>
+ <symbol name='xmlMalloc'>
+ <ref filename='testWriter.c'/>
+ </symbol>
+ <symbol name='xmlMemoryDump'>
+ <ref filename='io1.c'/>
+ <ref filename='parse1.c'/>
+ <ref filename='parse2.c'/>
+ <ref filename='parse3.c'/>
+ <ref filename='parse4.c'/>
+ <ref filename='reader1.c'/>
+ </symbol>
+ <symbol name='xmlNewChild'>
+ <ref filename='tree2.c'/>
+ </symbol>
+ <symbol name='xmlNewDoc'>
+ <ref filename='io2.c'/>
+ <ref filename='testWriter.c'/>
+ <ref filename='tree2.c'/>
+ </symbol>
+ <symbol name='xmlNewDocNode'>
+ <ref filename='testWriter.c'/>
+ </symbol>
+ <symbol name='xmlNewNode'>
+ <ref filename='io2.c'/>
+ <ref filename='tree2.c'/>
+ </symbol>
+ <symbol name='xmlNewParserCtxt'>
+ <ref filename='parse2.c'/>
+ </symbol>
+ <symbol name='xmlNewProp'>
+ <ref filename='tree2.c'/>
+ </symbol>
+ <symbol name='xmlNewText'>
+ <ref filename='tree2.c'/>
+ </symbol>
+ <symbol name='xmlNewTextWriterDoc'>
+ <ref filename='testWriter.c'/>
+ </symbol>
+ <symbol name='xmlNewTextWriterFilename'>
+ <ref filename='testWriter.c'/>
+ </symbol>
+ <symbol name='xmlNewTextWriterMemory'>
+ <ref filename='testWriter.c'/>
+ </symbol>
+ <symbol name='xmlNewTextWriterTree'>
+ <ref filename='testWriter.c'/>
+ </symbol>
+ <symbol name='xmlNodePtr'>
+ <ref filename='io2.c'/>
+ <ref filename='testWriter.c'/>
+ <ref filename='xpath1.c'/>
+ </symbol>
+ <symbol name='xmlNodeSetContent'>
+ <ref filename='io2.c'/>
+ <ref filename='xpath2.c'/>
+ </symbol>
+ <symbol name='xmlNsPtr'>
+ <ref filename='xpath1.c'/>
+ </symbol>
+ <symbol name='xmlParseChunk'>
+ <ref filename='parse4.c'/>
+ </symbol>
+ <symbol name='xmlParseFile'>
+ <ref filename='xpath1.c'/>
+ <ref filename='xpath2.c'/>
+ </symbol>
+ <symbol name='xmlParserCtxtPtr'>
+ <ref filename='parse2.c'/>
+ <ref filename='parse4.c'/>
+ </symbol>
+ <symbol name='xmlReadFile'>
+ <ref filename='parse1.c'/>
+ <ref filename='tree1.c'/>
+ </symbol>
+ <symbol name='xmlReadMemory'>
+ <ref filename='io1.c'/>
+ <ref filename='parse3.c'/>
+ </symbol>
+ <symbol name='xmlReaderForFile'>
+ <ref filename='reader1.c'/>
+ <ref filename='reader2.c'/>
+ <ref filename='reader3.c'/>
+ <ref filename='reader4.c'/>
+ </symbol>
+ <symbol name='xmlReaderNewFile'>
+ <ref filename='reader4.c'/>
+ </symbol>
+ <symbol name='xmlRealloc'>
+ <ref filename='testWriter.c'/>
+ </symbol>
+ <symbol name='xmlRegisterInputCallbacks'>
+ <ref filename='io1.c'/>
+ </symbol>
+ <symbol name='xmlSaveFileEnc'>
+ <ref filename='testWriter.c'/>
+ </symbol>
+ <symbol name='xmlSaveFormatFileEnc'>
+ <ref filename='tree2.c'/>
+ </symbol>
+ <symbol name='xmlStrchr'>
+ <ref filename='xpath1.c'/>
+ </symbol>
+ <symbol name='xmlStrdup'>
+ <ref filename='xpath1.c'/>
+ </symbol>
+ <symbol name='xmlStrlen'>
+ <ref filename='reader1.c'/>
+ <ref filename='reader2.c'/>
+ </symbol>
+ <symbol name='xmlTextReaderConstName'>
+ <ref filename='reader1.c'/>
+ <ref filename='reader2.c'/>
+ </symbol>
+ <symbol name='xmlTextReaderConstValue'>
+ <ref filename='reader1.c'/>
+ <ref filename='reader2.c'/>
+ </symbol>
+ <symbol name='xmlTextReaderCurrentDoc'>
+ <ref filename='reader3.c'/>
+ <ref filename='reader4.c'/>
+ </symbol>
+ <symbol name='xmlTextReaderDepth'>
+ <ref filename='reader1.c'/>
+ <ref filename='reader2.c'/>
+ </symbol>
+ <symbol name='xmlTextReaderHasValue'>
+ <ref filename='reader1.c'/>
+ <ref filename='reader2.c'/>
+ </symbol>
+ <symbol name='xmlTextReaderIsEmptyElement'>
+ <ref filename='reader1.c'/>
+ <ref filename='reader2.c'/>
+ </symbol>
+ <symbol name='xmlTextReaderIsValid'>
+ <ref filename='reader2.c'/>
+ </symbol>
+ <symbol name='xmlTextReaderNodeType'>
+ <ref filename='reader1.c'/>
+ <ref filename='reader2.c'/>
+ </symbol>
+ <symbol name='xmlTextReaderPreservePattern'>
+ <ref filename='reader3.c'/>
+ </symbol>
+ <symbol name='xmlTextReaderPtr'>
+ <ref filename='reader1.c'/>
+ <ref filename='reader2.c'/>
+ <ref filename='reader3.c'/>
+ <ref filename='reader4.c'/>
+ </symbol>
+ <symbol name='xmlTextReaderRead'>
+ <ref filename='reader1.c'/>
+ <ref filename='reader2.c'/>
+ <ref filename='reader3.c'/>
+ <ref filename='reader4.c'/>
+ </symbol>
+ <symbol name='xmlTextWriterEndDocument'>
+ <ref filename='testWriter.c'/>
+ </symbol>
+ <symbol name='xmlTextWriterEndElement'>
+ <ref filename='testWriter.c'/>
+ </symbol>
+ <symbol name='xmlTextWriterPtr'>
+ <ref filename='testWriter.c'/>
+ </symbol>
+ <symbol name='xmlTextWriterStartDocument'>
+ <ref filename='testWriter.c'/>
+ </symbol>
+ <symbol name='xmlTextWriterStartElement'>
+ <ref filename='testWriter.c'/>
+ </symbol>
+ <symbol name='xmlTextWriterWriteAttribute'>
+ <ref filename='testWriter.c'/>
+ </symbol>
+ <symbol name='xmlTextWriterWriteComment'>
+ <ref filename='testWriter.c'/>
+ </symbol>
+ <symbol name='xmlTextWriterWriteElement'>
+ <ref filename='testWriter.c'/>
+ </symbol>
+ <symbol name='xmlTextWriterWriteFormatComment'>
+ <ref filename='testWriter.c'/>
+ </symbol>
+ <symbol name='xmlTextWriterWriteFormatElement'>
+ <ref filename='testWriter.c'/>
+ </symbol>
+ <symbol name='xmlXIncludeProcess'>
+ <ref filename='io1.c'/>
+ </symbol>
+ <symbol name='xmlXPathContextPtr'>
+ <ref filename='xpath1.c'/>
+ <ref filename='xpath2.c'/>
+ </symbol>
+ <symbol name='xmlXPathEvalExpression'>
+ <ref filename='xpath1.c'/>
+ <ref filename='xpath2.c'/>
+ </symbol>
+ <symbol name='xmlXPathFreeContext'>
+ <ref filename='xpath1.c'/>
+ <ref filename='xpath2.c'/>
+ </symbol>
+ <symbol name='xmlXPathFreeObject'>
+ <ref filename='xpath1.c'/>
+ <ref filename='xpath2.c'/>
+ </symbol>
+ <symbol name='xmlXPathNewContext'>
+ <ref filename='xpath1.c'/>
+ <ref filename='xpath2.c'/>
+ </symbol>
+ <symbol name='xmlXPathObjectPtr'>
+ <ref filename='xpath1.c'/>
+ <ref filename='xpath2.c'/>
+ </symbol>
+ <symbol name='xmlXPathRegisterNs'>
+ <ref filename='xpath1.c'/>
+ </symbol>
+ </symbols>
+ <sections>
+ <section name='InputOutput'>
+ <example filename='io1.c'/>
+ <example filename='io2.c'/>
+ </section>
+ <section name='Parsing'>
+ <example filename='parse1.c'/>
+ <example filename='parse2.c'/>
+ <example filename='parse3.c'/>
+ <example filename='parse4.c'/>
+ </section>
+ <section name='Tree'>
+ <example filename='tree1.c'/>
+ <example filename='tree2.c'/>
+ </section>
+ <section name='XPath'>
+ <example filename='xpath1.c'/>
+ <example filename='xpath2.c'/>
+ </section>
+ <section name='xmlReader'>
+ <example filename='reader1.c'/>
+ <example filename='reader2.c'/>
+ <example filename='reader3.c'/>
+ <example filename='reader4.c'/>
+ </section>
+ <section name='xmlWriter'>
+ <example filename='testWriter.c'/>
+ </section>
+ </sections>
+</examples>
diff --git a/libxml2-2.9.10/doc/examples/examples.xsl b/libxml2-2.9.10/doc/examples/examples.xsl
new file mode 100644
index 0000000..bc93a3d
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/examples.xsl
@@ -0,0 +1,174 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:exsl="http://exslt.org/common"
+ extension-element-prefixes="exsl"
+ exclude-result-prefixes="exsl">
+
+ <xsl:import href="../site.xsl"/>
+
+ <xsl:variable name="href_base">../</xsl:variable>
+ <xsl:variable name="menu_name">Examples Menu</xsl:variable>
+
+ <xsl:variable name="toc">
+ <form action="../search.php"
+ enctype="application/x-www-form-urlencoded" method="get">
+ <input name="query" type="text" size="20" value=""/>
+ <input name="submit" type="submit" value="Search ..."/>
+ </form>
+ <ul><!-- style="margin-left: -1em" -->
+ <li><a href="{$href_base}index.html">Home</a></li>
+ <li><a style="font-weight:bold"
+ href="{$href_base}docs.html">Developer Menu</a></li>
+ <li><a style="font-weight:bold"
+ href="{$href_base}html/index.html">API Menu</a></li>
+ <xsl:for-each select="/examples/sections/section">
+ <li><a href="#{@name}"><xsl:value-of select="@name"/> Examples</a></li>
+ </xsl:for-each>
+ <li><a href="{$href_base}guidelines.html">XML Guidelines</a></li>
+ </ul>
+ </xsl:variable>
+
+ <xsl:template match="include">
+ <xsl:variable name="header" select="substring-before(substring-after(., '/'), '&gt;')"/>
+ <xsl:variable name="doc" select="concat('../html/libxml-', $header, 'tml')"/>
+ <li><a href="{$doc}"><xsl:value-of select="."/></a></li>
+ </xsl:template>
+
+ <xsl:template match="typedef">
+ <xsl:variable name="name" select="@name"/>
+ <xsl:variable name="header" select="concat(@file, '.h')"/>
+ <xsl:variable name="doc" select="concat('../html/libxml-', @file, '.html#', $name)"/>
+ <li> line <xsl:value-of select="@line"/>: Type <a href="{$doc}"><xsl:value-of select="$name"/></a> from <xsl:value-of select="$header"/></li>
+ </xsl:template>
+
+ <xsl:template match="function">
+ <xsl:variable name="name" select="@name"/>
+ <xsl:variable name="header" select="concat(@file, '.h')"/>
+ <xsl:variable name="doc" select="concat('../html/libxml-', @file, '.html#', $name)"/>
+ <li> line <xsl:value-of select="@line"/>: Function <a href="{$doc}"><xsl:value-of select="$name"/></a> from <xsl:value-of select="$header"/></li>
+ </xsl:template>
+
+ <xsl:template match="macro">
+ <xsl:variable name="name" select="@name"/>
+ <xsl:variable name="header" select="concat(@file, '.h')"/>
+ <xsl:variable name="doc" select="concat('../html/libxml-', @file, '.html#', $name)"/>
+ <li> line <xsl:value-of select="@line"/>: Macro <a href="{$doc}"><xsl:value-of select="$name"/></a> from <xsl:value-of select="$header"/></li>
+ </xsl:template>
+
+ <xsl:template match="example">
+ <xsl:variable name="filename" select="string(@filename)"/>
+ <h3><a name="{$filename}" href="{$filename}"><xsl:value-of select="$filename"/></a>: <xsl:value-of select="synopsis"/></h3>
+ <p><xsl:value-of select="purpose"/></p>
+ <p>Includes:</p>
+ <ul>
+ <xsl:for-each select="includes/include">
+ <xsl:apply-templates select='.'/>
+ </xsl:for-each>
+ </ul>
+ <p>Uses:</p>
+ <ul>
+ <xsl:for-each select="uses/*">
+ <xsl:sort select="@line" data-type="number"/>
+ <xsl:apply-templates select='.'/>
+ </xsl:for-each>
+ </ul>
+ <p>Usage:</p>
+ <p><xsl:value-of select="usage"/></p>
+ <p>Author: <xsl:value-of select="author"/></p>
+ </xsl:template>
+
+ <xsl:template match="section">
+ <li><p> <a href="#{@name}"><xsl:value-of select="@name"/></a> :</p>
+ <ul>
+ <xsl:for-each select="example">
+ <xsl:sort select='.'/>
+ <xsl:variable name="filename" select="@filename"/>
+ <li> <a href="#{$filename}"><xsl:value-of select="$filename"/></a>: <xsl:value-of select="/examples/example[@filename = $filename]/synopsis"/></li>
+ </xsl:for-each>
+ </ul>
+ </li>
+ </xsl:template>
+
+ <xsl:template match="sections">
+ <p> The examples are stored per section depending on the main focus
+ of the example:</p>
+ <ul>
+ <xsl:for-each select="section">
+ <xsl:sort select='.'/>
+ <xsl:apply-templates select='.'/>
+ </xsl:for-each>
+ </ul>
+ <p> Getting the compilation options and libraries dependencies needed
+to generate binaries from the examples is best done on Linux/Unix by using
+the xml2-config script which should have been installed as part of <i>make
+install</i> step or when installing the libxml2 development package:</p>
+<pre>gcc -o example `xml2-config --cflags` example.c `xml2-config --libs`</pre>
+ </xsl:template>
+
+ <xsl:template name="sections-list">
+ <xsl:for-each select="sections/section">
+ <xsl:variable name="section" select="@name"/>
+ <h2> <a name="{$section}"></a><xsl:value-of select="$section"/> Examples</h2>
+ <xsl:apply-templates select='/examples/example[section = $section]'/>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template match="examples">
+ <xsl:variable name="title">Libxml2 set of examples</xsl:variable>
+ <xsl:document href="index.html" method="xml" encoding="ISO-8859-1"
+ doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
+ doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+ <html>
+ <head>
+ <xsl:call-template name="style"/>
+ <xsl:element name="title">
+ <xsl:value-of select="$title"/>
+ </xsl:element>
+ </head>
+ <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000">
+ <xsl:call-template name="titlebox">
+ <xsl:with-param name="title" select="$title"/>
+ </xsl:call-template>
+ <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center">
+ <tr>
+ <td bgcolor="#8b7765">
+ <table border="0" cellspacing="0" cellpadding="2" width="100%">
+ <tr>
+ <td valign="top" width="200" bgcolor="#8b7765">
+ <xsl:call-template name="toc"/>
+ </td>
+ <td valign="top" bgcolor="#8b7765">
+ <table border="0" cellspacing="0" cellpadding="1" width="100%">
+ <tr>
+ <td>
+ <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
+ <tr>
+ <td>
+ <table border="0" cellpadding="3" cellspacing="1" width="100%">
+ <tr>
+ <td bgcolor="#fffacd">
+ <xsl:apply-templates select="sections"/>
+ <xsl:call-template name="sections-list"/>
+ <p><a href="../bugs.html">Daniel Veillard</a></p>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </body>
+ </html>
+ </xsl:document>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/libxml2-2.9.10/doc/examples/index.html b/libxml2-2.9.10/doc/examples/index.html
new file mode 100644
index 0000000..9707759
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/index.html
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><link rel="SHORTCUT ICON" href="/favicon.ico" /><style type="text/css">
+TD {font-family: Verdana,Arial,Helvetica}
+BODY {font-family: Verdana,Arial,Helvetica; margin-top: 2em; margin-left: 0em; margin-right: 0em}
+H1 {font-family: Verdana,Arial,Helvetica}
+H2 {font-family: Verdana,Arial,Helvetica}
+H3 {font-family: Verdana,Arial,Helvetica}
+A:link, A:visited, A:active { text-decoration: underline }
+</style><title>Libxml2 set of examples</title></head><body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="../epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="../gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="../w3c.png" alt="W3C Logo" /></a><a href="http://www.redhat.com/"><img src="../redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/"><img src="../Libxml2-Logo-180x168.gif" alt="Made with Libxml2 Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1></h1><h2>Libxml2 set of examples</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Examples Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="../search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a href="../index.html">Home</a></li><li><a style="font-weight:bold" href="../docs.html">Developer Menu</a></li><li><a style="font-weight:bold" href="../html/index.html">API Menu</a></li><li><a href="#InputOutput">InputOutput Examples</a></li><li><a href="#Parsing">Parsing Examples</a></li><li><a href="#Tree">Tree Examples</a></li><li><a href="#XPath">XPath Examples</a></li><li><a href="#xmlReader">xmlReader Examples</a></li><li><a href="#xmlWriter">xmlWriter Examples</a></li><li><a href="../guidelines.html">XML Guidelines</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="http://mail.gnome.org/archives/xml/">Mail archive</a></li><li><a href="http://xmlsoft.org/XSLT/">XSLT libxslt</a></li><li><a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li><li><a href="http://www.aleksey.com/xmlsec/">XML-DSig xmlsec</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://opencsw.org/packages/libxml2">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://lxml.de/">lxml Python bindings</a></li><li><a href="http://cpan.uwinnipeg.ca/dist/XML-LibXML">Perl bindings</a></li><li><a href="http://libxmlplusplus.sourceforge.net/">C++ bindings</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading4">PHP bindings</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://libxml.rubyforge.org/">Ruby bindings</a></li><li><a href="http://tclxml.sourceforge.net/">Tcl bindings</a></li><li><a href="https://gitlab.gnome.org/GNOME/libxml2/issues">Bug Tracker</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p> The examples are stored per section depending on the main focus
+ of the example:</p><ul><li><p><a href="#xmlWriter">xmlWriter</a> :</p><ul><li><a href="#testWriter.c">testWriter.c</a>: use various APIs for the xmlWriter</li></ul></li><li><p><a href="#InputOutput">InputOutput</a> :</p><ul><li><a href="#io1.c">io1.c</a>: Example of custom Input/Output</li><li><a href="#io2.c">io2.c</a>: Output to char buffer</li></ul></li><li><p><a href="#Tree">Tree</a> :</p><ul><li><a href="#tree1.c">tree1.c</a>: Navigates a tree to print element names</li><li><a href="#tree2.c">tree2.c</a>: Creates a tree</li></ul></li><li><p><a href="#XPath">XPath</a> :</p><ul><li><a href="#xpath1.c">xpath1.c</a>: Evaluate XPath expression and prints result node set.</li><li><a href="#xpath2.c">xpath2.c</a>: Load a document, locate subelements with XPath, modify said elements and save the resulting document.</li></ul></li><li><p><a href="#Parsing">Parsing</a> :</p><ul><li><a href="#parse1.c">parse1.c</a>: Parse an XML file to a tree and free it</li><li><a href="#parse2.c">parse2.c</a>: Parse and validate an XML file to a tree and free the result</li><li><a href="#parse3.c">parse3.c</a>: Parse an XML document in memory to a tree and free it</li><li><a href="#parse4.c">parse4.c</a>: Parse an XML document chunk by chunk to a tree and free it</li></ul></li><li><p><a href="#xmlReader">xmlReader</a> :</p><ul><li><a href="#reader1.c">reader1.c</a>: Parse an XML file with an xmlReader</li><li><a href="#reader2.c">reader2.c</a>: Parse and validate an XML file with an xmlReader</li><li><a href="#reader3.c">reader3.c</a>: Show how to extract subdocuments with xmlReader</li><li><a href="#reader4.c">reader4.c</a>: Parse multiple XML files reusing an xmlReader</li></ul></li></ul><p> Getting the compilation options and libraries dependencies needed
+to generate binaries from the examples is best done on Linux/Unix by using
+the xml2-config script which should have been installed as part of <i>make
+install</i> step or when installing the libxml2 development package:</p><pre>gcc -o example `xml2-config --cflags` example.c `xml2-config --libs`</pre><h2><a name="InputOutput" id="InputOutput"></a>InputOutput Examples</h2><h3><a name="io1.c" href="io1.c" id="io1.c">io1.c</a>: Example of custom Input/Output</h3><p>Demonstrate the use of xmlRegisterInputCallbacks to build a custom I/O layer, this is used in an XInclude method context to show how dynamic document can be built in a clean way.</p><p>Includes:</p><ul><li><a href="../html/libxml-parser.html">&lt;libxml/parser.h&gt;</a></li><li><a href="../html/libxml-xmlIO.html">&lt;libxml/xmlIO.h&gt;</a></li><li><a href="../html/libxml-xinclude.html">&lt;libxml/xinclude.h&gt;</a></li><li><a href="../html/libxml-tree.html">&lt;libxml/tree.h&gt;</a></li></ul><p>Uses:</p><ul><li> line 105: Type <a href="../html/libxml-tree.html#xmlDocPtr">xmlDocPtr</a> from tree.h</li><li> line 117: Macro <a href="../html/libxml-xmlversion.html#LIBXML_TEST_VERSION">LIBXML_TEST_VERSION</a> from xmlversion.h</li><li> line 117: Function <a href="../html/libxml-xmlIO.html#xmlRegisterInputCallbacks">xmlRegisterInputCallbacks</a> from xmlIO.h</li><li> line 124: Function <a href="../html/libxml-parser.html#xmlReadMemory">xmlReadMemory</a> from parser.h</li><li> line 134: Function <a href="../html/libxml-xinclude.html#xmlXIncludeProcess">xmlXIncludeProcess</a> from xinclude.h</li><li> line 143: Function <a href="../html/libxml-tree.html#xmlDocDump">xmlDocDump</a> from tree.h</li><li> line 149: Function <a href="../html/libxml-tree.html#xmlFreeDoc">xmlFreeDoc</a> from tree.h</li><li> line 154: Function <a href="../html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a> from parser.h</li><li> line 158: Function <a href="../html/libxml-xmlmemory.html#xmlMemoryDump">xmlMemoryDump</a> from xmlmemory.h</li></ul><p>Usage:</p><p>io1</p><p>Author: Daniel Veillard</p><h3><a name="io2.c" href="io2.c" id="io2.c">io2.c</a>: Output to char buffer</h3><p>Demonstrate the use of xmlDocDumpMemory to output document to a character buffer</p><p>Includes:</p><ul><li><a href="../html/libxml-parser.html">&lt;libxml/parser.h&gt;</a></li></ul><p>Uses:</p><ul><li> line 19: Type <a href="../html/libxml-tree.html#xmlNodePtr">xmlNodePtr</a> from tree.h</li><li> line 20: Type <a href="../html/libxml-tree.html#xmlDocPtr">xmlDocPtr</a> from tree.h</li><li> line 27: Function <a href="../html/libxml-tree.html#xmlNewDoc">xmlNewDoc</a> from tree.h</li><li> line 28: Function <a href="../html/libxml-tree.html#xmlNewNode">xmlNewNode</a> from tree.h</li><li> line 29: Function <a href="../html/libxml-tree.html#xmlNodeSetContent">xmlNodeSetContent</a> from tree.h</li><li> line 30: Function <a href="../html/libxml-tree.html#xmlDocSetRootElement">xmlDocSetRootElement</a> from tree.h</li><li> line 36: Function <a href="../html/libxml-tree.html#xmlDocDumpFormatMemory">xmlDocDumpFormatMemory</a> from tree.h</li><li> line 43: Function <a href="../html/libxml-tree.html#xmlFreeDoc">xmlFreeDoc</a> from tree.h</li></ul><p>Usage:</p><p>io2</p><p>Author: John Fleck</p><h2><a name="Parsing" id="Parsing"></a>Parsing Examples</h2><h3><a name="parse1.c" href="parse1.c" id="parse1.c">parse1.c</a>: Parse an XML file to a tree and free it</h3><p>Demonstrate the use of xmlReadFile() to read an XML file into a tree and xmlFreeDoc() to free the resulting tree</p><p>Includes:</p><ul><li><a href="../html/libxml-tree.html">&lt;libxml/tree.h&gt;</a></li><li><a href="../html/libxml-parser.html">&lt;libxml/parser.h&gt;</a></li></ul><p>Uses:</p><ul><li> line 24: Type <a href="../html/libxml-tree.html#xmlDocPtr">xmlDocPtr</a> from tree.h</li><li> line 26: Function <a href="../html/libxml-parser.html#xmlReadFile">xmlReadFile</a> from parser.h</li><li> line 31: Function <a href="../html/libxml-tree.html#xmlFreeDoc">xmlFreeDoc</a> from tree.h</li><li> line 45: Macro <a href="../html/libxml-xmlversion.html#LIBXML_TEST_VERSION">LIBXML_TEST_VERSION</a> from xmlversion.h</li><li> line 50: Function <a href="../html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a> from parser.h</li><li> line 54: Function <a href="../html/libxml-xmlmemory.html#xmlMemoryDump">xmlMemoryDump</a> from xmlmemory.h</li></ul><p>Usage:</p><p>parse1 test1.xml</p><p>Author: Daniel Veillard</p><h3><a name="parse2.c" href="parse2.c" id="parse2.c">parse2.c</a>: Parse and validate an XML file to a tree and free the result</h3><p>Create a parser context for an XML file, then parse and validate the file, creating a tree, check the validation result and xmlFreeDoc() to free the resulting tree.</p><p>Includes:</p><ul><li><a href="../html/libxml-tree.html">&lt;libxml/tree.h&gt;</a></li><li><a href="../html/libxml-parser.html">&lt;libxml/parser.h&gt;</a></li></ul><p>Uses:</p><ul><li> line 25: Type <a href="../html/libxml-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> from tree.h</li><li> line 26: Type <a href="../html/libxml-tree.html#xmlDocPtr">xmlDocPtr</a> from tree.h</li><li> line 29: Function <a href="../html/libxml-parser.html#xmlNewParserCtxt">xmlNewParserCtxt</a> from parser.h</li><li> line 35: Function <a href="../html/libxml-parser.html#xmlCtxtReadFile">xmlCtxtReadFile</a> from parser.h</li><li> line 44: Function <a href="../html/libxml-tree.html#xmlFreeDoc">xmlFreeDoc</a> from tree.h</li><li> line 47: Function <a href="../html/libxml-parser.html#xmlFreeParserCtxt">xmlFreeParserCtxt</a> from parser.h</li><li> line 61: Macro <a href="../html/libxml-xmlversion.html#LIBXML_TEST_VERSION">LIBXML_TEST_VERSION</a> from xmlversion.h</li><li> line 66: Function <a href="../html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a> from parser.h</li><li> line 70: Function <a href="../html/libxml-xmlmemory.html#xmlMemoryDump">xmlMemoryDump</a> from xmlmemory.h</li></ul><p>Usage:</p><p>parse2 test2.xml</p><p>Author: Daniel Veillard</p><h3><a name="parse3.c" href="parse3.c" id="parse3.c">parse3.c</a>: Parse an XML document in memory to a tree and free it</h3><p>Demonstrate the use of xmlReadMemory() to read an XML file into a tree and xmlFreeDoc() to free the resulting tree</p><p>Includes:</p><ul><li><a href="../html/libxml-tree.html">&lt;libxml/tree.h&gt;</a></li><li><a href="../html/libxml-parser.html">&lt;libxml/parser.h&gt;</a></li></ul><p>Uses:</p><ul><li> line 27: Type <a href="../html/libxml-tree.html#xmlDocPtr">xmlDocPtr</a> from tree.h</li><li> line 33: Function <a href="../html/libxml-parser.html#xmlReadMemory">xmlReadMemory</a> from parser.h</li><li> line 38: Function <a href="../html/libxml-tree.html#xmlFreeDoc">xmlFreeDoc</a> from tree.h</li><li> line 49: Macro <a href="../html/libxml-xmlversion.html#LIBXML_TEST_VERSION">LIBXML_TEST_VERSION</a> from xmlversion.h</li><li> line 54: Function <a href="../html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a> from parser.h</li><li> line 58: Function <a href="../html/libxml-xmlmemory.html#xmlMemoryDump">xmlMemoryDump</a> from xmlmemory.h</li></ul><p>Usage:</p><p>parse3</p><p>Author: Daniel Veillard</p><h3><a name="parse4.c" href="parse4.c" id="parse4.c">parse4.c</a>: Parse an XML document chunk by chunk to a tree and free it</h3><p>Demonstrate the use of xmlCreatePushParserCtxt() and xmlParseChunk() to read an XML file progressively into a tree and xmlFreeDoc() to free the resulting tree</p><p>Includes:</p><ul><li><a href="../html/libxml-tree.html">&lt;libxml/tree.h&gt;</a></li><li><a href="../html/libxml-parser.html">&lt;libxml/parser.h&gt;</a></li></ul><p>Uses:</p><ul><li> line 45: Type <a href="../html/libxml-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> from tree.h</li><li> line 47: Type <a href="../html/libxml-tree.html#xmlDocPtr">xmlDocPtr</a> from tree.h</li><li> line 67: Function <a href="../html/libxml-parser.html#xmlCreatePushParserCtxt">xmlCreatePushParserCtxt</a> from parser.h</li><li> line 86: Function <a href="../html/libxml-parser.html#xmlParseChunk">xmlParseChunk</a> from parser.h</li><li> line 94: Function <a href="../html/libxml-parser.html#xmlFreeParserCtxt">xmlFreeParserCtxt</a> from parser.h</li><li> line 103: Function <a href="../html/libxml-tree.html#xmlFreeDoc">xmlFreeDoc</a> from tree.h</li><li> line 120: Macro <a href="../html/libxml-xmlversion.html#LIBXML_TEST_VERSION">LIBXML_TEST_VERSION</a> from xmlversion.h</li><li> line 131: Function <a href="../html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a> from parser.h</li><li> line 135: Function <a href="../html/libxml-xmlmemory.html#xmlMemoryDump">xmlMemoryDump</a> from xmlmemory.h</li></ul><p>Usage:</p><p>parse4 test3.xml</p><p>Author: Daniel Veillard</p><h2><a name="Tree" id="Tree"></a>Tree Examples</h2><h3><a name="tree1.c" href="tree1.c" id="tree1.c">tree1.c</a>: Navigates a tree to print element names</h3><p>Parse a file to a tree, use xmlDocGetRootElement() to get the root element, then walk the document and print all the element name in document order.</p><p>Includes:</p><ul><li><a href="../html/libxml-tree.html">&lt;libxml/tree.h&gt;</a></li><li><a href="../html/libxml-parser.html">&lt;libxml/parser.h&gt;</a></li></ul><p>Uses:</p><ul><li> line 67: Function <a href="../html/libxml-parser.html#xmlReadFile">xmlReadFile</a> from parser.h</li><li> line 74: Function <a href="../html/libxml-tree.html#xmlDocGetRootElement">xmlDocGetRootElement</a> from tree.h</li></ul><p>Usage:</p><p>tree1 filename_or_URL</p><p>Author: Dodji Seketeli</p><h3><a name="tree2.c" href="tree2.c" id="tree2.c">tree2.c</a>: Creates a tree</h3><p>Shows how to create document, nodes and dump it to stdout or file.</p><p>Includes:</p><ul><li><a href="../html/libxml-tree.html">&lt;libxml/tree.h&gt;</a></li><li><a href="../html/libxml-parser.html">&lt;libxml/parser.h&gt;</a></li></ul><p>Uses:</p><ul><li> line 38: Function <a href="../html/libxml-tree.html#xmlNewDoc">xmlNewDoc</a> from tree.h</li><li> line 40: Function <a href="../html/libxml-tree.html#xmlDocSetRootElement">xmlDocSetRootElement</a> from tree.h</li><li> line 45: Function <a href="../html/libxml-tree.html#xmlCreateIntSubset">xmlCreateIntSubset</a> from tree.h</li><li> line 73: Function <a href="../html/libxml-tree.html#xmlNewNode">xmlNewNode</a> from tree.h</li><li> line 74: Function <a href="../html/libxml-tree.html#xmlNewText">xmlNewText</a> from tree.h</li><li> line 77: Function <a href="../html/libxml-tree.html#xmlAddChild">xmlAddChild</a> from tree.h</li><li> line 87: Function <a href="../html/libxml-tree.html#xmlNewChild">xmlNewChild</a> from tree.h</li><li> line 88: Function <a href="../html/libxml-tree.html#xmlNewProp">xmlNewProp</a> from tree.h</li><li> line 95: Function <a href="../html/libxml-tree.html#xmlSaveFormatFileEnc">xmlSaveFormatFileEnc</a> from tree.h</li></ul><p>Usage:</p><p>tree2 &lt;filename&gt; -Default output: stdout</p><p>Author: Lucas Brasilino &lt;brasilino@recife.pe.gov.br&gt;</p><h2><a name="XPath" id="XPath"></a>XPath Examples</h2><h3><a name="xpath1.c" href="xpath1.c" id="xpath1.c">xpath1.c</a>: Evaluate XPath expression and prints result node set.</h3><p>Shows how to evaluate XPath expression and register known namespaces in XPath context.</p><p>Includes:</p><ul><li><a href="../html/libxml-parser.html">&lt;libxml/parser.h&gt;</a></li><li><a href="../html/libxml-xpath.html">&lt;libxml/xpath.h&gt;</a></li><li><a href="../html/libxml-xpathInternals.html">&lt;libxml/xpathInternals.h&gt;</a></li><li><a href="../html/libxml-tree.html">&lt;libxml/tree.h&gt;</a></li></ul><p>Uses:</p><ul><li> line 39: Function <a href="../html/libxml-parser.html#xmlInitParser">xmlInitParser</a> from parser.h</li><li> line 87: Type <a href="../html/libxml-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> from xpath.h</li><li> line 88: Type <a href="../html/libxml-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> from xpath.h</li><li> line 94: Function <a href="../html/libxml-parser.html#xmlParseFile">xmlParseFile</a> from parser.h</li><li> line 101: Function <a href="../html/libxml-xpath.html#xmlXPathNewContext">xmlXPathNewContext</a> from xpath.h</li><li> line 117: Function <a href="../html/libxml-xpath.html#xmlXPathEvalExpression">xmlXPathEvalExpression</a> from xpath.h</li><li> line 129: Function <a href="../html/libxml-xpath.html#xmlXPathFreeObject">xmlXPathFreeObject</a> from xpath.h</li><li> line 130: Function <a href="../html/libxml-xpath.html#xmlXPathFreeContext">xmlXPathFreeContext</a> from xpath.h</li><li> line 156: Function <a href="../html/libxml-xmlstring.html#xmlStrdup">xmlStrdup</a> from xmlstring.h</li><li> line 180: Function <a href="../html/libxml-xmlstring.html#xmlStrchr">xmlStrchr</a> from xmlstring.h</li><li> line 186: Function <a href="../html/libxml-xpathInternals.html#xmlXPathRegisterNs">xmlXPathRegisterNs</a> from xpathInternals.h</li><li> line 206: Type <a href="../html/libxml-tree.html#xmlNodePtr">xmlNodePtr</a> from tree.h</li><li> line 218: Type <a href="../html/libxml-tree.html#xmlNsPtr">xmlNsPtr</a> from tree.h</li></ul><p>Usage:</p><p>xpath1 &lt;xml-file&gt; &lt;xpath-expr&gt; [&lt;known-ns-list&gt;]</p><p>Author: Aleksey Sanin</p><h3><a name="xpath2.c" href="xpath2.c" id="xpath2.c">xpath2.c</a>: Load a document, locate subelements with XPath, modify said elements and save the resulting document.</h3><p>Shows how to make a full round-trip from a load/edit/save</p><p>Includes:</p><ul><li><a href="../html/libxml-parser.html">&lt;libxml/parser.h&gt;</a></li><li><a href="../html/libxml-xpath.html">&lt;libxml/xpath.h&gt;</a></li><li><a href="../html/libxml-xpathInternals.html">&lt;libxml/xpathInternals.h&gt;</a></li><li><a href="../html/libxml-tree.html">&lt;libxml/tree.h&gt;</a></li></ul><p>Uses:</p><ul><li> line 41: Function <a href="../html/libxml-parser.html#xmlInitParser">xmlInitParser</a> from parser.h</li><li> line 87: Type <a href="../html/libxml-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> from xpath.h</li><li> line 88: Type <a href="../html/libxml-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> from xpath.h</li><li> line 95: Function <a href="../html/libxml-parser.html#xmlParseFile">xmlParseFile</a> from parser.h</li><li> line 102: Function <a href="../html/libxml-xpath.html#xmlXPathNewContext">xmlXPathNewContext</a> from xpath.h</li><li> line 110: Function <a href="../html/libxml-xpath.html#xmlXPathEvalExpression">xmlXPathEvalExpression</a> from xpath.h</li><li> line 123: Function <a href="../html/libxml-xpath.html#xmlXPathFreeObject">xmlXPathFreeObject</a> from xpath.h</li><li> line 124: Function <a href="../html/libxml-xpath.html#xmlXPathFreeContext">xmlXPathFreeContext</a> from xpath.h</li><li> line 127: Function <a href="../html/libxml-tree.html#xmlDocDump">xmlDocDump</a> from tree.h</li><li> line 162: Function <a href="../html/libxml-tree.html#xmlNodeSetContent">xmlNodeSetContent</a> from tree.h</li></ul><p>Usage:</p><p>xpath2 &lt;xml-file&gt; &lt;xpath-expr&gt; &lt;new-value&gt;</p><p>Author: Aleksey Sanin and Daniel Veillard</p><h2><a name="xmlReader" id="xmlReader"></a>xmlReader Examples</h2><h3><a name="reader1.c" href="reader1.c" id="reader1.c">reader1.c</a>: Parse an XML file with an xmlReader</h3><p>Demonstrate the use of xmlReaderForFile() to parse an XML file and dump the informations about the nodes found in the process. (Note that the XMLReader functions require libxml2 version later than 2.6.)</p><p>Includes:</p><ul><li><a href="../html/libxml-xmlreader.html">&lt;libxml/xmlreader.h&gt;</a></li></ul><p>Uses:</p><ul><li> line 29: Function <a href="../html/libxml-xmlreader.html#xmlTextReaderConstName">xmlTextReaderConstName</a> from xmlreader.h</li><li> line 33: Function <a href="../html/libxml-xmlreader.html#xmlTextReaderConstValue">xmlTextReaderConstValue</a> from xmlreader.h</li><li> line 36: Function <a href="../html/libxml-xmlreader.html#xmlTextReaderDepth">xmlTextReaderDepth</a> from xmlreader.h</li><li> line 37: Function <a href="../html/libxml-xmlreader.html#xmlTextReaderNodeType">xmlTextReaderNodeType</a> from xmlreader.h</li><li> line 39: Function <a href="../html/libxml-xmlreader.html#xmlTextReaderIsEmptyElement">xmlTextReaderIsEmptyElement</a> from xmlreader.h</li><li> line 40: Function <a href="../html/libxml-xmlreader.html#xmlTextReaderHasValue">xmlTextReaderHasValue</a> from xmlreader.h</li><li> line 44: Function <a href="../html/libxml-xmlstring.html#xmlStrlen">xmlStrlen</a> from xmlstring.h</li><li> line 59: Type <a href="../html/libxml-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a> from xmlreader.h</li><li> line 62: Function <a href="../html/libxml-xmlreader.html#xmlReaderForFile">xmlReaderForFile</a> from xmlreader.h</li><li> line 67: Function <a href="../html/libxml-xmlreader.html#xmlTextReaderRead">xmlTextReaderRead</a> from xmlreader.h</li><li> line 69: Function <a href="../html/libxml-xmlreader.html#xmlFreeTextReader">xmlFreeTextReader</a> from xmlreader.h</li><li> line 89: Macro <a href="../html/libxml-xmlversion.html#LIBXML_TEST_VERSION">LIBXML_TEST_VERSION</a> from xmlversion.h</li><li> line 94: Function <a href="../html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a> from parser.h</li><li> line 98: Function <a href="../html/libxml-xmlmemory.html#xmlMemoryDump">xmlMemoryDump</a> from xmlmemory.h</li></ul><p>Usage:</p><p>reader1 &lt;filename&gt;</p><p>Author: Daniel Veillard</p><h3><a name="reader2.c" href="reader2.c" id="reader2.c">reader2.c</a>: Parse and validate an XML file with an xmlReader</h3><p>Demonstrate the use of xmlReaderForFile() to parse an XML file validating the content in the process and activating options like entities substitution, and DTD attributes defaulting. (Note that the XMLReader functions require libxml2 version later than 2.6.)</p><p>Includes:</p><ul><li><a href="../html/libxml-xmlreader.html">&lt;libxml/xmlreader.h&gt;</a></li></ul><p>Uses:</p><ul><li> line 30: Function <a href="../html/libxml-xmlreader.html#xmlTextReaderConstName">xmlTextReaderConstName</a> from xmlreader.h</li><li> line 34: Function <a href="../html/libxml-xmlreader.html#xmlTextReaderConstValue">xmlTextReaderConstValue</a> from xmlreader.h</li><li> line 37: Function <a href="../html/libxml-xmlreader.html#xmlTextReaderDepth">xmlTextReaderDepth</a> from xmlreader.h</li><li> line 38: Function <a href="../html/libxml-xmlreader.html#xmlTextReaderNodeType">xmlTextReaderNodeType</a> from xmlreader.h</li><li> line 40: Function <a href="../html/libxml-xmlreader.html#xmlTextReaderIsEmptyElement">xmlTextReaderIsEmptyElement</a> from xmlreader.h</li><li> line 41: Function <a href="../html/libxml-xmlreader.html#xmlTextReaderHasValue">xmlTextReaderHasValue</a> from xmlreader.h</li><li> line 45: Function <a href="../html/libxml-xmlstring.html#xmlStrlen">xmlStrlen</a> from xmlstring.h</li><li> line 60: Type <a href="../html/libxml-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a> from xmlreader.h</li><li> line 68: Function <a href="../html/libxml-xmlreader.html#xmlReaderForFile">xmlReaderForFile</a> from xmlreader.h</li><li> line 76: Function <a href="../html/libxml-xmlreader.html#xmlTextReaderRead">xmlTextReaderRead</a> from xmlreader.h</li><li> line 81: Function <a href="../html/libxml-xmlreader.html#xmlTextReaderIsValid">xmlTextReaderIsValid</a> from xmlreader.h</li><li> line 84: Function <a href="../html/libxml-xmlreader.html#xmlFreeTextReader">xmlFreeTextReader</a> from xmlreader.h</li></ul><p>Usage:</p><p>reader2 &lt;valid_xml_filename&gt;</p><p>Author: Daniel Veillard</p><h3><a name="reader3.c" href="reader3.c" id="reader3.c">reader3.c</a>: Show how to extract subdocuments with xmlReader</h3><p>Demonstrate the use of xmlTextReaderPreservePattern() to parse an XML file with the xmlReader while collecting only some subparts of the document. (Note that the XMLReader functions require libxml2 version later than 2.6.)</p><p>Includes:</p><ul><li><a href="../html/libxml-xmlreader.html">&lt;libxml/xmlreader.h&gt;</a></li></ul><p>Uses:</p><ul><li> line 32: Type <a href="../html/libxml-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a> from xmlreader.h</li><li> line 38: Function <a href="../html/libxml-xmlreader.html#xmlReaderForFile">xmlReaderForFile</a> from xmlreader.h</li><li> line 43: Function <a href="../html/libxml-xmlreader.html#xmlTextReaderPreservePattern">xmlTextReaderPreservePattern</a> from xmlreader.h</li><li> line 52: Function <a href="../html/libxml-xmlreader.html#xmlTextReaderRead">xmlTextReaderRead</a> from xmlreader.h</li><li> line 62: Function <a href="../html/libxml-xmlreader.html#xmlTextReaderCurrentDoc">xmlTextReaderCurrentDoc</a> from xmlreader.h</li><li> line 66: Function <a href="../html/libxml-xmlreader.html#xmlFreeTextReader">xmlFreeTextReader</a> from xmlreader.h</li><li> line 96: Function <a href="../html/libxml-tree.html#xmlDocDump">xmlDocDump</a> from tree.h</li></ul><p>Usage:</p><p>reader3</p><p>Author: Daniel Veillard</p><h3><a name="reader4.c" href="reader4.c" id="reader4.c">reader4.c</a>: Parse multiple XML files reusing an xmlReader</h3><p>Demonstrate the use of xmlReaderForFile() and xmlReaderNewFile to parse XML files while reusing the reader object and parser context. (Note that the XMLReader functions require libxml2 version later than 2.6.)</p><p>Includes:</p><ul><li><a href="../html/libxml-xmlreader.html">&lt;libxml/xmlreader.h&gt;</a></li></ul><p>Uses:</p><ul><li> line 26: Function <a href="../html/libxml-xmlreader.html#xmlTextReaderRead">xmlTextReaderRead</a> from xmlreader.h</li><li> line 54: Type <a href="../html/libxml-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a> from xmlreader.h</li><li> line 72: Function <a href="../html/libxml-xmlreader.html#xmlReaderForFile">xmlReaderForFile</a> from xmlreader.h</li><li> line 83: Function <a href="../html/libxml-xmlreader.html#xmlReaderNewFile">xmlReaderNewFile</a> from xmlreader.h</li><li> line 97: Function <a href="../html/libxml-xmlreader.html#xmlTextReaderCurrentDoc">xmlTextReaderCurrentDoc</a> from xmlreader.h</li><li> line 104: Function <a href="../html/libxml-xmlreader.html#xmlFreeTextReader">xmlFreeTextReader</a> from xmlreader.h</li></ul><p>Usage:</p><p>reader4 &lt;filename&gt; [ filename ... ]</p><p>Author: Graham Bennett</p><h2><a name="xmlWriter" id="xmlWriter"></a>xmlWriter Examples</h2><h3><a name="testWriter.c" href="testWriter.c" id="testWriter.c">testWriter.c</a>: use various APIs for the xmlWriter</h3><p>tests a number of APIs for the xmlWriter, especially the various methods to write to a filename, to a memory buffer, to a new document, or to a subtree. It shows how to do encoding string conversions too. The resulting documents are then serialized.</p><p>Includes:</p><ul><li><a href="../html/libxml-encoding.html">&lt;libxml/encoding.h&gt;</a></li><li><a href="../html/libxml-xmlwriter.html">&lt;libxml/xmlwriter.h&gt;</a></li></ul><p>Uses:</p><ul><li> line 76: Function <a href="../html/libxml-xmlwriter.html#xmlNewTextWriterFilename">xmlNewTextWriterFilename</a> from xmlwriter.h</li><li> line 341: Type <a href="../html/libxml-tree.html#xmlBufferPtr">xmlBufferPtr</a> from tree.h</li><li> line 347: Function <a href="../html/libxml-tree.html#xmlBufferCreate">xmlBufferCreate</a> from tree.h</li><li> line 355: Function <a href="../html/libxml-xmlwriter.html#xmlNewTextWriterMemory">xmlNewTextWriterMemory</a> from xmlwriter.h</li><li> line 613: Function <a href="../html/libxml-tree.html#xmlBufferFree">xmlBufferFree</a> from tree.h</li><li> line 632: Function <a href="../html/libxml-xmlwriter.html#xmlNewTextWriterDoc">xmlNewTextWriterDoc</a> from xmlwriter.h</li><li> line 878: Type <a href="../html/libxml-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> from xmlwriter.h</li><li> line 880: Type <a href="../html/libxml-tree.html#xmlNodePtr">xmlNodePtr</a> from tree.h</li><li> line 885: Macro <a href="../html/libxml-parser.html#XML_DEFAULT_VERSION">XML_DEFAULT_VERSION</a> from parser.h</li><li> line 885: Function <a href="../html/libxml-tree.html#xmlNewDoc">xmlNewDoc</a> from tree.h</li><li> line 894: Function <a href="../html/libxml-tree.html#xmlNewDocNode">xmlNewDocNode</a> from tree.h</li><li> line 901: Function <a href="../html/libxml-tree.html#xmlDocSetRootElement">xmlDocSetRootElement</a> from tree.h</li><li> line 904: Function <a href="../html/libxml-xmlwriter.html#xmlNewTextWriterTree">xmlNewTextWriterTree</a> from xmlwriter.h</li><li> line 913: Function <a href="../html/libxml-xmlwriter.html#xmlTextWriterStartDocument">xmlTextWriterStartDocument</a> from xmlwriter.h</li><li> line 925: Function <a href="../html/libxml-xmlwriter.html#xmlTextWriterWriteComment">xmlTextWriterWriteComment</a> from xmlwriter.h</li><li> line 949: Function <a href="../html/libxml-xmlwriter.html#xmlTextWriterWriteAttribute">xmlTextWriterWriteAttribute</a> from xmlwriter.h</li><li> line 959: Function <a href="../html/libxml-xmlwriter.html#xmlTextWriterWriteFormatComment">xmlTextWriterWriteFormatComment</a> from xmlwriter.h</li><li> line 1073: Function <a href="../html/libxml-xmlwriter.html#xmlTextWriterWriteFormatElement">xmlTextWriterWriteFormatElement</a> from xmlwriter.h</li><li> line 1096: Function <a href="../html/libxml-xmlwriter.html#xmlTextWriterStartElement">xmlTextWriterStartElement</a> from xmlwriter.h</li><li> line 1103: Function <a href="../html/libxml-xmlwriter.html#xmlTextWriterWriteElement">xmlTextWriterWriteElement</a> from xmlwriter.h</li><li> line 1111: Function <a href="../html/libxml-xmlwriter.html#xmlTextWriterEndElement">xmlTextWriterEndElement</a> from xmlwriter.h</li><li> line 1121: Function <a href="../html/libxml-xmlwriter.html#xmlTextWriterEndDocument">xmlTextWriterEndDocument</a> from xmlwriter.h</li><li> line 1127: Function <a href="../html/libxml-xmlwriter.html#xmlFreeTextWriter">xmlFreeTextWriter</a> from xmlwriter.h</li><li> line 1129: Function <a href="../html/libxml-tree.html#xmlSaveFileEnc">xmlSaveFileEnc</a> from tree.h</li><li> line 1151: Type <a href="../html/libxml-encoding.html#xmlCharEncodingHandlerPtr">xmlCharEncodingHandlerPtr</a> from encoding.h</li><li> line 1156: Function <a href="../html/libxml-encoding.html#xmlFindCharEncodingHandler">xmlFindCharEncodingHandler</a> from encoding.h</li></ul><p>Usage:</p><p>testWriter</p><p>Author: Alfred Mickautsch</p><p><a href="../bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html>
diff --git a/libxml2-2.9.10/doc/examples/index.py b/libxml2-2.9.10/doc/examples/index.py
new file mode 100755
index 0000000..ac44ec5
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/index.py
@@ -0,0 +1,315 @@
+#!/usr/bin/python -u
+#
+# Indexes the examples and build an XML description
+#
+import string
+import glob
+import sys
+try:
+ import libxml2
+except:
+ sys.exit(1)
+sys.path.insert(0, "..")
+from apibuild import CParser, escape
+
+examples = []
+extras = ['examples.xsl', 'index.html', 'index.py']
+tests = []
+sections = {}
+symbols = {}
+api_dict = None
+api_doc = None
+
+def load_api():
+ global api_dict
+ global api_doc
+
+ if api_dict != None:
+ return
+ api_dict = {}
+ try:
+ print "loading ../libxml2-api.xml"
+ api_doc = libxml2.parseFile("../libxml2-api.xml")
+ except:
+ print "failed to parse ../libxml2-api.xml"
+ sys.exit(1)
+
+def find_symbol(name):
+ global api_dict
+ global api_doc
+
+ if api_doc == None:
+ load_api()
+
+ if name == None:
+ return
+ if api_dict.has_key(name):
+ return api_dict[name]
+ ctxt = api_doc.xpathNewContext()
+ res = ctxt.xpathEval("/api/symbols/*[@name = '%s']" % (name))
+ if type(res) == type([]) and len(res) >= 1:
+ if len(res) > 1:
+ print "Found %d references to %s in the API" % (len(res), name)
+ node = res[0]
+ typ = node.name
+ file = node.xpathEval("string(@file)")
+ info = node.xpathEval("string(info)")
+ else:
+ print "Reference %s not found in the API" % (name)
+ return None
+ ret = (typ, file, info)
+ api_dict[name] = ret
+ return ret
+
+def parse_top_comment(filename, comment):
+ res = {}
+ lines = string.split(comment, "\n")
+ item = None
+ for line in lines:
+ while line != "" and (line[0] == ' ' or line[0] == '\t'):
+ line = line[1:]
+ while line != "" and line[0] == '*':
+ line = line[1:]
+ while line != "" and (line[0] == ' ' or line[0] == '\t'):
+ line = line[1:]
+ try:
+ (it, line) = string.split(line, ":", 1)
+ item = it
+ while line != "" and (line[0] == ' ' or line[0] == '\t'):
+ line = line[1:]
+ if res.has_key(item):
+ res[item] = res[item] + " " + line
+ else:
+ res[item] = line
+ except:
+ if item != None:
+ if res.has_key(item):
+ res[item] = res[item] + " " + line
+ else:
+ res[item] = line
+ return res
+
+def parse(filename, output):
+ global symbols
+ global sections
+
+ parser = CParser(filename)
+ parser.collect_references()
+ idx = parser.parse()
+ info = parse_top_comment(filename, parser.top_comment)
+ output.write(" <example filename='%s'>\n" % filename)
+ try:
+ synopsis = info['synopsis']
+ output.write(" <synopsis>%s</synopsis>\n" % escape(synopsis));
+ except:
+ print "Example %s lacks a synopsis description" % (filename)
+ try:
+ purpose = info['purpose']
+ output.write(" <purpose>%s</purpose>\n" % escape(purpose));
+ except:
+ print "Example %s lacks a purpose description" % (filename)
+ try:
+ usage = info['usage']
+ output.write(" <usage>%s</usage>\n" % escape(usage));
+ except:
+ print "Example %s lacks an usage description" % (filename)
+ try:
+ test = info['test']
+ output.write(" <test>%s</test>\n" % escape(test));
+ progname=filename[0:-2]
+ command=string.replace(test, progname, './' + progname, 1)
+ tests.append(command)
+ except:
+ pass
+ try:
+ author = info['author']
+ output.write(" <author>%s</author>\n" % escape(author));
+ except:
+ print "Example %s lacks an author description" % (filename)
+ try:
+ copy = info['copy']
+ output.write(" <copy>%s</copy>\n" % escape(copy));
+ except:
+ print "Example %s lacks a copyright description" % (filename)
+ try:
+ section = info['section']
+ output.write(" <section>%s</section>\n" % escape(section));
+ if sections.has_key(section):
+ sections[section].append(filename)
+ else:
+ sections[section] = [filename]
+ except:
+ print "Example %s lacks a section description" % (filename)
+ for topic in info.keys():
+ if topic != "purpose" and topic != "usage" and \
+ topic != "author" and topic != "copy" and \
+ topic != "section" and topic != "synopsis" and topic != "test":
+ str = info[topic]
+ output.write(" <extra topic='%s'>%s</extra>\n" % (
+ escape(topic), escape(str)))
+ output.write(" <includes>\n")
+ for include in idx.includes.keys():
+ if include.find("libxml") != -1:
+ output.write(" <include>%s</include>\n" % (escape(include)))
+ output.write(" </includes>\n")
+ output.write(" <uses>\n")
+ for ref in idx.references.keys():
+ id = idx.references[ref]
+ name = id.get_name()
+ line = id.get_lineno()
+ if symbols.has_key(name):
+ sinfo = symbols[name]
+ refs = sinfo[0]
+ # gather at most 5 references per symbols
+ if refs > 5:
+ continue
+ sinfo.append(filename)
+ sinfo[0] = refs + 1
+ else:
+ symbols[name] = [1, filename]
+ info = find_symbol(name)
+ if info != None:
+ type = info[0]
+ file = info[1]
+ output.write(" <%s line='%d' file='%s' name='%s'/>\n" % (type,
+ line, file, name))
+ else:
+ type = id.get_type()
+ output.write(" <%s line='%d' name='%s'/>\n" % (type,
+ line, name))
+
+ output.write(" </uses>\n")
+ output.write(" </example>\n")
+
+ return idx
+
+def dump_symbols(output):
+ global symbols
+
+ output.write(" <symbols>\n")
+ keys = symbols.keys()
+ keys.sort()
+ for symbol in keys:
+ output.write(" <symbol name='%s'>\n" % (symbol))
+ info = symbols[symbol]
+ i = 1
+ while i < len(info):
+ output.write(" <ref filename='%s'/>\n" % (info[i]))
+ i = i + 1
+ output.write(" </symbol>\n")
+ output.write(" </symbols>\n")
+
+def dump_sections(output):
+ global sections
+
+ output.write(" <sections>\n")
+ keys = sections.keys()
+ keys.sort()
+ for section in keys:
+ output.write(" <section name='%s'>\n" % (section))
+ info = sections[section]
+ i = 0
+ while i < len(info):
+ output.write(" <example filename='%s'/>\n" % (info[i]))
+ i = i + 1
+ output.write(" </section>\n")
+ output.write(" </sections>\n")
+
+def dump_Makefile():
+ for file in glob.glob('*.xml'):
+ extras.append(file)
+ for file in glob.glob('*.res'):
+ extras.append(file)
+ Makefile="""##
+## This file is auto-generated by index.py
+## DO NOT EDIT !!!
+##
+
+AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir)/include
+AM_CFLAGS = $(THREAD_CFLAGS) $(Z_CFLAGS)
+LDADD = $(RDL_LIBS) $(STATIC_BINARIES) $(top_builddir)/libxml2.la $(THREAD_LIBS) $(Z_LIBS) $(ICONV_LIBS) -lm $(WIN32_EXTRA_LIBADD)
+
+CLEANFILES = *.tmp
+
+if REBUILD_DOCS
+rebuild: examples.xml index.html
+.PHONY: rebuild
+
+examples.xml: index.py $(check_PROGRAMS:=.c)
+ cd $(srcdir) && $(PYTHON) index.py
+ $(MAKE) Makefile
+
+index.html: examples.xml examples.xsl
+ cd $(srcdir) && xsltproc examples.xsl examples.xml && echo "Rebuilt web page"
+ -cd $(srcdir) && xmllint --valid --noout index.html
+endif
+
+install-data-local:
+ $(MKDIR_P) $(DESTDIR)$(HTML_DIR)
+ -$(INSTALL) -m 0644 $(srcdir)/*.html $(srcdir)/*.c $(srcdir)/*.xml $(srcdir)/*.xsl $(srcdir)/*.res $(DESTDIR)$(HTML_DIR)
+
+clean-local:
+ test -f Makefile.am || rm -f test?.xml
+
+"""
+ examples.sort()
+ extras.sort()
+ tests.sort()
+ EXTRA_DIST=""
+ for extra in extras:
+ EXTRA_DIST = EXTRA_DIST + " \\\n\t" + extra
+ Makefile = Makefile + "EXTRA_DIST =%s\n\n" % (EXTRA_DIST)
+ check_PROGRAMS=""
+ for example in examples:
+ check_PROGRAMS = check_PROGRAMS + " \\\n\t" + example
+ Makefile = Makefile + "check_PROGRAMS =%s\n\n" % (check_PROGRAMS)
+ for example in examples:
+ Makefile = Makefile + "%s_SOURCES = %s.c\n\n" % (example, example)
+ Makefile = Makefile + "valgrind: \n\t$(MAKE) CHECKER='valgrind' tests\n\n"
+ Makefile = Makefile + "tests: $(check_PROGRAMS)\n"
+ Makefile = Makefile + "\t@test -f Makefile.am || test -f test1.xml || $(LN_S) $(srcdir)/test?.xml .\n"
+ Makefile = Makefile + "\t@(echo '## examples regression tests')\n"
+ Makefile = Makefile + "\t@(echo > .memdump)\n"
+ for test in tests:
+ Makefile = Makefile + "\t@$(CHECKER) %s\n" % (test)
+ Makefile = Makefile + '\t@grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0\n'
+ Makefile = Makefile + "\t@rm *.tmp\n"
+ try:
+ old = open("Makefile.am", "r").read()
+ if old != Makefile:
+ n = open("Makefile.am", "w").write(Makefile)
+ print "Updated Makefile.am"
+ except:
+ print "Failed to read or save Makefile.am"
+# #
+# # Autogenerate the .cvsignore too ... DEPRECATED
+# #
+# ignore = """.memdump
+#Makefile.in
+#Makefile
+#"""
+# for example in examples:
+# ignore = ignore + "%s\n" % (example)
+# try:
+# old = open(".cvsignore", "r").read()
+# if old != ignore:
+# n = open(".cvsignore", "w").write(ignore)
+# print "Updated .cvsignore"
+# except:
+# print "Failed to read or save .cvsignore"
+
+if __name__ == "__main__":
+ load_api()
+ output = open("examples.xml", "w")
+ output.write("<examples>\n")
+
+ for file in sorted(glob.glob('*.c')):
+ parse(file, output)
+ examples.append(file[:-2])
+
+ dump_symbols(output)
+ dump_sections(output)
+ output.write("</examples>\n")
+ output.close()
+ dump_Makefile()
+
diff --git a/libxml2-2.9.10/doc/examples/io1.c b/libxml2-2.9.10/doc/examples/io1.c
new file mode 100644
index 0000000..d077cd8
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/io1.c
@@ -0,0 +1,166 @@
+/**
+ * section: InputOutput
+ * synopsis: Example of custom Input/Output
+ * purpose: Demonstrate the use of xmlRegisterInputCallbacks
+ * to build a custom I/O layer, this is used in an
+ * XInclude method context to show how dynamic document can
+ * be built in a clean way.
+ * usage: io1
+ * test: io1 > io1.tmp && diff io1.tmp $(srcdir)/io1.res
+ * author: Daniel Veillard
+ * copy: see Copyright for the status of this software.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include <libxml/xinclude.h>
+#include <libxml/xmlIO.h>
+
+#ifdef LIBXML_XINCLUDE_ENABLED
+static const char *result = "<list><people>a</people><people>b</people></list>";
+static const char *cur = NULL;
+static int rlen;
+
+/**
+ * sqlMatch:
+ * @URI: an URI to test
+ *
+ * Check for an sql: query
+ *
+ * Returns 1 if yes and 0 if another Input module should be used
+ */
+static int
+sqlMatch(const char * URI) {
+ if ((URI != NULL) && (!strncmp(URI, "sql:", 4)))
+ return(1);
+ return(0);
+}
+
+/**
+ * sqlOpen:
+ * @URI: an URI to test
+ *
+ * Return a pointer to the sql: query handler, in this example simply
+ * the current pointer...
+ *
+ * Returns an Input context or NULL in case or error
+ */
+static void *
+sqlOpen(const char * URI) {
+ if ((URI == NULL) || (strncmp(URI, "sql:", 4)))
+ return(NULL);
+ cur = result;
+ rlen = strlen(result);
+ return((void *) cur);
+}
+
+/**
+ * sqlClose:
+ * @context: the read context
+ *
+ * Close the sql: query handler
+ *
+ * Returns 0 or -1 in case of error
+ */
+static int
+sqlClose(void * context) {
+ if (context == NULL) return(-1);
+ cur = NULL;
+ rlen = 0;
+ return(0);
+}
+
+/**
+ * sqlRead:
+ * @context: the read context
+ * @buffer: where to store data
+ * @len: number of bytes to read
+ *
+ * Implement an sql: query read.
+ *
+ * Returns the number of bytes read or -1 in case of error
+ */
+static int
+sqlRead(void * context, char * buffer, int len) {
+ const char *ptr = (const char *) context;
+
+ if ((context == NULL) || (buffer == NULL) || (len < 0))
+ return(-1);
+
+ if (len > rlen) len = rlen;
+ memcpy(buffer, ptr, len);
+ rlen -= len;
+ return(len);
+}
+
+const char *include = "<?xml version='1.0'?>\n\
+<document xmlns:xi=\"http://www.w3.org/2003/XInclude\">\n\
+ <p>List of people:</p>\n\
+ <xi:include href=\"sql:select_name_from_people\"/>\n\
+</document>\n";
+
+int main(void) {
+ xmlDocPtr doc;
+
+ /*
+ * this initialize the library and check potential ABI mismatches
+ * between the version it was compiled for and the actual shared
+ * library used.
+ */
+ LIBXML_TEST_VERSION
+
+ /*
+ * register the new I/O handlers
+ */
+ if (xmlRegisterInputCallbacks(sqlMatch, sqlOpen, sqlRead, sqlClose) < 0) {
+ fprintf(stderr, "failed to register SQL handler\n");
+ exit(1);
+ }
+ /*
+ * parse include into a document
+ */
+ doc = xmlReadMemory(include, strlen(include), "include.xml", NULL, 0);
+ if (doc == NULL) {
+ fprintf(stderr, "failed to parse the including file\n");
+ exit(1);
+ }
+
+ /*
+ * apply the XInclude process, this should trigger the I/O just
+ * registered.
+ */
+ if (xmlXIncludeProcess(doc) <= 0) {
+ fprintf(stderr, "XInclude processing failed\n");
+ exit(1);
+ }
+
+#ifdef LIBXML_OUTPUT_ENABLED
+ /*
+ * save the output for checking to stdout
+ */
+ xmlDocDump(stdout, doc);
+#endif
+
+ /*
+ * Free the document
+ */
+ xmlFreeDoc(doc);
+
+ /*
+ * Cleanup function for the XML library.
+ */
+ xmlCleanupParser();
+ /*
+ * this is to debug memory for regression tests
+ */
+ xmlMemoryDump();
+ return(0);
+}
+#else
+int main(void) {
+ fprintf(stderr, "XInclude support not compiled in\n");
+ exit(1);
+}
+#endif
diff --git a/libxml2-2.9.10/doc/examples/io1.res b/libxml2-2.9.10/doc/examples/io1.res
new file mode 100644
index 0000000..4a4c036
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/io1.res
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<document xmlns:xi="http://www.w3.org/2003/XInclude">
+ <p>List of people:</p>
+ <list><people>a</people><people>b</people></list>
+</document>
diff --git a/libxml2-2.9.10/doc/examples/io2.c b/libxml2-2.9.10/doc/examples/io2.c
new file mode 100644
index 0000000..4676f4a
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/io2.c
@@ -0,0 +1,58 @@
+/**
+ * section: InputOutput
+ * synopsis: Output to char buffer
+ * purpose: Demonstrate the use of xmlDocDumpMemory
+ * to output document to a character buffer
+ * usage: io2
+ * test: io2 > io2.tmp && diff io2.tmp $(srcdir)/io2.res
+ * author: John Fleck
+ * copy: see Copyright for the status of this software.
+ */
+
+#include <libxml/parser.h>
+
+#if defined(LIBXML_TREE_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
+int
+main(void)
+{
+
+ xmlNodePtr n;
+ xmlDocPtr doc;
+ xmlChar *xmlbuff;
+ int buffersize;
+
+ /*
+ * Create the document.
+ */
+ doc = xmlNewDoc(BAD_CAST "1.0");
+ n = xmlNewNode(NULL, BAD_CAST "root");
+ xmlNodeSetContent(n, BAD_CAST "content");
+ xmlDocSetRootElement(doc, n);
+
+ /*
+ * Dump the document to a buffer and print it
+ * for demonstration purposes.
+ */
+ xmlDocDumpFormatMemory(doc, &xmlbuff, &buffersize, 1);
+ printf("%s", (char *) xmlbuff);
+
+ /*
+ * Free associated memory.
+ */
+ xmlFree(xmlbuff);
+ xmlFreeDoc(doc);
+
+ return (0);
+
+}
+#else
+#include <stdio.h>
+
+int
+main(void)
+{
+ fprintf(stderr,
+ "library not configured with tree and output support\n");
+ return (1);
+}
+#endif
diff --git a/libxml2-2.9.10/doc/examples/io2.res b/libxml2-2.9.10/doc/examples/io2.res
new file mode 100644
index 0000000..8737b87
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/io2.res
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<root>content</root>
diff --git a/libxml2-2.9.10/doc/examples/parse1.c b/libxml2-2.9.10/doc/examples/parse1.c
new file mode 100644
index 0000000..e3c9d3a
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/parse1.c
@@ -0,0 +1,56 @@
+/**
+ * section: Parsing
+ * synopsis: Parse an XML file to a tree and free it
+ * purpose: Demonstrate the use of xmlReadFile() to read an XML file
+ * into a tree and xmlFreeDoc() to free the resulting tree
+ * usage: parse1 test1.xml
+ * test: parse1 test1.xml
+ * author: Daniel Veillard
+ * copy: see Copyright for the status of this software.
+ */
+
+#include <stdio.h>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+
+/**
+ * example1Func:
+ * @filename: a filename or an URL
+ *
+ * Parse the resource and free the resulting tree
+ */
+static void
+example1Func(const char *filename) {
+ xmlDocPtr doc; /* the resulting document tree */
+
+ doc = xmlReadFile(filename, NULL, 0);
+ if (doc == NULL) {
+ fprintf(stderr, "Failed to parse %s\n", filename);
+ return;
+ }
+ xmlFreeDoc(doc);
+}
+
+int main(int argc, char **argv) {
+ if (argc != 2)
+ return(1);
+
+ /*
+ * this initialize the library and check potential ABI mismatches
+ * between the version it was compiled for and the actual shared
+ * library used.
+ */
+ LIBXML_TEST_VERSION
+
+ example1Func(argv[1]);
+
+ /*
+ * Cleanup function for the XML library.
+ */
+ xmlCleanupParser();
+ /*
+ * this is to debug memory for regression tests
+ */
+ xmlMemoryDump();
+ return(0);
+}
diff --git a/libxml2-2.9.10/doc/examples/parse2.c b/libxml2-2.9.10/doc/examples/parse2.c
new file mode 100644
index 0000000..4dcbfde
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/parse2.c
@@ -0,0 +1,72 @@
+/**
+ * section: Parsing
+ * synopsis: Parse and validate an XML file to a tree and free the result
+ * purpose: Create a parser context for an XML file, then parse and validate
+ * the file, creating a tree, check the validation result
+ * and xmlFreeDoc() to free the resulting tree.
+ * usage: parse2 test2.xml
+ * test: parse2 test2.xml
+ * author: Daniel Veillard
+ * copy: see Copyright for the status of this software.
+ */
+
+#include <stdio.h>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+
+/**
+ * exampleFunc:
+ * @filename: a filename or an URL
+ *
+ * Parse and validate the resource and free the resulting tree
+ */
+static void
+exampleFunc(const char *filename) {
+ xmlParserCtxtPtr ctxt; /* the parser context */
+ xmlDocPtr doc; /* the resulting document tree */
+
+ /* create a parser context */
+ ctxt = xmlNewParserCtxt();
+ if (ctxt == NULL) {
+ fprintf(stderr, "Failed to allocate parser context\n");
+ return;
+ }
+ /* parse the file, activating the DTD validation option */
+ doc = xmlCtxtReadFile(ctxt, filename, NULL, XML_PARSE_DTDVALID);
+ /* check if parsing succeeded */
+ if (doc == NULL) {
+ fprintf(stderr, "Failed to parse %s\n", filename);
+ } else {
+ /* check if validation succeeded */
+ if (ctxt->valid == 0)
+ fprintf(stderr, "Failed to validate %s\n", filename);
+ /* free up the resulting document */
+ xmlFreeDoc(doc);
+ }
+ /* free up the parser context */
+ xmlFreeParserCtxt(ctxt);
+}
+
+int main(int argc, char **argv) {
+ if (argc != 2)
+ return(1);
+
+ /*
+ * this initialize the library and check potential ABI mismatches
+ * between the version it was compiled for and the actual shared
+ * library used.
+ */
+ LIBXML_TEST_VERSION
+
+ exampleFunc(argv[1]);
+
+ /*
+ * Cleanup function for the XML library.
+ */
+ xmlCleanupParser();
+ /*
+ * this is to debug memory for regression tests
+ */
+ xmlMemoryDump();
+ return(0);
+}
diff --git a/libxml2-2.9.10/doc/examples/parse3.c b/libxml2-2.9.10/doc/examples/parse3.c
new file mode 100644
index 0000000..076a786
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/parse3.c
@@ -0,0 +1,60 @@
+/**
+ * section: Parsing
+ * synopsis: Parse an XML document in memory to a tree and free it
+ * purpose: Demonstrate the use of xmlReadMemory() to read an XML file
+ * into a tree and xmlFreeDoc() to free the resulting tree
+ * usage: parse3
+ * test: parse3
+ * author: Daniel Veillard
+ * copy: see Copyright for the status of this software.
+ */
+
+#include <stdio.h>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+
+static const char *document = "<doc/>";
+
+/**
+ * example3Func:
+ * @content: the content of the document
+ * @length: the length in bytes
+ *
+ * Parse the in memory document and free the resulting tree
+ */
+static void
+example3Func(const char *content, int length) {
+ xmlDocPtr doc; /* the resulting document tree */
+
+ /*
+ * The document being in memory, it have no base per RFC 2396,
+ * and the "noname.xml" argument will serve as its base.
+ */
+ doc = xmlReadMemory(content, length, "noname.xml", NULL, 0);
+ if (doc == NULL) {
+ fprintf(stderr, "Failed to parse document\n");
+ return;
+ }
+ xmlFreeDoc(doc);
+}
+
+int main(void) {
+ /*
+ * this initialize the library and check potential ABI mismatches
+ * between the version it was compiled for and the actual shared
+ * library used.
+ */
+ LIBXML_TEST_VERSION
+
+ example3Func(document, 6);
+
+ /*
+ * Cleanup function for the XML library.
+ */
+ xmlCleanupParser();
+ /*
+ * this is to debug memory for regression tests
+ */
+ xmlMemoryDump();
+ return(0);
+}
diff --git a/libxml2-2.9.10/doc/examples/parse4.c b/libxml2-2.9.10/doc/examples/parse4.c
new file mode 100644
index 0000000..c7095e5
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/parse4.c
@@ -0,0 +1,143 @@
+/**
+ * section: Parsing
+ * synopsis: Parse an XML document chunk by chunk to a tree and free it
+ * purpose: Demonstrate the use of xmlCreatePushParserCtxt() and
+ * xmlParseChunk() to read an XML file progressively
+ * into a tree and xmlFreeDoc() to free the resulting tree
+ * usage: parse4 test3.xml
+ * test: parse4 test3.xml
+ * author: Daniel Veillard
+ * copy: see Copyright for the status of this software.
+ */
+
+#include <stdio.h>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+
+#ifdef LIBXML_PUSH_ENABLED
+static FILE *desc;
+
+/**
+ * readPacket:
+ * @mem: array to store the packet
+ * @size: the packet size
+ *
+ * read at most @size bytes from the document and store it in @mem
+ *
+ * Returns the number of bytes read
+ */
+static int
+readPacket(char *mem, int size) {
+ int res;
+
+ res = fread(mem, 1, size, desc);
+ return(res);
+}
+
+/**
+ * example4Func:
+ * @filename: a filename or an URL
+ *
+ * Parse the resource and free the resulting tree
+ */
+static void
+example4Func(const char *filename) {
+ xmlParserCtxtPtr ctxt;
+ char chars[4];
+ xmlDocPtr doc; /* the resulting document tree */
+ int res;
+
+ /*
+ * Read a few first byte to check the input used for the
+ * encoding detection at the parser level.
+ */
+ res = readPacket(chars, 4);
+ if (res <= 0) {
+ fprintf(stderr, "Failed to parse %s\n", filename);
+ return;
+ }
+
+ /*
+ * Create a progressive parsing context, the 2 first arguments
+ * are not used since we want to build a tree and not use a SAX
+ * parsing interface. We also pass the first bytes of the document
+ * to allow encoding detection when creating the parser but this
+ * is optional.
+ */
+ ctxt = xmlCreatePushParserCtxt(NULL, NULL,
+ chars, res, filename);
+ if (ctxt == NULL) {
+ fprintf(stderr, "Failed to create parser context !\n");
+ return;
+ }
+
+ /*
+ * loop on the input getting the document data, of course 4 bytes
+ * at a time is not realistic but allows to verify testing on small
+ * documents.
+ */
+ while ((res = readPacket(chars, 4)) > 0) {
+ xmlParseChunk(ctxt, chars, res, 0);
+ }
+
+ /*
+ * there is no more input, indicate the parsing is finished.
+ */
+ xmlParseChunk(ctxt, chars, 0, 1);
+
+ /*
+ * collect the document back and if it was wellformed
+ * and destroy the parser context.
+ */
+ doc = ctxt->myDoc;
+ res = ctxt->wellFormed;
+ xmlFreeParserCtxt(ctxt);
+
+ if (!res) {
+ fprintf(stderr, "Failed to parse %s\n", filename);
+ }
+
+ /*
+ * since we don't use the document, destroy it now.
+ */
+ xmlFreeDoc(doc);
+}
+
+int main(int argc, char **argv) {
+ if (argc != 2)
+ return(1);
+
+ /*
+ * this initialize the library and check potential ABI mismatches
+ * between the version it was compiled for and the actual shared
+ * library used.
+ */
+ LIBXML_TEST_VERSION
+
+ /*
+ * simulate a progressive parsing using the input file.
+ */
+ desc = fopen(argv[1], "rb");
+ if (desc != NULL) {
+ example4Func(argv[1]);
+ fclose(desc);
+ } else {
+ fprintf(stderr, "Failed to parse %s\n", argv[1]);
+ }
+
+ /*
+ * Cleanup function for the XML library.
+ */
+ xmlCleanupParser();
+ /*
+ * this is to debug memory for regression tests
+ */
+ xmlMemoryDump();
+ return(0);
+}
+#else /* ! LIBXML_PUSH_ENABLED */
+int main(int argc, char **argv) {
+ fprintf(stderr, "Library not compiled with push parser support\n");
+ return(1);
+}
+#endif
diff --git a/libxml2-2.9.10/doc/examples/reader1.c b/libxml2-2.9.10/doc/examples/reader1.c
new file mode 100644
index 0000000..e8a005a
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/reader1.c
@@ -0,0 +1,107 @@
+/**
+ * section: xmlReader
+ * synopsis: Parse an XML file with an xmlReader
+ * purpose: Demonstrate the use of xmlReaderForFile() to parse an XML file
+ * and dump the informations about the nodes found in the process.
+ * (Note that the XMLReader functions require libxml2 version later
+ * than 2.6.)
+ * usage: reader1 <filename>
+ * test: reader1 test2.xml > reader1.tmp && diff reader1.tmp $(srcdir)/reader1.res
+ * author: Daniel Veillard
+ * copy: see Copyright for the status of this software.
+ */
+
+#include <stdio.h>
+#include <libxml/xmlreader.h>
+
+#ifdef LIBXML_READER_ENABLED
+
+/**
+ * processNode:
+ * @reader: the xmlReader
+ *
+ * Dump information about the current node
+ */
+static void
+processNode(xmlTextReaderPtr reader) {
+ const xmlChar *name, *value;
+
+ name = xmlTextReaderConstName(reader);
+ if (name == NULL)
+ name = BAD_CAST "--";
+
+ value = xmlTextReaderConstValue(reader);
+
+ printf("%d %d %s %d %d",
+ xmlTextReaderDepth(reader),
+ xmlTextReaderNodeType(reader),
+ name,
+ xmlTextReaderIsEmptyElement(reader),
+ xmlTextReaderHasValue(reader));
+ if (value == NULL)
+ printf("\n");
+ else {
+ if (xmlStrlen(value) > 40)
+ printf(" %.40s...\n", value);
+ else
+ printf(" %s\n", value);
+ }
+}
+
+/**
+ * streamFile:
+ * @filename: the file name to parse
+ *
+ * Parse and print information about an XML file.
+ */
+static void
+streamFile(const char *filename) {
+ xmlTextReaderPtr reader;
+ int ret;
+
+ reader = xmlReaderForFile(filename, NULL, 0);
+ if (reader != NULL) {
+ ret = xmlTextReaderRead(reader);
+ while (ret == 1) {
+ processNode(reader);
+ ret = xmlTextReaderRead(reader);
+ }
+ xmlFreeTextReader(reader);
+ if (ret != 0) {
+ fprintf(stderr, "%s : failed to parse\n", filename);
+ }
+ } else {
+ fprintf(stderr, "Unable to open %s\n", filename);
+ }
+}
+
+int main(int argc, char **argv) {
+ if (argc != 2)
+ return(1);
+
+ /*
+ * this initialize the library and check potential ABI mismatches
+ * between the version it was compiled for and the actual shared
+ * library used.
+ */
+ LIBXML_TEST_VERSION
+
+ streamFile(argv[1]);
+
+ /*
+ * Cleanup function for the XML library.
+ */
+ xmlCleanupParser();
+ /*
+ * this is to debug memory for regression tests
+ */
+ xmlMemoryDump();
+ return(0);
+}
+
+#else
+int main(void) {
+ fprintf(stderr, "XInclude support not compiled in\n");
+ exit(1);
+}
+#endif
diff --git a/libxml2-2.9.10/doc/examples/reader1.res b/libxml2-2.9.10/doc/examples/reader1.res
new file mode 100644
index 0000000..eb48d85
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/reader1.res
@@ -0,0 +1,14 @@
+0 10 doc 0 0
+0 1 doc 0 0
+1 14 #text 0 1
+
+1 1 src 1 0
+1 14 #text 0 1
+
+1 1 dest 1 0
+1 14 #text 0 1
+
+1 1 src 1 0
+1 14 #text 0 1
+
+0 15 doc 0 0
diff --git a/libxml2-2.9.10/doc/examples/reader2.c b/libxml2-2.9.10/doc/examples/reader2.c
new file mode 100644
index 0000000..043b137
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/reader2.c
@@ -0,0 +1,122 @@
+/**
+ * section: xmlReader
+ * synopsis: Parse and validate an XML file with an xmlReader
+ * purpose: Demonstrate the use of xmlReaderForFile() to parse an XML file
+ * validating the content in the process and activating options
+ * like entities substitution, and DTD attributes defaulting.
+ * (Note that the XMLReader functions require libxml2 version later
+ * than 2.6.)
+ * usage: reader2 <valid_xml_filename>
+ * test: reader2 test2.xml > reader1.tmp && diff reader1.tmp $(srcdir)/reader1.res
+ * author: Daniel Veillard
+ * copy: see Copyright for the status of this software.
+ */
+
+#include <stdio.h>
+#include <libxml/xmlreader.h>
+
+#ifdef LIBXML_READER_ENABLED
+
+/**
+ * processNode:
+ * @reader: the xmlReader
+ *
+ * Dump information about the current node
+ */
+static void
+processNode(xmlTextReaderPtr reader) {
+ const xmlChar *name, *value;
+
+ name = xmlTextReaderConstName(reader);
+ if (name == NULL)
+ name = BAD_CAST "--";
+
+ value = xmlTextReaderConstValue(reader);
+
+ printf("%d %d %s %d %d",
+ xmlTextReaderDepth(reader),
+ xmlTextReaderNodeType(reader),
+ name,
+ xmlTextReaderIsEmptyElement(reader),
+ xmlTextReaderHasValue(reader));
+ if (value == NULL)
+ printf("\n");
+ else {
+ if (xmlStrlen(value) > 40)
+ printf(" %.40s...\n", value);
+ else
+ printf(" %s\n", value);
+ }
+}
+
+/**
+ * streamFile:
+ * @filename: the file name to parse
+ *
+ * Parse, validate and print information about an XML file.
+ */
+static void
+streamFile(const char *filename) {
+ xmlTextReaderPtr reader;
+ int ret;
+
+
+ /*
+ * Pass some special parsing options to activate DTD attribute defaulting,
+ * entities substitution and DTD validation
+ */
+ reader = xmlReaderForFile(filename, NULL,
+ XML_PARSE_DTDATTR | /* default DTD attributes */
+ XML_PARSE_NOENT | /* substitute entities */
+ XML_PARSE_DTDVALID); /* validate with the DTD */
+ if (reader != NULL) {
+ ret = xmlTextReaderRead(reader);
+ while (ret == 1) {
+ processNode(reader);
+ ret = xmlTextReaderRead(reader);
+ }
+ /*
+ * Once the document has been fully parsed check the validation results
+ */
+ if (xmlTextReaderIsValid(reader) != 1) {
+ fprintf(stderr, "Document %s does not validate\n", filename);
+ }
+ xmlFreeTextReader(reader);
+ if (ret != 0) {
+ fprintf(stderr, "%s : failed to parse\n", filename);
+ }
+ } else {
+ fprintf(stderr, "Unable to open %s\n", filename);
+ }
+}
+
+int main(int argc, char **argv) {
+ if (argc != 2)
+ return(1);
+
+ /*
+ * this initialize the library and check potential ABI mismatches
+ * between the version it was compiled for and the actual shared
+ * library used.
+ */
+ LIBXML_TEST_VERSION
+
+ streamFile(argv[1]);
+
+ /*
+ * Cleanup function for the XML library.
+ */
+ xmlCleanupParser();
+ /*
+ * this is to debug memory for regression tests
+ */
+ xmlMemoryDump();
+ return(0);
+}
+
+#else
+int main(void) {
+ fprintf(stderr, "XInclude support not compiled in\n");
+ exit(1);
+}
+#endif
diff --git a/libxml2-2.9.10/doc/examples/reader3.c b/libxml2-2.9.10/doc/examples/reader3.c
new file mode 100644
index 0000000..1899474
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/reader3.c
@@ -0,0 +1,120 @@
+/**
+ * section: xmlReader
+ * synopsis: Show how to extract subdocuments with xmlReader
+ * purpose: Demonstrate the use of xmlTextReaderPreservePattern()
+ * to parse an XML file with the xmlReader while collecting
+ * only some subparts of the document.
+ * (Note that the XMLReader functions require libxml2 version later
+ * than 2.6.)
+ * usage: reader3
+ * test: reader3 > reader3.tmp && diff reader3.tmp $(srcdir)/reader3.res
+ * author: Daniel Veillard
+ * copy: see Copyright for the status of this software.
+ */
+
+#include <stdio.h>
+#include <libxml/xmlreader.h>
+
+#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
+
+
+/**
+ * streamFile:
+ * @filename: the file name to parse
+ *
+ * Parse and print information about an XML file.
+ *
+ * Returns the resulting doc with just the elements preserved.
+ */
+static xmlDocPtr
+extractFile(const char *filename, const xmlChar *pattern) {
+ xmlDocPtr doc;
+ xmlTextReaderPtr reader;
+ int ret;
+
+ /*
+ * build an xmlReader for that file
+ */
+ reader = xmlReaderForFile(filename, NULL, 0);
+ if (reader != NULL) {
+ /*
+ * add the pattern to preserve
+ */
+ if (xmlTextReaderPreservePattern(reader, pattern, NULL) < 0) {
+ fprintf(stderr, "%s : failed add preserve pattern %s\n",
+ filename, (const char *) pattern);
+ }
+ /*
+ * Parse and traverse the tree, collecting the nodes in the process
+ */
+ ret = xmlTextReaderRead(reader);
+ while (ret == 1) {
+ ret = xmlTextReaderRead(reader);
+ }
+ if (ret != 0) {
+ fprintf(stderr, "%s : failed to parse\n", filename);
+ xmlFreeTextReader(reader);
+ return(NULL);
+ }
+ /*
+ * get the resulting nodes
+ */
+ doc = xmlTextReaderCurrentDoc(reader);
+ /*
+ * Free up the reader
+ */
+ xmlFreeTextReader(reader);
+ } else {
+ fprintf(stderr, "Unable to open %s\n", filename);
+ return(NULL);
+ }
+ return(doc);
+}
+
+int main(int argc, char **argv) {
+ const char *filename = "test3.xml";
+ const char *pattern = "preserved";
+ xmlDocPtr doc;
+
+ if (argc == 3) {
+ filename = argv[1];
+ pattern = argv[2];
+ }
+
+ /*
+ * this initialize the library and check potential ABI mismatches
+ * between the version it was compiled for and the actual shared
+ * library used.
+ */
+ LIBXML_TEST_VERSION
+
+ doc = extractFile(filename, (const xmlChar *) pattern);
+ if (doc != NULL) {
+ /*
+ * output the result.
+ */
+ xmlDocDump(stdout, doc);
+ /*
+ * don't forget to free up the doc
+ */
+ xmlFreeDoc(doc);
+ }
+
+
+ /*
+ * Cleanup function for the XML library.
+ */
+ xmlCleanupParser();
+ /*
+ * this is to debug memory for regression tests
+ */
+ xmlMemoryDump();
+ return(0);
+}
+
+#else
+int main(void) {
+ fprintf(stderr, "Reader, Pattern or output support not compiled in\n");
+ exit(1);
+}
+#endif
diff --git a/libxml2-2.9.10/doc/examples/reader3.res b/libxml2-2.9.10/doc/examples/reader3.res
new file mode 100644
index 0000000..20e2e82
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/reader3.res
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<doc><parent><preserved/><preserved>
+ content1
+ <child1/>
+ <child2>content2</child2>
+ <preserved>too</preserved>
+ <child2>content3</child2>
+ <preserved/>
+ <child2>content4</child2>
+ <preserved/>
+ <child2>content5</child2>
+ content6
+ </preserved><preserved/><preserved/></parent></doc>
diff --git a/libxml2-2.9.10/doc/examples/reader4.c b/libxml2-2.9.10/doc/examples/reader4.c
new file mode 100644
index 0000000..5ed5883
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/reader4.c
@@ -0,0 +1,122 @@
+/**
+ * section: xmlReader
+ * synopsis: Parse multiple XML files reusing an xmlReader
+ * purpose: Demonstrate the use of xmlReaderForFile() and
+ * xmlReaderNewFile to parse XML files while reusing the reader object
+ * and parser context. (Note that the XMLReader functions require
+ * libxml2 version later than 2.6.)
+ * usage: reader4 <filename> [ filename ... ]
+ * test: reader4 test1.xml test2.xml test3.xml > reader4.tmp && diff reader4.tmp $(srcdir)/reader4.res
+ * author: Graham Bennett
+ * copy: see Copyright for the status of this software.
+ */
+
+#include <stdio.h>
+#include <libxml/xmlreader.h>
+
+#ifdef LIBXML_READER_ENABLED
+
+static void processDoc(xmlTextReaderPtr readerPtr) {
+ int ret;
+ xmlDocPtr docPtr;
+ const xmlChar *URL;
+
+ ret = xmlTextReaderRead(readerPtr);
+ while (ret == 1) {
+ ret = xmlTextReaderRead(readerPtr);
+ }
+
+ /*
+ * One can obtain the document pointer to get interesting
+ * information about the document like the URL, but one must also
+ * be sure to clean it up at the end (see below).
+ */
+ docPtr = xmlTextReaderCurrentDoc(readerPtr);
+ if (NULL == docPtr) {
+ fprintf(stderr, "failed to obtain document\n");
+ return;
+ }
+
+ URL = docPtr->URL;
+ if (NULL == URL) {
+ fprintf(stderr, "Failed to obtain URL\n");
+ }
+
+ if (ret != 0) {
+ fprintf(stderr, "%s: Failed to parse\n", URL);
+ return;
+ }
+
+ printf("%s: Processed ok\n", (const char *)URL);
+}
+
+int main(int argc, char **argv) {
+ xmlTextReaderPtr readerPtr;
+ int i;
+ xmlDocPtr docPtr;
+
+ if (argc < 2)
+ return(1);
+
+ /*
+ * this initialises the library and check potential ABI mismatches
+ * between the version it was compiled for and the actual shared
+ * library used.
+ */
+ LIBXML_TEST_VERSION
+
+ /*
+ * Create a new reader for the first file and process the
+ * document.
+ */
+ readerPtr = xmlReaderForFile(argv[1], NULL, 0);
+ if (NULL == readerPtr) {
+ fprintf(stderr, "%s: failed to create reader\n", argv[1]);
+ return(1);
+ }
+ processDoc(readerPtr);
+
+ /*
+ * The reader can be reused for subsequent files.
+ */
+ for (i=2; i < argc; ++i) {
+ xmlReaderNewFile(readerPtr, argv[i], NULL, 0);
+ if (NULL == readerPtr) {
+ fprintf(stderr, "%s: failed to create reader\n", argv[i]);
+ return(1);
+ }
+ processDoc(readerPtr);
+ }
+
+ /*
+ * Since we've called xmlTextReaderCurrentDoc, we now have to
+ * clean up after ourselves. We only have to do this the last
+ * time, because xmlReaderNewFile calls xmlCtxtReset which takes
+ * care of it.
+ */
+ docPtr = xmlTextReaderCurrentDoc(readerPtr);
+ if (docPtr != NULL)
+ xmlFreeDoc(docPtr);
+
+ /*
+ * Clean up the reader.
+ */
+ xmlFreeTextReader(readerPtr);
+
+ /*
+ * Cleanup function for the XML library.
+ */
+ xmlCleanupParser();
+ /*
+ * this is to debug memory for regression tests
+ */
+ xmlMemoryDump();
+ return(0);
+}
+
+#else
+int main(void) {
+ fprintf(stderr, "xmlReader support not compiled in\n");
+ exit(1);
+}
+#endif
diff --git a/libxml2-2.9.10/doc/examples/reader4.res b/libxml2-2.9.10/doc/examples/reader4.res
new file mode 100644
index 0000000..b793f82
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/reader4.res
@@ -0,0 +1,3 @@
+test1.xml: Processed ok
+test2.xml: Processed ok
+test3.xml: Processed ok
diff --git a/libxml2-2.9.10/doc/examples/test1.xml b/libxml2-2.9.10/doc/examples/test1.xml
new file mode 100644
index 0000000..69d62f2
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/test1.xml
@@ -0,0 +1 @@
+<doc/>
diff --git a/libxml2-2.9.10/doc/examples/test2.xml b/libxml2-2.9.10/doc/examples/test2.xml
new file mode 100644
index 0000000..7390f5e
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/test2.xml
@@ -0,0 +1,13 @@
+<!DOCTYPE doc [
+<!ELEMENT doc (src | dest)*>
+<!ELEMENT src EMPTY>
+<!ELEMENT dest EMPTY>
+<!ATTLIST src ref IDREF #IMPLIED>
+<!ATTLIST dest id ID #IMPLIED>
+]>
+<doc>
+ <src ref="foo"/>
+ <dest id="foo"/>
+ <src ref="foo"/>
+</doc>
+
diff --git a/libxml2-2.9.10/doc/examples/test3.xml b/libxml2-2.9.10/doc/examples/test3.xml
new file mode 100644
index 0000000..4d0828f
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/test3.xml
@@ -0,0 +1,39 @@
+<doc>
+ <parent>
+ <discarded>
+ <discarded/>
+ </discarded>
+ <preserved/>
+ This text node must be discarded
+ <discarded>
+ <discarded/>
+ </discarded>
+ <preserved>
+ content1
+ <child1></child1>
+ <child2>content2</child2>
+ <preserved>too</preserved>
+ <child2>content3</child2>
+ <preserved></preserved>
+ <child2>content4</child2>
+ <preserved/>
+ <child2>content5</child2>
+ content6
+ </preserved>
+ This text node must be discarded
+ <discarded>
+ <discarded/>
+ </discarded>
+ This text node must be discarded
+ <preserved></preserved>
+ This text node must be discarded
+ <preserved/>
+ This text node must be discarded
+ <discarded>
+ <discarded/>
+ </discarded>
+ This text node must be discarded
+ </parent>
+</doc>
+
+
diff --git a/libxml2-2.9.10/doc/examples/testWriter.c b/libxml2-2.9.10/doc/examples/testWriter.c
new file mode 100644
index 0000000..82e8d3a
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/testWriter.c
@@ -0,0 +1,1198 @@
+/**
+ * section: xmlWriter
+ * synopsis: use various APIs for the xmlWriter
+ * purpose: tests a number of APIs for the xmlWriter, especially
+ * the various methods to write to a filename, to a memory
+ * buffer, to a new document, or to a subtree. It shows how to
+ * do encoding string conversions too. The resulting
+ * documents are then serialized.
+ * usage: testWriter
+ * test: testWriter && for i in 1 2 3 4 ; do diff $(srcdir)/writer.xml writer$$i.tmp || break ; done
+ * author: Alfred Mickautsch
+ * copy: see Copyright for the status of this software.
+ */
+#include <stdio.h>
+#include <string.h>
+#include <libxml/encoding.h>
+#include <libxml/xmlwriter.h>
+
+#if defined(LIBXML_WRITER_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
+
+#define MY_ENCODING "ISO-8859-1"
+
+void testXmlwriterFilename(const char *uri);
+void testXmlwriterMemory(const char *file);
+void testXmlwriterDoc(const char *file);
+void testXmlwriterTree(const char *file);
+xmlChar *ConvertInput(const char *in, const char *encoding);
+
+int
+main(void)
+{
+ /*
+ * this initialize the library and check potential ABI mismatches
+ * between the version it was compiled for and the actual shared
+ * library used.
+ */
+ LIBXML_TEST_VERSION
+
+ /* first, the file version */
+ testXmlwriterFilename("writer1.tmp");
+
+ /* next, the memory version */
+ testXmlwriterMemory("writer2.tmp");
+
+ /* next, the DOM version */
+ testXmlwriterDoc("writer3.tmp");
+
+ /* next, the tree version */
+ testXmlwriterTree("writer4.tmp");
+
+ /*
+ * Cleanup function for the XML library.
+ */
+ xmlCleanupParser();
+ /*
+ * this is to debug memory for regression tests
+ */
+ xmlMemoryDump();
+ return 0;
+}
+
+/**
+ * testXmlwriterFilename:
+ * @uri: the output URI
+ *
+ * test the xmlWriter interface when writing to a new file
+ */
+void
+testXmlwriterFilename(const char *uri)
+{
+ int rc;
+ xmlTextWriterPtr writer;
+ xmlChar *tmp;
+
+ /* Create a new XmlWriter for uri, with no compression. */
+ writer = xmlNewTextWriterFilename(uri, 0);
+ if (writer == NULL) {
+ printf("testXmlwriterFilename: Error creating the xml writer\n");
+ return;
+ }
+
+ /* Start the document with the xml default for the version,
+ * encoding ISO 8859-1 and the default for the standalone
+ * declaration. */
+ rc = xmlTextWriterStartDocument(writer, NULL, MY_ENCODING, NULL);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterStartDocument\n");
+ return;
+ }
+
+ /* Start an element named "EXAMPLE". Since thist is the first
+ * element, this will be the root element of the document. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "EXAMPLE");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Write a comment as child of EXAMPLE.
+ * Please observe, that the input to the xmlTextWriter functions
+ * HAS to be in UTF-8, even if the output XML is encoded
+ * in iso-8859-1 */
+ tmp = ConvertInput("This is a comment with special chars: <\xE4\xF6\xFC>",
+ MY_ENCODING);
+ rc = xmlTextWriterWriteComment(writer, tmp);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterWriteComment\n");
+ return;
+ }
+ if (tmp != NULL) xmlFree(tmp);
+
+ /* Start an element named "ORDER" as child of EXAMPLE. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "ORDER");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Add an attribute with name "version" and value "1.0" to ORDER. */
+ rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "version",
+ BAD_CAST "1.0");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterWriteAttribute\n");
+ return;
+ }
+
+ /* Add an attribute with name "xml:lang" and value "de" to ORDER. */
+ rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "xml:lang",
+ BAD_CAST "de");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterWriteAttribute\n");
+ return;
+ }
+
+ /* Write a comment as child of ORDER */
+ tmp = ConvertInput("<\xE4\xF6\xFC>", MY_ENCODING);
+ rc = xmlTextWriterWriteFormatComment(writer,
+ "This is another comment with special chars: %s",
+ tmp);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterWriteFormatComment\n");
+ return;
+ }
+ if (tmp != NULL) xmlFree(tmp);
+
+ /* Start an element named "HEADER" as child of ORDER. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "HEADER");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Write an element named "X_ORDER_ID" as child of HEADER. */
+ rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "X_ORDER_ID",
+ "%010d", 53535);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterWriteFormatElement\n");
+ return;
+ }
+
+ /* Write an element named "CUSTOMER_ID" as child of HEADER. */
+ rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "CUSTOMER_ID",
+ "%d", 1010);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterWriteFormatElement\n");
+ return;
+ }
+
+ /* Write an element named "NAME_1" as child of HEADER. */
+ tmp = ConvertInput("M\xFCller", MY_ENCODING);
+ rc = xmlTextWriterWriteElement(writer, BAD_CAST "NAME_1", tmp);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterWriteElement\n");
+ return;
+ }
+ if (tmp != NULL) xmlFree(tmp);
+
+ /* Write an element named "NAME_2" as child of HEADER. */
+ tmp = ConvertInput("J\xF6rg", MY_ENCODING);
+ rc = xmlTextWriterWriteElement(writer, BAD_CAST "NAME_2", tmp);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterWriteElement\n");
+ return;
+ }
+ if (tmp != NULL) xmlFree(tmp);
+
+ /* Close the element named HEADER. */
+ rc = xmlTextWriterEndElement(writer);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterEndElement\n");
+ return;
+ }
+
+ /* Start an element named "ENTRIES" as child of ORDER. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "ENTRIES");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Start an element named "ENTRY" as child of ENTRIES. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "ENTRY");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Write an element named "ARTICLE" as child of ENTRY. */
+ rc = xmlTextWriterWriteElement(writer, BAD_CAST "ARTICLE",
+ BAD_CAST "<Test>");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterWriteElement\n");
+ return;
+ }
+
+ /* Write an element named "ENTRY_NO" as child of ENTRY. */
+ rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ENTRY_NO", "%d",
+ 10);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterWriteFormatElement\n");
+ return;
+ }
+
+ /* Close the element named ENTRY. */
+ rc = xmlTextWriterEndElement(writer);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterEndElement\n");
+ return;
+ }
+
+ /* Start an element named "ENTRY" as child of ENTRIES. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "ENTRY");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Write an element named "ARTICLE" as child of ENTRY. */
+ rc = xmlTextWriterWriteElement(writer, BAD_CAST "ARTICLE",
+ BAD_CAST "<Test 2>");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterWriteElement\n");
+ return;
+ }
+
+ /* Write an element named "ENTRY_NO" as child of ENTRY. */
+ rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ENTRY_NO", "%d",
+ 20);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterWriteFormatElement\n");
+ return;
+ }
+
+ /* Close the element named ENTRY. */
+ rc = xmlTextWriterEndElement(writer);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterEndElement\n");
+ return;
+ }
+
+ /* Close the element named ENTRIES. */
+ rc = xmlTextWriterEndElement(writer);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterEndElement\n");
+ return;
+ }
+
+ /* Start an element named "FOOTER" as child of ORDER. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "FOOTER");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Write an element named "TEXT" as child of FOOTER. */
+ rc = xmlTextWriterWriteElement(writer, BAD_CAST "TEXT",
+ BAD_CAST "This is a text.");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterWriteElement\n");
+ return;
+ }
+
+ /* Close the element named FOOTER. */
+ rc = xmlTextWriterEndElement(writer);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterEndElement\n");
+ return;
+ }
+
+ /* Here we could close the elements ORDER and EXAMPLE using the
+ * function xmlTextWriterEndElement, but since we do not want to
+ * write any other elements, we simply call xmlTextWriterEndDocument,
+ * which will do all the work. */
+ rc = xmlTextWriterEndDocument(writer);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterFilename: Error at xmlTextWriterEndDocument\n");
+ return;
+ }
+
+ xmlFreeTextWriter(writer);
+}
+
+/**
+ * testXmlwriterMemory:
+ * @file: the output file
+ *
+ * test the xmlWriter interface when writing to memory
+ */
+void
+testXmlwriterMemory(const char *file)
+{
+ int rc;
+ xmlTextWriterPtr writer;
+ xmlBufferPtr buf;
+ xmlChar *tmp;
+ FILE *fp;
+
+ /* Create a new XML buffer, to which the XML document will be
+ * written */
+ buf = xmlBufferCreate();
+ if (buf == NULL) {
+ printf("testXmlwriterMemory: Error creating the xml buffer\n");
+ return;
+ }
+
+ /* Create a new XmlWriter for memory, with no compression.
+ * Remark: there is no compression for this kind of xmlTextWriter */
+ writer = xmlNewTextWriterMemory(buf, 0);
+ if (writer == NULL) {
+ printf("testXmlwriterMemory: Error creating the xml writer\n");
+ return;
+ }
+
+ /* Start the document with the xml default for the version,
+ * encoding ISO 8859-1 and the default for the standalone
+ * declaration. */
+ rc = xmlTextWriterStartDocument(writer, NULL, MY_ENCODING, NULL);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterMemory: Error at xmlTextWriterStartDocument\n");
+ return;
+ }
+
+ /* Start an element named "EXAMPLE". Since thist is the first
+ * element, this will be the root element of the document. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "EXAMPLE");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterMemory: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Write a comment as child of EXAMPLE.
+ * Please observe, that the input to the xmlTextWriter functions
+ * HAS to be in UTF-8, even if the output XML is encoded
+ * in iso-8859-1 */
+ tmp = ConvertInput("This is a comment with special chars: <\xE4\xF6\xFC>",
+ MY_ENCODING);
+ rc = xmlTextWriterWriteComment(writer, tmp);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterMemory: Error at xmlTextWriterWriteComment\n");
+ return;
+ }
+ if (tmp != NULL) xmlFree(tmp);
+
+ /* Start an element named "ORDER" as child of EXAMPLE. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "ORDER");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterMemory: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Add an attribute with name "version" and value "1.0" to ORDER. */
+ rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "version",
+ BAD_CAST "1.0");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterMemory: Error at xmlTextWriterWriteAttribute\n");
+ return;
+ }
+
+ /* Add an attribute with name "xml:lang" and value "de" to ORDER. */
+ rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "xml:lang",
+ BAD_CAST "de");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterMemory: Error at xmlTextWriterWriteAttribute\n");
+ return;
+ }
+
+ /* Write a comment as child of ORDER */
+ tmp = ConvertInput("<\xE4\xF6\xFC>", MY_ENCODING);
+ rc = xmlTextWriterWriteFormatComment(writer,
+ "This is another comment with special chars: %s",
+ tmp);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterMemory: Error at xmlTextWriterWriteFormatComment\n");
+ return;
+ }
+ if (tmp != NULL) xmlFree(tmp);
+
+ /* Start an element named "HEADER" as child of ORDER. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "HEADER");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterMemory: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Write an element named "X_ORDER_ID" as child of HEADER. */
+ rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "X_ORDER_ID",
+ "%010d", 53535);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterMemory: Error at xmlTextWriterWriteFormatElement\n");
+ return;
+ }
+
+ /* Write an element named "CUSTOMER_ID" as child of HEADER. */
+ rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "CUSTOMER_ID",
+ "%d", 1010);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterMemory: Error at xmlTextWriterWriteFormatElement\n");
+ return;
+ }
+
+ /* Write an element named "NAME_1" as child of HEADER. */
+ tmp = ConvertInput("M\xFCller", MY_ENCODING);
+ rc = xmlTextWriterWriteElement(writer, BAD_CAST "NAME_1", tmp);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterMemory: Error at xmlTextWriterWriteElement\n");
+ return;
+ }
+ if (tmp != NULL) xmlFree(tmp);
+
+ /* Write an element named "NAME_2" as child of HEADER. */
+ tmp = ConvertInput("J\xF6rg", MY_ENCODING);
+ rc = xmlTextWriterWriteElement(writer, BAD_CAST "NAME_2", tmp);
+
+ if (rc < 0) {
+ printf
+ ("testXmlwriterMemory: Error at xmlTextWriterWriteElement\n");
+ return;
+ }
+ if (tmp != NULL) xmlFree(tmp);
+
+ /* Close the element named HEADER. */
+ rc = xmlTextWriterEndElement(writer);
+ if (rc < 0) {
+ printf("testXmlwriterMemory: Error at xmlTextWriterEndElement\n");
+ return;
+ }
+
+ /* Start an element named "ENTRIES" as child of ORDER. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "ENTRIES");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterMemory: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Start an element named "ENTRY" as child of ENTRIES. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "ENTRY");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterMemory: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Write an element named "ARTICLE" as child of ENTRY. */
+ rc = xmlTextWriterWriteElement(writer, BAD_CAST "ARTICLE",
+ BAD_CAST "<Test>");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterMemory: Error at xmlTextWriterWriteElement\n");
+ return;
+ }
+
+ /* Write an element named "ENTRY_NO" as child of ENTRY. */
+ rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ENTRY_NO", "%d",
+ 10);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterMemory: Error at xmlTextWriterWriteFormatElement\n");
+ return;
+ }
+
+ /* Close the element named ENTRY. */
+ rc = xmlTextWriterEndElement(writer);
+ if (rc < 0) {
+ printf("testXmlwriterMemory: Error at xmlTextWriterEndElement\n");
+ return;
+ }
+
+ /* Start an element named "ENTRY" as child of ENTRIES. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "ENTRY");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterMemory: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Write an element named "ARTICLE" as child of ENTRY. */
+ rc = xmlTextWriterWriteElement(writer, BAD_CAST "ARTICLE",
+ BAD_CAST "<Test 2>");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterMemory: Error at xmlTextWriterWriteElement\n");
+ return;
+ }
+
+ /* Write an element named "ENTRY_NO" as child of ENTRY. */
+ rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ENTRY_NO", "%d",
+ 20);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterMemory: Error at xmlTextWriterWriteFormatElement\n");
+ return;
+ }
+
+ /* Close the element named ENTRY. */
+ rc = xmlTextWriterEndElement(writer);
+ if (rc < 0) {
+ printf("testXmlwriterMemory: Error at xmlTextWriterEndElement\n");
+ return;
+ }
+
+ /* Close the element named ENTRIES. */
+ rc = xmlTextWriterEndElement(writer);
+ if (rc < 0) {
+ printf("testXmlwriterMemory: Error at xmlTextWriterEndElement\n");
+ return;
+ }
+
+ /* Start an element named "FOOTER" as child of ORDER. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "FOOTER");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterMemory: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Write an element named "TEXT" as child of FOOTER. */
+ rc = xmlTextWriterWriteElement(writer, BAD_CAST "TEXT",
+ BAD_CAST "This is a text.");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterMemory: Error at xmlTextWriterWriteElement\n");
+ return;
+ }
+
+ /* Close the element named FOOTER. */
+ rc = xmlTextWriterEndElement(writer);
+ if (rc < 0) {
+ printf("testXmlwriterMemory: Error at xmlTextWriterEndElement\n");
+ return;
+ }
+
+ /* Here we could close the elements ORDER and EXAMPLE using the
+ * function xmlTextWriterEndElement, but since we do not want to
+ * write any other elements, we simply call xmlTextWriterEndDocument,
+ * which will do all the work. */
+ rc = xmlTextWriterEndDocument(writer);
+ if (rc < 0) {
+ printf("testXmlwriterMemory: Error at xmlTextWriterEndDocument\n");
+ return;
+ }
+
+ xmlFreeTextWriter(writer);
+
+ fp = fopen(file, "w");
+ if (fp == NULL) {
+ printf("testXmlwriterMemory: Error at fopen\n");
+ return;
+ }
+
+ fprintf(fp, "%s", (const char *) buf->content);
+
+ fclose(fp);
+
+ xmlBufferFree(buf);
+}
+
+/**
+ * testXmlwriterDoc:
+ * @file: the output file
+ *
+ * test the xmlWriter interface when creating a new document
+ */
+void
+testXmlwriterDoc(const char *file)
+{
+ int rc;
+ xmlTextWriterPtr writer;
+ xmlChar *tmp;
+ xmlDocPtr doc;
+
+
+ /* Create a new XmlWriter for DOM, with no compression. */
+ writer = xmlNewTextWriterDoc(&doc, 0);
+ if (writer == NULL) {
+ printf("testXmlwriterDoc: Error creating the xml writer\n");
+ return;
+ }
+
+ /* Start the document with the xml default for the version,
+ * encoding ISO 8859-1 and the default for the standalone
+ * declaration. */
+ rc = xmlTextWriterStartDocument(writer, NULL, MY_ENCODING, NULL);
+ if (rc < 0) {
+ printf("testXmlwriterDoc: Error at xmlTextWriterStartDocument\n");
+ return;
+ }
+
+ /* Start an element named "EXAMPLE". Since thist is the first
+ * element, this will be the root element of the document. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "EXAMPLE");
+ if (rc < 0) {
+ printf("testXmlwriterDoc: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Write a comment as child of EXAMPLE.
+ * Please observe, that the input to the xmlTextWriter functions
+ * HAS to be in UTF-8, even if the output XML is encoded
+ * in iso-8859-1 */
+ tmp = ConvertInput("This is a comment with special chars: <\xE4\xF6\xFC>",
+ MY_ENCODING);
+ rc = xmlTextWriterWriteComment(writer, tmp);
+ if (rc < 0) {
+ printf("testXmlwriterDoc: Error at xmlTextWriterWriteComment\n");
+ return;
+ }
+ if (tmp != NULL) xmlFree(tmp);
+
+ /* Start an element named "ORDER" as child of EXAMPLE. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "ORDER");
+ if (rc < 0) {
+ printf("testXmlwriterDoc: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Add an attribute with name "version" and value "1.0" to ORDER. */
+ rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "version",
+ BAD_CAST "1.0");
+ if (rc < 0) {
+ printf("testXmlwriterDoc: Error at xmlTextWriterWriteAttribute\n");
+ return;
+ }
+
+ /* Add an attribute with name "xml:lang" and value "de" to ORDER. */
+ rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "xml:lang",
+ BAD_CAST "de");
+ if (rc < 0) {
+ printf("testXmlwriterDoc: Error at xmlTextWriterWriteAttribute\n");
+ return;
+ }
+
+ /* Write a comment as child of ORDER */
+ tmp = ConvertInput("<\xE4\xF6\xFC>", MY_ENCODING);
+ rc = xmlTextWriterWriteFormatComment(writer,
+ "This is another comment with special chars: %s",
+ tmp);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterDoc: Error at xmlTextWriterWriteFormatComment\n");
+ return;
+ }
+ if (tmp != NULL) xmlFree(tmp);
+
+ /* Start an element named "HEADER" as child of ORDER. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "HEADER");
+ if (rc < 0) {
+ printf("testXmlwriterDoc: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Write an element named "X_ORDER_ID" as child of HEADER. */
+ rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "X_ORDER_ID",
+ "%010d", 53535);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterDoc: Error at xmlTextWriterWriteFormatElement\n");
+ return;
+ }
+
+ /* Write an element named "CUSTOMER_ID" as child of HEADER. */
+ rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "CUSTOMER_ID",
+ "%d", 1010);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterDoc: Error at xmlTextWriterWriteFormatElement\n");
+ return;
+ }
+
+ /* Write an element named "NAME_1" as child of HEADER. */
+ tmp = ConvertInput("M\xFCller", MY_ENCODING);
+ rc = xmlTextWriterWriteElement(writer, BAD_CAST "NAME_1", tmp);
+ if (rc < 0) {
+ printf("testXmlwriterDoc: Error at xmlTextWriterWriteElement\n");
+ return;
+ }
+ if (tmp != NULL) xmlFree(tmp);
+
+ /* Write an element named "NAME_2" as child of HEADER. */
+ tmp = ConvertInput("J\xF6rg", MY_ENCODING);
+ rc = xmlTextWriterWriteElement(writer, BAD_CAST "NAME_2", tmp);
+ if (rc < 0) {
+ printf("testXmlwriterDoc: Error at xmlTextWriterWriteElement\n");
+ return;
+ }
+ if (tmp != NULL) xmlFree(tmp);
+
+ /* Close the element named HEADER. */
+ rc = xmlTextWriterEndElement(writer);
+ if (rc < 0) {
+ printf("testXmlwriterDoc: Error at xmlTextWriterEndElement\n");
+ return;
+ }
+
+ /* Start an element named "ENTRIES" as child of ORDER. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "ENTRIES");
+ if (rc < 0) {
+ printf("testXmlwriterDoc: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Start an element named "ENTRY" as child of ENTRIES. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "ENTRY");
+ if (rc < 0) {
+ printf("testXmlwriterDoc: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Write an element named "ARTICLE" as child of ENTRY. */
+ rc = xmlTextWriterWriteElement(writer, BAD_CAST "ARTICLE",
+ BAD_CAST "<Test>");
+ if (rc < 0) {
+ printf("testXmlwriterDoc: Error at xmlTextWriterWriteElement\n");
+ return;
+ }
+
+ /* Write an element named "ENTRY_NO" as child of ENTRY. */
+ rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ENTRY_NO", "%d",
+ 10);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterDoc: Error at xmlTextWriterWriteFormatElement\n");
+ return;
+ }
+
+ /* Close the element named ENTRY. */
+ rc = xmlTextWriterEndElement(writer);
+ if (rc < 0) {
+ printf("testXmlwriterDoc: Error at xmlTextWriterEndElement\n");
+ return;
+ }
+
+ /* Start an element named "ENTRY" as child of ENTRIES. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "ENTRY");
+ if (rc < 0) {
+ printf("testXmlwriterDoc: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Write an element named "ARTICLE" as child of ENTRY. */
+ rc = xmlTextWriterWriteElement(writer, BAD_CAST "ARTICLE",
+ BAD_CAST "<Test 2>");
+ if (rc < 0) {
+ printf("testXmlwriterDoc: Error at xmlTextWriterWriteElement\n");
+ return;
+ }
+
+ /* Write an element named "ENTRY_NO" as child of ENTRY. */
+ rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ENTRY_NO", "%d",
+ 20);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterDoc: Error at xmlTextWriterWriteFormatElement\n");
+ return;
+ }
+
+ /* Close the element named ENTRY. */
+ rc = xmlTextWriterEndElement(writer);
+ if (rc < 0) {
+ printf("testXmlwriterDoc: Error at xmlTextWriterEndElement\n");
+ return;
+ }
+
+ /* Close the element named ENTRIES. */
+ rc = xmlTextWriterEndElement(writer);
+ if (rc < 0) {
+ printf("testXmlwriterDoc: Error at xmlTextWriterEndElement\n");
+ return;
+ }
+
+ /* Start an element named "FOOTER" as child of ORDER. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "FOOTER");
+ if (rc < 0) {
+ printf("testXmlwriterDoc: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Write an element named "TEXT" as child of FOOTER. */
+ rc = xmlTextWriterWriteElement(writer, BAD_CAST "TEXT",
+ BAD_CAST "This is a text.");
+ if (rc < 0) {
+ printf("testXmlwriterDoc: Error at xmlTextWriterWriteElement\n");
+ return;
+ }
+
+ /* Close the element named FOOTER. */
+ rc = xmlTextWriterEndElement(writer);
+ if (rc < 0) {
+ printf("testXmlwriterDoc: Error at xmlTextWriterEndElement\n");
+ return;
+ }
+
+ /* Here we could close the elements ORDER and EXAMPLE using the
+ * function xmlTextWriterEndElement, but since we do not want to
+ * write any other elements, we simply call xmlTextWriterEndDocument,
+ * which will do all the work. */
+ rc = xmlTextWriterEndDocument(writer);
+ if (rc < 0) {
+ printf("testXmlwriterDoc: Error at xmlTextWriterEndDocument\n");
+ return;
+ }
+
+ xmlFreeTextWriter(writer);
+
+ xmlSaveFileEnc(file, doc, MY_ENCODING);
+
+ xmlFreeDoc(doc);
+}
+
+/**
+ * testXmlwriterTree:
+ * @file: the output file
+ *
+ * test the xmlWriter interface when writing to a subtree
+ */
+void
+testXmlwriterTree(const char *file)
+{
+ int rc;
+ xmlTextWriterPtr writer;
+ xmlDocPtr doc;
+ xmlNodePtr node;
+ xmlChar *tmp;
+
+ /* Create a new XML DOM tree, to which the XML document will be
+ * written */
+ doc = xmlNewDoc(BAD_CAST XML_DEFAULT_VERSION);
+ if (doc == NULL) {
+ printf
+ ("testXmlwriterTree: Error creating the xml document tree\n");
+ return;
+ }
+
+ /* Create a new XML node, to which the XML document will be
+ * appended */
+ node = xmlNewDocNode(doc, NULL, BAD_CAST "EXAMPLE", NULL);
+ if (node == NULL) {
+ printf("testXmlwriterTree: Error creating the xml node\n");
+ return;
+ }
+
+ /* Make ELEMENT the root node of the tree */
+ xmlDocSetRootElement(doc, node);
+
+ /* Create a new XmlWriter for DOM tree, with no compression. */
+ writer = xmlNewTextWriterTree(doc, node, 0);
+ if (writer == NULL) {
+ printf("testXmlwriterTree: Error creating the xml writer\n");
+ return;
+ }
+
+ /* Start the document with the xml default for the version,
+ * encoding ISO 8859-1 and the default for the standalone
+ * declaration. */
+ rc = xmlTextWriterStartDocument(writer, NULL, MY_ENCODING, NULL);
+ if (rc < 0) {
+ printf("testXmlwriterTree: Error at xmlTextWriterStartDocument\n");
+ return;
+ }
+
+ /* Write a comment as child of EXAMPLE.
+ * Please observe, that the input to the xmlTextWriter functions
+ * HAS to be in UTF-8, even if the output XML is encoded
+ * in iso-8859-1 */
+ tmp = ConvertInput("This is a comment with special chars: <\xE4\xF6\xFC>",
+ MY_ENCODING);
+ rc = xmlTextWriterWriteComment(writer, tmp);
+ if (rc < 0) {
+ printf("testXmlwriterTree: Error at xmlTextWriterWriteComment\n");
+ return;
+ }
+ if (tmp != NULL) xmlFree(tmp);
+
+ /* Start an element named "ORDER" as child of EXAMPLE. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "ORDER");
+ if (rc < 0) {
+ printf("testXmlwriterTree: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Add an attribute with name "version" and value "1.0" to ORDER. */
+ rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "version",
+ BAD_CAST "1.0");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterTree: Error at xmlTextWriterWriteAttribute\n");
+ return;
+ }
+
+ /* Add an attribute with name "xml:lang" and value "de" to ORDER. */
+ rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "xml:lang",
+ BAD_CAST "de");
+ if (rc < 0) {
+ printf
+ ("testXmlwriterTree: Error at xmlTextWriterWriteAttribute\n");
+ return;
+ }
+
+ /* Write a comment as child of ORDER */
+ tmp = ConvertInput("<\xE4\xF6\xFC>", MY_ENCODING);
+ rc = xmlTextWriterWriteFormatComment(writer,
+ "This is another comment with special chars: %s",
+ tmp);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterTree: Error at xmlTextWriterWriteFormatComment\n");
+ return;
+ }
+ if (tmp != NULL) xmlFree(tmp);
+
+ /* Start an element named "HEADER" as child of ORDER. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "HEADER");
+ if (rc < 0) {
+ printf("testXmlwriterTree: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Write an element named "X_ORDER_ID" as child of HEADER. */
+ rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "X_ORDER_ID",
+ "%010d", 53535);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterTree: Error at xmlTextWriterWriteFormatElement\n");
+ return;
+ }
+
+ /* Write an element named "CUSTOMER_ID" as child of HEADER. */
+ rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "CUSTOMER_ID",
+ "%d", 1010);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterTree: Error at xmlTextWriterWriteFormatElement\n");
+ return;
+ }
+
+ /* Write an element named "NAME_1" as child of HEADER. */
+ tmp = ConvertInput("M\xFCller", MY_ENCODING);
+ rc = xmlTextWriterWriteElement(writer, BAD_CAST "NAME_1", tmp);
+ if (rc < 0) {
+ printf("testXmlwriterTree: Error at xmlTextWriterWriteElement\n");
+ return;
+ }
+ if (tmp != NULL) xmlFree(tmp);
+
+ /* Write an element named "NAME_2" as child of HEADER. */
+ tmp = ConvertInput("J\xF6rg", MY_ENCODING);
+ rc = xmlTextWriterWriteElement(writer, BAD_CAST "NAME_2", tmp);
+ if (rc < 0) {
+ printf("testXmlwriterTree: Error at xmlTextWriterWriteElement\n");
+ return;
+ }
+ if (tmp != NULL) xmlFree(tmp);
+
+ /* Close the element named HEADER. */
+ rc = xmlTextWriterEndElement(writer);
+ if (rc < 0) {
+ printf("testXmlwriterTree: Error at xmlTextWriterEndElement\n");
+ return;
+ }
+
+ /* Start an element named "ENTRIES" as child of ORDER. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "ENTRIES");
+ if (rc < 0) {
+ printf("testXmlwriterTree: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Start an element named "ENTRY" as child of ENTRIES. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "ENTRY");
+ if (rc < 0) {
+ printf("testXmlwriterTree: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Write an element named "ARTICLE" as child of ENTRY. */
+ rc = xmlTextWriterWriteElement(writer, BAD_CAST "ARTICLE",
+ BAD_CAST "<Test>");
+ if (rc < 0) {
+ printf("testXmlwriterTree: Error at xmlTextWriterWriteElement\n");
+ return;
+ }
+
+ /* Write an element named "ENTRY_NO" as child of ENTRY. */
+ rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ENTRY_NO", "%d",
+ 10);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterTree: Error at xmlTextWriterWriteFormatElement\n");
+ return;
+ }
+
+ /* Close the element named ENTRY. */
+ rc = xmlTextWriterEndElement(writer);
+ if (rc < 0) {
+ printf("testXmlwriterTree: Error at xmlTextWriterEndElement\n");
+ return;
+ }
+
+ /* Start an element named "ENTRY" as child of ENTRIES. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "ENTRY");
+ if (rc < 0) {
+ printf("testXmlwriterTree: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Write an element named "ARTICLE" as child of ENTRY. */
+ rc = xmlTextWriterWriteElement(writer, BAD_CAST "ARTICLE",
+ BAD_CAST "<Test 2>");
+ if (rc < 0) {
+ printf("testXmlwriterTree: Error at xmlTextWriterWriteElement\n");
+ return;
+ }
+
+ /* Write an element named "ENTRY_NO" as child of ENTRY. */
+ rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ENTRY_NO", "%d",
+ 20);
+ if (rc < 0) {
+ printf
+ ("testXmlwriterTree: Error at xmlTextWriterWriteFormatElement\n");
+ return;
+ }
+
+ /* Close the element named ENTRY. */
+ rc = xmlTextWriterEndElement(writer);
+ if (rc < 0) {
+ printf("testXmlwriterTree: Error at xmlTextWriterEndElement\n");
+ return;
+ }
+
+ /* Close the element named ENTRIES. */
+ rc = xmlTextWriterEndElement(writer);
+ if (rc < 0) {
+ printf("testXmlwriterTree: Error at xmlTextWriterEndElement\n");
+ return;
+ }
+
+ /* Start an element named "FOOTER" as child of ORDER. */
+ rc = xmlTextWriterStartElement(writer, BAD_CAST "FOOTER");
+ if (rc < 0) {
+ printf("testXmlwriterTree: Error at xmlTextWriterStartElement\n");
+ return;
+ }
+
+ /* Write an element named "TEXT" as child of FOOTER. */
+ rc = xmlTextWriterWriteElement(writer, BAD_CAST "TEXT",
+ BAD_CAST "This is a text.");
+ if (rc < 0) {
+ printf("testXmlwriterTree: Error at xmlTextWriterWriteElement\n");
+ return;
+ }
+
+ /* Close the element named FOOTER. */
+ rc = xmlTextWriterEndElement(writer);
+ if (rc < 0) {
+ printf("testXmlwriterTree: Error at xmlTextWriterEndElement\n");
+ return;
+ }
+
+ /* Here we could close the elements ORDER and EXAMPLE using the
+ * function xmlTextWriterEndElement, but since we do not want to
+ * write any other elements, we simply call xmlTextWriterEndDocument,
+ * which will do all the work. */
+ rc = xmlTextWriterEndDocument(writer);
+ if (rc < 0) {
+ printf("testXmlwriterTree: Error at xmlTextWriterEndDocument\n");
+ return;
+ }
+
+ xmlFreeTextWriter(writer);
+
+ xmlSaveFileEnc(file, doc, MY_ENCODING);
+
+ xmlFreeDoc(doc);
+}
+
+/**
+ * ConvertInput:
+ * @in: string in a given encoding
+ * @encoding: the encoding used
+ *
+ * Converts @in into UTF-8 for processing with libxml2 APIs
+ *
+ * Returns the converted UTF-8 string, or NULL in case of error.
+ */
+xmlChar *
+ConvertInput(const char *in, const char *encoding)
+{
+ xmlChar *out;
+ int ret;
+ int size;
+ int out_size;
+ int temp;
+ xmlCharEncodingHandlerPtr handler;
+
+ if (in == 0)
+ return 0;
+
+ handler = xmlFindCharEncodingHandler(encoding);
+
+ if (!handler) {
+ printf("ConvertInput: no encoding handler found for '%s'\n",
+ encoding ? encoding : "");
+ return 0;
+ }
+
+ size = (int) strlen(in) + 1;
+ out_size = size * 2 - 1;
+ out = (unsigned char *) xmlMalloc((size_t) out_size);
+
+ if (out != 0) {
+ temp = size - 1;
+ ret = handler->input(out, &out_size, (const xmlChar *) in, &temp);
+ if ((ret < 0) || (temp - size + 1)) {
+ if (ret < 0) {
+ printf("ConvertInput: conversion wasn't successful.\n");
+ } else {
+ printf
+ ("ConvertInput: conversion wasn't successful. converted: %i octets.\n",
+ temp);
+ }
+
+ xmlFree(out);
+ out = 0;
+ } else {
+ out = (unsigned char *) xmlRealloc(out, out_size + 1);
+ out[out_size] = 0; /*null terminating out */
+ }
+ } else {
+ printf("ConvertInput: no mem\n");
+ }
+
+ return out;
+}
+
+#else
+int main(void) {
+ fprintf(stderr, "Writer or output support not compiled in\n");
+ exit(1);
+}
+#endif
diff --git a/libxml2-2.9.10/doc/examples/tree1.c b/libxml2-2.9.10/doc/examples/tree1.c
new file mode 100644
index 0000000..e6faefc
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/tree1.c
@@ -0,0 +1,94 @@
+/**
+ * section: Tree
+ * synopsis: Navigates a tree to print element names
+ * purpose: Parse a file to a tree, use xmlDocGetRootElement() to
+ * get the root element, then walk the document and print
+ * all the element name in document order.
+ * usage: tree1 filename_or_URL
+ * test: tree1 test2.xml > tree1.tmp && diff tree1.tmp $(srcdir)/tree1.res
+ * author: Dodji Seketeli
+ * copy: see Copyright for the status of this software.
+ */
+#include <stdio.h>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+
+#ifdef LIBXML_TREE_ENABLED
+
+/*
+ *To compile this file using gcc you can type
+ *gcc `xml2-config --cflags --libs` -o xmlexample libxml2-example.c
+ */
+
+/**
+ * print_element_names:
+ * @a_node: the initial xml node to consider.
+ *
+ * Prints the names of the all the xml elements
+ * that are siblings or children of a given xml node.
+ */
+static void
+print_element_names(xmlNode * a_node)
+{
+ xmlNode *cur_node = NULL;
+
+ for (cur_node = a_node; cur_node; cur_node = cur_node->next) {
+ if (cur_node->type == XML_ELEMENT_NODE) {
+ printf("node type: Element, name: %s\n", cur_node->name);
+ }
+
+ print_element_names(cur_node->children);
+ }
+}
+
+
+/**
+ * Simple example to parse a file called "file.xml",
+ * walk down the DOM, and print the name of the
+ * xml elements nodes.
+ */
+int
+main(int argc, char **argv)
+{
+ xmlDoc *doc = NULL;
+ xmlNode *root_element = NULL;
+
+ if (argc != 2)
+ return(1);
+
+ /*
+ * this initialize the library and check potential ABI mismatches
+ * between the version it was compiled for and the actual shared
+ * library used.
+ */
+ LIBXML_TEST_VERSION
+
+ /*parse the file and get the DOM */
+ doc = xmlReadFile(argv[1], NULL, 0);
+
+ if (doc == NULL) {
+ printf("error: could not parse file %s\n", argv[1]);
+ }
+
+ /*Get the root element node */
+ root_element = xmlDocGetRootElement(doc);
+
+ print_element_names(root_element);
+
+ /*free the document */
+ xmlFreeDoc(doc);
+
+ /*
+ *Free the global variables that may
+ *have been allocated by the parser.
+ */
+ xmlCleanupParser();
+
+ return 0;
+}
+#else
+int main(void) {
+ fprintf(stderr, "Tree support not compiled in\n");
+ exit(1);
+}
+#endif
diff --git a/libxml2-2.9.10/doc/examples/tree1.res b/libxml2-2.9.10/doc/examples/tree1.res
new file mode 100644
index 0000000..7b14ad0
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/tree1.res
@@ -0,0 +1,4 @@
+node type: Element, name: doc
+node type: Element, name: src
+node type: Element, name: dest
+node type: Element, name: src
diff --git a/libxml2-2.9.10/doc/examples/tree2.c b/libxml2-2.9.10/doc/examples/tree2.c
new file mode 100644
index 0000000..6548e29
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/tree2.c
@@ -0,0 +1,117 @@
+/*
+ * section: Tree
+ * synopsis: Creates a tree
+ * purpose: Shows how to create document, nodes and dump it to stdout or file.
+ * usage: tree2 <filename> -Default output: stdout
+ * test: tree2 > tree2.tmp && diff tree2.tmp $(srcdir)/tree2.res
+ * author: Lucas Brasilino <brasilino@recife.pe.gov.br>
+ * copy: see Copyright for the status of this software
+ */
+
+#include <stdio.h>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+
+#if defined(LIBXML_TREE_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
+
+/*
+ *To compile this file using gcc you can type
+ *gcc `xml2-config --cflags --libs` -o tree2 tree2.c
+ */
+
+/* A simple example how to create DOM. Libxml2 automagically
+ * allocates the necessary amount of memory to it.
+*/
+int
+main(int argc, char **argv)
+{
+ xmlDocPtr doc = NULL; /* document pointer */
+ xmlNodePtr root_node = NULL, node = NULL, node1 = NULL;/* node pointers */
+ char buff[256];
+ int i, j;
+
+ LIBXML_TEST_VERSION;
+
+ /*
+ * Creates a new document, a node and set it as a root node
+ */
+ doc = xmlNewDoc(BAD_CAST "1.0");
+ root_node = xmlNewNode(NULL, BAD_CAST "root");
+ xmlDocSetRootElement(doc, root_node);
+
+ /*
+ * Creates a DTD declaration. Isn't mandatory.
+ */
+ xmlCreateIntSubset(doc, BAD_CAST "root", NULL, BAD_CAST "tree2.dtd");
+
+ /*
+ * xmlNewChild() creates a new node, which is "attached" as child node
+ * of root_node node.
+ */
+ xmlNewChild(root_node, NULL, BAD_CAST "node1",
+ BAD_CAST "content of node 1");
+ /*
+ * The same as above, but the new child node doesn't have a content
+ */
+ xmlNewChild(root_node, NULL, BAD_CAST "node2", NULL);
+
+ /*
+ * xmlNewProp() creates attributes, which is "attached" to an node.
+ * It returns xmlAttrPtr, which isn't used here.
+ */
+ node =
+ xmlNewChild(root_node, NULL, BAD_CAST "node3",
+ BAD_CAST "this node has attributes");
+ xmlNewProp(node, BAD_CAST "attribute", BAD_CAST "yes");
+ xmlNewProp(node, BAD_CAST "foo", BAD_CAST "bar");
+
+ /*
+ * Here goes another way to create nodes. xmlNewNode() and xmlNewText
+ * creates a node and a text node separately. They are "attached"
+ * by xmlAddChild()
+ */
+ node = xmlNewNode(NULL, BAD_CAST "node4");
+ node1 = xmlNewText(BAD_CAST
+ "other way to create content (which is also a node)");
+ xmlAddChild(node, node1);
+ xmlAddChild(root_node, node);
+
+ /*
+ * A simple loop that "automates" nodes creation
+ */
+ for (i = 5; i < 7; i++) {
+ sprintf(buff, "node%d", i);
+ node = xmlNewChild(root_node, NULL, BAD_CAST buff, NULL);
+ for (j = 1; j < 4; j++) {
+ sprintf(buff, "node%d%d", i, j);
+ node1 = xmlNewChild(node, NULL, BAD_CAST buff, NULL);
+ xmlNewProp(node1, BAD_CAST "odd", BAD_CAST((j % 2) ? "no" : "yes"));
+ }
+ }
+
+ /*
+ * Dumping document to stdio or file
+ */
+ xmlSaveFormatFileEnc(argc > 1 ? argv[1] : "-", doc, "UTF-8", 1);
+
+ /*free the document */
+ xmlFreeDoc(doc);
+
+ /*
+ *Free the global variables that may
+ *have been allocated by the parser.
+ */
+ xmlCleanupParser();
+
+ /*
+ * this is to debug memory for regression tests
+ */
+ xmlMemoryDump();
+ return(0);
+}
+#else
+int main(void) {
+ fprintf(stderr, "tree support not compiled in\n");
+ exit(1);
+}
+#endif
diff --git a/libxml2-2.9.10/doc/examples/tree2.res b/libxml2-2.9.10/doc/examples/tree2.res
new file mode 100644
index 0000000..ed00195
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/tree2.res
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE root SYSTEM "tree2.dtd">
+<root>
+ <node1>content of node 1</node1>
+ <node2/>
+ <node3 attribute="yes" foo="bar">this node has attributes</node3>
+ <node4>other way to create content (which is also a node)</node4>
+ <node5>
+ <node51 odd="no"/>
+ <node52 odd="yes"/>
+ <node53 odd="no"/>
+ </node5>
+ <node6>
+ <node61 odd="no"/>
+ <node62 odd="yes"/>
+ <node63 odd="no"/>
+ </node6>
+</root>
diff --git a/libxml2-2.9.10/doc/examples/tst.xml b/libxml2-2.9.10/doc/examples/tst.xml
new file mode 100644
index 0000000..1cc6c95
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/tst.xml
@@ -0,0 +1,7 @@
+<thing>
+ <thing1>hello</thing1>
+</thing>
+<thing>
+ <thing2>goodbye</thing2>
+</thing>
+
diff --git a/libxml2-2.9.10/doc/examples/writer.xml b/libxml2-2.9.10/doc/examples/writer.xml
new file mode 100644
index 0000000..6ab05fd
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/writer.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<EXAMPLE><!--This is a comment with special chars: <äöü>--><ORDER version="1.0" xml:lang="de"><!--This is another comment with special chars: <äöü>--><HEADER><X_ORDER_ID>0000053535</X_ORDER_ID><CUSTOMER_ID>1010</CUSTOMER_ID><NAME_1>Müller</NAME_1><NAME_2>Jörg</NAME_2></HEADER><ENTRIES><ENTRY><ARTICLE>&lt;Test&gt;</ARTICLE><ENTRY_NO>10</ENTRY_NO></ENTRY><ENTRY><ARTICLE>&lt;Test 2&gt;</ARTICLE><ENTRY_NO>20</ENTRY_NO></ENTRY></ENTRIES><FOOTER><TEXT>This is a text.</TEXT></FOOTER></ORDER></EXAMPLE>
diff --git a/libxml2-2.9.10/doc/examples/xpath1.c b/libxml2-2.9.10/doc/examples/xpath1.c
new file mode 100644
index 0000000..0a31650
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/xpath1.c
@@ -0,0 +1,250 @@
+/**
+ * section: XPath
+ * synopsis: Evaluate XPath expression and prints result node set.
+ * purpose: Shows how to evaluate XPath expression and register
+ * known namespaces in XPath context.
+ * usage: xpath1 <xml-file> <xpath-expr> [<known-ns-list>]
+ * test: xpath1 test3.xml '//child2' > xpath1.tmp && diff xpath1.tmp $(srcdir)/xpath1.res
+ * author: Aleksey Sanin
+ * copy: see Copyright for the status of this software.
+ */
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+#include <libxml/tree.h>
+#include <libxml/parser.h>
+#include <libxml/xpath.h>
+#include <libxml/xpathInternals.h>
+
+#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_SAX1_ENABLED)
+
+
+static void usage(const char *name);
+int execute_xpath_expression(const char* filename, const xmlChar* xpathExpr, const xmlChar* nsList);
+int register_namespaces(xmlXPathContextPtr xpathCtx, const xmlChar* nsList);
+void print_xpath_nodes(xmlNodeSetPtr nodes, FILE* output);
+
+int
+main(int argc, char **argv) {
+ /* Parse command line and process file */
+ if((argc < 3) || (argc > 4)) {
+ fprintf(stderr, "Error: wrong number of arguments.\n");
+ usage(argv[0]);
+ return(-1);
+ }
+
+ /* Init libxml */
+ xmlInitParser();
+ LIBXML_TEST_VERSION
+
+ /* Do the main job */
+ if(execute_xpath_expression(argv[1], BAD_CAST argv[2], (argc > 3) ? BAD_CAST argv[3] : NULL) < 0) {
+ usage(argv[0]);
+ return(-1);
+ }
+
+ /* Shutdown libxml */
+ xmlCleanupParser();
+
+ /*
+ * this is to debug memory for regression tests
+ */
+ xmlMemoryDump();
+ return 0;
+}
+
+/**
+ * usage:
+ * @name: the program name.
+ *
+ * Prints usage information.
+ */
+static void
+usage(const char *name) {
+ assert(name);
+
+ fprintf(stderr, "Usage: %s <xml-file> <xpath-expr> [<known-ns-list>]\n", name);
+ fprintf(stderr, "where <known-ns-list> is a list of known namespaces\n");
+ fprintf(stderr, "in \"<prefix1>=<href1> <prefix2>=href2> ...\" format\n");
+}
+
+/**
+ * execute_xpath_expression:
+ * @filename: the input XML filename.
+ * @xpathExpr: the xpath expression for evaluation.
+ * @nsList: the optional list of known namespaces in
+ * "<prefix1>=<href1> <prefix2>=href2> ..." format.
+ *
+ * Parses input XML file, evaluates XPath expression and prints results.
+ *
+ * Returns 0 on success and a negative value otherwise.
+ */
+int
+execute_xpath_expression(const char* filename, const xmlChar* xpathExpr, const xmlChar* nsList) {
+ xmlDocPtr doc;
+ xmlXPathContextPtr xpathCtx;
+ xmlXPathObjectPtr xpathObj;
+
+ assert(filename);
+ assert(xpathExpr);
+
+ /* Load XML document */
+ doc = xmlParseFile(filename);
+ if (doc == NULL) {
+ fprintf(stderr, "Error: unable to parse file \"%s\"\n", filename);
+ return(-1);
+ }
+
+ /* Create xpath evaluation context */
+ xpathCtx = xmlXPathNewContext(doc);
+ if(xpathCtx == NULL) {
+ fprintf(stderr,"Error: unable to create new XPath context\n");
+ xmlFreeDoc(doc);
+ return(-1);
+ }
+
+ /* Register namespaces from list (if any) */
+ if((nsList != NULL) && (register_namespaces(xpathCtx, nsList) < 0)) {
+ fprintf(stderr,"Error: failed to register namespaces list \"%s\"\n", nsList);
+ xmlXPathFreeContext(xpathCtx);
+ xmlFreeDoc(doc);
+ return(-1);
+ }
+
+ /* Evaluate xpath expression */
+ xpathObj = xmlXPathEvalExpression(xpathExpr, xpathCtx);
+ if(xpathObj == NULL) {
+ fprintf(stderr,"Error: unable to evaluate xpath expression \"%s\"\n", xpathExpr);
+ xmlXPathFreeContext(xpathCtx);
+ xmlFreeDoc(doc);
+ return(-1);
+ }
+
+ /* Print results */
+ print_xpath_nodes(xpathObj->nodesetval, stdout);
+
+ /* Cleanup */
+ xmlXPathFreeObject(xpathObj);
+ xmlXPathFreeContext(xpathCtx);
+ xmlFreeDoc(doc);
+
+ return(0);
+}
+
+/**
+ * register_namespaces:
+ * @xpathCtx: the pointer to an XPath context.
+ * @nsList: the list of known namespaces in
+ * "<prefix1>=<href1> <prefix2>=href2> ..." format.
+ *
+ * Registers namespaces from @nsList in @xpathCtx.
+ *
+ * Returns 0 on success and a negative value otherwise.
+ */
+int
+register_namespaces(xmlXPathContextPtr xpathCtx, const xmlChar* nsList) {
+ xmlChar* nsListDup;
+ xmlChar* prefix;
+ xmlChar* href;
+ xmlChar* next;
+
+ assert(xpathCtx);
+ assert(nsList);
+
+ nsListDup = xmlStrdup(nsList);
+ if(nsListDup == NULL) {
+ fprintf(stderr, "Error: unable to strdup namespaces list\n");
+ return(-1);
+ }
+
+ next = nsListDup;
+ while(next != NULL) {
+ /* skip spaces */
+ while((*next) == ' ') next++;
+ if((*next) == '\0') break;
+
+ /* find prefix */
+ prefix = next;
+ next = (xmlChar*)xmlStrchr(next, '=');
+ if(next == NULL) {
+ fprintf(stderr,"Error: invalid namespaces list format\n");
+ xmlFree(nsListDup);
+ return(-1);
+ }
+ *(next++) = '\0';
+
+ /* find href */
+ href = next;
+ next = (xmlChar*)xmlStrchr(next, ' ');
+ if(next != NULL) {
+ *(next++) = '\0';
+ }
+
+ /* do register namespace */
+ if(xmlXPathRegisterNs(xpathCtx, prefix, href) != 0) {
+ fprintf(stderr,"Error: unable to register NS with prefix=\"%s\" and href=\"%s\"\n", prefix, href);
+ xmlFree(nsListDup);
+ return(-1);
+ }
+ }
+
+ xmlFree(nsListDup);
+ return(0);
+}
+
+/**
+ * print_xpath_nodes:
+ * @nodes: the nodes set.
+ * @output: the output file handle.
+ *
+ * Prints the @nodes content to @output.
+ */
+void
+print_xpath_nodes(xmlNodeSetPtr nodes, FILE* output) {
+ xmlNodePtr cur;
+ int size;
+ int i;
+
+ assert(output);
+ size = (nodes) ? nodes->nodeNr : 0;
+
+ fprintf(output, "Result (%d nodes):\n", size);
+ for(i = 0; i < size; ++i) {
+ assert(nodes->nodeTab[i]);
+
+ if(nodes->nodeTab[i]->type == XML_NAMESPACE_DECL) {
+ xmlNsPtr ns;
+
+ ns = (xmlNsPtr)nodes->nodeTab[i];
+ cur = (xmlNodePtr)ns->next;
+ if(cur->ns) {
+ fprintf(output, "= namespace \"%s\"=\"%s\" for node %s:%s\n",
+ ns->prefix, ns->href, cur->ns->href, cur->name);
+ } else {
+ fprintf(output, "= namespace \"%s\"=\"%s\" for node %s\n",
+ ns->prefix, ns->href, cur->name);
+ }
+ } else if(nodes->nodeTab[i]->type == XML_ELEMENT_NODE) {
+ cur = nodes->nodeTab[i];
+ if(cur->ns) {
+ fprintf(output, "= element node \"%s:%s\"\n",
+ cur->ns->href, cur->name);
+ } else {
+ fprintf(output, "= element node \"%s\"\n",
+ cur->name);
+ }
+ } else {
+ cur = nodes->nodeTab[i];
+ fprintf(output, "= node \"%s\": type %d\n", cur->name, cur->type);
+ }
+ }
+}
+
+#else
+int main(void) {
+ fprintf(stderr, "XPath support not compiled in\n");
+ exit(1);
+}
+#endif
diff --git a/libxml2-2.9.10/doc/examples/xpath1.res b/libxml2-2.9.10/doc/examples/xpath1.res
new file mode 100644
index 0000000..76af3a9
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/xpath1.res
@@ -0,0 +1,5 @@
+Result (4 nodes):
+= element node "child2"
+= element node "child2"
+= element node "child2"
+= element node "child2"
diff --git a/libxml2-2.9.10/doc/examples/xpath2.c b/libxml2-2.9.10/doc/examples/xpath2.c
new file mode 100644
index 0000000..f604114
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/xpath2.c
@@ -0,0 +1,190 @@
+/**
+ * section: XPath
+ * synopsis: Load a document, locate subelements with XPath, modify
+ * said elements and save the resulting document.
+ * purpose: Shows how to make a full round-trip from a load/edit/save
+ * usage: xpath2 <xml-file> <xpath-expr> <new-value>
+ * test: xpath2 test3.xml '//discarded' discarded > xpath2.tmp && diff xpath2.tmp $(srcdir)/xpath2.res
+ * author: Aleksey Sanin and Daniel Veillard
+ * copy: see Copyright for the status of this software.
+ */
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+#include <libxml/tree.h>
+#include <libxml/parser.h>
+#include <libxml/xpath.h>
+#include <libxml/xpathInternals.h>
+
+#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_SAX1_ENABLED) && \
+ defined(LIBXML_OUTPUT_ENABLED)
+
+
+static void usage(const char *name);
+static int example4(const char *filename, const xmlChar * xpathExpr,
+ const xmlChar * value);
+static void update_xpath_nodes(xmlNodeSetPtr nodes, const xmlChar * value);
+
+
+int
+main(int argc, char **argv) {
+ /* Parse command line and process file */
+ if (argc != 4) {
+ fprintf(stderr, "Error: wrong number of arguments.\n");
+ usage(argv[0]);
+ return(-1);
+ }
+
+ /* Init libxml */
+ xmlInitParser();
+ LIBXML_TEST_VERSION
+
+ /* Do the main job */
+ if (example4(argv[1], BAD_CAST argv[2], BAD_CAST argv[3])) {
+ usage(argv[0]);
+ return(-1);
+ }
+
+ /* Shutdown libxml */
+ xmlCleanupParser();
+
+ /*
+ * this is to debug memory for regression tests
+ */
+ xmlMemoryDump();
+ return 0;
+}
+
+/**
+ * usage:
+ * @name: the program name.
+ *
+ * Prints usage information.
+ */
+static void
+usage(const char *name) {
+ assert(name);
+
+ fprintf(stderr, "Usage: %s <xml-file> <xpath-expr> <value>\n", name);
+}
+
+/**
+ * example4:
+ * @filename: the input XML filename.
+ * @xpathExpr: the xpath expression for evaluation.
+ * @value: the new node content.
+ *
+ * Parses input XML file, evaluates XPath expression and update the nodes
+ * then print the result.
+ *
+ * Returns 0 on success and a negative value otherwise.
+ */
+static int
+example4(const char* filename, const xmlChar* xpathExpr, const xmlChar* value) {
+ xmlDocPtr doc;
+ xmlXPathContextPtr xpathCtx;
+ xmlXPathObjectPtr xpathObj;
+
+ assert(filename);
+ assert(xpathExpr);
+ assert(value);
+
+ /* Load XML document */
+ doc = xmlParseFile(filename);
+ if (doc == NULL) {
+ fprintf(stderr, "Error: unable to parse file \"%s\"\n", filename);
+ return(-1);
+ }
+
+ /* Create xpath evaluation context */
+ xpathCtx = xmlXPathNewContext(doc);
+ if(xpathCtx == NULL) {
+ fprintf(stderr,"Error: unable to create new XPath context\n");
+ xmlFreeDoc(doc);
+ return(-1);
+ }
+
+ /* Evaluate xpath expression */
+ xpathObj = xmlXPathEvalExpression(xpathExpr, xpathCtx);
+ if(xpathObj == NULL) {
+ fprintf(stderr,"Error: unable to evaluate xpath expression \"%s\"\n", xpathExpr);
+ xmlXPathFreeContext(xpathCtx);
+ xmlFreeDoc(doc);
+ return(-1);
+ }
+
+ /* update selected nodes */
+ update_xpath_nodes(xpathObj->nodesetval, value);
+
+
+ /* Cleanup of XPath data */
+ xmlXPathFreeObject(xpathObj);
+ xmlXPathFreeContext(xpathCtx);
+
+ /* dump the resulting document */
+ xmlDocDump(stdout, doc);
+
+
+ /* free the document */
+ xmlFreeDoc(doc);
+
+ return(0);
+}
+
+/**
+ * update_xpath_nodes:
+ * @nodes: the nodes set.
+ * @value: the new value for the node(s)
+ *
+ * Prints the @nodes content to @output.
+ */
+static void
+update_xpath_nodes(xmlNodeSetPtr nodes, const xmlChar* value) {
+ int size;
+ int i;
+
+ assert(value);
+ size = (nodes) ? nodes->nodeNr : 0;
+
+ /*
+ * NOTE: the nodes are processed in reverse order, i.e. reverse document
+ * order because xmlNodeSetContent can actually free up descendant
+ * of the node and such nodes may have been selected too ! Handling
+ * in reverse order ensure that descendant are accessed first, before
+ * they get removed. Mixing XPath and modifications on a tree must be
+ * done carefully !
+ */
+ for(i = size - 1; i >= 0; i--) {
+ assert(nodes->nodeTab[i]);
+
+ xmlNodeSetContent(nodes->nodeTab[i], value);
+ /*
+ * All the elements returned by an XPath query are pointers to
+ * elements from the tree *except* namespace nodes where the XPath
+ * semantic is different from the implementation in libxml2 tree.
+ * As a result when a returned node set is freed when
+ * xmlXPathFreeObject() is called, that routine must check the
+ * element type. But node from the returned set may have been removed
+ * by xmlNodeSetContent() resulting in access to freed data.
+ * This can be exercised by running
+ * valgrind xpath2 test3.xml '//discarded' discarded
+ * There is 2 ways around it:
+ * - make a copy of the pointers to the nodes from the result set
+ * then call xmlXPathFreeObject() and then modify the nodes
+ * or
+ * - remove the reference to the modified nodes from the node set
+ * as they are processed, if they are not namespace nodes.
+ */
+ if (nodes->nodeTab[i]->type != XML_NAMESPACE_DECL)
+ nodes->nodeTab[i] = NULL;
+ }
+}
+
+#else
+int main(void) {
+ fprintf(stderr, "XPath support not compiled in\n");
+ exit(1);
+}
+#endif
diff --git a/libxml2-2.9.10/doc/examples/xpath2.res b/libxml2-2.9.10/doc/examples/xpath2.res
new file mode 100644
index 0000000..4e89699
--- /dev/null
+++ b/libxml2-2.9.10/doc/examples/xpath2.res
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<doc>
+ <parent>
+ <discarded>discarded</discarded>
+ <preserved/>
+ This text node must be discarded
+ <discarded>discarded</discarded>
+ <preserved>
+ content1
+ <child1/>
+ <child2>content2</child2>
+ <preserved>too</preserved>
+ <child2>content3</child2>
+ <preserved/>
+ <child2>content4</child2>
+ <preserved/>
+ <child2>content5</child2>
+ content6
+ </preserved>
+ This text node must be discarded
+ <discarded>discarded</discarded>
+ This text node must be discarded
+ <preserved/>
+ This text node must be discarded
+ <preserved/>
+ This text node must be discarded
+ <discarded>discarded</discarded>
+ This text node must be discarded
+ </parent>
+</doc>