summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAron Xu <aron@debian.org>2012-04-18 15:58:48 +0800
committerAron Xu <aron@debian.org>2012-04-23 00:25:41 +0800
commit4281fb7adc1b49f8038085cd294327a4338b7082 (patch)
tree23d0bb5616d39b6e757f5ecaabf58cfb61b156fd
parent6205aa529c62396b509525bc4283e765ae0ebee8 (diff)
downloadlibxml2-4281fb7adc1b49f8038085cd294327a4338b7082.tar.gz
Port existing patch to quilt.
-rw-r--r--autogen.sh43
-rw-r--r--debian/compat2
-rw-r--r--debian/control21
-rw-r--r--debian/libxml2-dbg.dirs1
-rw-r--r--debian/libxml2-dev.dirs1
-rw-r--r--debian/libxml2-udeb.install2
-rw-r--r--debian/libxml2-utils.dirs1
-rw-r--r--debian/patches/01_build-system.patch55
-rw-r--r--debian/patches/01_historical_changes.patch899
-rw-r--r--debian/patches/series2
-rwxr-xr-xdebian/rules58
-rw-r--r--doc/examples/index.html14
12 files changed, 950 insertions, 149 deletions
diff --git a/autogen.sh b/autogen.sh
deleted file mode 100644
index 9eefa8b..0000000
--- a/autogen.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/sh
-## ----------------------------------------------------------------------
-## autogen.sh : refresh GNU autotools toolchain for libxml2, and
-## refreshes doc/examples/index.html
-## For use in root directory of the build tree ONLY.
-## ----------------------------------------------------------------------
-## Requires: autoconf (2.6x), automake1.11, libtool (1.5.x), xsltproc,
-## libxml2-utils
-## ----------------------------------------------------------------------
-
-## ----------------------------------------------------------------------
-set -e
-
-## ----------------------------------------------------------------------
-libtoolize --force --copy
-
-## ----------------------------------------------------------------------
-aclocal-1.11 -Im4
-
-## ----------------------------------------------------------------------
-autoheader
-
-## ----------------------------------------------------------------------
-automake-1.11 --foreign --add-missing --force-missing --copy
-
-## ----------------------------------------------------------------------
-autoconf
-
-# clean up the junk that was created
-rm -rf autom4te.cache
-
-# rebuild doc/examples/index.html
-rm -f doc/examples/index.html
-make -C doc/examples -f Makefile.am rebuild
-#cd doc/examples
-#xsltproc examples.xsl examples.xml
-#xmllint --valid --noout index.html
-#cd ../..
-
-## ----------------------------------------------------------------------
-exit 0
-
-## ----------------------------------------------------------------------
diff --git a/debian/compat b/debian/compat
index 7f8f011..ec63514 100644
--- a/debian/compat
+++ b/debian/compat
@@ -1 +1 @@
-7
+9
diff --git a/debian/control b/debian/control
index 94ad55a..c2d9cef 100644
--- a/debian/control
+++ b/debian/control
@@ -12,7 +12,6 @@ Vcs-Browser: http://git.debian.org/?p=debian-xml-sgml/libxml2.git
Package: libxml2
Priority: standard
Architecture: any
-Section: libs
Pre-Depends: ${misc:Pre-Depends}
Depends: ${shlibs:Depends}, ${misc:Depends}
Recommends: xml-core
@@ -45,6 +44,22 @@ Description: XML utilities
XML documents, and xmlcatalog, a tool to parse and manipulate XML or
SGML catalog files.
+Package: libxml2-utils-dbg
+Architecture: any
+Section: debug
+Priority: extra
+Depends: libxml2-utils (= ${binary:Version}), ${misc:Depends}
+Description: XML utilities (debug extension)
+ XML is a metalanguage to let you design your own markup language.
+ A regular markup language defines a way to describe information in
+ a certain class of documents (eg HTML). XML lets you define your
+ own customized markup languages for many classes of document. It
+ can do this because it's written in SGML, the international standard
+ metalanguage for markup languages.
+ .
+ This package provides the debugging symbols for the utilities provided
+ by the libxml2-utils package.
+
Package: libxml2-dev
Architecture: any
Section: libdevel
@@ -74,9 +89,7 @@ Description: Debugging symbols for the GNOME XML library
can do this because it's written in SGML, the international standard
metalanguage for markup languages.
.
- This package provides the debugging symbols for the library and for
- the utilities provided by the libxml2-utils package.
- Debugging symbols for the Python modules are not available.
+ This package provides the debugging symbols for the library.
Package: libxml2-doc
Architecture: all
diff --git a/debian/libxml2-dbg.dirs b/debian/libxml2-dbg.dirs
deleted file mode 100644
index 924dda7..0000000
--- a/debian/libxml2-dbg.dirs
+++ /dev/null
@@ -1 +0,0 @@
-/usr/share/doc
diff --git a/debian/libxml2-dev.dirs b/debian/libxml2-dev.dirs
deleted file mode 100644
index 924dda7..0000000
--- a/debian/libxml2-dev.dirs
+++ /dev/null
@@ -1 +0,0 @@
-/usr/share/doc
diff --git a/debian/libxml2-udeb.install b/debian/libxml2-udeb.install
index 59ed997..d1a994c 100644
--- a/debian/libxml2-udeb.install
+++ b/debian/libxml2-udeb.install
@@ -1 +1 @@
-usr/lib/libxml2.so.*
+usr/lib/*/libxml2.so.*
diff --git a/debian/libxml2-utils.dirs b/debian/libxml2-utils.dirs
deleted file mode 100644
index 924dda7..0000000
--- a/debian/libxml2-utils.dirs
+++ /dev/null
@@ -1 +0,0 @@
-/usr/share/doc
diff --git a/debian/patches/01_build-system.patch b/debian/patches/01_build-system.patch
deleted file mode 100644
index 16a9c9f..0000000
--- a/debian/patches/01_build-system.patch
+++ /dev/null
@@ -1,55 +0,0 @@
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -8,10 +8,10 @@
-
- INCLUDES = -I$(top_builddir)/include -I@srcdir@/include @THREAD_CFLAGS@ @Z_CFLAGS@
-
--noinst_PROGRAMS=testSchemas testRelax testSAX testHTML testXPath testURI \
-- testThreads testC14N testAutomata testRegexp \
-- testReader testapi testModule runtest runsuite testchar \
-- testdict runxmlconf testrecurse
-+#noinst_PROGRAMS=testSchemas testRelax testSAX testHTML testXPath testURI \
-+# testThreads testC14N testAutomata testRegexp \
-+# testReader testapi testModule runtest runsuite testchar \
-+# testdict runxmlconf testrecurse
-
- bin_PROGRAMS = xmllint xmlcatalog
-
-@@ -157,7 +157,7 @@
- testModule_DEPENDENCIES = $(DEPS)
- testModule_LDADD= $(LDADDS)
-
--noinst_LTLIBRARIES = testdso.la
-+#noinst_LTLIBRARIES = testdso.la
- testdso_la_SOURCES = testdso.c
- testdso_la_LDFLAGS = -module -no-undefined -avoid-version -rpath $(libdir)
-
---- a/configure.in
-+++ b/configure.in
-@@ -70,6 +70,8 @@
- AC_LIBTOOL_WIN32_DLL
- AM_PROG_LIBTOOL
-
-+AM_MAINTAINER_MODE
-+
- dnl
- dnl if the system support linker version scripts for symbol versioning
- dnl then add it
-@@ -84,7 +86,7 @@
- esac
- fi
- AC_SUBST(VERSION_SCRIPT_FLAGS)
--AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -z "$VERSION_SCRIPT_FLAGS"])
-+AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"])
-
- dnl
- dnl We process the AC_ARG_WITH first so that later we can modify
-@@ -1319,7 +1321,7 @@
- *) M_LIBS="-lm"
- ;;
- esac
--XML_LIBS="-lxml2 $Z_LIBS $THREAD_LIBS $ICONV_LIBS $M_LIBS $LIBS"
-+XML_LIBS="-lxml2"
- XML_LIBTOOLLIBS="libxml2.la"
- AC_SUBST(WITH_ICONV)
-
diff --git a/debian/patches/01_historical_changes.patch b/debian/patches/01_historical_changes.patch
new file mode 100644
index 0000000..81004ba
--- /dev/null
+++ b/debian/patches/01_historical_changes.patch
@@ -0,0 +1,899 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -8,10 +8,10 @@
+
+ INCLUDES = -I$(top_builddir)/include -I@srcdir@/include @THREAD_CFLAGS@ @Z_CFLAGS@
+
+-noinst_PROGRAMS=testSchemas testRelax testSAX testHTML testXPath testURI \
+- testThreads testC14N testAutomata testRegexp \
+- testReader testapi testModule runtest runsuite testchar \
+- testdict runxmlconf testrecurse
++#noinst_PROGRAMS=testSchemas testRelax testSAX testHTML testXPath testURI \
++# testThreads testC14N testAutomata testRegexp \
++# testReader testapi testModule runtest runsuite testchar \
++# testdict runxmlconf testrecurse
+
+ bin_PROGRAMS = xmllint xmlcatalog
+
+@@ -157,7 +157,7 @@
+ testModule_DEPENDENCIES = $(DEPS)
+ testModule_LDADD= $(LDADDS)
+
+-noinst_LTLIBRARIES = testdso.la
++#noinst_LTLIBRARIES = testdso.la
+ testdso_la_SOURCES = testdso.c
+ testdso_la_LDFLAGS = -module -no-undefined -avoid-version -rpath $(libdir)
+
+--- a/configure.in
++++ b/configure.in
+@@ -1,6 +1,6 @@
+ dnl Process this file with autoconf to produce a configure script.
+ AC_PREREQ(2.59)
+-AC_INIT(entities.c)
++AC_INIT(entities.c, 2.7.8)
+ AM_CONFIG_HEADER(config.h)
+ AC_CONFIG_MACRO_DIR([m4])
+ AC_CANONICAL_HOST
+@@ -48,6 +48,7 @@
+
+ VERSION=${LIBXML_VERSION}
+
++AM_INIT_AUTOMAKE([1.10 no-define foreign])
+ AM_INIT_AUTOMAKE(libxml2, $VERSION)
+
+ dnl Checks for programs.
+@@ -70,6 +71,8 @@
+ AC_LIBTOOL_WIN32_DLL
+ AM_PROG_LIBTOOL
+
++AM_MAINTAINER_MODE
++
+ dnl
+ dnl if the system support linker version scripts for symbol versioning
+ dnl then add it
+@@ -84,7 +87,7 @@
+ esac
+ fi
+ AC_SUBST(VERSION_SCRIPT_FLAGS)
+-AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -z "$VERSION_SCRIPT_FLAGS"])
++AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"])
+
+ dnl
+ dnl We process the AC_ARG_WITH first so that later we can modify
+@@ -1319,7 +1322,7 @@
+ *) M_LIBS="-lm"
+ ;;
+ esac
+-XML_LIBS="-lxml2 $Z_LIBS $THREAD_LIBS $ICONV_LIBS $M_LIBS $LIBS"
++XML_LIBS="-lxml2"
+ XML_LIBTOOLLIBS="libxml2.la"
+ AC_SUBST(WITH_ICONV)
+
+--- a/dict.c
++++ b/dict.c
+@@ -19,6 +19,28 @@
+ #define IN_LIBXML
+ #include "libxml.h"
+
++#ifdef HAVE_STDLIB_H
++#include <stdlib.h>
++#endif
++#ifdef HAVE_TIME_H
++#include <time.h>
++#endif
++
++/*
++ * Following http://www.ocert.org/advisories/ocert-2011-003.html
++ * it seems that having hash randomization might be a good idea
++ * when using XML with untrusted data
++ * Note1: that it works correctly only if compiled with WITH_BIG_KEY
++ * which is the default.
++ * Note2: the fast function used for a small dict won't protect very
++ * well but since the attack is based on growing a very big hash
++ * list we will use the BigKey algo as soon as the hash size grows
++ * over MIN_DICT_SIZE so this actually works
++ */
++#if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME)
++#define DICT_RANDOMIZATION
++#endif
++
+ #include <string.h>
+ #ifdef HAVE_STDINT_H
+ #include <stdint.h>
+@@ -44,23 +66,23 @@
+ #define WITH_BIG_KEY
+
+ #ifdef WITH_BIG_KEY
+-#define xmlDictComputeKey(dict, name, len) \
+- (((dict)->size == MIN_DICT_SIZE) ? \
+- xmlDictComputeFastKey(name, len) : \
+- xmlDictComputeBigKey(name, len))
+-
+-#define xmlDictComputeQKey(dict, prefix, plen, name, len) \
+- (((prefix) == NULL) ? \
+- (xmlDictComputeKey(dict, name, len)) : \
+- (((dict)->size == MIN_DICT_SIZE) ? \
+- xmlDictComputeFastQKey(prefix, plen, name, len) : \
+- xmlDictComputeBigQKey(prefix, plen, name, len)))
++#define xmlDictComputeKey(dict, name, len) \
++ (((dict)->size == MIN_DICT_SIZE) ? \
++ xmlDictComputeFastKey(name, len, (dict)->seed) : \
++ xmlDictComputeBigKey(name, len, (dict)->seed))
++
++#define xmlDictComputeQKey(dict, prefix, plen, name, len) \
++ (((prefix) == NULL) ? \
++ (xmlDictComputeKey(dict, name, len)) : \
++ (((dict)->size == MIN_DICT_SIZE) ? \
++ xmlDictComputeFastQKey(prefix, plen, name, len, (dict)->seed) : \
++ xmlDictComputeBigQKey(prefix, plen, name, len, (dict)->seed)))
+
+ #else /* !WITH_BIG_KEY */
+-#define xmlDictComputeKey(dict, name, len) \
+- xmlDictComputeFastKey(name, len)
+-#define xmlDictComputeQKey(dict, prefix, plen, name, len) \
+- xmlDictComputeFastQKey(prefix, plen, name, len)
++#define xmlDictComputeKey(dict, name, len) \
++ xmlDictComputeFastKey(name, len, (dict)->seed)
++#define xmlDictComputeQKey(dict, prefix, plen, name, len) \
++ xmlDictComputeFastQKey(prefix, plen, name, len, (dict)->seed)
+ #endif /* WITH_BIG_KEY */
+
+ /*
+@@ -98,6 +120,8 @@
+ xmlDictStringsPtr strings;
+
+ struct _xmlDict *subdict;
++ /* used for randomization */
++ int seed;
+ };
+
+ /*
+@@ -125,6 +149,10 @@
+ if ((xmlDictMutex = xmlNewRMutex()) == NULL)
+ return(0);
+
++#ifdef DICT_RANDOMIZATION
++ srand(time(NULL));
++#endif
++
+ xmlDictInitialized = 1;
+ return(1);
+ }
+@@ -277,13 +305,13 @@
+ */
+
+ static uint32_t
+-xmlDictComputeBigKey(const xmlChar* data, int namelen) {
++xmlDictComputeBigKey(const xmlChar* data, int namelen, int seed) {
+ uint32_t hash;
+ int i;
+
+ if (namelen <= 0 || data == NULL) return(0);
+
+- hash = 0;
++ hash = seed;
+
+ for (i = 0;i < namelen; i++) {
+ hash += data[i];
+@@ -310,12 +338,12 @@
+ */
+ static unsigned long
+ xmlDictComputeBigQKey(const xmlChar *prefix, int plen,
+- const xmlChar *name, int len)
++ const xmlChar *name, int len, int seed)
+ {
+ uint32_t hash;
+ int i;
+
+- hash = 0;
++ hash = seed;
+
+ for (i = 0;i < plen; i++) {
+ hash += prefix[i];
+@@ -346,8 +374,8 @@
+ * for low hash table fill.
+ */
+ static unsigned long
+-xmlDictComputeFastKey(const xmlChar *name, int namelen) {
+- unsigned long value = 0L;
++xmlDictComputeFastKey(const xmlChar *name, int namelen, int seed) {
++ unsigned long value = seed;
+
+ if (name == NULL) return(0);
+ value = *name;
+@@ -381,9 +409,9 @@
+ */
+ static unsigned long
+ xmlDictComputeFastQKey(const xmlChar *prefix, int plen,
+- const xmlChar *name, int len)
++ const xmlChar *name, int len, int seed)
+ {
+- unsigned long value = 0L;
++ unsigned long value = seed;
+
+ if (plen == 0)
+ value += 30 * (unsigned long) ':';
+@@ -460,6 +488,11 @@
+ dict->subdict = NULL;
+ if (dict->dict) {
+ memset(dict->dict, 0, MIN_DICT_SIZE * sizeof(xmlDictEntry));
++#ifdef DICT_RANDOMIZATION
++ dict->seed = rand();
++#else
++ dict->seed = 0;
++#endif
+ return(dict);
+ }
+ xmlFree(dict);
+--- a/encoding.c
++++ b/encoding.c
+@@ -1928,7 +1928,7 @@
+ if (in == NULL) return(-1);
+
+ /* calculate space available */
+- written = out->size - out->use;
++ written = out->size - out->use - 1; /* count '\0' */
+ toconv = in->use;
+ /*
+ * echo '<?xml version="1.0" encoding="UCS4"?>' | wc -c => 38
+@@ -2059,7 +2059,7 @@
+ toconv = in->use;
+ if (toconv == 0)
+ return (0);
+- written = out->size - out->use;
++ written = out->size - out->use - 1; /* count '\0' */
+ if (toconv * 2 >= written) {
+ xmlBufferGrow(out, out->size + toconv * 2);
+ written = out->size - out->use - 1;
+--- a/error.c
++++ b/error.c
+@@ -452,6 +452,8 @@
+ xmlErrorPtr to = &xmlLastError;
+ xmlNodePtr baseptr = NULL;
+
++ if (code == XML_ERR_OK)
++ return;
+ if ((xmlGetWarningsDefaultValue == 0) && (level == XML_ERR_WARNING))
+ return;
+ if ((domain == XML_FROM_PARSER) || (domain == XML_FROM_HTML) ||
+@@ -459,8 +461,11 @@
+ (domain == XML_FROM_IO) || (domain == XML_FROM_VALID)) {
+ ctxt = (xmlParserCtxtPtr) ctx;
+ if ((schannel == NULL) && (ctxt != NULL) && (ctxt->sax != NULL) &&
+- (ctxt->sax->initialized == XML_SAX2_MAGIC))
++ (ctxt->sax->initialized == XML_SAX2_MAGIC) &&
++ (ctxt->sax->serror != NULL)) {
+ schannel = ctxt->sax->serror;
++ data = ctxt->userData;
++ }
+ }
+ /*
+ * Check if structured error handler set
+@@ -473,16 +478,6 @@
+ if (schannel != NULL)
+ data = xmlStructuredErrorContext;
+ }
+- if ((domain == XML_FROM_VALID) &&
+- ((channel == xmlParserValidityError) ||
+- (channel == xmlParserValidityWarning))) {
+- ctxt = (xmlParserCtxtPtr) ctx;
+- if ((schannel == NULL) && (ctxt != NULL) && (ctxt->sax != NULL) &&
+- (ctxt->sax->initialized == XML_SAX2_MAGIC))
+- schannel = ctxt->sax->serror;
+- }
+- if (code == XML_ERR_OK)
+- return;
+ /*
+ * Formatting the message
+ */
+@@ -589,6 +584,10 @@
+ if (to != &xmlLastError)
+ xmlCopyError(to,&xmlLastError);
+
++ if (schannel != NULL) {
++ schannel(data, to);
++ return;
++ }
+ /*
+ * Find the callback channel if channel param is NULL
+ */
+@@ -600,19 +599,9 @@
+ channel = ctxt->sax->error;
+ data = ctxt->userData;
+ } else if (channel == NULL) {
+- if ((schannel == NULL) && (xmlStructuredError != NULL)) {
+- schannel = xmlStructuredError;
+- data = xmlStructuredErrorContext;
+- } else {
+- channel = xmlGenericError;
+- if (!data) {
+- data = xmlGenericErrorContext;
+- }
+- }
+- }
+- if (schannel != NULL) {
+- schannel(data, to);
+- return;
++ channel = xmlGenericError;
++ if (!data)
++ data = xmlGenericErrorContext;
+ }
+ if (channel == NULL)
+ return;
+--- a/hash.c
++++ b/hash.c
+@@ -21,6 +21,22 @@
+ #include "libxml.h"
+
+ #include <string.h>
++#ifdef HAVE_STDLIB_H
++#include <stdlib.h>
++#endif
++#ifdef HAVE_TIME_H
++#include <time.h>
++#endif
++
++/*
++ * Following http://www.ocert.org/advisories/ocert-2011-003.html
++ * it seems that having hash randomization might be a good idea
++ * when using XML with untrusted data
++ */
++#if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME)
++#define HASH_RANDOMIZATION
++#endif
++
+ #include <libxml/parser.h>
+ #include <libxml/hash.h>
+ #include <libxml/xmlmemory.h>
+@@ -31,6 +47,10 @@
+
+ /* #define DEBUG_GROW */
+
++#ifdef HASH_RANDOMIZATION
++static int hash_initialized = 0;
++#endif
++
+ /*
+ * A single entry in the hash table
+ */
+@@ -53,6 +73,9 @@
+ int size;
+ int nbElems;
+ xmlDictPtr dict;
++#ifdef HASH_RANDOMIZATION
++ int random_seed;
++#endif
+ };
+
+ /*
+@@ -65,6 +88,9 @@
+ unsigned long value = 0L;
+ char ch;
+
++#ifdef HASH_RANDOMIZATION
++ value = table->random_seed;
++#endif
+ if (name != NULL) {
+ value += 30 * (*name);
+ while ((ch = *name++) != 0) {
+@@ -156,6 +182,13 @@
+ table->table = xmlMalloc(size * sizeof(xmlHashEntry));
+ if (table->table) {
+ memset(table->table, 0, size * sizeof(xmlHashEntry));
++#ifdef HASH_RANDOMIZATION
++ if (!hash_initialized) {
++ srand(time(NULL));
++ hash_initialized = 1;
++ }
++ table->random_seed = rand();
++#endif
+ return(table);
+ }
+ xmlFree(table);
+--- a/include/libxml/xpath.h
++++ b/include/libxml/xpath.h
+@@ -68,7 +68,8 @@
+ XPATH_UNDEF_PREFIX_ERROR,
+ XPATH_ENCODING_ERROR,
+ XPATH_INVALID_CHAR_ERROR,
+- XPATH_INVALID_CTXT
++ XPATH_INVALID_CTXT,
++ XPATH_STACK_ERROR
+ } xmlXPathError;
+
+ /*
+@@ -380,6 +381,9 @@
+ xmlXPathCompExprPtr comp; /* the precompiled expression */
+ int xptr; /* it this an XPointer expression */
+ xmlNodePtr ancestor; /* used for walking preceding axis */
++
++ int valueFrame; /* used to limit Pop on the stack */
++
+ };
+
+ /************************************************************************
+--- a/libxml-2.0-uninstalled.pc.in
++++ b/libxml-2.0-uninstalled.pc.in
+@@ -8,5 +8,6 @@
+ Version: @VERSION@
+ Description: libXML library version2.
+ Requires:
+-Libs: -L${libdir} -lxml2 @THREAD_LIBS@ @Z_LIBS@ @ICONV_LIBS@ @M_LIBS@ @LIBS@
++Libs: -L${libdir} -lxml2
++Libs.private: @BASE_THREAD_LIBS@ @THREAD_LIBS@ @Z_LIBS@ @ICONV_LIBS@ @M_LIBS@ @LIBS@
+ Cflags: -I${includedir} @XML_INCLUDEDIR@ @XML_CFLAGS@
+--- a/libxml.h
++++ b/libxml.h
+@@ -13,6 +13,9 @@
+ #ifndef _LARGEFILE_SOURCE
+ #define _LARGEFILE_SOURCE
+ #endif
++#ifndef _LARGEFILE64_SOURCE
++#define _LARGEFILE64_SOURCE
++#endif
+ #ifndef _FILE_OFFSET_BITS
+ #define _FILE_OFFSET_BITS 64
+ #endif
+--- a/parser.c
++++ b/parser.c
+@@ -2709,7 +2709,7 @@
+
+ buffer[nbchars++] = '&';
+ if (nbchars > buffer_size - i - XML_PARSER_BUFFER_SIZE) {
+- growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
++ growBuffer(buffer, i + XML_PARSER_BUFFER_SIZE);
+ }
+ for (;i > 0;i--)
+ buffer[nbchars++] = *cur++;
+@@ -4949,7 +4949,8 @@
+ (ctxt->sax->processingInstruction != NULL))
+ ctxt->sax->processingInstruction(ctxt->userData,
+ target, NULL);
+- ctxt->instate = state;
++ if (ctxt->instate != XML_PARSER_EOF)
++ ctxt->instate = state;
+ return;
+ }
+ buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
+@@ -5029,7 +5030,8 @@
+ } else {
+ xmlFatalErr(ctxt, XML_ERR_PI_NOT_STARTED, NULL);
+ }
+- ctxt->instate = state;
++ if (ctxt->instate != XML_PARSER_EOF)
++ ctxt->instate = state;
+ }
+ }
+
+@@ -9588,6 +9590,8 @@
+ else
+ name = xmlParseStartTag(ctxt);
+ #endif /* LIBXML_SAX1_ENABLED */
++ if (ctxt->instate == XML_PARSER_EOF)
++ return;
+ if (name == NULL) {
+ spacePop(ctxt);
+ return;
+@@ -10967,6 +10971,8 @@
+ else
+ name = xmlParseStartTag(ctxt);
+ #endif /* LIBXML_SAX1_ENABLED */
++ if (ctxt->instate == XML_PARSER_EOF)
++ goto done;
+ if (name == NULL) {
+ spacePop(ctxt);
+ ctxt->instate = XML_PARSER_EOF;
+@@ -11153,7 +11159,9 @@
+ else
+ xmlParseEndTag1(ctxt, 0);
+ #endif /* LIBXML_SAX1_ENABLED */
+- if (ctxt->nameNr == 0) {
++ if (ctxt->instate == XML_PARSER_EOF) {
++ /* Nothing */
++ } else if (ctxt->nameNr == 0) {
+ ctxt->instate = XML_PARSER_EPILOG;
+ } else {
+ ctxt->instate = XML_PARSER_CONTENT;
+--- a/xml2-config.1
++++ b/xml2-config.1
+@@ -9,7 +9,6 @@
+ linker flags that should be used to compile and link programs that use
+ \fIGNOME-XML\fP.
+ .SH OPTIONS
+-.l
+ \fIxml-config\fP accepts the following options:
+ .TP 8
+ .B \-\-version
+@@ -17,6 +16,8 @@
+ .TP 8
+ .B \-\-libs
+ Print the linker flags that are necessary to link a \fIGNOME-XML\fP program.
++Add the \fB\-\-static\fP option to print the linker flags that are necessary to
++\fBstatically\fP link a \fIGNOME-XML\fP program.
+ .TP 8
+ .B \-\-cflags
+ Print the compiler flags that are necessary to compile a \fIGNOME-XML\fP program.
+--- a/xml2-config.in
++++ b/xml2-config.in
+@@ -15,6 +15,7 @@
+ --prefix=DIR change libxml prefix [default $prefix]
+ --exec-prefix=DIR change libxml exec prefix [default $exec_prefix]
+ --libs print library linking information
++ add --static to print static library linking information
+ --cflags print pre-processor and compiler flags
+ --modules module support enabled
+ --help display this help and exit
+@@ -86,13 +87,19 @@
+ then
+ if [ "@XML_LIBDIR@" = "-L/usr/lib" -o "@XML_LIBDIR@" = "-L/usr/lib64" ]
+ then
+- echo @XML_LIBS@
++ LIBS="@XML_LIBS@ "
+ else
+- echo @XML_LIBDIR@ @XML_LIBS@
++ LIBS="@XML_LIBDIR@ @XML_LIBS@"
+ fi
+ else
+- echo @XML_LIBDIR@ @XML_LIBS@ @WIN32_EXTRA_LIBADD@
++ LIBS="@XML_LIBDIR@ @XML_LIBS@ @WIN32_EXTRA_LIBADD@"
+ fi
++ if [ "$2" = "--static" ]
++ then
++ shift
++ LIBS="${LIBS} @Z_LIBS@ @BASE_THREAD_LIBS@ @THREAD_LIBS@ @ICONV_LIBS@ @M_LIBS@ @LIBS@"
++ fi
++ echo ${LIBS}
+ ;;
+
+ *)
+--- a/xmllint.c
++++ b/xmllint.c
+@@ -2976,7 +2976,7 @@
+ printf("\t--huge : remove any internal arbitrary parser limits\n");
+ printf("\t--noent : substitute entity references by their value\n");
+ printf("\t--noout : don't output the result tree\n");
+- printf("\t--path 'paths': provide a set of paths for resources\n");
++ printf("\t--path 'paths' : provide a set of paths for resources\n");
+ printf("\t--load-trace : print trace of all external entites loaded\n");
+ printf("\t--nonet : refuse to fetch DTDs or entities over network\n");
+ printf("\t--nocompact : do not generate compact text nodes\n");
+@@ -3032,7 +3032,7 @@
+ printf("\t--catalogs : use SGML catalogs from $SGML_CATALOG_FILES\n");
+ printf("\t otherwise XML Catalogs starting from \n");
+ printf("\t %s are activated by default\n", XML_XML_DEFAULT_CATALOG);
+- printf("\t--nocatalogs: deactivate all catalogs\n");
++ printf("\t--nocatalogs : deactivate all catalogs\n");
+ #endif
+ printf("\t--auto : generate a small doc on the fly\n");
+ #ifdef LIBXML_XINCLUDE_ENABLED
+--- a/xpath.c
++++ b/xpath.c
+@@ -252,6 +252,7 @@
+ "Encoding error\n",
+ "Char out of XML range\n",
+ "Invalid or incomplete context\n",
++ "Stack usage errror\n",
+ "?? Unknown error ??\n" /* Must be last in the list! */
+ };
+ #define MAXERRNO ((int)(sizeof(xmlXPathErrorMessages) / \
+@@ -2398,6 +2399,42 @@
+ ************************************************************************/
+
+ /**
++ * xmlXPathSetFrame:
++ * @ctxt: an XPath parser context
++ *
++ * Set the callee evaluation frame
++ *
++ * Returns the previous frame value to be restored once done
++ */
++static int
++xmlXPathSetFrame(xmlXPathParserContextPtr ctxt) {
++ int ret;
++
++ if (ctxt == NULL)
++ return(0);
++ ret = ctxt->valueFrame;
++ ctxt->valueFrame = ctxt->valueNr;
++ return(ret);
++}
++
++/**
++ * xmlXPathPopFrame:
++ * @ctxt: an XPath parser context
++ * @frame: the previous frame value
++ *
++ * Remove the callee evaluation frame
++ */
++static void
++xmlXPathPopFrame(xmlXPathParserContextPtr ctxt, int frame) {
++ if (ctxt == NULL)
++ return;
++ if (ctxt->valueNr < ctxt->valueFrame) {
++ xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_STACK_ERROR);
++ }
++ ctxt->valueFrame = frame;
++}
++
++/**
+ * valuePop:
+ * @ctxt: an XPath evaluation context
+ *
+@@ -2412,6 +2449,12 @@
+
+ if ((ctxt == NULL) || (ctxt->valueNr <= 0))
+ return (NULL);
++
++ if (ctxt->valueNr <= ctxt->valueFrame) {
++ xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_STACK_ERROR);
++ return (NULL);
++ }
++
+ ctxt->valueNr--;
+ if (ctxt->valueNr > 0)
+ ctxt->value = ctxt->valueTab[ctxt->valueNr - 1];
+@@ -3523,12 +3566,13 @@
+ xmlNodePtr *temp;
+
+ cur->nodeMax *= 2;
+- temp = (xmlNodePtr *) xmlRealloc(cur->nodeTab, cur->nodeMax *
++ temp = (xmlNodePtr *) xmlRealloc(cur->nodeTab, cur->nodeMax * 2 *
+ sizeof(xmlNodePtr));
+ if (temp == NULL) {
+ xmlXPathErrMemory(NULL, "growing nodeset\n");
+ return;
+ }
++ cur->nodeMax *= 2;
+ cur->nodeTab = temp;
+ }
+ cur->nodeTab[cur->nodeNr++] = xmlXPathNodeSetDupNs(node, ns);
+@@ -3627,14 +3671,14 @@
+ } else if (cur->nodeNr == cur->nodeMax) {
+ xmlNodePtr *temp;
+
+- cur->nodeMax *= 2;
+- temp = (xmlNodePtr *) xmlRealloc(cur->nodeTab, cur->nodeMax *
++ temp = (xmlNodePtr *) xmlRealloc(cur->nodeTab, cur->nodeMax * 2 *
+ sizeof(xmlNodePtr));
+ if (temp == NULL) {
+ xmlXPathErrMemory(NULL, "growing nodeset\n");
+ return;
+ }
+ cur->nodeTab = temp;
++ cur->nodeMax *= 2;
+ }
+ if (val->type == XML_NAMESPACE_DECL) {
+ xmlNsPtr ns = (xmlNsPtr) val;
+@@ -3738,14 +3782,14 @@
+ } else if (val1->nodeNr == val1->nodeMax) {
+ xmlNodePtr *temp;
+
+- val1->nodeMax *= 2;
+- temp = (xmlNodePtr *) xmlRealloc(val1->nodeTab, val1->nodeMax *
++ temp = (xmlNodePtr *) xmlRealloc(val1->nodeTab, val1->nodeMax * 2 *
+ sizeof(xmlNodePtr));
+ if (temp == NULL) {
+ xmlXPathErrMemory(NULL, "merging nodeset\n");
+ return(NULL);
+ }
+ val1->nodeTab = temp;
++ val1->nodeMax *= 2;
+ }
+ if (n2->type == XML_NAMESPACE_DECL) {
+ xmlNsPtr ns = (xmlNsPtr) n2;
+@@ -3907,14 +3951,14 @@
+ } else if (set1->nodeNr >= set1->nodeMax) {
+ xmlNodePtr *temp;
+
+- set1->nodeMax *= 2;
+ temp = (xmlNodePtr *) xmlRealloc(
+- set1->nodeTab, set1->nodeMax * sizeof(xmlNodePtr));
++ set1->nodeTab, set1->nodeMax * 2 * sizeof(xmlNodePtr));
+ if (temp == NULL) {
+ xmlXPathErrMemory(NULL, "merging nodeset\n");
+ return(NULL);
+ }
+ set1->nodeTab = temp;
++ set1->nodeMax *= 2;
+ }
+ if (n2->type == XML_NAMESPACE_DECL) {
+ xmlNsPtr ns = (xmlNsPtr) n2;
+@@ -3991,14 +4035,14 @@
+ } else if (set1->nodeNr >= set1->nodeMax) {
+ xmlNodePtr *temp;
+
+- set1->nodeMax *= 2;
+ temp = (xmlNodePtr *) xmlRealloc(
+- set1->nodeTab, set1->nodeMax * sizeof(xmlNodePtr));
++ set1->nodeTab, set1->nodeMax * 2 * sizeof(xmlNodePtr));
+ if (temp == NULL) {
+ xmlXPathErrMemory(NULL, "merging nodeset\n");
+ return(NULL);
+ }
+ set1->nodeTab = temp;
++ set1->nodeMax *= 2;
+ }
+ set1->nodeTab[set1->nodeNr++] = n2;
+ }
+@@ -6154,6 +6198,7 @@
+ ret->valueNr = 0;
+ ret->valueMax = 10;
+ ret->value = NULL;
++ ret->valueFrame = 0;
+
+ ret->context = ctxt;
+ ret->comp = comp;
+@@ -11712,6 +11757,7 @@
+ xmlXPathObjectPtr contextObj = NULL, exprRes = NULL;
+ xmlNodePtr oldContextNode, contextNode = NULL;
+ xmlXPathContextPtr xpctxt = ctxt->context;
++ int frame;
+
+ #ifdef LIBXML_XPTR_ENABLED
+ /*
+@@ -11731,6 +11777,7 @@
+ */
+ exprOp = &ctxt->comp->steps[op->ch2];
+ for (i = 0; i < set->nodeNr; i++) {
++ xmlXPathObjectPtr tmp;
+ if (set->nodeTab[i] == NULL)
+ continue;
+
+@@ -11758,18 +11805,25 @@
+ xmlXPathNodeSetAddUnique(contextObj->nodesetval,
+ contextNode);
+
++ frame = xmlXPathSetFrame(ctxt);
+ valuePush(ctxt, contextObj);
+ res = xmlXPathCompOpEvalToBoolean(ctxt, exprOp, 1);
++ tmp = valuePop(ctxt);
++ xmlXPathPopFrame(ctxt, frame);
+
+ if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) {
+- xmlXPathObjectPtr tmp;
+- /* pop the result */
+- tmp = valuePop(ctxt);
+- xmlXPathReleaseObject(xpctxt, tmp);
+- /* then pop off contextObj, which will be freed later */
+- valuePop(ctxt);
++ while (tmp != contextObj) {
++ /*
++ * Free up the result
++ * then pop off contextObj, which will be freed later
++ */
++ xmlXPathReleaseObject(xpctxt, tmp);
++ tmp = valuePop(ctxt);
++ }
+ goto evaluation_error;
+ }
++ /* push the result back onto the stack */
++ valuePush(ctxt, tmp);
+
+ if (res)
+ pos++;
+@@ -13357,6 +13411,7 @@
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlXPathCompOpEval: variable %s bound to undefined prefix %s\n",
+ (char *) op->value4, (char *)op->value5);
++ ctxt->error = XPATH_UNDEF_PREFIX_ERROR;
+ return (total);
+ }
+ val = xmlXPathVariableLookupNS(ctxt->context,
+@@ -13373,7 +13428,9 @@
+ xmlXPathFunction func;
+ const xmlChar *oldFunc, *oldFuncURI;
+ int i;
++ int frame;
+
++ frame = xmlXPathSetFrame(ctxt);
+ if (op->ch1 != -1)
+ total +=
+ xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
+@@ -13381,15 +13438,18 @@
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlXPathCompOpEval: parameter error\n");
+ ctxt->error = XPATH_INVALID_OPERAND;
++ xmlXPathPopFrame(ctxt, frame);
+ return (total);
+ }
+- for (i = 0; i < op->value; i++)
++ for (i = 0; i < op->value; i++) {
+ if (ctxt->valueTab[(ctxt->valueNr - 1) - i] == NULL) {
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlXPathCompOpEval: parameter error\n");
+ ctxt->error = XPATH_INVALID_OPERAND;
++ xmlXPathPopFrame(ctxt, frame);
+ return (total);
+ }
++ }
+ if (op->cache != NULL)
+ XML_CAST_FPTR(func) = op->cache;
+ else {
+@@ -13405,6 +13465,8 @@
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlXPathCompOpEval: function %s bound to undefined prefix %s\n",
+ (char *)op->value4, (char *)op->value5);
++ ctxt->error = XPATH_UNDEF_PREFIX_ERROR;
++ xmlXPathPopFrame(ctxt, frame);
+ return (total);
+ }
+ func = xmlXPathFunctionLookupNS(ctxt->context,
+@@ -13426,6 +13488,7 @@
+ func(ctxt, op->value);
+ ctxt->context->function = oldFunc;
+ ctxt->context->functionURI = oldFuncURI;
++ xmlXPathPopFrame(ctxt, frame);
+ return (total);
+ }
+ case XPATH_OP_ARG:
+@@ -14329,6 +14392,7 @@
+ ctxt->valueNr = 0;
+ ctxt->valueMax = 10;
+ ctxt->value = NULL;
++ ctxt->valueFrame = 0;
+ }
+ #ifdef XPATH_STREAMING
+ if (ctxt->comp->stream) {
+--- a/xpointer.c
++++ b/xpointer.c
+@@ -1269,6 +1269,7 @@
+ ctxt->valueNr = 0;
+ ctxt->valueMax = 10;
+ ctxt->value = NULL;
++ ctxt->valueFrame = 0;
+ }
+ SKIP_BLANKS;
+ if (CUR == '/') {
+--- a/doc/devhelp/Makefile.am
++++ b/doc/devhelp/Makefile.am
+@@ -63,7 +63,7 @@
+ libxml2.devhelp $(HTML_FILES): devhelp.xsl html.xsl $(top_srcdir)/doc/libxml2-api.xml
+ -@(echo Rebuilding devhelp files)
+ -@(if [ -x $(XSLTPROC) ] ; then \
+- $(XSLTPROC) --nonet -o $(srcdir)/libxml2.devhelp devhelp.xsl $(top_srcdir)/doc/libxml2-api.xml ; fi );
++ $(XSLTPROC) --nonet -o $(srcdir)/libxml2.devhelp $(top_srcdir)/doc/devhelp/devhelp.xsl $(top_srcdir)/doc/libxml2-api.xml ; fi );
+
+ install-data-local:
+ -@MKDIR_P@ $(DESTDIR)$(DEVHELP_DIR)
+--- a/doc/examples/Makefile.am
++++ b/doc/examples/Makefile.am
+@@ -5,17 +5,17 @@
+
+ rebuild: examples.xml index.html
+
+-examples.xml: index.py *.c
++examples.xml: $(srcdir)/index.py $(srcdir)/*.c
+ -@($(srcdir)/index.py)
+
+-index.html: examples.xml examples.xsl
+- -@(xsltproc examples.xsl examples.xml && echo "Rebuilt web page" && xmllint --valid --noout index.html)
++index.html: $(srcdir)/examples.xml $(srcdir)/examples.xsl
++ -@(xsltproc $(srcdir)/examples.xsl $(srcdir)/examples.xml && echo "Rebuilt web page" && 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)
+
+-EXTRA_DIST=examples.xsl index.py examples.xml writer.xml test3.xml tst.xml test1.xml test2.xml io2.res xpath2.res tree1.res reader4.res io1.res tree2.res reader3.res xpath1.res reader1.res
++EXTRA_DIST=index.html examples.xsl index.py examples.xml writer.xml test3.xml tst.xml test1.xml test2.xml io2.res xpath2.res tree1.res reader4.res io1.res tree2.res reader3.res xpath1.res reader1.res
+
+ noinst_PROGRAMS=xpath2 reader1 reader4 parse2 reader2 parse3 reader3 tree2 parse4 io2 testWriter io1 xpath1 parse1 tree1
+
+--- a/doc/Makefile.am
++++ b/doc/Makefile.am
+@@ -96,11 +96,11 @@
+ -@(cd .. ; $(MAKE) rebuild_testapi)
+
+
+-xmllint.1: xmllint.xml
+- -@($(XSLTPROC) --nonet xmllint.xml)
++xmllint.1: $(srcdir)/xmllint.xml
++ -@($(XSLTPROC) --nonet $(srcdir)/xmllint.xml)
+
+-xmlcatalog.1: xmlcatalog_man.xml
+- -@($(XSLTPROC) --nonet xmlcatalog_man.xml)
++xmlcatalog.1: $(srcdir)/xmlcatalog_man.xml
++ -@($(XSLTPROC) --nonet $(srcdir)/xmlcatalog_man.xml)
+
+ clean-local:
+ rm -f *~ *.bak *.hierarchy *.signals *-unused.txt
diff --git a/debian/patches/series b/debian/patches/series
index 56dd302..306e703 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1 @@
-01_build-system.patch
+01_historical_changes.patch
diff --git a/debian/rules b/debian/rules
index 832457c..1b4999d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -12,7 +12,7 @@ LDFLAGS = `dpkg-buildflags --get LDFLAGS` -Wl,--as-needed
CPPFLAGS = `dpkg-buildflags --get CPPFLAGS`
ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
- CFLAGS += -fno-strict-aliasing
+ CFLAGS += -fno-strict-aliasing
endif
TARGETS := main $(PYVERS) $(PYVERS:%=%-dbg)
@@ -29,38 +29,40 @@ endif
CONFIGURE_FLAGS := --with-history CC="$(CC)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" --cache-file="$(CURDIR)/build/config.cache"
-override_dh_auto_configure: $(TARGETS:%=configure-%)
+override_dh_auto_configure: $(TARGETS:%=doconfigure-%)
-configure-%:
+doconfigure-%:
dh_auto_configure --builddirectory=build/$* -- $(CONFIGURE_FLAGS)
-configure-main: CONFIGURE_FLAGS += --without-python --libdir=/usr/lib/$(DEB_HOST_MULTIARCH)
-configure-python%: CONFIGURE_FLAGS += --with-python=/usr/bin/$*
-configure-udeb: CONFIGURE_FLAGS += --without-history --with-minimum --with-tree --with-output
+doconfigure-main: CONFIGURE_FLAGS += --without-python --libdir=/usr/lib/$(DEB_HOST_MULTIARCH)
+doconfigure-python%: CONFIGURE_FLAGS += --with-python=/usr/bin/$*
+doconfigure-udeb: CONFIGURE_FLAGS += --without-history --with-minimum --with-tree --with-output
-override_dh_auto_build: $(TARGETS:%=build-%)
+override_dh_auto_build: $(TARGETS:%=dobuild-%)
-build-%: BUILD_DIR=build/$*
-build-%:
+dobuild-%: BUILD_DIR=build/$*
+dobuild-%: doconfigure-%
$(if $(filter $(BUILD_DIR),build/$*),,[ -d $(BUILD_DIR) ] || mv build/$*/python $(BUILD_DIR))
dh_auto_build --builddirectory=$(BUILD_DIR) -- $(BUILD_FLAGS)
+ $(if $(filter build/main,$(BUILD_DIR)),make -C $(BUILD_DIR)/doc/examples rebuild)
+ #$(if $(filter build/main/python%,$(BUILD_DIR)),make -C $(BUILD_DIR)/tests tests)
-build-python%: BUILD_DIR=build/main/$*
-build-python%: BUILD_FLAGS = libxml2mod_la_LIBADD='$$(mylibs)'
-build-python%-dbg: BUILD_FLAGS += PYTHON_INCLUDES=/usr/include/$(*:-dbg=_d) \
+dobuild-python%: BUILD_DIR=build/main/$*
+dobuild-python%: BUILD_FLAGS = libxml2mod_la_LIBADD='$$(mylibs)'
+dobuild-python%-dbg: BUILD_FLAGS += PYTHON_INCLUDES=/usr/include/$(*:-dbg=_d) \
LDFLAGS="-L$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)" CFLAGS="-Wall -g -O0"
+build-arch: $(TARGETS:%=dobuild-%)
+build-indep:
+build: build-arch build-indep
override_dh_auto_clean:
- rm -rf build debian/tmp-dbg
+ rm -rf build debian/tmp-dbg debian/tmp-udeb
+ dh_auto_clean
- -test -r /usr/share/misc/config.sub && \
- cp -f /usr/share/misc/config.sub config.sub
- -test -r /usr/share/misc/config.guess && \
- cp -f /usr/share/misc/config.guess config.guess
-
-override_dh_auto_install: $(TARGETS:%=install-%)
+override_dh_auto_install: $(TARGETS:%=doinstall-%)
+ find debian/ -name *.la -delete
-install-main:
+doinstall-main:
dh_auto_install --builddirectory=build/main
mv debian/tmp/usr/share/aclocal/libxml.m4 debian/tmp/usr/share/aclocal/libxml2.m4
@@ -74,20 +76,20 @@ install-main:
install -m 644 \
doc/examples/*.c \
doc/examples/*.res \
- doc/examples/index.html \
+ build/main/doc/examples/index.html \
doc/examples/[tw]*.xml debian/tmp/usr/share/doc/libxml2-doc/examples
cp -a \
doc/html \
doc/tutorial debian/tmp/usr/share/doc/libxml2-doc
-install-python%-dbg:
+doinstall-python%-dbg:
$(MAKE) -C build/main/python$*-dbg DESTDIR=$(CURDIR)/debian/tmp-dbg install-pythonLTLIBRARIES
prename 's/(?<!_d)\.so$$/_d.so/' debian/tmp-dbg/usr/lib/python$*/*-packages/*.so
-install-python%:
+doinstall-python%:
dh_auto_install --builddirectory=build/main/python$*
-install-udeb:
+doinstall-udeb:
dh_auto_install --builddirectory=build/udeb --destdir=debian/tmp-udeb
override_dh_installdocs:
@@ -105,11 +107,10 @@ override_dh_install:
dh_install -Npython-libxml2-dbg -Nlibxml2-udeb
dh_install -ppython-libxml2-dbg --sourcedir=debian/tmp-dbg
dh_install -plibxml2-udeb --sourcedir=debian/tmp-udeb
- #sed "/dependency_libs/ s/'.*'/''/" debian/tmp/usr/lib/libxml2.la > debian/libxml2-dev/usr/lib/libxml2.la
- find debian/ -name *.la -delete
override_dh_strip:
- dh_strip -a --dbg-package=libxml2-dbg -Npython-libxml2 -Npython-libxml2-dbg
+ dh_strip -a --dbg-package=libxml2-dbg -Nlibxml2-udeb -Nlibxml2-utils -Nlibxml2-utils-dbg -Npython-libxml2 -Npython-libxml2-dbg
+ dh_strip -plibxml2-utils --dbg-package=libxml2-utils-dbg
dh_strip -ppython-libxml2 --dbg-package=python-libxml2-dbg
$(foreach python, $(filter-out $(PYVER), $(PYVERS)),\
cd $(CURDIR)/debian/python-libxml2/usr/lib/pyshared; \
@@ -117,9 +118,12 @@ override_dh_strip:
rm -f $(python)/libxml2mod.so; \
ln -s ../$(PYVER)/libxml2mod.so $(python)/libxml2mod.so; \
fi;)
+ dh_strip
override_dh_makeshlibs:
dh_makeshlibs -a $(if $(WITH_UDEB),--add-udeb=libxml2-udeb )-V 'libxml2 (>= 2.7.4)' -- -c4
%:
dh $@ --with autoreconf --with python2
+
+
diff --git a/doc/examples/index.html b/doc/examples/index.html
deleted file mode 100644
index 43e1471..0000000
--- a/doc/examples/index.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<?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://codespeak.net/lxml/">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="http://bugzilla.gnome.org/buglist.cgi?product=libxml2">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="#io2.c">io2.c</a>: Output to char buffer</li><li><a href="#io1.c">io1.c</a>: Example of custom Input/Output</li></ul></li><li><p><a href="#Tree">Tree</a> :</p><ul><li><a href="#tree2.c">tree2.c</a>: Creates a tree</li><li><a href="#tree1.c">tree1.c</a>: Navigates a tree to print element names</li></ul></li><li><p><a href="#XPath">XPath</a> :</p><ul><li><a href="#xpath2.c">xpath2.c</a>: Load a document, locate subelements with XPath, modify said elements and save the resulting document.</li><li><a href="#xpath1.c">xpath1.c</a>: Evaluate XPath expression and prints result node set.</li></ul></li><li><p><a href="#Parsing">Parsing</a> :</p><ul><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><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></ul></li><li><p><a href="#xmlReader">xmlReader</a> :</p><ul><li><a href="#reader2.c">reader2.c</a>: Parse and validate an XML file with an xmlReader</li><li><a href="#reader1.c">reader1.c</a>: Parse 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 dependancies 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="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><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 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></ul><p>Usage:</p><p>io1</p><p>Author: Daniel Veillard</p><h2><a name="Parsing" id="Parsing"></a>Parsing Examples</h2><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 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 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></ul><p>Usage:</p><p>parse4 test3.xml</p><p>Author: Daniel Veillard</p><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 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><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 26: Function <a href="../html/libxml-parser.html#xmlReadFile">xmlReadFile</a> from parser.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 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 47: Function <a href="../html/libxml-parser.html#xmlFreeParserCtxt">xmlFreeParserCtxt</a> from parser.h</li></ul><p>Usage:</p><p>parse2 test2.xml</p><p>Author: Daniel Veillard</p><h2><a name="Tree" id="Tree"></a>Tree Examples</h2><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 34: Macro <a href="../html/libxml-xmlversion.html#LIBXML_TEST_VERSION">LIBXML_TEST_VERSION</a> from xmlversion.h</li><li> line 39: Function <a href="../html/libxml-tree.html#xmlNewDoc">xmlNewDoc</a> from tree.h</li><li> line 41: Function <a href="../html/libxml-tree.html#xmlDocSetRootElement">xmlDocSetRootElement</a> from tree.h</li><li> line 46: Function <a href="../html/libxml-tree.html#xmlCreateIntSubset">xmlCreateIntSubset</a> from tree.h</li><li> line 74: Function <a href="../html/libxml-tree.html#xmlNewNode">xmlNewNode</a> from tree.h</li><li> line 75: Function <a href="../html/libxml-tree.html#xmlNewText">xmlNewText</a> from tree.h</li><li> line 78: Function <a href="../html/libxml-tree.html#xmlAddChild">xmlAddChild</a> from tree.h</li><li> line 88: Function <a href="../html/libxml-tree.html#xmlNewChild">xmlNewChild</a> from tree.h</li><li> line 89: Function <a href="../html/libxml-tree.html#xmlNewProp">xmlNewProp</a> from tree.h</li><li> line 96: Function <a href="../html/libxml-tree.html#xmlSaveFormatFileEnc">xmlSaveFormatFileEnc</a> from tree.h</li><li> line 99: Function <a href="../html/libxml-tree.html#xmlFreeDoc">xmlFreeDoc</a> from tree.h</li><li> line 105: Function <a href="../html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a> from parser.h</li><li> line 110: Function <a href="../html/libxml-xmlmemory.html#xmlMemoryDump">xmlMemoryDump</a> from xmlmemory.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><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><h2><a name="XPath" id="XPath"></a>XPath Examples</h2><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 45: Macro <a href="../html/libxml-xmlversion.html#LIBXML_TEST_VERSION">LIBXML_TEST_VERSION</a> from xmlversion.h</li><li> line 51: Function <a href="../html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a> from parser.h</li><li> line 56: Function <a href="../html/libxml-xmlmemory.html#xmlMemoryDump">xmlMemoryDump</a> from xmlmemory.h</li><li> line 86: Type <a href="../html/libxml-tree.html#xmlDocPtr">xmlDocPtr</a> from tree.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 131: Function <a href="../html/libxml-tree.html#xmlFreeDoc">xmlFreeDoc</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><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 43: Macro <a href="../html/libxml-xmlversion.html#LIBXML_TEST_VERSION">LIBXML_TEST_VERSION</a> from xmlversion.h</li><li> line 49: 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><li> line 86: Type <a href="../html/libxml-tree.html#xmlDocPtr">xmlDocPtr</a> from tree.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 131: Function <a href="../html/libxml-tree.html#xmlFreeDoc">xmlFreeDoc</a> from tree.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><h2><a name="xmlReader" id="xmlReader"></a>xmlReader Examples</h2><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><li> line 104: Macro <a href="../html/libxml-xmlversion.html#LIBXML_TEST_VERSION">LIBXML_TEST_VERSION</a> from xmlversion.h</li><li> line 109: Function <a href="../html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a> from parser.h</li><li> line 113: Function <a href="../html/libxml-xmlmemory.html#xmlMemoryDump">xmlMemoryDump</a> from xmlmemory.h</li></ul><p>Usage:</p><p>reader2 &lt;valid_xml_filename&gt;</p><p>Author: Daniel Veillard</p><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="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 879: Type <a href="../html/libxml-tree.html#xmlDocPtr">xmlDocPtr</a> from tree.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 1131: Function <a href="../html/libxml-tree.html#xmlFreeDoc">xmlFreeDoc</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>