summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2014-09-02 13:34:01 +0400
committerIgor Pashev <pashev.igor@gmail.com>2014-09-02 13:34:01 +0400
commitfa06cf6edf86aa1839d4f43bfd3bd9a3a36b5223 (patch)
tree705466443ec58fffa74a3499a3bcc56be1cdee9d
parent08f466c86ef859f2f3ab1f65677536cbccd85960 (diff)
parent3a8c2d58eab0410fe5e79a112614aa9be061dc46 (diff)
downloadlibxml2-fa06cf6edf86aa1839d4f43bfd3bd9a3a36b5223.tar.gz
Merge branch 'master' of git://anonscm.debian.org/debian-xml-sgml/libxml2
Conflicts: debian/changelog debian/control debian/rules
-rw-r--r--COPYING14
-rw-r--r--Copyright14
-rw-r--r--HTMLparser.c7
-rw-r--r--Makefile.in99
-rw-r--r--SAX2.c19
-rw-r--r--aclocal.m410
-rw-r--r--buf.c3
-rw-r--r--catalog.c10
-rwxr-xr-xconfig.guess16
-rwxr-xr-xconfig.sub19
-rwxr-xr-xconfigure372
-rw-r--r--configure.in52
-rw-r--r--debian/changelog64
-rw-r--r--debian/control14
-rw-r--r--debian/libxml2.symbols5
-rw-r--r--debian/patches/0001-modify-xml2-config-and-pkgconfig-behaviour.patch19
-rw-r--r--debian/patches/0002-fix-python-multiarch-includes.patch35
-rw-r--r--debian/patches/0002-rand_seed-should-be-static-in-dict.c.patch28
-rw-r--r--debian/patches/0003-Fix-a-thread-portability-problem.patch34
-rw-r--r--debian/patches/0003-Fix-an-error-in-xmlCleanupParser.patch27
-rw-r--r--debian/patches/0004-Fix-missing-break-on-last-function-for-attributes.patch21
-rw-r--r--debian/patches/0004-link-libxml2mod-first.patch24
-rw-r--r--debian/patches/0005-xmllint-memory-should-fail-on-empty-files.patch27
-rw-r--r--debian/patches/0006-properly-quote-the-namespace-uris-written-out-during.patch32
-rw-r--r--debian/patches/0007-Fix-a-parsing-bug-on-non-ascii-element-and-CR-LF-usa.patch57
-rw-r--r--debian/patches/0008-missing-else-in-xlink.c.patch22
-rw-r--r--debian/patches/0009-Catch-malloc-error-and-exit-accordingly.patch24
-rw-r--r--debian/patches/0010-Fix-handling-of-mmap-errors.patch51
-rw-r--r--debian/patches/0011-Avoid-crash-if-allocation-fails.patch25
-rw-r--r--debian/patches/0012-Fix-a-possible-NULL-dereference.patch30
-rw-r--r--debian/patches/0013-Clear-up-a-potential-NULL-dereference.patch26
-rw-r--r--debian/patches/0014-Fix-XPath-optimization-with-predicates.patch27
-rw-r--r--debian/patches/0015-xmllint-pretty-crashed-without-following-numeric-arg.patch34
-rw-r--r--debian/patches/0016-Fix-potential-NULL-pointer-dereferences-in-regexp-co.patch45
-rw-r--r--debian/patches/0017-Fix-a-potential-NULL-dereference-in-tree-code.patch26
-rw-r--r--debian/patches/0018-Fix-pointer-dereferenced-before-null-check.patch25
-rw-r--r--debian/patches/0019-Fix-a-bug-loading-some-compressed-files.patch69
-rw-r--r--debian/patches/0020-Avoid-a-possibility-of-dangling-encoding-handler.patch57
-rw-r--r--debian/patches/0021-Fix-a-couple-of-missing-NULL-checks.patch29
-rw-r--r--debian/patches/0022-adding-init-calls-to-xml-and-html-Read-parsing-entry.patch148
-rw-r--r--debian/patches/0023-Handling-of-XPath-function-arguments-in-error-case.patch41
-rw-r--r--debian/patches/0024-Missing-initialization-for-the-catalog-module.patch22
-rw-r--r--debian/patches/0025-Fix-an-fd-leak-in-an-error-case.patch24
-rw-r--r--debian/patches/0026-fixing-a-ptotential-uninitialized-access.patch21
-rw-r--r--debian/patches/0027-Fix-xmlTextWriterWriteElement-when-a-null-content-is.patch29
-rw-r--r--debian/patches/0028-Avoid-a-possible-NULL-pointer-dereference.patch22
-rw-r--r--debian/patches/0029-Do-not-fetch-external-parameter-entities.patch35
-rw-r--r--debian/patches/0030-Avoid-Possible-null-pointer-dereference-in-memory-de.patch32
-rw-r--r--debian/patches/0031-xmllint-was-not-parsing-the-c14n11-flag.patch22
-rw-r--r--debian/patches/0032-Fix-regressions-introduced-by-CVE-2014-0191-patch.patch58
-rw-r--r--debian/patches/series34
-rwxr-xr-xdebian/rules35
-rw-r--r--debian/watch4
-rw-r--r--debugXML.c1
-rwxr-xr-xdepcomp124
-rw-r--r--dict.c29
-rw-r--r--doc/APIchunk10.html3
-rw-r--r--doc/APIchunk12.html1
-rw-r--r--doc/APIchunk13.html1
-rw-r--r--doc/APIchunk14.html1
-rw-r--r--doc/APIchunk16.html1
-rw-r--r--doc/APIchunk18.html6
-rw-r--r--doc/APIchunk2.html1
-rw-r--r--doc/APIchunk21.html1
-rw-r--r--doc/APIchunk22.html2
-rw-r--r--doc/APIchunk23.html1
-rw-r--r--doc/APIchunk24.html4
-rw-r--r--doc/APIchunk25.html1
-rw-r--r--doc/APIchunk26.html1
-rw-r--r--doc/APIchunk28.html1
-rw-r--r--doc/APIchunk4.html1
-rw-r--r--doc/APIchunk5.html1
-rw-r--r--doc/APIchunk7.html1
-rw-r--r--doc/APIconstructors.html1
-rw-r--r--doc/APIfiles.html4
-rw-r--r--doc/APIfunctions.html5
-rw-r--r--doc/APIsymbols.html4
-rw-r--r--doc/Makefile.am1
-rw-r--r--doc/Makefile.in55
-rwxr-xr-xdoc/apibuild.py3258
-rw-r--r--doc/devhelp/Makefile.in31
-rw-r--r--doc/devhelp/libxml2-dict.html2
-rw-r--r--doc/devhelp/libxml2-relaxng.html2
-rw-r--r--doc/devhelp/libxml2-tree.html3
-rw-r--r--doc/devhelp/libxml2-valid.html2
-rw-r--r--doc/devhelp/libxml2-xmlerror.html1
-rw-r--r--doc/devhelp/libxml2-xmlregexp.html6
-rw-r--r--doc/devhelp/libxml2-xmlversion.html5
-rw-r--r--doc/devhelp/libxml2-xpath.html10
-rw-r--r--doc/devhelp/libxml2.devhelp4
-rw-r--r--doc/examples/Makefile.in26
-rw-r--r--doc/html/libxml-dict.html2
-rw-r--r--doc/html/libxml-relaxng.html2
-rw-r--r--doc/html/libxml-tree.html3
-rw-r--r--doc/html/libxml-valid.html2
-rw-r--r--doc/html/libxml-xmlerror.html1
-rw-r--r--doc/html/libxml-xmlregexp.html6
-rw-r--r--doc/html/libxml-xmlversion.html3
-rw-r--r--doc/html/libxml-xpath.html10
-rw-r--r--doc/html/libxml-xzlib.html16
-rw-r--r--doc/libxml2-api.xml41
-rw-r--r--doc/symbols.xml4
-rw-r--r--doc/xml.html2
-rw-r--r--doc/xmllint.1611
-rw-r--r--doc/xmllint.xml14
-rw-r--r--elfgcchack.h174
-rw-r--r--enc.h2
-rw-r--r--encoding.c9
-rw-r--r--entities.c2
-rw-r--r--example/Makefile.in26
-rw-r--r--hash.c4
-rw-r--r--include/Makefile.in37
-rw-r--r--include/libxml/Makefile.in31
-rw-r--r--include/libxml/entities.h3
-rw-r--r--include/libxml/parser.h1
-rw-r--r--include/libxml/tree.h2
-rw-r--r--include/libxml/xmlerror.h1
-rw-r--r--include/libxml/xmlversion.h19
-rw-r--r--include/libxml/xmlversion.h.in9
-rw-r--r--include/libxml/xpath.h7
-rw-r--r--libxml.h4
-rw-r--r--libxml.spec.in57
-rw-r--r--libxml2.spec63
-rw-r--r--libxml2.syms8
-rw-r--r--nanohttp.c12
-rw-r--r--parser.c209
-rw-r--r--parserInternals.c6
-rw-r--r--python/Makefile.am4
-rw-r--r--python/Makefile.in61
-rwxr-xr-xpython/generator.py241
-rw-r--r--python/libxml.c318
-rw-r--r--python/libxml.py109
-rw-r--r--python/libxml2-export.c7
-rw-r--r--python/libxml2-py.c81
-rw-r--r--python/libxml2-py.h7
-rw-r--r--python/libxml2-python-api.xml9
-rw-r--r--python/libxml2.py176
-rw-r--r--python/libxml2class.py67
-rw-r--r--python/libxml2class.txt3
-rw-r--r--python/libxml_wrap.h30
-rwxr-xr-xpython/setup.py20
-rwxr-xr-xpython/setup.py.in18
-rw-r--r--python/tests/Makefile.am1
-rw-r--r--python/tests/Makefile.in32
-rwxr-xr-xpython/tests/attribs.py6
-rwxr-xr-xpython/tests/build.py18
-rwxr-xr-xpython/tests/compareNodes.py18
-rwxr-xr-xpython/tests/ctxterror.py12
-rwxr-xr-xpython/tests/cutnpaste.py6
-rwxr-xr-xpython/tests/dtdvalid.py6
-rwxr-xr-xpython/tests/error.py12
-rwxr-xr-xpython/tests/inbuf.py13
-rwxr-xr-xpython/tests/indexes.py20
-rwxr-xr-xpython/tests/input_callback.py148
-rwxr-xr-xpython/tests/nsdel.py6
-rwxr-xr-xpython/tests/outbuf.py49
-rwxr-xr-xpython/tests/push.py8
-rwxr-xr-xpython/tests/pushSAX.py8
-rwxr-xr-xpython/tests/pushSAXhtml.py8
-rwxr-xr-xpython/tests/reader.py185
-rwxr-xr-xpython/tests/reader2.py63
-rwxr-xr-xpython/tests/reader3.py63
-rwxr-xr-xpython/tests/reader4.py17
-rwxr-xr-xpython/tests/reader5.py15
-rwxr-xr-xpython/tests/reader6.py27
-rwxr-xr-xpython/tests/reader7.py17
-rwxr-xr-xpython/tests/reader8.py7
-rwxr-xr-x[-rw-r--r--]python/tests/readererr.py21
-rwxr-xr-xpython/tests/readernext.py39
-rwxr-xr-x[-rw-r--r--]python/tests/regexp.py14
-rwxr-xr-xpython/tests/relaxng.py6
-rwxr-xr-xpython/tests/resolver.py17
-rwxr-xr-xpython/tests/schema.py6
-rwxr-xr-xpython/tests/serialize.py36
-rwxr-xr-xpython/tests/sync.py32
-rwxr-xr-xpython/tests/thread2.py21
-rwxr-xr-xpython/tests/tst.py10
-rwxr-xr-xpython/tests/tstLastError.py20
-rwxr-xr-xpython/tests/tstURI.py18
-rwxr-xr-xpython/tests/tstmem.py6
-rwxr-xr-xpython/tests/tstxpath.py16
-rwxr-xr-xpython/tests/validDTD.py10
-rwxr-xr-xpython/tests/validRNG.py10
-rwxr-xr-xpython/tests/validSchemas.py10
-rwxr-xr-xpython/tests/validate.py20
-rwxr-xr-xpython/tests/walker.py23
-rwxr-xr-xpython/tests/xpath.py14
-rwxr-xr-xpython/tests/xpathext.py12
-rwxr-xr-x[-rw-r--r--]python/tests/xpathleak.py14
-rwxr-xr-xpython/tests/xpathns.py8
-rwxr-xr-xpython/tests/xpathret.py14
-rw-r--r--python/types.c280
-rw-r--r--relaxng.c2
-rw-r--r--runtest.c22
-rw-r--r--testapi.c101
-rw-r--r--testlimits.c8
-rw-r--r--threads.c8
-rw-r--r--timsort.h14
-rw-r--r--tree.c2
-rw-r--r--valid.c2
-rw-r--r--win32/Makefile.msvc15
-rw-r--r--win32/configure.js2
-rw-r--r--xmlIO.c22
-rw-r--r--xmllint.c18
-rw-r--r--xmlreader.c8
-rw-r--r--xmlregexp.c6
-rw-r--r--xmlsave.c4
-rw-r--r--xmlschemas.c22
-rw-r--r--xpath.c45
-rw-r--r--xstc/Makefile.in26
210 files changed, 6540 insertions, 3424 deletions
diff --git a/COPYING b/COPYING
index 417e955..d613185 100644
--- a/COPYING
+++ b/COPYING
@@ -2,7 +2,7 @@ Except where otherwise noted in the source code (e.g. the files hash.c,
list.c and the trio files, which are covered by a similar licence but
with different Copyright notices) all the files are:
- Copyright (C) 1998-2003 Daniel Veillard. All Rights Reserved.
+ Copyright (C) 1998-2012 Daniel Veillard. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -17,11 +17,7 @@ all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
-NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of Daniel Veillard shall not
-be used in advertising or otherwise to promote the sale, use or other deal-
-ings in this Software without prior written authorization from him.
-
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/Copyright b/Copyright
index 417e955..d613185 100644
--- a/Copyright
+++ b/Copyright
@@ -2,7 +2,7 @@ Except where otherwise noted in the source code (e.g. the files hash.c,
list.c and the trio files, which are covered by a similar licence but
with different Copyright notices) all the files are:
- Copyright (C) 1998-2003 Daniel Veillard. All Rights Reserved.
+ Copyright (C) 1998-2012 Daniel Veillard. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -17,11 +17,7 @@ all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
-NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of Daniel Veillard shall not
-be used in advertising or otherwise to promote the sale, use or other deal-
-ings in this Software without prior written authorization from him.
-
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/HTMLparser.c b/HTMLparser.c
index a533f37..dd0c1ea 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -3561,7 +3561,7 @@ htmlCheckEncodingDirect(htmlParserCtxtPtr ctxt, const xmlChar *encoding) {
*/
processed = ctxt->input->cur - ctxt->input->base;
xmlBufShrink(ctxt->input->buf->buffer, processed);
- nbchars = xmlCharEncInput(ctxt->input->buf);
+ nbchars = xmlCharEncInput(ctxt->input->buf, 1);
if (nbchars < 0) {
htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING,
"htmlCheckEncoding: encoder error\n",
@@ -6054,13 +6054,16 @@ htmlParseChunk(htmlParserCtxtPtr ctxt, const char *chunk, int size,
if ((in->encoder != NULL) && (in->buffer != NULL) &&
(in->raw != NULL)) {
int nbchars;
+ size_t base = xmlBufGetInputBase(in->buffer, ctxt->input);
+ size_t current = ctxt->input->cur - ctxt->input->base;
- nbchars = xmlCharEncInput(in);
+ nbchars = xmlCharEncInput(in, terminate);
if (nbchars < 0) {
htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING,
"encoder error\n", NULL, NULL);
return(XML_ERR_INVALID_ENCODING);
}
+ xmlBufSetInputBaseCur(in->buffer, ctxt->input, base, current);
}
}
}
diff --git a/Makefile.in b/Makefile.in
index 63d8228..bde07d3 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -19,6 +19,23 @@
VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -310,6 +327,11 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
man1dir = $(mandir)/man1
man3dir = $(mandir)/man3
NROFF = nroff
@@ -458,7 +480,6 @@ RANLIB = @RANLIB@
RDL_LIBS = @RDL_LIBS@
READER_TEST = @READER_TEST@
RELDATE = @RELDATE@
-RM = @RM@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
@@ -515,6 +536,7 @@ 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@
@@ -815,7 +837,6 @@ libxml-2.0-uninstalled.pc: $(top_builddir)/config.status $(srcdir)/libxml-2.0-un
cd $(top_builddir) && $(SHELL) ./config.status $@
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
@@ -823,6 +844,8 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES)
else :; fi; \
done; \
test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
@@ -859,8 +882,11 @@ testdso.la: $(testdso_la_OBJECTS) $(testdso_la_DEPENDENCIES) $(EXTRA_testdso_la_
$(AM_V_CCLD)$(testdso_la_LINK) $(testdso_la_OBJECTS) $(testdso_la_LIBADD) $(LIBS)
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
- test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
while read p p1; do if test -f $$p || test -f $$p1; \
@@ -977,8 +1003,11 @@ xmllint$(EXEEXT): $(xmllint_OBJECTS) $(xmllint_DEPENDENCIES) $(EXTRA_xmllint_DEP
$(AM_V_CCLD)$(xmllint_LINK) $(xmllint_OBJECTS) $(xmllint_LDADD) $(LIBS)
install-binSCRIPTS: $(bin_SCRIPTS)
@$(NORMAL_INSTALL)
- test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
@list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
@@ -1117,11 +1146,18 @@ distclean-libtool:
-rm -f libtool config.lt
install-man1: $(man_MANS)
@$(NORMAL_INSTALL)
- test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
- @list=''; test -n "$(man1dir)" || exit 0; \
- { for i in $$list; do echo "$$i"; done; \
- l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
- sed -n '/\.1[a-z]*$$/p'; \
+ @list1=''; \
+ list2='$(man_MANS)'; \
+ test -n "$(man1dir)" \
+ && test -n "`echo $$list1$$list2`" \
+ || exit 0; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
+ { for i in $$list1; do echo "$$i"; done; \
+ if test -n "$$list2"; then \
+ for i in $$list2; do echo "$$i"; done \
+ | sed -n '/\.1[a-z]*$$/p'; \
+ fi; \
} | while read p; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; echo "$$p"; \
@@ -1153,11 +1189,18 @@ uninstall-man1:
dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
install-man3: $(man_MANS)
@$(NORMAL_INSTALL)
- test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)"
- @list=''; test -n "$(man3dir)" || exit 0; \
- { for i in $$list; do echo "$$i"; done; \
- l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
- sed -n '/\.3[a-z]*$$/p'; \
+ @list1=''; \
+ list2='$(man_MANS)'; \
+ test -n "$(man3dir)" \
+ && test -n "`echo $$list1$$list2`" \
+ || exit 0; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(man3dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(man3dir)" || exit 1; \
+ { for i in $$list1; do echo "$$i"; done; \
+ if test -n "$$list2"; then \
+ for i in $$list2; do echo "$$i"; done \
+ | sed -n '/\.3[a-z]*$$/p'; \
+ fi; \
} | while read p; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; echo "$$p"; \
@@ -1189,8 +1232,11 @@ uninstall-man3:
dir='$(DESTDIR)$(man3dir)'; $(am__uninstall_files_from_dir)
install-confexecDATA: $(confexec_DATA)
@$(NORMAL_INSTALL)
- test -z "$(confexecdir)" || $(MKDIR_P) "$(DESTDIR)$(confexecdir)"
@list='$(confexec_DATA)'; test -n "$(confexecdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(confexecdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(confexecdir)" || exit 1; \
+ fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
@@ -1207,8 +1253,11 @@ uninstall-confexecDATA:
dir='$(DESTDIR)$(confexecdir)'; $(am__uninstall_files_from_dir)
install-m4dataDATA: $(m4data_DATA)
@$(NORMAL_INSTALL)
- test -z "$(m4datadir)" || $(MKDIR_P) "$(DESTDIR)$(m4datadir)"
@list='$(m4data_DATA)'; test -n "$(m4datadir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(m4datadir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(m4datadir)" || exit 1; \
+ fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
@@ -1225,8 +1274,11 @@ uninstall-m4dataDATA:
dir='$(DESTDIR)$(m4datadir)'; $(am__uninstall_files_from_dir)
install-pkgconfigDATA: $(pkgconfig_DATA)
@$(NORMAL_INSTALL)
- test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \
+ fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
@@ -1424,13 +1476,10 @@ distdir: $(DISTFILES)
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
- test -d "$(distdir)/$$subdir" \
- || $(MKDIR_P) "$(distdir)/$$subdir" \
- || exit 1; \
- fi; \
- done
- @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
+ $(am__make_dryrun) \
+ || test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
diff --git a/SAX2.c b/SAX2.c
index a24abc8..4adf202 100644
--- a/SAX2.c
+++ b/SAX2.c
@@ -411,6 +411,7 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
xmlParserInputPtr input = NULL;
xmlCharEncoding enc;
int oldcharset;
+ const xmlChar *oldencoding;
/*
* Ask the Entity resolver to load the damn thing
@@ -432,6 +433,8 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
oldinputMax = ctxt->inputMax;
oldinputTab = ctxt->inputTab;
oldcharset = ctxt->charset;
+ oldencoding = ctxt->encoding;
+ ctxt->encoding = NULL;
ctxt->inputTab = (xmlParserInputPtr *)
xmlMalloc(5 * sizeof(xmlParserInputPtr));
@@ -442,6 +445,7 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
ctxt->inputMax = oldinputMax;
ctxt->inputTab = oldinputTab;
ctxt->charset = oldcharset;
+ ctxt->encoding = oldencoding;
return;
}
ctxt->inputNr = 0;
@@ -487,6 +491,11 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
ctxt->inputMax = oldinputMax;
ctxt->inputTab = oldinputTab;
ctxt->charset = oldcharset;
+ if ((ctxt->encoding != NULL) &&
+ ((ctxt->dict == NULL) ||
+ (!xmlDictOwns(ctxt->dict, ctxt->encoding))))
+ xmlFree((xmlChar *) ctxt->encoding);
+ ctxt->encoding = oldencoding;
/* ctxt->wellFormed = oldwellFormed; */
}
}
@@ -591,6 +600,7 @@ xmlSAX2GetEntity(void *ctx, const xmlChar *name)
* parse the external entity
*/
xmlNodePtr children;
+ unsigned long oldnbent = ctxt->nbentities;
val = xmlParseCtxtExternalEntity(ctxt, ret->URI,
ret->ExternalID, &children);
@@ -603,8 +613,11 @@ xmlSAX2GetEntity(void *ctx, const xmlChar *name)
return(NULL);
}
ret->owner = 1;
- if (ret->checked == 0)
- ret->checked = 1;
+ if (ret->checked == 0) {
+ ret->checked = (ctxt->nbentities - oldnbent + 1) * 2;
+ if ((ret->content != NULL) && (xmlStrchr(ret->content, '<')))
+ ret->checked |= 1;
+ }
}
return(ret);
}
@@ -2202,7 +2215,7 @@ xmlSAX2StartElementNs(void *ctx,
(ctxt->myDoc->intSubset->elements == NULL) &&
(ctxt->myDoc->intSubset->attributes == NULL) &&
(ctxt->myDoc->intSubset->entities == NULL)))) {
- xmlErrValid(ctxt, XML_ERR_NO_DTD,
+ xmlErrValid(ctxt, XML_DTD_NO_DTD,
"Validation failed: no DTD found !", NULL, NULL);
ctxt->validate = 0;
}
diff --git a/aclocal.m4 b/aclocal.m4
index 78c9ca9..cb558d2 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,4 +1,4 @@
-# generated automatically by aclocal 1.11.3 -*- Autoconf -*-
+# generated automatically by aclocal 1.11.6 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
@@ -14,8 +14,8 @@
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
-[m4_warning([this file was generated for autoconf 2.68.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
+[m4_warning([this file was generated for autoconf 2.69.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])])
@@ -38,7 +38,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.11'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
-m4_if([$1], [1.11.3], [],
+m4_if([$1], [1.11.6], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@@ -54,7 +54,7 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11.3])dnl
+[AM_AUTOMAKE_VERSION([1.11.6])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
diff --git a/buf.c b/buf.c
index fa0c3f6..d1756c4 100644
--- a/buf.c
+++ b/buf.c
@@ -1299,3 +1299,6 @@ xmlBufSetInputBaseCur(xmlBufPtr buf, xmlParserInputPtr input,
input->end = &buf->content[buf->use];
return(0);
}
+
+#define bottom_buf
+#include "elfgcchack.h"
diff --git a/catalog.c b/catalog.c
index 61cce03..8e34cd2 100644
--- a/catalog.c
+++ b/catalog.c
@@ -84,10 +84,12 @@ static char XML_XML_DEFAULT_CATALOG[256] = "file:///etc/xml/catalog";
#define GetModuleHandleA GetModuleHandle
#define GetModuleFileNameA GetModuleFileName
#else
+#if !defined(_WINDOWS_)
void* __stdcall GetModuleHandleA(const char*);
unsigned long __stdcall GetModuleFileNameA(void*, char*, unsigned long);
#endif
#endif
+#endif
static xmlChar *xmlCatalogNormalizePublic(const xmlChar *pubID);
static int xmlExpandCatalog(xmlCatalogPtr catal, const char *filename);
@@ -989,7 +991,7 @@ xmlLoadFileContent(const char *filename)
return (NULL);
}
#endif
- content = xmlMallocAtomic(size + 10);
+ content = (xmlChar*)xmlMallocAtomic(size + 10);
if (content == NULL) {
xmlCatalogErrMemory("allocating catalog data");
return (NULL);
@@ -1547,7 +1549,7 @@ xmlAddXMLCatalog(xmlCatalogEntryPtr catal, const xmlChar *type,
NULL, catal->prefer, NULL);
if (doregister) {
catal->type = XML_CATA_CATALOG;
- cur = xmlHashLookup(xmlCatalogXMLFiles, catal->URL);
+ cur = (xmlCatalogEntryPtr)xmlHashLookup(xmlCatalogXMLFiles, catal->URL);
if (cur != NULL)
cur->children = catal->children;
}
@@ -3129,7 +3131,7 @@ xmlInitializeCatalog(void) {
if (p != buf) {
xmlChar* uri;
strncpy(p, "\\..\\etc\\catalog", 255 - (p - buf));
- uri = xmlCanonicPath(buf);
+ uri = xmlCanonicPath((const xmlChar*)buf);
if (uri != NULL) {
strncpy(XML_XML_DEFAULT_CATALOG, uri, 255);
xmlFree(uri);
@@ -3244,7 +3246,7 @@ xmlLoadCatalogs(const char *pathss) {
cur++;
path = xmlStrndup((const xmlChar *)paths, cur - paths);
#ifdef _WIN32
- iLen = strlen(path);
+ iLen = strlen((const char*)path);
for(i = 0; i < iLen; i++) {
if(path[i] == '\\') {
path[i] = '/';
diff --git a/config.guess b/config.guess
index 49ba16f..d622a44 100755
--- a/config.guess
+++ b/config.guess
@@ -4,7 +4,7 @@
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012 Free Software Foundation, Inc.
-timestamp='2012-01-01'
+timestamp='2012-02-10'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -17,9 +17,7 @@ timestamp='2012-01-01'
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -863,6 +861,13 @@ EOF
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
+ aarch64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ aarch64_be:Linux:*:*)
+ UNAME_MACHINE=aarch64_be
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
@@ -1320,6 +1325,9 @@ EOF
i*86:AROS:*:*)
echo ${UNAME_MACHINE}-pc-aros
exit ;;
+ x86_64:VMkernel:*:*)
+ echo ${UNAME_MACHINE}-unknown-esx
+ exit ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
diff --git a/config.sub b/config.sub
index d6b6b3c..c894da4 100755
--- a/config.sub
+++ b/config.sub
@@ -4,7 +4,7 @@
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012 Free Software Foundation, Inc.
-timestamp='2012-01-01'
+timestamp='2012-02-10'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -21,9 +21,7 @@ timestamp='2012-01-01'
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -132,6 +130,10 @@ case $maybe_os in
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
+ android-linux)
+ os=-linux-android
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+ ;;
*)
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
@@ -247,6 +249,7 @@ case $basic_machine in
# Some are omitted here because they have special meanings below.
1750a | 580 \
| a29k \
+ | aarch64 | aarch64_be \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
@@ -319,7 +322,7 @@ case $basic_machine in
c6x)
basic_machine=tic6x-unknown
;;
- m6811 | m68hc11 | m6812 | m68hc12 | picochip)
+ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
basic_machine=$basic_machine-unknown
os=-none
;;
@@ -332,7 +335,10 @@ case $basic_machine in
strongarm | thumb | xscale)
basic_machine=arm-unknown
;;
-
+ xgate)
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
xscaleeb)
basic_machine=armeb-unknown
;;
@@ -355,6 +361,7 @@ case $basic_machine in
# Recognize the basic CPU types with company name.
580-* \
| a29k-* \
+ | aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
diff --git a/configure b/configure
index dab3f3a..80dd0fc 100755
--- a/configure
+++ b/configure
@@ -1,11 +1,9 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68.
+# Generated by GNU Autoconf 2.69.
#
#
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
#
#
# This configure script is free software; the Free Software Foundation
@@ -134,6 +132,31 @@ export LANGUAGE
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+# Use a proper internal environment variable to ensure we don't fall
+ # into an infinite loop, continuously re-executing ourselves.
+ if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+ _as_can_reexec=no; export _as_can_reexec;
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+ fi
+ # We don't want this to propagate to other subprocesses.
+ { _as_can_reexec=; unset _as_can_reexec;}
if test "x$CONFIG_SHELL" = x; then
as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
@@ -167,7 +190,8 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
else
exitcode=1; echo positional parameters were not saved.
fi
-test x\$exitcode = x0 || exit 1"
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
@@ -220,21 +244,25 @@ IFS=$as_save_IFS
if test "x$CONFIG_SHELL" != x; then :
- # We cannot yet assume a decent shell, so we have to provide a
- # neutralization value for shells without unset; and this also
- # works around shells that cannot unset nonexistent variables.
- # Preserve -v and -x to the replacement shell.
- BASH_ENV=/dev/null
- ENV=/dev/null
- (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
- export CONFIG_SHELL
- case $- in # ((((
- *v*x* | *x*v* ) as_opts=-vx ;;
- *v* ) as_opts=-v ;;
- *x* ) as_opts=-x ;;
- * ) as_opts= ;;
- esac
- exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
+ export CONFIG_SHELL
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
fi
if test x$as_have_required = xno; then :
@@ -336,6 +364,14 @@ $as_echo X"$as_dir" |
} # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
@@ -457,6 +493,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
chmod +x "$as_me.lineno" ||
{ $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+ # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+ # already done that, so ensure we don't try to do so again and fall
+ # in an infinite loop. This has already happened in practice.
+ _as_can_reexec=no; export _as_can_reexec
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensitive to this).
@@ -491,16 +531,16 @@ if (echo >conf$$.file) 2>/dev/null; then
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -p'.
+ # In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
@@ -512,28 +552,8 @@ else
as_mkdir_p=false
fi
-if test -x / >/dev/null 2>&1; then
- as_test_x='test -x'
-else
- if ls -dL / >/dev/null 2>&1; then
- as_ls_L_option=L
- else
- as_ls_L_option=
- fi
- as_test_x='
- eval sh -c '\''
- if test -d "$1"; then
- test -d "$1/.";
- else
- case $1 in #(
- -*)set "./$1";;
- esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
- ???[sx]*):;;*)false;;esac;fi
- '\'' sh
- '
-fi
-as_executable_p=$as_test_x
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -692,6 +712,7 @@ WITH_FTP
WITH_TREE
THREADS_W32_FALSE
THREADS_W32_TRUE
+WITH_THREAD_ALLOC
TEST_THREADS
THREAD_CFLAGS
WITH_THREADS
@@ -749,7 +770,6 @@ WGET
PERL
TAR
MV
-RM
CPP
LN_S
am__fastdepCC_FALSE
@@ -1368,8 +1388,6 @@ target=$target_alias
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
- $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
- If a cross compiler is detected then cross compile mode will be used" >&2
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
@@ -1671,9 +1689,9 @@ test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
configure
-generated by GNU Autoconf 2.68
+generated by GNU Autoconf 2.69
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
@@ -1786,7 +1804,7 @@ $as_echo "$ac_try_echo"; } >&5
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
+ test -x conftest$ac_exeext
}; then :
ac_retval=0
else
@@ -2056,7 +2074,8 @@ int
main ()
{
static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
;
return 0;
@@ -2089,7 +2108,7 @@ This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by $as_me, which was
-generated by GNU Autoconf 2.68. Invocation command line was
+generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2543,7 +2562,7 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
LIBXML_MAJOR_VERSION=2
LIBXML_MINOR_VERSION=9
-LIBXML_MICRO_VERSION=0
+LIBXML_MICRO_VERSION=1
LIBXML_MICRO_VERSION_SUFFIX=
LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
@@ -2623,7 +2642,7 @@ case $as_dir/ in #((
# by default.
for ac_prog in ginstall scoinst install; do
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
if test $ac_prog = install &&
grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
@@ -2792,7 +2811,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_STRIP="${ac_tool_prefix}strip"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2832,7 +2851,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_STRIP="strip"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2883,7 +2902,7 @@ do
test -z "$as_dir" && as_dir=.
for ac_prog in mkdir gmkdir; do
for ac_exec_ext in '' $ac_executable_extensions; do
- { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+ as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
'mkdir (GNU coreutils) '* | \
'mkdir (coreutils) '* | \
@@ -2936,7 +2955,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_AWK="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3128,7 +3147,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3168,7 +3187,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3221,7 +3240,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3262,7 +3281,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
@@ -3320,7 +3339,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3364,7 +3383,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3810,8 +3829,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdarg.h>
#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -4237,47 +4255,6 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-# Extract the first word of "rm", so it can be a program name with args.
-set dummy rm; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_RM+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case $RM in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_RM="$RM" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_path_RM="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- test -z "$ac_cv_path_RM" && ac_cv_path_RM="/bin/rm"
- ;;
-esac
-fi
-RM=$ac_cv_path_RM
-if test -n "$RM"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RM" >&5
-$as_echo "$RM" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
# Extract the first word of "mv", so it can be a program name with args.
set dummy mv; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -4296,7 +4273,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_MV="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -4337,7 +4314,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_TAR="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -4378,7 +4355,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -4419,7 +4396,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_WGET="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -4460,7 +4437,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_XMLLINT="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -4501,7 +4478,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_XSLTPROC="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -4641,7 +4618,7 @@ do
for ac_prog in sed gsed; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+ as_fn_executable_p "$ac_path_SED" || continue
# Check for GNU ac_path_SED and select it if it is found.
# Check for GNU $ac_path_SED
case `"$ac_path_SED" --version 2>&1` in
@@ -4717,7 +4694,7 @@ do
for ac_prog in grep ggrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+ as_fn_executable_p "$ac_path_GREP" || continue
# Check for GNU ac_path_GREP and select it if it is found.
# Check for GNU $ac_path_GREP
case `"$ac_path_GREP" --version 2>&1` in
@@ -4783,7 +4760,7 @@ do
for ac_prog in egrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+ as_fn_executable_p "$ac_path_EGREP" || continue
# Check for GNU ac_path_EGREP and select it if it is found.
# Check for GNU $ac_path_EGREP
case `"$ac_path_EGREP" --version 2>&1` in
@@ -4850,7 +4827,7 @@ do
for ac_prog in fgrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
+ as_fn_executable_p "$ac_path_FGREP" || continue
# Check for GNU ac_path_FGREP and select it if it is found.
# Check for GNU $ac_path_FGREP
case `"$ac_path_FGREP" --version 2>&1` in
@@ -5106,7 +5083,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5150,7 +5127,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5563,7 +5540,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5603,7 +5580,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_OBJDUMP="objdump"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5909,7 +5886,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5949,7 +5926,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_DLLTOOL="dlltool"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -6053,7 +6030,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -6097,7 +6074,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_AR="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -6222,7 +6199,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_STRIP="${ac_tool_prefix}strip"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -6262,7 +6239,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_STRIP="strip"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -6321,7 +6298,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -6361,7 +6338,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_RANLIB="ranlib"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -7010,7 +6987,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -7050,7 +7027,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -7130,7 +7107,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -7170,7 +7147,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -7222,7 +7199,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -7262,7 +7239,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_NMEDIT="nmedit"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -7314,7 +7291,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -7354,7 +7331,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_LIPO="lipo"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -7406,7 +7383,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -7446,7 +7423,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_OTOOL="otool"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -7498,7 +7475,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -7538,7 +7515,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_OTOOL64="otool64"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -13605,7 +13582,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for type of socket length (socklen_t)" >&5
$as_echo_n "checking for type of socket length (socklen_t)... " >&6; }
cat > conftest.$ac_ext <<EOF
-#line 13608 "configure"
+#line 13585 "configure"
#include "confdefs.h"
#include <stddef.h>
@@ -13616,7 +13593,7 @@ int main(void) {
(void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)
; return 0; }
EOF
-if { (eval echo configure:13619: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then
+if { (eval echo configure:13596: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then
rm -rf conftest*
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: socklen_t *" >&5
@@ -13628,7 +13605,7 @@ else
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 13631 "configure"
+#line 13608 "configure"
#include "confdefs.h"
#include <stddef.h>
@@ -13639,7 +13616,7 @@ int main(void) {
(void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)
; return 0; }
EOF
-if { (eval echo configure:13642: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then
+if { (eval echo configure:13619: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then
rm -rf conftest*
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: size_t *" >&5
@@ -13651,7 +13628,7 @@ else
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 13654 "configure"
+#line 13631 "configure"
#include "confdefs.h"
#include <stddef.h>
@@ -13662,7 +13639,7 @@ int main(void) {
(void)getsockopt (1, 1, 1, NULL, (int *)NULL)
; return 0; }
EOF
-if { (eval echo configure:13665: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then
+if { (eval echo configure:13642: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then
rm -rf conftest*
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: int *" >&5
@@ -14058,7 +14035,7 @@ if test "$with_python" != "no" ; then
if test -x "$PYTHON"
then
echo Found python in environment PYTHON=$PYTHON
- with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
+ with_python=`$PYTHON -c "import sys; print(sys.exec_prefix)"`
else
# Extract the first word of "python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5", so it can be a program name with args.
set dummy python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5; ac_word=$2
@@ -14078,7 +14055,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -14106,50 +14083,53 @@ fi
fi
if test "$PYTHON" != ""
then
- PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[0:3]"`
+ PYTHON_VERSION=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_version())"`
+ PYTHON_INCLUDES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_inc())"`
+# does not work as it produce a /usr/lib/python path instead of/usr/lib64/python
+#
+# PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_lib())"`
echo Found Python version $PYTHON_VERSION
fi
- if test "$PYTHON_VERSION" != ""
+ if test "$PYTHON_VERSION" != "" -a "$PYTHON_INCLUDES" = ""
then
- if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
- -d $with_python/lib/python$PYTHON_VERSION/site-packages
+ if test -r $with_python/include/python$PYTHON_VERSION/Python.h
then
PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
- PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
else
if test -r $prefix/include/python$PYTHON_VERSION/Python.h
then
PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
- PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
else
if test -r /usr/include/python$PYTHON_VERSION/Python.h
then
PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
- PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
else
- if test -r $with_python/include/Python.h -a \
- -d $with_python/lib/site-packages
+ if test -r $with_python/include/Python.h
then
PYTHON_INCLUDES=$with_python/include
- PYTHON_SITE_PACKAGES=$with_python/lib/site-packages
else
echo could not find python$PYTHON_VERSION/Python.h or $with_python/include/Python.h
fi
fi
fi
- if test ! -d "$PYTHON_SITE_PACKAGES"
- then
- PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
- fi
fi
- PYTHON_LIBS=`python$PYTHON_VERSION-config --ldflags`
fi
- if test "$with_python" != ""
+ if test "$PYTHON_VERSION" != "" -a "$PYTHON_SITE_PACKAGES" = ""
then
- pythondir='$(PYTHON_SITE_PACKAGES)'
- else
- pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+ if test -d $libdir/python$PYTHON_VERSION/site-packages
+ then
+ PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
+ else
+ if test -d $with_python/lib/site-packages
+ then
+ PYTHON_SITE_PACKAGES=$with_python/lib/site-packages
+ else
+ PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_lib())"`
+ fi
+ fi
fi
+ pythondir='$(PYTHON_SITE_PACKAGES)'
+ PYTHON_LIBS=`python$PYTHON_VERSION-config --ldflags`
else
PYTHON=
fi
@@ -14417,6 +14397,7 @@ WITH_THREADS=0
THREAD_CFLAGS=""
TEST_THREADS=""
THREADS_W32=""
+WITH_THREAD_ALLOC=0
if test "$with_threads" = "no" ; then
echo Disabling multithreaded support
@@ -14525,7 +14506,7 @@ fi
fi
fi
if test "$with_thread_alloc" = "yes" -a "$WITH_THREADS" = "1" ; then
- THREAD_CFLAGS="$THREAD_CFLAGS -DLIBXML_THREAD_ALLOC_ENABLED"
+ WITH_THREAD_ALLOC=1
fi
@@ -14533,6 +14514,7 @@ fi
+
if test -n "$THREADS_W32"; then
THREADS_W32_TRUE=
THREADS_W32_FALSE='#'
@@ -15730,16 +15712,16 @@ if (echo >conf$$.file) 2>/dev/null; then
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -p'.
+ # In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
@@ -15799,28 +15781,16 @@ else
as_mkdir_p=false
fi
-if test -x / >/dev/null 2>&1; then
- as_test_x='test -x'
-else
- if ls -dL / >/dev/null 2>&1; then
- as_ls_L_option=L
- else
- as_ls_L_option=
- fi
- as_test_x='
- eval sh -c '\''
- if test -d "$1"; then
- test -d "$1/.";
- else
- case $1 in #(
- -*)set "./$1";;
- esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
- ???[sx]*):;;*)false;;esac;fi
- '\'' sh
- '
-fi
-as_executable_p=$as_test_x
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -15842,7 +15812,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# values after options handling.
ac_log="
This file was extended by $as_me, which was
-generated by GNU Autoconf 2.68. Invocation command line was
+generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -15908,10 +15878,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
config.status
-configured by $0, generated by GNU Autoconf 2.68,
+configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
@@ -16002,7 +15972,7 @@ fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
if \$ac_cs_recheck; then
- set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
shift
\$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
CONFIG_SHELL='$SHELL'
diff --git a/configure.in b/configure.in
index 3d5f48b..d449b11 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
-AC_PREREQ([2.68])
+AC_PREREQ([2.63])
AC_INIT
AC_CONFIG_SRCDIR([entities.c])
AC_CONFIG_HEADERS([config.h])
@@ -8,7 +8,7 @@ AC_CANONICAL_HOST
LIBXML_MAJOR_VERSION=2
LIBXML_MINOR_VERSION=9
-LIBXML_MICRO_VERSION=0
+LIBXML_MICRO_VERSION=1
LIBXML_MICRO_VERSION_SUFFIX=
LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
@@ -62,7 +62,6 @@ AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MKDIR_P
AC_PROG_CPP
-AC_PATH_PROG(RM, rm, /bin/rm)
AC_PATH_PROG(MV, mv, /bin/mv)
AC_PATH_PROG(TAR, tar, /bin/tar)
AC_PATH_PROG(PERL, perl, /usr/bin/perl)
@@ -767,7 +766,7 @@ if test "$with_python" != "no" ; then
if test -x "$PYTHON"
then
echo Found python in environment PYTHON=$PYTHON
- with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
+ with_python=`$PYTHON -c "import sys; print(sys.exec_prefix)"`
else
AC_PATH_PROG(PYTHON, python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
fi
@@ -776,50 +775,53 @@ if test "$with_python" != "no" ; then
fi
if test "$PYTHON" != ""
then
- PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
+ PYTHON_VERSION=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_version())"`
+ PYTHON_INCLUDES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_inc())"`
+# does not work as it produce a /usr/lib/python path instead of/usr/lib64/python
+#
+# PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_lib())"`
echo Found Python version $PYTHON_VERSION
fi
- if test "$PYTHON_VERSION" != ""
+ if test "$PYTHON_VERSION" != "" -a "$PYTHON_INCLUDES" = ""
then
- if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
- -d $with_python/lib/python$PYTHON_VERSION/site-packages
+ if test -r $with_python/include/python$PYTHON_VERSION/Python.h
then
PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
- PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
else
if test -r $prefix/include/python$PYTHON_VERSION/Python.h
then
PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
- PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
else
if test -r /usr/include/python$PYTHON_VERSION/Python.h
then
PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
- PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
else
- if test -r $with_python/include/Python.h -a \
- -d $with_python/lib/site-packages
+ if test -r $with_python/include/Python.h
then
PYTHON_INCLUDES=$with_python/include
- PYTHON_SITE_PACKAGES=$with_python/lib/site-packages
else
echo could not find python$PYTHON_VERSION/Python.h or $with_python/include/Python.h
fi
fi
fi
- if test ! -d "$PYTHON_SITE_PACKAGES"
- then
- PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
- fi
fi
- PYTHON_LIBS=`python$PYTHON_VERSION-config --ldflags`
fi
- if test "$with_python" != ""
+ if test "$PYTHON_VERSION" != "" -a "$PYTHON_SITE_PACKAGES" = ""
then
- pythondir='$(PYTHON_SITE_PACKAGES)'
- else
- pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+ if test -d $libdir/python$PYTHON_VERSION/site-packages
+ then
+ PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
+ else
+ if test -d $with_python/lib/site-packages
+ then
+ PYTHON_SITE_PACKAGES=$with_python/lib/site-packages
+ else
+ PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_lib())"`
+ fi
+ fi
fi
+ pythondir='$(PYTHON_SITE_PACKAGES)'
+ PYTHON_LIBS=`python$PYTHON_VERSION-config --ldflags`
else
PYTHON=
fi
@@ -954,6 +956,7 @@ WITH_THREADS=0
THREAD_CFLAGS=""
TEST_THREADS=""
THREADS_W32=""
+WITH_THREAD_ALLOC=0
if test "$with_threads" = "no" ; then
echo Disabling multithreaded support
@@ -1017,7 +1020,7 @@ else
fi
fi
if test "$with_thread_alloc" = "yes" -a "$WITH_THREADS" = "1" ; then
- THREAD_CFLAGS="$THREAD_CFLAGS -DLIBXML_THREAD_ALLOC_ENABLED"
+ WITH_THREAD_ALLOC=1
fi
AC_SUBST(THREAD_LIBS)
@@ -1025,6 +1028,7 @@ AC_SUBST(BASE_THREAD_LIBS)
AC_SUBST(WITH_THREADS)
AC_SUBST(THREAD_CFLAGS)
AC_SUBST(TEST_THREADS)
+AC_SUBST(WITH_THREAD_ALLOC)
AM_CONDITIONAL([THREADS_W32],[test -n "$THREADS_W32"])
dnl
diff --git a/debian/changelog b/debian/changelog
index 3f78359..0f5cfa2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,67 @@
+libxml2 (2.9.1+dfsg1-4) unstable; urgency=low
+
+ [ Christian Svensson ]
+ * Do not build-depend on readline (Closes: #742350)
+
+ [ Daniel Schepler ]
+ * Patch to bootstrap without python (Closes: #738080)
+
+ [ Helmut Grohne ]
+ * Drop unneeded B-D on perl and binutils (Closes: #753005)
+
+ [ Adam Conrad ]
+ * Actually run dh_autoreconf, which the old/new mixed rules file misses.
+
+ [ Matthias Klose ]
+ * Add patch to fix python multiarch issue
+ * Allow the package to cross-build by tweaking B-Ds on python
+ * Set PYTHON_LIBS for cross builds
+
+ [ Aron Xu ]
+ * Use correct $CC
+ * Configure udeb without python
+ * New round of cherry-picking upstream fixes
+ - Includes fixes for CVE-2014-0191 (Closes: #747309).
+ * Call prename with -vf
+ * Require python-all-dev (>= 2.7.5-5~)
+ * Bump std-ver: 3.9.4 -> 3.9.5, no change
+
+ -- Aron Xu <aron@debian.org> Wed, 09 Jul 2014 05:40:15 +0800
+
+libxml2 (2.9.1+dfsg1-3) unstable; urgency=low
+
+ * debian/patches/0007-Fix-XPath-optimization-with-predicates.patch:
+ - Upstream patch to fix XPath evaluation issue. (Closes: #713146)
+
+ -- Aron Xu <aron@debian.org> Mon, 05 Aug 2013 11:02:43 +0800
+
+libxml2 (2.9.1+dfsg1-2) unstable; urgency=low
+
+ * Upload to unstable.
+ * debian/patches/000[2-6]-*.patch:
+ - cherry-picking upstream post-release fixes.
+
+ -- Aron Xu <aron@debian.org> Mon, 17 Jun 2013 23:24:07 +0800
+
+libxml2 (2.9.1+dfsg1-1) experimental; urgency=low
+
+ * New upstream release (Closes: #696300, #705722).
+ * Add -llzma for static linking (Closes: #697382).
+ * Update symbols.
+ * Update debian/watch, thanks to Bart Martens.
+ * Use canonical Vcs-* fields.
+ * Mark python-libxml2-dbg as "Multi-Arch: same".
+
+ -- Aron Xu <aron@debian.org> Sun, 09 Jun 2013 00:34:16 +0800
+
+libxml2 (2.9.0+dfsg1-4) experimental; urgency=low
+
+ [ Daniel Veillard ]
+ * Fix potential out of bound access
+ CVE-2012-5134, Closes: #694521.
+
+ -- Aron Xu <aron@debian.org> Wed, 28 Nov 2012 22:34:15 +0800
+
libxml2 (2.9.0+dfsg1-3+dyson5) unstable; urgency=low
* Rebuilt. For unknown reasons python module was not linked to libxml
diff --git a/debian/control b/debian/control
index 5bc5b15..8f0fb90 100644
--- a/debian/control
+++ b/debian/control
@@ -3,14 +3,14 @@ Priority: optional
Section: libs
Maintainer: Debian XML/SGML Group <debian-xml-sgml-pkgs@lists.alioth.debian.org>
Uploaders: Aron Xu <aron@debian.org>, YunQiang Su <wzssyqa@gmail.com>
-Standards-Version: 3.9.4
-Build-Depends: debhelper (>= 9), perl, dh-autoreconf, autotools-dev,
- binutils (>= 2.14.90.0.7), python-all-dev (>= 2.6.6-3~), python-all-dbg,
- gcc-multilib, lib32z1-dev [illumos-any],
- zlib1g-dev | libz-dev, liblzma-dev, libreadline-dev | libreadline6-dev
+Standards-Version: 3.9.5
+Build-Depends: debhelper (>= 9), dh-autoreconf, autotools-dev,
+ libpython-all-dev, libpython-all-dbg,
+ python-all-dev:any (>= 2.7.5-5~), python-all-dbg:any,
+ zlib1g-dev | libz-dev, liblzma-dev
Homepage: http://xmlsoft.org/
-Vcs-Git: git://git.debian.org/debian-xml-sgml/libxml2.git
-Vcs-Browser: http://git.debian.org/?p=debian-xml-sgml/libxml2.git
+Vcs-Git: git://anonscm.debian.org/debian-xml-sgml/libxml2.git
+Vcs-Browser: http://anonscm.debian.org/gitweb/?p=debian-xml-sgml/libxml2.git
XS-Testsuite: autopkgtest
Package: lib32xml2
diff --git a/debian/libxml2.symbols b/debian/libxml2.symbols
index b8473f2..374ef1d 100644
--- a/debian/libxml2.symbols
+++ b/debian/libxml2.symbols
@@ -39,6 +39,7 @@ libxml2.so.2 libxml2 #MINVER#
(symver|optional)LIBXML2_2.7.4 2.7.4
(symver|optional)LIBXML2_2.8.0 2.8.0
(symver|optional)LIBXML2_2.9.0 2.9.0
+ (symver|optional)LIBXML2_2.9.1 2.9.1
__docbDefaultSAXHandler@Base 2.6.27
__htmlDefaultSAXHandler@Base 2.6.27
__htmlParseContent@Base 2.6.27
@@ -62,6 +63,7 @@ libxml2.so.2 libxml2 #MINVER#
__xmlGlobalInitMutexUnlock@Base 2.6.28
__xmlIOErr@Base 2.6.27
__xmlIndentTreeOutput@Base 2.6.27
+ __xmlInitializeDict@Base 2.9.1
__xmlKeepBlanksDefaultValue@Base 2.6.27
__xmlLastError@Base 2.6.27
__xmlLineNumbersDefaultValue@Base 2.6.27
@@ -143,6 +145,7 @@ libxml2.so.2 libxml2 #MINVER#
xmlGenericErrorDefaultFunc@Base 2.6.27
xmlInitializeDict@LIBXML2_2.8.0 2.8.0
xmlMallocBreakpoint@Base 2.6.27
+ xmlNop@Base 2.9.1
xmlNsListDumpOutput@Base 2.6.27
xmlOutputBufferCreateFilenameDefault@LIBXML2_2.6.11 2.8.0
xmlOutputBufferCreateFilenameValue@LIBXML2_2.6.11 2.8.0
@@ -163,4 +166,6 @@ libxml2.so.2 libxml2 #MINVER#
xmlThrDefParserInputBufferCreateFilenameDefault@LIBXML2_2.6.11 2.8.0
xmlTextReaderRelaxNGValidateCtxt@LIBXML2_2.8.0
xmlUpgradeOldNs@Base 2.6.27
+ xmlXPathNodeEval@LIBXML2_2.9.1 2.9.1
+ xmlXPathSetContextNode@LIBXML2_2.9.1 2.9.1
xmlXPtrAdvanceNode@Base 2.6.27
diff --git a/debian/patches/0001-modify-xml2-config-and-pkgconfig-behaviour.patch b/debian/patches/0001-modify-xml2-config-and-pkgconfig-behaviour.patch
index e4deba2..c5b16bb 100644
--- a/debian/patches/0001-modify-xml2-config-and-pkgconfig-behaviour.patch
+++ b/debian/patches/0001-modify-xml2-config-and-pkgconfig-behaviour.patch
@@ -5,15 +5,16 @@ Subject: modify xml2-config and pkgconfig behaviour
---
configure.in | 2 +-
libxml-2.0-uninstalled.pc.in | 3 ++-
+ libxml-2.0.pc.in | 2 +-
xml2-config.1 | 4 ++++
xml2-config.in | 22 ++++++++++------------
- 4 files changed, 17 insertions(+), 14 deletions(-)
+ 5 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/configure.in b/configure.in
-index 3d5f48b..836695c 100644
+index d449b11..668f233 100644
--- a/configure.in
+++ b/configure.in
-@@ -1376,7 +1376,7 @@ case "$host" in
+@@ -1380,7 +1380,7 @@ case "$host" in
*) M_LIBS="-lm"
;;
esac
@@ -34,6 +35,17 @@ index cab6834..af16ebc 100644
+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@
+diff --git a/libxml-2.0.pc.in b/libxml-2.0.pc.in
+index f5f5f03..0de667b 100644
+--- a/libxml-2.0.pc.in
++++ b/libxml-2.0.pc.in
+@@ -9,5 +9,5 @@ Version: @VERSION@
+ Description: libXML library version2.
+ Requires:
+ Libs: -L${libdir} -lxml2
+-Libs.private: @ICU_LIBS@ @THREAD_LIBS@ @Z_LIBS@ @ICONV_LIBS@ @M_LIBS@ @WIN32_EXTRA_LIBADD@ @LIBS@
++Libs.private: @ICU_LIBS@ @THREAD_LIBS@ @Z_LIBS@ @ICONV_LIBS@ @M_LIBS@ @WIN32_EXTRA_LIBADD@ @LIBS@ @LZMA_LIBS@
+ Cflags: @XML_INCLUDEDIR@ @XML_CFLAGS@
diff --git a/xml2-config.1 b/xml2-config.1
index 8cf9858..7b4195d 100644
--- a/xml2-config.1
@@ -94,4 +106,3 @@ index 1957486..b764d83 100644
*)
usage
---
diff --git a/debian/patches/0002-fix-python-multiarch-includes.patch b/debian/patches/0002-fix-python-multiarch-includes.patch
new file mode 100644
index 0000000..ff7c4fa
--- /dev/null
+++ b/debian/patches/0002-fix-python-multiarch-includes.patch
@@ -0,0 +1,35 @@
+From: Matthias Klose <doko@ubuntu.com>
+Date: Wed, 9 Jul 2014 05:30:24 +0800
+Subject: fix python multiarch includes
+
+---
+ python/Makefile.am | 2 +-
+ python/Makefile.in | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/python/Makefile.am b/python/Makefile.am
+index 34aed96..8445ea5 100644
+--- a/python/Makefile.am
++++ b/python/Makefile.am
+@@ -19,7 +19,7 @@ if WITH_PYTHON
+ AM_CPPFLAGS = \
+ -I$(top_builddir)/include \
+ -I$(top_srcdir)/include \
+- -I$(PYTHON_INCLUDES)
++ $(PYTHON_INCLUDES)
+
+ python_LTLIBRARIES = libxml2mod.la
+
+diff --git a/python/Makefile.in b/python/Makefile.in
+index efdea43..23e7fa2 100644
+--- a/python/Makefile.in
++++ b/python/Makefile.in
+@@ -430,7 +430,7 @@ EXTRA_DIST = \
+ @WITH_PYTHON_TRUE@AM_CPPFLAGS = \
+ @WITH_PYTHON_TRUE@ -I$(top_builddir)/include \
+ @WITH_PYTHON_TRUE@ -I$(top_srcdir)/include \
+-@WITH_PYTHON_TRUE@ -I$(PYTHON_INCLUDES)
++@WITH_PYTHON_TRUE@ $(PYTHON_INCLUDES)
+
+ @WITH_PYTHON_TRUE@python_LTLIBRARIES = libxml2mod.la
+ @WITH_PYTHON_TRUE@libxml2mod_la_SOURCES = libxml.c libxml_wrap.h libxml2-py.h libxml2-py.c types.c
diff --git a/debian/patches/0002-rand_seed-should-be-static-in-dict.c.patch b/debian/patches/0002-rand_seed-should-be-static-in-dict.c.patch
deleted file mode 100644
index 163a846..0000000
--- a/debian/patches/0002-rand_seed-should-be-static-in-dict.c.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From: Wouter Van Rooy <rooywo@vasco.com>
-Date: Fri, 14 Sep 2012 14:39:42 +0800
-Subject: rand_seed should be static in dict.c
-
-For https://bugzilla.gnome.org/show_bug.cgi?id=683933
-rand_seed should be a static variable in dict.c
-
-We ran into a problem with another library that exports rand_seed as a
-function. Combined with 2.7.8 this was not a problem but later versions
-have this problem.
----
- dict.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/dict.c b/dict.c
-index 9935a25..164c7f2 100644
---- a/dict.c
-+++ b/dict.c
-@@ -143,7 +143,7 @@ static int xmlDictInitialized = 0;
- /*
- * Internal data for random function, protected by xmlDictMutex
- */
--unsigned int rand_seed = 0;
-+static unsigned int rand_seed = 0;
- #endif
- #endif
-
---
diff --git a/debian/patches/0003-Fix-a-thread-portability-problem.patch b/debian/patches/0003-Fix-a-thread-portability-problem.patch
deleted file mode 100644
index 07e3583..0000000
--- a/debian/patches/0003-Fix-a-thread-portability-problem.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From: Friedrich Haubensak <hsk@fli-leibniz.de>
-Date: Wed, 12 Sep 2012 17:34:53 +0200
-Subject: Fix a thread portability problem
-
-cannot compile libxml2-2.9.0 using studio 12.1 compiler on solaris 10
-
-I.M.O. structure initializer (as PTHREAD_ONCE_INIT) cannot be used in
-a structure assignment anyway
----
- threads.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/threads.c b/threads.c
-index f206149..7e85a26 100644
---- a/threads.c
-+++ b/threads.c
-@@ -146,6 +146,7 @@ struct _xmlRMutex {
- static pthread_key_t globalkey;
- static pthread_t mainthread;
- static pthread_once_t once_control = PTHREAD_ONCE_INIT;
-+static pthread_once_t once_control_init = PTHREAD_ONCE_INIT;
- static pthread_mutex_t global_init_lock = PTHREAD_MUTEX_INITIALIZER;
- #elif defined HAVE_WIN32_THREADS
- #if defined(HAVE_COMPILER_TLS)
-@@ -915,7 +916,7 @@ xmlCleanupThreads(void)
- #ifdef HAVE_PTHREAD_H
- if ((libxml_is_threaded) && (pthread_key_delete != NULL))
- pthread_key_delete(globalkey);
-- once_control = PTHREAD_ONCE_INIT;
-+ once_control = once_control_init;
- #elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
- if (globalkey != TLS_OUT_OF_INDEXES) {
- xmlGlobalStateCleanupHelperParams *p;
---
diff --git a/debian/patches/0003-Fix-an-error-in-xmlCleanupParser.patch b/debian/patches/0003-Fix-an-error-in-xmlCleanupParser.patch
new file mode 100644
index 0000000..03bf447
--- /dev/null
+++ b/debian/patches/0003-Fix-an-error-in-xmlCleanupParser.patch
@@ -0,0 +1,27 @@
+From: Alexander Pastukhov <pastuchov@yandex.ru>
+Date: Tue, 23 Apr 2013 05:02:11 +0000
+Subject: Fix an error in xmlCleanupParser
+
+https://bugzilla.gnome.org/show_bug.cgi?id=698582
+
+xmlCleanupParser calls xmlCleanupGlobals() and then
+xmlResetLastError() but the later reallocate the global
+data freed by previous call. Just swap the two calls.
+---
+ parser.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/parser.c b/parser.c
+index ee429f3..b9df6d8 100644
+--- a/parser.c
++++ b/parser.c
+@@ -14763,8 +14763,8 @@ xmlCleanupParser(void) {
+ xmlSchemaCleanupTypes();
+ xmlRelaxNGCleanupTypes();
+ #endif
+- xmlCleanupGlobals();
+ xmlResetLastError();
++ xmlCleanupGlobals();
+ xmlCleanupThreads(); /* must be last if called not from the main thread */
+ xmlCleanupMemory();
+ xmlParserInitialized = 0;
diff --git a/debian/patches/0004-Fix-missing-break-on-last-function-for-attributes.patch b/debian/patches/0004-Fix-missing-break-on-last-function-for-attributes.patch
new file mode 100644
index 0000000..cff8b72
--- /dev/null
+++ b/debian/patches/0004-Fix-missing-break-on-last-function-for-attributes.patch
@@ -0,0 +1,21 @@
+From: dcb <dcb314@hotmail.com>
+Date: Thu, 2 May 2013 08:11:46 +0000
+Subject: Fix missing break on last() function for attributes
+
+pointed out by cppcheck
+---
+ python/libxml.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/python/libxml.c b/python/libxml.c
+index 03cfb9f..3338b83 100644
+--- a/python/libxml.c
++++ b/python/libxml.c
+@@ -2683,6 +2683,7 @@ libxml_last(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
+ xmlAttrPtr attr = (xmlAttrPtr) cur;
+
+ res = attr->last;
++ break;
+ }
+ default:
+ res = NULL;
diff --git a/debian/patches/0004-link-libxml2mod-first.patch b/debian/patches/0004-link-libxml2mod-first.patch
deleted file mode 100644
index 6b5a18c..0000000
--- a/debian/patches/0004-link-libxml2mod-first.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-From: YunQiang Su <wzssyqa@gmail.com>
-Date: Sun, 28 Oct 2012 03:29:05 +0800
-Subject: link libxml2mod first
-
----
- python/Makefile.am | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/python/Makefile.am b/python/Makefile.am
-index 4a8b5d5..10724ec 100644
---- a/python/Makefile.am
-+++ b/python/Makefile.am
-@@ -24,8 +24,8 @@ AM_CPPFLAGS = \
- python_LTLIBRARIES = libxml2mod.la
-
- libxml2mod_la_SOURCES = libxml.c libxml_wrap.h libxml2-py.h libxml2-py.c types.c
--libxml2mod_la_LIBADD = $(top_builddir)/libxml2.la $(CYGWIN_EXTRA_PYTHON_LIBADD) $(WIN32_EXTRA_PYTHON_LIBADD) $(PYTHON_LIBS) -lpython$(PYTHON_VERSION)
--libxml2mod_la_LDFLAGS = $(CYGWIN_EXTRA_LDFLAGS) $(WIN32_EXTRA_LDFLAGS) -module -avoid-version
-+libxml2mod_la_LDFLAGS = $(CYGWIN_EXTRA_LDFLAGS) $(WIN32_EXTRA_LDFLAGS) -module -avoid-version \
-+ $(top_builddir)/libxml2.la $(CYGWIN_EXTRA_PYTHON_LIBADD) $(WIN32_EXTRA_PYTHON_LIBADD) $(PYTHON_LIBS) -lpython$(PYTHON_VERSION)
-
- BUILT_SOURCES = libxml2-export.c libxml2-py.h libxml2-py.c
-
---
diff --git a/debian/patches/0005-xmllint-memory-should-fail-on-empty-files.patch b/debian/patches/0005-xmllint-memory-should-fail-on-empty-files.patch
new file mode 100644
index 0000000..e1a2197
--- /dev/null
+++ b/debian/patches/0005-xmllint-memory-should-fail-on-empty-files.patch
@@ -0,0 +1,27 @@
+From: Daniel Veillard <veillard@redhat.com>
+Date: Wed, 8 May 2013 05:45:48 +0000
+Subject: xmllint --memory should fail on empty files
+
+Exposed by https://bugzilla.gnome.org/show_bug.cgi?id=699896
+when doing analysis but a priori unrelated.
+---
+ xmllint.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/xmllint.c b/xmllint.c
+index 26d8db1..c0196ab 100644
+--- a/xmllint.c
++++ b/xmllint.c
+@@ -2338,8 +2338,11 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
+ if ((fd = open(filename, O_RDONLY)) < 0)
+ return;
+ base = mmap(NULL, info.st_size, PROT_READ, MAP_SHARED, fd, 0) ;
+- if (base == (void *) MAP_FAILED)
++ if (base == (void *) MAP_FAILED) {
++ fprintf(stderr, "mmap failure for file %s\n", filename);
++ progresult = XMLLINT_ERR_RDFILE;
+ return;
++ }
+
+ if (rectxt == NULL)
+ doc = xmlReadMemory((char *) base, info.st_size,
diff --git a/debian/patches/0006-properly-quote-the-namespace-uris-written-out-during.patch b/debian/patches/0006-properly-quote-the-namespace-uris-written-out-during.patch
new file mode 100644
index 0000000..6f4c4c8
--- /dev/null
+++ b/debian/patches/0006-properly-quote-the-namespace-uris-written-out-during.patch
@@ -0,0 +1,32 @@
+From: Aleksey Sanin <aleksey@aleksey.com>
+Date: Thu, 9 May 2013 16:02:16 +0000
+Subject: properly quote the namespace uris written out during c14n
+
+---
+ c14n.c | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/c14n.c b/c14n.c
+index afd95b3..ca77f92 100644
+--- a/c14n.c
++++ b/c14n.c
+@@ -547,14 +547,15 @@ xmlC14NPrintNamespaces(const xmlNsPtr ns, xmlC14NCtxPtr ctx)
+ if (ns->prefix != NULL) {
+ xmlOutputBufferWriteString(ctx->buf, " xmlns:");
+ xmlOutputBufferWriteString(ctx->buf, (const char *) ns->prefix);
+- xmlOutputBufferWriteString(ctx->buf, "=\"");
++ xmlOutputBufferWriteString(ctx->buf, "=");
+ } else {
+- xmlOutputBufferWriteString(ctx->buf, " xmlns=\"");
++ xmlOutputBufferWriteString(ctx->buf, " xmlns=");
+ }
+ if(ns->href != NULL) {
+- xmlOutputBufferWriteString(ctx->buf, (const char *) ns->href);
++ xmlBufWriteQuotedString(ctx->buf->buffer, ns->href);
++ } else {
++ xmlOutputBufferWriteString(ctx->buf, "\"\"");
+ }
+- xmlOutputBufferWriteString(ctx->buf, "\"");
+ return (1);
+ }
+
diff --git a/debian/patches/0007-Fix-a-parsing-bug-on-non-ascii-element-and-CR-LF-usa.patch b/debian/patches/0007-Fix-a-parsing-bug-on-non-ascii-element-and-CR-LF-usa.patch
new file mode 100644
index 0000000..442fd11
--- /dev/null
+++ b/debian/patches/0007-Fix-a-parsing-bug-on-non-ascii-element-and-CR-LF-usa.patch
@@ -0,0 +1,57 @@
+From: Daniel Veillard <veillard@redhat.com>
+Date: Wed, 22 May 2013 20:56:45 +0000
+Subject: Fix a parsing bug on non-ascii element and CR/LF usage
+
+https://bugzilla.gnome.org/show_bug.cgi?id=698550
+
+Somehow the behaviour of the internal parser routine changed
+slightly when encountering CR/LF, which led to a bug when
+parsing document with non-ascii Names
+---
+ parser.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/parser.c b/parser.c
+index b9df6d8..dd00399 100644
+--- a/parser.c
++++ b/parser.c
+@@ -3404,6 +3404,7 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
+ int len = 0, l;
+ int c;
+ int count = 0;
++ const xmlChar *end; /* needed because CUR_CHAR() can move cur on \r\n */
+
+ #ifdef DEBUG
+ nbParseNCNameComplex++;
+@@ -3413,6 +3414,7 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
+ * Handler for more complex cases
+ */
+ GROW;
++ end = ctxt->input->cur;
+ c = CUR_CHAR(l);
+ if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */
+ (!xmlIsNameStartChar(ctxt, c) || (c == ':'))) {
+@@ -3434,12 +3436,14 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
+ }
+ len += l;
+ NEXTL(l);
++ end = ctxt->input->cur;
+ c = CUR_CHAR(l);
+ if (c == 0) {
+ count = 0;
+ GROW;
+ if (ctxt->instate == XML_PARSER_EOF)
+ return(NULL);
++ end = ctxt->input->cur;
+ c = CUR_CHAR(l);
+ }
+ }
+@@ -3448,7 +3452,7 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
+ xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName");
+ return(NULL);
+ }
+- return(xmlDictLookup(ctxt->dict, ctxt->input->cur - len, len));
++ return(xmlDictLookup(ctxt->dict, end - len, len));
+ }
+
+ /**
diff --git a/debian/patches/0008-missing-else-in-xlink.c.patch b/debian/patches/0008-missing-else-in-xlink.c.patch
new file mode 100644
index 0000000..88a4e86
--- /dev/null
+++ b/debian/patches/0008-missing-else-in-xlink.c.patch
@@ -0,0 +1,22 @@
+From: Ami Fischman <fischman@google.com>
+Date: Tue, 2 Jul 2013 09:47:26 +0800
+Subject: missing else in xlink.c
+
+Obviously forgotten
+---
+ xlink.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/xlink.c b/xlink.c
+index 3566e06..c0e4ff3 100644
+--- a/xlink.c
++++ b/xlink.c
+@@ -150,7 +150,7 @@ xlinkIsLink (xmlDocPtr doc, xmlNodePtr node) {
+ if (type != NULL) {
+ if (xmlStrEqual(type, BAD_CAST "simple")) {
+ ret = XLINK_TYPE_SIMPLE;
+- } if (xmlStrEqual(type, BAD_CAST "extended")) {
++ } else if (xmlStrEqual(type, BAD_CAST "extended")) {
+ role = xmlGetNsProp(node, BAD_CAST "role", XLINK_NAMESPACE);
+ if (role != NULL) {
+ xmlNsPtr xlink;
diff --git a/debian/patches/0009-Catch-malloc-error-and-exit-accordingly.patch b/debian/patches/0009-Catch-malloc-error-and-exit-accordingly.patch
new file mode 100644
index 0000000..3f93a57
--- /dev/null
+++ b/debian/patches/0009-Catch-malloc-error-and-exit-accordingly.patch
@@ -0,0 +1,24 @@
+From: Daniel Veillard <veillard@redhat.com>
+Date: Thu, 11 Jul 2013 15:41:22 +0800
+Subject: Catch malloc error and exit accordingly
+
+As pointed privately by Bill Parker <wp02855@gmail.com>
+---
+ xmllint.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/xmllint.c b/xmllint.c
+index c0196ab..4d464e4 100644
+--- a/xmllint.c
++++ b/xmllint.c
+@@ -3090,6 +3090,10 @@ static void usage(const char *name) {
+ static void registerNode(xmlNodePtr node)
+ {
+ node->_private = malloc(sizeof(long));
++ if (node->_private == NULL) {
++ fprintf(stderr, "Out of memory in xmllint:registerNode()\n");
++ exit(XMLLINT_ERR_MEM);
++ }
+ *(long*)node->_private = (long) 0x81726354;
+ nbregister++;
+ }
diff --git a/debian/patches/0010-Fix-handling-of-mmap-errors.patch b/debian/patches/0010-Fix-handling-of-mmap-errors.patch
new file mode 100644
index 0000000..0c55cfe
--- /dev/null
+++ b/debian/patches/0010-Fix-handling-of-mmap-errors.patch
@@ -0,0 +1,51 @@
+From: Daniel Veillard <veillard@redhat.com>
+Date: Fri, 12 Jul 2013 12:08:40 +0800
+Subject: Fix handling of mmap errors
+
+https://bugzilla.gnome.org/show_bug.cgi?id=702320
+
+as raised by Gaurav <ya1gaurav@gmail.com>
+---
+ xmllint.c | 13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/xmllint.c b/xmllint.c
+index 4d464e4..92e6b03 100644
+--- a/xmllint.c
++++ b/xmllint.c
+@@ -1837,8 +1837,12 @@ static void streamFile(char *filename) {
+ if ((fd = open(filename, O_RDONLY)) < 0)
+ return;
+ base = mmap(NULL, info.st_size, PROT_READ, MAP_SHARED, fd, 0) ;
+- if (base == (void *) MAP_FAILED)
++ if (base == (void *) MAP_FAILED) {
++ close(fd);
++ fprintf(stderr, "mmap failure for file %s\n", filename);
++ progresult = XMLLINT_ERR_RDFILE;
+ return;
++ }
+
+ reader = xmlReaderForMemory(base, info.st_size, filename,
+ NULL, options);
+@@ -2223,8 +2227,12 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
+ if ((fd = open(filename, O_RDONLY)) < 0)
+ return;
+ base = mmap(NULL, info.st_size, PROT_READ, MAP_SHARED, fd, 0) ;
+- if (base == (void *) MAP_FAILED)
++ if (base == (void *) MAP_FAILED) {
++ close(fd);
++ fprintf(stderr, "mmap failure for file %s\n", filename);
++ progresult = XMLLINT_ERR_RDFILE;
+ return;
++ }
+
+ doc = htmlReadMemory((char *) base, info.st_size, filename,
+ NULL, options);
+@@ -2339,6 +2347,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
+ return;
+ base = mmap(NULL, info.st_size, PROT_READ, MAP_SHARED, fd, 0) ;
+ if (base == (void *) MAP_FAILED) {
++ close(fd);
+ fprintf(stderr, "mmap failure for file %s\n", filename);
+ progresult = XMLLINT_ERR_RDFILE;
+ return;
diff --git a/debian/patches/0011-Avoid-crash-if-allocation-fails.patch b/debian/patches/0011-Avoid-crash-if-allocation-fails.patch
new file mode 100644
index 0000000..e4e7206
--- /dev/null
+++ b/debian/patches/0011-Avoid-crash-if-allocation-fails.patch
@@ -0,0 +1,25 @@
+From: Daniel Veillard <veillard@redhat.com>
+Date: Mon, 22 Jul 2013 14:28:20 +0800
+Subject: Avoid crash if allocation fails
+
+https://bugzilla.gnome.org/show_bug.cgi?id=704527
+xmlSchemaNewValue() may fail on OOM error
+---
+ xmlschemastypes.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/xmlschemastypes.c b/xmlschemastypes.c
+index a9edc03..ec403e8 100644
+--- a/xmlschemastypes.c
++++ b/xmlschemastypes.c
+@@ -242,6 +242,10 @@ xmlSchemaNewMinLengthFacet(int value)
+ }
+ ret->type = XML_SCHEMA_FACET_MINLENGTH;
+ ret->val = xmlSchemaNewValue(XML_SCHEMAS_NNINTEGER);
++ if (ret->val == NULL) {
++ xmlFree(ret);
++ return(NULL);
++ }
+ ret->val->value.decimal.lo = value;
+ return (ret);
+ }
diff --git a/debian/patches/0012-Fix-a-possible-NULL-dereference.patch b/debian/patches/0012-Fix-a-possible-NULL-dereference.patch
new file mode 100644
index 0000000..9a7cf6f
--- /dev/null
+++ b/debian/patches/0012-Fix-a-possible-NULL-dereference.patch
@@ -0,0 +1,30 @@
+From: Gaurav <g.gupta@40samsung.com>
+Date: Sat, 3 Aug 2013 22:16:02 +0800
+Subject: Fix a possible NULL dereference
+
+https://bugzilla.gnome.org/show_bug.cgi?id=705400
+In case of allocation error the pointer was dereferenced before the
+test for a failure
+---
+ SAX2.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/SAX2.c b/SAX2.c
+index 4adf202..33d167e 100644
+--- a/SAX2.c
++++ b/SAX2.c
+@@ -994,12 +994,12 @@ xmlSAX2StartDocument(void *ctx)
+ #ifdef LIBXML_HTML_ENABLED
+ if (ctxt->myDoc == NULL)
+ ctxt->myDoc = htmlNewDocNoDtD(NULL, NULL);
+- ctxt->myDoc->properties = XML_DOC_HTML;
+- ctxt->myDoc->parseFlags = ctxt->options;
+ if (ctxt->myDoc == NULL) {
+ xmlSAX2ErrMemory(ctxt, "xmlSAX2StartDocument");
+ return;
+ }
++ ctxt->myDoc->properties = XML_DOC_HTML;
++ ctxt->myDoc->parseFlags = ctxt->options;
+ #else
+ xmlGenericError(xmlGenericErrorContext,
+ "libxml2 built without HTML support\n");
diff --git a/debian/patches/0013-Clear-up-a-potential-NULL-dereference.patch b/debian/patches/0013-Clear-up-a-potential-NULL-dereference.patch
new file mode 100644
index 0000000..a18dfaf
--- /dev/null
+++ b/debian/patches/0013-Clear-up-a-potential-NULL-dereference.patch
@@ -0,0 +1,26 @@
+From: Daniel Veillard <veillard@redhat.com>
+Date: Sat, 3 Aug 2013 22:25:13 +0800
+Subject: Clear up a potential NULL dereference
+
+https://bugzilla.gnome.org/show_bug.cgi?id=705399
+
+if ctxt->node_seq.buffer is null then ctxt->node_seq.maximum ought
+to be zero but it's better to clarify the check in the code directly.
+---
+ parserInternals.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/parserInternals.c b/parserInternals.c
+index f8a7041..98a5836 100644
+--- a/parserInternals.c
++++ b/parserInternals.c
+@@ -1990,7 +1990,8 @@ xmlParserAddNodeInfo(xmlParserCtxtPtr ctxt,
+
+ /* Otherwise, we need to add new node to buffer */
+ else {
+- if (ctxt->node_seq.length + 1 > ctxt->node_seq.maximum) {
++ if ((ctxt->node_seq.length + 1 > ctxt->node_seq.maximum) ||
++ (ctxt->node_seq.buffer == NULL)) {
+ xmlParserNodeInfo *tmp_buffer;
+ unsigned int byte_size;
+
diff --git a/debian/patches/0014-Fix-XPath-optimization-with-predicates.patch b/debian/patches/0014-Fix-XPath-optimization-with-predicates.patch
new file mode 100644
index 0000000..f24424a
--- /dev/null
+++ b/debian/patches/0014-Fix-XPath-optimization-with-predicates.patch
@@ -0,0 +1,27 @@
+From: Nick Wellnhofer <wellnhofer@aevum.de>
+Date: Sun, 4 Aug 2013 22:15:11 +0000
+Subject: Fix XPath '//' optimization with predicates
+
+My attempt to optimize XPath expressions containing '//' caused a
+regression reported in bug #695699. This commit disables the
+optimization for expressions of the form '//foo[predicate]'.
+---
+ xpath.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/xpath.c b/xpath.c
+index 97410e7..a676989 100644
+--- a/xpath.c
++++ b/xpath.c
+@@ -14719,8 +14719,9 @@ xmlXPathOptimizeExpression(xmlXPathCompExprPtr comp, xmlXPathStepOpPtr op)
+ * internal representation.
+ */
+
+- if ((op->ch1 != -1) &&
+- (op->op == XPATH_OP_COLLECT /* 11 */))
++ if ((op->op == XPATH_OP_COLLECT /* 11 */) &&
++ (op->ch1 != -1) &&
++ (op->ch2 == -1 /* no predicate */))
+ {
+ xmlXPathStepOpPtr prevop = &comp->steps[op->ch1];
+
diff --git a/debian/patches/0015-xmllint-pretty-crashed-without-following-numeric-arg.patch b/debian/patches/0015-xmllint-pretty-crashed-without-following-numeric-arg.patch
new file mode 100644
index 0000000..b910c3a
--- /dev/null
+++ b/debian/patches/0015-xmllint-pretty-crashed-without-following-numeric-arg.patch
@@ -0,0 +1,34 @@
+From: Tim Galeckas <tim@galeckas.com>
+Date: Thu, 29 Aug 2013 16:44:33 +0800
+Subject: xmllint --pretty crashed without following numeric argument
+
+https://bugzilla.gnome.org/show_bug.cgi?id=674789
+
+We need to check for NULL argument before calling atoi()
+---
+ xmllint.c | 12 +++++++-----
+ 1 file changed, 7 insertions(+), 5 deletions(-)
+
+diff --git a/xmllint.c b/xmllint.c
+index 92e6b03..d69722c 100644
+--- a/xmllint.c
++++ b/xmllint.c
+@@ -3388,11 +3388,13 @@ main(int argc, char **argv) {
+ (!strcmp(argv[i], "--pretty"))) {
+ i++;
+ #ifdef LIBXML_OUTPUT_ENABLED
+- format = atoi(argv[i]);
+- if (format == 1) {
+- noblanks++;
+- xmlKeepBlanksDefault(0);
+- }
++ if (argv[i] != NULL) {
++ format = atoi(argv[i]);
++ if (format == 1) {
++ noblanks++;
++ xmlKeepBlanksDefault(0);
++ }
++ }
+ #endif /* LIBXML_OUTPUT_ENABLED */
+ }
+ #ifdef LIBXML_READER_ENABLED
diff --git a/debian/patches/0016-Fix-potential-NULL-pointer-dereferences-in-regexp-co.patch b/debian/patches/0016-Fix-potential-NULL-pointer-dereferences-in-regexp-co.patch
new file mode 100644
index 0000000..fa8a176
--- /dev/null
+++ b/debian/patches/0016-Fix-potential-NULL-pointer-dereferences-in-regexp-co.patch
@@ -0,0 +1,45 @@
+From: Gaurav <g.gupta@samsung.com>
+Date: Wed, 11 Sep 2013 14:59:06 +0800
+Subject: Fix potential NULL pointer dereferences in regexp code
+
+https://bugzilla.gnome.org/show_bug.cgi?id=707749
+
+Fix 3 cases where we might dereference NULL
+---
+ xmlregexp.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/xmlregexp.c b/xmlregexp.c
+index 1f9911c..8e63d74 100644
+--- a/xmlregexp.c
++++ b/xmlregexp.c
+@@ -3162,8 +3162,10 @@ xmlFARegExecRollBack(xmlRegExecCtxtPtr exec) {
+ exec->status = -6;
+ return;
+ }
+- memcpy(exec->counts, exec->rollbacks[exec->nbRollbacks].counts,
++ if (exec->counts) {
++ memcpy(exec->counts, exec->rollbacks[exec->nbRollbacks].counts,
+ exec->comp->nbCounters * sizeof(int));
++ }
+ }
+
+ #ifdef DEBUG_REGEXP_EXEC
+@@ -4091,7 +4093,7 @@ rollback:
+ */
+ exec->determinist = 0;
+ xmlFARegExecRollBack(exec);
+- if (exec->status == 0) {
++ if ((exec->inputStack != NULL ) && (exec->status == 0)) {
+ value = exec->inputStack[exec->index].value;
+ data = exec->inputStack[exec->index].data;
+ #ifdef DEBUG_PUSH
+@@ -4306,7 +4308,7 @@ xmlRegExecGetValues(xmlRegExecCtxtPtr exec, int err,
+ (*nbval)++;
+ }
+ } else {
+- if ((exec->comp->states[trans->to] != NULL) &&
++ if ((exec->comp != NULL) && (exec->comp->states[trans->to] != NULL) &&
+ (exec->comp->states[trans->to]->type !=
+ XML_REGEXP_SINK_STATE)) {
+ if (atom->neg)
diff --git a/debian/patches/0017-Fix-a-potential-NULL-dereference-in-tree-code.patch b/debian/patches/0017-Fix-a-potential-NULL-dereference-in-tree-code.patch
new file mode 100644
index 0000000..2c55813
--- /dev/null
+++ b/debian/patches/0017-Fix-a-potential-NULL-dereference-in-tree-code.patch
@@ -0,0 +1,26 @@
+From: Daniel Veillard <veillard@redhat.com>
+Date: Wed, 11 Sep 2013 15:11:27 +0800
+Subject: Fix a potential NULL dereference in tree code
+
+https://bugzilla.gnome.org/show_bug.cgi?id=707750
+
+Also reported by Gaurav, simple fix to check the pointer before
+dereference
+---
+ tree.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/tree.c b/tree.c
+index 7e5af26..efc3ca2 100644
+--- a/tree.c
++++ b/tree.c
+@@ -9780,7 +9780,8 @@ leave_node:
+ if (clone->parent != NULL)
+ clone->parent->last = clone;
+ clone = clone->parent;
+- parentClone = clone->parent;
++ if (clone != NULL)
++ parentClone = clone->parent;
+ /*
+ * Process parent --> next;
+ */
diff --git a/debian/patches/0018-Fix-pointer-dereferenced-before-null-check.patch b/debian/patches/0018-Fix-pointer-dereferenced-before-null-check.patch
new file mode 100644
index 0000000..3ae1c59
--- /dev/null
+++ b/debian/patches/0018-Fix-pointer-dereferenced-before-null-check.patch
@@ -0,0 +1,25 @@
+From: Gaurav <g.gupta@samsung.com>
+Date: Mon, 30 Sep 2013 10:43:47 +0800
+Subject: Fix pointer dereferenced before null check
+
+for https://bugzilla.gnome.org/show_bug.cgi?id=708364
+
+xmlValidateElementContent is a private function but should still
+check the ctxt argument before dereferencing
+---
+ valid.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/valid.c b/valid.c
+index 6e53a76..e0832e7 100644
+--- a/valid.c
++++ b/valid.c
+@@ -5236,7 +5236,7 @@ xmlValidateElementContent(xmlValidCtxtPtr ctxt, xmlNodePtr child,
+ xmlElementContentPtr cont;
+ const xmlChar *name;
+
+- if ((elemDecl == NULL) || (parent == NULL))
++ if ((elemDecl == NULL) || (parent == NULL) || (ctxt == NULL))
+ return(-1);
+ cont = elemDecl->content;
+ name = elemDecl->name;
diff --git a/debian/patches/0019-Fix-a-bug-loading-some-compressed-files.patch b/debian/patches/0019-Fix-a-bug-loading-some-compressed-files.patch
new file mode 100644
index 0000000..48b4fa4
--- /dev/null
+++ b/debian/patches/0019-Fix-a-bug-loading-some-compressed-files.patch
@@ -0,0 +1,69 @@
+From: Mike Alexander <mta@umich.edu>
+Date: Thu, 28 Nov 2013 23:21:23 +0800
+Subject: Fix a bug loading some compressed files
+
+For https://bugzilla.gnome.org/show_bug.cgi?id=712528
+Related to https://bugzilla.redhat.com/show_bug.cgi?id=877567
+
+There is a bug in xzlib.c which causes certain compressed XML files to fail to
+load correctly. The code in xz_decomp which attempts to verify the checksum
+and length of the expanded data fails if the checksum or length at the end of
+the file crosses a 1024 byte boundary. It calls gz_next4 to get those two
+values. This function uses the stream state in state->zstrm, but calls
+xz_avail which uses the state->strm stream info. This causes gz_next4 to
+signal a premature EOF if the data it is fetching crosses a 1024 byte boundary.
+---
+ xzlib.c | 26 ++++++++++++++++++++++----
+ 1 file changed, 22 insertions(+), 4 deletions(-)
+
+diff --git a/xzlib.c b/xzlib.c
+index 928bd17..cd045fa 100644
+--- a/xzlib.c
++++ b/xzlib.c
+@@ -245,6 +245,20 @@ xz_avail(xz_statep state)
+ return 0;
+ }
+
++#ifdef HAVE_ZLIB_H
++static int
++xz_avail_zstrm(xz_statep state)
++{
++ int ret;
++ state->strm.avail_in = state->zstrm.avail_in;
++ state->strm.next_in = state->zstrm.next_in;
++ ret = xz_avail(state);
++ state->zstrm.avail_in = (uInt) state->strm.avail_in;
++ state->zstrm.next_in = (Bytef *) state->strm.next_in;
++ return ret;
++}
++#endif
++
+ static int
+ is_format_xz(xz_statep state)
+ {
+@@ -314,6 +328,10 @@ is_format_lzma(xz_statep state)
+ #define NEXT() ((strm->avail_in == 0 && xz_avail(state) == -1) ? -1 : \
+ (strm->avail_in == 0 ? -1 : \
+ (strm->avail_in--, *(strm->next_in)++)))
++/* Same thing, but from zstrm */
++#define NEXTZ() ((strm->avail_in == 0 && xz_avail_zstrm(state) == -1) ? -1 : \
++ (strm->avail_in == 0 ? -1 : \
++ (strm->avail_in--, *(strm->next_in)++)))
+
+ /* Get a four-byte little-endian integer and return 0 on success and the value
+ in *ret. Otherwise -1 is returned and *ret is not modified. */
+@@ -324,10 +342,10 @@ gz_next4(xz_statep state, unsigned long *ret)
+ unsigned long val;
+ z_streamp strm = &(state->zstrm);
+
+- val = NEXT();
+- val += (unsigned) NEXT() << 8;
+- val += (unsigned long) NEXT() << 16;
+- ch = NEXT();
++ val = NEXTZ();
++ val += (unsigned) NEXTZ() << 8;
++ val += (unsigned long) NEXTZ() << 16;
++ ch = NEXTZ();
+ if (ch == -1)
+ return -1;
+ val += (unsigned long) ch << 24;
diff --git a/debian/patches/0020-Avoid-a-possibility-of-dangling-encoding-handler.patch b/debian/patches/0020-Avoid-a-possibility-of-dangling-encoding-handler.patch
new file mode 100644
index 0000000..ab0bde8
--- /dev/null
+++ b/debian/patches/0020-Avoid-a-possibility-of-dangling-encoding-handler.patch
@@ -0,0 +1,57 @@
+From: Gaurav <g.gupta@samsung.com>
+Date: Fri, 29 Nov 2013 23:10:50 +0800
+Subject: Avoid a possibility of dangling encoding handler
+
+For https://bugzilla.gnome.org/show_bug.cgi?id=711149
+
+In Function:
+int xmlCharEncCloseFunc(xmlCharEncodingHandler *handler)
+
+If the freed handler is any one of handlers[i] list, then it will make that
+hanldlers[i] as dangling. This may lead to crash issues at places where
+handlers is read.
+---
+ encoding.c | 16 ++++++++++++++--
+ 1 file changed, 14 insertions(+), 2 deletions(-)
+
+diff --git a/encoding.c b/encoding.c
+index 7330e90..d4fc45f 100644
+--- a/encoding.c
++++ b/encoding.c
+@@ -2851,14 +2851,25 @@ int
+ xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) {
+ int ret = 0;
+ int tofree = 0;
++ int i, handler_in_list = 0;
++
+ if (handler == NULL) return(-1);
+ if (handler->name == NULL) return(-1);
++ if (handlers != NULL) {
++ for (i = 0;i < nbCharEncodingHandler; i++) {
++ if (handler == handlers[i]) {
++ handler_in_list = 1;
++ break;
++ }
++ }
++ }
+ #ifdef LIBXML_ICONV_ENABLED
+ /*
+ * Iconv handlers can be used only once, free the whole block.
+ * and the associated icon resources.
+ */
+- if ((handler->iconv_out != NULL) || (handler->iconv_in != NULL)) {
++ if ((handler_in_list == 0) &&
++ ((handler->iconv_out != NULL) || (handler->iconv_in != NULL))) {
+ tofree = 1;
+ if (handler->iconv_out != NULL) {
+ if (iconv_close(handler->iconv_out))
+@@ -2873,7 +2884,8 @@ xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) {
+ }
+ #endif /* LIBXML_ICONV_ENABLED */
+ #ifdef LIBXML_ICU_ENABLED
+- if ((handler->uconv_out != NULL) || (handler->uconv_in != NULL)) {
++ if ((handler_in_list == 0) &&
++ ((handler->uconv_out != NULL) || (handler->uconv_in != NULL))) {
+ tofree = 1;
+ if (handler->uconv_out != NULL) {
+ closeIcuConverter(handler->uconv_out);
diff --git a/debian/patches/0021-Fix-a-couple-of-missing-NULL-checks.patch b/debian/patches/0021-Fix-a-couple-of-missing-NULL-checks.patch
new file mode 100644
index 0000000..6771dbb
--- /dev/null
+++ b/debian/patches/0021-Fix-a-couple-of-missing-NULL-checks.patch
@@ -0,0 +1,29 @@
+From: Gaurav <g.gupta@samsung.com>
+Date: Fri, 29 Nov 2013 23:28:21 +0800
+Subject: Fix a couple of missing NULL checks
+
+For https://bugzilla.gnome.org/show_bug.cgi?id=708681
+---
+ tree.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/tree.c b/tree.c
+index efc3ca2..43c3c57 100644
+--- a/tree.c
++++ b/tree.c
+@@ -4294,6 +4294,7 @@ xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent) {
+ }
+ if (doc->intSubset == NULL) {
+ q = (xmlNodePtr) xmlCopyDtd( (xmlDtdPtr) node );
++ if (q == NULL) return(NULL);
+ q->doc = doc;
+ q->parent = parent;
+ doc->intSubset = (xmlDtdPtr) q;
+@@ -4305,6 +4306,7 @@ xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent) {
+ } else
+ #endif /* LIBXML_TREE_ENABLED */
+ q = xmlStaticCopyNode(node, doc, parent, 1);
++ if (q == NULL) return(NULL);
+ if (ret == NULL) {
+ q->prev = NULL;
+ ret = p = q;
diff --git a/debian/patches/0022-adding-init-calls-to-xml-and-html-Read-parsing-entry.patch b/debian/patches/0022-adding-init-calls-to-xml-and-html-Read-parsing-entry.patch
new file mode 100644
index 0000000..7820411
--- /dev/null
+++ b/debian/patches/0022-adding-init-calls-to-xml-and-html-Read-parsing-entry.patch
@@ -0,0 +1,148 @@
+From: Daniel Veillard <veillard@redhat.com>
+Date: Mon, 9 Dec 2013 15:23:40 +0800
+Subject: adding init calls to xml and html Read parsing entry points
+
+As pointed out by "Tassyns, Bram <BramT@enfocus.com>" on the list
+some call had it other didn't, clean it up and add to all missing
+ones
+---
+ HTMLparser.c | 6 ++++++
+ parser.c | 10 ++++++++++
+ 2 files changed, 16 insertions(+)
+
+diff --git a/HTMLparser.c b/HTMLparser.c
+index dd0c1ea..44c1a3c 100644
+--- a/HTMLparser.c
++++ b/HTMLparser.c
+@@ -6808,6 +6808,7 @@ htmlReadFd(int fd, const char *URL, const char *encoding, int options)
+
+ if (fd < 0)
+ return (NULL);
++ xmlInitParser();
+
+ xmlInitParser();
+ input = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE);
+@@ -6898,6 +6899,7 @@ htmlCtxtReadDoc(htmlParserCtxtPtr ctxt, const xmlChar * cur,
+ return (NULL);
+ if (ctxt == NULL)
+ return (NULL);
++ xmlInitParser();
+
+ htmlCtxtReset(ctxt);
+
+@@ -6931,6 +6933,7 @@ htmlCtxtReadFile(htmlParserCtxtPtr ctxt, const char *filename,
+ return (NULL);
+ if (ctxt == NULL)
+ return (NULL);
++ xmlInitParser();
+
+ htmlCtxtReset(ctxt);
+
+@@ -6967,6 +6970,7 @@ htmlCtxtReadMemory(htmlParserCtxtPtr ctxt, const char *buffer, int size,
+ return (NULL);
+ if (buffer == NULL)
+ return (NULL);
++ xmlInitParser();
+
+ htmlCtxtReset(ctxt);
+
+@@ -7009,6 +7013,7 @@ htmlCtxtReadFd(htmlParserCtxtPtr ctxt, int fd,
+ return (NULL);
+ if (ctxt == NULL)
+ return (NULL);
++ xmlInitParser();
+
+ htmlCtxtReset(ctxt);
+
+@@ -7053,6 +7058,7 @@ htmlCtxtReadIO(htmlParserCtxtPtr ctxt, xmlInputReadCallback ioread,
+ return (NULL);
+ if (ctxt == NULL)
+ return (NULL);
++ xmlInitParser();
+
+ htmlCtxtReset(ctxt);
+
+diff --git a/parser.c b/parser.c
+index dd00399..ad400f4 100644
+--- a/parser.c
++++ b/parser.c
+@@ -15217,6 +15217,7 @@ xmlReadDoc(const xmlChar * cur, const char *URL, const char *encoding, int optio
+
+ if (cur == NULL)
+ return (NULL);
++ xmlInitParser();
+
+ ctxt = xmlCreateDocParserCtxt(cur);
+ if (ctxt == NULL)
+@@ -15239,6 +15240,7 @@ xmlReadFile(const char *filename, const char *encoding, int options)
+ {
+ xmlParserCtxtPtr ctxt;
+
++ xmlInitParser();
+ ctxt = xmlCreateURLParserCtxt(filename, options);
+ if (ctxt == NULL)
+ return (NULL);
+@@ -15262,6 +15264,7 @@ xmlReadMemory(const char *buffer, int size, const char *URL, const char *encodin
+ {
+ xmlParserCtxtPtr ctxt;
+
++ xmlInitParser();
+ ctxt = xmlCreateMemoryParserCtxt(buffer, size);
+ if (ctxt == NULL)
+ return (NULL);
+@@ -15290,6 +15293,7 @@ xmlReadFd(int fd, const char *URL, const char *encoding, int options)
+
+ if (fd < 0)
+ return (NULL);
++ xmlInitParser();
+
+ input = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE);
+ if (input == NULL)
+@@ -15333,6 +15337,7 @@ xmlReadIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose,
+
+ if (ioread == NULL)
+ return (NULL);
++ xmlInitParser();
+
+ input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx,
+ XML_CHAR_ENCODING_NONE);
+@@ -15379,6 +15384,7 @@ xmlCtxtReadDoc(xmlParserCtxtPtr ctxt, const xmlChar * cur,
+ return (NULL);
+ if (ctxt == NULL)
+ return (NULL);
++ xmlInitParser();
+
+ xmlCtxtReset(ctxt);
+
+@@ -15412,6 +15418,7 @@ xmlCtxtReadFile(xmlParserCtxtPtr ctxt, const char *filename,
+ return (NULL);
+ if (ctxt == NULL)
+ return (NULL);
++ xmlInitParser();
+
+ xmlCtxtReset(ctxt);
+
+@@ -15448,6 +15455,7 @@ xmlCtxtReadMemory(xmlParserCtxtPtr ctxt, const char *buffer, int size,
+ return (NULL);
+ if (buffer == NULL)
+ return (NULL);
++ xmlInitParser();
+
+ xmlCtxtReset(ctxt);
+
+@@ -15492,6 +15500,7 @@ xmlCtxtReadFd(xmlParserCtxtPtr ctxt, int fd,
+ return (NULL);
+ if (ctxt == NULL)
+ return (NULL);
++ xmlInitParser();
+
+ xmlCtxtReset(ctxt);
+
+@@ -15537,6 +15546,7 @@ xmlCtxtReadIO(xmlParserCtxtPtr ctxt, xmlInputReadCallback ioread,
+ return (NULL);
+ if (ctxt == NULL)
+ return (NULL);
++ xmlInitParser();
+
+ xmlCtxtReset(ctxt);
+
diff --git a/debian/patches/0023-Handling-of-XPath-function-arguments-in-error-case.patch b/debian/patches/0023-Handling-of-XPath-function-arguments-in-error-case.patch
new file mode 100644
index 0000000..cc18db7
--- /dev/null
+++ b/debian/patches/0023-Handling-of-XPath-function-arguments-in-error-case.patch
@@ -0,0 +1,41 @@
+From: Nick Wellnhofer <wellnhofer@aevum.de>
+Date: Fri, 20 Dec 2013 00:01:53 +0100
+Subject: Handling of XPath function arguments in error case
+
+The XPath engine tries to guarantee that every XPath function can pop
+'nargs' non-NULL values off the stack. libxslt, for example, relies on
+this assumption. But the check isn't thorough enough if there are errors
+during the evaluation of arguments. This can lead to segfaults:
+
+https://mail.gnome.org/archives/xslt/2013-December/msg00005.html
+
+This commit makes the handling of function arguments more robust.
+
+* Bail out early when evaluation of XPath function arguments fails.
+* Make sure that there are 'nargs' arguments in the current call frame.
+---
+ xpath.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/xpath.c b/xpath.c
+index a676989..a75df9b 100644
+--- a/xpath.c
++++ b/xpath.c
+@@ -13512,10 +13512,15 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
+ int frame;
+
+ frame = xmlXPathSetFrame(ctxt);
+- if (op->ch1 != -1)
++ if (op->ch1 != -1) {
+ total +=
+ xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
+- if (ctxt->valueNr < op->value) {
++ if (ctxt->error != XPATH_EXPRESSION_OK) {
++ xmlXPathPopFrame(ctxt, frame);
++ return (total);
++ }
++ }
++ if (ctxt->valueNr < ctxt->valueFrame + op->value) {
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlXPathCompOpEval: parameter error\n");
+ ctxt->error = XPATH_INVALID_OPERAND;
diff --git a/debian/patches/0024-Missing-initialization-for-the-catalog-module.patch b/debian/patches/0024-Missing-initialization-for-the-catalog-module.patch
new file mode 100644
index 0000000..c5a5d16
--- /dev/null
+++ b/debian/patches/0024-Missing-initialization-for-the-catalog-module.patch
@@ -0,0 +1,22 @@
+From: Daniel Veillard <veillard@redhat.com>
+Date: Sun, 26 Jan 2014 15:02:25 +0100
+Subject: Missing initialization for the catalog module
+
+---
+ parser.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/parser.c b/parser.c
+index ad400f4..7381a78 100644
+--- a/parser.c
++++ b/parser.c
+@@ -14720,6 +14720,9 @@ xmlInitParser(void) {
+ #ifdef LIBXML_XPATH_ENABLED
+ xmlXPathInit();
+ #endif
++#ifdef LIBXML_CATALOG_ENABLED
++ xmlInitializeCatalog();
++#endif
+ xmlParserInitialized = 1;
+ #ifdef LIBXML_THREAD_ENABLED
+ }
diff --git a/debian/patches/0025-Fix-an-fd-leak-in-an-error-case.patch b/debian/patches/0025-Fix-an-fd-leak-in-an-error-case.patch
new file mode 100644
index 0000000..edf1752
--- /dev/null
+++ b/debian/patches/0025-Fix-an-fd-leak-in-an-error-case.patch
@@ -0,0 +1,24 @@
+From: Daniel Veillard <veillard@redhat.com>
+Date: Thu, 6 Feb 2014 10:38:00 +0100
+Subject: Fix an fd leak in an error case
+
+---
+ catalog.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/catalog.c b/catalog.c
+index 8e34cd2..56991da 100644
+--- a/catalog.c
++++ b/catalog.c
+@@ -994,6 +994,11 @@ xmlLoadFileContent(const char *filename)
+ content = (xmlChar*)xmlMallocAtomic(size + 10);
+ if (content == NULL) {
+ xmlCatalogErrMemory("allocating catalog data");
++#ifdef HAVE_STAT
++ close(fd);
++#else
++ fclose(fd);
++#endif
+ return (NULL);
+ }
+ #ifdef HAVE_STAT
diff --git a/debian/patches/0026-fixing-a-ptotential-uninitialized-access.patch b/debian/patches/0026-fixing-a-ptotential-uninitialized-access.patch
new file mode 100644
index 0000000..65eae92
--- /dev/null
+++ b/debian/patches/0026-fixing-a-ptotential-uninitialized-access.patch
@@ -0,0 +1,21 @@
+From: Daniel Veillard <veillard@redhat.com>
+Date: Thu, 6 Feb 2014 10:47:20 +0100
+Subject: fixing a ptotential uninitialized access
+
+---
+ valid.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/valid.c b/valid.c
+index e0832e7..114bb72 100644
+--- a/valid.c
++++ b/valid.c
+@@ -6948,7 +6948,7 @@ xmlValidGetValidElements(xmlNode *prev, xmlNode *next, const xmlChar **names,
+ int max) {
+ xmlValidCtxt vctxt;
+ int nb_valid_elements = 0;
+- const xmlChar *elements[256];
++ const xmlChar *elements[256]={0};
+ int nb_elements = 0, i;
+ const xmlChar *name;
+
diff --git a/debian/patches/0027-Fix-xmlTextWriterWriteElement-when-a-null-content-is.patch b/debian/patches/0027-Fix-xmlTextWriterWriteElement-when-a-null-content-is.patch
new file mode 100644
index 0000000..22d206a
--- /dev/null
+++ b/debian/patches/0027-Fix-xmlTextWriterWriteElement-when-a-null-content-is.patch
@@ -0,0 +1,29 @@
+From: Daniel Veillard <veillard@redhat.com>
+Date: Sat, 8 Feb 2014 02:22:35 +0800
+Subject: Fix xmlTextWriterWriteElement when a null content is given
+
+---
+ xmlwriter.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/xmlwriter.c b/xmlwriter.c
+index d3f29f8..27209b9 100644
+--- a/xmlwriter.c
++++ b/xmlwriter.c
+@@ -2238,10 +2238,12 @@ xmlTextWriterWriteElement(xmlTextWriterPtr writer, const xmlChar * name,
+ if (count == -1)
+ return -1;
+ sum += count;
+- count = xmlTextWriterWriteString(writer, content);
+- if (count == -1)
+- return -1;
+- sum += count;
++ if (content != NULL) {
++ count = xmlTextWriterWriteString(writer, content);
++ if (count == -1)
++ return -1;
++ sum += count;
++ }
+ count = xmlTextWriterEndElement(writer);
+ if (count == -1)
+ return -1;
diff --git a/debian/patches/0028-Avoid-a-possible-NULL-pointer-dereference.patch b/debian/patches/0028-Avoid-a-possible-NULL-pointer-dereference.patch
new file mode 100644
index 0000000..219d13a
--- /dev/null
+++ b/debian/patches/0028-Avoid-a-possible-NULL-pointer-dereference.patch
@@ -0,0 +1,22 @@
+From: Gaurav <g.gupta@samsung.com>
+Date: Tue, 18 Feb 2014 11:47:43 +0800
+Subject: Avoid a possible NULL pointer dereference
+
+For https://bugzilla.gnome.org/show_bug.cgi?id=708355
+---
+ xmlmodule.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/xmlmodule.c b/xmlmodule.c
+index 7fe5bc2..50ed666 100644
+--- a/xmlmodule.c
++++ b/xmlmodule.c
+@@ -115,7 +115,7 @@ xmlModuleSymbol(xmlModulePtr module, const char *name, void **symbol)
+ {
+ int rc = -1;
+
+- if ((NULL == module) || (symbol == NULL)) {
++ if ((NULL == module) || (symbol == NULL) || (name == NULL)) {
+ __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_MODULE,
+ XML_MODULE_OPEN, XML_ERR_FATAL, NULL, 0, 0,
+ NULL, NULL, 0, 0, "null parameter\n");
diff --git a/debian/patches/0029-Do-not-fetch-external-parameter-entities.patch b/debian/patches/0029-Do-not-fetch-external-parameter-entities.patch
new file mode 100644
index 0000000..06ec27c
--- /dev/null
+++ b/debian/patches/0029-Do-not-fetch-external-parameter-entities.patch
@@ -0,0 +1,35 @@
+From: Daniel Veillard <veillard@redhat.com>
+Date: Tue, 22 Apr 2014 15:30:56 +0800
+Subject: Do not fetch external parameter entities
+
+Unless explicitely asked for when validating or replacing entities
+with their value. Problem pointed out by Daniel Berrange <berrange@redhat.com>
+---
+ parser.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/parser.c b/parser.c
+index 7381a78..8aad7b4 100644
+--- a/parser.c
++++ b/parser.c
+@@ -2595,6 +2595,20 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) {
+ xmlCharEncoding enc;
+
+ /*
++ * Note: external parsed entities will not be loaded, it is
++ * not required for a non-validating parser, unless the
++ * option of validating, or substituting entities were
++ * given. Doing so is far more secure as the parser will
++ * only process data coming from the document entity by
++ * default.
++ */
++ if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) &&
++ ((ctxt->options & XML_PARSE_NOENT) == 0) &&
++ ((ctxt->options & XML_PARSE_DTDVALID) == 0) &&
++ (ctxt->validate == 0))
++ return;
++
++ /*
+ * handle the extra spaces added before and after
+ * c.f. http://www.w3.org/TR/REC-xml#as-PE
+ * this is done independently.
diff --git a/debian/patches/0030-Avoid-Possible-null-pointer-dereference-in-memory-de.patch b/debian/patches/0030-Avoid-Possible-null-pointer-dereference-in-memory-de.patch
new file mode 100644
index 0000000..8a84731
--- /dev/null
+++ b/debian/patches/0030-Avoid-Possible-null-pointer-dereference-in-memory-de.patch
@@ -0,0 +1,32 @@
+From: Gaurav <g.gupta@samsung.com>
+Date: Fri, 9 May 2014 17:00:08 +0800
+Subject: Avoid Possible null pointer dereference in memory debug mode
+
+Fix a use before check on pointer
+For https://bugzilla.gnome.org/show_bug.cgi?id=729849
+---
+ xmlmemory.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/xmlmemory.c b/xmlmemory.c
+index 25d9318..37dcf3b 100644
+--- a/xmlmemory.c
++++ b/xmlmemory.c
+@@ -583,13 +583,15 @@ xmlMemBlocks(void) {
+ static void
+ xmlMemContentShow(FILE *fp, MEMHDR *p)
+ {
+- int i,j,k,len = p->mh_size;
+- const char *buf = (const char *) HDR_2_CLIENT(p);
++ int i,j,k,len;
++ const char *buf;
+
+ if (p == NULL) {
+ fprintf(fp, " NULL");
+ return;
+ }
++ len = p->mh_size;
++ buf = (const char *) HDR_2_CLIENT(p);
+
+ for (i = 0;i < len;i++) {
+ if (buf[i] == 0) break;
diff --git a/debian/patches/0031-xmllint-was-not-parsing-the-c14n11-flag.patch b/debian/patches/0031-xmllint-was-not-parsing-the-c14n11-flag.patch
new file mode 100644
index 0000000..7b24f6b
--- /dev/null
+++ b/debian/patches/0031-xmllint-was-not-parsing-the-c14n11-flag.patch
@@ -0,0 +1,22 @@
+From: =?UTF-8?q?S=C3=A9rgio=20Batista?= <mail@se.rg.io>
+Date: Mon, 9 Jun 2014 22:10:15 +0800
+Subject: xmllint was not parsing the --c14n11 flag
+
+Cut and paste error, using the wrong variable
+---
+ xmllint.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/xmllint.c b/xmllint.c
+index d69722c..4a5d043 100644
+--- a/xmllint.c
++++ b/xmllint.c
+@@ -2573,7 +2573,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
+ fprintf(stderr, "Failed to canonicalize\n");
+ progresult = XMLLINT_ERR_OUT;
+ }
+- } else if (canonical) {
++ } else if (canonical_11) {
+ xmlChar *result = NULL;
+ int size;
+
diff --git a/debian/patches/0032-Fix-regressions-introduced-by-CVE-2014-0191-patch.patch b/debian/patches/0032-Fix-regressions-introduced-by-CVE-2014-0191-patch.patch
new file mode 100644
index 0000000..d9fc108
--- /dev/null
+++ b/debian/patches/0032-Fix-regressions-introduced-by-CVE-2014-0191-patch.patch
@@ -0,0 +1,58 @@
+From: Daniel Veillard <veillard@redhat.com>
+Date: Wed, 11 Jun 2014 16:54:32 +0800
+Subject: Fix regressions introduced by CVE-2014-0191 patch
+
+A number of issues have been raised after the fix, and this patch
+tries to correct all of them, though most were related to
+postvalidation.
+https://bugzilla.gnome.org/show_bug.cgi?id=730290
+and other reports on list, off-list and on Red Hat bugzilla
+---
+ parser.c | 13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/parser.c b/parser.c
+index 8aad7b4..ea0ea65 100644
+--- a/parser.c
++++ b/parser.c
+@@ -2595,8 +2595,8 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) {
+ xmlCharEncoding enc;
+
+ /*
+- * Note: external parsed entities will not be loaded, it is
+- * not required for a non-validating parser, unless the
++ * Note: external parameter entities will not be loaded, it
++ * is not required for a non-validating parser, unless the
+ * option of validating, or substituting entities were
+ * given. Doing so is far more secure as the parser will
+ * only process data coming from the document entity by
+@@ -2605,6 +2605,9 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) {
+ if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) &&
+ ((ctxt->options & XML_PARSE_NOENT) == 0) &&
+ ((ctxt->options & XML_PARSE_DTDVALID) == 0) &&
++ ((ctxt->options & XML_PARSE_DTDLOAD) == 0) &&
++ ((ctxt->options & XML_PARSE_DTDATTR) == 0) &&
++ (ctxt->replaceEntities == 0) &&
+ (ctxt->validate == 0))
+ return;
+
+@@ -12609,6 +12612,9 @@ xmlIOParseDTD(xmlSAXHandlerPtr sax, xmlParserInputBufferPtr input,
+ return(NULL);
+ }
+
++ /* We are loading a DTD */
++ ctxt->options |= XML_PARSE_DTDLOAD;
++
+ /*
+ * Set-up the SAX context
+ */
+@@ -12736,6 +12742,9 @@ xmlSAXParseDTD(xmlSAXHandlerPtr sax, const xmlChar *ExternalID,
+ return(NULL);
+ }
+
++ /* We are loading a DTD */
++ ctxt->options |= XML_PARSE_DTDLOAD;
++
+ /*
+ * Set-up the SAX context
+ */
diff --git a/debian/patches/series b/debian/patches/series
index 2caba13..ce6e665 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,32 @@
0001-modify-xml2-config-and-pkgconfig-behaviour.patch
-0002-rand_seed-should-be-static-in-dict.c.patch
-0003-Fix-a-thread-portability-problem.patch
-0004-link-libxml2mod-first.patch
+0002-fix-python-multiarch-includes.patch
+0003-Fix-an-error-in-xmlCleanupParser.patch
+0004-Fix-missing-break-on-last-function-for-attributes.patch
+0005-xmllint-memory-should-fail-on-empty-files.patch
+0006-properly-quote-the-namespace-uris-written-out-during.patch
+0007-Fix-a-parsing-bug-on-non-ascii-element-and-CR-LF-usa.patch
+0008-missing-else-in-xlink.c.patch
+0009-Catch-malloc-error-and-exit-accordingly.patch
+0010-Fix-handling-of-mmap-errors.patch
+0011-Avoid-crash-if-allocation-fails.patch
+0012-Fix-a-possible-NULL-dereference.patch
+0013-Clear-up-a-potential-NULL-dereference.patch
+0014-Fix-XPath-optimization-with-predicates.patch
+0015-xmllint-pretty-crashed-without-following-numeric-arg.patch
+0016-Fix-potential-NULL-pointer-dereferences-in-regexp-co.patch
+0017-Fix-a-potential-NULL-dereference-in-tree-code.patch
+0018-Fix-pointer-dereferenced-before-null-check.patch
+0019-Fix-a-bug-loading-some-compressed-files.patch
+0020-Avoid-a-possibility-of-dangling-encoding-handler.patch
+0021-Fix-a-couple-of-missing-NULL-checks.patch
+0022-adding-init-calls-to-xml-and-html-Read-parsing-entry.patch
+0023-Handling-of-XPath-function-arguments-in-error-case.patch
+0024-Missing-initialization-for-the-catalog-module.patch
+0025-Fix-an-fd-leak-in-an-error-case.patch
+0026-fixing-a-ptotential-uninitialized-access.patch
+0027-Fix-xmlTextWriterWriteElement-when-a-null-content-is.patch
+0028-Avoid-a-possible-NULL-pointer-dereference.patch
+0029-Do-not-fetch-external-parameter-entities.patch
+0030-Avoid-Possible-null-pointer-dereference-in-memory-de.patch
+0031-xmllint-was-not-parsing-the-c14n11-flag.patch
+0032-Fix-regressions-introduced-by-CVE-2014-0191-patch.patch
diff --git a/debian/rules b/debian/rules
index 66612bb..9116dbd 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,4 +1,5 @@
#!/usr/bin/make -f
+export DH_VERBOSE=1
include /usr/share/dpkg/architecture.mk
@@ -8,8 +9,10 @@ PYVERS=$(shell pyversions -s)
PYVER=$(shell pyversions -d)
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+CC = $(DEB_HOST_GNU_TYPE)-gcc
CFLAGS = `dpkg-buildflags --get CFLAGS` -Wall
LDFLAGS = `dpkg-buildflags --get LDFLAGS` -Wl,--as-needed
CPPFLAGS = `dpkg-buildflags --get CPPFLAGS`
@@ -29,18 +32,25 @@ $(if $(shell grep -q libxml2-udeb debian/control && echo yes),$(shell sed -i /li
export DH_OPTIONS = -Nlibxml2-udeb
endif
-CACHE_FILE := $(CURDIR)/builddir/config.cache
+ifeq ($(DEB_BUILD_PROFILE),stage1)
+DH_OPTIONS += -Npython-libxml2 -Npython-libxml2-dbg
+export DH_OPTIONS
+endif
-CONFIGURE_FLAGS = --with-history CC="$(CC)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" --cache-file="$(CACHE_FILE)"
+CONFIGURE_FLAGS := --disable-silent-rules --with-history CC="$(CC)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" --cache-file="$(CURDIR)/builddir/config.cache"
override_dh_auto_configure: $(TARGETS:%=doconfigure-%)
-doconfigure-%:
+debian/autoreconf.after:
+ dh_autoreconf
+
+doconfigure-%: debian/autoreconf.after
dh_auto_configure --builddirectory=builddir/$* -- $(CONFIGURE_FLAGS)
doconfigure-main: CONFIGURE_FLAGS += --without-python
doconfigure-python%: CONFIGURE_FLAGS += --with-python=/usr/bin/$*
-doconfigure-udeb: CONFIGURE_FLAGS += --without-history --with-minimum --with-tree --with-output
+#doconfigure-udeb: CONFIGURE_FLAGS += --without-history --with-minimum --with-tree --with-output
+doconfigure-udeb: CONFIGURE_FLAGS += --without-history --with-tree --with-output --without-python
# For dyson we need 32-bit library, but we don't have 32-bit liblzma
doconfigure-32: CONFIGURE_FLAGS += --without-python --libdir=/usr/lib32 --without-lzma
@@ -55,8 +65,11 @@ dobuild-%: doconfigure-%
dh_auto_build --builddirectory=$(BUILD_DIR) -- $(BUILD_FLAGS)
dobuild-python%: BUILD_DIR=builddir/main/$*
-dobuild-python%: BUILD_FLAGS = libxml2mod_la_LIBADD='$$(mylibs)'
-dobuild-python%-dbg: BUILD_FLAGS += PYTHON_INCLUDES=/usr/include/$(*:-dbg=_d) \
+dobuild-python%: BUILD_FLAGS = libxml2mod_la_LIBADD='$$(mylibs)' \
+ PYTHON_INCLUDES="$(shell $(DEB_HOST_GNU_TYPE)-python-config --includes)" \
+ PYTHON_LIBS="$(shell $(DEB_HOST_GNU_TYPE)-python-config --ldflags)"
+dobuild-python%-dbg: BUILD_FLAGS += PYTHON_INCLUDES="$(shell $(DEB_HOST_GNU_TYPE)-python-dbg-config --includes)" \
+ PYTHON_LIBS="$(shell $(DEB_HOST_GNU_TYPE)-python-dbg-config --ldflags)" \
CFLAGS="$(CFLAGS) -Wall -g -O0" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS) \
-L$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)"
build-arch: $(TARGETS:%=dobuild-%)
@@ -96,7 +109,7 @@ doinstall-main:
doinstall-python%-dbg:
$(MAKE) -C builddir/main/python$*-dbg DESTDIR=$(CURDIR)/debian/tmp-dbg install-pythonLTLIBRARIES
- prename 's/(?<!_d)\.so$$/_d.so/' debian/tmp-dbg/usr/lib/python$*/*-packages/*.so
+ prename -vf 's/(?<!_d)\.so$$/_d.so/' debian/tmp-dbg/usr/lib/python$*/*-packages/*.so
doinstall-python%:
dh_auto_install --builddirectory=builddir/main/python$*
@@ -117,14 +130,18 @@ override_dh_installchangelogs:
override_dh_install:
dh_install -Npython-libxml2-dbg -Nlibxml2-udeb
+ifneq ($(DEB_BUILD_PROFILE),stage1)
dh_install -ppython-libxml2-dbg --sourcedir=debian/tmp-dbg
+endif
dh_install -plibxml2-udeb --sourcedir=debian/tmp-udeb
sed -i -e 's,/lib/$(DEB_HOST_MULTIARCH),/lib,' debian/libxml2-dev/usr/bin/xml2-config
override_dh_strip:
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
+ifneq ($(DEB_BUILD_PROFILE),stage1)
dh_strip -ppython-libxml2 --dbg-package=python-libxml2-dbg
+endif
$(foreach python, $(filter-out $(PYVER), $(PYVERS)),\
cd $(CURDIR)/debian/python-libxml2/usr/lib/pyshared; \
if diff $(python)/libxml2mod.so $(PYVER)/libxml2mod.so > /dev/null 2>&1; then \
@@ -137,6 +154,10 @@ override_dh_makeshlibs:
dh_makeshlibs -a $(if $(WITH_UDEB),--add-udeb=libxml2-udeb ) -- -c4
%:
+ifeq ($(DEB_BUILD_PROFILE),stage1)
+ dh $@ --with autoreconf
+else
dh $@ --with autoreconf,python2
+endif
diff --git a/debian/watch b/debian/watch
index fe56c31..ebd77f0 100644
--- a/debian/watch
+++ b/debian/watch
@@ -1,3 +1,3 @@
version=3
-opts=dversionmangle=s/\.dfsg.*$// \
-ftp://xmlsoft.org/libxml2/libxml2-([\d\.]+)\.tar\.gz
+opts=dversionmangle=s/\+(debian|dfsg|ds|deb)\d*$//,uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|BETA|beta|alpha|b|a)[\-\.]?\d*)$/$1~$2/ \
+ftp://xmlsoft.org/libxml2/libxml2-(\d.*)\.(?:tgz|tbz2|txz|tar\.(?:gz|bz2|xz))
diff --git a/debugXML.c b/debugXML.c
index 3874b19..c8efe6a 100644
--- a/debugXML.c
+++ b/debugXML.c
@@ -354,7 +354,6 @@ xmlCtxtGenericNodeCheck(xmlDebugCtxtPtr ctxt, xmlNodePtr node) {
(node->type != XML_ELEMENT_DECL) &&
(node->type != XML_ATTRIBUTE_DECL) &&
(node->type != XML_DTD_NODE) &&
- (node->type != XML_ELEMENT_DECL) &&
(node->type != XML_HTML_DOCUMENT_NODE) &&
(node->type != XML_DOCUMENT_NODE)) {
if (node->content != NULL)
diff --git a/depcomp b/depcomp
index bd0ac08..25a39e6 100755
--- a/depcomp
+++ b/depcomp
@@ -1,10 +1,10 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
-scriptversion=2011-12-04.11; # UTC
+scriptversion=2012-03-27.16; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
-# 2011 Free Software Foundation, Inc.
+# 2011, 2012 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ scriptversion=2011-12-04.11; # UTC
case $1 in
'')
- echo "$0: No command. Try \`$0 --help' for more information." 1>&2
+ echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
@@ -40,8 +40,8 @@ as side-effects.
Environment variables:
depmode Dependency tracking mode.
- source Source file read by `PROGRAMS ARGS'.
- object Object file output by `PROGRAMS ARGS'.
+ source Source file read by 'PROGRAMS ARGS'.
+ object Object file output by 'PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputting dependencies.
@@ -57,6 +57,12 @@ EOF
;;
esac
+# A tabulation character.
+tab=' '
+# A newline character.
+nl='
+'
+
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
@@ -102,6 +108,12 @@ if test "$depmode" = msvc7msys; then
depmode=msvc7
fi
+if test "$depmode" = xlc; then
+ # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
+ gccflag=-qmakedep=gcc,-MF
+ depmode=gcc
+fi
+
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
@@ -156,15 +168,14 @@ gcc)
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
-## This next piece of magic avoids the `deleted header file' problem.
+## This next piece of magic avoids the "deleted header file" problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
- tr ' ' '
-' < "$tmpdepfile" |
-## Some versions of gcc put a space before the `:'. On the theory
+ tr ' ' "$nl" < "$tmpdepfile" |
+## Some versions of gcc put a space before the ':'. On the theory
## that the space means something, we add a space to the output as
## well. hp depmode also adds that space, but also prefixes the VPATH
## to the object. Take care to not repeat it in the output.
@@ -203,18 +214,15 @@ sgi)
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
- # the IRIX cc adds comments like `#:fec' to the end of the
+ # the IRIX cc adds comments like '#:fec' to the end of the
# dependency line.
- tr ' ' '
-' < "$tmpdepfile" \
+ tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
- tr '
-' ' ' >> "$depfile"
+ tr "$nl" ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
- tr ' ' '
-' < "$tmpdepfile" \
+ tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
@@ -226,10 +234,17 @@ sgi)
rm -f "$tmpdepfile"
;;
+xlc)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
- # current directory. Also, the AIX compiler puts `$object:' at the
+ # current directory. Also, the AIX compiler puts '$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
@@ -259,12 +274,11 @@ aix)
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
- # Each line is of the form `foo.o: dependent.h'.
+ # Each line is of the form 'foo.o: dependent.h'.
# Do two passes, one to just change these to
- # `$object: dependent.h' and one to simply `dependent.h:'.
+ # '$object: dependent.h' and one to simply 'dependent.h:'.
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
- # That's a tab and a space in the [].
- sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
@@ -275,23 +289,26 @@ aix)
;;
icc)
- # Intel's C compiler understands `-MD -MF file'. However on
- # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+ # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
+ # However on
+ # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
- # which is wrong. We want:
+ # which is wrong. We want
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
- # and will wrap long lines using \ :
+ # and will wrap long lines using '\':
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
-
+ # tcc 0.9.26 (FIXME still under development at the moment of writing)
+ # will emit a similar output, but also prepend the continuation lines
+ # with horizontal tabulation characters.
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
@@ -300,15 +317,21 @@ icc)
exit $stat
fi
rm -f "$depfile"
- # Each line is of the form `foo.o: dependent.h',
- # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+ # Each line is of the form 'foo.o: dependent.h',
+ # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
# Do two passes, one to just change these to
- # `$object: dependent.h' and one to simply `dependent.h:'.
- sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
- # Some versions of the HPUX 10.20 sed can't process this invocation
- # correctly. Breaking it into two sed invocations is a workaround.
- sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
- sed -e 's/$/ :/' >> "$depfile"
+ # '$object: dependent.h' and one to simply 'dependent.h:'.
+ sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \
+ < "$tmpdepfile" > "$depfile"
+ sed '
+ s/[ '"$tab"'][ '"$tab"']*/ /g
+ s/^ *//
+ s/ *\\*$//
+ s/^[^:]*: *//
+ /^$/d
+ /:$/d
+ s/$/ :/
+ ' < "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile"
;;
@@ -344,7 +367,7 @@ hp2)
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
- # Add `dependent.h:' lines.
+ # Add 'dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
@@ -359,9 +382,9 @@ hp2)
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
- # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+ # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
- # dependencies in `foo.d' instead, so we check for that too.
+ # dependencies in 'foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
@@ -407,8 +430,7 @@ tru64)
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
- # That's a tab and a space in the [].
- sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
@@ -443,11 +465,11 @@ msvc7)
p
}' | $cygpath_u | sort -u | sed -n '
s/ /\\ /g
-s/\(.*\)/ \1 \\/p
+s/\(.*\)/'"$tab"'\1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
- s/.*/ /
+ s/.*/'"$tab"'/
G
p
}' >> "$depfile"
@@ -478,7 +500,7 @@ dashmstdout)
shift
fi
- # Remove `-o $object'.
+ # Remove '-o $object'.
IFS=" "
for arg
do
@@ -498,15 +520,14 @@ dashmstdout)
done
test -z "$dashmflag" && dashmflag=-M
- # Require at least two characters before searching for `:'
+ # Require at least two characters before searching for ':'
# in the target name. This is to cope with DOS-style filenames:
- # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+ # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
"$@" $dashmflag |
- sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
+ sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
- tr ' ' '
-' < "$tmpdepfile" | \
+ tr ' ' "$nl" < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
@@ -562,8 +583,7 @@ makedepend)
# makedepend may prepend the VPATH from the source file name to the object.
# No need to regex-escape $object, excess matching of '.' is harmless.
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
- sed '1,2d' "$tmpdepfile" | tr ' ' '
-' | \
+ sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
@@ -583,7 +603,7 @@ cpp)
shift
fi
- # Remove `-o $object'.
+ # Remove '-o $object'.
IFS=" "
for arg
do
@@ -652,8 +672,8 @@ msvisualcpp)
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
- sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
- echo " " >> "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
+ echo "$tab" >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
diff --git a/dict.c b/dict.c
index 9935a25..5f71d55 100644
--- a/dict.c
+++ b/dict.c
@@ -143,7 +143,7 @@ static int xmlDictInitialized = 0;
/*
* Internal data for random function, protected by xmlDictMutex
*/
-unsigned int rand_seed = 0;
+static unsigned int rand_seed = 0;
#endif
#endif
@@ -151,13 +151,28 @@ unsigned int rand_seed = 0;
* xmlInitializeDict:
*
* Do the dictionary mutex initialization.
- * this function is not thread safe, initialization should
- * preferably be done once at startup
+ * this function is deprecated
*
* Returns 0 if initialization was already done, and 1 if that
* call led to the initialization
*/
int xmlInitializeDict(void) {
+ return(0);
+}
+
+/**
+ * __xmlInitializeDict:
+ *
+ * This function is not public
+ * Do the dictionary mutex initialization.
+ * this function is not thread safe, initialization should
+ * normally be done once at setup when called from xmlOnceInit()
+ * we may also land in this code if thread support is not compiled in
+ *
+ * Returns 0 if initialization was already done, and 1 if that
+ * call led to the initialization
+ */
+int __xmlInitializeDict(void) {
if (xmlDictInitialized)
return(1);
@@ -183,7 +198,7 @@ int __xmlRandom(void) {
int ret;
if (xmlDictInitialized == 0)
- xmlInitializeDict();
+ __xmlInitializeDict();
xmlRMutexLock(xmlDictMutex);
#ifdef HAVE_RAND_R
@@ -522,7 +537,7 @@ xmlDictCreate(void) {
xmlDictPtr dict;
if (!xmlDictInitialized)
- if (!xmlInitializeDict())
+ if (!__xmlInitializeDict())
return(NULL);
#ifdef DICT_DEBUG_PATTERNS
@@ -590,7 +605,7 @@ xmlDictCreateSub(xmlDictPtr sub) {
int
xmlDictReference(xmlDictPtr dict) {
if (!xmlDictInitialized)
- if (!xmlInitializeDict())
+ if (!__xmlInitializeDict())
return(-1);
if (dict == NULL) return -1;
@@ -754,7 +769,7 @@ xmlDictFree(xmlDictPtr dict) {
return;
if (!xmlDictInitialized)
- if (!xmlInitializeDict())
+ if (!__xmlInitializeDict())
return;
/* decrement the counter, it may be shared by a parser and docs */
diff --git a/doc/APIchunk10.html b/doc/APIchunk10.html
index 4c9f892..22d5061 100644
--- a/doc/APIchunk10.html
+++ b/doc/APIchunk10.html
@@ -314,7 +314,8 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-threads.html#xmlNewRMutex">xmlNewRMutex</a><br />
<a href="html/libxml-xmlmemory.html#xmlReallocLoc">xmlReallocLoc</a><br />
<a href="html/libxml-xpath.html#xmlXPathObjectCopy">xmlXPathObjectCopy</a><br />
-</dd><dt>allocation</dt><dd><a href="html/libxml-HTMLparser.html#htmlNewParserCtxt">htmlNewParserCtxt</a><br />
+</dd><dt>allocation</dt><dd><a href="html/libxml-xmlversion.html#LIBXML_THREAD_ALLOC_ENABLED">LIBXML_THREAD_ALLOC_ENABLED</a><br />
+<a href="html/libxml-HTMLparser.html#htmlNewParserCtxt">htmlNewParserCtxt</a><br />
<a href="html/libxml-tree.html#xmlBufferSetAllocationScheme">xmlBufferSetAllocationScheme</a><br />
<a href="html/libxml-tree.html#xmlGetBufferAllocationScheme">xmlGetBufferAllocationScheme</a><br />
<a href="html/libxml-xmlmemory.html#xmlMallocAtomicLoc">xmlMallocAtomicLoc</a><br />
diff --git a/doc/APIchunk12.html b/doc/APIchunk12.html
index 05a6b80..113385b 100644
--- a/doc/APIchunk12.html
+++ b/doc/APIchunk12.html
@@ -657,6 +657,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xpathInternals.html#xmlXPathDistinct">xmlXPathDistinct</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathDistinctSorted">xmlXPathDistinctSorted</a><br />
</dd><dt>contains</dt><dd><a href="html/libxml-schemasInternals.html#XML_SCHEMAS_ATTRGROUP_HAS_REFS">XML_SCHEMAS_ATTRGROUP_HAS_REFS</a><br />
+<a href="html/libxml-entities.html#_xmlEntity">_xmlEntity</a><br />
<a href="html/libxml-parserInternals.html#xmlCurrentChar">xmlCurrentChar</a><br />
<a href="html/libxml-parserInternals.html#xmlParseEntityRef">xmlParseEntityRef</a><br />
<a href="html/libxml-parserInternals.html#xmlParsePEReference">xmlParsePEReference</a><br />
diff --git a/doc/APIchunk13.html b/doc/APIchunk13.html
index c5d3e6a..b1f069d 100644
--- a/doc/APIchunk13.html
+++ b/doc/APIchunk13.html
@@ -242,6 +242,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-parserInternals.html#xmlCheckLanguageID">xmlCheckLanguageID</a><br />
<a href="html/libxml-entities.html#xmlCreateEntitiesTable">xmlCreateEntitiesTable</a><br />
<a href="html/libxml-parserInternals.html#xmlDecodeEntities">xmlDecodeEntities</a><br />
+<a href="html/libxml-dict.html#xmlInitializeDict">xmlInitializeDict</a><br />
<a href="html/libxml-tree.html#xmlNodeDump">xmlNodeDump</a><br />
<a href="html/libxml-parserInternals.html#xmlParserHandleReference">xmlParserHandleReference</a><br />
<a href="html/libxml-parser.html#xmlParserInputRead">xmlParserInputRead</a><br />
diff --git a/doc/APIchunk14.html b/doc/APIchunk14.html
index b30962c..2eac2f6 100644
--- a/doc/APIchunk14.html
+++ b/doc/APIchunk14.html
@@ -313,6 +313,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xpath.html#xmlXPathEvalFunc">xmlXPathEvalFunc</a><br />
<a href="html/libxml-xpath.html#xmlXPathEvalPredicate">xmlXPathEvalPredicate</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathEvaluatePredicateResult">xmlXPathEvaluatePredicateResult</a><br />
+<a href="html/libxml-xpath.html#xmlXPathNodeEval">xmlXPathNodeEval</a><br />
<a href="html/libxml-xpointer.html#xmlXPtrBuildNodeList">xmlXPtrBuildNodeList</a><br />
<a href="html/libxml-xpointer.html#xmlXPtrEval">xmlXPtrEval</a><br />
</dd><dt>evaulation</dt><dd><a href="html/libxml-xmlregexp.html#xmlRegFreeExecCtxt">xmlRegFreeExecCtxt</a><br />
diff --git a/doc/APIchunk16.html b/doc/APIchunk16.html
index 20e90a7..92d3845 100644
--- a/doc/APIchunk16.html
+++ b/doc/APIchunk16.html
@@ -281,6 +281,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-tree.html#xmlNewNsPropEatName">xmlNewNsPropEatName</a><br />
<a href="html/libxml-tree.html#xmlNewProp">xmlNewProp</a><br />
</dd><dt>holds</dt><dd><a href="html/libxml-tree.html#xmlBufferWriteQuotedString">xmlBufferWriteQuotedString</a><br />
+</dd><dt>hooks</dt><dd><a href="html/libxml-xmlversion.html#LIBXML_THREAD_ALLOC_ENABLED">LIBXML_THREAD_ALLOC_ENABLED</a><br />
</dd><dt>host</dt><dd><a href="html/libxml-nanoftp.html#xmlNanoFTPProxy">xmlNanoFTPProxy</a><br />
<a href="html/libxml-nanoftp.html#xmlNanoFTPScanProxy">xmlNanoFTPScanProxy</a><br />
<a href="html/libxml-nanoftp.html#xmlNanoFTPUpdateURL">xmlNanoFTPUpdateURL</a><br />
diff --git a/doc/APIchunk18.html b/doc/APIchunk18.html
index c7eb589..90249a1 100644
--- a/doc/APIchunk18.html
+++ b/doc/APIchunk18.html
@@ -184,12 +184,6 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xmlstring.html#xmlStrndup">xmlStrndup</a><br />
<a href="html/libxml-xmlstring.html#xmlUTF8Strndup">xmlUTF8Strndup</a><br />
<a href="html/libxml-xmlstring.html#xmlUTF8Strsize">xmlUTF8Strsize</a><br />
-</dd><dt>lenght</dt><dd><a href="html/libxml-xmlregexp.html#xmlExpGetLanguage">xmlExpGetLanguage</a><br />
-<a href="html/libxml-xmlregexp.html#xmlExpGetStart">xmlExpGetStart</a><br />
-<a href="html/libxml-xmlregexp.html#xmlExpNewAtom">xmlExpNewAtom</a><br />
-<a href="html/libxml-relaxng.html#xmlRelaxNGValidatePushCData">xmlRelaxNGValidatePushCData</a><br />
-<a href="html/libxml-tree.html#xmlSplitQName3">xmlSplitQName3</a><br />
-<a href="html/libxml-valid.html#xmlValidatePushCData">xmlValidatePushCData</a><br />
</dd><dt>length-1</dt><dd><a href="html/libxml-xpath.html#xmlXPathNodeSetItem">xmlXPathNodeSetItem</a><br />
</dd><dt>less</dt><dd><a href="html/libxml-xmlregexp.html#xmlExpExpDerive">xmlExpExpDerive</a><br />
<a href="html/libxml-xmlsave.html#xmlSaveToFilename">xmlSaveToFilename</a><br />
diff --git a/doc/APIchunk2.html b/doc/APIchunk2.html
index 7fba0b5..1d10f93 100644
--- a/doc/APIchunk2.html
+++ b/doc/APIchunk2.html
@@ -330,6 +330,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xpath.html#xmlXPathEvalExpression">xmlXPathEvalExpression</a><br />
<a href="html/libxml-xpath.html#xmlXPathEvalPredicate">xmlXPathEvalPredicate</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathEvaluatePredicateResult">xmlXPathEvaluatePredicateResult</a><br />
+<a href="html/libxml-xpath.html#xmlXPathNodeEval">xmlXPathNodeEval</a><br />
<a href="html/libxml-xpointer.html#xmlXPtrEval">xmlXPtrEval</a><br />
<a href="html/libxml-xpointer.html#xmlXPtrEvalRangePredicate">xmlXPtrEvalRangePredicate</a><br />
</dd><dt>Evaluates</dt><dd><a href="html/libxml-xmlregexp.html#xmlExpExpDerive">xmlExpExpDerive</a><br />
diff --git a/doc/APIchunk21.html b/doc/APIchunk21.html
index 9c03080..c655198 100644
--- a/doc/APIchunk21.html
+++ b/doc/APIchunk21.html
@@ -135,7 +135,6 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-entities.html#xmlEncodeEntities">xmlEncodeEntities</a><br />
<a href="html/libxml-parser.html#xmlInitParser">xmlInitParser</a><br />
<a href="html/libxml-catalog.html#xmlInitializeCatalog">xmlInitializeCatalog</a><br />
-<a href="html/libxml-dict.html#xmlInitializeDict">xmlInitializeDict</a><br />
<a href="html/libxml-catalog.html#xmlLoadCatalog">xmlLoadCatalog</a><br />
<a href="html/libxml-catalog.html#xmlLoadCatalogs">xmlLoadCatalogs</a><br />
<a href="html/libxml-parserInternals.html#xmlParseAttributeType">xmlParseAttributeType</a><br />
diff --git a/doc/APIchunk22.html b/doc/APIchunk22.html
index bf76a9c..2f20018 100644
--- a/doc/APIchunk22.html
+++ b/doc/APIchunk22.html
@@ -151,6 +151,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-parserInternals.html#xmlParseAttributeType">xmlParseAttributeType</a><br />
<a href="html/libxml-valid.html#xmlValidateElementDecl">xmlValidateElementDecl</a><br />
<a href="html/libxml-xpath.html#xmlXPathContextSetCache">xmlXPathContextSetCache</a><br />
+</dd><dt>per-thread</dt><dd><a href="html/libxml-xmlversion.html#LIBXML_THREAD_ALLOC_ENABLED">LIBXML_THREAD_ALLOC_ENABLED</a><br />
</dd><dt>performance</dt><dd><a href="html/libxml-tree.html#xmlGetBufferAllocationScheme">xmlGetBufferAllocationScheme</a><br />
<a href="html/libxml-tree.html#xmlSetBufferAllocationScheme">xmlSetBufferAllocationScheme</a><br />
</dd><dt>performed</dt><dd><a href="html/libxml-HTMLparser.html#htmlNodeStatus">htmlNodeStatus</a><br />
@@ -295,7 +296,6 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xpathInternals.html#xmlXPathEvaluatePredicateResult">xmlXPathEvaluatePredicateResult</a><br />
<a href="html/libxml-xpointer.html#xmlXPtrEvalRangePredicate">xmlXPtrEvalRangePredicate</a><br />
</dd><dt>preferably</dt><dd><a href="html/libxml-catalog.html#xmlInitializeCatalog">xmlInitializeCatalog</a><br />
-<a href="html/libxml-dict.html#xmlInitializeDict">xmlInitializeDict</a><br />
<a href="html/libxml-catalog.html#xmlLoadCatalog">xmlLoadCatalog</a><br />
<a href="html/libxml-catalog.html#xmlLoadCatalogs">xmlLoadCatalogs</a><br />
<a href="html/libxml-tree.html#xmlNewPI">xmlNewPI</a><br />
diff --git a/doc/APIchunk23.html b/doc/APIchunk23.html
index 2908b82..16c7c21 100644
--- a/doc/APIchunk23.html
+++ b/doc/APIchunk23.html
@@ -522,6 +522,7 @@ A:link, A:visited, A:active { text-decoration: underline }
</dd><dt>restored</dt><dd><a href="html/libxml-xmlschemas.html#xmlSchemaSAXUnplug">xmlSchemaSAXUnplug</a><br />
<a href="html/libxml-xmlreader.html#xmlTextReaderSetErrorHandler">xmlTextReaderSetErrorHandler</a><br />
<a href="html/libxml-xmlreader.html#xmlTextReaderSetStructuredErrorHandler">xmlTextReaderSetStructuredErrorHandler</a><br />
+<a href="html/libxml-xpath.html#xmlXPathNodeEval">xmlXPathNodeEval</a><br />
</dd><dt>restrict</dt><dd><a href="html/libxml-parserInternals.html#xmlParseExternalID">xmlParseExternalID</a><br />
</dd><dt>restriction</dt><dd><a href="html/libxml-schemasInternals.html#XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION">XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION</a><br />
<a href="html/libxml-schemasInternals.html#XML_SCHEMAS_ELEM_BLOCK_RESTRICTION">XML_SCHEMAS_ELEM_BLOCK_RESTRICTION</a><br />
diff --git a/doc/APIchunk24.html b/doc/APIchunk24.html
index cd45121..e81f34d 100644
--- a/doc/APIchunk24.html
+++ b/doc/APIchunk24.html
@@ -40,7 +40,6 @@ A:link, A:visited, A:active { text-decoration: underline }
</h2><h2>Letter s:</h2><dl><dt>s390</dt><dd><a href="html/libxml-hash.html#XML_CAST_FPTR">XML_CAST_FPTR</a><br />
</dd><dt>safe</dt><dd><a href="html/libxml-xmlstring.html#BAD_CAST">BAD_CAST</a><br />
<a href="html/libxml-catalog.html#xmlInitializeCatalog">xmlInitializeCatalog</a><br />
-<a href="html/libxml-dict.html#xmlInitializeDict">xmlInitializeDict</a><br />
<a href="html/libxml-catalog.html#xmlLoadCatalog">xmlLoadCatalog</a><br />
<a href="html/libxml-catalog.html#xmlLoadCatalogs">xmlLoadCatalogs</a><br />
</dd><dt>safety</dt><dd><a href="html/libxml-parserInternals.html#XML_MAX_DICTIONARY_LIMIT">XML_MAX_DICTIONARY_LIMIT</a><br />
@@ -68,6 +67,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xpathInternals.html#xmlXPathNextFollowing">xmlXPathNextFollowing</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNextPreceding">xmlXPathNextPreceding</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNormalizeFunction">xmlXPathNormalizeFunction</a><br />
+<a href="html/libxml-xpath.html#xmlXPathSetContextNode">xmlXPathSetContextNode</a><br />
</dd><dt>save</dt><dd><a href="html/libxml-HTMLtree.html#htmlNodeDumpFileFormat">htmlNodeDumpFileFormat</a><br />
<a href="html/libxml-xmlmemory.html#xmlGcMemGet">xmlGcMemGet</a><br />
<a href="html/libxml-xmlmemory.html#xmlMemGet">xmlMemGet</a><br />
@@ -645,7 +645,6 @@ A:link, A:visited, A:active { text-decoration: underline }
</dd><dt>startup</dt><dd><a href="html/libxml-SAX.html#setDocumentLocator">setDocumentLocator</a><br />
<a href="html/libxml-parser.html#setDocumentLocatorSAXFunc">setDocumentLocatorSAXFunc</a><br />
<a href="html/libxml-catalog.html#xmlInitializeCatalog">xmlInitializeCatalog</a><br />
-<a href="html/libxml-dict.html#xmlInitializeDict">xmlInitializeDict</a><br />
<a href="html/libxml-catalog.html#xmlLoadCatalog">xmlLoadCatalog</a><br />
<a href="html/libxml-catalog.html#xmlLoadCatalogs">xmlLoadCatalogs</a><br />
<a href="html/libxml-SAX2.html#xmlSAX2SetDocumentLocator">xmlSAX2SetDocumentLocator</a><br />
@@ -902,6 +901,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xmlreader.html#xmlTextReaderSetParserProp">xmlTextReaderSetParserProp</a><br />
<a href="html/libxml-tree.html#xmlUnsetNsProp">xmlUnsetNsProp</a><br />
<a href="html/libxml-tree.html#xmlUnsetProp">xmlUnsetProp</a><br />
+<a href="html/libxml-xpath.html#xmlXPathSetContextNode">xmlXPathSetContextNode</a><br />
</dd><dt>successfully</dt><dd><a href="html/libxml-xmlreader.html#xmlTextReaderNext">xmlTextReaderNext</a><br />
<a href="html/libxml-xmlreader.html#xmlTextReaderNextSibling">xmlTextReaderNextSibling</a><br />
<a href="html/libxml-xmlreader.html#xmlTextReaderRead">xmlTextReaderRead</a><br />
diff --git a/doc/APIchunk25.html b/doc/APIchunk25.html
index de57ec4..dec65ba 100644
--- a/doc/APIchunk25.html
+++ b/doc/APIchunk25.html
@@ -173,7 +173,6 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-threads.html#xmlGetThreadId">xmlGetThreadId</a><br />
<a href="html/libxml-threads.html#xmlInitThreads">xmlInitThreads</a><br />
<a href="html/libxml-catalog.html#xmlInitializeCatalog">xmlInitializeCatalog</a><br />
-<a href="html/libxml-dict.html#xmlInitializeDict">xmlInitializeDict</a><br />
<a href="html/libxml-threads.html#xmlIsMainThread">xmlIsMainThread</a><br />
<a href="html/libxml-catalog.html#xmlLoadCatalog">xmlLoadCatalog</a><br />
<a href="html/libxml-catalog.html#xmlLoadCatalogs">xmlLoadCatalogs</a><br />
diff --git a/doc/APIchunk26.html b/doc/APIchunk26.html
index 50e814f..17666cf 100644
--- a/doc/APIchunk26.html
+++ b/doc/APIchunk26.html
@@ -298,6 +298,7 @@ A:link, A:visited, A:active { text-decoration: underline }
</dd><dt>void</dt><dd><a href="html/libxml-hash.html#XML_CAST_FPTR">XML_CAST_FPTR</a><br />
<a href="html/libxml-parser.html#xmlSAXParseFileWithData">xmlSAXParseFileWithData</a><br />
<a href="html/libxml-parser.html#xmlSAXParseMemoryWithData">xmlSAXParseMemoryWithData</a><br />
+</dd><dt>volume</dt><dd><a href="html/libxml-parser.html#_xmlParserCtxt">_xmlParserCtxt</a><br />
</dd></dl><h2 align="center"><a href="APIchunk0.html">A-B</a>
<a href="APIchunk1.html">C-C</a>
<a href="APIchunk2.html">D-E</a>
diff --git a/doc/APIchunk28.html b/doc/APIchunk28.html
index a009f5f..c5993f9 100644
--- a/doc/APIchunk28.html
+++ b/doc/APIchunk28.html
@@ -498,6 +498,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xpathInternals.html#xmlXPathNewNodeSetList">xmlXPathNewNodeSetList</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNewString">xmlXPathNewString</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNewValueTree">xmlXPathNewValueTree</a><br />
+<a href="html/libxml-xpath.html#xmlXPathNodeEval">xmlXPathNodeEval</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathWrapNodeSet">xmlXPathWrapNodeSet</a><br />
<a href="html/libxml-xpointer.html#xmlXPtrEval">xmlXPtrEval</a><br />
<a href="html/libxml-xpointer.html#xmlXPtrLocationSetAdd">xmlXPtrLocationSetAdd</a><br />
diff --git a/doc/APIchunk4.html b/doc/APIchunk4.html
index cbafa23..d26883b 100644
--- a/doc/APIchunk4.html
+++ b/doc/APIchunk4.html
@@ -91,6 +91,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-parserInternals.html#xmlSplitQName">xmlSplitQName</a><br />
<a href="html/libxml-tree.html#xmlSplitQName2">xmlSplitQName2</a><br />
</dd><dt>Location</dt><dd><a href="html/libxml-xpath.html#xmlXPathEval">xmlXPathEval</a><br />
+<a href="html/libxml-xpath.html#xmlXPathNodeEval">xmlXPathNodeEval</a><br />
<a href="html/libxml-xpointer.html#xmlXPtrEval">xmlXPtrEval</a><br />
<a href="html/libxml-xpointer.html#xmlXPtrEvalRangePredicate">xmlXPtrEvalRangePredicate</a><br />
</dd><dt>LocationSet</dt><dd><a href="html/libxml-xpointer.html#xmlXPtrFreeLocationSet">xmlXPtrFreeLocationSet</a><br />
diff --git a/doc/APIchunk5.html b/doc/APIchunk5.html
index e4c9550..da60d1a 100644
--- a/doc/APIchunk5.html
+++ b/doc/APIchunk5.html
@@ -149,6 +149,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xmlschemastypes.html#xmlSchemaGetBuiltInListSimpleTypeItemType">xmlSchemaGetBuiltInListSimpleTypeItemType</a><br />
</dd><dt>Path</dt><dd><a href="html/libxml-tree.html#xmlGetNodePath">xmlGetNodePath</a><br />
<a href="html/libxml-xpath.html#xmlXPathEval">xmlXPathEval</a><br />
+<a href="html/libxml-xpath.html#xmlXPathNodeEval">xmlXPathNodeEval</a><br />
<a href="html/libxml-xpointer.html#xmlXPtrEval">xmlXPtrEval</a><br />
</dd><dt>People</dt><dd><a href="html/libxml-entities.html#xmlEncodeEntities">xmlEncodeEntities</a><br />
</dd><dt>PhoneticExtensions</dt><dd><a href="html/libxml-xmlunicode.html#xmlUCSIsPhoneticExtensions">xmlUCSIsPhoneticExtensions</a><br />
diff --git a/doc/APIchunk7.html b/doc/APIchunk7.html
index c556bb2..3f46f99 100644
--- a/doc/APIchunk7.html
+++ b/doc/APIchunk7.html
@@ -185,6 +185,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xpathInternals.html#xmlXPathNodeLeadingSorted">xmlXPathNodeLeadingSorted</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNodeTrailing">xmlXPathNodeTrailing</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNodeTrailingSorted">xmlXPathNodeTrailingSorted</a><br />
+<a href="html/libxml-xpath.html#xmlXPathSetContextNode">xmlXPathSetContextNode</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathTrailing">xmlXPathTrailing</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathTrailingSorted">xmlXPathTrailingSorted</a><br />
</dd><dt>Setting</dt><dd><a href="html/libxml-xmlschemas.html#xmlSchemaValidateSetLocator">xmlSchemaValidateSetLocator</a><br />
diff --git a/doc/APIconstructors.html b/doc/APIconstructors.html
index c6c4475..d5ca488 100644
--- a/doc/APIconstructors.html
+++ b/doc/APIconstructors.html
@@ -571,6 +571,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xpathInternals.html#xmlXPathNewNodeSetList">xmlXPathNewNodeSetList</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNewString">xmlXPathNewString</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNewValueTree">xmlXPathNewValueTree</a><br />
+<a href="html/libxml-xpath.html#xmlXPathNodeEval">xmlXPathNodeEval</a><br />
<a href="html/libxml-xpath.html#xmlXPathObjectCopy">xmlXPathObjectCopy</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathVariableLookup">xmlXPathVariableLookup</a><br />
<a href="html/libxml-xpath.html#xmlXPathVariableLookupFunc">xmlXPathVariableLookupFunc</a><br />
diff --git a/doc/APIfiles.html b/doc/APIfiles.html
index 498f6e4..65e004b 100644
--- a/doc/APIfiles.html
+++ b/doc/APIfiles.html
@@ -2026,6 +2026,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xmlerror.html#XML_ERR_UNSUPPORTED_ENCODING">XML_ERR_UNSUPPORTED_ENCODING</a><br />
<a href="html/libxml-xmlerror.html#XML_ERR_URI_FRAGMENT">XML_ERR_URI_FRAGMENT</a><br />
<a href="html/libxml-xmlerror.html#XML_ERR_URI_REQUIRED">XML_ERR_URI_REQUIRED</a><br />
+<a href="html/libxml-xmlerror.html#XML_ERR_USER_STOP">XML_ERR_USER_STOP</a><br />
<a href="html/libxml-xmlerror.html#XML_ERR_VALUE_REQUIRED">XML_ERR_VALUE_REQUIRED</a><br />
<a href="html/libxml-xmlerror.html#XML_ERR_VERSION_MISMATCH">XML_ERR_VERSION_MISMATCH</a><br />
<a href="html/libxml-xmlerror.html#XML_ERR_VERSION_MISSING">XML_ERR_VERSION_MISSING</a><br />
@@ -3199,6 +3200,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xmlversion.html#LIBXML_SCHEMAS_ENABLED">LIBXML_SCHEMAS_ENABLED</a><br />
<a href="html/libxml-xmlversion.html#LIBXML_SCHEMATRON_ENABLED">LIBXML_SCHEMATRON_ENABLED</a><br />
<a href="html/libxml-xmlversion.html#LIBXML_TEST_VERSION">LIBXML_TEST_VERSION</a><br />
+<a href="html/libxml-xmlversion.html#LIBXML_THREAD_ALLOC_ENABLED">LIBXML_THREAD_ALLOC_ENABLED</a><br />
<a href="html/libxml-xmlversion.html#LIBXML_THREAD_ENABLED">LIBXML_THREAD_ENABLED</a><br />
<a href="html/libxml-xmlversion.html#LIBXML_TREE_ENABLED">LIBXML_TREE_ENABLED</a><br />
<a href="html/libxml-xmlversion.html#LIBXML_UNICODE_ENABLED">LIBXML_UNICODE_ENABLED</a><br />
@@ -3396,6 +3398,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xpath.html#xmlXPathNAN">xmlXPathNAN</a><br />
<a href="html/libxml-xpath.html#xmlXPathNINF">xmlXPathNINF</a><br />
<a href="html/libxml-xpath.html#xmlXPathNewContext">xmlXPathNewContext</a><br />
+<a href="html/libxml-xpath.html#xmlXPathNodeEval">xmlXPathNodeEval</a><br />
<a href="html/libxml-xpath.html#xmlXPathNodeSetCreate">xmlXPathNodeSetCreate</a><br />
<a href="html/libxml-xpath.html#xmlXPathNodeSetGetLength">xmlXPathNodeSetGetLength</a><br />
<a href="html/libxml-xpath.html#xmlXPathNodeSetIsEmpty">xmlXPathNodeSetIsEmpty</a><br />
@@ -3408,6 +3411,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xpath.html#xmlXPathPINF">xmlXPathPINF</a><br />
<a href="html/libxml-xpath.html#xmlXPathParserContext">xmlXPathParserContext</a><br />
<a href="html/libxml-xpath.html#xmlXPathParserContextPtr">xmlXPathParserContextPtr</a><br />
+<a href="html/libxml-xpath.html#xmlXPathSetContextNode">xmlXPathSetContextNode</a><br />
<a href="html/libxml-xpath.html#xmlXPathType">xmlXPathType</a><br />
<a href="html/libxml-xpath.html#xmlXPathTypePtr">xmlXPathTypePtr</a><br />
<a href="html/libxml-xpath.html#xmlXPathVariable">xmlXPathVariable</a><br />
diff --git a/doc/APIfunctions.html b/doc/APIfunctions.html
index 68eeb14..3c47863 100644
--- a/doc/APIfunctions.html
+++ b/doc/APIfunctions.html
@@ -489,6 +489,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xpathInternals.html#xmlXPathIsNodeType">xmlXPathIsNodeType</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNewParserContext">xmlXPathNewParserContext</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNewString">xmlXPathNewString</a><br />
+<a href="html/libxml-xpath.html#xmlXPathNodeEval">xmlXPathNodeEval</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNsLookup">xmlXPathNsLookup</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathRegisterFunc">xmlXPathRegisterFunc</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathRegisterFuncNS">xmlXPathRegisterFuncNS</a><br />
@@ -1582,6 +1583,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xpathInternals.html#xmlXPathNextPreceding">xmlXPathNextPreceding</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNextPrecedingSibling">xmlXPathNextPrecedingSibling</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNextSelf">xmlXPathNextSelf</a><br />
+<a href="html/libxml-xpath.html#xmlXPathNodeEval">xmlXPathNodeEval</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNodeLeading">xmlXPathNodeLeading</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNodeLeadingSorted">xmlXPathNodeLeadingSorted</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNodeSetAdd">xmlXPathNodeSetAdd</a><br />
@@ -1592,6 +1594,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xpathInternals.html#xmlXPathNodeSetDel">xmlXPathNodeSetDel</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNodeTrailing">xmlXPathNodeTrailing</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNodeTrailingSorted">xmlXPathNodeTrailingSorted</a><br />
+<a href="html/libxml-xpath.html#xmlXPathSetContextNode">xmlXPathSetContextNode</a><br />
<a href="html/libxml-xpointer.html#xmlXPtrNewCollapsedRange">xmlXPtrNewCollapsedRange</a><br />
<a href="html/libxml-xpointer.html#xmlXPtrNewContext">xmlXPtrNewContext</a><br />
<a href="html/libxml-xpointer.html#xmlXPtrNewLocationSetNodes">xmlXPtrNewLocationSetNodes</a><br />
@@ -2226,6 +2229,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xpathInternals.html#xmlXPathFunctionLookup">xmlXPathFunctionLookup</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathFunctionLookupNS">xmlXPathFunctionLookupNS</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNewParserContext">xmlXPathNewParserContext</a><br />
+<a href="html/libxml-xpath.html#xmlXPathNodeEval">xmlXPathNodeEval</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNsLookup">xmlXPathNsLookup</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathRegisterAllFunctions">xmlXPathRegisterAllFunctions</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathRegisterFunc">xmlXPathRegisterFunc</a><br />
@@ -2238,6 +2242,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xpathInternals.html#xmlXPathRegisteredFuncsCleanup">xmlXPathRegisteredFuncsCleanup</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathRegisteredNsCleanup">xmlXPathRegisteredNsCleanup</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathRegisteredVariablesCleanup">xmlXPathRegisteredVariablesCleanup</a><br />
+<a href="html/libxml-xpath.html#xmlXPathSetContextNode">xmlXPathSetContextNode</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathVariableLookup">xmlXPathVariableLookup</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathVariableLookupNS">xmlXPathVariableLookupNS</a><br />
<a href="html/libxml-xpointer.html#xmlXPtrEval">xmlXPtrEval</a><br />
diff --git a/doc/APIsymbols.html b/doc/APIsymbols.html
index fa9f4c8..c2b82e7 100644
--- a/doc/APIsymbols.html
+++ b/doc/APIsymbols.html
@@ -92,6 +92,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xmlversion.html#LIBXML_SCHEMAS_ENABLED">LIBXML_SCHEMAS_ENABLED</a><br />
<a href="html/libxml-xmlversion.html#LIBXML_SCHEMATRON_ENABLED">LIBXML_SCHEMATRON_ENABLED</a><br />
<a href="html/libxml-xmlversion.html#LIBXML_TEST_VERSION">LIBXML_TEST_VERSION</a><br />
+<a href="html/libxml-xmlversion.html#LIBXML_THREAD_ALLOC_ENABLED">LIBXML_THREAD_ALLOC_ENABLED</a><br />
<a href="html/libxml-xmlversion.html#LIBXML_THREAD_ENABLED">LIBXML_THREAD_ENABLED</a><br />
<a href="html/libxml-xmlversion.html#LIBXML_TREE_ENABLED">LIBXML_TREE_ENABLED</a><br />
<a href="html/libxml-xmlversion.html#LIBXML_UNICODE_ENABLED">LIBXML_UNICODE_ENABLED</a><br />
@@ -425,6 +426,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xmlerror.html#XML_ERR_UNSUPPORTED_ENCODING">XML_ERR_UNSUPPORTED_ENCODING</a><br />
<a href="html/libxml-xmlerror.html#XML_ERR_URI_FRAGMENT">XML_ERR_URI_FRAGMENT</a><br />
<a href="html/libxml-xmlerror.html#XML_ERR_URI_REQUIRED">XML_ERR_URI_REQUIRED</a><br />
+<a href="html/libxml-xmlerror.html#XML_ERR_USER_STOP">XML_ERR_USER_STOP</a><br />
<a href="html/libxml-xmlerror.html#XML_ERR_VALUE_REQUIRED">XML_ERR_VALUE_REQUIRED</a><br />
<a href="html/libxml-xmlerror.html#XML_ERR_VERSION_MISMATCH">XML_ERR_VERSION_MISMATCH</a><br />
<a href="html/libxml-xmlerror.html#XML_ERR_VERSION_MISSING">XML_ERR_VERSION_MISSING</a><br />
@@ -3467,6 +3469,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xpathInternals.html#xmlXPathNextPreceding">xmlXPathNextPreceding</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNextPrecedingSibling">xmlXPathNextPrecedingSibling</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNextSelf">xmlXPathNextSelf</a><br />
+<a href="html/libxml-xpath.html#xmlXPathNodeEval">xmlXPathNodeEval</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNodeLeading">xmlXPathNodeLeading</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNodeLeadingSorted">xmlXPathNodeLeadingSorted</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathNodeSetAdd">xmlXPathNodeSetAdd</a><br />
@@ -3528,6 +3531,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xpathInternals.html#xmlXPathRoot">xmlXPathRoot</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathRoundFunction">xmlXPathRoundFunction</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathSetArityError">xmlXPathSetArityError</a><br />
+<a href="html/libxml-xpath.html#xmlXPathSetContextNode">xmlXPathSetContextNode</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathSetError">xmlXPathSetError</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathSetTypeError">xmlXPathSetTypeError</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathStackIsExternal">xmlXPathStackIsExternal</a><br />
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 08c0b45..0cc0a50 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -143,6 +143,7 @@ EXTRA_DIST = \
html/libxml-xpath.html \
html/libxml-xpathInternals.html \
html/libxml-xpointer.html \
+ html/libxml-xzlib.html \
html/right.png \
html/up.png \
index.html \
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 92e08cd..997026a 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -15,6 +15,23 @@
@SET_MAKE@
VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -61,6 +78,11 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -222,7 +244,6 @@ RANLIB = @RANLIB@
RDL_LIBS = @RDL_LIBS@
READER_TEST = @READER_TEST@
RELDATE = @RELDATE@
-RM = @RM@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
@@ -279,6 +300,7 @@ 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@
@@ -495,6 +517,7 @@ EXTRA_DIST = \
html/libxml-xpath.html \
html/libxml-xpathInternals.html \
html/libxml-xpointer.html \
+ html/libxml-xzlib.html \
html/right.png \
html/up.png \
index.html \
@@ -634,11 +657,18 @@ clean-libtool:
-rm -rf .libs _libs
install-man1: $(man_MANS)
@$(NORMAL_INSTALL)
- test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
- @list=''; test -n "$(man1dir)" || exit 0; \
- { for i in $$list; do echo "$$i"; done; \
- l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
- sed -n '/\.1[a-z]*$$/p'; \
+ @list1=''; \
+ list2='$(man_MANS)'; \
+ test -n "$(man1dir)" \
+ && test -n "`echo $$list1$$list2`" \
+ || exit 0; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
+ { for i in $$list1; do echo "$$i"; done; \
+ if test -n "$$list2"; then \
+ for i in $$list2; do echo "$$i"; done \
+ | sed -n '/\.1[a-z]*$$/p'; \
+ fi; \
} | while read p; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; echo "$$p"; \
@@ -849,13 +879,10 @@ distdir: $(DISTFILES)
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
- test -d "$(distdir)/$$subdir" \
- || $(MKDIR_P) "$(distdir)/$$subdir" \
- || exit 1; \
- fi; \
- done
- @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
+ $(am__make_dryrun) \
+ || test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
diff --git a/doc/apibuild.py b/doc/apibuild.py
index 25f0210..b5b669a 100755
--- a/doc/apibuild.py
+++ b/doc/apibuild.py
@@ -84,51 +84,51 @@ ignored_words = {
}
def escape(raw):
- raw = string.replace(raw, '&', '&amp;')
- raw = string.replace(raw, '<', '&lt;')
- raw = string.replace(raw, '>', '&gt;')
- raw = string.replace(raw, "'", '&apos;')
- raw = string.replace(raw, '"', '&quot;')
+ raw = raw.replace('&', '&amp;')
+ raw = raw.replace('<', '&lt;')
+ raw = raw.replace('>', '&gt;')
+ raw = raw.replace("'", '&apos;')
+ raw = raw.replace('"', '&quot;')
return raw
def uniq(items):
d = {}
for item in items:
d[item]=1
- return d.keys()
+ return list(d.keys())
class identifier:
def __init__(self, name, header=None, module=None, type=None, lineno = 0,
info=None, extra=None, conditionals = None):
self.name = name
- self.header = header
- self.module = module
- self.type = type
- self.info = info
- self.extra = extra
- self.lineno = lineno
- self.static = 0
- if conditionals == None or len(conditionals) == 0:
- self.conditionals = None
- else:
- self.conditionals = conditionals[:]
- if self.name == debugsym:
- print "=> define %s : %s" % (debugsym, (module, type, info,
- extra, conditionals))
+ self.header = header
+ self.module = module
+ self.type = type
+ self.info = info
+ self.extra = extra
+ self.lineno = lineno
+ self.static = 0
+ if conditionals == None or len(conditionals) == 0:
+ self.conditionals = None
+ else:
+ self.conditionals = conditionals[:]
+ if self.name == debugsym:
+ print("=> define %s : %s" % (debugsym, (module, type, info,
+ extra, conditionals)))
def __repr__(self):
r = "%s %s:" % (self.type, self.name)
- if self.static:
- r = r + " static"
- if self.module != None:
- r = r + " from %s" % (self.module)
- if self.info != None:
- r = r + " " + `self.info`
- if self.extra != None:
- r = r + " " + `self.extra`
- if self.conditionals != None:
- r = r + " " + `self.conditionals`
- return r
+ if self.static:
+ r = r + " static"
+ if self.module != None:
+ r = r + " from %s" % (self.module)
+ if self.info != None:
+ r = r + " " + repr(self.info)
+ if self.extra != None:
+ r = r + " " + repr(self.extra)
+ if self.conditionals != None:
+ r = r + " " + repr(self.conditionals)
+ return r
def set_header(self, header):
@@ -146,10 +146,10 @@ class identifier:
def set_static(self, static):
self.static = static
def set_conditionals(self, conditionals):
- if conditionals == None or len(conditionals) == 0:
- self.conditionals = None
- else:
- self.conditionals = conditionals[:]
+ if conditionals == None or len(conditionals) == 0:
+ self.conditionals = None
+ else:
+ self.conditionals = conditionals[:]
def get_name(self):
return self.name
@@ -172,231 +172,231 @@ class identifier:
def update(self, header, module, type = None, info = None, extra=None,
conditionals=None):
- if self.name == debugsym:
- print "=> update %s : %s" % (debugsym, (module, type, info,
- extra, conditionals))
+ if self.name == debugsym:
+ print("=> update %s : %s" % (debugsym, (module, type, info,
+ extra, conditionals)))
if header != None and self.header == None:
- self.set_header(module)
+ self.set_header(module)
if module != None and (self.module == None or self.header == self.module):
- self.set_module(module)
+ self.set_module(module)
if type != None and self.type == None:
- self.set_type(type)
+ self.set_type(type)
if info != None:
- self.set_info(info)
+ self.set_info(info)
if extra != None:
- self.set_extra(extra)
+ self.set_extra(extra)
if conditionals != None:
- self.set_conditionals(conditionals)
+ self.set_conditionals(conditionals)
class index:
def __init__(self, name = "noname"):
self.name = name
self.identifiers = {}
self.functions = {}
- self.variables = {}
- self.includes = {}
- self.structs = {}
- self.enums = {}
- self.typedefs = {}
- self.macros = {}
- self.references = {}
- self.info = {}
+ self.variables = {}
+ self.includes = {}
+ self.structs = {}
+ self.enums = {}
+ self.typedefs = {}
+ self.macros = {}
+ self.references = {}
+ self.info = {}
def add_ref(self, name, header, module, static, type, lineno, info=None, extra=None, conditionals = None):
if name[0:2] == '__':
- return None
+ return None
d = None
try:
- d = self.identifiers[name]
- d.update(header, module, type, lineno, info, extra, conditionals)
- except:
- d = identifier(name, header, module, type, lineno, info, extra, conditionals)
- self.identifiers[name] = d
+ d = self.identifiers[name]
+ d.update(header, module, type, lineno, info, extra, conditionals)
+ except:
+ d = identifier(name, header, module, type, lineno, info, extra, conditionals)
+ self.identifiers[name] = d
- if d != None and static == 1:
- d.set_static(1)
+ if d != None and static == 1:
+ d.set_static(1)
- if d != None and name != None and type != None:
- self.references[name] = d
+ if d != None and name != None and type != None:
+ self.references[name] = d
- if name == debugsym:
- print "New ref: %s" % (d)
+ if name == debugsym:
+ print("New ref: %s" % (d))
- return d
+ return d
def add(self, name, header, module, static, type, lineno, info=None, extra=None, conditionals = None):
if name[0:2] == '__':
- return None
+ return None
d = None
try:
- d = self.identifiers[name]
- d.update(header, module, type, lineno, info, extra, conditionals)
- except:
- d = identifier(name, header, module, type, lineno, info, extra, conditionals)
- self.identifiers[name] = d
-
- if d != None and static == 1:
- d.set_static(1)
-
- if d != None and name != None and type != None:
- if type == "function":
- self.functions[name] = d
- elif type == "functype":
- self.functions[name] = d
- elif type == "variable":
- self.variables[name] = d
- elif type == "include":
- self.includes[name] = d
- elif type == "struct":
- self.structs[name] = d
- elif type == "enum":
- self.enums[name] = d
- elif type == "typedef":
- self.typedefs[name] = d
- elif type == "macro":
- self.macros[name] = d
- else:
- print "Unable to register type ", type
-
- if name == debugsym:
- print "New symbol: %s" % (d)
-
- return d
+ d = self.identifiers[name]
+ d.update(header, module, type, lineno, info, extra, conditionals)
+ except:
+ d = identifier(name, header, module, type, lineno, info, extra, conditionals)
+ self.identifiers[name] = d
+
+ if d != None and static == 1:
+ d.set_static(1)
+
+ if d != None and name != None and type != None:
+ if type == "function":
+ self.functions[name] = d
+ elif type == "functype":
+ self.functions[name] = d
+ elif type == "variable":
+ self.variables[name] = d
+ elif type == "include":
+ self.includes[name] = d
+ elif type == "struct":
+ self.structs[name] = d
+ elif type == "enum":
+ self.enums[name] = d
+ elif type == "typedef":
+ self.typedefs[name] = d
+ elif type == "macro":
+ self.macros[name] = d
+ else:
+ print("Unable to register type ", type)
+
+ if name == debugsym:
+ print("New symbol: %s" % (d))
+
+ return d
def merge(self, idx):
- for id in idx.functions.keys():
+ for id in list(idx.functions.keys()):
#
# macro might be used to override functions or variables
# definitions
#
- if self.macros.has_key(id):
- del self.macros[id]
- if self.functions.has_key(id):
- print "function %s from %s redeclared in %s" % (
- id, self.functions[id].header, idx.functions[id].header)
- else:
- self.functions[id] = idx.functions[id]
- self.identifiers[id] = idx.functions[id]
- for id in idx.variables.keys():
+ if id in self.macros:
+ del self.macros[id]
+ if id in self.functions:
+ print("function %s from %s redeclared in %s" % (
+ id, self.functions[id].header, idx.functions[id].header))
+ else:
+ self.functions[id] = idx.functions[id]
+ self.identifiers[id] = idx.functions[id]
+ for id in list(idx.variables.keys()):
#
# macro might be used to override functions or variables
# definitions
#
- if self.macros.has_key(id):
- del self.macros[id]
- if self.variables.has_key(id):
- print "variable %s from %s redeclared in %s" % (
- id, self.variables[id].header, idx.variables[id].header)
- else:
- self.variables[id] = idx.variables[id]
- self.identifiers[id] = idx.variables[id]
- for id in idx.structs.keys():
- if self.structs.has_key(id):
- print "struct %s from %s redeclared in %s" % (
- id, self.structs[id].header, idx.structs[id].header)
- else:
- self.structs[id] = idx.structs[id]
- self.identifiers[id] = idx.structs[id]
- for id in idx.typedefs.keys():
- if self.typedefs.has_key(id):
- print "typedef %s from %s redeclared in %s" % (
- id, self.typedefs[id].header, idx.typedefs[id].header)
- else:
- self.typedefs[id] = idx.typedefs[id]
- self.identifiers[id] = idx.typedefs[id]
- for id in idx.macros.keys():
+ if id in self.macros:
+ del self.macros[id]
+ if id in self.variables:
+ print("variable %s from %s redeclared in %s" % (
+ id, self.variables[id].header, idx.variables[id].header))
+ else:
+ self.variables[id] = idx.variables[id]
+ self.identifiers[id] = idx.variables[id]
+ for id in list(idx.structs.keys()):
+ if id in self.structs:
+ print("struct %s from %s redeclared in %s" % (
+ id, self.structs[id].header, idx.structs[id].header))
+ else:
+ self.structs[id] = idx.structs[id]
+ self.identifiers[id] = idx.structs[id]
+ for id in list(idx.typedefs.keys()):
+ if id in self.typedefs:
+ print("typedef %s from %s redeclared in %s" % (
+ id, self.typedefs[id].header, idx.typedefs[id].header))
+ else:
+ self.typedefs[id] = idx.typedefs[id]
+ self.identifiers[id] = idx.typedefs[id]
+ for id in list(idx.macros.keys()):
#
# macro might be used to override functions or variables
# definitions
#
- if self.variables.has_key(id):
+ if id in self.variables:
continue
- if self.functions.has_key(id):
+ if id in self.functions:
continue
- if self.enums.has_key(id):
+ if id in self.enums:
continue
- if self.macros.has_key(id):
- print "macro %s from %s redeclared in %s" % (
- id, self.macros[id].header, idx.macros[id].header)
- else:
- self.macros[id] = idx.macros[id]
- self.identifiers[id] = idx.macros[id]
- for id in idx.enums.keys():
- if self.enums.has_key(id):
- print "enum %s from %s redeclared in %s" % (
- id, self.enums[id].header, idx.enums[id].header)
- else:
- self.enums[id] = idx.enums[id]
- self.identifiers[id] = idx.enums[id]
+ if id in self.macros:
+ print("macro %s from %s redeclared in %s" % (
+ id, self.macros[id].header, idx.macros[id].header))
+ else:
+ self.macros[id] = idx.macros[id]
+ self.identifiers[id] = idx.macros[id]
+ for id in list(idx.enums.keys()):
+ if id in self.enums:
+ print("enum %s from %s redeclared in %s" % (
+ id, self.enums[id].header, idx.enums[id].header))
+ else:
+ self.enums[id] = idx.enums[id]
+ self.identifiers[id] = idx.enums[id]
def merge_public(self, idx):
- for id in idx.functions.keys():
- if self.functions.has_key(id):
- # check that function condition agrees with header
- if idx.functions[id].conditionals != \
- self.functions[id].conditionals:
- print "Header condition differs from Function for %s:" \
- % id
- print " H: %s" % self.functions[id].conditionals
- print " C: %s" % idx.functions[id].conditionals
- up = idx.functions[id]
- self.functions[id].update(None, up.module, up.type, up.info, up.extra)
- # else:
- # print "Function %s from %s is not declared in headers" % (
- # id, idx.functions[id].module)
- # TODO: do the same for variables.
+ for id in list(idx.functions.keys()):
+ if id in self.functions:
+ # check that function condition agrees with header
+ if idx.functions[id].conditionals != \
+ self.functions[id].conditionals:
+ print("Header condition differs from Function for %s:" \
+ % id)
+ print(" H: %s" % self.functions[id].conditionals)
+ print(" C: %s" % idx.functions[id].conditionals)
+ up = idx.functions[id]
+ self.functions[id].update(None, up.module, up.type, up.info, up.extra)
+ # else:
+ # print "Function %s from %s is not declared in headers" % (
+ # id, idx.functions[id].module)
+ # TODO: do the same for variables.
def analyze_dict(self, type, dict):
count = 0
- public = 0
- for name in dict.keys():
- id = dict[name]
- count = count + 1
- if id.static == 0:
- public = public + 1
+ public = 0
+ for name in list(dict.keys()):
+ id = dict[name]
+ count = count + 1
+ if id.static == 0:
+ public = public + 1
if count != public:
- print " %d %s , %d public" % (count, type, public)
- elif count != 0:
- print " %d public %s" % (count, type)
+ print(" %d %s , %d public" % (count, type, public))
+ elif count != 0:
+ print(" %d public %s" % (count, type))
def analyze(self):
- self.analyze_dict("functions", self.functions)
- self.analyze_dict("variables", self.variables)
- self.analyze_dict("structs", self.structs)
- self.analyze_dict("typedefs", self.typedefs)
- self.analyze_dict("macros", self.macros)
+ self.analyze_dict("functions", self.functions)
+ self.analyze_dict("variables", self.variables)
+ self.analyze_dict("structs", self.structs)
+ self.analyze_dict("typedefs", self.typedefs)
+ self.analyze_dict("macros", self.macros)
class CLexer:
"""A lexer for the C language, tokenize the input by reading and
analyzing it line by line"""
def __init__(self, input):
self.input = input
- self.tokens = []
- self.line = ""
- self.lineno = 0
+ self.tokens = []
+ self.line = ""
+ self.lineno = 0
def getline(self):
line = ''
- while line == '':
- line = self.input.readline()
- if not line:
- return None
- self.lineno = self.lineno + 1
- line = string.lstrip(line)
- line = string.rstrip(line)
- if line == '':
- continue
- while line[-1] == '\\':
- line = line[:-1]
- n = self.input.readline()
- self.lineno = self.lineno + 1
- n = string.lstrip(n)
- n = string.rstrip(n)
- if not n:
- break
- else:
- line = line + n
+ while line == '':
+ line = self.input.readline()
+ if not line:
+ return None
+ self.lineno = self.lineno + 1
+ line = line.lstrip()
+ line = line.rstrip()
+ if line == '':
+ continue
+ while line[-1] == '\\':
+ line = line[:-1]
+ n = self.input.readline()
+ self.lineno = self.lineno + 1
+ n = n.lstrip()
+ n = n.rstrip()
+ if not n:
+ break
+ else:
+ line = line + n
return line
def getlineno(self):
@@ -406,194 +406,194 @@ class CLexer:
self.tokens.insert(0, token);
def debug(self):
- print "Last token: ", self.last
- print "Token queue: ", self.tokens
- print "Line %d end: " % (self.lineno), self.line
+ print("Last token: ", self.last)
+ print("Token queue: ", self.tokens)
+ print("Line %d end: " % (self.lineno), self.line)
def token(self):
while self.tokens == []:
- if self.line == "":
- line = self.getline()
- else:
- line = self.line
- self.line = ""
- if line == None:
- return None
-
- if line[0] == '#':
- self.tokens = map((lambda x: ('preproc', x)),
- string.split(line))
- break;
- l = len(line)
- if line[0] == '"' or line[0] == "'":
- end = line[0]
- line = line[1:]
- found = 0
- tok = ""
- while found == 0:
- i = 0
- l = len(line)
- while i < l:
- if line[i] == end:
- self.line = line[i+1:]
- line = line[:i]
- l = i
- found = 1
- break
- if line[i] == '\\':
- i = i + 1
- i = i + 1
- tok = tok + line
- if found == 0:
- line = self.getline()
- if line == None:
- return None
- self.last = ('string', tok)
- return self.last
-
- if l >= 2 and line[0] == '/' and line[1] == '*':
- line = line[2:]
- found = 0
- tok = ""
- while found == 0:
- i = 0
- l = len(line)
- while i < l:
- if line[i] == '*' and i+1 < l and line[i+1] == '/':
- self.line = line[i+2:]
- line = line[:i-1]
- l = i
- found = 1
- break
- i = i + 1
- if tok != "":
- tok = tok + "\n"
- tok = tok + line
- if found == 0:
- line = self.getline()
- if line == None:
- return None
- self.last = ('comment', tok)
- return self.last
- if l >= 2 and line[0] == '/' and line[1] == '/':
- line = line[2:]
- self.last = ('comment', line)
- return self.last
- i = 0
- while i < l:
- if line[i] == '/' and i+1 < l and line[i+1] == '/':
- self.line = line[i:]
- line = line[:i]
- break
- if line[i] == '/' and i+1 < l and line[i+1] == '*':
- self.line = line[i:]
- line = line[:i]
- break
- if line[i] == '"' or line[i] == "'":
- self.line = line[i:]
- line = line[:i]
- break
- i = i + 1
- l = len(line)
- i = 0
- while i < l:
- if line[i] == ' ' or line[i] == '\t':
- i = i + 1
- continue
- o = ord(line[i])
- if (o >= 97 and o <= 122) or (o >= 65 and o <= 90) or \
- (o >= 48 and o <= 57):
- s = i
- while i < l:
- o = ord(line[i])
- if (o >= 97 and o <= 122) or (o >= 65 and o <= 90) or \
- (o >= 48 and o <= 57) or string.find(
- " \t(){}:;,+-*/%&!|[]=><", line[i]) == -1:
- i = i + 1
- else:
- break
- self.tokens.append(('name', line[s:i]))
- continue
- if string.find("(){}:;,[]", line[i]) != -1:
+ if self.line == "":
+ line = self.getline()
+ else:
+ line = self.line
+ self.line = ""
+ if line == None:
+ return None
+
+ if line[0] == '#':
+ self.tokens = list(map((lambda x: ('preproc', x)),
+ line.split()))
+ break;
+ l = len(line)
+ if line[0] == '"' or line[0] == "'":
+ end = line[0]
+ line = line[1:]
+ found = 0
+ tok = ""
+ while found == 0:
+ i = 0
+ l = len(line)
+ while i < l:
+ if line[i] == end:
+ self.line = line[i+1:]
+ line = line[:i]
+ l = i
+ found = 1
+ break
+ if line[i] == '\\':
+ i = i + 1
+ i = i + 1
+ tok = tok + line
+ if found == 0:
+ line = self.getline()
+ if line == None:
+ return None
+ self.last = ('string', tok)
+ return self.last
+
+ if l >= 2 and line[0] == '/' and line[1] == '*':
+ line = line[2:]
+ found = 0
+ tok = ""
+ while found == 0:
+ i = 0
+ l = len(line)
+ while i < l:
+ if line[i] == '*' and i+1 < l and line[i+1] == '/':
+ self.line = line[i+2:]
+ line = line[:i-1]
+ l = i
+ found = 1
+ break
+ i = i + 1
+ if tok != "":
+ tok = tok + "\n"
+ tok = tok + line
+ if found == 0:
+ line = self.getline()
+ if line == None:
+ return None
+ self.last = ('comment', tok)
+ return self.last
+ if l >= 2 and line[0] == '/' and line[1] == '/':
+ line = line[2:]
+ self.last = ('comment', line)
+ return self.last
+ i = 0
+ while i < l:
+ if line[i] == '/' and i+1 < l and line[i+1] == '/':
+ self.line = line[i:]
+ line = line[:i]
+ break
+ if line[i] == '/' and i+1 < l and line[i+1] == '*':
+ self.line = line[i:]
+ line = line[:i]
+ break
+ if line[i] == '"' or line[i] == "'":
+ self.line = line[i:]
+ line = line[:i]
+ break
+ i = i + 1
+ l = len(line)
+ i = 0
+ while i < l:
+ if line[i] == ' ' or line[i] == '\t':
+ i = i + 1
+ continue
+ o = ord(line[i])
+ if (o >= 97 and o <= 122) or (o >= 65 and o <= 90) or \
+ (o >= 48 and o <= 57):
+ s = i
+ while i < l:
+ o = ord(line[i])
+ if (o >= 97 and o <= 122) or (o >= 65 and o <= 90) or \
+ (o >= 48 and o <= 57) or \
+ (" \t(){}:;,+-*/%&!|[]=><".find(line[i])) == -1:
+ i = i + 1
+ else:
+ break
+ self.tokens.append(('name', line[s:i]))
+ continue
+ if "(){}:;,[]".find(line[i]) != -1:
# if line[i] == '(' or line[i] == ')' or line[i] == '{' or \
-# line[i] == '}' or line[i] == ':' or line[i] == ';' or \
-# line[i] == ',' or line[i] == '[' or line[i] == ']':
- self.tokens.append(('sep', line[i]))
- i = i + 1
- continue
- if string.find("+-*><=/%&!|.", line[i]) != -1:
+# line[i] == '}' or line[i] == ':' or line[i] == ';' or \
+# line[i] == ',' or line[i] == '[' or line[i] == ']':
+ self.tokens.append(('sep', line[i]))
+ i = i + 1
+ continue
+ if "+-*><=/%&!|.".find(line[i]) != -1:
# if line[i] == '+' or line[i] == '-' or line[i] == '*' or \
-# line[i] == '>' or line[i] == '<' or line[i] == '=' or \
-# line[i] == '/' or line[i] == '%' or line[i] == '&' or \
-# line[i] == '!' or line[i] == '|' or line[i] == '.':
- if line[i] == '.' and i + 2 < l and \
- line[i+1] == '.' and line[i+2] == '.':
- self.tokens.append(('name', '...'))
- i = i + 3
- continue
-
- j = i + 1
- if j < l and (
- string.find("+-*><=/%&!|", line[j]) != -1):
-# line[j] == '+' or line[j] == '-' or line[j] == '*' or \
-# line[j] == '>' or line[j] == '<' or line[j] == '=' or \
-# line[j] == '/' or line[j] == '%' or line[j] == '&' or \
-# line[j] == '!' or line[j] == '|'):
- self.tokens.append(('op', line[i:j+1]))
- i = j + 1
- else:
- self.tokens.append(('op', line[i]))
- i = i + 1
- continue
- s = i
- while i < l:
- o = ord(line[i])
- if (o >= 97 and o <= 122) or (o >= 65 and o <= 90) or \
- (o >= 48 and o <= 57) or (
- string.find(" \t(){}:;,+-*/%&!|[]=><", line[i]) == -1):
-# line[i] != ' ' and line[i] != '\t' and
-# line[i] != '(' and line[i] != ')' and
-# line[i] != '{' and line[i] != '}' and
-# line[i] != ':' and line[i] != ';' and
-# line[i] != ',' and line[i] != '+' and
-# line[i] != '-' and line[i] != '*' and
-# line[i] != '/' and line[i] != '%' and
-# line[i] != '&' and line[i] != '!' and
-# line[i] != '|' and line[i] != '[' and
-# line[i] != ']' and line[i] != '=' and
-# line[i] != '*' and line[i] != '>' and
-# line[i] != '<'):
- i = i + 1
- else:
- break
- self.tokens.append(('name', line[s:i]))
-
- tok = self.tokens[0]
- self.tokens = self.tokens[1:]
- self.last = tok
- return tok
+# line[i] == '>' or line[i] == '<' or line[i] == '=' or \
+# line[i] == '/' or line[i] == '%' or line[i] == '&' or \
+# line[i] == '!' or line[i] == '|' or line[i] == '.':
+ if line[i] == '.' and i + 2 < l and \
+ line[i+1] == '.' and line[i+2] == '.':
+ self.tokens.append(('name', '...'))
+ i = i + 3
+ continue
+
+ j = i + 1
+ if j < l and (
+ "+-*><=/%&!|".find(line[j]) != -1):
+# line[j] == '+' or line[j] == '-' or line[j] == '*' or \
+# line[j] == '>' or line[j] == '<' or line[j] == '=' or \
+# line[j] == '/' or line[j] == '%' or line[j] == '&' or \
+# line[j] == '!' or line[j] == '|'):
+ self.tokens.append(('op', line[i:j+1]))
+ i = j + 1
+ else:
+ self.tokens.append(('op', line[i]))
+ i = i + 1
+ continue
+ s = i
+ while i < l:
+ o = ord(line[i])
+ if (o >= 97 and o <= 122) or (o >= 65 and o <= 90) or \
+ (o >= 48 and o <= 57) or (
+ " \t(){}:;,+-*/%&!|[]=><".find(line[i]) == -1):
+# line[i] != ' ' and line[i] != '\t' and
+# line[i] != '(' and line[i] != ')' and
+# line[i] != '{' and line[i] != '}' and
+# line[i] != ':' and line[i] != ';' and
+# line[i] != ',' and line[i] != '+' and
+# line[i] != '-' and line[i] != '*' and
+# line[i] != '/' and line[i] != '%' and
+# line[i] != '&' and line[i] != '!' and
+# line[i] != '|' and line[i] != '[' and
+# line[i] != ']' and line[i] != '=' and
+# line[i] != '*' and line[i] != '>' and
+# line[i] != '<'):
+ i = i + 1
+ else:
+ break
+ self.tokens.append(('name', line[s:i]))
+
+ tok = self.tokens[0]
+ self.tokens = self.tokens[1:]
+ self.last = tok
+ return tok
class CParser:
"""The C module parser"""
def __init__(self, filename, idx = None):
self.filename = filename
- if len(filename) > 2 and filename[-2:] == '.h':
- self.is_header = 1
- else:
- self.is_header = 0
+ if len(filename) > 2 and filename[-2:] == '.h':
+ self.is_header = 1
+ else:
+ self.is_header = 0
self.input = open(filename)
- self.lexer = CLexer(self.input)
- if idx == None:
- self.index = index()
- else:
- self.index = idx
- self.top_comment = ""
- self.last_comment = ""
- self.comment = None
- self.collect_ref = 0
- self.no_error = 0
- self.conditionals = []
- self.defines = []
+ self.lexer = CLexer(self.input)
+ if idx == None:
+ self.index = index()
+ else:
+ self.index = idx
+ self.top_comment = ""
+ self.last_comment = ""
+ self.comment = None
+ self.collect_ref = 0
+ self.no_error = 0
+ self.conditionals = []
+ self.defines = []
def collect_references(self):
self.collect_ref = 1
@@ -608,203 +608,203 @@ class CParser:
return self.lexer.getlineno()
def index_add(self, name, module, static, type, info=None, extra = None):
- if self.is_header == 1:
- self.index.add(name, module, module, static, type, self.lineno(),
- info, extra, self.conditionals)
- else:
- self.index.add(name, None, module, static, type, self.lineno(),
- info, extra, self.conditionals)
+ if self.is_header == 1:
+ self.index.add(name, module, module, static, type, self.lineno(),
+ info, extra, self.conditionals)
+ else:
+ self.index.add(name, None, module, static, type, self.lineno(),
+ info, extra, self.conditionals)
def index_add_ref(self, name, module, static, type, info=None,
extra = None):
- if self.is_header == 1:
- self.index.add_ref(name, module, module, static, type,
- self.lineno(), info, extra, self.conditionals)
- else:
- self.index.add_ref(name, None, module, static, type, self.lineno(),
- info, extra, self.conditionals)
+ if self.is_header == 1:
+ self.index.add_ref(name, module, module, static, type,
+ self.lineno(), info, extra, self.conditionals)
+ else:
+ self.index.add_ref(name, None, module, static, type, self.lineno(),
+ info, extra, self.conditionals)
def warning(self, msg):
if self.no_error:
- return
- print msg
+ return
+ print(msg)
def error(self, msg, token=-1):
if self.no_error:
- return
+ return
- print "Parse Error: " + msg
- if token != -1:
- print "Got token ", token
- self.lexer.debug()
- sys.exit(1)
+ print("Parse Error: " + msg)
+ if token != -1:
+ print("Got token ", token)
+ self.lexer.debug()
+ sys.exit(1)
def debug(self, msg, token=-1):
- print "Debug: " + msg
- if token != -1:
- print "Got token ", token
- self.lexer.debug()
+ print("Debug: " + msg)
+ if token != -1:
+ print("Got token ", token)
+ self.lexer.debug()
def parseTopComment(self, 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
- self.index.info = res
+ res = {}
+ lines = comment.split("\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) = line.split(":", 1)
+ item = it
+ while line != "" and (line[0] == ' ' or line[0] == '\t'):
+ line = line[1:]
+ if item in res:
+ res[item] = res[item] + " " + line
+ else:
+ res[item] = line
+ except:
+ if item != None:
+ if item in res:
+ res[item] = res[item] + " " + line
+ else:
+ res[item] = line
+ self.index.info = res
def parseComment(self, token):
if self.top_comment == "":
- self.top_comment = token[1]
- if self.comment == None or token[1][0] == '*':
- self.comment = token[1];
- else:
- self.comment = self.comment + token[1]
- token = self.lexer.token()
+ self.top_comment = token[1]
+ if self.comment == None or token[1][0] == '*':
+ self.comment = token[1];
+ else:
+ self.comment = self.comment + token[1]
+ token = self.lexer.token()
- if string.find(self.comment, "DOC_DISABLE") != -1:
- self.stop_error()
+ if self.comment.find("DOC_DISABLE") != -1:
+ self.stop_error()
- if string.find(self.comment, "DOC_ENABLE") != -1:
- self.start_error()
+ if self.comment.find("DOC_ENABLE") != -1:
+ self.start_error()
- return token
+ return token
#
# Parse a comment block associate to a typedef
#
def parseTypeComment(self, name, quiet = 0):
if name[0:2] == '__':
- quiet = 1
+ quiet = 1
args = []
- desc = ""
+ desc = ""
if self.comment == None:
- if not quiet:
- self.warning("Missing comment for type %s" % (name))
- return((args, desc))
+ if not quiet:
+ self.warning("Missing comment for type %s" % (name))
+ return((args, desc))
if self.comment[0] != '*':
- if not quiet:
- self.warning("Missing * in type comment for %s" % (name))
- return((args, desc))
- lines = string.split(self.comment, '\n')
- if lines[0] == '*':
- del lines[0]
- if lines[0] != "* %s:" % (name):
- if not quiet:
- self.warning("Misformatted type comment for %s" % (name))
- self.warning(" Expecting '* %s:' got '%s'" % (name, lines[0]))
- return((args, desc))
- del lines[0]
- while len(lines) > 0 and lines[0] == '*':
- del lines[0]
- desc = ""
- while len(lines) > 0:
- l = lines[0]
- while len(l) > 0 and l[0] == '*':
- l = l[1:]
- l = string.strip(l)
- desc = desc + " " + l
- del lines[0]
-
- desc = string.strip(desc)
-
- if quiet == 0:
- if desc == "":
- self.warning("Type comment for %s lack description of the macro" % (name))
-
- return(desc)
+ if not quiet:
+ self.warning("Missing * in type comment for %s" % (name))
+ return((args, desc))
+ lines = self.comment.split('\n')
+ if lines[0] == '*':
+ del lines[0]
+ if lines[0] != "* %s:" % (name):
+ if not quiet:
+ self.warning("Misformatted type comment for %s" % (name))
+ self.warning(" Expecting '* %s:' got '%s'" % (name, lines[0]))
+ return((args, desc))
+ del lines[0]
+ while len(lines) > 0 and lines[0] == '*':
+ del lines[0]
+ desc = ""
+ while len(lines) > 0:
+ l = lines[0]
+ while len(l) > 0 and l[0] == '*':
+ l = l[1:]
+ l = l.strip()
+ desc = desc + " " + l
+ del lines[0]
+
+ desc = desc.strip()
+
+ if quiet == 0:
+ if desc == "":
+ self.warning("Type comment for %s lack description of the macro" % (name))
+
+ return(desc)
#
# Parse a comment block associate to a macro
#
def parseMacroComment(self, name, quiet = 0):
if name[0:2] == '__':
- quiet = 1
+ quiet = 1
args = []
- desc = ""
+ desc = ""
if self.comment == None:
- if not quiet:
- self.warning("Missing comment for macro %s" % (name))
- return((args, desc))
+ if not quiet:
+ self.warning("Missing comment for macro %s" % (name))
+ return((args, desc))
if self.comment[0] != '*':
- if not quiet:
- self.warning("Missing * in macro comment for %s" % (name))
- return((args, desc))
- lines = string.split(self.comment, '\n')
- if lines[0] == '*':
- del lines[0]
- if lines[0] != "* %s:" % (name):
- if not quiet:
- self.warning("Misformatted macro comment for %s" % (name))
- self.warning(" Expecting '* %s:' got '%s'" % (name, lines[0]))
- return((args, desc))
- del lines[0]
- while lines[0] == '*':
- del lines[0]
- while len(lines) > 0 and lines[0][0:3] == '* @':
- l = lines[0][3:]
- try:
- (arg, desc) = string.split(l, ':', 1)
- desc=string.strip(desc)
- arg=string.strip(arg)
+ if not quiet:
+ self.warning("Missing * in macro comment for %s" % (name))
+ return((args, desc))
+ lines = self.comment.split('\n')
+ if lines[0] == '*':
+ del lines[0]
+ if lines[0] != "* %s:" % (name):
+ if not quiet:
+ self.warning("Misformatted macro comment for %s" % (name))
+ self.warning(" Expecting '* %s:' got '%s'" % (name, lines[0]))
+ return((args, desc))
+ del lines[0]
+ while lines[0] == '*':
+ del lines[0]
+ while len(lines) > 0 and lines[0][0:3] == '* @':
+ l = lines[0][3:]
+ try:
+ (arg, desc) = l.split(':', 1)
+ desc=desc.strip()
+ arg=arg.strip()
except:
- if not quiet:
- self.warning("Misformatted macro comment for %s" % (name))
- self.warning(" problem with '%s'" % (lines[0]))
- del lines[0]
- continue
- del lines[0]
- l = string.strip(lines[0])
- while len(l) > 2 and l[0:3] != '* @':
- while l[0] == '*':
- l = l[1:]
- desc = desc + ' ' + string.strip(l)
- del lines[0]
- if len(lines) == 0:
- break
- l = lines[0]
+ if not quiet:
+ self.warning("Misformatted macro comment for %s" % (name))
+ self.warning(" problem with '%s'" % (lines[0]))
+ del lines[0]
+ continue
+ del lines[0]
+ l = lines[0].strip()
+ while len(l) > 2 and l[0:3] != '* @':
+ while l[0] == '*':
+ l = l[1:]
+ desc = desc + ' ' + l.strip()
+ del lines[0]
+ if len(lines) == 0:
+ break
+ l = lines[0]
args.append((arg, desc))
- while len(lines) > 0 and lines[0] == '*':
- del lines[0]
- desc = ""
- while len(lines) > 0:
- l = lines[0]
- while len(l) > 0 and l[0] == '*':
- l = l[1:]
- l = string.strip(l)
- desc = desc + " " + l
- del lines[0]
+ while len(lines) > 0 and lines[0] == '*':
+ del lines[0]
+ desc = ""
+ while len(lines) > 0:
+ l = lines[0]
+ while len(l) > 0 and l[0] == '*':
+ l = l[1:]
+ l = l.strip()
+ desc = desc + " " + l
+ del lines[0]
- desc = string.strip(desc)
+ desc = desc.strip()
- if quiet == 0:
- if desc == "":
- self.warning("Macro comment for %s lack description of the macro" % (name))
+ if quiet == 0:
+ if desc == "":
+ self.warning("Macro comment for %s lack description of the macro" % (name))
- return((args, desc))
+ return((args, desc))
#
# Parse a comment block and merge the informations found in the
@@ -813,206 +813,206 @@ class CParser:
#
def mergeFunctionComment(self, name, description, quiet = 0):
if name == 'main':
- quiet = 1
+ quiet = 1
if name[0:2] == '__':
- quiet = 1
+ quiet = 1
- (ret, args) = description
- desc = ""
- retdesc = ""
+ (ret, args) = description
+ desc = ""
+ retdesc = ""
if self.comment == None:
- if not quiet:
- self.warning("Missing comment for function %s" % (name))
- return(((ret[0], retdesc), args, desc))
+ if not quiet:
+ self.warning("Missing comment for function %s" % (name))
+ return(((ret[0], retdesc), args, desc))
if self.comment[0] != '*':
- if not quiet:
- self.warning("Missing * in function comment for %s" % (name))
- return(((ret[0], retdesc), args, desc))
- lines = string.split(self.comment, '\n')
- if lines[0] == '*':
- del lines[0]
- if lines[0] != "* %s:" % (name):
- if not quiet:
- self.warning("Misformatted function comment for %s" % (name))
- self.warning(" Expecting '* %s:' got '%s'" % (name, lines[0]))
- return(((ret[0], retdesc), args, desc))
- del lines[0]
- while lines[0] == '*':
- del lines[0]
- nbargs = len(args)
- while len(lines) > 0 and lines[0][0:3] == '* @':
- l = lines[0][3:]
- try:
- (arg, desc) = string.split(l, ':', 1)
- desc=string.strip(desc)
- arg=string.strip(arg)
+ if not quiet:
+ self.warning("Missing * in function comment for %s" % (name))
+ return(((ret[0], retdesc), args, desc))
+ lines = self.comment.split('\n')
+ if lines[0] == '*':
+ del lines[0]
+ if lines[0] != "* %s:" % (name):
+ if not quiet:
+ self.warning("Misformatted function comment for %s" % (name))
+ self.warning(" Expecting '* %s:' got '%s'" % (name, lines[0]))
+ return(((ret[0], retdesc), args, desc))
+ del lines[0]
+ while lines[0] == '*':
+ del lines[0]
+ nbargs = len(args)
+ while len(lines) > 0 and lines[0][0:3] == '* @':
+ l = lines[0][3:]
+ try:
+ (arg, desc) = l.split(':', 1)
+ desc=desc.strip()
+ arg=arg.strip()
except:
- if not quiet:
- self.warning("Misformatted function comment for %s" % (name))
- self.warning(" problem with '%s'" % (lines[0]))
- del lines[0]
- continue
- del lines[0]
- l = string.strip(lines[0])
- while len(l) > 2 and l[0:3] != '* @':
- while l[0] == '*':
- l = l[1:]
- desc = desc + ' ' + string.strip(l)
- del lines[0]
- if len(lines) == 0:
- break
- l = lines[0]
- i = 0
- while i < nbargs:
- if args[i][1] == arg:
- args[i] = (args[i][0], arg, desc)
- break;
- i = i + 1
- if i >= nbargs:
- if not quiet:
- self.warning("Unable to find arg %s from function comment for %s" % (
- arg, name))
- while len(lines) > 0 and lines[0] == '*':
- del lines[0]
- desc = ""
- while len(lines) > 0:
- l = lines[0]
- while len(l) > 0 and l[0] == '*':
- l = l[1:]
- l = string.strip(l)
- if len(l) >= 6 and l[0:6] == "return" or l[0:6] == "Return":
- try:
- l = string.split(l, ' ', 1)[1]
- except:
- l = ""
- retdesc = string.strip(l)
- del lines[0]
- while len(lines) > 0:
- l = lines[0]
- while len(l) > 0 and l[0] == '*':
- l = l[1:]
- l = string.strip(l)
- retdesc = retdesc + " " + l
- del lines[0]
- else:
- desc = desc + " " + l
- del lines[0]
-
- retdesc = string.strip(retdesc)
- desc = string.strip(desc)
-
- if quiet == 0:
- #
- # report missing comments
- #
- i = 0
- while i < nbargs:
- if args[i][2] == None and args[i][0] != "void" and \
- ((args[i][1] != None) or (args[i][1] == '')):
- self.warning("Function comment for %s lacks description of arg %s" % (name, args[i][1]))
- i = i + 1
- if retdesc == "" and ret[0] != "void":
- self.warning("Function comment for %s lacks description of return value" % (name))
- if desc == "":
- self.warning("Function comment for %s lacks description of the function" % (name))
-
- return(((ret[0], retdesc), args, desc))
+ if not quiet:
+ self.warning("Misformatted function comment for %s" % (name))
+ self.warning(" problem with '%s'" % (lines[0]))
+ del lines[0]
+ continue
+ del lines[0]
+ l = lines[0].strip()
+ while len(l) > 2 and l[0:3] != '* @':
+ while l[0] == '*':
+ l = l[1:]
+ desc = desc + ' ' + l.strip()
+ del lines[0]
+ if len(lines) == 0:
+ break
+ l = lines[0]
+ i = 0
+ while i < nbargs:
+ if args[i][1] == arg:
+ args[i] = (args[i][0], arg, desc)
+ break;
+ i = i + 1
+ if i >= nbargs:
+ if not quiet:
+ self.warning("Unable to find arg %s from function comment for %s" % (
+ arg, name))
+ while len(lines) > 0 and lines[0] == '*':
+ del lines[0]
+ desc = ""
+ while len(lines) > 0:
+ l = lines[0]
+ while len(l) > 0 and l[0] == '*':
+ l = l[1:]
+ l = l.strip()
+ if len(l) >= 6 and l[0:6] == "return" or l[0:6] == "Return":
+ try:
+ l = l.split(' ', 1)[1]
+ except:
+ l = ""
+ retdesc = l.strip()
+ del lines[0]
+ while len(lines) > 0:
+ l = lines[0]
+ while len(l) > 0 and l[0] == '*':
+ l = l[1:]
+ l = l.strip()
+ retdesc = retdesc + " " + l
+ del lines[0]
+ else:
+ desc = desc + " " + l
+ del lines[0]
+
+ retdesc = retdesc.strip()
+ desc = desc.strip()
+
+ if quiet == 0:
+ #
+ # report missing comments
+ #
+ i = 0
+ while i < nbargs:
+ if args[i][2] == None and args[i][0] != "void" and \
+ ((args[i][1] != None) or (args[i][1] == '')):
+ self.warning("Function comment for %s lacks description of arg %s" % (name, args[i][1]))
+ i = i + 1
+ if retdesc == "" and ret[0] != "void":
+ self.warning("Function comment for %s lacks description of return value" % (name))
+ if desc == "":
+ self.warning("Function comment for %s lacks description of the function" % (name))
+
+ return(((ret[0], retdesc), args, desc))
def parsePreproc(self, token):
- if debug:
- print "=> preproc ", token, self.lexer.tokens
+ if debug:
+ print("=> preproc ", token, self.lexer.tokens)
name = token[1]
- if name == "#include":
- token = self.lexer.token()
- if token == None:
- return None
- if token[0] == 'preproc':
- self.index_add(token[1], self.filename, not self.is_header,
- "include")
- return self.lexer.token()
- return token
- if name == "#define":
- token = self.lexer.token()
- if token == None:
- return None
- if token[0] == 'preproc':
- # TODO macros with arguments
- name = token[1]
- lst = []
- token = self.lexer.token()
- while token != None and token[0] == 'preproc' and \
- token[1][0] != '#':
- lst.append(token[1])
- token = self.lexer.token()
+ if name == "#include":
+ token = self.lexer.token()
+ if token == None:
+ return None
+ if token[0] == 'preproc':
+ self.index_add(token[1], self.filename, not self.is_header,
+ "include")
+ return self.lexer.token()
+ return token
+ if name == "#define":
+ token = self.lexer.token()
+ if token == None:
+ return None
+ if token[0] == 'preproc':
+ # TODO macros with arguments
+ name = token[1]
+ lst = []
+ token = self.lexer.token()
+ while token != None and token[0] == 'preproc' and \
+ token[1][0] != '#':
+ lst.append(token[1])
+ token = self.lexer.token()
try:
- name = string.split(name, '(') [0]
+ name = name.split('(') [0]
except:
pass
info = self.parseMacroComment(name, not self.is_header)
- self.index_add(name, self.filename, not self.is_header,
- "macro", info)
- return token
-
- #
- # Processing of conditionals modified by Bill 1/1/05
- #
- # We process conditionals (i.e. tokens from #ifdef, #ifndef,
- # #if, #else and #endif) for headers and mainline code,
- # store the ones from the header in libxml2-api.xml, and later
- # (in the routine merge_public) verify that the two (header and
- # mainline code) agree.
- #
- # There is a small problem with processing the headers. Some of
- # the variables are not concerned with enabling / disabling of
- # library functions (e.g. '__XML_PARSER_H__'), and we don't want
- # them to be included in libxml2-api.xml, or involved in
- # the check between the header and the mainline code. To
- # accomplish this, we ignore any conditional which doesn't include
- # the string 'ENABLED'
- #
- if name == "#ifdef":
- apstr = self.lexer.tokens[0][1]
- try:
- self.defines.append(apstr)
- if string.find(apstr, 'ENABLED') != -1:
- self.conditionals.append("defined(%s)" % apstr)
- except:
- pass
- elif name == "#ifndef":
- apstr = self.lexer.tokens[0][1]
- try:
- self.defines.append(apstr)
- if string.find(apstr, 'ENABLED') != -1:
- self.conditionals.append("!defined(%s)" % apstr)
- except:
- pass
- elif name == "#if":
- apstr = ""
- for tok in self.lexer.tokens:
- if apstr != "":
- apstr = apstr + " "
- apstr = apstr + tok[1]
- try:
- self.defines.append(apstr)
- if string.find(apstr, 'ENABLED') != -1:
- self.conditionals.append(apstr)
- except:
- pass
- elif name == "#else":
- if self.conditionals != [] and \
- string.find(self.defines[-1], 'ENABLED') != -1:
- self.conditionals[-1] = "!(%s)" % self.conditionals[-1]
- elif name == "#endif":
- if self.conditionals != [] and \
- string.find(self.defines[-1], 'ENABLED') != -1:
- self.conditionals = self.conditionals[:-1]
- self.defines = self.defines[:-1]
- token = self.lexer.token()
- while token != None and token[0] == 'preproc' and \
- token[1][0] != '#':
- token = self.lexer.token()
- return token
+ self.index_add(name, self.filename, not self.is_header,
+ "macro", info)
+ return token
+
+ #
+ # Processing of conditionals modified by Bill 1/1/05
+ #
+ # We process conditionals (i.e. tokens from #ifdef, #ifndef,
+ # #if, #else and #endif) for headers and mainline code,
+ # store the ones from the header in libxml2-api.xml, and later
+ # (in the routine merge_public) verify that the two (header and
+ # mainline code) agree.
+ #
+ # There is a small problem with processing the headers. Some of
+ # the variables are not concerned with enabling / disabling of
+ # library functions (e.g. '__XML_PARSER_H__'), and we don't want
+ # them to be included in libxml2-api.xml, or involved in
+ # the check between the header and the mainline code. To
+ # accomplish this, we ignore any conditional which doesn't include
+ # the string 'ENABLED'
+ #
+ if name == "#ifdef":
+ apstr = self.lexer.tokens[0][1]
+ try:
+ self.defines.append(apstr)
+ if apstr.find('ENABLED') != -1:
+ self.conditionals.append("defined(%s)" % apstr)
+ except:
+ pass
+ elif name == "#ifndef":
+ apstr = self.lexer.tokens[0][1]
+ try:
+ self.defines.append(apstr)
+ if apstr.find('ENABLED') != -1:
+ self.conditionals.append("!defined(%s)" % apstr)
+ except:
+ pass
+ elif name == "#if":
+ apstr = ""
+ for tok in self.lexer.tokens:
+ if apstr != "":
+ apstr = apstr + " "
+ apstr = apstr + tok[1]
+ try:
+ self.defines.append(apstr)
+ if apstr.find('ENABLED') != -1:
+ self.conditionals.append(apstr)
+ except:
+ pass
+ elif name == "#else":
+ if self.conditionals != [] and \
+ self.defines[-1].find('ENABLED') != -1:
+ self.conditionals[-1] = "!(%s)" % self.conditionals[-1]
+ elif name == "#endif":
+ if self.conditionals != [] and \
+ self.defines[-1].find('ENABLED') != -1:
+ self.conditionals = self.conditionals[:-1]
+ self.defines = self.defines[:-1]
+ token = self.lexer.token()
+ while token != None and token[0] == 'preproc' and \
+ token[1][0] != '#':
+ token = self.lexer.token()
+ return token
#
# token acquisition on top of the lexer, it handle internally
@@ -1023,89 +1023,89 @@ class CParser:
global ignored_words
token = self.lexer.token()
- while token != None:
- if token[0] == 'comment':
- token = self.parseComment(token)
- continue
- elif token[0] == 'preproc':
- token = self.parsePreproc(token)
- continue
- elif token[0] == "name" and token[1] == "__const":
- token = ("name", "const")
- return token
- elif token[0] == "name" and token[1] == "__attribute":
- token = self.lexer.token()
- while token != None and token[1] != ";":
- token = self.lexer.token()
- return token
- elif token[0] == "name" and ignored_words.has_key(token[1]):
- (n, info) = ignored_words[token[1]]
- i = 0
- while i < n:
- token = self.lexer.token()
- i = i + 1
- token = self.lexer.token()
- continue
- else:
- if debug:
- print "=> ", token
- return token
- return None
+ while token != None:
+ if token[0] == 'comment':
+ token = self.parseComment(token)
+ continue
+ elif token[0] == 'preproc':
+ token = self.parsePreproc(token)
+ continue
+ elif token[0] == "name" and token[1] == "__const":
+ token = ("name", "const")
+ return token
+ elif token[0] == "name" and token[1] == "__attribute":
+ token = self.lexer.token()
+ while token != None and token[1] != ";":
+ token = self.lexer.token()
+ return token
+ elif token[0] == "name" and token[1] in ignored_words:
+ (n, info) = ignored_words[token[1]]
+ i = 0
+ while i < n:
+ token = self.lexer.token()
+ i = i + 1
+ token = self.lexer.token()
+ continue
+ else:
+ if debug:
+ print("=> ", token)
+ return token
+ return None
#
# Parse a typedef, it records the type and its name.
#
def parseTypedef(self, token):
if token == None:
- return None
- token = self.parseType(token)
- if token == None:
- self.error("parsing typedef")
- return None
- base_type = self.type
- type = base_type
- #self.debug("end typedef type", token)
- while token != None:
- if token[0] == "name":
- name = token[1]
- signature = self.signature
- if signature != None:
- type = string.split(type, '(')[0]
- d = self.mergeFunctionComment(name,
- ((type, None), signature), 1)
- self.index_add(name, self.filename, not self.is_header,
- "functype", d)
- else:
- if base_type == "struct":
- self.index_add(name, self.filename, not self.is_header,
- "struct", type)
- base_type = "struct " + name
- else:
- # TODO report missing or misformatted comments
- info = self.parseTypeComment(name, 1)
- self.index_add(name, self.filename, not self.is_header,
- "typedef", type, info)
- token = self.token()
- else:
- self.error("parsing typedef: expecting a name")
- return token
- #self.debug("end typedef", token)
- if token != None and token[0] == 'sep' and token[1] == ',':
- type = base_type
- token = self.token()
- while token != None and token[0] == "op":
- type = type + token[1]
- token = self.token()
- elif token != None and token[0] == 'sep' and token[1] == ';':
- break;
- elif token != None and token[0] == 'name':
- type = base_type
- continue;
- else:
- self.error("parsing typedef: expecting ';'", token)
- return token
- token = self.token()
- return token
+ return None
+ token = self.parseType(token)
+ if token == None:
+ self.error("parsing typedef")
+ return None
+ base_type = self.type
+ type = base_type
+ #self.debug("end typedef type", token)
+ while token != None:
+ if token[0] == "name":
+ name = token[1]
+ signature = self.signature
+ if signature != None:
+ type = type.split('(')[0]
+ d = self.mergeFunctionComment(name,
+ ((type, None), signature), 1)
+ self.index_add(name, self.filename, not self.is_header,
+ "functype", d)
+ else:
+ if base_type == "struct":
+ self.index_add(name, self.filename, not self.is_header,
+ "struct", type)
+ base_type = "struct " + name
+ else:
+ # TODO report missing or misformatted comments
+ info = self.parseTypeComment(name, 1)
+ self.index_add(name, self.filename, not self.is_header,
+ "typedef", type, info)
+ token = self.token()
+ else:
+ self.error("parsing typedef: expecting a name")
+ return token
+ #self.debug("end typedef", token)
+ if token != None and token[0] == 'sep' and token[1] == ',':
+ type = base_type
+ token = self.token()
+ while token != None and token[0] == "op":
+ type = type + token[1]
+ token = self.token()
+ elif token != None and token[0] == 'sep' and token[1] == ';':
+ break;
+ elif token != None and token[0] == 'name':
+ type = base_type
+ continue;
+ else:
+ self.error("parsing typedef: expecting ';'", token)
+ return token
+ token = self.token()
+ return token
#
# Parse a C code block, used for functions it parse till
@@ -1113,138 +1113,138 @@ class CParser:
#
def parseBlock(self, token):
while token != None:
- if token[0] == "sep" and token[1] == "{":
- token = self.token()
- token = self.parseBlock(token)
- elif token[0] == "sep" and token[1] == "}":
- self.comment = None
- token = self.token()
- return token
- else:
- if self.collect_ref == 1:
- oldtok = token
- token = self.token()
- if oldtok[0] == "name" and oldtok[1][0:3] == "xml":
- if token[0] == "sep" and token[1] == "(":
- self.index_add_ref(oldtok[1], self.filename,
- 0, "function")
- token = self.token()
- elif token[0] == "name":
- token = self.token()
- if token[0] == "sep" and (token[1] == ";" or
- token[1] == "," or token[1] == "="):
- self.index_add_ref(oldtok[1], self.filename,
- 0, "type")
- elif oldtok[0] == "name" and oldtok[1][0:4] == "XML_":
- self.index_add_ref(oldtok[1], self.filename,
- 0, "typedef")
- elif oldtok[0] == "name" and oldtok[1][0:7] == "LIBXML_":
- self.index_add_ref(oldtok[1], self.filename,
- 0, "typedef")
-
- else:
- token = self.token()
- return token
+ if token[0] == "sep" and token[1] == "{":
+ token = self.token()
+ token = self.parseBlock(token)
+ elif token[0] == "sep" and token[1] == "}":
+ self.comment = None
+ token = self.token()
+ return token
+ else:
+ if self.collect_ref == 1:
+ oldtok = token
+ token = self.token()
+ if oldtok[0] == "name" and oldtok[1][0:3] == "xml":
+ if token[0] == "sep" and token[1] == "(":
+ self.index_add_ref(oldtok[1], self.filename,
+ 0, "function")
+ token = self.token()
+ elif token[0] == "name":
+ token = self.token()
+ if token[0] == "sep" and (token[1] == ";" or
+ token[1] == "," or token[1] == "="):
+ self.index_add_ref(oldtok[1], self.filename,
+ 0, "type")
+ elif oldtok[0] == "name" and oldtok[1][0:4] == "XML_":
+ self.index_add_ref(oldtok[1], self.filename,
+ 0, "typedef")
+ elif oldtok[0] == "name" and oldtok[1][0:7] == "LIBXML_":
+ self.index_add_ref(oldtok[1], self.filename,
+ 0, "typedef")
+
+ else:
+ token = self.token()
+ return token
#
# Parse a C struct definition till the balancing }
#
def parseStruct(self, token):
fields = []
- #self.debug("start parseStruct", token)
+ #self.debug("start parseStruct", token)
while token != None:
- if token[0] == "sep" and token[1] == "{":
- token = self.token()
- token = self.parseTypeBlock(token)
- elif token[0] == "sep" and token[1] == "}":
- self.struct_fields = fields
- #self.debug("end parseStruct", token)
- #print fields
- token = self.token()
- return token
- else:
- base_type = self.type
- #self.debug("before parseType", token)
- token = self.parseType(token)
- #self.debug("after parseType", token)
- if token != None and token[0] == "name":
- fname = token[1]
- token = self.token()
- if token[0] == "sep" and token[1] == ";":
- self.comment = None
- token = self.token()
- fields.append((self.type, fname, self.comment))
- self.comment = None
- else:
- self.error("parseStruct: expecting ;", token)
- elif token != None and token[0] == "sep" and token[1] == "{":
- token = self.token()
- token = self.parseTypeBlock(token)
- if token != None and token[0] == "name":
- token = self.token()
- if token != None and token[0] == "sep" and token[1] == ";":
- token = self.token()
- else:
- self.error("parseStruct: expecting ;", token)
- else:
- self.error("parseStruct: name", token)
- token = self.token()
- self.type = base_type;
+ if token[0] == "sep" and token[1] == "{":
+ token = self.token()
+ token = self.parseTypeBlock(token)
+ elif token[0] == "sep" and token[1] == "}":
+ self.struct_fields = fields
+ #self.debug("end parseStruct", token)
+ #print fields
+ token = self.token()
+ return token
+ else:
+ base_type = self.type
+ #self.debug("before parseType", token)
+ token = self.parseType(token)
+ #self.debug("after parseType", token)
+ if token != None and token[0] == "name":
+ fname = token[1]
+ token = self.token()
+ if token[0] == "sep" and token[1] == ";":
+ self.comment = None
+ token = self.token()
+ fields.append((self.type, fname, self.comment))
+ self.comment = None
+ else:
+ self.error("parseStruct: expecting ;", token)
+ elif token != None and token[0] == "sep" and token[1] == "{":
+ token = self.token()
+ token = self.parseTypeBlock(token)
+ if token != None and token[0] == "name":
+ token = self.token()
+ if token != None and token[0] == "sep" and token[1] == ";":
+ token = self.token()
+ else:
+ self.error("parseStruct: expecting ;", token)
+ else:
+ self.error("parseStruct: name", token)
+ token = self.token()
+ self.type = base_type;
self.struct_fields = fields
- #self.debug("end parseStruct", token)
- #print fields
- return token
+ #self.debug("end parseStruct", token)
+ #print fields
+ return token
#
# Parse a C enum block, parse till the balancing }
#
def parseEnumBlock(self, token):
self.enums = []
- name = None
- self.comment = None
- comment = ""
- value = "0"
+ name = None
+ self.comment = None
+ comment = ""
+ value = "0"
while token != None:
- if token[0] == "sep" and token[1] == "{":
- token = self.token()
- token = self.parseTypeBlock(token)
- elif token[0] == "sep" and token[1] == "}":
- if name != None:
- if self.comment != None:
- comment = self.comment
- self.comment = None
- self.enums.append((name, value, comment))
- token = self.token()
- return token
- elif token[0] == "name":
- if name != None:
- if self.comment != None:
- comment = string.strip(self.comment)
- self.comment = None
- self.enums.append((name, value, comment))
- name = token[1]
- comment = ""
- token = self.token()
- if token[0] == "op" and token[1][0] == "=":
- value = ""
- if len(token[1]) > 1:
- value = token[1][1:]
- token = self.token()
- while token[0] != "sep" or (token[1] != ',' and
- token[1] != '}'):
- value = value + token[1]
- token = self.token()
- else:
- try:
- value = "%d" % (int(value) + 1)
- except:
- self.warning("Failed to compute value of enum %s" % (name))
- value=""
- if token[0] == "sep" and token[1] == ",":
- token = self.token()
- else:
- token = self.token()
- return token
+ if token[0] == "sep" and token[1] == "{":
+ token = self.token()
+ token = self.parseTypeBlock(token)
+ elif token[0] == "sep" and token[1] == "}":
+ if name != None:
+ if self.comment != None:
+ comment = self.comment
+ self.comment = None
+ self.enums.append((name, value, comment))
+ token = self.token()
+ return token
+ elif token[0] == "name":
+ if name != None:
+ if self.comment != None:
+ comment = self.comment.strip()
+ self.comment = None
+ self.enums.append((name, value, comment))
+ name = token[1]
+ comment = ""
+ token = self.token()
+ if token[0] == "op" and token[1][0] == "=":
+ value = ""
+ if len(token[1]) > 1:
+ value = token[1][1:]
+ token = self.token()
+ while token[0] != "sep" or (token[1] != ',' and
+ token[1] != '}'):
+ value = value + token[1]
+ token = self.token()
+ else:
+ try:
+ value = "%d" % (int(value) + 1)
+ except:
+ self.warning("Failed to compute value of enum %s" % (name))
+ value=""
+ if token[0] == "sep" and token[1] == ",":
+ token = self.token()
+ else:
+ token = self.token()
+ return token
#
# Parse a C definition block, used for structs it parse till
@@ -1252,15 +1252,15 @@ class CParser:
#
def parseTypeBlock(self, token):
while token != None:
- if token[0] == "sep" and token[1] == "{":
- token = self.token()
- token = self.parseTypeBlock(token)
- elif token[0] == "sep" and token[1] == "}":
- token = self.token()
- return token
- else:
- token = self.token()
- return token
+ if token[0] == "sep" and token[1] == "{":
+ token = self.token()
+ token = self.parseTypeBlock(token)
+ elif token[0] == "sep" and token[1] == "}":
+ token = self.token()
+ return token
+ else:
+ token = self.token()
+ return token
#
# Parse a type: the fact that the type name can either occur after
@@ -1269,200 +1269,200 @@ class CParser:
#
def parseType(self, token):
self.type = ""
- self.struct_fields = []
+ self.struct_fields = []
self.signature = None
- if token == None:
- return token
-
- while token[0] == "name" and (
- token[1] == "const" or \
- token[1] == "unsigned" or \
- token[1] == "signed"):
- if self.type == "":
- self.type = token[1]
- else:
- self.type = self.type + " " + token[1]
- token = self.token()
+ if token == None:
+ return token
+
+ while token[0] == "name" and (
+ token[1] == "const" or \
+ token[1] == "unsigned" or \
+ token[1] == "signed"):
+ if self.type == "":
+ self.type = token[1]
+ else:
+ self.type = self.type + " " + token[1]
+ token = self.token()
if token[0] == "name" and (token[1] == "long" or token[1] == "short"):
- if self.type == "":
- self.type = token[1]
- else:
- self.type = self.type + " " + token[1]
- if token[0] == "name" and token[1] == "int":
- if self.type == "":
- self.type = tmp[1]
- else:
- self.type = self.type + " " + tmp[1]
+ if self.type == "":
+ self.type = token[1]
+ else:
+ self.type = self.type + " " + token[1]
+ if token[0] == "name" and token[1] == "int":
+ if self.type == "":
+ self.type = tmp[1]
+ else:
+ self.type = self.type + " " + tmp[1]
elif token[0] == "name" and token[1] == "struct":
- if self.type == "":
- self.type = token[1]
- else:
- self.type = self.type + " " + token[1]
- token = self.token()
- nametok = None
- if token[0] == "name":
- nametok = token
- token = self.token()
- if token != None and token[0] == "sep" and token[1] == "{":
- token = self.token()
- token = self.parseStruct(token)
- elif token != None and token[0] == "op" and token[1] == "*":
- self.type = self.type + " " + nametok[1] + " *"
- token = self.token()
- while token != None and token[0] == "op" and token[1] == "*":
- self.type = self.type + " *"
- token = self.token()
- if token[0] == "name":
- nametok = token
- token = self.token()
- else:
- self.error("struct : expecting name", token)
- return token
- elif token != None and token[0] == "name" and nametok != None:
- self.type = self.type + " " + nametok[1]
- return token
-
- if nametok != None:
- self.lexer.push(token)
- token = nametok
- return token
+ if self.type == "":
+ self.type = token[1]
+ else:
+ self.type = self.type + " " + token[1]
+ token = self.token()
+ nametok = None
+ if token[0] == "name":
+ nametok = token
+ token = self.token()
+ if token != None and token[0] == "sep" and token[1] == "{":
+ token = self.token()
+ token = self.parseStruct(token)
+ elif token != None and token[0] == "op" and token[1] == "*":
+ self.type = self.type + " " + nametok[1] + " *"
+ token = self.token()
+ while token != None and token[0] == "op" and token[1] == "*":
+ self.type = self.type + " *"
+ token = self.token()
+ if token[0] == "name":
+ nametok = token
+ token = self.token()
+ else:
+ self.error("struct : expecting name", token)
+ return token
+ elif token != None and token[0] == "name" and nametok != None:
+ self.type = self.type + " " + nametok[1]
+ return token
+
+ if nametok != None:
+ self.lexer.push(token)
+ token = nametok
+ return token
elif token[0] == "name" and token[1] == "enum":
- if self.type == "":
- self.type = token[1]
- else:
- self.type = self.type + " " + token[1]
- self.enums = []
- token = self.token()
- if token != None and token[0] == "sep" and token[1] == "{":
- token = self.token()
- token = self.parseEnumBlock(token)
- else:
- self.error("parsing enum: expecting '{'", token)
- enum_type = None
- if token != None and token[0] != "name":
- self.lexer.push(token)
- token = ("name", "enum")
- else:
- enum_type = token[1]
- for enum in self.enums:
- self.index_add(enum[0], self.filename,
- not self.is_header, "enum",
- (enum[1], enum[2], enum_type))
- return token
-
- elif token[0] == "name":
- if self.type == "":
- self.type = token[1]
- else:
- self.type = self.type + " " + token[1]
- else:
- self.error("parsing type %s: expecting a name" % (self.type),
- token)
- return token
- token = self.token()
+ if self.type == "":
+ self.type = token[1]
+ else:
+ self.type = self.type + " " + token[1]
+ self.enums = []
+ token = self.token()
+ if token != None and token[0] == "sep" and token[1] == "{":
+ token = self.token()
+ token = self.parseEnumBlock(token)
+ else:
+ self.error("parsing enum: expecting '{'", token)
+ enum_type = None
+ if token != None and token[0] != "name":
+ self.lexer.push(token)
+ token = ("name", "enum")
+ else:
+ enum_type = token[1]
+ for enum in self.enums:
+ self.index_add(enum[0], self.filename,
+ not self.is_header, "enum",
+ (enum[1], enum[2], enum_type))
+ return token
+
+ elif token[0] == "name":
+ if self.type == "":
+ self.type = token[1]
+ else:
+ self.type = self.type + " " + token[1]
+ else:
+ self.error("parsing type %s: expecting a name" % (self.type),
+ token)
+ return token
+ token = self.token()
while token != None and (token[0] == "op" or
- token[0] == "name" and token[1] == "const"):
- self.type = self.type + " " + token[1]
- token = self.token()
-
- #
- # if there is a parenthesis here, this means a function type
- #
- if token != None and token[0] == "sep" and token[1] == '(':
- self.type = self.type + token[1]
- token = self.token()
- while token != None and token[0] == "op" and token[1] == '*':
- self.type = self.type + token[1]
- token = self.token()
- if token == None or token[0] != "name" :
- self.error("parsing function type, name expected", token);
- return token
- self.type = self.type + token[1]
- nametok = token
- token = self.token()
- if token != None and token[0] == "sep" and token[1] == ')':
- self.type = self.type + token[1]
- token = self.token()
- if token != None and token[0] == "sep" and token[1] == '(':
- token = self.token()
- type = self.type;
- token = self.parseSignature(token);
- self.type = type;
- else:
- self.error("parsing function type, '(' expected", token);
- return token
- else:
- self.error("parsing function type, ')' expected", token);
- return token
- self.lexer.push(token)
- token = nametok
- return token
+ token[0] == "name" and token[1] == "const"):
+ self.type = self.type + " " + token[1]
+ token = self.token()
+
+ #
+ # if there is a parenthesis here, this means a function type
+ #
+ if token != None and token[0] == "sep" and token[1] == '(':
+ self.type = self.type + token[1]
+ token = self.token()
+ while token != None and token[0] == "op" and token[1] == '*':
+ self.type = self.type + token[1]
+ token = self.token()
+ if token == None or token[0] != "name" :
+ self.error("parsing function type, name expected", token);
+ return token
+ self.type = self.type + token[1]
+ nametok = token
+ token = self.token()
+ if token != None and token[0] == "sep" and token[1] == ')':
+ self.type = self.type + token[1]
+ token = self.token()
+ if token != None and token[0] == "sep" and token[1] == '(':
+ token = self.token()
+ type = self.type;
+ token = self.parseSignature(token);
+ self.type = type;
+ else:
+ self.error("parsing function type, '(' expected", token);
+ return token
+ else:
+ self.error("parsing function type, ')' expected", token);
+ return token
+ self.lexer.push(token)
+ token = nametok
+ return token
#
- # do some lookahead for arrays
- #
- if token != None and token[0] == "name":
- nametok = token
- token = self.token()
- if token != None and token[0] == "sep" and token[1] == '[':
- self.type = self.type + nametok[1]
- while token != None and token[0] == "sep" and token[1] == '[':
- self.type = self.type + token[1]
- token = self.token()
- while token != None and token[0] != 'sep' and \
- token[1] != ']' and token[1] != ';':
- self.type = self.type + token[1]
- token = self.token()
- if token != None and token[0] == 'sep' and token[1] == ']':
- self.type = self.type + token[1]
- token = self.token()
- else:
- self.error("parsing array type, ']' expected", token);
- return token
- elif token != None and token[0] == "sep" and token[1] == ':':
- # remove :12 in case it's a limited int size
- token = self.token()
- token = self.token()
- self.lexer.push(token)
- token = nametok
-
- return token
+ # do some lookahead for arrays
+ #
+ if token != None and token[0] == "name":
+ nametok = token
+ token = self.token()
+ if token != None and token[0] == "sep" and token[1] == '[':
+ self.type = self.type + nametok[1]
+ while token != None and token[0] == "sep" and token[1] == '[':
+ self.type = self.type + token[1]
+ token = self.token()
+ while token != None and token[0] != 'sep' and \
+ token[1] != ']' and token[1] != ';':
+ self.type = self.type + token[1]
+ token = self.token()
+ if token != None and token[0] == 'sep' and token[1] == ']':
+ self.type = self.type + token[1]
+ token = self.token()
+ else:
+ self.error("parsing array type, ']' expected", token);
+ return token
+ elif token != None and token[0] == "sep" and token[1] == ':':
+ # remove :12 in case it's a limited int size
+ token = self.token()
+ token = self.token()
+ self.lexer.push(token)
+ token = nametok
+
+ return token
#
# Parse a signature: '(' has been parsed and we scan the type definition
# up to the ')' included
def parseSignature(self, token):
signature = []
- if token != None and token[0] == "sep" and token[1] == ')':
- self.signature = []
- token = self.token()
- return token
- while token != None:
- token = self.parseType(token)
- if token != None and token[0] == "name":
- signature.append((self.type, token[1], None))
- token = self.token()
- elif token != None and token[0] == "sep" and token[1] == ',':
- token = self.token()
- continue
- elif token != None and token[0] == "sep" and token[1] == ')':
- # only the type was provided
- if self.type == "...":
- signature.append((self.type, "...", None))
- else:
- signature.append((self.type, None, None))
- if token != None and token[0] == "sep":
- if token[1] == ',':
- token = self.token()
- continue
- elif token[1] == ')':
- token = self.token()
- break
- self.signature = signature
- return token
+ if token != None and token[0] == "sep" and token[1] == ')':
+ self.signature = []
+ token = self.token()
+ return token
+ while token != None:
+ token = self.parseType(token)
+ if token != None and token[0] == "name":
+ signature.append((self.type, token[1], None))
+ token = self.token()
+ elif token != None and token[0] == "sep" and token[1] == ',':
+ token = self.token()
+ continue
+ elif token != None and token[0] == "sep" and token[1] == ')':
+ # only the type was provided
+ if self.type == "...":
+ signature.append((self.type, "...", None))
+ else:
+ signature.append((self.type, None, None))
+ if token != None and token[0] == "sep":
+ if token[1] == ',':
+ token = self.token()
+ continue
+ elif token[1] == ')':
+ token = self.token()
+ break
+ self.signature = signature
+ return token
#
# Parse a global definition, be it a type, variable or function
@@ -1471,134 +1471,134 @@ class CParser:
def parseGlobal(self, token):
static = 0
if token[1] == 'extern':
- token = self.token()
- if token == None:
- return token
- if token[0] == 'string':
- if token[1] == 'C':
- token = self.token()
- if token == None:
- return token
- if token[0] == 'sep' and token[1] == "{":
- token = self.token()
-# print 'Entering extern "C line ', self.lineno()
- while token != None and (token[0] != 'sep' or
- token[1] != "}"):
- if token[0] == 'name':
- token = self.parseGlobal(token)
- else:
- self.error(
- "token %s %s unexpected at the top level" % (
- token[0], token[1]))
- token = self.parseGlobal(token)
-# print 'Exiting extern "C" line', self.lineno()
- token = self.token()
- return token
- else:
- return token
- elif token[1] == 'static':
- static = 1
- token = self.token()
- if token == None or token[0] != 'name':
- return token
-
- if token[1] == 'typedef':
- token = self.token()
- return self.parseTypedef(token)
- else:
- token = self.parseType(token)
- type_orig = self.type
- if token == None or token[0] != "name":
- return token
- type = type_orig
- self.name = token[1]
- token = self.token()
- while token != None and (token[0] == "sep" or token[0] == "op"):
- if token[0] == "sep":
- if token[1] == "[":
- type = type + token[1]
- token = self.token()
- while token != None and (token[0] != "sep" or \
- token[1] != ";"):
- type = type + token[1]
- token = self.token()
-
- if token != None and token[0] == "op" and token[1] == "=":
- #
- # Skip the initialization of the variable
- #
- token = self.token()
- if token[0] == 'sep' and token[1] == '{':
- token = self.token()
- token = self.parseBlock(token)
- else:
- self.comment = None
- while token != None and (token[0] != "sep" or \
- (token[1] != ';' and token[1] != ',')):
- token = self.token()
- self.comment = None
- if token == None or token[0] != "sep" or (token[1] != ';' and
- token[1] != ','):
- self.error("missing ';' or ',' after value")
-
- if token != None and token[0] == "sep":
- if token[1] == ";":
- self.comment = None
- token = self.token()
- if type == "struct":
- self.index_add(self.name, self.filename,
- not self.is_header, "struct", self.struct_fields)
- else:
- self.index_add(self.name, self.filename,
- not self.is_header, "variable", type)
- break
- elif token[1] == "(":
- token = self.token()
- token = self.parseSignature(token)
- if token == None:
- return None
- if token[0] == "sep" and token[1] == ";":
- d = self.mergeFunctionComment(self.name,
- ((type, None), self.signature), 1)
- self.index_add(self.name, self.filename, static,
- "function", d)
- token = self.token()
- elif token[0] == "sep" and token[1] == "{":
- d = self.mergeFunctionComment(self.name,
- ((type, None), self.signature), static)
- self.index_add(self.name, self.filename, static,
- "function", d)
- token = self.token()
- token = self.parseBlock(token);
- elif token[1] == ',':
- self.comment = None
- self.index_add(self.name, self.filename, static,
- "variable", type)
- type = type_orig
- token = self.token()
- while token != None and token[0] == "sep":
- type = type + token[1]
- token = self.token()
- if token != None and token[0] == "name":
- self.name = token[1]
- token = self.token()
- else:
- break
-
- return token
+ token = self.token()
+ if token == None:
+ return token
+ if token[0] == 'string':
+ if token[1] == 'C':
+ token = self.token()
+ if token == None:
+ return token
+ if token[0] == 'sep' and token[1] == "{":
+ token = self.token()
+# print 'Entering extern "C line ', self.lineno()
+ while token != None and (token[0] != 'sep' or
+ token[1] != "}"):
+ if token[0] == 'name':
+ token = self.parseGlobal(token)
+ else:
+ self.error(
+ "token %s %s unexpected at the top level" % (
+ token[0], token[1]))
+ token = self.parseGlobal(token)
+# print 'Exiting extern "C" line', self.lineno()
+ token = self.token()
+ return token
+ else:
+ return token
+ elif token[1] == 'static':
+ static = 1
+ token = self.token()
+ if token == None or token[0] != 'name':
+ return token
+
+ if token[1] == 'typedef':
+ token = self.token()
+ return self.parseTypedef(token)
+ else:
+ token = self.parseType(token)
+ type_orig = self.type
+ if token == None or token[0] != "name":
+ return token
+ type = type_orig
+ self.name = token[1]
+ token = self.token()
+ while token != None and (token[0] == "sep" or token[0] == "op"):
+ if token[0] == "sep":
+ if token[1] == "[":
+ type = type + token[1]
+ token = self.token()
+ while token != None and (token[0] != "sep" or \
+ token[1] != ";"):
+ type = type + token[1]
+ token = self.token()
+
+ if token != None and token[0] == "op" and token[1] == "=":
+ #
+ # Skip the initialization of the variable
+ #
+ token = self.token()
+ if token[0] == 'sep' and token[1] == '{':
+ token = self.token()
+ token = self.parseBlock(token)
+ else:
+ self.comment = None
+ while token != None and (token[0] != "sep" or \
+ (token[1] != ';' and token[1] != ',')):
+ token = self.token()
+ self.comment = None
+ if token == None or token[0] != "sep" or (token[1] != ';' and
+ token[1] != ','):
+ self.error("missing ';' or ',' after value")
+
+ if token != None and token[0] == "sep":
+ if token[1] == ";":
+ self.comment = None
+ token = self.token()
+ if type == "struct":
+ self.index_add(self.name, self.filename,
+ not self.is_header, "struct", self.struct_fields)
+ else:
+ self.index_add(self.name, self.filename,
+ not self.is_header, "variable", type)
+ break
+ elif token[1] == "(":
+ token = self.token()
+ token = self.parseSignature(token)
+ if token == None:
+ return None
+ if token[0] == "sep" and token[1] == ";":
+ d = self.mergeFunctionComment(self.name,
+ ((type, None), self.signature), 1)
+ self.index_add(self.name, self.filename, static,
+ "function", d)
+ token = self.token()
+ elif token[0] == "sep" and token[1] == "{":
+ d = self.mergeFunctionComment(self.name,
+ ((type, None), self.signature), static)
+ self.index_add(self.name, self.filename, static,
+ "function", d)
+ token = self.token()
+ token = self.parseBlock(token);
+ elif token[1] == ',':
+ self.comment = None
+ self.index_add(self.name, self.filename, static,
+ "variable", type)
+ type = type_orig
+ token = self.token()
+ while token != None and token[0] == "sep":
+ type = type + token[1]
+ token = self.token()
+ if token != None and token[0] == "name":
+ self.name = token[1]
+ token = self.token()
+ else:
+ break
+
+ return token
def parse(self):
self.warning("Parsing %s" % (self.filename))
token = self.token()
- while token != None:
+ while token != None:
if token[0] == 'name':
- token = self.parseGlobal(token)
+ token = self.parseGlobal(token)
else:
- self.error("token %s %s unexpected at the top level" % (
- token[0], token[1]))
- token = self.parseGlobal(token)
- return
- self.parseTopComment(self.top_comment)
+ self.error("token %s %s unexpected at the top level" % (
+ token[0], token[1]))
+ token = self.parseGlobal(token)
+ return
+ self.parseTopComment(self.top_comment)
return self.index
@@ -1607,490 +1607,490 @@ class docBuilder:
def __init__(self, name, directories=['.'], excludes=[]):
self.name = name
self.directories = directories
- self.excludes = excludes + ignored_files.keys()
- self.modules = {}
- self.headers = {}
- self.idx = index()
+ self.excludes = excludes + list(ignored_files.keys())
+ self.modules = {}
+ self.headers = {}
+ self.idx = index()
self.xref = {}
- self.index = {}
- if name == 'libxml2':
- self.basename = 'libxml'
- else:
- self.basename = name
+ self.index = {}
+ if name == 'libxml2':
+ self.basename = 'libxml'
+ else:
+ self.basename = name
def indexString(self, id, str):
- if str == None:
- return
- str = string.replace(str, "'", ' ')
- str = string.replace(str, '"', ' ')
- str = string.replace(str, "/", ' ')
- str = string.replace(str, '*', ' ')
- str = string.replace(str, "[", ' ')
- str = string.replace(str, "]", ' ')
- str = string.replace(str, "(", ' ')
- str = string.replace(str, ")", ' ')
- str = string.replace(str, "<", ' ')
- str = string.replace(str, '>', ' ')
- str = string.replace(str, "&", ' ')
- str = string.replace(str, '#', ' ')
- str = string.replace(str, ",", ' ')
- str = string.replace(str, '.', ' ')
- str = string.replace(str, ';', ' ')
- tokens = string.split(str)
- for token in tokens:
- try:
- c = token[0]
- if string.find(string.letters, c) < 0:
- pass
- elif len(token) < 3:
- pass
- else:
- lower = string.lower(token)
- # TODO: generalize this a bit
- if lower == 'and' or lower == 'the':
- pass
- elif self.xref.has_key(token):
- self.xref[token].append(id)
- else:
- self.xref[token] = [id]
- except:
- pass
+ if str == None:
+ return
+ str = str.replace("'", ' ')
+ str = str.replace('"', ' ')
+ str = str.replace("/", ' ')
+ str = str.replace('*', ' ')
+ str = str.replace("[", ' ')
+ str = str.replace("]", ' ')
+ str = str.replace("(", ' ')
+ str = str.replace(")", ' ')
+ str = str.replace("<", ' ')
+ str = str.replace('>', ' ')
+ str = str.replace("&", ' ')
+ str = str.replace('#', ' ')
+ str = str.replace(",", ' ')
+ str = str.replace('.', ' ')
+ str = str.replace(';', ' ')
+ tokens = str.split()
+ for token in tokens:
+ try:
+ c = token[0]
+ if string.ascii_letters.find(c) < 0:
+ pass
+ elif len(token) < 3:
+ pass
+ else:
+ lower = token.lower()
+ # TODO: generalize this a bit
+ if lower == 'and' or lower == 'the':
+ pass
+ elif token in self.xref:
+ self.xref[token].append(id)
+ else:
+ self.xref[token] = [id]
+ except:
+ pass
def analyze(self):
- print "Project %s : %d headers, %d modules" % (self.name, len(self.headers.keys()), len(self.modules.keys()))
- self.idx.analyze()
+ print("Project %s : %d headers, %d modules" % (self.name, len(list(self.headers.keys())), len(list(self.modules.keys()))))
+ self.idx.analyze()
def scanHeaders(self):
- for header in self.headers.keys():
- parser = CParser(header)
- idx = parser.parse()
- self.headers[header] = idx;
- self.idx.merge(idx)
+ for header in list(self.headers.keys()):
+ parser = CParser(header)
+ idx = parser.parse()
+ self.headers[header] = idx;
+ self.idx.merge(idx)
def scanModules(self):
- for module in self.modules.keys():
- parser = CParser(module)
- idx = parser.parse()
- # idx.analyze()
- self.modules[module] = idx
- self.idx.merge_public(idx)
+ for module in list(self.modules.keys()):
+ parser = CParser(module)
+ idx = parser.parse()
+ # idx.analyze()
+ self.modules[module] = idx
+ self.idx.merge_public(idx)
def scan(self):
for directory in self.directories:
- files = glob.glob(directory + "/*.c")
- for file in files:
- skip = 0
- for excl in self.excludes:
- if string.find(file, excl) != -1:
- print "Skipping %s" % file
- skip = 1
- break
- if skip == 0:
- self.modules[file] = None;
- files = glob.glob(directory + "/*.h")
- for file in files:
- skip = 0
- for excl in self.excludes:
- if string.find(file, excl) != -1:
- print "Skipping %s" % file
- skip = 1
- break
- if skip == 0:
- self.headers[file] = None;
- self.scanHeaders()
- self.scanModules()
+ files = glob.glob(directory + "/*.c")
+ for file in files:
+ skip = 0
+ for excl in self.excludes:
+ if file.find(excl) != -1:
+ print("Skipping %s" % file)
+ skip = 1
+ break
+ if skip == 0:
+ self.modules[file] = None;
+ files = glob.glob(directory + "/*.h")
+ for file in files:
+ skip = 0
+ for excl in self.excludes:
+ if file.find(excl) != -1:
+ print("Skipping %s" % file)
+ skip = 1
+ break
+ if skip == 0:
+ self.headers[file] = None;
+ self.scanHeaders()
+ self.scanModules()
def modulename_file(self, file):
module = os.path.basename(file)
- if module[-2:] == '.h':
- module = module[:-2]
- elif module[-2:] == '.c':
- module = module[:-2]
- return module
+ if module[-2:] == '.h':
+ module = module[:-2]
+ elif module[-2:] == '.c':
+ module = module[:-2]
+ return module
def serialize_enum(self, output, name):
id = self.idx.enums[name]
output.write(" <enum name='%s' file='%s'" % (name,
- self.modulename_file(id.header)))
- if id.info != None:
- info = id.info
- if info[0] != None and info[0] != '':
- try:
- val = eval(info[0])
- except:
- val = info[0]
- output.write(" value='%s'" % (val));
- if info[2] != None and info[2] != '':
- output.write(" type='%s'" % info[2]);
- if info[1] != None and info[1] != '':
- output.write(" info='%s'" % escape(info[1]));
+ self.modulename_file(id.header)))
+ if id.info != None:
+ info = id.info
+ if info[0] != None and info[0] != '':
+ try:
+ val = eval(info[0])
+ except:
+ val = info[0]
+ output.write(" value='%s'" % (val));
+ if info[2] != None and info[2] != '':
+ output.write(" type='%s'" % info[2]);
+ if info[1] != None and info[1] != '':
+ output.write(" info='%s'" % escape(info[1]));
output.write("/>\n")
def serialize_macro(self, output, name):
id = self.idx.macros[name]
output.write(" <macro name='%s' file='%s'>\n" % (name,
- self.modulename_file(id.header)))
- if id.info != None:
+ self.modulename_file(id.header)))
+ if id.info != None:
try:
- (args, desc) = id.info
- if desc != None and desc != "":
- output.write(" <info>%s</info>\n" % (escape(desc)))
- self.indexString(name, desc)
- for arg in args:
- (name, desc) = arg
- if desc != None and desc != "":
- output.write(" <arg name='%s' info='%s'/>\n" % (
- name, escape(desc)))
- self.indexString(name, desc)
- else:
- output.write(" <arg name='%s'/>\n" % (name))
+ (args, desc) = id.info
+ if desc != None and desc != "":
+ output.write(" <info>%s</info>\n" % (escape(desc)))
+ self.indexString(name, desc)
+ for arg in args:
+ (name, desc) = arg
+ if desc != None and desc != "":
+ output.write(" <arg name='%s' info='%s'/>\n" % (
+ name, escape(desc)))
+ self.indexString(name, desc)
+ else:
+ output.write(" <arg name='%s'/>\n" % (name))
except:
pass
output.write(" </macro>\n")
def serialize_typedef(self, output, name):
id = self.idx.typedefs[name]
- if id.info[0:7] == 'struct ':
- output.write(" <struct name='%s' file='%s' type='%s'" % (
- name, self.modulename_file(id.header), id.info))
- name = id.info[7:]
- if self.idx.structs.has_key(name) and ( \
- type(self.idx.structs[name].info) == type(()) or
- type(self.idx.structs[name].info) == type([])):
- output.write(">\n");
- try:
- for field in self.idx.structs[name].info:
- desc = field[2]
- self.indexString(name, desc)
- if desc == None:
- desc = ''
- else:
- desc = escape(desc)
- output.write(" <field name='%s' type='%s' info='%s'/>\n" % (field[1] , field[0], desc))
- except:
- print "Failed to serialize struct %s" % (name)
- output.write(" </struct>\n")
- else:
- output.write("/>\n");
- else :
- output.write(" <typedef name='%s' file='%s' type='%s'" % (
- name, self.modulename_file(id.header), id.info))
+ if id.info[0:7] == 'struct ':
+ output.write(" <struct name='%s' file='%s' type='%s'" % (
+ name, self.modulename_file(id.header), id.info))
+ name = id.info[7:]
+ if name in self.idx.structs and ( \
+ type(self.idx.structs[name].info) == type(()) or
+ type(self.idx.structs[name].info) == type([])):
+ output.write(">\n");
+ try:
+ for field in self.idx.structs[name].info:
+ desc = field[2]
+ self.indexString(name, desc)
+ if desc == None:
+ desc = ''
+ else:
+ desc = escape(desc)
+ output.write(" <field name='%s' type='%s' info='%s'/>\n" % (field[1] , field[0], desc))
+ except:
+ print("Failed to serialize struct %s" % (name))
+ output.write(" </struct>\n")
+ else:
+ output.write("/>\n");
+ else :
+ output.write(" <typedef name='%s' file='%s' type='%s'" % (
+ name, self.modulename_file(id.header), id.info))
try:
- desc = id.extra
- if desc != None and desc != "":
- output.write(">\n <info>%s</info>\n" % (escape(desc)))
- output.write(" </typedef>\n")
- else:
- output.write("/>\n")
- except:
- output.write("/>\n")
+ desc = id.extra
+ if desc != None and desc != "":
+ output.write(">\n <info>%s</info>\n" % (escape(desc)))
+ output.write(" </typedef>\n")
+ else:
+ output.write("/>\n")
+ except:
+ output.write("/>\n")
def serialize_variable(self, output, name):
id = self.idx.variables[name]
- if id.info != None:
- output.write(" <variable name='%s' file='%s' type='%s'/>\n" % (
- name, self.modulename_file(id.header), id.info))
- else:
- output.write(" <variable name='%s' file='%s'/>\n" % (
- name, self.modulename_file(id.header)))
+ if id.info != None:
+ output.write(" <variable name='%s' file='%s' type='%s'/>\n" % (
+ name, self.modulename_file(id.header), id.info))
+ else:
+ output.write(" <variable name='%s' file='%s'/>\n" % (
+ name, self.modulename_file(id.header)))
def serialize_function(self, output, name):
id = self.idx.functions[name]
- if name == debugsym:
- print "=>", id
+ if name == debugsym:
+ print("=>", id)
output.write(" <%s name='%s' file='%s' module='%s'>\n" % (id.type,
- name, self.modulename_file(id.header),
- self.modulename_file(id.module)))
- #
- # Processing of conditionals modified by Bill 1/1/05
- #
- if id.conditionals != None:
- apstr = ""
- for cond in id.conditionals:
- if apstr != "":
- apstr = apstr + " &amp;&amp; "
- apstr = apstr + cond
- output.write(" <cond>%s</cond>\n"% (apstr));
- try:
- (ret, params, desc) = id.info
- if (desc == None or desc == '') and \
- name[0:9] != "xmlThrDef" and name != "xmlDllMain":
- print "%s %s from %s has no description" % (id.type, name,
- self.modulename_file(id.module))
-
- output.write(" <info>%s</info>\n" % (escape(desc)))
- self.indexString(name, desc)
- if ret[0] != None:
- if ret[0] == "void":
- output.write(" <return type='void'/>\n")
- else:
- output.write(" <return type='%s' info='%s'/>\n" % (
- ret[0], escape(ret[1])))
- self.indexString(name, ret[1])
- for param in params:
- if param[0] == 'void':
- continue
- if param[2] == None:
- output.write(" <arg name='%s' type='%s' info=''/>\n" % (param[1], param[0]))
- else:
- output.write(" <arg name='%s' type='%s' info='%s'/>\n" % (param[1], param[0], escape(param[2])))
- self.indexString(name, param[2])
- except:
- print "Failed to save function %s info: " % name, `id.info`
+ name, self.modulename_file(id.header),
+ self.modulename_file(id.module)))
+ #
+ # Processing of conditionals modified by Bill 1/1/05
+ #
+ if id.conditionals != None:
+ apstr = ""
+ for cond in id.conditionals:
+ if apstr != "":
+ apstr = apstr + " &amp;&amp; "
+ apstr = apstr + cond
+ output.write(" <cond>%s</cond>\n"% (apstr));
+ try:
+ (ret, params, desc) = id.info
+ if (desc == None or desc == '') and \
+ name[0:9] != "xmlThrDef" and name != "xmlDllMain":
+ print("%s %s from %s has no description" % (id.type, name,
+ self.modulename_file(id.module)))
+
+ output.write(" <info>%s</info>\n" % (escape(desc)))
+ self.indexString(name, desc)
+ if ret[0] != None:
+ if ret[0] == "void":
+ output.write(" <return type='void'/>\n")
+ else:
+ output.write(" <return type='%s' info='%s'/>\n" % (
+ ret[0], escape(ret[1])))
+ self.indexString(name, ret[1])
+ for param in params:
+ if param[0] == 'void':
+ continue
+ if param[2] == None:
+ output.write(" <arg name='%s' type='%s' info=''/>\n" % (param[1], param[0]))
+ else:
+ output.write(" <arg name='%s' type='%s' info='%s'/>\n" % (param[1], param[0], escape(param[2])))
+ self.indexString(name, param[2])
+ except:
+ print("Failed to save function %s info: " % name, repr(id.info))
output.write(" </%s>\n" % (id.type))
def serialize_exports(self, output, file):
module = self.modulename_file(file)
- output.write(" <file name='%s'>\n" % (module))
- dict = self.headers[file]
- if dict.info != None:
- for data in ('Summary', 'Description', 'Author'):
- try:
- output.write(" <%s>%s</%s>\n" % (
- string.lower(data),
- escape(dict.info[data]),
- string.lower(data)))
- except:
- print "Header %s lacks a %s description" % (module, data)
- if dict.info.has_key('Description'):
- desc = dict.info['Description']
- if string.find(desc, "DEPRECATED") != -1:
- output.write(" <deprecated/>\n")
-
- ids = dict.macros.keys()
- ids.sort()
- for id in uniq(ids):
- # Macros are sometime used to masquerade other types.
- if dict.functions.has_key(id):
- continue
- if dict.variables.has_key(id):
- continue
- if dict.typedefs.has_key(id):
- continue
- if dict.structs.has_key(id):
- continue
- if dict.enums.has_key(id):
- continue
- output.write(" <exports symbol='%s' type='macro'/>\n" % (id))
- ids = dict.enums.keys()
- ids.sort()
- for id in uniq(ids):
- output.write(" <exports symbol='%s' type='enum'/>\n" % (id))
- ids = dict.typedefs.keys()
- ids.sort()
- for id in uniq(ids):
- output.write(" <exports symbol='%s' type='typedef'/>\n" % (id))
- ids = dict.structs.keys()
- ids.sort()
- for id in uniq(ids):
- output.write(" <exports symbol='%s' type='struct'/>\n" % (id))
- ids = dict.variables.keys()
- ids.sort()
- for id in uniq(ids):
- output.write(" <exports symbol='%s' type='variable'/>\n" % (id))
- ids = dict.functions.keys()
- ids.sort()
- for id in uniq(ids):
- output.write(" <exports symbol='%s' type='function'/>\n" % (id))
- output.write(" </file>\n")
+ output.write(" <file name='%s'>\n" % (module))
+ dict = self.headers[file]
+ if dict.info != None:
+ for data in ('Summary', 'Description', 'Author'):
+ try:
+ output.write(" <%s>%s</%s>\n" % (
+ data.lower(),
+ escape(dict.info[data]),
+ data.lower()))
+ except:
+ print("Header %s lacks a %s description" % (module, data))
+ if 'Description' in dict.info:
+ desc = dict.info['Description']
+ if desc.find("DEPRECATED") != -1:
+ output.write(" <deprecated/>\n")
+
+ ids = list(dict.macros.keys())
+ ids.sort()
+ for id in uniq(ids):
+ # Macros are sometime used to masquerade other types.
+ if id in dict.functions:
+ continue
+ if id in dict.variables:
+ continue
+ if id in dict.typedefs:
+ continue
+ if id in dict.structs:
+ continue
+ if id in dict.enums:
+ continue
+ output.write(" <exports symbol='%s' type='macro'/>\n" % (id))
+ ids = list(dict.enums.keys())
+ ids.sort()
+ for id in uniq(ids):
+ output.write(" <exports symbol='%s' type='enum'/>\n" % (id))
+ ids = list(dict.typedefs.keys())
+ ids.sort()
+ for id in uniq(ids):
+ output.write(" <exports symbol='%s' type='typedef'/>\n" % (id))
+ ids = list(dict.structs.keys())
+ ids.sort()
+ for id in uniq(ids):
+ output.write(" <exports symbol='%s' type='struct'/>\n" % (id))
+ ids = list(dict.variables.keys())
+ ids.sort()
+ for id in uniq(ids):
+ output.write(" <exports symbol='%s' type='variable'/>\n" % (id))
+ ids = list(dict.functions.keys())
+ ids.sort()
+ for id in uniq(ids):
+ output.write(" <exports symbol='%s' type='function'/>\n" % (id))
+ output.write(" </file>\n")
def serialize_xrefs_files(self, output):
- headers = self.headers.keys()
+ headers = list(self.headers.keys())
headers.sort()
for file in headers:
- module = self.modulename_file(file)
- output.write(" <file name='%s'>\n" % (module))
- dict = self.headers[file]
- ids = uniq(dict.functions.keys() + dict.variables.keys() + \
- dict.macros.keys() + dict.typedefs.keys() + \
- dict.structs.keys() + dict.enums.keys())
- ids.sort()
- for id in ids:
- output.write(" <ref name='%s'/>\n" % (id))
- output.write(" </file>\n")
+ module = self.modulename_file(file)
+ output.write(" <file name='%s'>\n" % (module))
+ dict = self.headers[file]
+ ids = uniq(list(dict.functions.keys()) + list(dict.variables.keys()) + \
+ list(dict.macros.keys()) + list(dict.typedefs.keys()) + \
+ list(dict.structs.keys()) + list(dict.enums.keys()))
+ ids.sort()
+ for id in ids:
+ output.write(" <ref name='%s'/>\n" % (id))
+ output.write(" </file>\n")
pass
def serialize_xrefs_functions(self, output):
funcs = {}
- for name in self.idx.functions.keys():
- id = self.idx.functions[name]
- try:
- (ret, params, desc) = id.info
- for param in params:
- if param[0] == 'void':
- continue
- if funcs.has_key(param[0]):
- funcs[param[0]].append(name)
- else:
- funcs[param[0]] = [name]
- except:
- pass
- typ = funcs.keys()
- typ.sort()
- for type in typ:
- if type == '' or type == 'void' or type == "int" or \
- type == "char *" or type == "const char *" :
- continue
- output.write(" <type name='%s'>\n" % (type))
- ids = funcs[type]
- ids.sort()
- pid = '' # not sure why we have dups, but get rid of them!
- for id in ids:
- if id != pid:
- output.write(" <ref name='%s'/>\n" % (id))
- pid = id
- output.write(" </type>\n")
+ for name in list(self.idx.functions.keys()):
+ id = self.idx.functions[name]
+ try:
+ (ret, params, desc) = id.info
+ for param in params:
+ if param[0] == 'void':
+ continue
+ if param[0] in funcs:
+ funcs[param[0]].append(name)
+ else:
+ funcs[param[0]] = [name]
+ except:
+ pass
+ typ = list(funcs.keys())
+ typ.sort()
+ for type in typ:
+ if type == '' or type == 'void' or type == "int" or \
+ type == "char *" or type == "const char *" :
+ continue
+ output.write(" <type name='%s'>\n" % (type))
+ ids = funcs[type]
+ ids.sort()
+ pid = '' # not sure why we have dups, but get rid of them!
+ for id in ids:
+ if id != pid:
+ output.write(" <ref name='%s'/>\n" % (id))
+ pid = id
+ output.write(" </type>\n")
def serialize_xrefs_constructors(self, output):
funcs = {}
- for name in self.idx.functions.keys():
- id = self.idx.functions[name]
- try:
- (ret, params, desc) = id.info
- if ret[0] == "void":
- continue
- if funcs.has_key(ret[0]):
- funcs[ret[0]].append(name)
- else:
- funcs[ret[0]] = [name]
- except:
- pass
- typ = funcs.keys()
- typ.sort()
- for type in typ:
- if type == '' or type == 'void' or type == "int" or \
- type == "char *" or type == "const char *" :
- continue
- output.write(" <type name='%s'>\n" % (type))
- ids = funcs[type]
- ids.sort()
- for id in ids:
- output.write(" <ref name='%s'/>\n" % (id))
- output.write(" </type>\n")
+ for name in list(self.idx.functions.keys()):
+ id = self.idx.functions[name]
+ try:
+ (ret, params, desc) = id.info
+ if ret[0] == "void":
+ continue
+ if ret[0] in funcs:
+ funcs[ret[0]].append(name)
+ else:
+ funcs[ret[0]] = [name]
+ except:
+ pass
+ typ = list(funcs.keys())
+ typ.sort()
+ for type in typ:
+ if type == '' or type == 'void' or type == "int" or \
+ type == "char *" or type == "const char *" :
+ continue
+ output.write(" <type name='%s'>\n" % (type))
+ ids = funcs[type]
+ ids.sort()
+ for id in ids:
+ output.write(" <ref name='%s'/>\n" % (id))
+ output.write(" </type>\n")
def serialize_xrefs_alpha(self, output):
- letter = None
- ids = self.idx.identifiers.keys()
- ids.sort()
- for id in ids:
- if id[0] != letter:
- if letter != None:
- output.write(" </letter>\n")
- letter = id[0]
- output.write(" <letter name='%s'>\n" % (letter))
- output.write(" <ref name='%s'/>\n" % (id))
- if letter != None:
- output.write(" </letter>\n")
+ letter = None
+ ids = list(self.idx.identifiers.keys())
+ ids.sort()
+ for id in ids:
+ if id[0] != letter:
+ if letter != None:
+ output.write(" </letter>\n")
+ letter = id[0]
+ output.write(" <letter name='%s'>\n" % (letter))
+ output.write(" <ref name='%s'/>\n" % (id))
+ if letter != None:
+ output.write(" </letter>\n")
def serialize_xrefs_references(self, output):
- typ = self.idx.identifiers.keys()
- typ.sort()
- for id in typ:
- idf = self.idx.identifiers[id]
- module = idf.header
- output.write(" <reference name='%s' href='%s'/>\n" % (id,
- 'html/' + self.basename + '-' +
- self.modulename_file(module) + '.html#' +
- id))
+ typ = list(self.idx.identifiers.keys())
+ typ.sort()
+ for id in typ:
+ idf = self.idx.identifiers[id]
+ module = idf.header
+ output.write(" <reference name='%s' href='%s'/>\n" % (id,
+ 'html/' + self.basename + '-' +
+ self.modulename_file(module) + '.html#' +
+ id))
def serialize_xrefs_index(self, output):
index = self.xref
- typ = index.keys()
- typ.sort()
- letter = None
- count = 0
- chunk = 0
- chunks = []
- for id in typ:
- if len(index[id]) > 30:
- continue
- if id[0] != letter:
- if letter == None or count > 200:
- if letter != None:
- output.write(" </letter>\n")
- output.write(" </chunk>\n")
- count = 0
- chunks.append(["chunk%s" % (chunk -1), first_letter, letter])
- output.write(" <chunk name='chunk%s'>\n" % (chunk))
- first_letter = id[0]
- chunk = chunk + 1
- elif letter != None:
- output.write(" </letter>\n")
- letter = id[0]
- output.write(" <letter name='%s'>\n" % (letter))
- output.write(" <word name='%s'>\n" % (id))
- tokens = index[id];
- tokens.sort()
- tok = None
- for token in tokens:
- if tok == token:
- continue
- tok = token
- output.write(" <ref name='%s'/>\n" % (token))
- count = count + 1
- output.write(" </word>\n")
- if letter != None:
- output.write(" </letter>\n")
- output.write(" </chunk>\n")
- if count != 0:
- chunks.append(["chunk%s" % (chunk -1), first_letter, letter])
- output.write(" <chunks>\n")
- for ch in chunks:
- output.write(" <chunk name='%s' start='%s' end='%s'/>\n" % (
- ch[0], ch[1], ch[2]))
- output.write(" </chunks>\n")
+ typ = list(index.keys())
+ typ.sort()
+ letter = None
+ count = 0
+ chunk = 0
+ chunks = []
+ for id in typ:
+ if len(index[id]) > 30:
+ continue
+ if id[0] != letter:
+ if letter == None or count > 200:
+ if letter != None:
+ output.write(" </letter>\n")
+ output.write(" </chunk>\n")
+ count = 0
+ chunks.append(["chunk%s" % (chunk -1), first_letter, letter])
+ output.write(" <chunk name='chunk%s'>\n" % (chunk))
+ first_letter = id[0]
+ chunk = chunk + 1
+ elif letter != None:
+ output.write(" </letter>\n")
+ letter = id[0]
+ output.write(" <letter name='%s'>\n" % (letter))
+ output.write(" <word name='%s'>\n" % (id))
+ tokens = index[id];
+ tokens.sort()
+ tok = None
+ for token in tokens:
+ if tok == token:
+ continue
+ tok = token
+ output.write(" <ref name='%s'/>\n" % (token))
+ count = count + 1
+ output.write(" </word>\n")
+ if letter != None:
+ output.write(" </letter>\n")
+ output.write(" </chunk>\n")
+ if count != 0:
+ chunks.append(["chunk%s" % (chunk -1), first_letter, letter])
+ output.write(" <chunks>\n")
+ for ch in chunks:
+ output.write(" <chunk name='%s' start='%s' end='%s'/>\n" % (
+ ch[0], ch[1], ch[2]))
+ output.write(" </chunks>\n")
def serialize_xrefs(self, output):
- output.write(" <references>\n")
- self.serialize_xrefs_references(output)
- output.write(" </references>\n")
- output.write(" <alpha>\n")
- self.serialize_xrefs_alpha(output)
- output.write(" </alpha>\n")
- output.write(" <constructors>\n")
- self.serialize_xrefs_constructors(output)
- output.write(" </constructors>\n")
- output.write(" <functions>\n")
- self.serialize_xrefs_functions(output)
- output.write(" </functions>\n")
- output.write(" <files>\n")
- self.serialize_xrefs_files(output)
- output.write(" </files>\n")
- output.write(" <index>\n")
- self.serialize_xrefs_index(output)
- output.write(" </index>\n")
+ output.write(" <references>\n")
+ self.serialize_xrefs_references(output)
+ output.write(" </references>\n")
+ output.write(" <alpha>\n")
+ self.serialize_xrefs_alpha(output)
+ output.write(" </alpha>\n")
+ output.write(" <constructors>\n")
+ self.serialize_xrefs_constructors(output)
+ output.write(" </constructors>\n")
+ output.write(" <functions>\n")
+ self.serialize_xrefs_functions(output)
+ output.write(" </functions>\n")
+ output.write(" <files>\n")
+ self.serialize_xrefs_files(output)
+ output.write(" </files>\n")
+ output.write(" <index>\n")
+ self.serialize_xrefs_index(output)
+ output.write(" </index>\n")
def serialize(self):
filename = "%s-api.xml" % self.name
- print "Saving XML description %s" % (filename)
+ print("Saving XML description %s" % (filename))
output = open(filename, "w")
output.write('<?xml version="1.0" encoding="ISO-8859-1"?>\n')
output.write("<api name='%s'>\n" % self.name)
output.write(" <files>\n")
- headers = self.headers.keys()
+ headers = list(self.headers.keys())
headers.sort()
for file in headers:
self.serialize_exports(output, file)
output.write(" </files>\n")
output.write(" <symbols>\n")
- macros = self.idx.macros.keys()
+ macros = list(self.idx.macros.keys())
macros.sort()
for macro in macros:
self.serialize_macro(output, macro)
- enums = self.idx.enums.keys()
+ enums = list(self.idx.enums.keys())
enums.sort()
for enum in enums:
self.serialize_enum(output, enum)
- typedefs = self.idx.typedefs.keys()
+ typedefs = list(self.idx.typedefs.keys())
typedefs.sort()
for typedef in typedefs:
self.serialize_typedef(output, typedef)
- variables = self.idx.variables.keys()
+ variables = list(self.idx.variables.keys())
variables.sort()
for variable in variables:
self.serialize_variable(output, variable)
- functions = self.idx.functions.keys()
+ functions = list(self.idx.functions.keys())
functions.sort()
for function in functions:
self.serialize_function(output, function)
@@ -2099,7 +2099,7 @@ class docBuilder:
output.close()
filename = "%s-refs.xml" % self.name
- print "Saving XML Cross References %s" % (filename)
+ print("Saving XML Cross References %s" % (filename))
output = open(filename, "w")
output.write('<?xml version="1.0" encoding="ISO-8859-1"?>\n')
output.write("<apirefs name='%s'>\n" % self.name)
@@ -2111,28 +2111,28 @@ class docBuilder:
def rebuild():
builder = None
if glob.glob("parser.c") != [] :
- print "Rebuilding API description for libxml2"
- builder = docBuilder("libxml2", [".", "."],
- ["xmlwin32version.h", "tst.c"])
+ print("Rebuilding API description for libxml2")
+ builder = docBuilder("libxml2", [".", "."],
+ ["xmlwin32version.h", "tst.c"])
elif glob.glob("../parser.c") != [] :
- print "Rebuilding API description for libxml2"
- builder = docBuilder("libxml2", ["..", "../include/libxml"],
- ["xmlwin32version.h", "tst.c"])
+ print("Rebuilding API description for libxml2")
+ builder = docBuilder("libxml2", ["..", "../include/libxml"],
+ ["xmlwin32version.h", "tst.c"])
elif glob.glob("../libxslt/transform.c") != [] :
- print "Rebuilding API description for libxslt"
- builder = docBuilder("libxslt", ["../libxslt"],
- ["win32config.h", "libxslt.h", "tst.c"])
+ print("Rebuilding API description for libxslt")
+ builder = docBuilder("libxslt", ["../libxslt"],
+ ["win32config.h", "libxslt.h", "tst.c"])
else:
- print "rebuild() failed, unable to guess the module"
- return None
+ print("rebuild() failed, unable to guess the module")
+ return None
builder.scan()
builder.analyze()
builder.serialize()
if glob.glob("../libexslt/exslt.c") != [] :
extra = docBuilder("libexslt", ["../libexslt"], ["libexslt.h"])
- extra.scan()
- extra.analyze()
- extra.serialize()
+ extra.scan()
+ extra.analyze()
+ extra.serialize()
return builder
#
@@ -2148,4 +2148,4 @@ if __name__ == "__main__":
debug = 1
parse(sys.argv[1])
else:
- rebuild()
+ rebuild()
diff --git a/doc/devhelp/Makefile.in b/doc/devhelp/Makefile.in
index 711f2cd..5d09d76 100644
--- a/doc/devhelp/Makefile.in
+++ b/doc/devhelp/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -16,6 +16,23 @@
@SET_MAKE@
VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -56,6 +73,11 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
SOURCES =
DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -182,7 +204,6 @@ RANLIB = @RANLIB@
RDL_LIBS = @RDL_LIBS@
READER_TEST = @READER_TEST@
RELDATE = @RELDATE@
-RM = @RM@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
@@ -239,6 +260,7 @@ 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@
@@ -421,8 +443,11 @@ clean-libtool:
-rm -rf .libs _libs
install-dist_devhelpDATA: $(dist_devhelp_DATA)
@$(NORMAL_INSTALL)
- test -z "$(devhelpdir)" || $(MKDIR_P) "$(DESTDIR)$(devhelpdir)"
@list='$(dist_devhelp_DATA)'; test -n "$(devhelpdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(devhelpdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(devhelpdir)" || exit 1; \
+ fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
diff --git a/doc/devhelp/libxml2-dict.html b/doc/devhelp/libxml2-dict.html
index dd42a01..fd5f6b9 100644
--- a/doc/devhelp/libxml2-dict.html
+++ b/doc/devhelp/libxml2-dict.html
@@ -125,7 +125,7 @@ The content of this structure is not made public by the API.
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>dict</tt></i>:</span></td><td>the dictionnary</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of elements in the dictionnary or -1 in case of error</td></tr></tbody></table></div></div>
<hr/>
<div class="refsect2" lang="en"><h3><a name="xmlInitializeDict"/>xmlInitializeDict ()</h3><pre class="programlisting">int xmlInitializeDict (void)<br/>
-</pre><p>Do the dictionary mutex initialization. this function is not thread safe, initialization should preferably be done once at startup</p>
+</pre><p>Do the dictionary mutex initialization. this function is deprecated</p>
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 if initialization was already done, and 1 if that call led to the initialization</td></tr></tbody></table></div></div>
<hr/>
</div>
diff --git a/doc/devhelp/libxml2-relaxng.html b/doc/devhelp/libxml2-relaxng.html
index a89b58f..23905d0 100644
--- a/doc/devhelp/libxml2-relaxng.html
+++ b/doc/devhelp/libxml2-relaxng.html
@@ -262,7 +262,7 @@ The content of this structure is not made public by the API.
<hr/>
<div class="refsect2" lang="en"><h3><a name="xmlRelaxNGValidatePushCData"/>xmlRelaxNGValidatePushCData ()</h3><pre class="programlisting">int xmlRelaxNGValidatePushCData (<a href="libxml2-relaxng.html#xmlRelaxNGValidCtxtPtr">xmlRelaxNGValidCtxtPtr</a> ctxt, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * data, <br/> int len)<br/>
</pre><p>check the CData parsed for validation in the current stack</p>
-<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the RelaxNG validation context</td></tr><tr><td><span class="term"><i><tt>data</tt></i>:</span></td><td>some character data read</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the lenght of the data</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if no validation problem was found or -1 otherwise</td></tr></tbody></table></div></div>
+<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the RelaxNG validation context</td></tr><tr><td><span class="term"><i><tt>data</tt></i>:</span></td><td>some character data read</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the length of the data</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if no validation problem was found or -1 otherwise</td></tr></tbody></table></div></div>
<hr/>
<div class="refsect2" lang="en"><h3><a name="xmlRelaxNGValidatePushElement"/>xmlRelaxNGValidatePushElement ()</h3><pre class="programlisting">int xmlRelaxNGValidatePushElement (<a href="libxml2-relaxng.html#xmlRelaxNGValidCtxtPtr">xmlRelaxNGValidCtxtPtr</a> ctxt, <br/> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br/> <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> elem)<br/>
</pre><p>Push a new element start on the RelaxNG validation stack.</p>
diff --git a/doc/devhelp/libxml2-tree.html b/doc/devhelp/libxml2-tree.html
index ca76d03..90c3903 100644
--- a/doc/devhelp/libxml2-tree.html
+++ b/doc/devhelp/libxml2-tree.html
@@ -812,6 +812,7 @@ The content of this structure is not made public by the API.
int nodeInfoMax : Max depth of the parsing stack
<a href="libxml2-parser.html#xmlParserNodeInfo">xmlParserNodeInfo</a> * nodeInfoTab : array of nodeInfos
int input_id : we need to label inputs
+ unsigned long sizeentcopy : volume of entity copy
} xmlParserCtxt;
</pre><p/>
</div>
@@ -1544,7 +1545,7 @@ The content of this structure is not made public by the API.
<hr/>
<div class="refsect2" lang="en"><h3><a name="xmlSplitQName3"/>xmlSplitQName3 ()</h3><pre class="programlisting">const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * xmlSplitQName3 (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br/> int * len)<br/>
</pre><p>parse an XML qualified name string,i</p>
-<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>the full QName</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>an int *</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>NULL if it is not a Qualified Name, otherwise, update len with the lenght in byte of the prefix and return a pointer to the start of the name without the prefix</td></tr></tbody></table></div></div>
+<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>the full QName</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>an int *</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>NULL if it is not a Qualified Name, otherwise, update len with the length in byte of the prefix and return a pointer to the start of the name without the prefix</td></tr></tbody></table></div></div>
<hr/>
<div class="refsect2" lang="en"><h3><a name="xmlStringGetNodeList"/>xmlStringGetNodeList ()</h3><pre class="programlisting"><a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> xmlStringGetNodeList (<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * value)<br/>
</pre><p>Parse the value string and build the node list associated. Should produce a flat tree with only TEXTs and ENTITY_REFs.</p>
diff --git a/doc/devhelp/libxml2-valid.html b/doc/devhelp/libxml2-valid.html
index 3480214..fcb68e7 100644
--- a/doc/devhelp/libxml2-valid.html
+++ b/doc/devhelp/libxml2-valid.html
@@ -512,7 +512,7 @@ The content of this structure is not made public by the API.
<hr/>
<div class="refsect2" lang="en"><h3><a name="xmlValidatePushCData"/>xmlValidatePushCData ()</h3><pre class="programlisting">int xmlValidatePushCData (<a href="libxml2-valid.html#xmlValidCtxtPtr">xmlValidCtxtPtr</a> ctxt, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * data, <br/> int len)<br/>
</pre><p>check the CData parsed for validation in the current stack</p>
-<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the validation context</td></tr><tr><td><span class="term"><i><tt>data</tt></i>:</span></td><td>some character data read</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the lenght of the data</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if no validation problem was found or 0 otherwise</td></tr></tbody></table></div></div>
+<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the validation context</td></tr><tr><td><span class="term"><i><tt>data</tt></i>:</span></td><td>some character data read</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the length of the data</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if no validation problem was found or 0 otherwise</td></tr></tbody></table></div></div>
<hr/>
<div class="refsect2" lang="en"><h3><a name="xmlValidatePushElement"/>xmlValidatePushElement ()</h3><pre class="programlisting">int xmlValidatePushElement (<a href="libxml2-valid.html#xmlValidCtxtPtr">xmlValidCtxtPtr</a> ctxt, <br/> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br/> <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> elem, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * qname)<br/>
</pre><p>Push a new element start on the validation stack.</p>
diff --git a/doc/devhelp/libxml2-xmlerror.html b/doc/devhelp/libxml2-xmlerror.html
index 4ebaa60..27f7836 100644
--- a/doc/devhelp/libxml2-xmlerror.html
+++ b/doc/devhelp/libxml2-xmlerror.html
@@ -252,6 +252,7 @@ void <a href="#xmlResetError">xmlResetError</a> (<a href="libxml2-xmlerror.htm
<a name="XML_ERR_UNKNOWN_VERSION">XML_ERR_UNKNOWN_VERSION</a> = 108 /* 108 */
<a name="XML_ERR_VERSION_MISMATCH">XML_ERR_VERSION_MISMATCH</a> = 109 /* 109 */
<a name="XML_ERR_NAME_TOO_LONG">XML_ERR_NAME_TOO_LONG</a> = 110 /* 110 */
+ <a name="XML_ERR_USER_STOP">XML_ERR_USER_STOP</a> = 111 /* 111 */
<a name="XML_NS_ERR_XML_NAMESPACE">XML_NS_ERR_XML_NAMESPACE</a> = 200
<a name="XML_NS_ERR_UNDEFINED_NAMESPACE">XML_NS_ERR_UNDEFINED_NAMESPACE</a> = 201 /* 201 */
<a name="XML_NS_ERR_QNAME">XML_NS_ERR_QNAME</a> = 202 /* 202 */
diff --git a/doc/devhelp/libxml2-xmlregexp.html b/doc/devhelp/libxml2-xmlregexp.html
index 4d11966..9427a34 100644
--- a/doc/devhelp/libxml2-xmlregexp.html
+++ b/doc/devhelp/libxml2-xmlregexp.html
@@ -180,11 +180,11 @@ The content of this structure is not made public by the API.
<hr/>
<div class="refsect2" lang="en"><h3><a name="xmlExpGetLanguage"/>xmlExpGetLanguage ()</h3><pre class="programlisting">int xmlExpGetLanguage (<a href="libxml2-xmlregexp.html#xmlExpCtxtPtr">xmlExpCtxtPtr</a> ctxt, <br/> <a href="libxml2-xmlregexp.html#xmlExpNodePtr">xmlExpNodePtr</a> exp, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** langList, <br/> int len)<br/>
</pre><p>Find all the strings used in @exp and store them in @list</p>
-<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the expression context</td></tr><tr><td><span class="term"><i><tt>exp</tt></i>:</span></td><td>the expression</td></tr><tr><td><span class="term"><i><tt>langList</tt></i>:</span></td><td>where to store the tokens</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the allocated lenght of @list</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of unique strings found, -1 in case of errors and -2 if there is more than @len strings</td></tr></tbody></table></div></div>
+<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the expression context</td></tr><tr><td><span class="term"><i><tt>exp</tt></i>:</span></td><td>the expression</td></tr><tr><td><span class="term"><i><tt>langList</tt></i>:</span></td><td>where to store the tokens</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the allocated length of @list</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of unique strings found, -1 in case of errors and -2 if there is more than @len strings</td></tr></tbody></table></div></div>
<hr/>
<div class="refsect2" lang="en"><h3><a name="xmlExpGetStart"/>xmlExpGetStart ()</h3><pre class="programlisting">int xmlExpGetStart (<a href="libxml2-xmlregexp.html#xmlExpCtxtPtr">xmlExpCtxtPtr</a> ctxt, <br/> <a href="libxml2-xmlregexp.html#xmlExpNodePtr">xmlExpNodePtr</a> exp, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** tokList, <br/> int len)<br/>
</pre><p>Find all the strings that appears at the start of the languages accepted by @exp and store them in @list. E.g. for (a, b) | c it will return the list [a, c]</p>
-<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the expression context</td></tr><tr><td><span class="term"><i><tt>exp</tt></i>:</span></td><td>the expression</td></tr><tr><td><span class="term"><i><tt>tokList</tt></i>:</span></td><td>where to store the tokens</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the allocated lenght of @list</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of unique strings found, -1 in case of errors and -2 if there is more than @len strings</td></tr></tbody></table></div></div>
+<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the expression context</td></tr><tr><td><span class="term"><i><tt>exp</tt></i>:</span></td><td>the expression</td></tr><tr><td><span class="term"><i><tt>tokList</tt></i>:</span></td><td>where to store the tokens</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the allocated length of @list</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of unique strings found, -1 in case of errors and -2 if there is more than @len strings</td></tr></tbody></table></div></div>
<hr/>
<div class="refsect2" lang="en"><h3><a name="xmlExpIsNillable"/>xmlExpIsNillable ()</h3><pre class="programlisting">int xmlExpIsNillable (<a href="libxml2-xmlregexp.html#xmlExpNodePtr">xmlExpNodePtr</a> exp)<br/>
</pre><p>Finds if the expression is nillable, i.e. if it accepts the empty sequqnce</p>
@@ -196,7 +196,7 @@ The content of this structure is not made public by the API.
<hr/>
<div class="refsect2" lang="en"><h3><a name="xmlExpNewAtom"/>xmlExpNewAtom ()</h3><pre class="programlisting"><a href="libxml2-xmlregexp.html#xmlExpNodePtr">xmlExpNodePtr</a> xmlExpNewAtom (<a href="libxml2-xmlregexp.html#xmlExpCtxtPtr">xmlExpCtxtPtr</a> ctxt, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br/> int len)<br/>
</pre><p>Get the atom associated to this name from that context</p>
-<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the expression context</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>the atom name</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the atom name lenght in byte (or -1);</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the node or NULL in case of error</td></tr></tbody></table></div></div>
+<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the expression context</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>the atom name</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the atom name length in byte (or -1);</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the node or NULL in case of error</td></tr></tbody></table></div></div>
<hr/>
<div class="refsect2" lang="en"><h3><a name="xmlExpNewCtxt"/>xmlExpNewCtxt ()</h3><pre class="programlisting"><a href="libxml2-xmlregexp.html#xmlExpCtxtPtr">xmlExpCtxtPtr</a> xmlExpNewCtxt (int maxNodes, <br/> <a href="libxml2-dict.html#xmlDictPtr">xmlDictPtr</a> dict)<br/>
</pre><p>Creates a new context for manipulating expressions</p>
diff --git a/doc/devhelp/libxml2-xmlversion.html b/doc/devhelp/libxml2-xmlversion.html
index 69a04e2..8178614 100644
--- a/doc/devhelp/libxml2-xmlversion.html
+++ b/doc/devhelp/libxml2-xmlversion.html
@@ -83,6 +83,7 @@
#define <a href="#DEBUG_MEMORY_LOCATION">DEBUG_MEMORY_LOCATION</a>;
#define <a href="#LIBXML_ATTR_FORMAT">LIBXML_ATTR_FORMAT</a>;
#define <a href="#LIBXML_TEST_VERSION">LIBXML_TEST_VERSION</a>;
+#define <a href="#LIBXML_THREAD_ALLOC_ENABLED">LIBXML_THREAD_ALLOC_ENABLED</a>;
#define <a href="#LIBXML_XPATH_ENABLED">LIBXML_XPATH_ENABLED</a>;
#define <a href="#LIBXML_PATTERN_ENABLED">LIBXML_PATTERN_ENABLED</a>;
#define <a href="#LIBXML_VALID_ENABLED">LIBXML_VALID_ENABLED</a>;
@@ -221,6 +222,10 @@ void <a href="#xmlCheckVersion">xmlCheckVersion</a> (int version);
</pre><p>Macro to check that the libxml version in use is compatible with the version the software has been compiled against</p>
</div>
<hr/>
+ <div class="refsect2" lang="en"><h3><a name="LIBXML_THREAD_ALLOC_ENABLED">Macro </a>LIBXML_THREAD_ALLOC_ENABLED</h3><pre class="programlisting">#define <a href="#LIBXML_THREAD_ALLOC_ENABLED">LIBXML_THREAD_ALLOC_ENABLED</a>;
+</pre><p>Whether the allocation hooks are per-thread</p>
+</div>
+ <hr/>
<div class="refsect2" lang="en"><h3><a name="LIBXML_THREAD_ENABLED">Macro </a>LIBXML_THREAD_ENABLED</h3><pre class="programlisting">#define <a href="#LIBXML_THREAD_ENABLED">LIBXML_THREAD_ENABLED</a>;
</pre><p>Whether the thread support is configured in</p>
</div>
diff --git a/doc/devhelp/libxml2-xpath.html b/doc/devhelp/libxml2-xpath.html
index d2a0afc..640c715 100644
--- a/doc/devhelp/libxml2-xpath.html
+++ b/doc/devhelp/libxml2-xpath.html
@@ -70,6 +70,7 @@ typedef <a href="libxml2-xpath.html#xmlXPathAxis">xmlXPathAxis</a> * <a href="#x
typedef struct _xmlXPathParserContext <a href="#xmlXPathParserContext">xmlXPathParserContext</a>;
int <a href="#xmlXPathCastNodeSetToBoolean">xmlXPathCastNodeSetToBoolean</a> (<a href="libxml2-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> ns);
typedef <a href="libxml2-xpath.html#xmlXPathFunction">xmlXPathFunction</a> <a href="#xmlXPathFuncLookupFunc">xmlXPathFuncLookupFunc</a> (void * ctxt, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * ns_uri);
+<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> <a href="#xmlXPathNodeEval">xmlXPathNodeEval</a> (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> node, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * str, <br/> <a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctx);
<a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * <a href="#xmlXPathCastNodeToString">xmlXPathCastNodeToString</a> (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> node);
int <a href="#xmlXPathIsNaN">xmlXPathIsNaN</a> (double val);
int <a href="#xmlXPathContextSetCache">xmlXPathContextSetCache</a> (<a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctxt, <br/> int active, <br/> int value, <br/> int options);
@@ -104,6 +105,7 @@ int <a href="#xmlXPathCmpNodes">xmlXPathCmpNodes</a> (<a href="libxml2-tree.htm
<a href="libxml2-xpath.html#xmlXPathCompExprPtr">xmlXPathCompExprPtr</a> <a href="#xmlXPathCtxtCompile">xmlXPathCtxtCompile</a> (<a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctxt, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * str);
typedef void <a href="#xmlXPathEvalFunc">xmlXPathEvalFunc</a> (<a href="libxml2-xpath.html#xmlXPathParserContextPtr">xmlXPathParserContextPtr</a> ctxt, <br/> int nargs);
<a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * <a href="#xmlXPathCastBooleanToString">xmlXPathCastBooleanToString</a> (int val);
+int <a href="#xmlXPathSetContextNode">xmlXPathSetContextNode</a> (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> node, <br/> <a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctx);
int <a href="#xmlXPathCastNumberToBoolean">xmlXPathCastNumberToBoolean</a> (double val);
void <a href="#xmlXPathFreeNodeSet">xmlXPathFreeNodeSet</a> (<a href="libxml2-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> obj);
void <a href="#xmlXPathFreeCompExpr">xmlXPathFreeCompExpr</a> (<a href="libxml2-xpath.html#xmlXPathCompExprPtr">xmlXPathCompExprPtr</a> comp);
@@ -514,6 +516,10 @@ The content of this structure is not made public by the API.
</pre><p>Create a new <a href="libxml2-xpath.html#xmlXPathContext">xmlXPathContext</a></p>
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>doc</tt></i>:</span></td><td>the XML document</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the <a href="libxml2-xpath.html#xmlXPathContext">xmlXPathContext</a> just allocated. The caller will need to free it.</td></tr></tbody></table></div></div>
<hr/>
+ <div class="refsect2" lang="en"><h3><a name="xmlXPathNodeEval"/>xmlXPathNodeEval ()</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> xmlXPathNodeEval (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> node, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * str, <br/> <a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctx)<br/>
+</pre><p>Evaluate the XPath Location Path in the given context. The node 'node' is set as the context node. The context node is not restored.</p>
+<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>node</tt></i>:</span></td><td>the node to to use as the context node</td></tr><tr><td><span class="term"><i><tt>str</tt></i>:</span></td><td>the XPath expression</td></tr><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the XPath context</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the <a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> resulting from the evaluation or NULL. the caller has to free the object.</td></tr></tbody></table></div></div>
+ <hr/>
<div class="refsect2" lang="en"><h3><a name="xmlXPathNodeSetCreate"/>xmlXPathNodeSetCreate ()</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> xmlXPathNodeSetCreate (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> val)<br/>
</pre><p>Create a new <a href="libxml2-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> of type double and of value @val</p>
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>val</tt></i>:</span></td><td>an initial xmlNodePtr, or NULL</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the newly created object.</td></tr></tbody></table></div></div>
@@ -526,6 +532,10 @@ The content of this structure is not made public by the API.
</pre><p>Call this routine to speed up XPath computation on static documents. This stamps all the element nodes with the document order Like for line information, the order is kept in the element-&gt;content field, the value stored is actually - the node number (starting at -1) to be able to differentiate from line numbers.</p>
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>doc</tt></i>:</span></td><td>an input document</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of elements found in the document or -1 in case of error.</td></tr></tbody></table></div></div>
<hr/>
+ <div class="refsect2" lang="en"><h3><a name="xmlXPathSetContextNode"/>xmlXPathSetContextNode ()</h3><pre class="programlisting">int xmlXPathSetContextNode (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> node, <br/> <a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctx)<br/>
+</pre><p>Sets 'node' as the context node. The node must be in the same document as that associated with the context.</p>
+<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>node</tt></i>:</span></td><td>the node to to use as the context node</td></tr><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the XPath context</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of error or 0 if successful</td></tr></tbody></table></div></div>
+ <hr/>
</div>
</div>
</body>
diff --git a/doc/devhelp/libxml2.devhelp b/doc/devhelp/libxml2.devhelp
index 3005571..282546a 100644
--- a/doc/devhelp/libxml2.devhelp
+++ b/doc/devhelp/libxml2.devhelp
@@ -122,6 +122,7 @@
<function name="LIBXML_SCHEMAS_ENABLED" link="libxml2-xmlversion.html#LIBXML_SCHEMAS_ENABLED"/>
<function name="LIBXML_SCHEMATRON_ENABLED" link="libxml2-xmlversion.html#LIBXML_SCHEMATRON_ENABLED"/>
<function name="LIBXML_TEST_VERSION" link="libxml2-xmlversion.html#LIBXML_TEST_VERSION"/>
+ <function name="LIBXML_THREAD_ALLOC_ENABLED" link="libxml2-xmlversion.html#LIBXML_THREAD_ALLOC_ENABLED"/>
<function name="LIBXML_THREAD_ENABLED" link="libxml2-xmlversion.html#LIBXML_THREAD_ENABLED"/>
<function name="LIBXML_TREE_ENABLED" link="libxml2-xmlversion.html#LIBXML_TREE_ENABLED"/>
<function name="LIBXML_UNICODE_ENABLED" link="libxml2-xmlversion.html#LIBXML_UNICODE_ENABLED"/>
@@ -614,6 +615,7 @@
<function name="XML_ERR_UNSUPPORTED_ENCODING" link="libxml2-xmlerror.html#XML_ERR_UNSUPPORTED_ENCODING"/>
<function name="XML_ERR_URI_FRAGMENT" link="libxml2-xmlerror.html#XML_ERR_URI_FRAGMENT"/>
<function name="XML_ERR_URI_REQUIRED" link="libxml2-xmlerror.html#XML_ERR_URI_REQUIRED"/>
+ <function name="XML_ERR_USER_STOP" link="libxml2-xmlerror.html#XML_ERR_USER_STOP"/>
<function name="XML_ERR_VALUE_REQUIRED" link="libxml2-xmlerror.html#XML_ERR_VALUE_REQUIRED"/>
<function name="XML_ERR_VERSION_MISMATCH" link="libxml2-xmlerror.html#XML_ERR_VERSION_MISMATCH"/>
<function name="XML_ERR_VERSION_MISSING" link="libxml2-xmlerror.html#XML_ERR_VERSION_MISSING"/>
@@ -3481,6 +3483,7 @@
<function name="xmlXPathNextPreceding ()" link="libxml2-xpathInternals.html#xmlXPathNextPreceding"/>
<function name="xmlXPathNextPrecedingSibling ()" link="libxml2-xpathInternals.html#xmlXPathNextPrecedingSibling"/>
<function name="xmlXPathNextSelf ()" link="libxml2-xpathInternals.html#xmlXPathNextSelf"/>
+ <function name="xmlXPathNodeEval ()" link="libxml2-xpath.html#xmlXPathNodeEval"/>
<function name="xmlXPathNodeLeading ()" link="libxml2-xpathInternals.html#xmlXPathNodeLeading"/>
<function name="xmlXPathNodeLeadingSorted ()" link="libxml2-xpathInternals.html#xmlXPathNodeLeadingSorted"/>
<function name="xmlXPathNodeSetAdd ()" link="libxml2-xpathInternals.html#xmlXPathNodeSetAdd"/>
@@ -3523,6 +3526,7 @@
<function name="xmlXPathRegisteredVariablesCleanup ()" link="libxml2-xpathInternals.html#xmlXPathRegisteredVariablesCleanup"/>
<function name="xmlXPathRoot ()" link="libxml2-xpathInternals.html#xmlXPathRoot"/>
<function name="xmlXPathRoundFunction ()" link="libxml2-xpathInternals.html#xmlXPathRoundFunction"/>
+ <function name="xmlXPathSetContextNode ()" link="libxml2-xpath.html#xmlXPathSetContextNode"/>
<function name="xmlXPathStartsWithFunction ()" link="libxml2-xpathInternals.html#xmlXPathStartsWithFunction"/>
<function name="xmlXPathStringEvalNumber ()" link="libxml2-xpathInternals.html#xmlXPathStringEvalNumber"/>
<function name="xmlXPathStringFunction ()" link="libxml2-xpathInternals.html#xmlXPathStringFunction"/>
diff --git a/doc/examples/Makefile.in b/doc/examples/Makefile.in
index dc0cbd7..cbb7e34 100644
--- a/doc/examples/Makefile.in
+++ b/doc/examples/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -16,6 +16,23 @@
@SET_MAKE@
VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -198,6 +215,11 @@ DIST_SOURCES = $(io1_SOURCES) $(io2_SOURCES) $(parse1_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
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -297,7 +319,6 @@ RANLIB = @RANLIB@
RDL_LIBS = @RDL_LIBS@
READER_TEST = @READER_TEST@
RELDATE = @RELDATE@
-RM = @RM@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
@@ -354,6 +375,7 @@ 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@
diff --git a/doc/html/libxml-dict.html b/doc/html/libxml-dict.html
index 81afd15..bdd21f4 100644
--- a/doc/html/libxml-dict.html
+++ b/doc/html/libxml-dict.html
@@ -54,5 +54,5 @@ The content of this structure is not made public by the API.
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dict</tt></i>:</span></td><td>the dictionnary</td></tr><tr><td><span class="term"><i><tt>limit</tt></i>:</span></td><td>the limit in bytes</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the previous limit of the dictionary or 0</td></tr></tbody></table></div><h3><a name="xmlDictSize" id="xmlDictSize"></a>Function: xmlDictSize</h3><pre class="programlisting">int xmlDictSize (<a href="libxml-dict.html#xmlDictPtr">xmlDictPtr</a> dict)<br />
</pre><p>Query the number of elements installed in the hash @dict.</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dict</tt></i>:</span></td><td>the dictionnary</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of elements in the dictionnary or -1 in case of error</td></tr></tbody></table></div><h3><a name="xmlInitializeDict" id="xmlInitializeDict"></a>Function: xmlInitializeDict</h3><pre class="programlisting">int xmlInitializeDict (void)<br />
-</pre><p>Do the dictionary mutex initialization. this function is not thread safe, initialization should preferably be done once at startup</p>
+</pre><p>Do the dictionary mutex initialization. this function is deprecated</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 if initialization was already done, and 1 if that call led to the initialization</td></tr></tbody></table></div><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/doc/html/libxml-relaxng.html b/doc/html/libxml-relaxng.html
index 6d0ce42..1ec3192 100644
--- a/doc/html/libxml-relaxng.html
+++ b/doc/html/libxml-relaxng.html
@@ -149,7 +149,7 @@ The content of this structure is not made public by the API.
</pre><p>Pop the element end from the RelaxNG validation stack.</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the RelaxNG validation context</td></tr><tr><td><span class="term"><i><tt>doc</tt></i>:</span></td><td>a document instance</td></tr><tr><td><span class="term"><i><tt>elem</tt></i>:</span></td><td>an element instance</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if no validation problem was found or 0 otherwise</td></tr></tbody></table></div><h3><a name="xmlRelaxNGValidatePushCData" id="xmlRelaxNGValidatePushCData"></a>Function: xmlRelaxNGValidatePushCData</h3><pre class="programlisting">int xmlRelaxNGValidatePushCData (<a href="libxml-relaxng.html#xmlRelaxNGValidCtxtPtr">xmlRelaxNGValidCtxtPtr</a> ctxt, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * data, <br /> int len)<br />
</pre><p>check the CData parsed for validation in the current stack</p>
-<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the RelaxNG validation context</td></tr><tr><td><span class="term"><i><tt>data</tt></i>:</span></td><td>some character data read</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the lenght of the data</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if no validation problem was found or -1 otherwise</td></tr></tbody></table></div><h3><a name="xmlRelaxNGValidatePushElement" id="xmlRelaxNGValidatePushElement"></a>Function: xmlRelaxNGValidatePushElement</h3><pre class="programlisting">int xmlRelaxNGValidatePushElement (<a href="libxml-relaxng.html#xmlRelaxNGValidCtxtPtr">xmlRelaxNGValidCtxtPtr</a> ctxt, <br /> <a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br /> <a href="libxml-tree.html#xmlNodePtr">xmlNodePtr</a> elem)<br />
+<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the RelaxNG validation context</td></tr><tr><td><span class="term"><i><tt>data</tt></i>:</span></td><td>some character data read</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the length of the data</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if no validation problem was found or -1 otherwise</td></tr></tbody></table></div><h3><a name="xmlRelaxNGValidatePushElement" id="xmlRelaxNGValidatePushElement"></a>Function: xmlRelaxNGValidatePushElement</h3><pre class="programlisting">int xmlRelaxNGValidatePushElement (<a href="libxml-relaxng.html#xmlRelaxNGValidCtxtPtr">xmlRelaxNGValidCtxtPtr</a> ctxt, <br /> <a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br /> <a href="libxml-tree.html#xmlNodePtr">xmlNodePtr</a> elem)<br />
</pre><p>Push a new element start on the RelaxNG validation stack.</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the validation context</td></tr><tr><td><span class="term"><i><tt>doc</tt></i>:</span></td><td>a document instance</td></tr><tr><td><span class="term"><i><tt>elem</tt></i>:</span></td><td>an element instance</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if no validation problem was found or 0 if validating the element requires a full node, and -1 in case of error.</td></tr></tbody></table></div><h3><a name="xmlRelaxNGValidityErrorFunc" id="xmlRelaxNGValidityErrorFunc"></a>Function type: xmlRelaxNGValidityErrorFunc</h3><pre class="programlisting">Function type: xmlRelaxNGValidityErrorFunc
void xmlRelaxNGValidityErrorFunc (void * ctx, <br /> const char * msg, <br /> ... ...)
diff --git a/doc/html/libxml-tree.html b/doc/html/libxml-tree.html
index 25c7a45..5d932cb 100644
--- a/doc/html/libxml-tree.html
+++ b/doc/html/libxml-tree.html
@@ -585,6 +585,7 @@ The content of this structure is not made public by the API.
int nodeInfoMax : Max depth of the parsing stack
<a href="libxml-parser.html#xmlParserNodeInfo">xmlParserNodeInfo</a> * nodeInfoTab : array of nodeInfos
int input_id : we need to label inputs
+ unsigned long sizeentcopy : volume of entity copy
}</pre><h3><a name="xmlParserInput" id="xmlParserInput">Structure xmlParserInput</a></h3><pre class="programlisting">Structure xmlParserInput<br />struct _xmlParserInput {
<a href="libxml-tree.html#xmlParserInputBufferPtr">xmlParserInputBufferPtr</a> buf : UTF-8 encoded buffer
const char * filename : The file analyzed, if any
@@ -964,7 +965,7 @@ The content of this structure is not made public by the API.
</pre><p>parse an XML qualified name string [NS 5] QName ::= (Prefix ':')? LocalPart [NS 6] Prefix ::= NCName [NS 7] LocalPart ::= NCName</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>the full QName</td></tr><tr><td><span class="term"><i><tt>prefix</tt></i>:</span></td><td>a <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> **</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>NULL if not a QName, otherwise the local part, and prefix is updated to get the Prefix if any.</td></tr></tbody></table></div><h3><a name="xmlSplitQName3" id="xmlSplitQName3"></a>Function: xmlSplitQName3</h3><pre class="programlisting">const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * xmlSplitQName3 (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * name, <br /> int * len)<br />
</pre><p>parse an XML qualified name string,i</p>
-<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>the full QName</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>an int *</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>NULL if it is not a Qualified Name, otherwise, update len with the lenght in byte of the prefix and return a pointer to the start of the name without the prefix</td></tr></tbody></table></div><h3><a name="xmlStringGetNodeList" id="xmlStringGetNodeList"></a>Function: xmlStringGetNodeList</h3><pre class="programlisting"><a href="libxml-tree.html#xmlNodePtr">xmlNodePtr</a> xmlStringGetNodeList (<a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * value)<br />
+<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>the full QName</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>an int *</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>NULL if it is not a Qualified Name, otherwise, update len with the length in byte of the prefix and return a pointer to the start of the name without the prefix</td></tr></tbody></table></div><h3><a name="xmlStringGetNodeList" id="xmlStringGetNodeList"></a>Function: xmlStringGetNodeList</h3><pre class="programlisting"><a href="libxml-tree.html#xmlNodePtr">xmlNodePtr</a> xmlStringGetNodeList (<a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * value)<br />
</pre><p>Parse the value string and build the node list associated. Should produce a flat tree with only TEXTs and ENTITY_REFs.</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>doc</tt></i>:</span></td><td>the document</td></tr><tr><td><span class="term"><i><tt>value</tt></i>:</span></td><td>the value of the <a href="libxml-SAX.html#attribute">attribute</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to the first child</td></tr></tbody></table></div><h3><a name="xmlStringLenGetNodeList" id="xmlStringLenGetNodeList"></a>Function: xmlStringLenGetNodeList</h3><pre class="programlisting"><a href="libxml-tree.html#xmlNodePtr">xmlNodePtr</a> xmlStringLenGetNodeList (<a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * value, <br /> int len)<br />
</pre><p>Parse the value string and build the node list associated. Should produce a flat tree with only TEXTs and ENTITY_REFs.</p>
diff --git a/doc/html/libxml-valid.html b/doc/html/libxml-valid.html
index 5c15ace..94df436 100644
--- a/doc/html/libxml-valid.html
+++ b/doc/html/libxml-valid.html
@@ -276,7 +276,7 @@ The content of this structure is not made public by the API.
</pre><p>Pop the element end from the validation stack.</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the validation context</td></tr><tr><td><span class="term"><i><tt>doc</tt></i>:</span></td><td>a document instance</td></tr><tr><td><span class="term"><i><tt>elem</tt></i>:</span></td><td>an element instance</td></tr><tr><td><span class="term"><i><tt>qname</tt></i>:</span></td><td>the qualified name as appearing in the serialization</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if no validation problem was found or 0 otherwise</td></tr></tbody></table></div><h3><a name="xmlValidatePushCData" id="xmlValidatePushCData"></a>Function: xmlValidatePushCData</h3><pre class="programlisting">int xmlValidatePushCData (<a href="libxml-valid.html#xmlValidCtxtPtr">xmlValidCtxtPtr</a> ctxt, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * data, <br /> int len)<br />
</pre><p>check the CData parsed for validation in the current stack</p>
-<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the validation context</td></tr><tr><td><span class="term"><i><tt>data</tt></i>:</span></td><td>some character data read</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the lenght of the data</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if no validation problem was found or 0 otherwise</td></tr></tbody></table></div><h3><a name="xmlValidatePushElement" id="xmlValidatePushElement"></a>Function: xmlValidatePushElement</h3><pre class="programlisting">int xmlValidatePushElement (<a href="libxml-valid.html#xmlValidCtxtPtr">xmlValidCtxtPtr</a> ctxt, <br /> <a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br /> <a href="libxml-tree.html#xmlNodePtr">xmlNodePtr</a> elem, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * qname)<br />
+<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the validation context</td></tr><tr><td><span class="term"><i><tt>data</tt></i>:</span></td><td>some character data read</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the length of the data</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if no validation problem was found or 0 otherwise</td></tr></tbody></table></div><h3><a name="xmlValidatePushElement" id="xmlValidatePushElement"></a>Function: xmlValidatePushElement</h3><pre class="programlisting">int xmlValidatePushElement (<a href="libxml-valid.html#xmlValidCtxtPtr">xmlValidCtxtPtr</a> ctxt, <br /> <a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br /> <a href="libxml-tree.html#xmlNodePtr">xmlNodePtr</a> elem, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * qname)<br />
</pre><p>Push a new element start on the validation stack.</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the validation context</td></tr><tr><td><span class="term"><i><tt>doc</tt></i>:</span></td><td>a document instance</td></tr><tr><td><span class="term"><i><tt>elem</tt></i>:</span></td><td>an element instance</td></tr><tr><td><span class="term"><i><tt>qname</tt></i>:</span></td><td>the qualified name as appearing in the serialization</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if no validation problem was found or 0 otherwise</td></tr></tbody></table></div><h3><a name="xmlValidateRoot" id="xmlValidateRoot"></a>Function: xmlValidateRoot</h3><pre class="programlisting">int xmlValidateRoot (<a href="libxml-valid.html#xmlValidCtxtPtr">xmlValidCtxtPtr</a> ctxt, <br /> <a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> doc)<br />
</pre><p>Try to validate a the root element basically it does the following check as described by the XML-1.0 recommendation: - [ VC: Root Element Type ] it doesn't try to recurse or apply other check to the element</p>
diff --git a/doc/html/libxml-xmlerror.html b/doc/html/libxml-xmlerror.html
index 528a61d..919d8de 100644
--- a/doc/html/libxml-xmlerror.html
+++ b/doc/html/libxml-xmlerror.html
@@ -202,6 +202,7 @@ void <a href="#xmlStructuredErrorFunc">xmlStructuredErrorFunc</a> (void * userD
<a name="XML_ERR_UNKNOWN_VERSION" id="XML_ERR_UNKNOWN_VERSION">XML_ERR_UNKNOWN_VERSION</a> = 108 : 108
<a name="XML_ERR_VERSION_MISMATCH" id="XML_ERR_VERSION_MISMATCH">XML_ERR_VERSION_MISMATCH</a> = 109 : 109
<a name="XML_ERR_NAME_TOO_LONG" id="XML_ERR_NAME_TOO_LONG">XML_ERR_NAME_TOO_LONG</a> = 110 : 110
+ <a name="XML_ERR_USER_STOP" id="XML_ERR_USER_STOP">XML_ERR_USER_STOP</a> = 111 : 111
<a name="XML_NS_ERR_XML_NAMESPACE" id="XML_NS_ERR_XML_NAMESPACE">XML_NS_ERR_XML_NAMESPACE</a> = 200
<a name="XML_NS_ERR_UNDEFINED_NAMESPACE" id="XML_NS_ERR_UNDEFINED_NAMESPACE">XML_NS_ERR_UNDEFINED_NAMESPACE</a> = 201 : 201
<a name="XML_NS_ERR_QNAME" id="XML_NS_ERR_QNAME">XML_NS_ERR_QNAME</a> = 202 : 202
diff --git a/doc/html/libxml-xmlregexp.html b/doc/html/libxml-xmlregexp.html
index f69cdab..8dda699 100644
--- a/doc/html/libxml-xmlregexp.html
+++ b/doc/html/libxml-xmlregexp.html
@@ -91,15 +91,15 @@ The content of this structure is not made public by the API.
</pre><p>Free an expression context</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>an expression context</td></tr></tbody></table></div><h3><a name="xmlExpGetLanguage" id="xmlExpGetLanguage"></a>Function: xmlExpGetLanguage</h3><pre class="programlisting">int xmlExpGetLanguage (<a href="libxml-xmlregexp.html#xmlExpCtxtPtr">xmlExpCtxtPtr</a> ctxt, <br /> <a href="libxml-xmlregexp.html#xmlExpNodePtr">xmlExpNodePtr</a> exp, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> ** langList, <br /> int len)<br />
</pre><p>Find all the strings used in @exp and store them in @list</p>
-<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the expression context</td></tr><tr><td><span class="term"><i><tt>exp</tt></i>:</span></td><td>the expression</td></tr><tr><td><span class="term"><i><tt>langList</tt></i>:</span></td><td>where to store the tokens</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the allocated lenght of @list</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of unique strings found, -1 in case of errors and -2 if there is more than @len strings</td></tr></tbody></table></div><h3><a name="xmlExpGetStart" id="xmlExpGetStart"></a>Function: xmlExpGetStart</h3><pre class="programlisting">int xmlExpGetStart (<a href="libxml-xmlregexp.html#xmlExpCtxtPtr">xmlExpCtxtPtr</a> ctxt, <br /> <a href="libxml-xmlregexp.html#xmlExpNodePtr">xmlExpNodePtr</a> exp, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> ** tokList, <br /> int len)<br />
+<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the expression context</td></tr><tr><td><span class="term"><i><tt>exp</tt></i>:</span></td><td>the expression</td></tr><tr><td><span class="term"><i><tt>langList</tt></i>:</span></td><td>where to store the tokens</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the allocated length of @list</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of unique strings found, -1 in case of errors and -2 if there is more than @len strings</td></tr></tbody></table></div><h3><a name="xmlExpGetStart" id="xmlExpGetStart"></a>Function: xmlExpGetStart</h3><pre class="programlisting">int xmlExpGetStart (<a href="libxml-xmlregexp.html#xmlExpCtxtPtr">xmlExpCtxtPtr</a> ctxt, <br /> <a href="libxml-xmlregexp.html#xmlExpNodePtr">xmlExpNodePtr</a> exp, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> ** tokList, <br /> int len)<br />
</pre><p>Find all the strings that appears at the start of the languages accepted by @exp and store them in @list. E.g. for (a, b) | c it will return the list [a, c]</p>
-<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the expression context</td></tr><tr><td><span class="term"><i><tt>exp</tt></i>:</span></td><td>the expression</td></tr><tr><td><span class="term"><i><tt>tokList</tt></i>:</span></td><td>where to store the tokens</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the allocated lenght of @list</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of unique strings found, -1 in case of errors and -2 if there is more than @len strings</td></tr></tbody></table></div><h3><a name="xmlExpIsNillable" id="xmlExpIsNillable"></a>Function: xmlExpIsNillable</h3><pre class="programlisting">int xmlExpIsNillable (<a href="libxml-xmlregexp.html#xmlExpNodePtr">xmlExpNodePtr</a> exp)<br />
+<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the expression context</td></tr><tr><td><span class="term"><i><tt>exp</tt></i>:</span></td><td>the expression</td></tr><tr><td><span class="term"><i><tt>tokList</tt></i>:</span></td><td>where to store the tokens</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the allocated length of @list</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of unique strings found, -1 in case of errors and -2 if there is more than @len strings</td></tr></tbody></table></div><h3><a name="xmlExpIsNillable" id="xmlExpIsNillable"></a>Function: xmlExpIsNillable</h3><pre class="programlisting">int xmlExpIsNillable (<a href="libxml-xmlregexp.html#xmlExpNodePtr">xmlExpNodePtr</a> exp)<br />
</pre><p>Finds if the expression is nillable, i.e. if it accepts the empty sequqnce</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>exp</tt></i>:</span></td><td>the expression</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if nillable, 0 if not and -1 in case of error</td></tr></tbody></table></div><h3><a name="xmlExpMaxToken" id="xmlExpMaxToken"></a>Function: xmlExpMaxToken</h3><pre class="programlisting">int xmlExpMaxToken (<a href="libxml-xmlregexp.html#xmlExpNodePtr">xmlExpNodePtr</a> expr)<br />
</pre><p>Indicate the maximum number of input a expression can accept</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>expr</tt></i>:</span></td><td>a compiled expression</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the maximum length or -1 in case of error</td></tr></tbody></table></div><h3><a name="xmlExpNewAtom" id="xmlExpNewAtom"></a>Function: xmlExpNewAtom</h3><pre class="programlisting"><a href="libxml-xmlregexp.html#xmlExpNodePtr">xmlExpNodePtr</a> xmlExpNewAtom (<a href="libxml-xmlregexp.html#xmlExpCtxtPtr">xmlExpCtxtPtr</a> ctxt, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * name, <br /> int len)<br />
</pre><p>Get the atom associated to this name from that context</p>
-<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the expression context</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>the atom name</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the atom name lenght in byte (or -1);</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the node or NULL in case of error</td></tr></tbody></table></div><h3><a name="xmlExpNewCtxt" id="xmlExpNewCtxt"></a>Function: xmlExpNewCtxt</h3><pre class="programlisting"><a href="libxml-xmlregexp.html#xmlExpCtxtPtr">xmlExpCtxtPtr</a> xmlExpNewCtxt (int maxNodes, <br /> <a href="libxml-dict.html#xmlDictPtr">xmlDictPtr</a> dict)<br />
+<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the expression context</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>the atom name</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the atom name length in byte (or -1);</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the node or NULL in case of error</td></tr></tbody></table></div><h3><a name="xmlExpNewCtxt" id="xmlExpNewCtxt"></a>Function: xmlExpNewCtxt</h3><pre class="programlisting"><a href="libxml-xmlregexp.html#xmlExpCtxtPtr">xmlExpCtxtPtr</a> xmlExpNewCtxt (int maxNodes, <br /> <a href="libxml-dict.html#xmlDictPtr">xmlDictPtr</a> dict)<br />
</pre><p>Creates a new context for manipulating expressions</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>maxNodes</tt></i>:</span></td><td>the maximum number of nodes</td></tr><tr><td><span class="term"><i><tt>dict</tt></i>:</span></td><td>optional dictionnary to use internally</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the context or NULL in case of error</td></tr></tbody></table></div><h3><a name="xmlExpNewOr" id="xmlExpNewOr"></a>Function: xmlExpNewOr</h3><pre class="programlisting"><a href="libxml-xmlregexp.html#xmlExpNodePtr">xmlExpNodePtr</a> xmlExpNewOr (<a href="libxml-xmlregexp.html#xmlExpCtxtPtr">xmlExpCtxtPtr</a> ctxt, <br /> <a href="libxml-xmlregexp.html#xmlExpNodePtr">xmlExpNodePtr</a> left, <br /> <a href="libxml-xmlregexp.html#xmlExpNodePtr">xmlExpNodePtr</a> right)<br />
</pre><p>Get the atom associated to the choice @left | @right Note that @left and @right are consumed in the operation, to keep an handle on them use xmlExpRef() and use xmlExpFree() to release them, this is true even in case of failure (unless ctxt == NULL).</p>
diff --git a/doc/html/libxml-xmlversion.html b/doc/html/libxml-xmlversion.html
index 2da967c..30e9f0e 100644
--- a/doc/html/libxml-xmlversion.html
+++ b/doc/html/libxml-xmlversion.html
@@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline }
</style><style type="text/css">
div.deprecated pre.programlisting {border-style: double;border-color:red}
pre.programlisting {border-style: double;background: #EECFA1}
- </style><title>Module xmlversion from libxml2</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" 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>Module xmlversion from libxml2</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>API 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 style="font-weight:bold" href="../index.html">Main Menu</a></li><li><a style="font-weight:bold" href="../docs.html">Developer Menu</a></li><li><a style="font-weight:bold" href="../examples/index.html">Code Examples</a></li><li><a style="font-weight:bold" href="index.html">API Menu</a></li><li><a href="libxml-parser.html">Parser API</a></li><li><a href="libxml-tree.html">Tree API</a></li><li><a href="libxml-xmlreader.html">Reader API</a></li><li><a href="../guidelines.html">XML Guidelines</a></li><li><a href="../ChangeLog.html">ChangeLog</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>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="../APIchunk0.html">Alphabetic</a></li><li><a href="../APIconstructors.html">Constructors</a></li><li><a href="../APIfunctions.html">Functions/Types</a></li><li><a href="../APIfiles.html">Modules</a></li><li><a href="../APIsymbols.html">Symbols</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="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"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="libxml-xmlunicode.html"><img src="left.png" width="24" height="24" border="0" alt="Prev" /></a></td><th align="left"><a href="libxml-xmlunicode.html">xmlunicode</a></th><td><a accesskey="u" href="index.html"><img src="up.png" width="24" height="24" border="0" alt="Up" /></a></td><th align="left"><a href="index.html">API documentation</a></th><td><a accesskey="h" href="../index.html"><img src="home.png" width="24" height="24" border="0" alt="Home" /></a></td><th align="center"><a href="../index.html">The XML C parser and toolkit of Gnome</a></th><th align="right"><a href="libxml-xmlwriter.html">xmlwriter</a></th><td><a accesskey="n" href="libxml-xmlwriter.html"><img src="right.png" width="24" height="24" border="0" alt="Next" /></a></td></tr></table><p>compile-time version informations for the XML library </p><h2>Table of Contents</h2><pre class="programlisting">#define <a href="#ATTRIBUTE_UNUSED">ATTRIBUTE_UNUSED</a></pre><pre class="programlisting">#define <a href="#DEBUG_MEMORY_LOCATION">DEBUG_MEMORY_LOCATION</a></pre><pre class="programlisting">#define <a href="#LIBXML_ATTR_ALLOC_SIZE">LIBXML_ATTR_ALLOC_SIZE</a></pre><pre class="programlisting">#define <a href="#LIBXML_ATTR_FORMAT">LIBXML_ATTR_FORMAT</a></pre><pre class="programlisting">#define <a href="#LIBXML_AUTOMATA_ENABLED">LIBXML_AUTOMATA_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_C14N_ENABLED">LIBXML_C14N_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_CATALOG_ENABLED">LIBXML_CATALOG_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_DEBUG_ENABLED">LIBXML_DEBUG_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_DEBUG_RUNTIME">LIBXML_DEBUG_RUNTIME</a></pre><pre class="programlisting">#define <a href="#LIBXML_DOCB_ENABLED">LIBXML_DOCB_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_DOTTED_VERSION">LIBXML_DOTTED_VERSION</a></pre><pre class="programlisting">#define <a href="#LIBXML_EXPR_ENABLED">LIBXML_EXPR_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_FTP_ENABLED">LIBXML_FTP_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_HTML_ENABLED">LIBXML_HTML_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_HTTP_ENABLED">LIBXML_HTTP_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_ICONV_ENABLED">LIBXML_ICONV_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_ICU_ENABLED">LIBXML_ICU_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_ISO8859X_ENABLED">LIBXML_ISO8859X_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_LEGACY_ENABLED">LIBXML_LEGACY_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_LZMA_ENABLED">LIBXML_LZMA_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_MODULES_ENABLED">LIBXML_MODULES_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_MODULE_EXTENSION">LIBXML_MODULE_EXTENSION</a></pre><pre class="programlisting">#define <a href="#LIBXML_OUTPUT_ENABLED">LIBXML_OUTPUT_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_PATTERN_ENABLED">LIBXML_PATTERN_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_PUSH_ENABLED">LIBXML_PUSH_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_READER_ENABLED">LIBXML_READER_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_REGEXP_ENABLED">LIBXML_REGEXP_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_SAX1_ENABLED">LIBXML_SAX1_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_SCHEMAS_ENABLED">LIBXML_SCHEMAS_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_SCHEMATRON_ENABLED">LIBXML_SCHEMATRON_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_TEST_VERSION">LIBXML_TEST_VERSION</a></pre><pre class="programlisting">#define <a href="#LIBXML_THREAD_ENABLED">LIBXML_THREAD_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_TREE_ENABLED">LIBXML_TREE_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_UNICODE_ENABLED">LIBXML_UNICODE_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_VALID_ENABLED">LIBXML_VALID_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_VERSION">LIBXML_VERSION</a></pre><pre class="programlisting">#define <a href="#LIBXML_VERSION_EXTRA">LIBXML_VERSION_EXTRA</a></pre><pre class="programlisting">#define <a href="#LIBXML_VERSION_STRING">LIBXML_VERSION_STRING</a></pre><pre class="programlisting">#define <a href="#LIBXML_WRITER_ENABLED">LIBXML_WRITER_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_XINCLUDE_ENABLED">LIBXML_XINCLUDE_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_XPATH_ENABLED">LIBXML_XPATH_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_XPTR_ENABLED">LIBXML_XPTR_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_ZLIB_ENABLED">LIBXML_ZLIB_ENABLED</a></pre><pre class="programlisting">#define <a href="#WITHOUT_TRIO">WITHOUT_TRIO</a></pre><pre class="programlisting">#define <a href="#WITH_TRIO">WITH_TRIO</a></pre><pre class="programlisting">void <a href="#xmlCheckVersion">xmlCheckVersion</a> (int version)</pre>
+ </style><title>Module xmlversion from libxml2</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" 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>Module xmlversion from libxml2</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>API 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 style="font-weight:bold" href="../index.html">Main Menu</a></li><li><a style="font-weight:bold" href="../docs.html">Developer Menu</a></li><li><a style="font-weight:bold" href="../examples/index.html">Code Examples</a></li><li><a style="font-weight:bold" href="index.html">API Menu</a></li><li><a href="libxml-parser.html">Parser API</a></li><li><a href="libxml-tree.html">Tree API</a></li><li><a href="libxml-xmlreader.html">Reader API</a></li><li><a href="../guidelines.html">XML Guidelines</a></li><li><a href="../ChangeLog.html">ChangeLog</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>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="../APIchunk0.html">Alphabetic</a></li><li><a href="../APIconstructors.html">Constructors</a></li><li><a href="../APIfunctions.html">Functions/Types</a></li><li><a href="../APIfiles.html">Modules</a></li><li><a href="../APIsymbols.html">Symbols</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="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"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="libxml-xmlunicode.html"><img src="left.png" width="24" height="24" border="0" alt="Prev" /></a></td><th align="left"><a href="libxml-xmlunicode.html">xmlunicode</a></th><td><a accesskey="u" href="index.html"><img src="up.png" width="24" height="24" border="0" alt="Up" /></a></td><th align="left"><a href="index.html">API documentation</a></th><td><a accesskey="h" href="../index.html"><img src="home.png" width="24" height="24" border="0" alt="Home" /></a></td><th align="center"><a href="../index.html">The XML C parser and toolkit of Gnome</a></th><th align="right"><a href="libxml-xmlwriter.html">xmlwriter</a></th><td><a accesskey="n" href="libxml-xmlwriter.html"><img src="right.png" width="24" height="24" border="0" alt="Next" /></a></td></tr></table><p>compile-time version informations for the XML library </p><h2>Table of Contents</h2><pre class="programlisting">#define <a href="#ATTRIBUTE_UNUSED">ATTRIBUTE_UNUSED</a></pre><pre class="programlisting">#define <a href="#DEBUG_MEMORY_LOCATION">DEBUG_MEMORY_LOCATION</a></pre><pre class="programlisting">#define <a href="#LIBXML_ATTR_ALLOC_SIZE">LIBXML_ATTR_ALLOC_SIZE</a></pre><pre class="programlisting">#define <a href="#LIBXML_ATTR_FORMAT">LIBXML_ATTR_FORMAT</a></pre><pre class="programlisting">#define <a href="#LIBXML_AUTOMATA_ENABLED">LIBXML_AUTOMATA_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_C14N_ENABLED">LIBXML_C14N_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_CATALOG_ENABLED">LIBXML_CATALOG_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_DEBUG_ENABLED">LIBXML_DEBUG_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_DEBUG_RUNTIME">LIBXML_DEBUG_RUNTIME</a></pre><pre class="programlisting">#define <a href="#LIBXML_DOCB_ENABLED">LIBXML_DOCB_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_DOTTED_VERSION">LIBXML_DOTTED_VERSION</a></pre><pre class="programlisting">#define <a href="#LIBXML_EXPR_ENABLED">LIBXML_EXPR_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_FTP_ENABLED">LIBXML_FTP_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_HTML_ENABLED">LIBXML_HTML_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_HTTP_ENABLED">LIBXML_HTTP_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_ICONV_ENABLED">LIBXML_ICONV_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_ICU_ENABLED">LIBXML_ICU_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_ISO8859X_ENABLED">LIBXML_ISO8859X_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_LEGACY_ENABLED">LIBXML_LEGACY_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_LZMA_ENABLED">LIBXML_LZMA_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_MODULES_ENABLED">LIBXML_MODULES_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_MODULE_EXTENSION">LIBXML_MODULE_EXTENSION</a></pre><pre class="programlisting">#define <a href="#LIBXML_OUTPUT_ENABLED">LIBXML_OUTPUT_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_PATTERN_ENABLED">LIBXML_PATTERN_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_PUSH_ENABLED">LIBXML_PUSH_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_READER_ENABLED">LIBXML_READER_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_REGEXP_ENABLED">LIBXML_REGEXP_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_SAX1_ENABLED">LIBXML_SAX1_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_SCHEMAS_ENABLED">LIBXML_SCHEMAS_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_SCHEMATRON_ENABLED">LIBXML_SCHEMATRON_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_TEST_VERSION">LIBXML_TEST_VERSION</a></pre><pre class="programlisting">#define <a href="#LIBXML_THREAD_ALLOC_ENABLED">LIBXML_THREAD_ALLOC_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_THREAD_ENABLED">LIBXML_THREAD_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_TREE_ENABLED">LIBXML_TREE_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_UNICODE_ENABLED">LIBXML_UNICODE_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_VALID_ENABLED">LIBXML_VALID_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_VERSION">LIBXML_VERSION</a></pre><pre class="programlisting">#define <a href="#LIBXML_VERSION_EXTRA">LIBXML_VERSION_EXTRA</a></pre><pre class="programlisting">#define <a href="#LIBXML_VERSION_STRING">LIBXML_VERSION_STRING</a></pre><pre class="programlisting">#define <a href="#LIBXML_WRITER_ENABLED">LIBXML_WRITER_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_XINCLUDE_ENABLED">LIBXML_XINCLUDE_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_XPATH_ENABLED">LIBXML_XPATH_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_XPTR_ENABLED">LIBXML_XPTR_ENABLED</a></pre><pre class="programlisting">#define <a href="#LIBXML_ZLIB_ENABLED">LIBXML_ZLIB_ENABLED</a></pre><pre class="programlisting">#define <a href="#WITHOUT_TRIO">WITHOUT_TRIO</a></pre><pre class="programlisting">#define <a href="#WITH_TRIO">WITH_TRIO</a></pre><pre class="programlisting">void <a href="#xmlCheckVersion">xmlCheckVersion</a> (int version)</pre>
<h2>Description</h2>
<h3><a name="ATTRIBUTE_UNUSED" id="ATTRIBUTE_UNUSED"></a>Macro: ATTRIBUTE_UNUSED</h3><pre>#define ATTRIBUTE_UNUSED</pre><p>Macro used to signal to GCC unused function parameters</p>
<h3><a name="DEBUG_MEMORY_LOCATION" id="DEBUG_MEMORY_LOCATION"></a>Macro: DEBUG_MEMORY_LOCATION</h3><pre>#define DEBUG_MEMORY_LOCATION</pre><p>Whether the memory debugging is configured in</p>
@@ -43,6 +43,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<h3><a name="LIBXML_SCHEMAS_ENABLED" id="LIBXML_SCHEMAS_ENABLED"></a>Macro: LIBXML_SCHEMAS_ENABLED</h3><pre>#define LIBXML_SCHEMAS_ENABLED</pre><p>Whether the Schemas validation interfaces are compiled in</p>
<h3><a name="LIBXML_SCHEMATRON_ENABLED" id="LIBXML_SCHEMATRON_ENABLED"></a>Macro: LIBXML_SCHEMATRON_ENABLED</h3><pre>#define LIBXML_SCHEMATRON_ENABLED</pre><p>Whether the Schematron validation interfaces are compiled in</p>
<h3><a name="LIBXML_TEST_VERSION" id="LIBXML_TEST_VERSION"></a>Macro: LIBXML_TEST_VERSION</h3><pre>#define LIBXML_TEST_VERSION</pre><p>Macro to check that the libxml version in use is compatible with the version the software has been compiled against</p>
+<h3><a name="LIBXML_THREAD_ALLOC_ENABLED" id="LIBXML_THREAD_ALLOC_ENABLED"></a>Macro: LIBXML_THREAD_ALLOC_ENABLED</h3><pre>#define LIBXML_THREAD_ALLOC_ENABLED</pre><p>Whether the allocation hooks are per-thread</p>
<h3><a name="LIBXML_THREAD_ENABLED" id="LIBXML_THREAD_ENABLED"></a>Macro: LIBXML_THREAD_ENABLED</h3><pre>#define LIBXML_THREAD_ENABLED</pre><p>Whether the thread support is configured in</p>
<h3><a name="LIBXML_TREE_ENABLED" id="LIBXML_TREE_ENABLED"></a>Macro: LIBXML_TREE_ENABLED</h3><pre>#define LIBXML_TREE_ENABLED</pre><p>Whether the DOM like tree manipulation API support is configured in</p>
<h3><a name="LIBXML_UNICODE_ENABLED" id="LIBXML_UNICODE_ENABLED"></a>Macro: LIBXML_UNICODE_ENABLED</h3><pre>#define LIBXML_UNICODE_ENABLED</pre><p>Whether the Unicode related interfaces are compiled in</p>
diff --git a/doc/html/libxml-xpath.html b/doc/html/libxml-xpath.html
index a51b864..e47e600 100644
--- a/doc/html/libxml-xpath.html
+++ b/doc/html/libxml-xpath.html
@@ -81,9 +81,11 @@ void <a href="#xmlXPathFunction">xmlXPathFunction</a> (<a href="libxml-xpath.ht
<pre class="programlisting">int <a href="#xmlXPathIsInf">xmlXPathIsInf</a> (double val)</pre>
<pre class="programlisting">int <a href="#xmlXPathIsNaN">xmlXPathIsNaN</a> (double val)</pre>
<pre class="programlisting"><a href="libxml-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> <a href="#xmlXPathNewContext">xmlXPathNewContext</a> (<a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> doc)</pre>
+<pre class="programlisting"><a href="libxml-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> <a href="#xmlXPathNodeEval">xmlXPathNodeEval</a> (<a href="libxml-tree.html#xmlNodePtr">xmlNodePtr</a> node, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * str, <br /> <a href="libxml-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctx)</pre>
<pre class="programlisting"><a href="libxml-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> <a href="#xmlXPathNodeSetCreate">xmlXPathNodeSetCreate</a> (<a href="libxml-tree.html#xmlNodePtr">xmlNodePtr</a> val)</pre>
<pre class="programlisting"><a href="libxml-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> <a href="#xmlXPathObjectCopy">xmlXPathObjectCopy</a> (<a href="libxml-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> val)</pre>
<pre class="programlisting">long <a href="#xmlXPathOrderDocElems">xmlXPathOrderDocElems</a> (<a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> doc)</pre>
+<pre class="programlisting">int <a href="#xmlXPathSetContextNode">xmlXPathSetContextNode</a> (<a href="libxml-tree.html#xmlNodePtr">xmlNodePtr</a> node, <br /> <a href="libxml-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctx)</pre>
<pre class="programlisting">Function type: <a href="#xmlXPathVariableLookupFunc">xmlXPathVariableLookupFunc</a>
<a href="libxml-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> <a href="#xmlXPathVariableLookupFunc">xmlXPathVariableLookupFunc</a> (void * ctxt, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * name, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * ns_uri)
</pre>
@@ -298,13 +300,17 @@ void xmlXPathFunction (<a href="libxml-xpath.html#xmlXPathParserContextPtr">xml
</pre><p>Provides a portable isnan() function to detect whether a double is a NotaNumber. Based on trio code http://sourceforge.net/projects/ctrio/</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>val</tt></i>:</span></td><td>a double value</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if the value is a NaN, 0 otherwise</td></tr></tbody></table></div><h3><a name="xmlXPathNewContext" id="xmlXPathNewContext"></a>Function: xmlXPathNewContext</h3><pre class="programlisting"><a href="libxml-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> xmlXPathNewContext (<a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> doc)<br />
</pre><p>Create a new <a href="libxml-xpath.html#xmlXPathContext">xmlXPathContext</a></p>
-<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>doc</tt></i>:</span></td><td>the XML document</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the <a href="libxml-xpath.html#xmlXPathContext">xmlXPathContext</a> just allocated. The caller will need to free it.</td></tr></tbody></table></div><h3><a name="xmlXPathNodeSetCreate" id="xmlXPathNodeSetCreate"></a>Function: xmlXPathNodeSetCreate</h3><pre class="programlisting"><a href="libxml-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> xmlXPathNodeSetCreate (<a href="libxml-tree.html#xmlNodePtr">xmlNodePtr</a> val)<br />
+<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>doc</tt></i>:</span></td><td>the XML document</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the <a href="libxml-xpath.html#xmlXPathContext">xmlXPathContext</a> just allocated. The caller will need to free it.</td></tr></tbody></table></div><h3><a name="xmlXPathNodeEval" id="xmlXPathNodeEval"></a>Function: xmlXPathNodeEval</h3><pre class="programlisting"><a href="libxml-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> xmlXPathNodeEval (<a href="libxml-tree.html#xmlNodePtr">xmlNodePtr</a> node, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * str, <br /> <a href="libxml-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctx)<br />
+</pre><p>Evaluate the XPath Location Path in the given context. The node 'node' is set as the context node. The context node is not restored.</p>
+<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>node</tt></i>:</span></td><td>the node to to use as the context node</td></tr><tr><td><span class="term"><i><tt>str</tt></i>:</span></td><td>the XPath expression</td></tr><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the XPath context</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the <a href="libxml-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> resulting from the evaluation or NULL. the caller has to free the object.</td></tr></tbody></table></div><h3><a name="xmlXPathNodeSetCreate" id="xmlXPathNodeSetCreate"></a>Function: xmlXPathNodeSetCreate</h3><pre class="programlisting"><a href="libxml-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> xmlXPathNodeSetCreate (<a href="libxml-tree.html#xmlNodePtr">xmlNodePtr</a> val)<br />
</pre><p>Create a new <a href="libxml-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> of type double and of value @val</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>val</tt></i>:</span></td><td>an initial xmlNodePtr, or NULL</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the newly created object.</td></tr></tbody></table></div><h3><a name="xmlXPathObjectCopy" id="xmlXPathObjectCopy"></a>Function: xmlXPathObjectCopy</h3><pre class="programlisting"><a href="libxml-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> xmlXPathObjectCopy (<a href="libxml-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> val)<br />
</pre><p>allocate a new copy of a given object</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>val</tt></i>:</span></td><td>the original object</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the newly created object.</td></tr></tbody></table></div><h3><a name="xmlXPathOrderDocElems" id="xmlXPathOrderDocElems"></a>Function: xmlXPathOrderDocElems</h3><pre class="programlisting">long xmlXPathOrderDocElems (<a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> doc)<br />
</pre><p>Call this routine to speed up XPath computation on static documents. This stamps all the element nodes with the document order Like for line information, the order is kept in the element-&gt;content field, the value stored is actually - the node number (starting at -1) to be able to differentiate from line numbers.</p>
-<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>doc</tt></i>:</span></td><td>an input document</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of elements found in the document or -1 in case of error.</td></tr></tbody></table></div><h3><a name="xmlXPathVariableLookupFunc" id="xmlXPathVariableLookupFunc"></a>Function type: xmlXPathVariableLookupFunc</h3><pre class="programlisting">Function type: xmlXPathVariableLookupFunc
+<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>doc</tt></i>:</span></td><td>an input document</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of elements found in the document or -1 in case of error.</td></tr></tbody></table></div><h3><a name="xmlXPathSetContextNode" id="xmlXPathSetContextNode"></a>Function: xmlXPathSetContextNode</h3><pre class="programlisting">int xmlXPathSetContextNode (<a href="libxml-tree.html#xmlNodePtr">xmlNodePtr</a> node, <br /> <a href="libxml-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctx)<br />
+</pre><p>Sets 'node' as the context node. The node must be in the same document as that associated with the context.</p>
+<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>node</tt></i>:</span></td><td>the node to to use as the context node</td></tr><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the XPath context</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of error or 0 if successful</td></tr></tbody></table></div><h3><a name="xmlXPathVariableLookupFunc" id="xmlXPathVariableLookupFunc"></a>Function type: xmlXPathVariableLookupFunc</h3><pre class="programlisting">Function type: xmlXPathVariableLookupFunc
<a href="libxml-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> xmlXPathVariableLookupFunc (void * ctxt, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * name, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * ns_uri)
</pre><p>Prototype for callbacks used to plug variable lookup in the XPath engine.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>an XPath context</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>name of the variable</td></tr><tr><td><span class="term"><i><tt>ns_uri</tt></i>:</span></td><td>the namespace name hosting this variable</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the XPath object value or NULL if not found.</td></tr></tbody></table></div><br />
<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/doc/html/libxml-xzlib.html b/doc/html/libxml-xzlib.html
new file mode 100644
index 0000000..c4dfdc3
--- /dev/null
+++ b/doc/html/libxml-xzlib.html
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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=UTF-8" /><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><style type="text/css">
+ div.deprecated pre.programlisting {border-style: double;border-color:red}
+ pre.programlisting {border-style: double;background: #EECFA1}
+ </style><title>Module xzlib from libxml2</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" 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>Module xzlib from libxml2</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>API 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 style="font-weight:bold" href="../index.html">Main Menu</a></li><li><a style="font-weight:bold" href="../docs.html">Developer Menu</a></li><li><a style="font-weight:bold" href="../examples/index.html">Code Examples</a></li><li><a style="font-weight:bold" href="index.html">API Menu</a></li><li><a href="libxml-parser.html">Parser API</a></li><li><a href="libxml-tree.html">Tree API</a></li><li><a href="libxml-xmlreader.html">Reader API</a></li><li><a href="../guidelines.html">XML Guidelines</a></li><li><a href="../ChangeLog.html">ChangeLog</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>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="../APIchunk0.html">Alphabetic</a></li><li><a href="../APIconstructors.html">Constructors</a></li><li><a href="../APIfunctions.html">Functions/Types</a></li><li><a href="../APIfiles.html">Modules</a></li><li><a href="../APIsymbols.html">Symbols</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="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"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="libxml-xpointer.html"><img src="left.png" width="24" height="24" border="0" alt="Prev" /></a></td><th align="left"><a href="libxml-xpointer.html">xpointer</a></th><td><a accesskey="u" href="index.html"><img src="up.png" width="24" height="24" border="0" alt="Up" /></a></td><th align="left"><a href="index.html">API documentation</a></th><td><a accesskey="h" href="../index.html"><img src="home.png" width="24" height="24" border="0" alt="Home" /></a></td><th align="center"><a href="../index.html">The XML C parser and toolkit of Gnome</a></th></tr></table><h2>Table of Contents</h2><pre class="programlisting">#define <a href="#LIBXML2_XZLIB_H">LIBXML2_XZLIB_H</a></pre><pre class="programlisting">Typedef void * <a name="xzFile" id="xzFile">xzFile</a>
+</pre><h2>Description</h2>
+<h3><a name="LIBXML2_XZLIB_H" id="LIBXML2_XZLIB_H"></a>Macro: LIBXML2_XZLIB_H</h3><pre>#define LIBXML2_XZLIB_H</pre><p></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/doc/libxml2-api.xml b/doc/libxml2-api.xml
index f14ed01..45bceb5 100644
--- a/doc/libxml2-api.xml
+++ b/doc/libxml2-api.xml
@@ -2706,6 +2706,7 @@
<exports symbol='XML_RNGP_FOREIGN_ELEMENT' type='enum'/>
<exports symbol='XML_SCHEMAP_DEF_AND_PREFIX' type='enum'/>
<exports symbol='XML_ERR_MIXED_NOT_STARTED' type='enum'/>
+ <exports symbol='XML_ERR_USER_STOP' type='enum'/>
<exports symbol='XML_CHECK_FOUND_CDATA' type='enum'/>
<exports symbol='XML_SCHEMAP_INTERNAL' type='enum'/>
<exports symbol='XML_SCHEMAV_INVALIDELEM' type='enum'/>
@@ -3418,6 +3419,7 @@
<exports symbol='DEBUG_MEMORY_LOCATION' type='macro'/>
<exports symbol='LIBXML_ATTR_FORMAT' type='macro'/>
<exports symbol='LIBXML_TEST_VERSION' type='macro'/>
+ <exports symbol='LIBXML_THREAD_ALLOC_ENABLED' type='macro'/>
<exports symbol='LIBXML_XPATH_ENABLED' type='macro'/>
<exports symbol='LIBXML_PATTERN_ENABLED' type='macro'/>
<exports symbol='LIBXML_VALID_ENABLED' type='macro'/>
@@ -3591,6 +3593,7 @@
<exports symbol='xmlXPathNINF' type='variable'/>
<exports symbol='xmlXPathCastNodeSetToBoolean' type='function'/>
<exports symbol='xmlXPathFuncLookupFunc' type='function'/>
+ <exports symbol='xmlXPathNodeEval' type='function'/>
<exports symbol='xmlXPathCastNodeToString' type='function'/>
<exports symbol='xmlXPathIsNaN' type='function'/>
<exports symbol='xmlXPathContextSetCache' type='function'/>
@@ -3625,6 +3628,7 @@
<exports symbol='xmlXPathCtxtCompile' type='function'/>
<exports symbol='xmlXPathEvalFunc' type='function'/>
<exports symbol='xmlXPathCastBooleanToString' type='function'/>
+ <exports symbol='xmlXPathSetContextNode' type='function'/>
<exports symbol='xmlXPathCastNumberToBoolean' type='function'/>
<exports symbol='xmlXPathFreeNodeSet' type='function'/>
<exports symbol='xmlXPathFreeCompExpr' type='function'/>
@@ -4047,6 +4051,9 @@
<macro name='LIBXML_TEST_VERSION' file='xmlversion'>
<info>Macro to check that the libxml version in use is compatible with the version the software has been compiled against</info>
</macro>
+ <macro name='LIBXML_THREAD_ALLOC_ENABLED' file='xmlversion'>
+ <info>Whether the allocation hooks are per-thread</info>
+ </macro>
<macro name='LIBXML_THREAD_ENABLED' file='xmlversion'>
<info>Whether the thread support is configured in</info>
</macro>
@@ -4960,6 +4967,7 @@ and not by parsing an instance'/>
<enum name='XML_ERR_UNSUPPORTED_ENCODING' file='xmlerror' value='32' type='xmlParserErrors' info='32'/>
<enum name='XML_ERR_URI_FRAGMENT' file='xmlerror' value='92' type='xmlParserErrors' info='92'/>
<enum name='XML_ERR_URI_REQUIRED' file='xmlerror' value='70' type='xmlParserErrors' info='70'/>
+ <enum name='XML_ERR_USER_STOP' file='xmlerror' value='111' type='xmlParserErrors' info='111'/>
<enum name='XML_ERR_VALUE_REQUIRED' file='xmlerror' value='84' type='xmlParserErrors' info='84'/>
<enum name='XML_ERR_VERSION_MISMATCH' file='xmlerror' value='109' type='xmlParserErrors' info='109'/>
<enum name='XML_ERR_VERSION_MISSING' file='xmlerror' value='96' type='xmlParserErrors' info='96'/>
@@ -6184,7 +6192,8 @@ set at the end of parsing'/>
<field name='URI' type='const xmlChar *' info=' the full URI as computed'/>
<field name='owner' type='int' info=' does the entity own the childrens'/>
<field name='checked' type='int' info=' was the entity content checked this is also used to count entites
-* references done from that entity'/>
+* references done from that entity
+* and if it contains &apos;&lt;&apos;'/>
</struct>
<typedef name='xmlEntityPtr' file='tree' type='xmlEntity *'/>
<typedef name='xmlEntityType' file='entities' type='enum'/>
@@ -6434,6 +6443,7 @@ actually an xmlCharEncoding'/>
<field name='nodeInfoMax' type='int' info=' Max depth of the parsing stack'/>
<field name='nodeInfoTab' type='xmlParserNodeInfo *' info=' array of nodeInfos'/>
<field name='input_id' type='int' info=' we need to label inputs'/>
+ <field name='sizeentcopy' type='unsigned long' info=' volume of entity copy'/>
</struct>
<typedef name='xmlParserCtxtPtr' file='tree' type='xmlParserCtxt *'/>
<typedef name='xmlParserErrors' file='xmlerror' type='enum'/>
@@ -9779,7 +9789,7 @@ Could we use @subtypes for this?'/>
<arg name='ctxt' type='xmlExpCtxtPtr' info='the expression context'/>
<arg name='exp' type='xmlExpNodePtr' info='the expression'/>
<arg name='langList' type='const xmlChar **' info='where to store the tokens'/>
- <arg name='len' type='int' info='the allocated lenght of @list'/>
+ <arg name='len' type='int' info='the allocated length of @list'/>
</function>
<function name='xmlExpGetStart' file='xmlregexp' module='xmlregexp'>
<cond>defined(LIBXML_REGEXP_ENABLED) &amp;&amp; defined(LIBXML_EXPR_ENABLED)</cond>
@@ -9788,7 +9798,7 @@ Could we use @subtypes for this?'/>
<arg name='ctxt' type='xmlExpCtxtPtr' info='the expression context'/>
<arg name='exp' type='xmlExpNodePtr' info='the expression'/>
<arg name='tokList' type='const xmlChar **' info='where to store the tokens'/>
- <arg name='len' type='int' info='the allocated lenght of @list'/>
+ <arg name='len' type='int' info='the allocated length of @list'/>
</function>
<function name='xmlExpIsNillable' file='xmlregexp' module='xmlregexp'>
<cond>defined(LIBXML_REGEXP_ENABLED) &amp;&amp; defined(LIBXML_EXPR_ENABLED)</cond>
@@ -9808,7 +9818,7 @@ Could we use @subtypes for this?'/>
<return type='xmlExpNodePtr' info='the node or NULL in case of error'/>
<arg name='ctxt' type='xmlExpCtxtPtr' info='the expression context'/>
<arg name='name' type='const xmlChar *' info='the atom name'/>
- <arg name='len' type='int' info='the atom name lenght in byte (or -1);'/>
+ <arg name='len' type='int' info='the atom name length in byte (or -1);'/>
</function>
<function name='xmlExpNewCtxt' file='xmlregexp' module='xmlregexp'>
<cond>defined(LIBXML_REGEXP_ENABLED) &amp;&amp; defined(LIBXML_EXPR_ENABLED)</cond>
@@ -10628,7 +10638,7 @@ Could we use @subtypes for this?'/>
<return type='void'/>
</function>
<function name='xmlInitializeDict' file='dict' module='dict'>
- <info>Do the dictionary mutex initialization. this function is not thread safe, initialization should preferably be done once at startup</info>
+ <info>Do the dictionary mutex initialization. this function is deprecated</info>
<return type='int' info='0 if initialization was already done, and 1 if that call led to the initialization'/>
</function>
<function name='xmlInitializeGlobalState' file='globals' module='globals'>
@@ -13112,7 +13122,7 @@ Could we use @subtypes for this?'/>
<return type='int' info='1 if no validation problem was found or -1 otherwise'/>
<arg name='ctxt' type='xmlRelaxNGValidCtxtPtr' info='the RelaxNG validation context'/>
<arg name='data' type='const xmlChar *' info='some character data read'/>
- <arg name='len' type='int' info='the lenght of the data'/>
+ <arg name='len' type='int' info='the length of the data'/>
</function>
<function name='xmlRelaxNGValidatePushElement' file='relaxng' module='relaxng'>
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
@@ -14447,7 +14457,7 @@ Could we use @subtypes for this?'/>
</function>
<function name='xmlSplitQName3' file='tree' module='tree'>
<info>parse an XML qualified name string,i</info>
- <return type='const xmlChar *' info='NULL if it is not a Qualified Name, otherwise, update len with the lenght in byte of the prefix and return a pointer to the start of the name without the prefix'/>
+ <return type='const xmlChar *' info='NULL if it is not a Qualified Name, otherwise, update len with the length in byte of the prefix and return a pointer to the start of the name without the prefix'/>
<arg name='name' type='const xmlChar *' info='the full QName'/>
<arg name='len' type='int *' info='an int *'/>
</function>
@@ -17165,7 +17175,7 @@ Could we use @subtypes for this?'/>
<return type='int' info='1 if no validation problem was found or 0 otherwise'/>
<arg name='ctxt' type='xmlValidCtxtPtr' info='the validation context'/>
<arg name='data' type='const xmlChar *' info='some character data read'/>
- <arg name='len' type='int' info='the lenght of the data'/>
+ <arg name='len' type='int' info='the length of the data'/>
</function>
<function name='xmlValidatePushElement' file='valid' module='valid'>
<cond>defined(LIBXML_VALID_ENABLED) &amp;&amp; defined(LIBXML_REGEXP_ENABLED)</cond>
@@ -17899,6 +17909,14 @@ Could we use @subtypes for this?'/>
<arg name='ctxt' type='xmlXPathParserContextPtr' info='the XPath Parser context'/>
<arg name='cur' type='xmlNodePtr' info='the current node in the traversal'/>
</function>
+ <function name='xmlXPathNodeEval' file='xpath' module='xpath'>
+ <cond>defined(LIBXML_XPATH_ENABLED)</cond>
+ <info>Evaluate the XPath Location Path in the given context. The node &apos;node&apos; is set as the context node. The context node is not restored.</info>
+ <return type='xmlXPathObjectPtr' info='the xmlXPathObjectPtr resulting from the evaluation or NULL. the caller has to free the object.'/>
+ <arg name='node' type='xmlNodePtr' info='the node to to use as the context node'/>
+ <arg name='str' type='const xmlChar *' info='the XPath expression'/>
+ <arg name='ctx' type='xmlXPathContextPtr' info='the XPath context'/>
+ </function>
<function name='xmlXPathNodeLeading' file='xpathInternals' module='xpath'>
<cond>defined(LIBXML_XPATH_ENABLED)</cond>
<info>Implements the EXSLT - Sets leading() function: node-set set:leading (node-set, node-set) @nodes is sorted by document order, then #exslSetsNodeLeadingSorted is called.</info>
@@ -18185,6 +18203,13 @@ Could we use @subtypes for this?'/>
<arg name='ctxt' type='xmlXPathParserContextPtr' info='the XPath Parser context'/>
<arg name='nargs' type='int' info='the number of arguments'/>
</function>
+ <function name='xmlXPathSetContextNode' file='xpath' module='xpath'>
+ <cond>defined(LIBXML_XPATH_ENABLED)</cond>
+ <info>Sets &apos;node&apos; as the context node. The node must be in the same document as that associated with the context.</info>
+ <return type='int' info='-1 in case of error or 0 if successful'/>
+ <arg name='node' type='xmlNodePtr' info='the node to to use as the context node'/>
+ <arg name='ctx' type='xmlXPathContextPtr' info='the XPath context'/>
+ </function>
<function name='xmlXPathStartsWithFunction' file='xpathInternals' module='xpath'>
<cond>defined(LIBXML_XPATH_ENABLED)</cond>
<info>Implement the starts-with() XPath function boolean starts-with(string, string) The starts-with function returns true if the first argument string starts with the second argument string, and otherwise returns false.</info>
diff --git a/doc/symbols.xml b/doc/symbols.xml
index 08dcfaa..ec275e7 100644
--- a/doc/symbols.xml
+++ b/doc/symbols.xml
@@ -1761,4 +1761,8 @@
<symbol file="xmlIO">xmlOutputBufferGetSize</symbol>
<symbol file="xmlwriter">xmlTextWriterSetQuoteChar</symbol>
</release>
+ <release version="2.9.1">
+ <symbol file="xpath">xmlXPathNodeEval</symbol>
+ <symbol file="xpath">xmlXPathSetContextNode</symbol>
+ </release>
</symbols>
diff --git a/doc/xml.html b/doc/xml.html
index d2cc00d..d6abd50 100644
--- a/doc/xml.html
+++ b/doc/xml.html
@@ -508,7 +508,7 @@ xmlDtdPtr dtd = xmlParseDTD(NULL, filename_of_dtd); /* parse the DTD */
<li>If you need to parse large files, check the <a
href="xmlreader.html">xmlReader</a> API tutorial</li>
<li><a href="mailto:james@daa.com.au">James Henstridge</a> wrote <a
- href="http://www.daa.com.au/~james/gnome/xml-sax/xml-sax.html">some nice
+ href="http://www.jamesh.id.au/articles/libxml-sax/libxml-sax.html">some nice
documentation</a> explaining how to use the libxml SAX interface.</li>
<li>George Lebl wrote <a
href="http://www-106.ibm.com/developerworks/library/l-gnome3/">an article
diff --git a/doc/xmllint.1 b/doc/xmllint.1
index 10caf40..c647763 100644
--- a/doc/xmllint.1
+++ b/doc/xmllint.1
@@ -1,18 +1,38 @@
-.\" ** You probably do not want to edit this file directly **
-.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1).
-.\" Instead of manually editing it, you probably should edit the DocBook XML
-.\" source for it and then use the DocBook XSL Stylesheets to regenerate it.
-.TH "XMLLINT" "1" "$Date$" "libxml2" ""
+'\" t
+.\" Title: xmllint
+.\" Author: John Fleck <jfleck@inkstain.net>
+.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
+.\" Date: $Date$
+.\" Manual: xmllint Manual
+.\" Source: libxml2
+.\" Language: English
+.\"
+.TH "XMLLINT" "1" "$Date$" "libxml2" "xmllint Manual"
+.\" -----------------------------------------------------------------
+.\" * Define some portability stuff
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" http://bugs.debian.org/507673
+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
.SH "NAME"
xmllint \- command line XML tool
.SH "SYNOPSIS"
-.HP 8
-\fBxmllint\fR [\fB\-\-version\fR \fB\-\-debug\fR \fB\-\-shell\fR \fB\-\-debugent\fR \fB\-\-copy\fR \fB\-\-recover\fR \fB\-\-noent\fR \fB\-\-noout\fR \fB\-\-nonet\fR \fB\-\-path\ "\fR\fB\fIPATH(S)\fR\fR\fB"\fR \fB\-\-load\-trace\fR \fB\-\-htmlout\fR \fB\-\-nowrap\fR \fB\-\-valid\fR \fB\-\-postvalid\fR \fB\-\-dtdvalid\ \fR\fB\fIURL\fR\fR \fB\-\-dtdvalidfpi\ \fR\fB\fIFPI\fR\fR \fB\-\-timing\fR \fB\-\-output\ \fR\fB\fIFILE\fR\fR \fB\-\-repeat\fR \fB\-\-insert\fR \fB\-\-compress\fR \fB\-\-html\fR \fB\-\-xmlout\fR \fB\-\-push\fR \fB\-\-memory\fR \fB\-\-maxmem\ \fR\fB\fINBBYTES\fR\fR \fB\-\-nowarning\fR \fB\-\-noblanks\fR \fB\-\-nocdata\fR \fB\-\-format\fR \fB\-\-encode\ \fR\fB\fIENCODING\fR\fR \fB\-\-dropdtd\fR \fB\-\-nsclean\fR \fB\-\-testIO\fR \fB\-\-catalogs\fR \fB\-\-nocatalogs\fR \fB\-\-auto\fR \fB\-\-xinclude\fR \fB\-\-noxincludenode\fR \fB\-\-loaddtd\fR \fB\-\-dtdattr\fR \fB\-\-stream\fR \fB\-\-walker\fR \fB\-\-pattern\ \fR\fB\fIPATTERNVALUE\fR\fR \fB\-\-chkregister\fR \fB\-\-relaxng\ \fR\fB\fISCHEMA\fR\fR \fB\-\-schema\ \fR\fB\fISCHEMA\fR\fR \fB\-\-c14n\fR] {\fIXML\-FILE(S)\fR... \-}
-.HP 8
+.HP \w'\fBxmllint\fR\ 'u
+\fBxmllint\fR [\fB\-\-version\fR | \fB\-\-debug\fR | \fB\-\-shell\fR | \fB\-\-xpath\ "\fR\fB\fIXPath_expression\fR\fR\fB"\fR | \fB\-\-debugent\fR | \fB\-\-copy\fR | \fB\-\-recover\fR | \fB\-\-noent\fR | \fB\-\-noout\fR | \fB\-\-nonet\fR | \fB\-\-path\ "\fR\fB\fIPATH(S)\fR\fR\fB"\fR | \fB\-\-load\-trace\fR | \fB\-\-htmlout\fR | \fB\-\-nowrap\fR | \fB\-\-valid\fR | \fB\-\-postvalid\fR | \fB\-\-dtdvalid\ \fR\fB\fIURL\fR\fR | \fB\-\-dtdvalidfpi\ \fR\fB\fIFPI\fR\fR | \fB\-\-timing\fR | \fB\-\-output\ \fR\fB\fIFILE\fR\fR | \fB\-\-repeat\fR | \fB\-\-insert\fR | \fB\-\-compress\fR | \fB\-\-html\fR | \fB\-\-xmlout\fR | \fB\-\-push\fR | \fB\-\-memory\fR | \fB\-\-maxmem\ \fR\fB\fINBBYTES\fR\fR | \fB\-\-nowarning\fR | \fB\-\-noblanks\fR | \fB\-\-nocdata\fR | \fB\-\-format\fR | \fB\-\-encode\ \fR\fB\fIENCODING\fR\fR | \fB\-\-dropdtd\fR | \fB\-\-nsclean\fR | \fB\-\-testIO\fR | \fB\-\-catalogs\fR | \fB\-\-nocatalogs\fR | \fB\-\-auto\fR | \fB\-\-xinclude\fR | \fB\-\-noxincludenode\fR | \fB\-\-loaddtd\fR | \fB\-\-dtdattr\fR | \fB\-\-stream\fR | \fB\-\-walker\fR | \fB\-\-pattern\ \fR\fB\fIPATTERNVALUE\fR\fR | \fB\-\-chkregister\fR | \fB\-\-relaxng\ \fR\fB\fISCHEMA\fR\fR | \fB\-\-schema\ \fR\fB\fISCHEMA\fR\fR | \fB\-\-c14n\fR] {\fIXML\-FILE(S)\fR... | \-}
+.HP \w'\fBxmllint\fR\ 'u
\fBxmllint\fR \fB\-\-help\fR
.SH "DESCRIPTION"
.PP
@@ -24,404 +44,607 @@ files, specified on the command line as
\fIXML\-FILE\fR
(or the standard input if the filename provided is
\fB\-\fR
-). It prints various types of output, depending upon the options selected. It is useful for detecting errors both in
+)\&. It prints various types of output, depending upon the options selected\&. It is useful for detecting errors both in
XML
code and in the
XML
-parser itself.
+parser itself\&.
.PP
\fBxmllint\fR
is included in
-\fBlibxml\fR(3).
+\fBlibxml\fR(3)\&.
.SH "OPTIONS"
.PP
+
\fBxmllint\fR
accepts the following options (in alphabetical order):
-.TP
+.PP
\fB\-\-auto\fR
-Generate a small document for testing purposes.
-.TP
+.RS 4
+Generate a small document for testing purposes\&.
+.RE
+.PP
\fB\-\-catalogs\fR
+.RS 4
Use the
SGML
catalog(s) from
-\fBSGML_CATALOG_FILES\fR. Otherwise
+\fBSGML_CATALOG_FILES\fR\&. Otherwise
XML
catalogs starting from
-\fI/etc/xml/catalog\fR
-are used by default.
-.TP
+/etc/xml/catalog
+are used by default\&.
+.RE
+.PP
\fB\-\-chkregister\fR
-Turn on node registration. Useful for developers testing
+.RS 4
+Turn on node registration\&. Useful for developers testing
\fBlibxml\fR(3)
-node tracking code.
-.TP
+node tracking code\&.
+.RE
+.PP
\fB\-\-compress\fR
+.RS 4
Turn on
\fBgzip\fR(1)
-compression of output.
-.TP
+compression of output\&.
+.RE
+.PP
\fB\-\-copy\fR
-Test the internal copy implementation.
-.TP
+.RS 4
+Test the internal copy implementation\&.
+.RE
+.PP
\fB\-\-c14n\fR
+.RS 4
Use the W3C
XML
Canonicalisation (C14N) to serialize the result of parsing to
-\fIstdout\fR. It keeps comments in the result.
-.TP
+stdout\&. It keeps comments in the result\&.
+.RE
+.PP
\fB\-\-dtdvalid \fR\fB\fIURL\fR\fR
+.RS 4
Use the
DTD
specified by an
\fIURL\fR
-for validation.
-.TP
+for validation\&.
+.RE
+.PP
\fB\-\-dtdvalidfpi \fR\fB\fIFPI\fR\fR
+.RS 4
Use the
DTD
specified by a Formal Public Identifier
\fIFPI\fR
-for validation, note that this will require a catalog exporting that Formal Public Identifier to work.
-.TP
+for validation, note that this will require a catalog exporting that Formal Public Identifier to work\&.
+.RE
+.PP
\fB\-\-debug\fR
-Parse a file and output an annotated tree of the in\-memory version of the document.
-.TP
+.RS 4
+Parse a file and output an annotated tree of the in\-memory version of the document\&.
+.RE
+.PP
\fB\-\-debugent\fR
-Debug the entities defined in the document.
-.TP
+.RS 4
+Debug the entities defined in the document\&.
+.RE
+.PP
\fB\-\-dropdtd\fR
+.RS 4
Remove
DTD
-from output.
-.TP
+from output\&.
+.RE
+.PP
\fB\-\-dtdattr\fR
+.RS 4
Fetch external
DTD
-and populate the tree with inherited attributes.
-.TP
+and populate the tree with inherited attributes\&.
+.RE
+.PP
\fB\-\-encode \fR\fB\fIENCODING\fR\fR
-Output in the given encoding.
-.TP
+.RS 4
+Output in the given encoding\&.
+.RE
+.PP
\fB\-\-format\fR
-Reformat and reindent the output. The
+.RS 4
+Reformat and reindent the output\&. The
\fBXMLLINT_INDENT\fR
-environment variable controls the indentation. The default value is two spaces " ").
-.TP
+environment variable controls the indentation\&. The default value is two spaces " ")\&.
+.RE
+.PP
\fB\-\-help\fR
+.RS 4
Print out a short usage summary for
-\fBxmllint\fR.
-.TP
+\fBxmllint\fR\&.
+.RE
+.PP
\fB\-\-html\fR
+.RS 4
Use the
HTML
-parser.
-.TP
+parser\&.
+.RE
+.PP
\fB\-\-htmlout\fR
+.RS 4
Output results as an
HTML
-file. This causes
+file\&. This causes
\fBxmllint\fR
to output the necessary
HTML
-tags surrounding the result tree output so the results can be displayed/viewed in a browser.
-.TP
+tags surrounding the result tree output so the results can be displayed/viewed in a browser\&.
+.RE
+.PP
\fB\-\-insert\fR
-Test for valid insertions.
-.TP
+.RS 4
+Test for valid insertions\&.
+.RE
+.PP
\fB\-\-loaddtd\fR
+.RS 4
Fetch an external
-DTD.
-.TP
+DTD\&.
+.RE
+.PP
\fB\-\-load\-trace\fR
+.RS 4
Display all the documents loaded during the processing to
-\fIstderr\fR.
-.TP
+stderr\&.
+.RE
+.PP
\fB\-\-maxmem \fR\fB\fINNBYTES\fR\fR
-Test the parser memory support.
+.RS 4
+Test the parser memory support\&.
\fINNBYTES\fR
-is the maximum number of bytes the library is allowed to allocate. This can also be used to make sure batch processing of
+is the maximum number of bytes the library is allowed to allocate\&. This can also be used to make sure batch processing of
XML
-files will not exhaust the virtual memory of the server running them.
-.TP
+files will not exhaust the virtual memory of the server running them\&.
+.RE
+.PP
\fB\-\-memory\fR
-Parse from memory.
-.TP
+.RS 4
+Parse from memory\&.
+.RE
+.PP
\fB\-\-noblanks\fR
-Drop ignorable blank spaces.
-.TP
+.RS 4
+Drop ignorable blank spaces\&.
+.RE
+.PP
\fB\-\-nocatalogs\fR
-Do not use any catalogs.
-.TP
+.RS 4
+Do not use any catalogs\&.
+.RE
+.PP
\fB\-\-nocdata\fR
-Substitute CDATA section by equivalent text nodes.
-.TP
+.RS 4
+Substitute CDATA section by equivalent text nodes\&.
+.RE
+.PP
\fB\-\-noent\fR
-Substitute entity values for entity references. By default,
+.RS 4
+Substitute entity values for entity references\&. By default,
\fBxmllint\fR
-leaves entity references in place.
-.TP
+leaves entity references in place\&.
+.RE
+.PP
\fB\-\-nonet\fR
+.RS 4
Do not use the Internet to fetch
-DTDs or entities.
-.TP
+DTDs or entities\&.
+.RE
+.PP
\fB\-\-noout\fR
-Suppress output. By default,
+.RS 4
+Suppress output\&. By default,
\fBxmllint\fR
-outputs the result tree.
-.TP
+outputs the result tree\&.
+.RE
+.PP
\fB\-\-nowarning\fR
-Do not emit warnings from the parser and/or validator.
-.TP
+.RS 4
+Do not emit warnings from the parser and/or validator\&.
+.RE
+.PP
\fB\-\-nowrap\fR
+.RS 4
Do not output
HTML
-doc wrapper.
-.TP
+doc wrapper\&.
+.RE
+.PP
\fB\-\-noxincludenode\fR
-Do XInclude processing but do not generate XInclude start and end nodes.
-.TP
+.RS 4
+Do XInclude processing but do not generate XInclude start and end nodes\&.
+.RE
+.PP
\fB\-\-nsclean\fR
-Remove redundant namespace declarations.
-.TP
+.RS 4
+Remove redundant namespace declarations\&.
+.RE
+.PP
\fB\-\-output \fR\fB\fIFILE\fR\fR
+.RS 4
Define a file path where
\fBxmllint\fR
-will save the result of parsing. Usually the programs build a tree and save it on
-\fIstdout\fR, with this option the result
+will save the result of parsing\&. Usually the programs build a tree and save it on
+stdout, with this option the result
XML
-instance will be saved onto a file.
-.TP
+instance will be saved onto a file\&.
+.RE
+.PP
\fB\-\-path "\fR\fB\fIPATH(S)\fR\fR\fB"\fR
+.RS 4
Use the (space\- or colon\-separated) list of filesystem paths specified by
\fIPATHS\fR
to load
-DTDs or entities. Enclose space\-separated lists by quotation marks.
-.TP
+DTDs or entities\&. Enclose space\-separated lists by quotation marks\&.
+.RE
+.PP
\fB\-\-pattern \fR\fB\fIPATTERNVALUE\fR\fR
-Used to exercise the pattern recognition engine, which can be used with the reader interface to the parser. It allows to select some nodes in the document based on an XPath (subset) expression. Used for debugging.
-.TP
+.RS 4
+Used to exercise the pattern recognition engine, which can be used with the reader interface to the parser\&. It allows to select some nodes in the document based on an XPath (subset) expression\&. Used for debugging\&.
+.RE
+.PP
\fB\-\-postvalid\fR
-Validate after parsing has completed.
-.TP
+.RS 4
+Validate after parsing has completed\&.
+.RE
+.PP
\fB\-\-push\fR
-Use the push mode of the parser.
-.TP
+.RS 4
+Use the push mode of the parser\&.
+.RE
+.PP
\fB\-\-recover\fR
-Output any parsable portions of an invalid document.
-.TP
+.RS 4
+Output any parsable portions of an invalid document\&.
+.RE
+.PP
\fB\-\-relaxng \fR\fB\fISCHEMA\fR\fR
+.RS 4
Use RelaxNG file named
\fISCHEMA\fR
-for validation.
-.TP
+for validation\&.
+.RE
+.PP
\fB\-\-repeat\fR
-Repeat 100 times, for timing or profiling.
-.TP
+.RS 4
+Repeat 100 times, for timing or profiling\&.
+.RE
+.PP
\fB\-\-schema \fR\fB\fISCHEMA\fR\fR
+.RS 4
Use a W3C
XML
Schema file named
\fISCHEMA\fR
-for validation.
-.TP
+for validation\&.
+.RE
+.PP
\fB\-\-shell\fR
-Run a navigating shell. Details on available commands in shell mode are below (see
-the section called \(lqSHELL COMMANDS\(rq).
-.TP
+.RS 4
+Run a navigating shell\&. Details on available commands in shell mode are below (see
+the section called \(lqSHELL COMMANDS\(rq)\&.
+.RE
+.PP
+\fB\-\-xpath "\fR\fB\fIXPath_expression\fR\fR\fB"\fR
+.RS 4
+Run an XPath expression given as argument and print the result\&. In case of a nodeset result, each node in the node set is serialized in full in the output\&. In case of an empty node set the "XPath set is empty" result will be shown and an error exit code will be returned\&.
+.RE
+.PP
\fB\-\-stream\fR
+.RS 4
Use streaming
API
\- useful when used in combination with
\fB\-\-relaxng\fR
or
\fB\-\-valid\fR
-options for validation of files that are too large to be held in memory.
-.TP
+options for validation of files that are too large to be held in memory\&.
+.RE
+.PP
\fB\-\-testIO\fR
-Test user input/output support.
-.TP
+.RS 4
+Test user input/output support\&.
+.RE
+.PP
\fB\-\-timing\fR
+.RS 4
Output information about the time it takes
\fBxmllint\fR
-to perform the various steps.
-.TP
+to perform the various steps\&.
+.RE
+.PP
\fB\-\-valid\fR
-Determine if the document is a valid instance of the included Document Type Definition (DTD). A
+.RS 4
+Determine if the document is a valid instance of the included Document Type Definition (DTD)\&. A
DTD
to be validated against also can be specified at the command line using the
\fB\-\-dtdvalid\fR
-option. By default,
+option\&. By default,
\fBxmllint\fR
-also checks to determine if the document is well\-formed.
-.TP
+also checks to determine if the document is well\-formed\&.
+.RE
+.PP
\fB\-\-version\fR
+.RS 4
Display the version of
\fBlibxml\fR(3)
-used.
-.TP
+used\&.
+.RE
+.PP
\fB\-\-walker\fR
+.RS 4
Test the walker module, which is a reader interface but for a document tree, instead of using the reader
API
-on an unparsed document it works on an existing in\-memory tree. Used for debugging.
-.TP
+on an unparsed document it works on an existing in\-memory tree\&. Used for debugging\&.
+.RE
+.PP
\fB\-\-xinclude\fR
-Do XInclude processing.
-.TP
+.RS 4
+Do XInclude processing\&.
+.RE
+.PP
\fB\-\-xmlout\fR
+.RS 4
Used in conjunction with
-\fB\-\-html\fR. Usually when
+\fB\-\-html\fR\&. Usually when
HTML
is parsed the document is saved with the
HTML
-serializer. But with this option the resulting document is saved with the
+serializer\&. But with this option the resulting document is saved with the
XML
-serializer. This is primarily used to generate
+serializer\&. This is primarily used to generate
XHTML
from
HTML
-input.
+input\&.
+.RE
.SH "SHELL COMMANDS"
.PP
+
\fBxmllint\fR
offers an interactive shell mode invoked with the
\fB\-\-shell\fR
-command. Available commands in shell mode include (in alphabetical order):
-.TP
+command\&. Available commands in shell mode include (in alphabetical order):
+.PP
\fBbase\fR
+.RS 4
Display
XML
-base of the node.
-.TP
+base of the node\&.
+.RE
+.PP
\fBbye\fR
-Leave the shell.
-.TP
+.RS 4
+Leave the shell\&.
+.RE
+.PP
\fBcat \fR\fB\fINODE\fR\fR
-Display the given node or the current one.
-.TP
+.RS 4
+Display the given node or the current one\&.
+.RE
+.PP
\fBcd \fR\fB\fIPATH\fR\fR
-Change the current node to the given path (if unique) or root if no argument is given.
-.TP
+.RS 4
+Change the current node to the given path (if unique) or root if no argument is given\&.
+.RE
+.PP
\fBdir \fR\fB\fIPATH\fR\fR
-Dumps information about the node (namespace, attributes, content).
-.TP
+.RS 4
+Dumps information about the node (namespace, attributes, content)\&.
+.RE
+.PP
\fBdu \fR\fB\fIPATH\fR\fR
-Show the structure of the subtree under the given path or the current node.
-.TP
+.RS 4
+Show the structure of the subtree under the given path or the current node\&.
+.RE
+.PP
\fBexit\fR
-Leave the shell.
-.TP
+.RS 4
+Leave the shell\&.
+.RE
+.PP
\fBhelp\fR
-Show this help.
-.TP
+.RS 4
+Show this help\&.
+.RE
+.PP
\fBfree\fR
-Display memory usage.
-.TP
+.RS 4
+Display memory usage\&.
+.RE
+.PP
\fBload \fR\fB\fIFILENAME\fR\fR
-Load a new document with the given filename.
-.TP
+.RS 4
+Load a new document with the given filename\&.
+.RE
+.PP
\fBls \fR\fB\fIPATH\fR\fR
-List contents of the given path or the current directory.
-.TP
+.RS 4
+List contents of the given path or the current directory\&.
+.RE
+.PP
\fBpwd\fR
-Display the path to the current node.
-.TP
+.RS 4
+Display the path to the current node\&.
+.RE
+.PP
\fBquit\fR
-Leave the shell.
-.TP
+.RS 4
+Leave the shell\&.
+.RE
+.PP
\fBsave \fR\fB\fIFILENAME\fR\fR
-Save the current document to the given filename or to the original name.
-.TP
+.RS 4
+Save the current document to the given filename or to the original name\&.
+.RE
+.PP
\fBvalidate\fR
-Check the document for errors.
-.TP
+.RS 4
+Check the document for errors\&.
+.RE
+.PP
\fBwrite \fR\fB\fIFILENAME\fR\fR
-Write the current node to the given filename.
+.RS 4
+Write the current node to the given filename\&.
+.RE
.SH "ENVIRONMENT"
-.TP
+.PP
\fBSGML_CATALOG_FILES\fR
+.RS 4
SGML
-catalog behavior can be changed by redirecting queries to the user's own set of catalogs. This can be done by setting the
+catalog behavior can be changed by redirecting queries to the user\*(Aqs own set of catalogs\&. This can be done by setting the
\fBSGML_CATALOG_FILES\fR
-environment variable to a list of catalogs. An empty one should deactivate loading the default
-\fI/etc/sgml/catalog\fR
-catalog.
-.TP
+environment variable to a list of catalogs\&. An empty one should deactivate loading the default
+/etc/sgml/catalog
+catalog\&.
+.RE
+.PP
\fBXML_CATALOG_FILES\fR
+.RS 4
XML
-catalog behavior can be changed by redirecting queries to the user's own set of catalogs. This can be done by setting the
+catalog behavior can be changed by redirecting queries to the user\*(Aqs own set of catalogs\&. This can be done by setting the
\fBXML_CATALOG_FILES\fR
-environment variable to a list of catalogs. An empty one should deactivate loading the default
-\fI/etc/xml/catalog\fR
-catalog.
-.TP
+environment variable to a list of catalogs\&. An empty one should deactivate loading the default
+/etc/xml/catalog
+catalog\&.
+.RE
+.PP
\fBXML_DEBUG_CATALOG\fR
+.RS 4
Setting the environment variable
\fBXML_DEBUG_CATALOG\fR
to
\fInon\-zero\fR
using the
\fBexport\fR
-command outputs debugging information related to catalog operations.
-.TP
+command outputs debugging information related to catalog operations\&.
+.RE
+.PP
\fBXMLLINT_INDENT\fR
+.RS 4
Setting the environment variable
\fBXMLLINT_INDENT\fR
-controls the indentation. The default value is two spaces " ".
+controls the indentation\&. The default value is two spaces " "\&.
+.RE
.SH "DIAGNOSTICS"
.PP
+
\fBxmllint\fR
-return codes provide information that can be used when calling it from scripts.
-.TP
+return codes provide information that can be used when calling it from scripts\&.
+.PP
\fB0\fR
+.RS 4
No error
-.TP
+.RE
+.PP
\fB1\fR
+.RS 4
Unclassified
-.TP
+.RE
+.PP
\fB2\fR
+.RS 4
Error in
DTD
-.TP
+.RE
+.PP
\fB3\fR
+.RS 4
Validation error
-.TP
+.RE
+.PP
\fB4\fR
+.RS 4
Validation error
-.TP
+.RE
+.PP
\fB5\fR
+.RS 4
Error in schema compilation
-.TP
+.RE
+.PP
\fB6\fR
+.RS 4
Error writing output
-.TP
+.RE
+.PP
\fB7\fR
+.RS 4
Error in pattern (generated when
\fB\-\-pattern\fR
option is used)
-.TP
+.RE
+.PP
\fB8\fR
+.RS 4
Error in Reader registration (generated when
\fB\-\-chkregister\fR
option is used)
-.TP
+.RE
+.PP
\fB9\fR
+.RS 4
Out of memory error
+.RE
.SH "SEE ALSO"
.PP
\fBlibxml\fR(3)
.PP
More information can be found at
-.TP 3
-\(bu
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
\fBlibxml\fR(3)
web page
-\fI\%http://www.xmlsoft.org/\fR
-.TP
-\(bu
+\m[blue]\fB\%http://www.xmlsoft.org/\fR\m[]
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
W3C
XSLT
page
-\fI\%http://www.w3.org/TR/xslt\fR
-.SH "AUTHOR"
-John Fleck <jfleck@inkstain.net>, Ziying Sherwin <sherwin@nlm.nih.gov>, Heiko Rupp <hwr@pilhuhn.de>.
+\m[blue]\fB\%http://www.w3.org/TR/xslt\fR\m[]
+.RE
+.sp
+.SH "AUTHORS"
+.PP
+\fBJohn Fleck\fR <\&jfleck@inkstain\&.net\&>
+.RS 4
+Author.
+.RE
+.PP
+\fBZiying Sherwin\fR <\&sherwin@nlm\&.nih\&.gov\&>
+.RS 4
+Author.
+.RE
+.PP
+\fBHeiko Rupp\fR <\&hwr@pilhuhn\&.de\&>
+.RS 4
+Author.
+.RE
+.SH "COPYRIGHT"
+.br
+Copyright \(co 2001, 2004
+.br
diff --git a/doc/xmllint.xml b/doc/xmllint.xml
index 9a41b4e..5f0f000 100644
--- a/doc/xmllint.xml
+++ b/doc/xmllint.xml
@@ -69,6 +69,7 @@
<arg choice="plain"><option>--version</option></arg>
<arg choice="plain"><option>--debug</option></arg>
<arg choice="plain"><option>--shell</option></arg>
+ <arg choice="plain"><option>--xpath "<replaceable class="option">XPath_expression</replaceable>"</option></arg>
<arg choice="plain"><option>--debugent</option></arg>
<arg choice="plain"><option>--copy</option></arg>
<arg choice="plain"><option>--recover</option></arg>
@@ -528,6 +529,19 @@
</varlistentry>
<varlistentry>
+ <term><option>--xpath "<replaceable class="option">XPath_expression</replaceable>"</option></term>
+ <listitem>
+ <para>
+ Run an XPath expression given as argument and print the
+ result. In case of a nodeset result, each node in the
+ node set is serialized in full in the output. In case
+ of an empty node set the "XPath set is empty" result
+ will be shown and an error exit code will be returned.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>--stream</option></term>
<listitem>
<para>
diff --git a/elfgcchack.h b/elfgcchack.h
index 84e8151..85c49d6 100644
--- a/elfgcchack.h
+++ b/elfgcchack.h
@@ -1343,6 +1343,68 @@ extern __typeof (xmlBoolToText) xmlBoolToText__internal_alias __attribute((visib
#endif
#endif
+#ifdef bottom_buf
+#undef xmlBufContent
+extern __typeof (xmlBufContent) xmlBufContent __attribute((alias("xmlBufContent__internal_alias")));
+#else
+#ifndef xmlBufContent
+extern __typeof (xmlBufContent) xmlBufContent__internal_alias __attribute((visibility("hidden")));
+#define xmlBufContent xmlBufContent__internal_alias
+#endif
+#endif
+
+#ifdef bottom_buf
+#undef xmlBufEnd
+extern __typeof (xmlBufEnd) xmlBufEnd __attribute((alias("xmlBufEnd__internal_alias")));
+#else
+#ifndef xmlBufEnd
+extern __typeof (xmlBufEnd) xmlBufEnd__internal_alias __attribute((visibility("hidden")));
+#define xmlBufEnd xmlBufEnd__internal_alias
+#endif
+#endif
+
+#ifdef bottom_tree
+#undef xmlBufGetNodeContent
+extern __typeof (xmlBufGetNodeContent) xmlBufGetNodeContent __attribute((alias("xmlBufGetNodeContent__internal_alias")));
+#else
+#ifndef xmlBufGetNodeContent
+extern __typeof (xmlBufGetNodeContent) xmlBufGetNodeContent__internal_alias __attribute((visibility("hidden")));
+#define xmlBufGetNodeContent xmlBufGetNodeContent__internal_alias
+#endif
+#endif
+
+#if defined(LIBXML_OUTPUT_ENABLED)
+#ifdef bottom_xmlsave
+#undef xmlBufNodeDump
+extern __typeof (xmlBufNodeDump) xmlBufNodeDump __attribute((alias("xmlBufNodeDump__internal_alias")));
+#else
+#ifndef xmlBufNodeDump
+extern __typeof (xmlBufNodeDump) xmlBufNodeDump__internal_alias __attribute((visibility("hidden")));
+#define xmlBufNodeDump xmlBufNodeDump__internal_alias
+#endif
+#endif
+#endif
+
+#ifdef bottom_buf
+#undef xmlBufShrink
+extern __typeof (xmlBufShrink) xmlBufShrink __attribute((alias("xmlBufShrink__internal_alias")));
+#else
+#ifndef xmlBufShrink
+extern __typeof (xmlBufShrink) xmlBufShrink__internal_alias __attribute((visibility("hidden")));
+#define xmlBufShrink xmlBufShrink__internal_alias
+#endif
+#endif
+
+#ifdef bottom_buf
+#undef xmlBufUse
+extern __typeof (xmlBufUse) xmlBufUse __attribute((alias("xmlBufUse__internal_alias")));
+#else
+#ifndef xmlBufUse
+extern __typeof (xmlBufUse) xmlBufUse__internal_alias __attribute((visibility("hidden")));
+#define xmlBufUse xmlBufUse__internal_alias
+#endif
+#endif
+
#ifdef bottom_tree
#undef xmlBufferAdd
extern __typeof (xmlBufferAdd) xmlBufferAdd __attribute((alias("xmlBufferAdd__internal_alias")));
@@ -1424,6 +1486,16 @@ extern __typeof (xmlBufferCreateStatic) xmlBufferCreateStatic__internal_alias __
#endif
#ifdef bottom_tree
+#undef xmlBufferDetach
+extern __typeof (xmlBufferDetach) xmlBufferDetach __attribute((alias("xmlBufferDetach__internal_alias")));
+#else
+#ifndef xmlBufferDetach
+extern __typeof (xmlBufferDetach) xmlBufferDetach__internal_alias __attribute((visibility("hidden")));
+#define xmlBufferDetach xmlBufferDetach__internal_alias
+#endif
+#endif
+
+#ifdef bottom_tree
#undef xmlBufferDump
extern __typeof (xmlBufferDump) xmlBufferDump __attribute((alias("xmlBufferDump__internal_alias")));
#else
@@ -2840,6 +2912,16 @@ extern __typeof (xmlDictFree) xmlDictFree__internal_alias __attribute((visibilit
#endif
#ifdef bottom_dict
+#undef xmlDictGetUsage
+extern __typeof (xmlDictGetUsage) xmlDictGetUsage __attribute((alias("xmlDictGetUsage__internal_alias")));
+#else
+#ifndef xmlDictGetUsage
+extern __typeof (xmlDictGetUsage) xmlDictGetUsage__internal_alias __attribute((visibility("hidden")));
+#define xmlDictGetUsage xmlDictGetUsage__internal_alias
+#endif
+#endif
+
+#ifdef bottom_dict
#undef xmlDictLookup
extern __typeof (xmlDictLookup) xmlDictLookup __attribute((alias("xmlDictLookup__internal_alias")));
#else
@@ -2880,6 +2962,16 @@ extern __typeof (xmlDictReference) xmlDictReference__internal_alias __attribute(
#endif
#ifdef bottom_dict
+#undef xmlDictSetLimit
+extern __typeof (xmlDictSetLimit) xmlDictSetLimit __attribute((alias("xmlDictSetLimit__internal_alias")));
+#else
+#ifndef xmlDictSetLimit
+extern __typeof (xmlDictSetLimit) xmlDictSetLimit__internal_alias __attribute((visibility("hidden")));
+#define xmlDictSetLimit xmlDictSetLimit__internal_alias
+#endif
+#endif
+
+#ifdef bottom_dict
#undef xmlDictSize
extern __typeof (xmlDictSize) xmlDictSize __attribute((alias("xmlDictSize__internal_alias")));
#else
@@ -4601,6 +4693,16 @@ extern __typeof (xmlInitializeCatalog) xmlInitializeCatalog__internal_alias __at
#endif
#endif
+#ifdef bottom_dict
+#undef xmlInitializeDict
+extern __typeof (xmlInitializeDict) xmlInitializeDict __attribute((alias("xmlInitializeDict__internal_alias")));
+#else
+#ifndef xmlInitializeDict
+extern __typeof (xmlInitializeDict) xmlInitializeDict__internal_alias __attribute((visibility("hidden")));
+#define xmlInitializeDict xmlInitializeDict__internal_alias
+#endif
+#endif
+
#ifdef bottom_globals
#undef xmlInitializeGlobalState
extern __typeof (xmlInitializeGlobalState) xmlInitializeGlobalState __attribute((alias("xmlInitializeGlobalState__internal_alias")));
@@ -6757,6 +6859,30 @@ extern __typeof (xmlOutputBufferFlush) xmlOutputBufferFlush__internal_alias __at
#if defined(LIBXML_OUTPUT_ENABLED)
#ifdef bottom_xmlIO
+#undef xmlOutputBufferGetContent
+extern __typeof (xmlOutputBufferGetContent) xmlOutputBufferGetContent __attribute((alias("xmlOutputBufferGetContent__internal_alias")));
+#else
+#ifndef xmlOutputBufferGetContent
+extern __typeof (xmlOutputBufferGetContent) xmlOutputBufferGetContent__internal_alias __attribute((visibility("hidden")));
+#define xmlOutputBufferGetContent xmlOutputBufferGetContent__internal_alias
+#endif
+#endif
+#endif
+
+#if defined(LIBXML_OUTPUT_ENABLED)
+#ifdef bottom_xmlIO
+#undef xmlOutputBufferGetSize
+extern __typeof (xmlOutputBufferGetSize) xmlOutputBufferGetSize __attribute((alias("xmlOutputBufferGetSize__internal_alias")));
+#else
+#ifndef xmlOutputBufferGetSize
+extern __typeof (xmlOutputBufferGetSize) xmlOutputBufferGetSize__internal_alias __attribute((visibility("hidden")));
+#define xmlOutputBufferGetSize xmlOutputBufferGetSize__internal_alias
+#endif
+#endif
+#endif
+
+#if defined(LIBXML_OUTPUT_ENABLED)
+#ifdef bottom_xmlIO
#undef xmlOutputBufferWrite
extern __typeof (xmlOutputBufferWrite) xmlOutputBufferWrite __attribute((alias("xmlOutputBufferWrite__internal_alias")));
#else
@@ -10043,6 +10169,30 @@ extern __typeof (xmlSchemaValidatePredefinedType) xmlSchemaValidatePredefinedTyp
#if defined(LIBXML_SCHEMAS_ENABLED)
#ifdef bottom_xmlschemas
+#undef xmlSchemaValidateSetFilename
+extern __typeof (xmlSchemaValidateSetFilename) xmlSchemaValidateSetFilename __attribute((alias("xmlSchemaValidateSetFilename__internal_alias")));
+#else
+#ifndef xmlSchemaValidateSetFilename
+extern __typeof (xmlSchemaValidateSetFilename) xmlSchemaValidateSetFilename__internal_alias __attribute((visibility("hidden")));
+#define xmlSchemaValidateSetFilename xmlSchemaValidateSetFilename__internal_alias
+#endif
+#endif
+#endif
+
+#if defined(LIBXML_SCHEMAS_ENABLED)
+#ifdef bottom_xmlschemas
+#undef xmlSchemaValidateSetLocator
+extern __typeof (xmlSchemaValidateSetLocator) xmlSchemaValidateSetLocator __attribute((alias("xmlSchemaValidateSetLocator__internal_alias")));
+#else
+#ifndef xmlSchemaValidateSetLocator
+extern __typeof (xmlSchemaValidateSetLocator) xmlSchemaValidateSetLocator__internal_alias __attribute((visibility("hidden")));
+#define xmlSchemaValidateSetLocator xmlSchemaValidateSetLocator__internal_alias
+#endif
+#endif
+#endif
+
+#if defined(LIBXML_SCHEMAS_ENABLED)
+#ifdef bottom_xmlschemas
#undef xmlSchemaValidateStream
extern __typeof (xmlSchemaValidateStream) xmlSchemaValidateStream __attribute((alias("xmlSchemaValidateStream__internal_alias")));
#else
@@ -11715,6 +11865,18 @@ extern __typeof (xmlTextReaderRelaxNGValidate) xmlTextReaderRelaxNGValidate__int
#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
#ifdef bottom_xmlreader
+#undef xmlTextReaderRelaxNGValidateCtxt
+extern __typeof (xmlTextReaderRelaxNGValidateCtxt) xmlTextReaderRelaxNGValidateCtxt __attribute((alias("xmlTextReaderRelaxNGValidateCtxt__internal_alias")));
+#else
+#ifndef xmlTextReaderRelaxNGValidateCtxt
+extern __typeof (xmlTextReaderRelaxNGValidateCtxt) xmlTextReaderRelaxNGValidateCtxt__internal_alias __attribute((visibility("hidden")));
+#define xmlTextReaderRelaxNGValidateCtxt xmlTextReaderRelaxNGValidateCtxt__internal_alias
+#endif
+#endif
+#endif
+
+#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
+#ifdef bottom_xmlreader
#undef xmlTextReaderSchemaValidate
extern __typeof (xmlTextReaderSchemaValidate) xmlTextReaderSchemaValidate __attribute((alias("xmlTextReaderSchemaValidate__internal_alias")));
#else
@@ -12003,6 +12165,18 @@ extern __typeof (xmlTextWriterSetIndentString) xmlTextWriterSetIndentString__int
#if defined(LIBXML_WRITER_ENABLED)
#ifdef bottom_xmlwriter
+#undef xmlTextWriterSetQuoteChar
+extern __typeof (xmlTextWriterSetQuoteChar) xmlTextWriterSetQuoteChar __attribute((alias("xmlTextWriterSetQuoteChar__internal_alias")));
+#else
+#ifndef xmlTextWriterSetQuoteChar
+extern __typeof (xmlTextWriterSetQuoteChar) xmlTextWriterSetQuoteChar__internal_alias __attribute((visibility("hidden")));
+#define xmlTextWriterSetQuoteChar xmlTextWriterSetQuoteChar__internal_alias
+#endif
+#endif
+#endif
+
+#if defined(LIBXML_WRITER_ENABLED)
+#ifdef bottom_xmlwriter
#undef xmlTextWriterStartAttribute
extern __typeof (xmlTextWriterStartAttribute) xmlTextWriterStartAttribute __attribute((alias("xmlTextWriterStartAttribute__internal_alias")));
#else
diff --git a/enc.h b/enc.h
index 9197760..057d206 100644
--- a/enc.h
+++ b/enc.h
@@ -21,7 +21,7 @@ extern "C" {
int xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out,
xmlBufferPtr in, int len);
int xmlCharEncFirstLineInput(xmlParserInputBufferPtr input, int len);
-int xmlCharEncInput(xmlParserInputBufferPtr input);
+int xmlCharEncInput(xmlParserInputBufferPtr input, int flush);
int xmlCharEncOutput(xmlOutputBufferPtr output, int init);
#ifdef __cplusplus
diff --git a/encoding.c b/encoding.c
index 87b1d9b..7330e90 100644
--- a/encoding.c
+++ b/encoding.c
@@ -1517,6 +1517,8 @@ xmlGetCharEncodingHandler(xmlCharEncoding enc) {
if (handler != NULL) return(handler);
handler = xmlFindCharEncodingHandler("EBCDIC-US");
if (handler != NULL) return(handler);
+ handler = xmlFindCharEncodingHandler("IBM-037");
+ if (handler != NULL) return(handler);
break;
case XML_CHAR_ENCODING_UCS4BE:
handler = xmlFindCharEncodingHandler("ISO-10646-UCS-4");
@@ -2161,6 +2163,7 @@ xmlCharEncFirstLineInput(xmlParserInputBufferPtr input, int len)
/**
* xmlCharEncInput:
* @input: a parser input buffer
+ * @flush: try to flush all the raw buffer
*
* Generic front-end for the encoding handler on parser input
*
@@ -2170,7 +2173,7 @@ xmlCharEncFirstLineInput(xmlParserInputBufferPtr input, int len)
* the result of transformation can't fit into the encoding we want), or
*/
int
-xmlCharEncInput(xmlParserInputBufferPtr input)
+xmlCharEncInput(xmlParserInputBufferPtr input, int flush)
{
int ret = -2;
size_t written;
@@ -2189,7 +2192,7 @@ xmlCharEncInput(xmlParserInputBufferPtr input)
toconv = xmlBufUse(in);
if (toconv == 0)
return (0);
- if (toconv > 64 * 1024)
+ if ((toconv > 64 * 1024) && (flush == 0))
toconv = 64 * 1024;
written = xmlBufAvail(out);
if (written > 0)
@@ -2200,7 +2203,7 @@ xmlCharEncInput(xmlParserInputBufferPtr input)
if (written > 0)
written--; /* count '\0' */
}
- if (written > 128 * 1024)
+ if ((written > 128 * 1024) && (flush == 0))
written = 128 * 1024;
c_in = toconv;
diff --git a/entities.c b/entities.c
index 5e786a1..0c484a7 100644
--- a/entities.c
+++ b/entities.c
@@ -649,7 +649,7 @@ xmlEncodeEntitiesInternal(xmlDocPtr doc, const xmlChar *input, int attr) {
} else if (*cur >= 0x80) {
if (((doc != NULL) && (doc->encoding != NULL)) || (html)) {
/*
- * Bjørn Reese <br@sseusa.com> provided the patch
+ * Bjørn Reese <br@sseusa.com> provided the patch
xmlChar xc;
xc = (*cur & 0x3F) << 6;
if (cur[1] != 0) {
diff --git a/example/Makefile.in b/example/Makefile.in
index c29bc80..69b7027 100644
--- a/example/Makefile.in
+++ b/example/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -16,6 +16,23 @@
@SET_MAKE@
VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -88,6 +105,11 @@ am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(gjobread_SOURCES)
DIST_SOURCES = $(gjobread_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -187,7 +209,6 @@ RANLIB = @RANLIB@
RDL_LIBS = @RDL_LIBS@
READER_TEST = @READER_TEST@
RELDATE = @RELDATE@
-RM = @RM@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
@@ -244,6 +265,7 @@ 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@
diff --git a/hash.c b/hash.c
index afabcb1..0145109 100644
--- a/hash.c
+++ b/hash.c
@@ -93,11 +93,13 @@ xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name,
value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
}
}
+ value = value ^ ((value << 5) + (value >> 3));
if (name2 != NULL) {
while ((ch = *name2++) != 0) {
value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
}
}
+ value = value ^ ((value << 5) + (value >> 3));
if (name3 != NULL) {
while ((ch = *name3++) != 0) {
value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
@@ -133,6 +135,7 @@ xmlHashComputeQKey(xmlHashTablePtr table,
value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
}
}
+ value = value ^ ((value << 5) + (value >> 3));
if (prefix2 != NULL) {
while ((ch = *prefix2++) != 0) {
value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
@@ -144,6 +147,7 @@ xmlHashComputeQKey(xmlHashTablePtr table,
value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
}
}
+ value = value ^ ((value << 5) + (value >> 3));
if (prefix3 != NULL) {
while ((ch = *prefix3++) != 0) {
value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
diff --git a/include/Makefile.in b/include/Makefile.in
index a4bf492..45e9dd5 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -15,6 +15,23 @@
@SET_MAKE@
VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -61,6 +78,11 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
@@ -191,7 +213,6 @@ RANLIB = @RANLIB@
RDL_LIBS = @RDL_LIBS@
READER_TEST = @READER_TEST@
RELDATE = @RELDATE@
-RM = @RM@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
@@ -248,6 +269,7 @@ 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@
@@ -530,13 +552,10 @@ distdir: $(DISTFILES)
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
- test -d "$(distdir)/$$subdir" \
- || $(MKDIR_P) "$(distdir)/$$subdir" \
- || exit 1; \
- fi; \
- done
- @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
+ $(am__make_dryrun) \
+ || test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
diff --git a/include/libxml/Makefile.in b/include/libxml/Makefile.in
index 2c56fd4..4ee1ab0 100644
--- a/include/libxml/Makefile.in
+++ b/include/libxml/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -16,6 +16,23 @@
@SET_MAKE@
VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -56,6 +73,11 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
SOURCES =
DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -184,7 +206,6 @@ RANLIB = @RANLIB@
RDL_LIBS = @RDL_LIBS@
READER_TEST = @READER_TEST@
RELDATE = @RELDATE@
-RM = @RM@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
@@ -241,6 +262,7 @@ 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@
@@ -408,8 +430,11 @@ clean-libtool:
-rm -rf .libs _libs
install-xmlincHEADERS: $(xmlinc_HEADERS)
@$(NORMAL_INSTALL)
- test -z "$(xmlincdir)" || $(MKDIR_P) "$(DESTDIR)$(xmlincdir)"
@list='$(xmlinc_HEADERS)'; test -n "$(xmlincdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(xmlincdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(xmlincdir)" || exit 1; \
+ fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
diff --git a/include/libxml/entities.h b/include/libxml/entities.h
index cefb97f..1e91189 100644
--- a/include/libxml/entities.h
+++ b/include/libxml/entities.h
@@ -58,7 +58,8 @@ struct _xmlEntity {
int owner; /* does the entity own the childrens */
int checked; /* was the entity content checked */
/* this is also used to count entites
- * references done from that entity */
+ * references done from that entity
+ * and if it contains '<' */
};
/*
diff --git a/include/libxml/parser.h b/include/libxml/parser.h
index e1346e4..3f5730d 100644
--- a/include/libxml/parser.h
+++ b/include/libxml/parser.h
@@ -310,6 +310,7 @@ struct _xmlParserCtxt {
xmlParserNodeInfo *nodeInfoTab; /* array of nodeInfos */
int input_id; /* we need to label inputs */
+ unsigned long sizeentcopy; /* volume of entity copy */
};
/**
diff --git a/include/libxml/tree.h b/include/libxml/tree.h
index da12daa..7e06686 100644
--- a/include/libxml/tree.h
+++ b/include/libxml/tree.h
@@ -118,7 +118,7 @@ typedef xmlBuf *xmlBufPtr;
*/
XMLPUBFUN xmlChar* XMLCALL xmlBufContent (const xmlBufPtr buf);
XMLPUBFUN xmlChar* XMLCALL xmlBufEnd (const xmlBufPtr buf);
-XMLPUBFUN size_t XMLCALL xmlBufUse (xmlBufPtr buf);
+XMLPUBFUN size_t XMLCALL xmlBufUse (const xmlBufPtr buf);
XMLPUBFUN size_t XMLCALL xmlBufShrink (xmlBufPtr buf, size_t len);
/*
diff --git a/include/libxml/xmlerror.h b/include/libxml/xmlerror.h
index 48ea145..537a396 100644
--- a/include/libxml/xmlerror.h
+++ b/include/libxml/xmlerror.h
@@ -208,6 +208,7 @@ typedef enum {
XML_ERR_UNKNOWN_VERSION, /* 108 */
XML_ERR_VERSION_MISMATCH, /* 109 */
XML_ERR_NAME_TOO_LONG, /* 110 */
+ XML_ERR_USER_STOP, /* 111 */
XML_NS_ERR_XML_NAMESPACE = 200,
XML_NS_ERR_UNDEFINED_NAMESPACE, /* 201 */
XML_NS_ERR_QNAME, /* 202 */
diff --git a/include/libxml/xmlversion.h b/include/libxml/xmlversion.h
index 36aa5af..09e546f 100644
--- a/include/libxml/xmlversion.h
+++ b/include/libxml/xmlversion.h
@@ -29,28 +29,28 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* the version string like "1.2.3"
*/
-#define LIBXML_DOTTED_VERSION "2.9.0"
+#define LIBXML_DOTTED_VERSION "2.9.1"
/**
* LIBXML_VERSION:
*
* the version number: 1.2.3 value is 10203
*/
-#define LIBXML_VERSION 20900
+#define LIBXML_VERSION 20901
/**
* LIBXML_VERSION_STRING:
*
* the version number string, 1.2.3 value is "10203"
*/
-#define LIBXML_VERSION_STRING "20900"
+#define LIBXML_VERSION_STRING "20901"
/**
* LIBXML_VERSION_EXTRA:
*
* extra version information, used to show a CVS compilation
*/
-#define LIBXML_VERSION_EXTRA "-GITv2.9.0-rc2-5-g7651606"
+#define LIBXML_VERSION_EXTRA "-GITv2.9.0-69-gc0a8dd1"
/**
* LIBXML_TEST_VERSION:
@@ -58,7 +58,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
* Macro to check that the libxml version in use is compatible with
* the version the software has been compiled against
*/
-#define LIBXML_TEST_VERSION xmlCheckVersion(20900);
+#define LIBXML_TEST_VERSION xmlCheckVersion(20901);
#ifndef VMS
#if 0
@@ -98,6 +98,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif
/**
+ * LIBXML_THREAD_ALLOC_ENABLED:
+ *
+ * Whether the allocation hooks are per-thread
+ */
+#if 0
+#define LIBXML_THREAD_ALLOC_ENABLED
+#endif
+
+/**
* LIBXML_TREE_ENABLED:
*
* Whether the DOM like tree manipulation API support is configured in
diff --git a/include/libxml/xmlversion.h.in b/include/libxml/xmlversion.h.in
index c98e7ca..00a836f 100644
--- a/include/libxml/xmlversion.h.in
+++ b/include/libxml/xmlversion.h.in
@@ -98,6 +98,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif
/**
+ * LIBXML_THREAD_ALLOC_ENABLED:
+ *
+ * Whether the allocation hooks are per-thread
+ */
+#if @WITH_THREAD_ALLOC@
+#define LIBXML_THREAD_ALLOC_ENABLED
+#endif
+
+/**
* LIBXML_TREE_ENABLED:
*
* Whether the DOM like tree manipulation API support is configured in
diff --git a/include/libxml/xpath.h b/include/libxml/xpath.h
index 8819a29..d96776c 100644
--- a/include/libxml/xpath.h
+++ b/include/libxml/xpath.h
@@ -508,6 +508,13 @@ XMLPUBFUN int XMLCALL
*/
XMLPUBFUN long XMLCALL
xmlXPathOrderDocElems (xmlDocPtr doc);
+XMLPUBFUN int XMLCALL
+ xmlXPathSetContextNode (xmlNodePtr node,
+ xmlXPathContextPtr ctx);
+XMLPUBFUN xmlXPathObjectPtr XMLCALL
+ xmlXPathNodeEval (xmlNodePtr node,
+ const xmlChar *str,
+ xmlXPathContextPtr ctx);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathEval (const xmlChar *str,
xmlXPathContextPtr ctx);
diff --git a/libxml.h b/libxml.h
index efe285b..2da9044 100644
--- a/libxml.h
+++ b/libxml.h
@@ -84,6 +84,8 @@ void __xmlGlobalInitMutexLock(void);
void __xmlGlobalInitMutexUnlock(void);
void __xmlGlobalInitMutexDestroy(void);
+int __xmlInitializeDict(void);
+
#if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME)
/*
* internal thread safe random function
@@ -91,6 +93,8 @@ void __xmlGlobalInitMutexDestroy(void);
int __xmlRandom(void);
#endif
+int xmlNop(void);
+
#ifdef IN_LIBXML
#ifdef __GNUC__
#ifdef PIC
diff --git a/libxml.spec.in b/libxml.spec.in
index 03eb24e..48060bb 100644
--- a/libxml.spec.in
+++ b/libxml.spec.in
@@ -1,22 +1,22 @@
Summary: Library providing XML and HTML support
Name: libxml2
Version: @VERSION@
-Release: 1
+Release: 1%{?dist}%{?extra_release}
License: MIT
Group: Development/Libraries
Source: ftp://xmlsoft.org/libxml2/libxml2-%{version}.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: python python-devel zlib-devel pkgconfig xz-devel
URL: http://xmlsoft.org/
%description
-This library allows to manipulate XML files. It includes support
+This library allows to manipulate XML files. It includes support
to read, modify and write XML and HTML files. There is DTDs support
this includes parsing and validation even with complex DtDs, either
at parse time or later once the document has been modified. The output
can be a simple SAX stream or and in-memory DOM like representations.
In this case one can use the built-in XPath and XPointer implementation
-to select subnodes or ranges. A flexible Input/Output mechanism is
+to select sub nodes or ranges. A flexible Input/Output mechanism is
available, with existing HTTP and FTP modules and combined to an
URI library.
@@ -30,28 +30,36 @@ Requires: pkgconfig
%description devel
Libraries, include files, etc you can use to develop XML applications.
-This library allows to manipulate XML files. It includes support
+This library allows to manipulate XML files. It includes support
to read, modify and write XML and HTML files. There is DTDs support
this includes parsing and validation even with complex DtDs, either
at parse time or later once the document has been modified. The output
can be a simple SAX stream or and in-memory DOM like representations.
In this case one can use the built-in XPath and XPointer implementation
-to select subnodes or ranges. A flexible Input/Output mechanism is
+to select sub nodes or ranges. A flexible Input/Output mechanism is
available, with existing HTTP and FTP modules and combined to an
URI library.
+%package static
+Summary: Static library for libxml2
+Group: Development/Libraries
+Requires: libxml2 = %{version}-%{release}
+
+%description static
+Static library for libxml2 provided for specific uses or shaving a few
+microseconds when parsing, do not link to them for generic purpose packages.
+
%package python
Summary: Python bindings for the libxml2 library
Group: Development/Libraries
Requires: libxml2 = %{version}-%{release}
-Requires: python
%description python
The libxml2-python package contains a module that permits applications
written in the Python programming language to use the interface
supplied by the libxml2 library to manipulate XML files.
-This library allows to manipulate XML files. It includes support
+This library allows to manipulate XML files. It includes support
to read, modify and write XML and HTML files. There is DTDs support
this includes parsing and validation even with complex DTDs, either
at parse time or later once the document has been modified.
@@ -62,29 +70,34 @@ at parse time or later once the document has been modified.
%build
%configure
make %{_smp_mflags}
-gzip -9 ChangeLog
%install
rm -fr %{buildroot}
-%makeinstall
-(cd doc/examples ; make clean ; rm -rf .deps Makefile)
-gzip -9 doc/libxml2-api.xml
+make install DESTDIR=%{buildroot}
+
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
+rm -f $RPM_BUILD_ROOT%{_libdir}/python*/site-packages/*.a
+rm -f $RPM_BUILD_ROOT%{_libdir}/python*/site-packages/*.la
+rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/libxml2-%{version}/*
+rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/libxml2-python-%{version}/*
+(cd doc/examples ; make clean ; rm -rf .deps Makefile)
+gzip -9 -c doc/libxml2-api.xml > doc/libxml2-api.xml.gz
+
+%check
+make runtests
%clean
rm -fr %{buildroot}
-%post
-/sbin/ldconfig
+%post -p /sbin/ldconfig
-%postun
-/sbin/ldconfig
+%postun -p /sbin/ldconfig
%files
%defattr(-, root, root)
-%doc AUTHORS ChangeLog.gz NEWS README Copyright TODO
+%doc AUTHORS NEWS README Copyright TODO
%doc %{_mandir}/man1/xmllint.1*
%doc %{_mandir}/man1/xmlcatalog.1*
%doc %{_mandir}/man3/libxml.3*
@@ -97,7 +110,7 @@ rm -fr %{buildroot}
%defattr(-, root, root)
%doc %{_mandir}/man1/xml2-config.1*
-%doc AUTHORS ChangeLog.gz NEWS README Copyright
+%doc AUTHORS NEWS README Copyright
%doc doc/*.html doc/html doc/*.gif doc/*.png
%doc doc/tutorial doc/libxml2-api.xml.gz
%doc doc/examples
@@ -108,16 +121,20 @@ rm -fr %{buildroot}
%doc %{_datadir}/gtk-doc/html/libxml2/*.css
%{_libdir}/lib*.so
-%{_libdir}/*a
%{_libdir}/*.sh
%{_includedir}/*
%{_bindir}/xml2-config
%{_datadir}/aclocal/libxml.m4
%{_libdir}/pkgconfig/libxml-2.0.pc
+
+%files static
+%defattr(-, root, root)
+
+%{_libdir}/*a
+
%files python
%defattr(-, root, root)
-%doc AUTHORS ChangeLog.gz NEWS README Copyright
%{_libdir}/python*/site-packages/libxml2.py*
%{_libdir}/python*/site-packages/drv_libxml2.py*
%{_libdir}/python*/site-packages/libxml2mod*
diff --git a/libxml2.spec b/libxml2.spec
index 214adcf..3f2f312 100644
--- a/libxml2.spec
+++ b/libxml2.spec
@@ -1,22 +1,22 @@
Summary: Library providing XML and HTML support
Name: libxml2
-Version: 2.9.0
-Release: 1
+Version: 2.9.1
+Release: 1%{?dist}%{?extra_release}
License: MIT
Group: Development/Libraries
Source: ftp://xmlsoft.org/libxml2/libxml2-%{version}.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: python python-devel zlib-devel pkgconfig xz-devel
URL: http://xmlsoft.org/
%description
-This library allows to manipulate XML files. It includes support
+This library allows to manipulate XML files. It includes support
to read, modify and write XML and HTML files. There is DTDs support
this includes parsing and validation even with complex DtDs, either
at parse time or later once the document has been modified. The output
can be a simple SAX stream or and in-memory DOM like representations.
In this case one can use the built-in XPath and XPointer implementation
-to select subnodes or ranges. A flexible Input/Output mechanism is
+to select sub nodes or ranges. A flexible Input/Output mechanism is
available, with existing HTTP and FTP modules and combined to an
URI library.
@@ -30,28 +30,36 @@ Requires: pkgconfig
%description devel
Libraries, include files, etc you can use to develop XML applications.
-This library allows to manipulate XML files. It includes support
+This library allows to manipulate XML files. It includes support
to read, modify and write XML and HTML files. There is DTDs support
this includes parsing and validation even with complex DtDs, either
at parse time or later once the document has been modified. The output
can be a simple SAX stream or and in-memory DOM like representations.
In this case one can use the built-in XPath and XPointer implementation
-to select subnodes or ranges. A flexible Input/Output mechanism is
+to select sub nodes or ranges. A flexible Input/Output mechanism is
available, with existing HTTP and FTP modules and combined to an
URI library.
+%package static
+Summary: Static library for libxml2
+Group: Development/Libraries
+Requires: libxml2 = %{version}-%{release}
+
+%description static
+Static library for libxml2 provided for specific uses or shaving a few
+microseconds when parsing, do not link to them for generic purpose packages.
+
%package python
Summary: Python bindings for the libxml2 library
Group: Development/Libraries
Requires: libxml2 = %{version}-%{release}
-Requires: python
%description python
The libxml2-python package contains a module that permits applications
written in the Python programming language to use the interface
supplied by the libxml2 library to manipulate XML files.
-This library allows to manipulate XML files. It includes support
+This library allows to manipulate XML files. It includes support
to read, modify and write XML and HTML files. There is DTDs support
this includes parsing and validation even with complex DTDs, either
at parse time or later once the document has been modified.
@@ -62,29 +70,34 @@ at parse time or later once the document has been modified.
%build
%configure
make %{_smp_mflags}
-gzip -9 ChangeLog
%install
rm -fr %{buildroot}
-%makeinstall
-(cd doc/examples ; make clean ; rm -rf .deps Makefile)
-gzip -9 doc/libxml2-api.xml
+make install DESTDIR=%{buildroot}
+
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
+rm -f $RPM_BUILD_ROOT%{_libdir}/python*/site-packages/*.a
+rm -f $RPM_BUILD_ROOT%{_libdir}/python*/site-packages/*.la
+rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/libxml2-%{version}/*
+rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/libxml2-python-%{version}/*
+(cd doc/examples ; make clean ; rm -rf .deps Makefile)
+gzip -9 -c doc/libxml2-api.xml > doc/libxml2-api.xml.gz
+
+%check
+make runtests
%clean
rm -fr %{buildroot}
-%post
-/sbin/ldconfig
+%post -p /sbin/ldconfig
-%postun
-/sbin/ldconfig
+%postun -p /sbin/ldconfig
%files
%defattr(-, root, root)
-%doc AUTHORS ChangeLog.gz NEWS README Copyright TODO
+%doc AUTHORS NEWS README Copyright TODO
%doc %{_mandir}/man1/xmllint.1*
%doc %{_mandir}/man1/xmlcatalog.1*
%doc %{_mandir}/man3/libxml.3*
@@ -97,7 +110,7 @@ rm -fr %{buildroot}
%defattr(-, root, root)
%doc %{_mandir}/man1/xml2-config.1*
-%doc AUTHORS ChangeLog.gz NEWS README Copyright
+%doc AUTHORS NEWS README Copyright
%doc doc/*.html doc/html doc/*.gif doc/*.png
%doc doc/tutorial doc/libxml2-api.xml.gz
%doc doc/examples
@@ -108,16 +121,20 @@ rm -fr %{buildroot}
%doc %{_datadir}/gtk-doc/html/libxml2/*.css
%{_libdir}/lib*.so
-%{_libdir}/*a
%{_libdir}/*.sh
%{_includedir}/*
%{_bindir}/xml2-config
%{_datadir}/aclocal/libxml.m4
%{_libdir}/pkgconfig/libxml-2.0.pc
+
+%files static
+%defattr(-, root, root)
+
+%{_libdir}/*a
+
%files python
%defattr(-, root, root)
-%doc AUTHORS ChangeLog.gz NEWS README Copyright
%{_libdir}/python*/site-packages/libxml2.py*
%{_libdir}/python*/site-packages/drv_libxml2.py*
%{_libdir}/python*/site-packages/libxml2mod*
@@ -128,6 +145,6 @@ rm -fr %{buildroot}
%doc doc/python.html
%changelog
-* Tue Sep 11 2012 Daniel Veillard <veillard@redhat.com>
-- upstream release 2.9.0 see http://xmlsoft.org/news.html
+* Fri Apr 19 2013 Daniel Veillard <veillard@redhat.com>
+- upstream release 2.9.1 see http://xmlsoft.org/news.html
diff --git a/libxml2.syms b/libxml2.syms
index ce5d773..370dcf1 100644
--- a/libxml2.syms
+++ b/libxml2.syms
@@ -2271,3 +2271,11 @@ LIBXML2_2.9.0 {
xmlTextWriterSetQuoteChar;
} LIBXML2_2.8.0;
+LIBXML2_2.9.1 {
+ global:
+
+# xpath
+ xmlXPathNodeEval;
+ xmlXPathSetContextNode;
+} LIBXML2_2.9.0;
+
diff --git a/nanohttp.c b/nanohttp.c
index c3f419f..ac47ea6 100644
--- a/nanohttp.c
+++ b/nanohttp.c
@@ -276,6 +276,8 @@ xmlNanoHTTPCleanup(void) {
static void
xmlNanoHTTPScanURL(xmlNanoHTTPCtxtPtr ctxt, const char *URL) {
xmlURIPtr uri;
+ int len;
+
/*
* Clear any existing data from the context
*/
@@ -307,7 +309,15 @@ xmlNanoHTTPScanURL(xmlNanoHTTPCtxtPtr ctxt, const char *URL) {
}
ctxt->protocol = xmlMemStrdup(uri->scheme);
- ctxt->hostname = xmlMemStrdup(uri->server);
+ /* special case of IPv6 addresses, the [] need to be removed */
+ if ((uri->server != NULL) && (*uri->server == '[')) {
+ len = strlen(uri->server);
+ if ((len > 2) && (uri->server[len - 1] == ']')) {
+ ctxt->hostname = (char *) xmlCharStrndup(uri->server + 1, len -2);
+ } else
+ ctxt->hostname = xmlMemStrdup(uri->server);
+ } else
+ ctxt->hostname = xmlMemStrdup(uri->server);
if (uri->path != NULL)
ctxt->path = xmlMemStrdup(uri->path);
else
diff --git a/parser.c b/parser.c
index 192eaed..ee429f3 100644
--- a/parser.c
+++ b/parser.c
@@ -122,7 +122,7 @@ xmlCreateEntityParserCtxtInternal(const xmlChar *URL, const xmlChar *ID,
*/
static int
xmlParserEntityCheck(xmlParserCtxtPtr ctxt, size_t size,
- xmlEntityPtr ent)
+ xmlEntityPtr ent, size_t replacement)
{
size_t consumed = 0;
@@ -130,7 +130,24 @@ xmlParserEntityCheck(xmlParserCtxtPtr ctxt, size_t size,
return (0);
if (ctxt->lastError.code == XML_ERR_ENTITY_LOOP)
return (1);
- if (size != 0) {
+ if (replacement != 0) {
+ if (replacement < XML_MAX_TEXT_LENGTH)
+ return(0);
+
+ /*
+ * If the volume of entity copy reaches 10 times the
+ * amount of parsed data and over the large text threshold
+ * then that's very likely to be an abuse.
+ */
+ if (ctxt->input != NULL) {
+ consumed = ctxt->input->consumed +
+ (ctxt->input->cur - ctxt->input->base);
+ }
+ consumed += ctxt->sizeentities;
+
+ if (replacement < XML_PARSER_NON_LINEAR * consumed)
+ return(0);
+ } else if (size != 0) {
/*
* Do the check based on the replacement size of the entity
*/
@@ -153,7 +170,7 @@ xmlParserEntityCheck(xmlParserCtxtPtr ctxt, size_t size,
/*
* use the number of parsed entities in the replacement
*/
- size = ent->checked;
+ size = ent->checked / 2;
/*
* The amount of data parsed counting entities size only once
@@ -176,7 +193,6 @@ xmlParserEntityCheck(xmlParserCtxtPtr ctxt, size_t size,
*/
return (0);
}
-
xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
return (1);
}
@@ -1540,7 +1556,7 @@ nsPush(xmlParserCtxtPtr ctxt, const xmlChar *prefix, const xmlChar *URL)
{
if (ctxt->options & XML_PARSE_NSCLEAN) {
int i;
- for (i = 0;i < ctxt->nsNr;i += 2) {
+ for (i = ctxt->nsNr - 2;i >= 0;i -= 2) {
if (ctxt->nsTab[i] == prefix) {
/* in scope */
if (ctxt->nsTab[i + 1] == URL)
@@ -2025,6 +2041,7 @@ static void xmlSHRINK (xmlParserCtxtPtr ctxt) {
static void xmlGROW (xmlParserCtxtPtr ctxt) {
if ((((ctxt->input->end - ctxt->input->cur) > XML_MAX_LOOKUP_LIMIT) ||
((ctxt->input->cur - ctxt->input->base) > XML_MAX_LOOKUP_LIMIT)) &&
+ ((ctxt->input->buf) && (ctxt->input->buf->readcallback != (xmlInputReadCallback) xmlNop)) &&
((ctxt->options & XML_PARSE_HUGE) == 0)) {
xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, "Huge input lookup");
ctxt->instate = XML_PARSER_EOF;
@@ -2532,6 +2549,8 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) {
NEXT;
if ((ctxt->sax != NULL) && (ctxt->sax->getParameterEntity != NULL))
entity = ctxt->sax->getParameterEntity(ctxt->userData, name);
+ if (ctxt->instate == XML_PARSER_EOF)
+ return;
if (entity == NULL) {
/*
@@ -2719,7 +2738,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
(ctxt->lastError.code == XML_ERR_INTERNAL_ERROR))
goto int_error;
if (ent != NULL)
- ctxt->nbentities += ent->checked;
+ ctxt->nbentities += ent->checked / 2;
if ((ent != NULL) &&
(ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) {
if (ent->content != NULL) {
@@ -2742,7 +2761,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
while (*current != 0) { /* non input consuming loop */
buffer[nbchars++] = *current++;
if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) {
- if (xmlParserEntityCheck(ctxt, nbchars, ent))
+ if (xmlParserEntityCheck(ctxt, nbchars, ent, 0))
goto int_error;
growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
}
@@ -2770,7 +2789,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
if (ctxt->lastError.code == XML_ERR_ENTITY_LOOP)
goto int_error;
if (ent != NULL)
- ctxt->nbentities += ent->checked;
+ ctxt->nbentities += ent->checked / 2;
if (ent != NULL) {
if (ent->content == NULL) {
xmlLoadEntityContent(ctxt, ent);
@@ -2784,7 +2803,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
while (*current != 0) { /* non input consuming loop */
buffer[nbchars++] = *current++;
if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) {
- if (xmlParserEntityCheck(ctxt, nbchars, ent))
+ if (xmlParserEntityCheck(ctxt, nbchars, ent, 0))
goto int_error;
growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
}
@@ -3435,7 +3454,7 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
/**
* xmlParseNCName:
* @ctxt: an XML parser context
- * @len: lenght of the string parsed
+ * @len: length of the string parsed
*
* parse an XML name.
*
@@ -3934,7 +3953,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
if ((len > XML_MAX_TEXT_LENGTH) &&
((ctxt->options & XML_PARSE_HUGE) == 0)) {
xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
- "AttValue lenght too long\n");
+ "AttValue length too long\n");
goto mem_error;
}
if (c == 0) break;
@@ -4027,10 +4046,16 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
* entities problems
*/
if ((ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) &&
- (ent->content != NULL)) {
+ (ent->content != NULL) && (ent->checked == 0)) {
+ unsigned long oldnbent = ctxt->nbentities;
+
rep = xmlStringDecodeEntities(ctxt, ent->content,
XML_SUBSTITUTE_REF, 0, 0, 0);
+
+ ent->checked = (ctxt->nbentities - oldnbent + 1) * 2;
if (rep != NULL) {
+ if (xmlStrchr(rep, '<'))
+ ent->checked |= 1;
xmlFree(rep);
rep = NULL;
}
@@ -4075,7 +4100,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
goto error;
if ((in_space) && (normalize)) {
- while (buf[len - 1] == 0x20) len--;
+ while ((len > 0) && (buf[len - 1] == 0x20)) len--;
}
buf[len] = 0;
if (RAW == '<') {
@@ -4093,11 +4118,11 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
/*
* There we potentially risk an overflow, don't allow attribute value of
- * lenght more than INT_MAX it is a very reasonnable assumption !
+ * length more than INT_MAX it is a very reasonnable assumption !
*/
if (len >= INT_MAX) {
xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
- "AttValue lenght too long\n");
+ "AttValue length too long\n");
goto mem_error;
}
@@ -4983,7 +5008,8 @@ get_more:
}
if (buf != NULL)
xmlFree(buf);
- ctxt->instate = state;
+ if (ctxt->instate != XML_PARSER_EOF)
+ ctxt->instate = state;
return;
}
if (buf != NULL) {
@@ -5571,6 +5597,8 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) {
}
}
}
+ if (ctxt->instate == XML_PARSER_EOF)
+ return;
SKIP_BLANKS;
if (RAW != '>') {
xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_NOT_FINISHED,
@@ -7196,13 +7224,15 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
* Store the number of entities needing parsing for this entity
* content and do checkings
*/
- ent->checked = ctxt->nbentities - oldnbent;
+ ent->checked = (ctxt->nbentities - oldnbent + 1) * 2;
+ if ((ent->content != NULL) && (xmlStrchr(ent->content, '<')))
+ ent->checked |= 1;
if (ret == XML_ERR_ENTITY_LOOP) {
xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
xmlFreeNodeList(list);
return;
}
- if (xmlParserEntityCheck(ctxt, 0, ent)) {
+ if (xmlParserEntityCheck(ctxt, 0, ent, 0)) {
xmlFreeNodeList(list);
return;
}
@@ -7261,9 +7291,9 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
list = NULL;
}
if (ent->checked == 0)
- ent->checked = 1;
+ ent->checked = 2;
} else if (ent->checked != 1) {
- ctxt->nbentities += ent->checked;
+ ctxt->nbentities += ent->checked / 2;
}
/*
@@ -7360,6 +7390,13 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
xmlNodePtr nw = NULL, cur, firstChild = NULL;
/*
+ * We are copying here, make sure there is no abuse
+ */
+ ctxt->sizeentcopy += ent->length;
+ if (xmlParserEntityCheck(ctxt, 0, ent, ctxt->sizeentcopy))
+ return;
+
+ /*
* when operating on a reader, the entities definitions
* are always owning the entities subtree.
if (ctxt->parseMode == XML_PARSE_READER)
@@ -7399,6 +7436,14 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
} else if ((list == NULL) || (ctxt->inputNr > 0)) {
xmlNodePtr nw = NULL, cur, next, last,
firstChild = NULL;
+
+ /*
+ * We are copying here, make sure there is no abuse
+ */
+ ctxt->sizeentcopy += ent->length;
+ if (xmlParserEntityCheck(ctxt, 0, ent, ctxt->sizeentcopy))
+ return;
+
/*
* Copy the entity child list and make it the new
* entity child list. The goal is to make sure any
@@ -7515,7 +7560,7 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) {
NEXT;
/*
- * Predefined entites override any extra definition
+ * Predefined entities override any extra definition
*/
if ((ctxt->options & XML_PARSE_OLDSAX) == 0) {
ent = xmlGetPredefinedEntity(name);
@@ -7524,7 +7569,7 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) {
}
/*
- * Increate the number of entity references parsed
+ * Increase the number of entity references parsed
*/
ctxt->nbentities++;
@@ -7543,6 +7588,8 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) {
ent = xmlSAX2GetEntity(ctxt, name);
}
}
+ if (ctxt->instate == XML_PARSER_EOF)
+ return(NULL);
/*
* [ WFC: Entity Declared ]
* In a document without any DTD, a document with only an
@@ -7609,11 +7656,13 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) {
* not contain a <.
*/
else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) &&
- (ent != NULL) && (ent->content != NULL) &&
- (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) &&
- (xmlStrchr(ent->content, '<'))) {
- xmlFatalErrMsgStr(ctxt, XML_ERR_LT_IN_ATTRIBUTE,
- "'<' in entity '%s' is not allowed in attributes values\n", name);
+ (ent != NULL) &&
+ (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY)) {
+ if ((ent->checked & 1) || ((ent->checked == 0) &&
+ (ent->content != NULL) &&(xmlStrchr(ent->content, '<')))) {
+ xmlFatalErrMsgStr(ctxt, XML_ERR_LT_IN_ATTRIBUTE,
+ "'<' in entity '%s' is not allowed in attributes values\n", name);
+ }
}
/*
@@ -7733,6 +7782,10 @@ xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) {
ent = xmlSAX2GetEntity(ctxt, name);
}
}
+ if (ctxt->instate == XML_PARSER_EOF) {
+ xmlFree(name);
+ return(NULL);
+ }
/*
* [ WFC: Entity Declared ]
@@ -7894,8 +7947,9 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt)
*/
if ((ctxt->sax != NULL) &&
(ctxt->sax->getParameterEntity != NULL))
- entity = ctxt->sax->getParameterEntity(ctxt->userData,
- name);
+ entity = ctxt->sax->getParameterEntity(ctxt->userData, name);
+ if (ctxt->instate == XML_PARSER_EOF)
+ return;
if (entity == NULL) {
/*
* [ WFC: Entity Declared ]
@@ -8132,8 +8186,11 @@ xmlParseStringPEReference(xmlParserCtxtPtr ctxt, const xmlChar **str) {
*/
if ((ctxt->sax != NULL) &&
(ctxt->sax->getParameterEntity != NULL))
- entity = ctxt->sax->getParameterEntity(ctxt->userData,
- name);
+ entity = ctxt->sax->getParameterEntity(ctxt->userData, name);
+ if (ctxt->instate == XML_PARSER_EOF) {
+ xmlFree(name);
+ return(NULL);
+ }
if (entity == NULL) {
/*
* [ WFC: Entity Declared ]
@@ -8235,6 +8292,8 @@ xmlParseDocTypeDecl(xmlParserCtxtPtr ctxt) {
if ((ctxt->sax != NULL) && (ctxt->sax->internalSubset != NULL) &&
(!ctxt->disableSAX))
ctxt->sax->internalSubset(ctxt->userData, name, ExternalID, URI);
+ if (ctxt->instate == XML_PARSER_EOF)
+ return;
/*
* Is there any internal subset declarations ?
@@ -8897,7 +8956,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
if (((in - start) > XML_MAX_TEXT_LENGTH) &&
((ctxt->options & XML_PARSE_HUGE) == 0)) {
xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
- "AttValue lenght too long\n");
+ "AttValue length too long\n");
return(NULL);
}
}
@@ -8919,7 +8978,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
if (((in - start) > XML_MAX_TEXT_LENGTH) &&
((ctxt->options & XML_PARSE_HUGE) == 0)) {
xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
- "AttValue lenght too long\n");
+ "AttValue length too long\n");
return(NULL);
}
}
@@ -8948,7 +9007,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
if (((in - start) > XML_MAX_TEXT_LENGTH) &&
((ctxt->options & XML_PARSE_HUGE) == 0)) {
xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
- "AttValue lenght too long\n");
+ "AttValue length too long\n");
return(NULL);
}
}
@@ -8956,7 +9015,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
if (((in - start) > XML_MAX_TEXT_LENGTH) &&
((ctxt->options & XML_PARSE_HUGE) == 0)) {
xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
- "AttValue lenght too long\n");
+ "AttValue length too long\n");
return(NULL);
}
if (*in != limit) goto need_complex;
@@ -8978,7 +9037,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
if (((in - start) > XML_MAX_TEXT_LENGTH) &&
((ctxt->options & XML_PARSE_HUGE) == 0)) {
xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
- "AttValue lenght too long\n");
+ "AttValue length too long\n");
return(NULL);
}
}
@@ -8987,7 +9046,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
if (((in - start) > XML_MAX_TEXT_LENGTH) &&
((ctxt->options & XML_PARSE_HUGE) == 0)) {
xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
- "AttValue lenght too long\n");
+ "AttValue length too long\n");
return(NULL);
}
if (*in != limit) goto need_complex;
@@ -9993,6 +10052,8 @@ xmlParseElement(xmlParserCtxtPtr ctxt) {
* Parse the content of the element:
*/
xmlParseContent(ctxt);
+ if (ctxt->instate == XML_PARSER_EOF)
+ return;
if (!IS_BYTE_CHAR(RAW)) {
xmlFatalErrMsgStrIntStr(ctxt, XML_ERR_TAG_NOT_FINISHED,
"Premature end of data in tag %s line %d\n",
@@ -10565,6 +10626,8 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) {
*/
if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
ctxt->sax->setDocumentLocator(ctxt->userData, &xmlDefaultSAXLocator);
+ if (ctxt->instate == XML_PARSER_EOF)
+ return(-1);
if ((ctxt->encoding == NULL) &&
((ctxt->input->end - ctxt->input->cur) >= 4)) {
@@ -10616,6 +10679,8 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) {
}
if ((ctxt->sax) && (ctxt->sax->startDocument) && (!ctxt->disableSAX))
ctxt->sax->startDocument(ctxt->userData);
+ if (ctxt->instate == XML_PARSER_EOF)
+ return(-1);
/*
* The Misc part of the Prolog
@@ -10635,6 +10700,8 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) {
if (RAW == '[') {
ctxt->instate = XML_PARSER_DTD;
xmlParseInternalSubset(ctxt);
+ if (ctxt->instate == XML_PARSER_EOF)
+ return(-1);
}
/*
@@ -10645,6 +10712,8 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) {
(!ctxt->disableSAX))
ctxt->sax->externalSubset(ctxt->userData, ctxt->intSubName,
ctxt->extSubSystem, ctxt->extSubURI);
+ if (ctxt->instate == XML_PARSER_EOF)
+ return(-1);
ctxt->inSubset = 0;
xmlCleanSpecialAttr(ctxt);
@@ -10785,6 +10854,8 @@ xmlParseExtParsedEnt(xmlParserCtxtPtr ctxt) {
}
if ((ctxt->sax) && (ctxt->sax->startDocument) && (!ctxt->disableSAX))
ctxt->sax->startDocument(ctxt->userData);
+ if (ctxt->instate == XML_PARSER_EOF)
+ return(-1);
/*
* Doing validity checking on chunk doesn't make sense
@@ -10795,6 +10866,8 @@ xmlParseExtParsedEnt(xmlParserCtxtPtr ctxt) {
ctxt->depth = 0;
xmlParseContent(ctxt);
+ if (ctxt->instate == XML_PARSER_EOF)
+ return(-1);
if ((RAW == '<') && (NXT(1) == '/')) {
xmlFatalErr(ctxt, XML_ERR_NOT_WELL_BALANCED, NULL);
@@ -11102,7 +11175,7 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
}
xmlParseGetLasts(ctxt, &lastlt, &lastgt);
- while (1) {
+ while (ctxt->instate != XML_PARSER_EOF) {
if ((ctxt->errNo != XML_ERR_OK) && (ctxt->disableSAX == 1))
return(0);
@@ -11121,9 +11194,13 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
/*
* If we are operating on converted input, try to flush
* remainng chars to avoid them stalling in the non-converted
- * buffer.
+ * buffer. But do not do this in document start where
+ * encoding="..." may not have been read and we work on a
+ * guessed encoding.
*/
- if (xmlBufIsEmpty(ctxt->input->buf->buffer) == 0) {
+ if ((ctxt->instate != XML_PARSER_START) &&
+ (ctxt->input->buf->raw != NULL) &&
+ (xmlBufIsEmpty(ctxt->input->buf->raw) == 0)) {
size_t base = xmlBufGetInputBase(ctxt->input->buf->buffer,
ctxt->input);
size_t current = ctxt->input->cur - ctxt->input->base;
@@ -11338,6 +11415,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
ctxt->sax->endElement(ctxt->userData, name);
#endif /* LIBXML_SAX1_ENABLED */
}
+ if (ctxt->instate == XML_PARSER_EOF)
+ goto done;
spacePop(ctxt);
if (ctxt->nameNr == 0) {
ctxt->instate = XML_PARSER_EPILOG;
@@ -11528,6 +11607,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
ctxt->sax->characters(ctxt->userData,
ctxt->input->cur, tmp);
}
+ if (ctxt->instate == XML_PARSER_EOF)
+ goto done;
SKIPL(tmp);
ctxt->checkIndex = 0;
}
@@ -11563,6 +11644,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
ctxt->sax->characters(ctxt->userData,
ctxt->input->cur, base);
}
+ if (ctxt->instate == XML_PARSER_EOF)
+ goto done;
SKIPL(base + 3);
ctxt->checkIndex = 0;
ctxt->instate = XML_PARSER_CONTENT;
@@ -11596,6 +11679,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
"PP: Parsing PI\n");
#endif
xmlParsePI(ctxt);
+ if (ctxt->instate == XML_PARSER_EOF)
+ goto done;
ctxt->instate = XML_PARSER_MISC;
ctxt->progressive = 1;
ctxt->checkIndex = 0;
@@ -11612,6 +11697,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
"PP: Parsing Comment\n");
#endif
xmlParseComment(ctxt);
+ if (ctxt->instate == XML_PARSER_EOF)
+ goto done;
ctxt->instate = XML_PARSER_MISC;
ctxt->progressive = 1;
ctxt->checkIndex = 0;
@@ -11633,9 +11720,11 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
"PP: Parsing internal subset\n");
#endif
ctxt->inSubset = 1;
- ctxt->progressive = 1;
+ ctxt->progressive = 0;
ctxt->checkIndex = 0;
xmlParseDocTypeDecl(ctxt);
+ if (ctxt->instate == XML_PARSER_EOF)
+ goto done;
if (RAW == '[') {
ctxt->instate = XML_PARSER_DTD;
#ifdef DEBUG_PUSH
@@ -11695,6 +11784,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
"PP: Parsing PI\n");
#endif
xmlParsePI(ctxt);
+ if (ctxt->instate == XML_PARSER_EOF)
+ goto done;
ctxt->instate = XML_PARSER_PROLOG;
ctxt->progressive = 1;
} else if ((cur == '<') && (next == '!') &&
@@ -11709,6 +11800,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
"PP: Parsing Comment\n");
#endif
xmlParseComment(ctxt);
+ if (ctxt->instate == XML_PARSER_EOF)
+ goto done;
ctxt->instate = XML_PARSER_PROLOG;
ctxt->progressive = 1;
} else if ((cur == '<') && (next == '!') &&
@@ -11747,6 +11840,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
"PP: Parsing PI\n");
#endif
xmlParsePI(ctxt);
+ if (ctxt->instate == XML_PARSER_EOF)
+ goto done;
ctxt->instate = XML_PARSER_EPILOG;
ctxt->progressive = 1;
} else if ((cur == '<') && (next == '!') &&
@@ -11761,6 +11856,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
"PP: Parsing Comment\n");
#endif
xmlParseComment(ctxt);
+ if (ctxt->instate == XML_PARSER_EOF)
+ goto done;
ctxt->instate = XML_PARSER_EPILOG;
ctxt->progressive = 1;
} else if ((cur == '<') && (next == '!') &&
@@ -11891,6 +11988,8 @@ not_end_of_int_subset:
found_end_int_subset:
ctxt->checkIndex = 0;
xmlParseInternalSubset(ctxt);
+ if (ctxt->instate == XML_PARSER_EOF)
+ goto done;
ctxt->inSubset = 2;
if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
(ctxt->sax->externalSubset != NULL))
@@ -11898,6 +11997,8 @@ found_end_int_subset:
ctxt->extSubSystem, ctxt->extSubURI);
ctxt->inSubset = 0;
xmlCleanSpecialAttr(ctxt);
+ if (ctxt->instate == XML_PARSER_EOF)
+ goto done;
ctxt->instate = XML_PARSER_PROLOG;
ctxt->checkIndex = 0;
#ifdef DEBUG_PUSH
@@ -12041,7 +12142,7 @@ xmlParseCheckTransition(xmlParserCtxtPtr ctxt, const char *chunk, int size) {
}
if ((ctxt->progressive == XML_PARSER_DTD) ||
(ctxt->instate == XML_PARSER_DTD)) {
- if (memchr(chunk, ']', size) != NULL)
+ if (memchr(chunk, '>', size) != NULL)
return(1);
return(0);
}
@@ -12125,7 +12226,7 @@ xmldecl_done:
remain = 0;
}
}
- res =xmlParserInputBufferPush(ctxt->input->buf, size, chunk);
+ res = xmlParserInputBufferPush(ctxt->input->buf, size, chunk);
if (res < 0) {
ctxt->errNo = XML_PARSER_EOF;
ctxt->disableSAX = 1;
@@ -12142,14 +12243,17 @@ xmldecl_done:
if ((in->encoder != NULL) && (in->buffer != NULL) &&
(in->raw != NULL)) {
int nbchars;
+ size_t base = xmlBufGetInputBase(in->buffer, ctxt->input);
+ size_t current = ctxt->input->cur - ctxt->input->base;
- nbchars = xmlCharEncInput(in);
+ nbchars = xmlCharEncInput(in, terminate);
if (nbchars < 0) {
/* TODO 2.6.0 */
xmlGenericError(xmlGenericErrorContext,
"xmlParseChunk: encoder error\n");
return(XML_ERR_INVALID_ENCODING);
}
+ xmlBufSetInputBaseCur(in->buffer, ctxt->input, base, current);
}
}
}
@@ -12171,6 +12275,9 @@ xmldecl_done:
avail - old_avail)))
xmlParseTryOrFinish(ctxt, terminate);
}
+ if (ctxt->instate == XML_PARSER_EOF)
+ return(ctxt->errNo);
+
if ((ctxt->input != NULL) &&
(((ctxt->input->end - ctxt->input->cur) > XML_MAX_LOOKUP_LIMIT) ||
((ctxt->input->cur - ctxt->input->base) > XML_MAX_LOOKUP_LIMIT)) &&
@@ -12189,7 +12296,14 @@ xmldecl_done:
}
if ((end_in_lf == 1) && (ctxt->input != NULL) &&
(ctxt->input->buf != NULL)) {
+ size_t base = xmlBufGetInputBase(ctxt->input->buf->buffer,
+ ctxt->input);
+ size_t current = ctxt->input->cur - ctxt->input->base;
+
xmlParserInputBufferPush(ctxt->input->buf, 1, "\r");
+
+ xmlBufSetInputBaseCur(ctxt->input->buf->buffer, ctxt->input,
+ base, current);
}
if (terminate) {
/*
@@ -12219,7 +12333,10 @@ xmldecl_done:
}
ctxt->instate = XML_PARSER_EOF;
}
- return((xmlParserErrors) ctxt->errNo);
+ if (ctxt->wellFormed == 0)
+ return((xmlParserErrors) ctxt->errNo);
+ else
+ return(0);
}
/************************************************************************
@@ -12364,6 +12481,7 @@ xmlStopParser(xmlParserCtxtPtr ctxt) {
if (ctxt == NULL)
return;
ctxt->instate = XML_PARSER_EOF;
+ ctxt->errNo = XML_ERR_USER_STOP;
ctxt->disableSAX = 1;
if (ctxt->input != NULL) {
ctxt->input->cur = BAD_CAST"";
@@ -14749,6 +14867,7 @@ xmlCtxtReset(xmlParserCtxtPtr ctxt)
ctxt->catalogs = NULL;
ctxt->nbentities = 0;
ctxt->sizeentities = 0;
+ ctxt->sizeentcopy = 0;
xmlInitNodeInfoSeq(&ctxt->node_seq);
if (ctxt->attsDefault != NULL) {
diff --git a/parserInternals.c b/parserInternals.c
index 35a90ab..f8a7041 100644
--- a/parserInternals.c
+++ b/parserInternals.c
@@ -1201,7 +1201,7 @@ xmlSwitchInputEncodingInt(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
/*
* convert as much as possible of the buffer
*/
- nbchars = xmlCharEncInput(input->buf);
+ nbchars = xmlCharEncInput(input->buf, 1);
} else {
/*
* convert just enough to get
@@ -1253,7 +1253,7 @@ xmlSwitchInputEncoding(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
* xmlSwitchToEncodingInt:
* @ctxt: the parser context
* @handler: the encoding handler
- * @len: the lenght to convert or -1
+ * @len: the length to convert or -1
*
* change the input functions when discovering the character encoding
* of a given entity, and convert only @len bytes of the output, this
@@ -1719,6 +1719,8 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
ctxt->charset = XML_CHAR_ENCODING_UTF8;
ctxt->catalogs = NULL;
ctxt->nbentities = 0;
+ ctxt->sizeentities = 0;
+ ctxt->sizeentcopy = 0;
ctxt->input_id = 1;
xmlInitNodeInfoSeq(&ctxt->node_seq);
return(0);
diff --git a/python/Makefile.am b/python/Makefile.am
index 4a8b5d5..34aed96 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -24,8 +24,8 @@ AM_CPPFLAGS = \
python_LTLIBRARIES = libxml2mod.la
libxml2mod_la_SOURCES = libxml.c libxml_wrap.h libxml2-py.h libxml2-py.c types.c
-libxml2mod_la_LIBADD = $(top_builddir)/libxml2.la $(CYGWIN_EXTRA_PYTHON_LIBADD) $(WIN32_EXTRA_PYTHON_LIBADD) $(PYTHON_LIBS) -lpython$(PYTHON_VERSION)
-libxml2mod_la_LDFLAGS = $(CYGWIN_EXTRA_LDFLAGS) $(WIN32_EXTRA_LDFLAGS) -module -avoid-version
+libxml2mod_la_LDFLAGS = $(CYGWIN_EXTRA_LDFLAGS) $(WIN32_EXTRA_LDFLAGS) -module -avoid-version \
+ $(top_builddir)/libxml2.la $(CYGWIN_EXTRA_PYTHON_LIBADD) $(WIN32_EXTRA_PYTHON_LIBADD) $(PYTHON_LIBS)
BUILT_SOURCES = libxml2-export.c libxml2-py.h libxml2-py.c
diff --git a/python/Makefile.in b/python/Makefile.in
index 9f1a044..efdea43 100644
--- a/python/Makefile.in
+++ b/python/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -17,6 +17,23 @@
VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -80,11 +97,7 @@ am__uninstall_files_from_dir = { \
am__installdirs = "$(DESTDIR)$(pythondir)" "$(DESTDIR)$(docsdir)" \
"$(DESTDIR)$(pythondir)"
LTLIBRARIES = $(python_LTLIBRARIES)
-am__DEPENDENCIES_1 =
-@WITH_PYTHON_TRUE@libxml2mod_la_DEPENDENCIES = \
-@WITH_PYTHON_TRUE@ $(top_builddir)/libxml2.la \
-@WITH_PYTHON_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
-@WITH_PYTHON_TRUE@ $(am__DEPENDENCIES_1)
+libxml2mod_la_LIBADD =
am__libxml2mod_la_SOURCES_DIST = libxml.c libxml_wrap.h libxml2-py.h \
libxml2-py.c types.c
@WITH_PYTHON_TRUE@am_libxml2mod_la_OBJECTS = libxml.lo libxml2-py.lo \
@@ -132,6 +145,11 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
am__dist_python_DATA_DIST = drv_libxml2.py libxml2.py
DATA = $(dist_docs_DATA) $(dist_python_DATA)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
@@ -264,7 +282,6 @@ RANLIB = @RANLIB@
RDL_LIBS = @RDL_LIBS@
READER_TEST = @READER_TEST@
RELDATE = @RELDATE@
-RM = @RM@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
@@ -321,6 +338,7 @@ 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@
@@ -416,8 +434,9 @@ EXTRA_DIST = \
@WITH_PYTHON_TRUE@python_LTLIBRARIES = libxml2mod.la
@WITH_PYTHON_TRUE@libxml2mod_la_SOURCES = libxml.c libxml_wrap.h libxml2-py.h libxml2-py.c types.c
-@WITH_PYTHON_TRUE@libxml2mod_la_LIBADD = $(top_builddir)/libxml2.la $(CYGWIN_EXTRA_PYTHON_LIBADD) $(WIN32_EXTRA_PYTHON_LIBADD) $(PYTHON_LIBS) -lpython$(PYTHON_VERSION)
-@WITH_PYTHON_TRUE@libxml2mod_la_LDFLAGS = $(CYGWIN_EXTRA_LDFLAGS) $(WIN32_EXTRA_LDFLAGS) -module -avoid-version
+@WITH_PYTHON_TRUE@libxml2mod_la_LDFLAGS = $(CYGWIN_EXTRA_LDFLAGS) $(WIN32_EXTRA_LDFLAGS) -module -avoid-version \
+@WITH_PYTHON_TRUE@ $(top_builddir)/libxml2.la $(CYGWIN_EXTRA_PYTHON_LIBADD) $(WIN32_EXTRA_PYTHON_LIBADD) $(PYTHON_LIBS)
+
@WITH_PYTHON_TRUE@BUILT_SOURCES = libxml2-export.c libxml2-py.h libxml2-py.c
@WITH_PYTHON_TRUE@dist_python_DATA = \
@WITH_PYTHON_TRUE@ drv_libxml2.py \
@@ -466,7 +485,6 @@ setup.py: $(top_builddir)/config.status $(srcdir)/setup.py.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
install-pythonLTLIBRARIES: $(python_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(pythondir)" || $(MKDIR_P) "$(DESTDIR)$(pythondir)"
@list='$(python_LTLIBRARIES)'; test -n "$(pythondir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
@@ -474,6 +492,8 @@ install-pythonLTLIBRARIES: $(python_LTLIBRARIES)
else :; fi; \
done; \
test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pythondir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pythondir)" || exit 1; \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pythondir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pythondir)"; \
}
@@ -536,8 +556,11 @@ clean-libtool:
-rm -rf .libs _libs
install-dist_docsDATA: $(dist_docs_DATA)
@$(NORMAL_INSTALL)
- test -z "$(docsdir)" || $(MKDIR_P) "$(DESTDIR)$(docsdir)"
@list='$(dist_docs_DATA)'; test -n "$(docsdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(docsdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(docsdir)" || exit 1; \
+ fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
@@ -554,8 +577,11 @@ uninstall-dist_docsDATA:
dir='$(DESTDIR)$(docsdir)'; $(am__uninstall_files_from_dir)
install-dist_pythonDATA: $(dist_python_DATA)
@$(NORMAL_INSTALL)
- test -z "$(pythondir)" || $(MKDIR_P) "$(DESTDIR)$(pythondir)"
@list='$(dist_python_DATA)'; test -n "$(pythondir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pythondir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pythondir)" || exit 1; \
+ fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
@@ -738,13 +764,10 @@ distdir: $(DISTFILES)
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
- test -d "$(distdir)/$$subdir" \
- || $(MKDIR_P) "$(distdir)/$$subdir" \
- || exit 1; \
- fi; \
- done
- @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
+ $(am__make_dryrun) \
+ || test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
diff --git a/python/generator.py b/python/generator.py
index 767c4bb..82109e3 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -47,19 +47,19 @@ class docParser(xml.sax.handler.ContentHandler):
def close(self):
if debug:
- print "close"
+ print("close")
def getmethodname(self):
return self._methodname
def data(self, text):
if debug:
- print "data %s" % text
+ print("data %s" % text)
self._data.append(text)
def start(self, tag, attrs):
if debug:
- print "start %s, %s" % (tag, attrs)
+ print("start %s, %s" % (tag, attrs))
if tag == 'function':
self._data = []
self.in_function = 1
@@ -69,9 +69,9 @@ class docParser(xml.sax.handler.ContentHandler):
self.function_descr = None
self.function_return = None
self.function_file = None
- if attrs.has_key('name'):
+ if 'name' in attrs.keys():
self.function = attrs['name']
- if attrs.has_key('file'):
+ if 'file' in attrs.keys():
self.function_file = attrs['file']
elif tag == 'cond':
self._data = []
@@ -82,29 +82,29 @@ class docParser(xml.sax.handler.ContentHandler):
self.function_arg_name = None
self.function_arg_type = None
self.function_arg_info = None
- if attrs.has_key('name'):
+ if 'name' in attrs.keys():
self.function_arg_name = attrs['name']
- if attrs.has_key('type'):
+ if 'type' in attrs.keys():
self.function_arg_type = attrs['type']
- if attrs.has_key('info'):
+ if 'info' in attrs.keys():
self.function_arg_info = attrs['info']
elif tag == 'return':
if self.in_function == 1:
self.function_return_type = None
self.function_return_info = None
self.function_return_field = None
- if attrs.has_key('type'):
+ if 'type' in attrs.keys():
self.function_return_type = attrs['type']
- if attrs.has_key('info'):
+ if 'info' in attrs.keys():
self.function_return_info = attrs['info']
- if attrs.has_key('field'):
+ if 'field' in attrs.keys():
self.function_return_field = attrs['field']
elif tag == 'enum':
enum(attrs['type'],attrs['name'],attrs['value'])
def end(self, tag):
if debug:
- print "end %s" % tag
+ print("end %s" % tag)
if tag == 'function':
if self.function != None:
function(self.function, self.function_descr,
@@ -133,13 +133,13 @@ class docParser(xml.sax.handler.ContentHandler):
str = str + c
if self.in_function == 1:
self.function_cond = str
-
-
+
+
def function(name, desc, ret, args, file, cond):
functions[name] = (desc, ret, args, file, cond)
def enum(type, name, value):
- if not enums.has_key(type):
+ if type not in enums:
enums[type] = {}
enums[type][name] = value
@@ -339,6 +339,8 @@ def skip_function(name):
return 1
if name == "xmlValidateAttributeDecl":
return 1
+ if name == "xmlPopInputCallbacks":
+ return 1
return 0
@@ -351,10 +353,10 @@ def print_function_wrapper(name, output, export, include):
try:
(desc, ret, args, file, cond) = functions[name]
except:
- print "failed to get function %s infos"
+ print("failed to get function %s infos")
return
- if skipped_modules.has_key(file):
+ if file in skipped_modules:
return 0
if skip_function(name) == 1:
return 0
@@ -368,16 +370,17 @@ def print_function_wrapper(name, output, export, include):
c_args=""
c_return=""
c_convert=""
+ c_release=""
num_bufs=0
for arg in args:
# This should be correct
if arg[1][0:6] == "const ":
arg[1] = arg[1][6:]
c_args = c_args + " %s %s;\n" % (arg[1], arg[0])
- if py_types.has_key(arg[1]):
+ if arg[1] in py_types:
(f, t, n, c) = py_types[arg[1]]
if (f == 'z') and (name in foreign_encoding_args) and (num_bufs == 0):
- f = 't#'
+ f = 's#'
if f != None:
format = format + f
if t != None:
@@ -388,17 +391,20 @@ def print_function_wrapper(name, output, export, include):
arg[1], t, arg[0])
else:
format_args = format_args + ", &%s" % (arg[0])
- if f == 't#':
+ if f == 's#':
format_args = format_args + ", &py_buffsize%d" % num_bufs
c_args = c_args + " int py_buffsize%d;\n" % num_bufs
num_bufs = num_bufs + 1
if c_call != "":
c_call = c_call + ", "
c_call = c_call + "%s" % (arg[0])
+ if t == "File":
+ c_release = c_release + \
+ " PyFile_Release(%s);\n" % (arg[0])
else:
- if skipped_types.has_key(arg[1]):
+ if arg[1] in skipped_types:
return 0
- if unknown_types.has_key(arg[1]):
+ if arg[1] in unknown_types:
lst = unknown_types[arg[1]]
lst.append(name)
else:
@@ -420,25 +426,25 @@ def print_function_wrapper(name, output, export, include):
else:
c_call = "\n %s(%s);\n" % (name, c_call)
ret_convert = " Py_INCREF(Py_None);\n return(Py_None);\n"
- elif py_types.has_key(ret[0]):
+ elif ret[0] in py_types:
(f, t, n, c) = py_types[ret[0]]
- c_return = " %s c_retval;\n" % (ret[0])
+ c_return = c_return + " %s c_retval;\n" % (ret[0])
if file == "python_accessor" and ret[2] != None:
c_call = "\n c_retval = %s->%s;\n" % (args[0][0], ret[2])
else:
c_call = "\n c_retval = %s(%s);\n" % (name, c_call)
ret_convert = " py_retval = libxml_%sWrap((%s) c_retval);\n" % (n,c)
ret_convert = ret_convert + " return(py_retval);\n"
- elif py_return_types.has_key(ret[0]):
+ elif ret[0] in py_return_types:
(f, t, n, c) = py_return_types[ret[0]]
- c_return = " %s c_retval;\n" % (ret[0])
+ c_return = c_return + " %s c_retval;\n" % (ret[0])
c_call = "\n c_retval = %s(%s);\n" % (name, c_call)
ret_convert = " py_retval = libxml_%sWrap((%s) c_retval);\n" % (n,c)
ret_convert = ret_convert + " return(py_retval);\n"
else:
- if skipped_types.has_key(ret[0]):
+ if ret[0] in skipped_types:
return 0
- if unknown_types.has_key(ret[0]):
+ if ret[0] in unknown_types:
lst = unknown_types[ret[0]]
lst.append(name)
else:
@@ -489,8 +495,10 @@ def print_function_wrapper(name, output, export, include):
output.write(" return(NULL);\n")
if c_convert != "":
output.write(c_convert)
-
+
output.write(c_call)
+ if c_release != "":
+ output.write(c_release)
output.write(ret_convert)
output.write("}\n\n")
if cond != None and cond != "":
@@ -510,19 +518,19 @@ def buildStubs():
(parser, target) = getparser()
parser.feed(data)
parser.close()
- except IOError, msg:
+ except IOError as msg:
try:
f = open(os.path.join(srcPref,"..","doc","libxml2-api.xml"))
data = f.read()
(parser, target) = getparser()
parser.feed(data)
parser.close()
- except IOError, msg:
- print file, ":", msg
+ except IOError as msg:
+ print(file, ":", msg)
sys.exit(1)
- n = len(functions.keys())
- print "Found %d functions in libxml2-api.xml" % (n)
+ n = len(list(functions.keys()))
+ print("Found %d functions in libxml2-api.xml" % (n))
py_types['pythonObject'] = ('O', "pythonObject", "pythonObject", "pythonObject")
try:
@@ -531,12 +539,12 @@ def buildStubs():
(parser, target) = getparser()
parser.feed(data)
parser.close()
- except IOError, msg:
- print file, ":", msg
+ except IOError as msg:
+ print(file, ":", msg)
- print "Found %d functions in libxml2-python-api.xml" % (
- len(functions.keys()) - n)
+ print("Found %d functions in libxml2-python-api.xml" % (
+ len(list(functions.keys())) - n))
nb_wrap = 0
failed = 0
skipped = 0
@@ -567,12 +575,12 @@ def buildStubs():
export.close()
wrapper.close()
- print "Generated %d wrapper functions, %d failed, %d skipped\n" % (nb_wrap,
- failed, skipped)
- print "Missing type converters: "
- for type in unknown_types.keys():
- print "%s:%d " % (type, len(unknown_types[type])),
- print
+ print("Generated %d wrapper functions, %d failed, %d skipped\n" % (nb_wrap,
+ failed, skipped))
+ print("Missing type converters: ")
+ for type in list(unknown_types.keys()):
+ print("%s:%d " % (type, len(unknown_types[type])))
+ print()
#######################################################################
#
@@ -697,40 +705,40 @@ def nameFixup(name, classe, type, file):
l = len(classe)
if name[0:l] == listname:
func = name[l:]
- func = string.lower(func[0:1]) + func[1:]
+ func = func[0:1].lower() + func[1:]
elif name[0:12] == "xmlParserGet" and file == "python_accessor":
func = name[12:]
- func = string.lower(func[0:1]) + func[1:]
+ func = func[0:1].lower() + func[1:]
elif name[0:12] == "xmlParserSet" and file == "python_accessor":
func = name[12:]
- func = string.lower(func[0:1]) + func[1:]
+ func = func[0:1].lower() + func[1:]
elif name[0:10] == "xmlNodeGet" and file == "python_accessor":
func = name[10:]
- func = string.lower(func[0:1]) + func[1:]
+ func = func[0:1].lower() + func[1:]
elif name[0:9] == "xmlURIGet" and file == "python_accessor":
func = name[9:]
- func = string.lower(func[0:1]) + func[1:]
+ func = func[0:1].lower() + func[1:]
elif name[0:9] == "xmlURISet" and file == "python_accessor":
func = name[6:]
- func = string.lower(func[0:1]) + func[1:]
+ func = func[0:1].lower() + func[1:]
elif name[0:11] == "xmlErrorGet" and file == "python_accessor":
func = name[11:]
- func = string.lower(func[0:1]) + func[1:]
+ func = func[0:1].lower() + func[1:]
elif name[0:17] == "xmlXPathParserGet" and file == "python_accessor":
func = name[17:]
- func = string.lower(func[0:1]) + func[1:]
+ func = func[0:1].lower() + func[1:]
elif name[0:11] == "xmlXPathGet" and file == "python_accessor":
func = name[11:]
- func = string.lower(func[0:1]) + func[1:]
+ func = func[0:1].lower() + func[1:]
elif name[0:11] == "xmlXPathSet" and file == "python_accessor":
func = name[8:]
- func = string.lower(func[0:1]) + func[1:]
+ func = func[0:1].lower() + func[1:]
elif name[0:15] == "xmlOutputBuffer" and file != "python":
func = name[15:]
- func = string.lower(func[0:1]) + func[1:]
+ func = func[0:1].lower() + func[1:]
elif name[0:20] == "xmlParserInputBuffer" and file != "python":
func = name[20:]
- func = string.lower(func[0:1]) + func[1:]
+ func = func[0:1].lower() + func[1:]
elif name[0:9] == "xmlRegexp" and file == "xmlregexp":
func = "regexp" + name[9:]
elif name[0:6] == "xmlReg" and file == "xmlregexp":
@@ -745,19 +753,19 @@ def nameFixup(name, classe, type, file):
func = name[9:]
elif name[0:11] == "xmlACatalog":
func = name[11:]
- func = string.lower(func[0:1]) + func[1:]
+ func = func[0:1].lower() + func[1:]
elif name[0:l] == classe:
func = name[l:]
- func = string.lower(func[0:1]) + func[1:]
+ func = func[0:1].lower() + func[1:]
elif name[0:7] == "libxml_":
func = name[7:]
- func = string.lower(func[0:1]) + func[1:]
+ func = func[0:1].lower() + func[1:]
elif name[0:6] == "xmlGet":
func = name[6:]
- func = string.lower(func[0:1]) + func[1:]
+ func = func[0:1].lower() + func[1:]
elif name[0:3] == "xml":
func = name[3:]
- func = string.lower(func[0:1]) + func[1:]
+ func = func[0:1].lower() + func[1:]
else:
func = name
if func[0:5] == "xPath":
@@ -795,11 +803,29 @@ def functionCompare(info1, info2):
return 1
return 0
+def cmp_to_key(mycmp):
+ 'Convert a cmp= function into a key= function'
+ class K(object):
+ def __init__(self, obj, *args):
+ self.obj = obj
+ def __lt__(self, other):
+ return mycmp(self.obj, other.obj) < 0
+ def __gt__(self, other):
+ return mycmp(self.obj, other.obj) > 0
+ def __eq__(self, other):
+ return mycmp(self.obj, other.obj) == 0
+ def __le__(self, other):
+ return mycmp(self.obj, other.obj) <= 0
+ def __ge__(self, other):
+ return mycmp(self.obj, other.obj) >= 0
+ def __ne__(self, other):
+ return mycmp(self.obj, other.obj) != 0
+ return K
def writeDoc(name, args, indent, output):
if functions[name][0] is None or functions[name][0] == "":
return
val = functions[name][0]
- val = string.replace(val, "NULL", "None")
+ val = val.replace("NULL", "None")
output.write(indent)
output.write('"""')
while len(val) > 60:
@@ -807,7 +833,7 @@ def writeDoc(name, args, indent, output):
val = val[1:]
continue
str = val[0:60]
- i = string.rfind(str, " ")
+ i = str.rfind(" ")
if i < 0:
i = 60
str = val[0:i]
@@ -857,13 +883,13 @@ def buildWrappers():
ctypes.append(type)
ctypes_processed[type] = ()
for type in sorted(classes_type.keys()):
- if ctypes_processed.has_key(type):
+ if type in ctypes_processed:
continue
tinfo = classes_type[type]
- if not classes_processed.has_key(tinfo[2]):
+ if tinfo[2] not in classes_processed:
classes_list.append(tinfo[2])
classes_processed[tinfo[2]] = ()
-
+
ctypes.append(type)
ctypes_processed[type] = ()
@@ -912,9 +938,9 @@ def buildWrappers():
txt.write(" Generated Classes for libxml2-python\n\n")
txt.write("#\n# Global functions of the module\n#\n\n")
- if function_classes.has_key("None"):
+ if "None" in function_classes:
flist = function_classes["None"]
- flist.sort(functionCompare)
+ flist = sorted(flist, key=cmp_to_key(functionCompare))
oldfile = ""
for info in flist:
(index, func, name, ret, args, file) = info
@@ -934,11 +960,17 @@ def buildWrappers():
writeDoc(name, args, ' ', classes)
for arg in args:
- if classes_type.has_key(arg[1]):
+ if arg[1] in classes_type:
classes.write(" if %s is None: %s__o = None\n" %
(arg[0], arg[0]))
classes.write(" else: %s__o = %s%s\n" %
(arg[0], arg[0], classes_type[arg[1]][0]))
+ if arg[1] in py_types:
+ (f, t, n, c) = py_types[arg[1]]
+ if t == "File":
+ classes.write(" if %s is not None: %s.flush()\n" % (
+ arg[0], arg[0]))
+
if ret[0] != "void":
classes.write(" ret = ")
else:
@@ -949,26 +981,36 @@ def buildWrappers():
if n != 0:
classes.write(", ")
classes.write("%s" % arg[0])
- if classes_type.has_key(arg[1]):
+ if arg[1] in classes_type:
classes.write("__o")
n = n + 1
classes.write(")\n")
+
+# This may be needed to reposition the I/O, but likely to cause more harm
+# than good. Those changes in Python3 really break the model.
+# for arg in args:
+# if arg[1] in py_types:
+# (f, t, n, c) = py_types[arg[1]]
+# if t == "File":
+# classes.write(" if %s is not None: %s.seek(0,0)\n"%(
+# arg[0], arg[0]))
+
if ret[0] != "void":
- if classes_type.has_key(ret[0]):
+ if ret[0] in classes_type:
#
# Raise an exception
#
- if functions_noexcept.has_key(name):
+ if name in functions_noexcept:
classes.write(" if ret is None:return None\n")
- elif string.find(name, "URI") >= 0:
+ elif name.find("URI") >= 0:
classes.write(
" if ret is None:raise uriError('%s() failed')\n"
% (name))
- elif string.find(name, "XPath") >= 0:
+ elif name.find("XPath") >= 0:
classes.write(
" if ret is None:raise xpathError('%s() failed')\n"
% (name))
- elif string.find(name, "Parse") >= 0:
+ elif name.find("Parse") >= 0:
classes.write(
" if ret is None:raise parserError('%s() failed')\n"
% (name))
@@ -988,7 +1030,7 @@ def buildWrappers():
if classname == "None":
pass
else:
- if classes_ancestor.has_key(classname):
+ if classname in classes_ancestor:
txt.write("\n\nClass %s(%s)\n" % (classname,
classes_ancestor[classname]))
classes.write("class %s(%s):\n" % (classname,
@@ -996,12 +1038,11 @@ def buildWrappers():
classes.write(" def __init__(self, _obj=None):\n")
if classes_ancestor[classname] == "xmlCore" or \
classes_ancestor[classname] == "xmlNode":
- classes.write(" if type(_obj).__name__ != ")
- classes.write("'PyCObject':\n")
- classes.write(" raise TypeError, ")
- classes.write("'%s needs a PyCObject argument'\n" % \
+ classes.write(" if checkWrapper(_obj) != 0:")
+ classes.write(" raise TypeError")
+ classes.write("('%s got a wrong wrapper object type')\n" % \
classname)
- if reference_keepers.has_key(classname):
+ if classname in reference_keepers:
rlist = reference_keepers[classname]
for ref in rlist:
classes.write(" self.%s = None\n" % ref[1])
@@ -1012,20 +1053,20 @@ def buildWrappers():
classes_ancestor[classname] == "xmlNode":
classes.write(" def __repr__(self):\n")
format = "<%s (%%s) object at 0x%%x>" % (classname)
- classes.write(" return \"%s\" %% (self.name, long(pos_id (self)))\n\n" % (
+ classes.write(" return \"%s\" %% (self.name, int(pos_id (self)))\n\n" % (
format))
else:
txt.write("Class %s()\n" % (classname))
classes.write("class %s:\n" % (classname))
classes.write(" def __init__(self, _obj=None):\n")
- if reference_keepers.has_key(classname):
+ if classname in reference_keepers:
list = reference_keepers[classname]
for ref in list:
classes.write(" self.%s = None\n" % ref[1])
classes.write(" if _obj != None:self._o = _obj;return\n")
classes.write(" self._o = None\n\n")
destruct=None
- if classes_destructors.has_key(classname):
+ if classname in classes_destructors:
classes.write(" def __del__(self):\n")
classes.write(" if self._o != None:\n")
classes.write(" libxml2mod.%s(self._o)\n" %
@@ -1033,7 +1074,7 @@ def buildWrappers():
classes.write(" self._o = None\n\n")
destruct=classes_destructors[classname]
flist = function_classes[classname]
- flist.sort(functionCompare)
+ flist = sorted(flist, key=cmp_to_key(functionCompare))
oldfile = ""
for info in flist:
(index, func, name, ret, args, file) = info
@@ -1065,7 +1106,7 @@ def buildWrappers():
writeDoc(name, args, ' ', classes)
n = 0
for arg in args:
- if classes_type.has_key(arg[1]):
+ if arg[1] in classes_type:
if n != index:
classes.write(" if %s is None: %s__o = None\n" %
(arg[0], arg[0]))
@@ -1083,31 +1124,31 @@ def buildWrappers():
classes.write(", ")
if n != index:
classes.write("%s" % arg[0])
- if classes_type.has_key(arg[1]):
+ if arg[1] in classes_type:
classes.write("__o")
else:
classes.write("self")
- if classes_type.has_key(arg[1]):
+ if arg[1] in classes_type:
classes.write(classes_type[arg[1]][0])
n = n + 1
classes.write(")\n")
if ret[0] != "void":
- if classes_type.has_key(ret[0]):
+ if ret[0] in classes_type:
#
# Raise an exception
#
- if functions_noexcept.has_key(name):
+ if name in functions_noexcept:
classes.write(
" if ret is None:return None\n")
- elif string.find(name, "URI") >= 0:
+ elif name.find("URI") >= 0:
classes.write(
" if ret is None:raise uriError('%s() failed')\n"
% (name))
- elif string.find(name, "XPath") >= 0:
+ elif name.find("XPath") >= 0:
classes.write(
" if ret is None:raise xpathError('%s() failed')\n"
% (name))
- elif string.find(name, "Parse") >= 0:
+ elif name.find("Parse") >= 0:
classes.write(
" if ret is None:raise parserError('%s() failed')\n"
% (name))
@@ -1129,7 +1170,7 @@ def buildWrappers():
# See reference_keepers for the list
#
tclass = classes_type[ret[0]][2]
- if reference_keepers.has_key(tclass):
+ if tclass in reference_keepers:
list = reference_keepers[tclass]
for pref in list:
if pref[0] == classname:
@@ -1139,22 +1180,22 @@ def buildWrappers():
# return the class
#
classes.write(" return __tmp\n")
- elif converter_type.has_key(ret[0]):
+ elif ret[0] in converter_type:
#
# Raise an exception
#
- if functions_noexcept.has_key(name):
+ if name in functions_noexcept:
classes.write(
" if ret is None:return None")
- elif string.find(name, "URI") >= 0:
+ elif name.find("URI") >= 0:
classes.write(
" if ret is None:raise uriError('%s() failed')\n"
% (name))
- elif string.find(name, "XPath") >= 0:
+ elif name.find("XPath") >= 0:
classes.write(
" if ret is None:raise xpathError('%s() failed')\n"
% (name))
- elif string.find(name, "Parse") >= 0:
+ elif name.find("Parse") >= 0:
classes.write(
" if ret is None:raise parserError('%s() failed')\n"
% (name))
@@ -1175,7 +1216,7 @@ def buildWrappers():
for type,enum in enums.items():
classes.write("# %s\n" % type)
items = enum.items()
- items.sort(lambda i1,i2: cmp(long(i1[1]),long(i2[1])))
+ items = sorted(items, key=(lambda i: int(i[1])))
for name,value in items:
classes.write("%s = %s\n" % (name,value))
classes.write("\n")
diff --git a/python/libxml.c b/python/libxml.c
index a556160..03cfb9f 100644
--- a/python/libxml.c
+++ b/python/libxml.c
@@ -41,7 +41,17 @@
/* #define DEBUG_FILES */
/* #define DEBUG_LOADER */
+#if PY_MAJOR_VERSION >= 3
+PyObject *PyInit_libxml2mod(void);
+
+#define PY_IMPORT_STRING_SIZE PyUnicode_FromStringAndSize
+#define PY_IMPORT_STRING PyUnicode_FromString
+#else
void initlibxml2mod(void);
+#define PY_IMPORT_STRING_SIZE PyString_FromStringAndSize
+#define PY_IMPORT_STRING PyString_FromString
+#endif
+
/**
* TODO:
@@ -280,18 +290,42 @@ xmlPythonFileReadRaw (void * context, char * buffer, int len) {
if (ret == NULL) {
printf("xmlPythonFileReadRaw: result is NULL\n");
return(-1);
- } else if (PyString_Check(ret)) {
- lenread = PyString_Size(ret);
- data = PyString_AsString(ret);
- if (lenread > len)
- memcpy(buffer, data, len);
- else
- memcpy(buffer, data, lenread);
- Py_DECREF(ret);
+ } else if (PyBytes_Check(ret)) {
+ lenread = PyBytes_Size(ret);
+ data = PyBytes_AsString(ret);
+#ifdef PyUnicode_Check
+ } else if PyUnicode_Check (ret) {
+#if PY_VERSION_HEX >= 0x03030000
+ size_t size;
+ const char *tmp;
+
+ /* tmp doesn't need to be deallocated */
+ tmp = PyUnicode_AsUTF8AndSize(ret, &size);
+
+ lenread = (int) size;
+ data = (char *) tmp;
+#else
+ PyObject *b;
+ b = PyUnicode_AsUTF8String(ret);
+ if (b == NULL) {
+ printf("xmlPythonFileReadRaw: failed to convert to UTF-8\n");
+ return(-1);
+ }
+ lenread = PyBytes_Size(b);
+ data = PyBytes_AsString(b);
+ Py_DECREF(b);
+#endif
+#endif
} else {
printf("xmlPythonFileReadRaw: result is not a String\n");
Py_DECREF(ret);
+ return(-1);
}
+ if (lenread > len)
+ memcpy(buffer, data, len);
+ else
+ memcpy(buffer, data, lenread);
+ Py_DECREF(ret);
return(lenread);
}
@@ -321,18 +355,42 @@ xmlPythonFileRead (void * context, char * buffer, int len) {
if (ret == NULL) {
printf("xmlPythonFileRead: result is NULL\n");
return(-1);
- } else if (PyString_Check(ret)) {
- lenread = PyString_Size(ret);
- data = PyString_AsString(ret);
- if (lenread > len)
- memcpy(buffer, data, len);
- else
- memcpy(buffer, data, lenread);
- Py_DECREF(ret);
+ } else if (PyBytes_Check(ret)) {
+ lenread = PyBytes_Size(ret);
+ data = PyBytes_AsString(ret);
+#ifdef PyUnicode_Check
+ } else if PyUnicode_Check (ret) {
+#if PY_VERSION_HEX >= 0x03030000
+ size_t size;
+ const char *tmp;
+
+ /* tmp doesn't need to be deallocated */
+ tmp = PyUnicode_AsUTF8AndSize(ret, &size);
+
+ lenread = (int) size;
+ data = (char *) tmp;
+#else
+ PyObject *b;
+ b = PyUnicode_AsUTF8String(ret);
+ if (b == NULL) {
+ printf("xmlPythonFileRead: failed to convert to UTF-8\n");
+ return(-1);
+ }
+ lenread = PyBytes_Size(b);
+ data = PyBytes_AsString(b);
+ Py_DECREF(b);
+#endif
+#endif
} else {
printf("xmlPythonFileRead: result is not a String\n");
Py_DECREF(ret);
+ return(-1);
}
+ if (lenread > len)
+ memcpy(buffer, data, len);
+ else
+ memcpy(buffer, data, lenread);
+ Py_DECREF(ret);
return(lenread);
}
@@ -358,7 +416,7 @@ xmlPythonFileWrite (void * context, const char * buffer, int len) {
#endif
file = (PyObject *) context;
if (file == NULL) return(-1);
- string = PyString_FromStringAndSize(buffer, len);
+ string = PY_IMPORT_STRING_SIZE(buffer, len);
if (string == NULL) return(-1);
if (PyObject_HasAttrString(file, (char *) "io_write")) {
ret = PyEval_CallMethod(file, (char *) "io_write", (char *) "(O)",
@@ -371,8 +429,8 @@ xmlPythonFileWrite (void * context, const char * buffer, int len) {
if (ret == NULL) {
printf("xmlPythonFileWrite: result is NULL\n");
return(-1);
- } else if (PyInt_Check(ret)) {
- written = (int) PyInt_AsLong(ret);
+ } else if (PyLong_Check(ret)) {
+ written = (int) PyLong_AsLong(ret);
Py_DECREF(ret);
} else if (ret == Py_None) {
written = len;
@@ -665,7 +723,7 @@ pythonExternalEntityLoader(const char *URL, const char *ID,
Py_XDECREF(ctxtobj);
#ifdef DEBUG_LOADER
printf("pythonExternalEntityLoader: result ");
- PyObject_Print(ret, stderr, 0);
+ PyObject_Print(ret, stdout, 0);
printf("\n");
#endif
@@ -711,19 +769,114 @@ libxml_xmlSetEntityLoader(ATTRIBUTE_UNUSED PyObject *self, PyObject *args) {
&loader))
return(NULL);
+ if (!PyCallable_Check(loader)) {
+ PyErr_SetString(PyExc_ValueError, "entity loader is not callable");
+ return(NULL);
+ }
+
#ifdef DEBUG_LOADER
printf("libxml_xmlSetEntityLoader\n");
#endif
if (defaultExternalEntityLoader == NULL)
defaultExternalEntityLoader = xmlGetExternalEntityLoader();
+ Py_XDECREF(pythonExternalEntityLoaderObjext);
pythonExternalEntityLoaderObjext = loader;
+ Py_XINCREF(pythonExternalEntityLoaderObjext);
xmlSetExternalEntityLoader(pythonExternalEntityLoader);
- py_retval = PyInt_FromLong(0);
+ py_retval = PyLong_FromLong(0);
return(py_retval);
}
+/************************************************************************
+ * *
+ * Input callback registration *
+ * *
+ ************************************************************************/
+static PyObject *pythonInputOpenCallbackObject;
+static int pythonInputCallbackID = -1;
+
+static int
+pythonInputMatchCallback(ATTRIBUTE_UNUSED const char *URI)
+{
+ /* Always return success, real decision whether URI is supported will be
+ * made in open callback. */
+ return 1;
+}
+
+static void *
+pythonInputOpenCallback(const char *URI)
+{
+ PyObject *ret;
+
+ ret = PyObject_CallFunction(pythonInputOpenCallbackObject,
+ (char *)"s", URI);
+ if (ret == Py_None) {
+ Py_DECREF(Py_None);
+ return NULL;
+ }
+ return ret;
+}
+
+PyObject *
+libxml_xmlRegisterInputCallback(ATTRIBUTE_UNUSED PyObject *self,
+ PyObject *args) {
+ PyObject *cb;
+
+ if (!PyArg_ParseTuple(args,
+ (const char *)"O:libxml_xmlRegisterInputCallback", &cb))
+ return(NULL);
+
+ if (!PyCallable_Check(cb)) {
+ PyErr_SetString(PyExc_ValueError, "input callback is not callable");
+ return(NULL);
+ }
+
+ /* Python module registers a single callback and manages the list of
+ * all callbacks internally. This is necessitated by xmlInputMatchCallback
+ * API, which does not allow for passing of data objects to discriminate
+ * different Python methods. */
+ if (pythonInputCallbackID == -1) {
+ pythonInputCallbackID = xmlRegisterInputCallbacks(
+ pythonInputMatchCallback, pythonInputOpenCallback,
+ xmlPythonFileReadRaw, xmlPythonFileCloseRaw);
+ if (pythonInputCallbackID == -1)
+ return PyErr_NoMemory();
+ pythonInputOpenCallbackObject = cb;
+ Py_INCREF(pythonInputOpenCallbackObject);
+ }
+
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
+
+PyObject *
+libxml_xmlUnregisterInputCallback(ATTRIBUTE_UNUSED PyObject *self,
+ ATTRIBUTE_UNUSED PyObject *args) {
+ int ret;
+
+ ret = xmlPopInputCallbacks();
+ if (pythonInputCallbackID != -1) {
+ /* Assert that the right input callback was popped. libxml's API does not
+ * allow removal by ID, so all that could be done is an assert. */
+ if (pythonInputCallbackID == ret) {
+ pythonInputCallbackID = -1;
+ Py_DECREF(pythonInputOpenCallbackObject);
+ pythonInputOpenCallbackObject = NULL;
+ } else {
+ PyErr_SetString(PyExc_AssertionError, "popped non-python input callback");
+ return(NULL);
+ }
+ } else if (ret == -1) {
+ /* No more callbacks to pop */
+ PyErr_SetString(PyExc_IndexError, "no input callbacks to pop");
+ return(NULL);
+ }
+
+ Py_INCREF(Py_None);
+ return(Py_None);
+}
/************************************************************************
* *
@@ -764,10 +917,10 @@ pythonStartElement(void *user_data, const xmlChar * name,
} else {
dict = PyDict_New();
for (i = 0; attrs[i] != NULL; i++) {
- attrname = PyString_FromString((char *) attrs[i]);
+ attrname = PY_IMPORT_STRING((char *) attrs[i]);
i++;
if (attrs[i] != NULL) {
- attrvalue = PyString_FromString((char *) attrs[i]);
+ attrvalue = PY_IMPORT_STRING((char *) attrs[i]);
} else {
Py_XINCREF(Py_None);
attrvalue = Py_None;
@@ -1170,7 +1323,7 @@ pythonAttributeDecl(void *user_data,
nameList = PyList_New(count);
count = 0;
for (node = tree; node != NULL; node = node->next) {
- newName = PyString_FromString((char *) node->name);
+ newName = PY_IMPORT_STRING((char *) node->name);
PyList_SetItem(nameList, count, newName);
Py_DECREF(newName);
count++;
@@ -2033,7 +2186,7 @@ libxml_xmlFreeTextReader(ATTRIBUTE_UNUSED PyObject *self, PyObject *args) {
if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeTextReader", &pyobj_reader))
return(NULL);
- if (!PyCObject_Check(pyobj_reader)) {
+ if (!PyCapsule_CheckExact(pyobj_reader)) {
Py_INCREF(Py_None);
return(Py_None);
}
@@ -2234,6 +2387,32 @@ libxml_xmlRegisterXPathFunction(ATTRIBUTE_UNUSED PyObject * self,
return (py_retval);
}
+PyObject *
+libxml_xmlXPathRegisterVariable(ATTRIBUTE_UNUSED PyObject * self,
+ PyObject * args)
+{
+ PyObject *py_retval;
+ int c_retval = 0;
+ xmlChar *name;
+ xmlChar *ns_uri;
+ xmlXPathContextPtr ctx;
+ xmlXPathObjectPtr val;
+ PyObject *pyobj_ctx;
+ PyObject *pyobj_value;
+
+ if (!PyArg_ParseTuple
+ (args, (char *) "OszO:xpathRegisterVariable", &pyobj_ctx, &name,
+ &ns_uri, &pyobj_value))
+ return (NULL);
+
+ ctx = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctx);
+ val = libxml_xmlXPathObjectPtrConvert(pyobj_value);
+
+ c_retval = xmlXPathRegisterVariableNS(ctx, name, ns_uri, val);
+ py_retval = libxml_intWrap(c_retval);
+ return (py_retval);
+}
+
/************************************************************************
* *
* Global properties access *
@@ -2566,6 +2745,10 @@ libxml_type(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
if (!PyArg_ParseTuple(args, (char *) "O:last", &obj))
return NULL;
cur = PyxmlNode_Get(obj);
+ if (cur == NULL) {
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
#ifdef DEBUG
printf("libxml_type: cur = %p\n", cur);
@@ -2682,7 +2865,7 @@ libxml_xmlNodeRemoveNsDef(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
PyObject *pyobj_node;
xmlChar *href;
xmlNsPtr c_retval;
-
+
if (!PyArg_ParseTuple
(args, (char *) "Oz:xmlNodeRemoveNsDef", &pyobj_node, &href))
return (NULL);
@@ -2844,16 +3027,12 @@ libxml_saveNodeTo(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
&py_file, &encoding, &format))
return (NULL);
node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
-
if (node == NULL) {
- return (PyInt_FromLong((long) -1));
- }
- if ((py_file == NULL) || (!(PyFile_Check(py_file)))) {
- return (PyInt_FromLong((long) -1));
+ return (PyLong_FromLong((long) -1));
}
- output = PyFile_AsFile(py_file);
+ output = PyFile_Get(py_file);
if (output == NULL) {
- return (PyInt_FromLong((long) -1));
+ return (PyLong_FromLong((long) -1));
}
if (node->type == XML_DOCUMENT_NODE) {
@@ -2872,7 +3051,7 @@ libxml_saveNodeTo(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
if (encoding != NULL) {
handler = xmlFindCharEncodingHandler(encoding);
if (handler == NULL) {
- return (PyInt_FromLong((long) -1));
+ return (PyLong_FromLong((long) -1));
}
}
if (doc->type == XML_HTML_DOCUMENT_NODE) {
@@ -2897,7 +3076,8 @@ libxml_saveNodeTo(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
xmlNodeDumpOutput(buf, doc, node, 0, format, encoding);
len = xmlOutputBufferClose(buf);
}
- return (PyInt_FromLong((long) len));
+ PyFile_Release(output);
+ return (PyLong_FromLong((long) len));
}
#endif /* LIBXML_OUTPUT_ENABLED */
@@ -3403,7 +3583,7 @@ PystringSet_Convert(PyObject *py_strings, xmlChar *** result)
{
int idx;
for (idx=0; idx < count; ++idx) {
- char* s = PyString_AsString
+ char* s = PyBytes_AsString
(is_tuple
? PyTuple_GET_ITEM(py_strings, idx)
: PyList_GET_ITEM(py_strings, idx));
@@ -3492,8 +3672,8 @@ libxml_C14NDocDumpMemory(ATTRIBUTE_UNUSED PyObject * self,
return NULL;
}
else {
- py_retval = PyString_FromStringAndSize((const char *) doc_txt,
- result);
+ py_retval = PY_IMPORT_STRING_SIZE((const char *) doc_txt,
+ result);
xmlFree(doc_txt);
return py_retval;
}
@@ -3534,11 +3714,7 @@ libxml_C14NDocSaveTo(ATTRIBUTE_UNUSED PyObject * self,
return NULL;
}
- if ((py_file == NULL) || (!(PyFile_Check(py_file)))) {
- PyErr_SetString(PyExc_TypeError, "bad file.");
- return NULL;
- }
- output = PyFile_AsFile(py_file);
+ output = PyFile_Get(py_file);
if (output == NULL) {
PyErr_SetString(PyExc_TypeError, "bad file.");
return NULL;
@@ -3576,6 +3752,7 @@ libxml_C14NDocSaveTo(ATTRIBUTE_UNUSED PyObject * self,
xmlFree(prefixes);
}
+ PyFile_Release(output);
len = xmlOutputBufferClose(buf);
if (result < 0) {
@@ -3584,7 +3761,7 @@ libxml_C14NDocSaveTo(ATTRIBUTE_UNUSED PyObject * self,
return NULL;
}
else
- return PyInt_FromLong((long) len);
+ return PyLong_FromLong((long) len);
}
#endif
@@ -3598,7 +3775,7 @@ libxml_getObjDesc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
if (!PyArg_ParseTuple(args, (char *)"O:getObjDesc", &obj))
return NULL;
- str = PyCObject_GetDesc(obj);
+ str = PyCapsule_GetPointer(obj, PyCapsule_GetName(obj));
return Py_BuildValue((char *)"s", str);
}
@@ -3693,31 +3870,64 @@ static PyMethodDef libxmlMethods[] = {
{(char *) "getObjDesc", libxml_getObjDesc, METH_VARARGS, NULL},
{(char *) "compareNodesEqual", libxml_compareNodesEqual, METH_VARARGS, NULL},
{(char *) "nodeHash", libxml_nodeHash, METH_VARARGS, NULL},
+ {(char *) "xmlRegisterInputCallback", libxml_xmlRegisterInputCallback, METH_VARARGS, NULL},
+ {(char *) "xmlUnregisterInputCallback", libxml_xmlUnregisterInputCallback, METH_VARARGS, NULL},
{NULL, NULL, 0, NULL}
};
+#if PY_MAJOR_VERSION >= 3
+#define INITERROR return NULL
+
+static struct PyModuleDef moduledef = {
+ PyModuleDef_HEAD_INIT,
+ "libxml2mod",
+ NULL,
+ -1,
+ libxmlMethods,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
+#else
+#define INITERROR return
+
#ifdef MERGED_MODULES
extern void initlibxsltmod(void);
#endif
-void
-initlibxml2mod(void)
-{
- static int initialized = 0;
+#endif
- if (initialized != 0)
- return;
+#if PY_MAJOR_VERSION >= 3
+PyObject *PyInit_libxml2mod(void)
+#else
+void initlibxml2mod(void)
+#endif
+{
+ PyObject *module;
+#if PY_MAJOR_VERSION >= 3
+ module = PyModule_Create(&moduledef);
+#else
/* intialize the python extension module */
- Py_InitModule((char *) "libxml2mod", libxmlMethods);
+ module = Py_InitModule((char *) "libxml2mod", libxmlMethods);
+#endif
+ if (module == NULL)
+ INITERROR;
/* initialize libxml2 */
xmlInitParser();
+ /* TODO this probably need to be revamped for Python3 */
libxml_xmlErrorInitialize();
- initialized = 1;
-
+#if PY_MAJOR_VERSION < 3
#ifdef MERGED_MODULES
initlibxsltmod();
#endif
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+ return module;
+#endif
}
diff --git a/python/libxml.py b/python/libxml.py
index c861a70..e507e0f 100644
--- a/python/libxml.py
+++ b/python/libxml.py
@@ -5,13 +5,23 @@ import sys
# The root of all libxml2 errors.
class libxmlError(Exception): pass
+# Type of the wrapper class for the C objects wrappers
+def checkWrapper(obj):
+ try:
+ n = type(_obj).__name__
+ if n != 'PyCObject' and n != 'PyCapsule':
+ return 1
+ except:
+ return 0
+ return 0
+
#
# id() is sometimes negative ...
#
def pos_id(o):
i = id(o)
if (i < 0):
- return (sys.maxint - i)
+ return (sys.maxsize - i)
return i
#
@@ -62,9 +72,20 @@ class ioWrapper:
def io_read(self, len = -1):
if self.__io == None:
return(-1)
- if len < 0:
- return(self.__io.read())
- return(self.__io.read(len))
+ try:
+ if len < 0:
+ ret = self.__io.read()
+ else:
+ ret = self.__io.read(len)
+ except Exception:
+ import sys
+ e = sys.exc_info()[1]
+ print("failed to read from Python:", type(e))
+ print("on IO:", self.__io)
+ self.__io == None
+ return(-1)
+
+ return(ret)
def io_write(self, str, len = -1):
if self.__io == None:
@@ -79,7 +100,7 @@ class ioReadWrapper(ioWrapper):
self._o = libxml2mod.xmlCreateInputBuffer(self, enc)
def __del__(self):
- print "__del__"
+ print("__del__")
self.io_close()
if self._o != None:
libxml2mod.xmlFreeParserInputBuffer(self._o)
@@ -95,12 +116,19 @@ class ioWriteWrapper(ioWrapper):
def __init__(self, _obj, enc = ""):
# print "ioWriteWrapper.__init__", _obj
if type(_obj) == type(''):
- print "write io from a string"
+ print("write io from a string")
self.o = None
- elif type(_obj) == types.InstanceType:
- print "write io from instance of %s" % (_obj.__class__)
- ioWrapper.__init__(self, _obj)
- self._o = libxml2mod.xmlCreateOutputBuffer(self, enc)
+ elif type(_obj).__name__ == 'PyCapsule':
+ file = libxml2mod.outputBufferGetPythonFile(_obj)
+ if file != None:
+ ioWrapper.__init__(self, file)
+ else:
+ ioWrapper.__init__(self, _obj)
+ self._o = _obj
+# elif type(_obj) == types.InstanceType:
+# print(("write io from instance of %s" % (_obj.__class__)))
+# ioWrapper.__init__(self, _obj)
+# self._o = libxml2mod.xmlCreateOutputBuffer(self, enc)
else:
file = libxml2mod.outputBufferGetPythonFile(_obj)
if file != None:
@@ -265,22 +293,22 @@ class xmlCore:
ret = libxml2mod.parent(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
def get_children(self):
ret = libxml2mod.children(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
def get_last(self):
ret = libxml2mod.last(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
def get_next(self):
ret = libxml2mod.next(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
def get_properties(self):
ret = libxml2mod.properties(self._o)
if ret == None:
@@ -290,7 +318,7 @@ class xmlCore:
ret = libxml2mod.prev(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
def get_content(self):
return libxml2mod.xmlNodeGetContent(self._o)
getContent = get_content # why is this duplicate naming needed ?
@@ -317,7 +345,7 @@ class xmlCore:
ret = libxml2mod.parent(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
elif attr == "properties":
ret = libxml2mod.properties(self._o)
if ret == None:
@@ -327,22 +355,22 @@ class xmlCore:
ret = libxml2mod.children(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
elif attr == "last":
ret = libxml2mod.last(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
elif attr == "next":
ret = libxml2mod.next(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
elif attr == "prev":
ret = libxml2mod.prev(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
elif attr == "content":
return libxml2mod.xmlNodeGetContent(self._o)
elif attr == "name":
@@ -357,7 +385,7 @@ class xmlCore:
else:
return None
return xmlDoc(_obj=ret)
- raise AttributeError,attr
+ raise AttributeError(attr)
else:
parent = property(get_parent, None, None, "Parent node")
children = property(get_children, None, None, "First child node")
@@ -400,7 +428,7 @@ class xmlCore:
prefixes=None,
with_comments=0):
if nodes:
- nodes = map(lambda n: n._o, nodes)
+ nodes = [n._o for n in nodes]
return libxml2mod.xmlC14NDocDumpMemory(
self.get_doc()._o,
nodes,
@@ -414,7 +442,7 @@ class xmlCore:
prefixes=None,
with_comments=0):
if nodes:
- nodes = map(lambda n: n._o, nodes)
+ nodes = [n._o for n in nodes]
return libxml2mod.xmlC14NDocSaveTo(
self.get_doc()._o,
nodes,
@@ -564,10 +592,10 @@ def nodeWrap(o):
def xpathObjectRet(o):
otype = type(o)
if otype == type([]):
- ret = map(xpathObjectRet, o)
+ ret = list(map(xpathObjectRet, o))
return ret
elif otype == type(()):
- ret = map(xpathObjectRet, o)
+ ret = list(map(xpathObjectRet, o))
return tuple(ret)
elif otype == type('') or otype == type(0) or otype == type(0.0):
return o
@@ -603,7 +631,7 @@ def registerErrorHandler(f, ctx):
"""Register a Python written function to for error reporting.
The function is called back as f(ctx, error). """
import sys
- if not sys.modules.has_key('libxslt'):
+ if 'libxslt' not in sys.modules:
# normal behaviour when libxslt is not imported
ret = libxml2mod.xmlRegisterErrorHandler(f,ctx)
else:
@@ -682,8 +710,9 @@ class relaxNgValidCtxtCore:
libxml2mod.xmlRelaxNGSetValidErrors(self._o, err_func, warn_func, arg)
-def _xmlTextReaderErrorFunc((f,arg),msg,severity,locator):
+def _xmlTextReaderErrorFunc(xxx_todo_changeme,msg,severity,locator):
"""Intermediate callback to wrap the locator"""
+ (f,arg) = xxx_todo_changeme
return f(arg,msg,severity,xmlTextReaderLocator(locator))
class xmlTextReaderCore:
@@ -719,11 +748,35 @@ class xmlTextReaderCore:
return arg
#
-# The cleanup now goes though a wrappe in libxml.c
+# The cleanup now goes though a wrapper in libxml.c
#
def cleanupParser():
libxml2mod.xmlPythonCleanupParser()
+#
+# The interface to xmlRegisterInputCallbacks.
+# Since this API does not allow to pass a data object along with
+# match/open callbacks, it is necessary to maintain a list of all
+# Python callbacks.
+#
+__input_callbacks = []
+def registerInputCallback(func):
+ def findOpenCallback(URI):
+ for cb in reversed(__input_callbacks):
+ o = cb(URI)
+ if o is not None:
+ return o
+ libxml2mod.xmlRegisterInputCallback(findOpenCallback)
+ __input_callbacks.append(func)
+
+def popInputCallbacks():
+ # First pop python-level callbacks, when no more available - start
+ # popping built-in ones.
+ if len(__input_callbacks) > 0:
+ __input_callbacks.pop()
+ if len(__input_callbacks) == 0:
+ libxml2mod.xmlUnregisterInputCallback()
+
# WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
#
# Everything before this line comes from libxml.py
diff --git a/python/libxml2-export.c b/python/libxml2-export.c
index 19ef337..f7d96e1 100644
--- a/python/libxml2-export.c
+++ b/python/libxml2-export.c
@@ -650,7 +650,6 @@
{ (char *)"xmlPathToURI", libxml_xmlPathToURI, METH_VARARGS, NULL },
{ (char *)"xmlPedanticParserDefault", libxml_xmlPedanticParserDefault, METH_VARARGS, NULL },
{ (char *)"xmlPopInput", libxml_xmlPopInput, METH_VARARGS, NULL },
- { (char *)"xmlPopInputCallbacks", libxml_xmlPopInputCallbacks, METH_VARARGS, NULL },
#if defined(LIBXML_TREE_ENABLED)
{ (char *)"xmlPreviousElementSibling", libxml_xmlPreviousElementSibling, METH_VARARGS, NULL },
#endif /* defined(LIBXML_TREE_ENABLED) */
@@ -1919,6 +1918,9 @@
{ (char *)"xmlXPathNextSelf", libxml_xmlXPathNextSelf, METH_VARARGS, NULL },
#endif /* defined(LIBXML_XPATH_ENABLED) */
#if defined(LIBXML_XPATH_ENABLED)
+ { (char *)"xmlXPathNodeEval", libxml_xmlXPathNodeEval, METH_VARARGS, NULL },
+#endif /* defined(LIBXML_XPATH_ENABLED) */
+#if defined(LIBXML_XPATH_ENABLED)
{ (char *)"xmlXPathNodeSetFreeNs", libxml_xmlXPathNodeSetFreeNs, METH_VARARGS, NULL },
#endif /* defined(LIBXML_XPATH_ENABLED) */
#if defined(LIBXML_XPATH_ENABLED)
@@ -1967,6 +1969,9 @@
{ (char *)"xmlXPathRegisterNs", libxml_xmlXPathRegisterNs, METH_VARARGS, NULL },
#endif /* defined(LIBXML_XPATH_ENABLED) */
#if defined(LIBXML_XPATH_ENABLED)
+ { (char *)"xmlXPathRegisterVariable", libxml_xmlXPathRegisterVariable, METH_VARARGS, NULL },
+#endif
+#if defined(LIBXML_XPATH_ENABLED)
{ (char *)"xmlXPathRegisteredFuncsCleanup", libxml_xmlXPathRegisteredFuncsCleanup, METH_VARARGS, NULL },
#endif /* defined(LIBXML_XPATH_ENABLED) */
#if defined(LIBXML_XPATH_ENABLED)
diff --git a/python/libxml2-py.c b/python/libxml2-py.c
index cb2e585..5d66e54 100644
--- a/python/libxml2-py.c
+++ b/python/libxml2-py.c
@@ -65,7 +65,7 @@ libxml_htmlCreateMemoryParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *arg
int py_buffsize0;
int size;
- if (!PyArg_ParseTuple(args, (char *)"t#i:htmlCreateMemoryParserCtxt", &buffer, &py_buffsize0, &size))
+ if (!PyArg_ParseTuple(args, (char *)"s#i:htmlCreateMemoryParserCtxt", &buffer, &py_buffsize0, &size))
return(NULL);
c_retval = htmlCreateMemoryParserCtxt(buffer, size);
@@ -155,7 +155,7 @@ libxml_htmlCtxtReadMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
char * encoding;
int options;
- if (!PyArg_ParseTuple(args, (char *)"Ot#izzi:htmlCtxtReadMemory", &pyobj_ctxt, &buffer, &py_buffsize0, &size, &URL, &encoding, &options))
+ if (!PyArg_ParseTuple(args, (char *)"Os#izzi:htmlCtxtReadMemory", &pyobj_ctxt, &buffer, &py_buffsize0, &size, &URL, &encoding, &options))
return(NULL);
ctxt = (htmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
@@ -267,6 +267,7 @@ libxml_htmlDocDump(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur);
c_retval = htmlDocDump(f, cur);
+ PyFile_Release(f);
py_retval = libxml_intWrap((int) c_retval);
return(py_retval);
}
@@ -448,6 +449,7 @@ libxml_htmlNodeDumpFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
htmlNodeDumpFile(out, doc, cur);
+ PyFile_Release(out);
Py_INCREF(Py_None);
return(Py_None);
}
@@ -474,6 +476,7 @@ libxml_htmlNodeDumpFileFormat(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
c_retval = htmlNodeDumpFileFormat(out, doc, cur, encoding, format);
+ PyFile_Release(out);
py_retval = libxml_intWrap((int) c_retval);
return(py_retval);
}
@@ -556,7 +559,7 @@ libxml_htmlParseChunk(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
int size;
int terminate;
- if (!PyArg_ParseTuple(args, (char *)"Ot#ii:htmlParseChunk", &pyobj_ctxt, &chunk, &py_buffsize0, &size, &terminate))
+ if (!PyArg_ParseTuple(args, (char *)"Os#ii:htmlParseChunk", &pyobj_ctxt, &chunk, &py_buffsize0, &size, &terminate))
return(NULL);
ctxt = (htmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
@@ -702,7 +705,7 @@ libxml_htmlReadMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
char * encoding;
int options;
- if (!PyArg_ParseTuple(args, (char *)"t#izzi:htmlReadMemory", &buffer, &py_buffsize0, &size, &URL, &encoding, &options))
+ if (!PyArg_ParseTuple(args, (char *)"s#izzi:htmlReadMemory", &buffer, &py_buffsize0, &size, &URL, &encoding, &options))
return(NULL);
c_retval = htmlReadMemory(buffer, size, URL, encoding, options);
@@ -913,6 +916,7 @@ libxml_xmlACatalogDump(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
out = (FILE *) PyFile_Get(pyobj_out);
xmlACatalogDump(catal, out);
+ PyFile_Release(out);
Py_INCREF(Py_None);
return(Py_None);
}
@@ -1312,6 +1316,7 @@ libxml_xmlCatalogDump(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
out = (FILE *) PyFile_Get(pyobj_out);
xmlCatalogDump(out);
+ PyFile_Release(out);
Py_INCREF(Py_None);
return(Py_None);
}
@@ -1892,7 +1897,7 @@ libxml_xmlCreateMemoryParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args
int py_buffsize0;
int size;
- if (!PyArg_ParseTuple(args, (char *)"t#i:xmlCreateMemoryParserCtxt", &buffer, &py_buffsize0, &size))
+ if (!PyArg_ParseTuple(args, (char *)"s#i:xmlCreateMemoryParserCtxt", &buffer, &py_buffsize0, &size))
return(NULL);
c_retval = xmlCreateMemoryParserCtxt(buffer, size);
@@ -1997,7 +2002,7 @@ libxml_xmlCtxtReadMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
char * encoding;
int options;
- if (!PyArg_ParseTuple(args, (char *)"Ot#izzi:xmlCtxtReadMemory", &pyobj_ctxt, &buffer, &py_buffsize0, &size, &URL, &encoding, &options))
+ if (!PyArg_ParseTuple(args, (char *)"Os#izzi:xmlCtxtReadMemory", &pyobj_ctxt, &buffer, &py_buffsize0, &size, &URL, &encoding, &options))
return(NULL);
ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
@@ -2032,7 +2037,7 @@ libxml_xmlCtxtResetPush(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
char * filename;
char * encoding;
- if (!PyArg_ParseTuple(args, (char *)"Ot#izz:xmlCtxtResetPush", &pyobj_ctxt, &chunk, &py_buffsize0, &size, &filename, &encoding))
+ if (!PyArg_ParseTuple(args, (char *)"Os#izz:xmlCtxtResetPush", &pyobj_ctxt, &chunk, &py_buffsize0, &size, &filename, &encoding))
return(NULL);
ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
@@ -2074,6 +2079,7 @@ libxml_xmlDebugCheckDocument(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
c_retval = xmlDebugCheckDocument(output, doc);
+ PyFile_Release(output);
py_retval = libxml_intWrap((int) c_retval);
return(py_retval);
}
@@ -2094,6 +2100,7 @@ libxml_xmlDebugDumpAttr(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
attr = (xmlAttrPtr) PyxmlNode_Get(pyobj_attr);
xmlDebugDumpAttr(output, attr, depth);
+ PyFile_Release(output);
Py_INCREF(Py_None);
return(Py_None);
}
@@ -2114,6 +2121,7 @@ libxml_xmlDebugDumpAttrList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
attr = (xmlAttrPtr) PyxmlNode_Get(pyobj_attr);
xmlDebugDumpAttrList(output, attr, depth);
+ PyFile_Release(output);
Py_INCREF(Py_None);
return(Py_None);
}
@@ -2133,6 +2141,7 @@ libxml_xmlDebugDumpDTD(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
dtd = (xmlDtdPtr) PyxmlNode_Get(pyobj_dtd);
xmlDebugDumpDTD(output, dtd);
+ PyFile_Release(output);
Py_INCREF(Py_None);
return(Py_None);
}
@@ -2152,6 +2161,7 @@ libxml_xmlDebugDumpDocument(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
xmlDebugDumpDocument(output, doc);
+ PyFile_Release(output);
Py_INCREF(Py_None);
return(Py_None);
}
@@ -2171,6 +2181,7 @@ libxml_xmlDebugDumpDocumentHead(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
xmlDebugDumpDocumentHead(output, doc);
+ PyFile_Release(output);
Py_INCREF(Py_None);
return(Py_None);
}
@@ -2190,6 +2201,7 @@ libxml_xmlDebugDumpEntities(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc);
xmlDebugDumpEntities(output, doc);
+ PyFile_Release(output);
Py_INCREF(Py_None);
return(Py_None);
}
@@ -2210,6 +2222,7 @@ libxml_xmlDebugDumpNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
xmlDebugDumpNode(output, node, depth);
+ PyFile_Release(output);
Py_INCREF(Py_None);
return(Py_None);
}
@@ -2230,6 +2243,7 @@ libxml_xmlDebugDumpNodeList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
xmlDebugDumpNodeList(output, node, depth);
+ PyFile_Release(output);
Py_INCREF(Py_None);
return(Py_None);
}
@@ -2250,6 +2264,7 @@ libxml_xmlDebugDumpOneNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
xmlDebugDumpOneNode(output, node, depth);
+ PyFile_Release(output);
Py_INCREF(Py_None);
return(Py_None);
}
@@ -2267,6 +2282,7 @@ libxml_xmlDebugDumpString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
output = (FILE *) PyFile_Get(pyobj_output);
xmlDebugDumpString(output, str);
+ PyFile_Release(output);
Py_INCREF(Py_None);
return(Py_None);
}
@@ -2380,6 +2396,7 @@ libxml_xmlDocDump(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur);
c_retval = xmlDocDump(f, cur);
+ PyFile_Release(f);
py_retval = libxml_intWrap((int) c_retval);
return(py_retval);
}
@@ -2402,6 +2419,7 @@ libxml_xmlDocFormatDump(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur);
c_retval = xmlDocFormatDump(f, cur, format);
+ PyFile_Release(f);
py_retval = libxml_intWrap((int) c_retval);
return(py_retval);
}
@@ -2461,6 +2479,7 @@ libxml_xmlElemDump(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur);
xmlElemDump(f, doc, cur);
+ PyFile_Release(f);
Py_INCREF(Py_None);
return(Py_None);
}
@@ -3639,6 +3658,7 @@ libxml_xmlLsOneNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
xmlLsOneNode(output, node);
+ PyFile_Release(output);
Py_INCREF(Py_None);
return(Py_None);
}
@@ -4839,7 +4859,7 @@ libxml_xmlParseChunk(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
int size;
int terminate;
- if (!PyArg_ParseTuple(args, (char *)"Ot#ii:xmlParseChunk", &pyobj_ctxt, &chunk, &py_buffsize0, &size, &terminate))
+ if (!PyArg_ParseTuple(args, (char *)"Os#ii:xmlParseChunk", &pyobj_ctxt, &chunk, &py_buffsize0, &size, &terminate))
return(NULL);
ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt);
@@ -5135,7 +5155,7 @@ libxml_xmlParseMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
int py_buffsize0;
int size;
- if (!PyArg_ParseTuple(args, (char *)"t#i:xmlParseMemory", &buffer, &py_buffsize0, &size))
+ if (!PyArg_ParseTuple(args, (char *)"s#i:xmlParseMemory", &buffer, &py_buffsize0, &size))
return(NULL);
c_retval = xmlParseMemory(buffer, size);
@@ -5731,16 +5751,6 @@ libxml_xmlPopInput(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
return(py_retval);
}
-PyObject *
-libxml_xmlPopInputCallbacks(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) {
- PyObject *py_retval;
- int c_retval;
-
- c_retval = xmlPopInputCallbacks();
- py_retval = libxml_intWrap((int) c_retval);
- return(py_retval);
-}
-
#if defined(LIBXML_TREE_ENABLED)
PyObject *
libxml_xmlPreviousElementSibling(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
@@ -5772,6 +5782,7 @@ libxml_xmlPrintURI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
uri = (xmlURIPtr) PyURI_Get(pyobj_uri);
xmlPrintURI(stream, uri);
+ PyFile_Release(stream);
Py_INCREF(Py_None);
return(Py_None);
}
@@ -5837,7 +5848,7 @@ libxml_xmlReadMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
char * encoding;
int options;
- if (!PyArg_ParseTuple(args, (char *)"t#izzi:xmlReadMemory", &buffer, &py_buffsize0, &size, &URL, &encoding, &options))
+ if (!PyArg_ParseTuple(args, (char *)"s#izzi:xmlReadMemory", &buffer, &py_buffsize0, &size, &URL, &encoding, &options))
return(NULL);
c_retval = xmlReadMemory(buffer, size, URL, encoding, options);
@@ -6110,7 +6121,7 @@ libxml_xmlRecoverMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
int py_buffsize0;
int size;
- if (!PyArg_ParseTuple(args, (char *)"t#i:xmlRecoverMemory", &buffer, &py_buffsize0, &size))
+ if (!PyArg_ParseTuple(args, (char *)"s#i:xmlRecoverMemory", &buffer, &py_buffsize0, &size))
return(NULL);
c_retval = xmlRecoverMemory(buffer, size);
@@ -6202,6 +6213,7 @@ libxml_xmlRegexpPrint(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
regexp = (xmlRegexpPtr) PyxmlReg_Get(pyobj_regexp);
xmlRegexpPrint(output, regexp);
+ PyFile_Release(output);
Py_INCREF(Py_None);
return(Py_None);
}
@@ -6261,6 +6273,7 @@ libxml_xmlRelaxNGDump(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
schema = (xmlRelaxNGPtr) PyrelaxNgSchema_Get(pyobj_schema);
xmlRelaxNGDump(output, schema);
+ PyFile_Release(output);
Py_INCREF(Py_None);
return(Py_None);
}
@@ -6280,6 +6293,7 @@ libxml_xmlRelaxNGDumpTree(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
schema = (xmlRelaxNGPtr) PyrelaxNgSchema_Get(pyobj_schema);
xmlRelaxNGDumpTree(output, schema);
+ PyFile_Release(output);
Py_INCREF(Py_None);
return(Py_None);
}
@@ -6815,6 +6829,7 @@ libxml_xmlSchemaDump(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
schema = (xmlSchemaPtr) PySchema_Get(pyobj_schema);
xmlSchemaDump(output, schema);
+ PyFile_Release(output);
Py_INCREF(Py_None);
return(Py_None);
}
@@ -13930,6 +13945,28 @@ libxml_xmlXPathNextSelf(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
#endif /* defined(LIBXML_XPATH_ENABLED) */
#if defined(LIBXML_XPATH_ENABLED)
PyObject *
+libxml_xmlXPathNodeEval(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ xmlXPathObjectPtr c_retval;
+ xmlNodePtr node;
+ PyObject *pyobj_node;
+ xmlChar * str;
+ xmlXPathContextPtr ctx;
+ PyObject *pyobj_ctx;
+
+ if (!PyArg_ParseTuple(args, (char *)"OzO:xmlXPathNodeEval", &pyobj_node, &str, &pyobj_ctx))
+ return(NULL);
+ node = (xmlNodePtr) PyxmlNode_Get(pyobj_node);
+ ctx = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctx);
+
+ c_retval = xmlXPathNodeEval(node, str, ctx);
+ py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval);
+ return(py_retval);
+}
+
+#endif /* defined(LIBXML_XPATH_ENABLED) */
+#if defined(LIBXML_XPATH_ENABLED)
+PyObject *
libxml_xmlXPathNodeSetFreeNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
xmlNsPtr ns;
PyObject *pyobj_ns;
@@ -14212,6 +14249,8 @@ libxml_xmlXPathRegisterNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
#endif /* defined(LIBXML_XPATH_ENABLED) */
#if defined(LIBXML_XPATH_ENABLED)
+#endif
+#if defined(LIBXML_XPATH_ENABLED)
PyObject *
libxml_xmlXPathRegisteredFuncsCleanup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
xmlXPathContextPtr ctxt;
diff --git a/python/libxml2-py.h b/python/libxml2-py.h
index acc0e05..ab57087 100644
--- a/python/libxml2-py.h
+++ b/python/libxml2-py.h
@@ -650,7 +650,6 @@ PyObject * libxml_xmlParserSetValidate(PyObject *self, PyObject *args);
PyObject * libxml_xmlPathToURI(PyObject *self, PyObject *args);
PyObject * libxml_xmlPedanticParserDefault(PyObject *self, PyObject *args);
PyObject * libxml_xmlPopInput(PyObject *self, PyObject *args);
-PyObject * libxml_xmlPopInputCallbacks(PyObject *self, PyObject *args);
#if defined(LIBXML_TREE_ENABLED)
PyObject * libxml_xmlPreviousElementSibling(PyObject *self, PyObject *args);
#endif /* defined(LIBXML_TREE_ENABLED) */
@@ -1919,6 +1918,9 @@ PyObject * libxml_xmlXPathNextPrecedingSibling(PyObject *self, PyObject *args);
PyObject * libxml_xmlXPathNextSelf(PyObject *self, PyObject *args);
#endif /* defined(LIBXML_XPATH_ENABLED) */
#if defined(LIBXML_XPATH_ENABLED)
+PyObject * libxml_xmlXPathNodeEval(PyObject *self, PyObject *args);
+#endif /* defined(LIBXML_XPATH_ENABLED) */
+#if defined(LIBXML_XPATH_ENABLED)
PyObject * libxml_xmlXPathNodeSetFreeNs(PyObject *self, PyObject *args);
#endif /* defined(LIBXML_XPATH_ENABLED) */
#if defined(LIBXML_XPATH_ENABLED)
@@ -1967,6 +1969,9 @@ PyObject * libxml_xmlXPathRegisterAllFunctions(PyObject *self, PyObject *args);
PyObject * libxml_xmlXPathRegisterNs(PyObject *self, PyObject *args);
#endif /* defined(LIBXML_XPATH_ENABLED) */
#if defined(LIBXML_XPATH_ENABLED)
+PyObject * libxml_xmlXPathRegisterVariable(PyObject *self, PyObject *args);
+#endif
+#if defined(LIBXML_XPATH_ENABLED)
PyObject * libxml_xmlXPathRegisteredFuncsCleanup(PyObject *self, PyObject *args);
#endif /* defined(LIBXML_XPATH_ENABLED) */
#if defined(LIBXML_XPATH_ENABLED)
diff --git a/python/libxml2-python-api.xml b/python/libxml2-python-api.xml
index 42f661d..032b44b 100644
--- a/python/libxml2-python-api.xml
+++ b/python/libxml2-python-api.xml
@@ -10,6 +10,15 @@
<arg name='ns_uri' type='xmlChar *' info='the namespace or NULL'/>
<arg name='f' type='pythonObject' info='the python function'/>
</function>
+ <function name='xmlXPathRegisterVariable' file='python'>
+ <cond>defined(LIBXML_XPATH_ENABLED)</cond>
+ <info>Register a variable with the XPath context</info>
+ <return type='int' info="1 in case of success, 0 or -1 in case of error"/>
+ <arg name='ctx' type='xmlXPathContextPtr' info='the xpathContext'/>
+ <arg name='name' type='xmlChar *' info='the variable name'/>
+ <arg name='ns_uri' type='xmlChar *' info='the namespace or NULL'/>
+ <arg name='value' type='pythonObject' info='the value'/>
+ </function>
<function name='xmlNewNode' file='python'>
<info>Create a new Node</info>
<return type='xmlNodePtr' info="A new element node"/>
diff --git a/python/libxml2.py b/python/libxml2.py
index 086389b..9712d16 100644
--- a/python/libxml2.py
+++ b/python/libxml2.py
@@ -5,13 +5,23 @@ import sys
# The root of all libxml2 errors.
class libxmlError(Exception): pass
+# Type of the wrapper class for the C objects wrappers
+def checkWrapper(obj):
+ try:
+ n = type(_obj).__name__
+ if n != 'PyCObject' and n != 'PyCapsule':
+ return 1
+ except:
+ return 0
+ return 0
+
#
# id() is sometimes negative ...
#
def pos_id(o):
i = id(o)
if (i < 0):
- return (sys.maxint - i)
+ return (sys.maxsize - i)
return i
#
@@ -62,9 +72,20 @@ class ioWrapper:
def io_read(self, len = -1):
if self.__io == None:
return(-1)
- if len < 0:
- return(self.__io.read())
- return(self.__io.read(len))
+ try:
+ if len < 0:
+ ret = self.__io.read()
+ else:
+ ret = self.__io.read(len)
+ except Exception:
+ import sys
+ e = sys.exc_info()[1]
+ print("failed to read from Python:", type(e))
+ print("on IO:", self.__io)
+ self.__io == None
+ return(-1)
+
+ return(ret)
def io_write(self, str, len = -1):
if self.__io == None:
@@ -79,7 +100,7 @@ class ioReadWrapper(ioWrapper):
self._o = libxml2mod.xmlCreateInputBuffer(self, enc)
def __del__(self):
- print "__del__"
+ print("__del__")
self.io_close()
if self._o != None:
libxml2mod.xmlFreeParserInputBuffer(self._o)
@@ -95,12 +116,19 @@ class ioWriteWrapper(ioWrapper):
def __init__(self, _obj, enc = ""):
# print "ioWriteWrapper.__init__", _obj
if type(_obj) == type(''):
- print "write io from a string"
+ print("write io from a string")
self.o = None
- elif type(_obj) == types.InstanceType:
- print "write io from instance of %s" % (_obj.__class__)
- ioWrapper.__init__(self, _obj)
- self._o = libxml2mod.xmlCreateOutputBuffer(self, enc)
+ elif type(_obj).__name__ == 'PyCapsule':
+ file = libxml2mod.outputBufferGetPythonFile(_obj)
+ if file != None:
+ ioWrapper.__init__(self, file)
+ else:
+ ioWrapper.__init__(self, _obj)
+ self._o = _obj
+# elif type(_obj) == types.InstanceType:
+# print(("write io from instance of %s" % (_obj.__class__)))
+# ioWrapper.__init__(self, _obj)
+# self._o = libxml2mod.xmlCreateOutputBuffer(self, enc)
else:
file = libxml2mod.outputBufferGetPythonFile(_obj)
if file != None:
@@ -265,22 +293,22 @@ class xmlCore:
ret = libxml2mod.parent(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
def get_children(self):
ret = libxml2mod.children(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
def get_last(self):
ret = libxml2mod.last(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
def get_next(self):
ret = libxml2mod.next(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
def get_properties(self):
ret = libxml2mod.properties(self._o)
if ret == None:
@@ -290,7 +318,7 @@ class xmlCore:
ret = libxml2mod.prev(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
def get_content(self):
return libxml2mod.xmlNodeGetContent(self._o)
getContent = get_content # why is this duplicate naming needed ?
@@ -317,7 +345,7 @@ class xmlCore:
ret = libxml2mod.parent(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
elif attr == "properties":
ret = libxml2mod.properties(self._o)
if ret == None:
@@ -327,22 +355,22 @@ class xmlCore:
ret = libxml2mod.children(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
elif attr == "last":
ret = libxml2mod.last(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
elif attr == "next":
ret = libxml2mod.next(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
elif attr == "prev":
ret = libxml2mod.prev(self._o)
if ret == None:
return None
- return xmlNode(_obj=ret)
+ return nodeWrap(ret)
elif attr == "content":
return libxml2mod.xmlNodeGetContent(self._o)
elif attr == "name":
@@ -357,7 +385,7 @@ class xmlCore:
else:
return None
return xmlDoc(_obj=ret)
- raise AttributeError,attr
+ raise AttributeError(attr)
else:
parent = property(get_parent, None, None, "Parent node")
children = property(get_children, None, None, "First child node")
@@ -400,7 +428,7 @@ class xmlCore:
prefixes=None,
with_comments=0):
if nodes:
- nodes = map(lambda n: n._o, nodes)
+ nodes = [n._o for n in nodes]
return libxml2mod.xmlC14NDocDumpMemory(
self.get_doc()._o,
nodes,
@@ -414,7 +442,7 @@ class xmlCore:
prefixes=None,
with_comments=0):
if nodes:
- nodes = map(lambda n: n._o, nodes)
+ nodes = [n._o for n in nodes]
return libxml2mod.xmlC14NDocSaveTo(
self.get_doc()._o,
nodes,
@@ -564,10 +592,10 @@ def nodeWrap(o):
def xpathObjectRet(o):
otype = type(o)
if otype == type([]):
- ret = map(xpathObjectRet, o)
+ ret = list(map(xpathObjectRet, o))
return ret
elif otype == type(()):
- ret = map(xpathObjectRet, o)
+ ret = list(map(xpathObjectRet, o))
return tuple(ret)
elif otype == type('') or otype == type(0) or otype == type(0.0):
return o
@@ -603,7 +631,7 @@ def registerErrorHandler(f, ctx):
"""Register a Python written function to for error reporting.
The function is called back as f(ctx, error). """
import sys
- if not sys.modules.has_key('libxslt'):
+ if 'libxslt' not in sys.modules:
# normal behaviour when libxslt is not imported
ret = libxml2mod.xmlRegisterErrorHandler(f,ctx)
else:
@@ -682,8 +710,9 @@ class relaxNgValidCtxtCore:
libxml2mod.xmlRelaxNGSetValidErrors(self._o, err_func, warn_func, arg)
-def _xmlTextReaderErrorFunc((f,arg),msg,severity,locator):
+def _xmlTextReaderErrorFunc(xxx_todo_changeme,msg,severity,locator):
"""Intermediate callback to wrap the locator"""
+ (f,arg) = xxx_todo_changeme
return f(arg,msg,severity,xmlTextReaderLocator(locator))
class xmlTextReaderCore:
@@ -719,11 +748,35 @@ class xmlTextReaderCore:
return arg
#
-# The cleanup now goes though a wrappe in libxml.c
+# The cleanup now goes though a wrapper in libxml.c
#
def cleanupParser():
libxml2mod.xmlPythonCleanupParser()
+#
+# The interface to xmlRegisterInputCallbacks.
+# Since this API does not allow to pass a data object along with
+# match/open callbacks, it is necessary to maintain a list of all
+# Python callbacks.
+#
+__input_callbacks = []
+def registerInputCallback(func):
+ def findOpenCallback(URI):
+ for cb in reversed(__input_callbacks):
+ o = cb(URI)
+ if o is not None:
+ return o
+ libxml2mod.xmlRegisterInputCallback(findOpenCallback)
+ __input_callbacks.append(func)
+
+def popInputCallbacks():
+ # First pop python-level callbacks, when no more available - start
+ # popping built-in ones.
+ if len(__input_callbacks) > 0:
+ __input_callbacks.pop()
+ if len(__input_callbacks) == 0:
+ libxml2mod.xmlUnregisterInputCallback()
+
# WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
#
# Everything before this line comes from libxml.py
@@ -866,6 +919,7 @@ def catalogConvert():
def catalogDump(out):
"""Dump all the global catalog content to the given file. """
+ if out is not None: out.flush()
libxml2mod.xmlCatalogDump(out)
def catalogGetPublic(pubID):
@@ -1025,6 +1079,7 @@ def boolToText(boolval):
def debugDumpString(output, str):
"""Dumps informations about the string, shorten it if necessary """
+ if output is not None: output.flush()
libxml2mod.xmlDebugDumpString(output, str)
def shellPrintXPathError(errorType, arg):
@@ -1042,8 +1097,7 @@ def dictCleanup():
def initializeDict():
"""Do the dictionary mutex initialization. this function is
- not thread safe, initialization should preferably be done
- once at startup """
+ deprecated """
ret = libxml2mod.xmlInitializeDict()
return ret
@@ -1850,12 +1904,6 @@ def parserGetDirectory(filename):
ret = libxml2mod.xmlParserGetDirectory(filename)
return ret
-def popInputCallbacks():
- """Clear the top input callback from the input stack. this
- includes the compiled-in I/O. """
- ret = libxml2mod.xmlPopInputCallbacks()
- return ret
-
def registerDefaultInputCallbacks():
"""Registers the default compiled-in I/O handlers. """
libxml2mod.xmlRegisterDefaultInputCallbacks()
@@ -2966,13 +3014,12 @@ def valuePop(ctxt):
class xmlNode(xmlCore):
def __init__(self, _obj=None):
- if type(_obj).__name__ != 'PyCObject':
- raise TypeError, 'xmlNode needs a PyCObject argument'
+ if checkWrapper(_obj) != 0: raise TypeError('xmlNode got a wrong wrapper object type')
self._o = _obj
xmlCore.__init__(self, _obj=_obj)
def __repr__(self):
- return "<xmlNode (%s) object at 0x%x>" % (self.name, long(pos_id (self)))
+ return "<xmlNode (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
# accessors for xmlNode
def ns(self):
@@ -3671,6 +3718,16 @@ class xmlNode(xmlCore):
ret = libxml2mod.xmlXPathCmpNodes(self._o, node2__o)
return ret
+ def xpathNodeEval(self, str, ctx):
+ """Evaluate the XPath Location Path in the given context. The
+ node 'node' is set as the context node. The context node is
+ not restored. """
+ if ctx is None: ctx__o = None
+ else: ctx__o = ctx._o
+ ret = libxml2mod.xmlXPathNodeEval(self._o, str, ctx__o)
+ if ret is None:raise xpathError('xmlXPathNodeEval() failed')
+ return xpathObjectRet(ret)
+
#
# xmlNode functions from module xpathInternals
#
@@ -3901,13 +3958,12 @@ class xmlNode(xmlCore):
class xmlDoc(xmlNode):
def __init__(self, _obj=None):
- if type(_obj).__name__ != 'PyCObject':
- raise TypeError, 'xmlDoc needs a PyCObject argument'
+ if checkWrapper(_obj) != 0: raise TypeError('xmlDoc got a wrong wrapper object type')
self._o = _obj
xmlNode.__init__(self, _obj=_obj)
def __repr__(self):
- return "<xmlDoc (%s) object at 0x%x>" % (self.name, long(pos_id (self)))
+ return "<xmlDoc (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
#
# xmlDoc functions from module HTMLparser
@@ -5503,13 +5559,12 @@ class parserCtxt(parserCtxtCore):
class xmlAttr(xmlNode):
def __init__(self, _obj=None):
- if type(_obj).__name__ != 'PyCObject':
- raise TypeError, 'xmlAttr needs a PyCObject argument'
+ if checkWrapper(_obj) != 0: raise TypeError('xmlAttr got a wrong wrapper object type')
self._o = _obj
xmlNode.__init__(self, _obj=_obj)
def __repr__(self):
- return "<xmlAttr (%s) object at 0x%x>" % (self.name, long(pos_id (self)))
+ return "<xmlAttr (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
#
# xmlAttr functions from module debugXML
@@ -5582,13 +5637,12 @@ class xmlAttr(xmlNode):
class xmlAttribute(xmlNode):
def __init__(self, _obj=None):
- if type(_obj).__name__ != 'PyCObject':
- raise TypeError, 'xmlAttribute needs a PyCObject argument'
+ if checkWrapper(_obj) != 0: raise TypeError('xmlAttribute got a wrong wrapper object type')
self._o = _obj
xmlNode.__init__(self, _obj=_obj)
def __repr__(self):
- return "<xmlAttribute (%s) object at 0x%x>" % (self.name, long(pos_id (self)))
+ return "<xmlAttribute (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
class catalog:
def __init__(self, _obj=None):
@@ -5652,13 +5706,12 @@ class catalog:
class xmlDtd(xmlNode):
def __init__(self, _obj=None):
- if type(_obj).__name__ != 'PyCObject':
- raise TypeError, 'xmlDtd needs a PyCObject argument'
+ if checkWrapper(_obj) != 0: raise TypeError('xmlDtd got a wrong wrapper object type')
self._o = _obj
xmlNode.__init__(self, _obj=_obj)
def __repr__(self):
- return "<xmlDtd (%s) object at 0x%x>" % (self.name, long(pos_id (self)))
+ return "<xmlDtd (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
#
# xmlDtd functions from module debugXML
@@ -5719,23 +5772,21 @@ class xmlDtd(xmlNode):
class xmlElement(xmlNode):
def __init__(self, _obj=None):
- if type(_obj).__name__ != 'PyCObject':
- raise TypeError, 'xmlElement needs a PyCObject argument'
+ if checkWrapper(_obj) != 0: raise TypeError('xmlElement got a wrong wrapper object type')
self._o = _obj
xmlNode.__init__(self, _obj=_obj)
def __repr__(self):
- return "<xmlElement (%s) object at 0x%x>" % (self.name, long(pos_id (self)))
+ return "<xmlElement (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
class xmlEntity(xmlNode):
def __init__(self, _obj=None):
- if type(_obj).__name__ != 'PyCObject':
- raise TypeError, 'xmlEntity needs a PyCObject argument'
+ if checkWrapper(_obj) != 0: raise TypeError('xmlEntity got a wrong wrapper object type')
self._o = _obj
xmlNode.__init__(self, _obj=_obj)
def __repr__(self):
- return "<xmlEntity (%s) object at 0x%x>" % (self.name, long(pos_id (self)))
+ return "<xmlEntity (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
#
# xmlEntity functions from module parserInternals
@@ -5802,13 +5853,12 @@ class Error:
class xmlNs(xmlNode):
def __init__(self, _obj=None):
- if type(_obj).__name__ != 'PyCObject':
- raise TypeError, 'xmlNs needs a PyCObject argument'
+ if checkWrapper(_obj) != 0: raise TypeError('xmlNs got a wrong wrapper object type')
self._o = _obj
xmlNode.__init__(self, _obj=_obj)
def __repr__(self):
- return "<xmlNs (%s) object at 0x%x>" % (self.name, long(pos_id (self)))
+ return "<xmlNs (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
#
# xmlNs functions from module tree
@@ -7259,6 +7309,11 @@ class xpathContext:
ret = libxml2mod.xmlRegisterXPathFunction(self._o, name, ns_uri, f)
return ret
+ def xpathRegisterVariable(self, name, ns_uri, value):
+ """Register a variable with the XPath context """
+ ret = libxml2mod.xmlXPathRegisterVariable(self._o, name, ns_uri, value)
+ return ret
+
#
# xpathContext functions from module xpath
#
@@ -8165,6 +8220,7 @@ XML_WAR_ENTITY_REDEFINED = 107
XML_ERR_UNKNOWN_VERSION = 108
XML_ERR_VERSION_MISMATCH = 109
XML_ERR_NAME_TOO_LONG = 110
+XML_ERR_USER_STOP = 111
XML_NS_ERR_XML_NAMESPACE = 200
XML_NS_ERR_UNDEFINED_NAMESPACE = 201
XML_NS_ERR_QNAME = 202
diff --git a/python/libxml2class.py b/python/libxml2class.py
index 96e8c3f..48aa7ba 100644
--- a/python/libxml2class.py
+++ b/python/libxml2class.py
@@ -133,6 +133,7 @@ def catalogConvert():
def catalogDump(out):
"""Dump all the global catalog content to the given file. """
+ if out is not None: out.flush()
libxml2mod.xmlCatalogDump(out)
def catalogGetPublic(pubID):
@@ -292,6 +293,7 @@ def boolToText(boolval):
def debugDumpString(output, str):
"""Dumps informations about the string, shorten it if necessary """
+ if output is not None: output.flush()
libxml2mod.xmlDebugDumpString(output, str)
def shellPrintXPathError(errorType, arg):
@@ -309,8 +311,7 @@ def dictCleanup():
def initializeDict():
"""Do the dictionary mutex initialization. this function is
- not thread safe, initialization should preferably be done
- once at startup """
+ deprecated """
ret = libxml2mod.xmlInitializeDict()
return ret
@@ -1117,12 +1118,6 @@ def parserGetDirectory(filename):
ret = libxml2mod.xmlParserGetDirectory(filename)
return ret
-def popInputCallbacks():
- """Clear the top input callback from the input stack. this
- includes the compiled-in I/O. """
- ret = libxml2mod.xmlPopInputCallbacks()
- return ret
-
def registerDefaultInputCallbacks():
"""Registers the default compiled-in I/O handlers. """
libxml2mod.xmlRegisterDefaultInputCallbacks()
@@ -2233,13 +2228,12 @@ def valuePop(ctxt):
class xmlNode(xmlCore):
def __init__(self, _obj=None):
- if type(_obj).__name__ != 'PyCObject':
- raise TypeError, 'xmlNode needs a PyCObject argument'
+ if checkWrapper(_obj) != 0: raise TypeError('xmlNode got a wrong wrapper object type')
self._o = _obj
xmlCore.__init__(self, _obj=_obj)
def __repr__(self):
- return "<xmlNode (%s) object at 0x%x>" % (self.name, long(pos_id (self)))
+ return "<xmlNode (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
# accessors for xmlNode
def ns(self):
@@ -2938,6 +2932,16 @@ class xmlNode(xmlCore):
ret = libxml2mod.xmlXPathCmpNodes(self._o, node2__o)
return ret
+ def xpathNodeEval(self, str, ctx):
+ """Evaluate the XPath Location Path in the given context. The
+ node 'node' is set as the context node. The context node is
+ not restored. """
+ if ctx is None: ctx__o = None
+ else: ctx__o = ctx._o
+ ret = libxml2mod.xmlXPathNodeEval(self._o, str, ctx__o)
+ if ret is None:raise xpathError('xmlXPathNodeEval() failed')
+ return xpathObjectRet(ret)
+
#
# xmlNode functions from module xpathInternals
#
@@ -3168,13 +3172,12 @@ class xmlNode(xmlCore):
class xmlDoc(xmlNode):
def __init__(self, _obj=None):
- if type(_obj).__name__ != 'PyCObject':
- raise TypeError, 'xmlDoc needs a PyCObject argument'
+ if checkWrapper(_obj) != 0: raise TypeError('xmlDoc got a wrong wrapper object type')
self._o = _obj
xmlNode.__init__(self, _obj=_obj)
def __repr__(self):
- return "<xmlDoc (%s) object at 0x%x>" % (self.name, long(pos_id (self)))
+ return "<xmlDoc (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
#
# xmlDoc functions from module HTMLparser
@@ -4770,13 +4773,12 @@ class parserCtxt(parserCtxtCore):
class xmlAttr(xmlNode):
def __init__(self, _obj=None):
- if type(_obj).__name__ != 'PyCObject':
- raise TypeError, 'xmlAttr needs a PyCObject argument'
+ if checkWrapper(_obj) != 0: raise TypeError('xmlAttr got a wrong wrapper object type')
self._o = _obj
xmlNode.__init__(self, _obj=_obj)
def __repr__(self):
- return "<xmlAttr (%s) object at 0x%x>" % (self.name, long(pos_id (self)))
+ return "<xmlAttr (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
#
# xmlAttr functions from module debugXML
@@ -4849,13 +4851,12 @@ class xmlAttr(xmlNode):
class xmlAttribute(xmlNode):
def __init__(self, _obj=None):
- if type(_obj).__name__ != 'PyCObject':
- raise TypeError, 'xmlAttribute needs a PyCObject argument'
+ if checkWrapper(_obj) != 0: raise TypeError('xmlAttribute got a wrong wrapper object type')
self._o = _obj
xmlNode.__init__(self, _obj=_obj)
def __repr__(self):
- return "<xmlAttribute (%s) object at 0x%x>" % (self.name, long(pos_id (self)))
+ return "<xmlAttribute (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
class catalog:
def __init__(self, _obj=None):
@@ -4919,13 +4920,12 @@ class catalog:
class xmlDtd(xmlNode):
def __init__(self, _obj=None):
- if type(_obj).__name__ != 'PyCObject':
- raise TypeError, 'xmlDtd needs a PyCObject argument'
+ if checkWrapper(_obj) != 0: raise TypeError('xmlDtd got a wrong wrapper object type')
self._o = _obj
xmlNode.__init__(self, _obj=_obj)
def __repr__(self):
- return "<xmlDtd (%s) object at 0x%x>" % (self.name, long(pos_id (self)))
+ return "<xmlDtd (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
#
# xmlDtd functions from module debugXML
@@ -4986,23 +4986,21 @@ class xmlDtd(xmlNode):
class xmlElement(xmlNode):
def __init__(self, _obj=None):
- if type(_obj).__name__ != 'PyCObject':
- raise TypeError, 'xmlElement needs a PyCObject argument'
+ if checkWrapper(_obj) != 0: raise TypeError('xmlElement got a wrong wrapper object type')
self._o = _obj
xmlNode.__init__(self, _obj=_obj)
def __repr__(self):
- return "<xmlElement (%s) object at 0x%x>" % (self.name, long(pos_id (self)))
+ return "<xmlElement (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
class xmlEntity(xmlNode):
def __init__(self, _obj=None):
- if type(_obj).__name__ != 'PyCObject':
- raise TypeError, 'xmlEntity needs a PyCObject argument'
+ if checkWrapper(_obj) != 0: raise TypeError('xmlEntity got a wrong wrapper object type')
self._o = _obj
xmlNode.__init__(self, _obj=_obj)
def __repr__(self):
- return "<xmlEntity (%s) object at 0x%x>" % (self.name, long(pos_id (self)))
+ return "<xmlEntity (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
#
# xmlEntity functions from module parserInternals
@@ -5069,13 +5067,12 @@ class Error:
class xmlNs(xmlNode):
def __init__(self, _obj=None):
- if type(_obj).__name__ != 'PyCObject':
- raise TypeError, 'xmlNs needs a PyCObject argument'
+ if checkWrapper(_obj) != 0: raise TypeError('xmlNs got a wrong wrapper object type')
self._o = _obj
xmlNode.__init__(self, _obj=_obj)
def __repr__(self):
- return "<xmlNs (%s) object at 0x%x>" % (self.name, long(pos_id (self)))
+ return "<xmlNs (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
#
# xmlNs functions from module tree
@@ -6526,6 +6523,11 @@ class xpathContext:
ret = libxml2mod.xmlRegisterXPathFunction(self._o, name, ns_uri, f)
return ret
+ def xpathRegisterVariable(self, name, ns_uri, value):
+ """Register a variable with the XPath context """
+ ret = libxml2mod.xmlXPathRegisterVariable(self._o, name, ns_uri, value)
+ return ret
+
#
# xpathContext functions from module xpath
#
@@ -7432,6 +7434,7 @@ XML_WAR_ENTITY_REDEFINED = 107
XML_ERR_UNKNOWN_VERSION = 108
XML_ERR_VERSION_MISMATCH = 109
XML_ERR_NAME_TOO_LONG = 110
+XML_ERR_USER_STOP = 111
XML_NS_ERR_XML_NAMESPACE = 200
XML_NS_ERR_UNDEFINED_NAMESPACE = 201
XML_NS_ERR_QNAME = 202
diff --git a/python/libxml2class.txt b/python/libxml2class.txt
index b16567c..ca88544 100644
--- a/python/libxml2class.txt
+++ b/python/libxml2class.txt
@@ -209,7 +209,6 @@ iOFTPMatch()
iOHTTPMatch()
normalizeWindowsPath()
parserGetDirectory()
-popInputCallbacks()
registerDefaultInputCallbacks()
registerDefaultOutputCallbacks()
registerHTTPPostCallbacks()
@@ -523,6 +522,7 @@ Class xmlNode(xmlCore)
xpathCastNodeToNumber()
xpathCastNodeToString()
xpathCmpNodes()
+ xpathNodeEval()
# functions from module xpathInternals
xpathNewNodeSet()
@@ -1087,6 +1087,7 @@ Class xpathContext()
# functions from module python
registerXPathFunction()
+ xpathRegisterVariable()
# functions from module xpath
xpathContextSetCache()
diff --git a/python/libxml_wrap.h b/python/libxml_wrap.h
index eaa5e96..a9b9739 100644
--- a/python/libxml_wrap.h
+++ b/python/libxml_wrap.h
@@ -23,6 +23,25 @@
#include <libxml/xmlschemas.h>
#endif
+/*
+ * for older versions of Python, we don't use PyBytes, but keep PyString
+ * and don't use Capsule but CObjects
+ */
+#if PY_VERSION_HEX < 0x02070000
+#ifndef PyBytes_Check
+#define PyBytes_Check PyString_Check
+#define PyBytes_Size PyString_Size
+#define PyBytes_AsString PyString_AsString
+#define PyBytes_AS_STRING PyString_AS_STRING
+#define PyBytes_GET_SIZE PyString_GET_SIZE
+
+#define PyCapsule_New PyCObject_FromVoidPtrAndDesc
+#define PyCapsule_CheckExact PyCObject_Check
+#define PyCapsule_GetPointer(o, n) PyCObject_GetDesc((o))
+
+#endif
+#endif
+
/**
* ATTRIBUTE_UNUSED:
*
@@ -150,8 +169,16 @@ typedef struct {
} PyURI_Object;
/* FILE * have their own internal representation */
+#if PY_MAJOR_VERSION >= 3
+FILE *libxml_PyFileGet(PyObject *f);
+void libxml_PyFileRelease(FILE *f);
+#define PyFile_Get(v) (((v) == Py_None) ? NULL : libxml_PyFileGet(v))
+#define PyFile_Release(f) libxml_PyFileRelease(f)
+#else
#define PyFile_Get(v) (((v) == Py_None) ? NULL : \
(PyFile_Check(v) ? (PyFile_AsFile(v)) : stdout))
+#define PyFile_Release(f)
+#endif
#ifdef LIBXML_SCHEMAS_ENABLED
typedef struct {
@@ -247,3 +274,6 @@ PyObject * libxml_xmlSchemaValidCtxtPtrWrap(xmlSchemaValidCtxtPtr valid);
#endif /* LIBXML_SCHEMAS_ENABLED */
PyObject * libxml_xmlErrorPtrWrap(xmlErrorPtr error);
PyObject * libxml_xmlSchemaSetValidErrors(PyObject * self, PyObject * args);
+PyObject * libxml_xmlRegisterInputCallback(PyObject *self, PyObject *args);
+PyObject * libxml_xmlUnregisterInputCallback(PyObject *self, PyObject *args);
+PyObject * libxml_xmlNodeRemoveNsDef(PyObject * self, PyObject * args);
diff --git a/python/setup.py b/python/setup.py
index 7cb8bfc..f24674c 100755
--- a/python/setup.py
+++ b/python/setup.py
@@ -32,7 +32,7 @@ except:
if WITHDLLS:
# libxml dlls (expected in ROOT/bin)
dlls = [ 'iconv.dll','libxml2.dll','libxslt.dll','libexslt.dll' ]
- dlls = map(lambda dll: os.path.join(ROOT,'bin',dll),dlls)
+ dlls = [os.path.join(ROOT,'bin',dll) for dll in dlls]
# create __init__.py for the libxmlmods package
if not os.path.exists("libxmlmods"):
@@ -70,7 +70,7 @@ for dir in includes_dir:
break;
if xml_includes == "":
- print "failed to find headers for libxml2: update includes_dir"
+ print("failed to find headers for libxml2: update includes_dir")
sys.exit(1)
iconv_includes=""
@@ -80,7 +80,7 @@ for dir in includes_dir:
break;
if iconv_includes == "":
- print "failed to find headers for libiconv: update includes_dir"
+ print("failed to find headers for libiconv: update includes_dir")
sys.exit(1)
# those are added in the linker search path for libraries
@@ -103,8 +103,8 @@ if missing("libxml2-py.c") or missing("libxml2.py"):
except:
import generator
except:
- print "failed to find and generate stubs for libxml2, aborting ..."
- print sys.exc_type, sys.exc_value
+ print("failed to find and generate stubs for libxml2, aborting ...")
+ print(sys.exc_info()[0], sys.exc_info()[1])
sys.exit(1)
head = open("libxml.py", "r")
@@ -124,13 +124,13 @@ if missing("libxml2-py.c") or missing("libxml2.py"):
with_xslt=0
if missing("libxslt-py.c") or missing("libxslt.py"):
if missing("xsltgenerator.py") or missing("libxslt-api.xml"):
- print "libxslt stub generator not found, libxslt not built"
+ print("libxslt stub generator not found, libxslt not built")
else:
try:
import xsltgenerator
except:
- print "failed to generate stubs for libxslt, aborting ..."
- print sys.exc_type, sys.exc_value
+ print("failed to generate stubs for libxslt, aborting ...")
+ print(sys.exc_info()[0], sys.exc_info()[1])
else:
head = open("libxsl.py", "r")
generated = open("libxsltclass.py", "r")
@@ -157,7 +157,7 @@ if with_xslt == 1:
break;
if xslt_includes == "":
- print "failed to find headers for libxslt: update includes_dir"
+ print("failed to find headers for libxslt: update includes_dir")
with_xslt = 0
@@ -226,7 +226,7 @@ else:
setup (name = "libxml2-python",
# On *nix, the version number is created from setup.py.in
# On windows, it is set by configure.js
- version = "2.9.0",
+ version = "2.9.1",
description = descr,
author = "Daniel Veillard",
author_email = "veillard@redhat.com",
diff --git a/python/setup.py.in b/python/setup.py.in
index 7eaf530..0e72338 100755
--- a/python/setup.py.in
+++ b/python/setup.py.in
@@ -32,7 +32,7 @@ except:
if WITHDLLS:
# libxml dlls (expected in ROOT/bin)
dlls = [ 'iconv.dll','libxml2.dll','libxslt.dll','libexslt.dll' ]
- dlls = map(lambda dll: os.path.join(ROOT,'bin',dll),dlls)
+ dlls = [os.path.join(ROOT,'bin',dll) for dll in dlls]
# create __init__.py for the libxmlmods package
if not os.path.exists("libxmlmods"):
@@ -70,7 +70,7 @@ for dir in includes_dir:
break;
if xml_includes == "":
- print "failed to find headers for libxml2: update includes_dir"
+ print("failed to find headers for libxml2: update includes_dir")
sys.exit(1)
iconv_includes=""
@@ -80,7 +80,7 @@ for dir in includes_dir:
break;
if iconv_includes == "":
- print "failed to find headers for libiconv: update includes_dir"
+ print("failed to find headers for libiconv: update includes_dir")
sys.exit(1)
# those are added in the linker search path for libraries
@@ -103,8 +103,8 @@ if missing("libxml2-py.c") or missing("libxml2.py"):
except:
import generator
except:
- print "failed to find and generate stubs for libxml2, aborting ..."
- print sys.exc_type, sys.exc_value
+ print("failed to find and generate stubs for libxml2, aborting ...")
+ print(sys.exc_info()[0], sys.exc_info()[1])
sys.exit(1)
head = open("libxml.py", "r")
@@ -124,13 +124,13 @@ if missing("libxml2-py.c") or missing("libxml2.py"):
with_xslt=0
if missing("libxslt-py.c") or missing("libxslt.py"):
if missing("xsltgenerator.py") or missing("libxslt-api.xml"):
- print "libxslt stub generator not found, libxslt not built"
+ print("libxslt stub generator not found, libxslt not built")
else:
try:
import xsltgenerator
except:
- print "failed to generate stubs for libxslt, aborting ..."
- print sys.exc_type, sys.exc_value
+ print("failed to generate stubs for libxslt, aborting ...")
+ print(sys.exc_info()[0], sys.exc_info()[1])
else:
head = open("libxsl.py", "r")
generated = open("libxsltclass.py", "r")
@@ -157,7 +157,7 @@ if with_xslt == 1:
break;
if xslt_includes == "":
- print "failed to find headers for libxslt: update includes_dir"
+ print("failed to find headers for libxslt: update includes_dir")
with_xslt = 0
diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am
index ab079bb..95ebead 100644
--- a/python/tests/Makefile.am
+++ b/python/tests/Makefile.am
@@ -19,6 +19,7 @@ PYTESTS= \
xpath.py \
outbuf.py \
inbuf.py \
+ input_callback.py \
resolver.py \
regexp.py \
reader.py \
diff --git a/python/tests/Makefile.in b/python/tests/Makefile.in
index 699d403..132538f 100644
--- a/python/tests/Makefile.in
+++ b/python/tests/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -16,6 +16,23 @@
@SET_MAKE@
VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -56,6 +73,11 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
SOURCES =
DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -182,7 +204,6 @@ RANLIB = @RANLIB@
RDL_LIBS = @RDL_LIBS@
READER_TEST = @READER_TEST@
RELDATE = @RELDATE@
-RM = @RM@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
@@ -239,6 +260,7 @@ 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@
@@ -332,6 +354,7 @@ PYTESTS = \
xpath.py \
outbuf.py \
inbuf.py \
+ input_callback.py \
resolver.py \
regexp.py \
reader.py \
@@ -410,8 +433,11 @@ clean-libtool:
-rm -rf .libs _libs
install-dist_exampleDATA: $(dist_example_DATA)
@$(NORMAL_INSTALL)
- test -z "$(exampledir)" || $(MKDIR_P) "$(DESTDIR)$(exampledir)"
@list='$(dist_example_DATA)'; test -n "$(exampledir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(exampledir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(exampledir)" || exit 1; \
+ fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
diff --git a/python/tests/attribs.py b/python/tests/attribs.py
index 9331a27..99132c2 100755
--- a/python/tests/attribs.py
+++ b/python/tests/attribs.py
@@ -20,7 +20,7 @@ doc = libxml2.parseDoc(
elem = doc.getRootElement()
attr = elem.hasNsProp('attr', 'http://abc.org')
if attr == None or attr.serialize()[:-1] != """<!ATTLIST test abc:attr CDATA #FIXED "def">""":
- print "Failed to find defaulted attribute abc:attr"
+ print("Failed to find defaulted attribute abc:attr")
sys.exit(1)
doc.freeDoc()
@@ -28,7 +28,7 @@ doc.freeDoc()
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/build.py b/python/tests/build.py
index bfc776c..b2d3f78 100755
--- a/python/tests/build.py
+++ b/python/tests/build.py
@@ -23,29 +23,29 @@ doc = libxml2.parseFile("tmp.xml")
comment = doc.children
if comment.type != "comment" or \
comment.content != "This is a generated document":
- print "error rereading comment"
+ print("error rereading comment")
sys.exit(1)
pi = comment.next
if pi.type != "pi" or pi.name != "test" or pi.content != "PI content":
- print "error rereading PI"
+ print("error rereading PI")
sys.exit(1)
root = pi.next
if root.name != "doc":
- print "error rereading root"
+ print("error rereading root")
sys.exit(1)
ns = root.ns()
if ns.name != "my" or ns.content != "http://example.com/doc":
- print "error rereading namespace"
+ print("error rereading namespace")
sys.exit(1)
elem = root.children
if elem.name != "foo":
- print "error rereading elem"
+ print("error rereading elem")
sys.exit(1)
if elem.getBase(None) != "http://example.com/imgs":
- print "error rereading base"
+ print("error rereading base")
sys.exit(1)
if elem.prop("img") != "image.gif":
- print "error rereading property"
+ print("error rereading property")
sys.exit(1)
doc.freeDoc()
@@ -53,7 +53,7 @@ doc.freeDoc()
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/compareNodes.py b/python/tests/compareNodes.py
index ec04323..ca5a5a2 100755
--- a/python/tests/compareNodes.py
+++ b/python/tests/compareNodes.py
@@ -17,25 +17,25 @@ foonode2 = root.children
# Now check that [in]equality tests work ok
if not ( foonode1 == foonode2 ):
- print "Error comparing nodes with ==, nodes should be equal but are unequal"
+ print("Error comparing nodes with ==, nodes should be equal but are unequal")
sys.exit(1)
if not ( foonode1 != root ):
- print "Error comparing nodes with ==, nodes should not be equal but are equal"
+ print("Error comparing nodes with ==, nodes should not be equal but are equal")
sys.exit(1)
if not ( foonode1 != root ):
- print "Error comparing nodes with !=, nodes should not be equal but are equal"
+ print("Error comparing nodes with !=, nodes should not be equal but are equal")
if ( foonode1 != foonode2 ):
- print "Error comparing nodes with !=, nodes should be equal but are unequal"
+ print("Error comparing nodes with !=, nodes should be equal but are unequal")
# Next check that the hash function for the objects also works ok
if not (hash(foonode1) == hash(foonode2)):
- print "Error hash values for two equal nodes are different"
+ print("Error hash values for two equal nodes are different")
sys.exit(1)
if not (hash(foonode1) != hash(root)):
- print "Error hash values for two unequal nodes are not different"
+ print("Error hash values for two unequal nodes are not different")
sys.exit(1)
if hash(foonode1) == hash(root):
- print "Error hash values for two unequal nodes are equal"
+ print("Error hash values for two unequal nodes are equal")
sys.exit(1)
# Basic tests successful
@@ -44,7 +44,7 @@ doc.freeDoc()
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/ctxterror.py b/python/tests/ctxterror.py
index f2a897a..416e384 100755
--- a/python/tests/ctxterror.py
+++ b/python/tests/ctxterror.py
@@ -23,7 +23,7 @@ s = """<x xmlns="foo"></y>"""
parserCtxt = libxml2.createPushParser(None,"",0,"test.xml")
parserCtxt.setErrorHandler(callback, "-->")
if parserCtxt.getErrorHandler() != (callback,"-->"):
- print "getErrorHandler failed"
+ print("getErrorHandler failed")
sys.exit(1)
parserCtxt.parseChunk(s,len(s),1)
doc = parserCtxt.doc()
@@ -31,9 +31,9 @@ doc.freeDoc()
parserCtxt = None
if err != expect:
- print "error"
- print "received %s" %(err)
- print "expected %s" %(expect)
+ print("error")
+ print("received %s" %(err))
+ print("expected %s" %(expect))
sys.exit(1)
i = 10000
@@ -50,7 +50,7 @@ while i > 0:
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/cutnpaste.py b/python/tests/cutnpaste.py
index 0f9665a..7787246 100755
--- a/python/tests/cutnpaste.py
+++ b/python/tests/cutnpaste.py
@@ -35,14 +35,14 @@ source.freeDoc()
# check the resulting tree
str = dest.serialize()
if str != """<root xmlns:foobar="http://example.org/bar" xmlns:default="http://example.org/include" xmlns:foo="http://example.org/foo"><default:fragment><foo:elem bar="tricky"/></default:fragment></root>""":
- print "reconciliateNs() failed"
+ print("reconciliateNs() failed")
sys.exit(1)
target.freeDoc()
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/dtdvalid.py b/python/tests/dtdvalid.py
index 2011f2c..d4049b8 100755
--- a/python/tests/dtdvalid.py
+++ b/python/tests/dtdvalid.py
@@ -14,7 +14,7 @@ ctxt = libxml2.newValidCtxt()
doc = libxml2.parseDoc(instance)
ret = doc.validateDtd(ctxt, dtd)
if ret != 1:
- print "error doing DTD validation"
+ print("error doing DTD validation")
sys.exit(1)
doc.freeDoc()
@@ -25,8 +25,8 @@ del ctxt
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/error.py b/python/tests/error.py
index da6d0c1..530c2ee 100755
--- a/python/tests/error.py
+++ b/python/tests/error.py
@@ -24,13 +24,13 @@ except libxml2.parserError:
got_exc = 1
if got_exc == 0:
- print "Failed to get a parser exception"
+ print("Failed to get a parser exception")
sys.exit(1)
if err != expect:
- print "error"
- print "received %s" %(err)
- print "expected %s" %(expect)
+ print("error")
+ print("received %s" %(err))
+ print("expected %s" %(expect))
sys.exit(1)
i = 10000
@@ -45,7 +45,7 @@ while i > 0:
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/inbuf.py b/python/tests/inbuf.py
index a7cc7a6..0c16674 100755
--- a/python/tests/inbuf.py
+++ b/python/tests/inbuf.py
@@ -1,14 +1,19 @@
#!/usr/bin/python -u
import sys
import libxml2
-import StringIO
+try:
+ import StringIO
+ str_io = StringIO.StringIO
+except:
+ import io
+ str_io = io.StringIO
# Memory debug specific
libxml2.debugMemory(1)
i = 0
while i < 5000:
- f = StringIO.StringIO("foobar")
+ f = str_io("foobar")
buf = libxml2.inputBuffer(f)
i = i + 1
@@ -18,8 +23,8 @@ del buf
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/indexes.py b/python/tests/indexes.py
index 8d7a7fc..e41a0d9 100755
--- a/python/tests/indexes.py
+++ b/python/tests/indexes.py
@@ -20,16 +20,16 @@ class callback:
def startDocument(self):
global ctxt
if ctxt.byteConsumed() != self.startd:
- print "document start at wrong index: %d expecting %d\n" % (
- ctxt.byteConsumed(), self.startd)
+ print("document start at wrong index: %d expecting %d\n" % (
+ ctxt.byteConsumed(), self.startd))
sys.exit(1)
def endDocument(self):
global ctxt
expect = self.ende + self.delta * (self.count - 1) + self.endd
if ctxt.byteConsumed() != expect:
- print "document end at wrong index: %d expecting %d\n" % (
- ctxt.byteConsumed(), expect)
+ print("document end at wrong index: %d expecting %d\n" % (
+ ctxt.byteConsumed(), expect))
sys.exit(1)
def startElement(self, tag, attrs):
@@ -37,8 +37,8 @@ class callback:
if tag == "bar1":
expect = self.starte + self.delta * self.count
if ctxt.byteConsumed() != expect:
- print "element start at wrong index: %d expecting %d\n" % (
- ctxt.byteConsumed(), expect)
+ print("element start at wrong index: %d expecting %d\n" % (
+ ctxt.byteConsumed(), expect))
sys.exit(1)
@@ -47,8 +47,8 @@ class callback:
if tag == "bar1":
expect = self.ende + self.delta * self.count
if ctxt.byteConsumed() != expect:
- print "element end at wrong index: %d expecting %d\n" % (
- ctxt.byteConsumed(), expect)
+ print("element end at wrong index: %d expecting %d\n" % (
+ ctxt.byteConsumed(), expect))
sys.exit(1)
self.count = self.count + 1
@@ -107,7 +107,7 @@ ctxt=None
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/input_callback.py b/python/tests/input_callback.py
new file mode 100755
index 0000000..495ab62
--- /dev/null
+++ b/python/tests/input_callback.py
@@ -0,0 +1,148 @@
+#!/usr/bin/python -u
+#
+# This tests custom input callbacks
+#
+import sys
+import libxml2
+try:
+ import StringIO
+ str_io = StringIO.StringIO
+except:
+ import io
+ str_io = io.StringIO
+
+# We implement a new scheme, py://strings/ that will reference this dictionary
+pystrings = {
+ 'catalogs/catalog.xml' :
+'''<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+ <rewriteSystem systemIdStartString="http://example.com/dtds/" rewritePrefix="../dtds/"/>
+</catalog>''',
+
+ 'xml/sample.xml' :
+'''<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE root SYSTEM "http://example.com/dtds/sample.dtd">
+<root>&sample.entity;</root>''',
+
+ 'dtds/sample.dtd' :
+'''
+<!ELEMENT root (#PCDATA)>
+<!ENTITY sample.entity "replacement text">'''
+}
+
+prefix = "py://strings/"
+startURL = prefix + "xml/sample.xml"
+catURL = prefix + "catalogs/catalog.xml"
+
+def my_input_cb(URI):
+ if not(URI.startswith(prefix)):
+ return None
+ path = URI[len(prefix):]
+ if path not in pystrings:
+ return None
+ return str_io(pystrings[path])
+
+
+def run_test(desc, docpath, catalog, exp_status="verified", exp_err=[], test_callback=None,
+ root_name="root", root_content="replacement text"):
+ opts = libxml2.XML_PARSE_DTDLOAD | libxml2.XML_PARSE_NONET | libxml2.XML_PARSE_COMPACT
+ actual_err = []
+
+ def my_global_error_cb(ctx, msg):
+ actual_err.append((-1, msg))
+ def my_ctx_error_cb(arg, msg, severity, reserved):
+ actual_err.append((severity, msg))
+
+ libxml2.registerErrorHandler(my_global_error_cb, None)
+ try:
+ parser = libxml2.createURLParserCtxt(docpath, opts)
+ parser.setErrorHandler(my_ctx_error_cb, None)
+ if catalog is not None:
+ parser.addLocalCatalog(catalog)
+ if test_callback is not None:
+ test_callback()
+ parser.parseDocument()
+ doc = parser.doc()
+ actual_status = "loaded"
+ e = doc.getRootElement()
+ if e.name == root_name and e.content == root_content:
+ actual_status = "verified"
+ doc.freeDoc()
+ except libxml2.parserError:
+ actual_status = "not loaded"
+
+ if actual_status != exp_status:
+ print("Test '%s' failed: expect status '%s', actual '%s'" % (desc, exp_status, actual_status))
+ sys.exit(1)
+ elif actual_err != exp_err:
+ print("Test '%s' failed" % desc)
+ print("Expect errors:")
+ for s,m in exp_err: print(" [%2d] '%s'" % (s,m))
+ print("Actual errors:")
+ for s,m in actual_err: print(" [%2d] '%s'" % (s,m))
+ sys.exit(1)
+
+
+# Check that we cannot read custom schema without custom callback
+run_test(desc="Loading entity without custom callback",
+ docpath=startURL, catalog=None,
+ exp_status="not loaded", exp_err=[
+ (-1, "I/O "),
+ (-1, "warning : "),
+ (-1, "failed to load external entity \"py://strings/xml/sample.xml\"\n")
+ ])
+
+# Register handler and try to load the same entity
+libxml2.registerInputCallback(my_input_cb)
+run_test(desc="Loading entity with custom callback",
+ docpath=startURL, catalog=None,
+ exp_status="loaded", exp_err=[
+ (-1, "Attempt to load network entity http://example.com/dtds/sample.dtd"),
+ ( 4, "Entity 'sample.entity' not defined\n")
+ ])
+
+# Register a catalog (also accessible via pystr://) and retry
+run_test(desc="Loading entity with custom callback and catalog",
+ docpath=startURL, catalog=catURL)
+
+# Unregister custom callback when parser is already created
+run_test(desc="Loading entity and unregistering callback",
+ docpath=startURL, catalog=catURL,
+ test_callback=lambda: libxml2.popInputCallbacks(),
+ exp_status="loaded", exp_err=[
+ ( 3, "failed to load external entity \"py://strings/dtds/sample.dtd\"\n"),
+ ( 4, "Entity 'sample.entity' not defined\n")
+ ])
+
+# Try to load the document again
+run_test(desc="Retry loading document after unregistering callback",
+ docpath=startURL, catalog=catURL,
+ exp_status="not loaded", exp_err=[
+ (-1, "I/O "),
+ (-1, "warning : "),
+ (-1, "failed to load external entity \"py://strings/xml/sample.xml\"\n")
+ ])
+
+# But should be able to read standard I/O yet...
+run_test(desc="Loading using standard i/o after unregistering callback",
+ docpath="tst.xml", catalog=None,
+ root_name='doc', root_content='bar')
+
+# Now pop ALL input callbacks, should fail to load even standard I/O
+try:
+ while True:
+ libxml2.popInputCallbacks()
+except IndexError:
+ pass
+
+run_test(desc="Loading using standard i/o after unregistering all callbacks",
+ docpath="tst.xml", catalog=None,
+ exp_status="not loaded", exp_err=[
+ (-1, "I/O "),
+ (-1, "warning : "),
+ (-1, "failed to load external entity \"tst.xml\"\n")
+ ])
+
+print("OK")
+sys.exit(0);
diff --git a/python/tests/nsdel.py b/python/tests/nsdel.py
index c06ded3..079399a 100755
--- a/python/tests/nsdel.py
+++ b/python/tests/nsdel.py
@@ -19,7 +19,7 @@ def checkNamespaceDefs(node, count):
nsList = list(namespaceDefs(node))
#print nsList
if len(nsList) != count :
- raise Exception, "Error: saw %d namespace declarations. Expected %d" % (len(nsList), count)
+ raise Exception("Error: saw %d namespace declarations. Expected %d" % (len(nsList), count))
# Memory debug specific
libxml2.debugMemory(1)
@@ -56,7 +56,7 @@ doc.freeDoc()
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/outbuf.py b/python/tests/outbuf.py
index 09cd9b5..62761cc 100755
--- a/python/tests/outbuf.py
+++ b/python/tests/outbuf.py
@@ -1,17 +1,22 @@
#!/usr/bin/python -u
import sys
import libxml2
-import StringIO
+try:
+ import StringIO
+ str_io = StringIO.StringIO
+except:
+ import io
+ str_io = io.StringIO
def testSimpleBufferWrites():
- f = StringIO.StringIO()
+ f = str_io()
buf = libxml2.createOutputBuffer(f, "ISO-8859-1")
buf.write(3, "foo")
buf.writeString("bar")
buf.close()
-
+
if f.getvalue() != "foobar":
- print "Failed to save to StringIO"
+ print("Failed to save to StringIO")
sys.exit(1)
def testSaveDocToBuffer():
@@ -23,15 +28,15 @@ def testSaveDocToBuffer():
<?xml version="1.0" encoding="UTF-8"?>
<foo>Hello</foo>
'''
- f = StringIO.StringIO()
+ f = str_io()
buf = libxml2.createOutputBuffer(f, 'UTF-8')
doc = libxml2.parseDoc(input)
doc.saveFileTo(buf, 'UTF-8')
doc.freeDoc()
if f.getvalue() != expected:
- print 'xmlDoc.saveFileTo() call failed.'
- print ' got: %s' % repr(f.getvalue())
- print 'expected: %s' % repr(expected)
+ print('xmlDoc.saveFileTo() call failed.')
+ print(' got: %s' % repr(f.getvalue()))
+ print('expected: %s' % repr(expected))
sys.exit(1)
def testSaveFormattedDocToBuffer():
@@ -49,13 +54,13 @@ def testSaveFormattedDocToBuffer():
''')
doc = libxml2.parseDoc(input)
for i in (0, 1):
- f = StringIO.StringIO()
+ f = str_io()
buf = libxml2.createOutputBuffer(f, 'UTF-8')
doc.saveFormatFileTo(buf, 'UTF-8', i)
if f.getvalue() != expected[i]:
- print 'xmlDoc.saveFormatFileTo() call failed.'
- print ' got: %s' % repr(f.getvalue())
- print 'expected: %s' % repr(expected[i])
+ print('xmlDoc.saveFormatFileTo() call failed.')
+ print(' got: %s' % repr(f.getvalue()))
+ print('expected: %s' % repr(expected[i]))
sys.exit(1)
doc.freeDoc()
@@ -69,22 +74,22 @@ def testSaveIntoOutputBuffer():
<?xml version="1.0" encoding="UTF-8"?>
<foo>Hello</foo>
'''
- f = StringIO.StringIO()
+ f = str_io()
doc = libxml2.parseDoc(input)
buf = libxml2.createOutputBuffer(f, 'UTF-8')
buf.saveFileTo(doc, 'UTF-8')
if f.getvalue() != expected:
- print 'outputBuffer.saveFileTo() call failed.'
- print ' got: %s' % repr(f.getvalue())
- print 'expected: %s' % repr(expected)
+ print('outputBuffer.saveFileTo() call failed.')
+ print(' got: %s' % repr(f.getvalue()))
+ print('expected: %s' % repr(expected))
sys.exit(1)
- f = StringIO.StringIO()
+ f = str_io()
buf = libxml2.createOutputBuffer(f, 'UTF-8')
buf.saveFormatFileTo(doc, 'UTF-8', 1)
if f.getvalue() != expected:
- print 'outputBuffer.saveFormatFileTo() call failed.'
- print ' got: %s' % repr(f.getvalue())
- print 'expected: %s' % repr(expected)
+ print('outputBuffer.saveFormatFileTo() call failed.')
+ print(' got: %s' % repr(f.getvalue()))
+ print('expected: %s' % repr(expected))
sys.exit(1)
doc.freeDoc()
@@ -99,7 +104,7 @@ if __name__ == '__main__':
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/push.py b/python/tests/push.py
index 5b60a16..0edd61d 100755
--- a/python/tests/push.py
+++ b/python/tests/push.py
@@ -10,11 +10,11 @@ ctxt.parseChunk("/>", 2, 1)
doc = ctxt.doc()
ctxt=None
if doc.name != "test.xml":
- print "document name error"
+ print("document name error")
sys.exit(1)
root = doc.children
if root.name != "foo":
- print "root element name error"
+ print("root element name error")
sys.exit(1)
doc.freeDoc()
i = 10000
@@ -29,7 +29,7 @@ ctxt=None
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/pushSAX.py b/python/tests/pushSAX.py
index 1c1e786..48f6e82 100755
--- a/python/tests/pushSAX.py
+++ b/python/tests/pushSAX.py
@@ -51,14 +51,14 @@ ctxt=None
reference = "startDocument:startElement foo {'url': 'tst'}:characters: bar:endElement foo:endDocument:"
if log != reference:
- print "Error got: %s" % log
- print "Exprected: %s" % reference
+ print("Error got: %s" % log)
+ print("Exprected: %s" % reference)
sys.exit(1)
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/pushSAXhtml.py b/python/tests/pushSAXhtml.py
index e6e89d9..159d308 100755
--- a/python/tests/pushSAXhtml.py
+++ b/python/tests/pushSAXhtml.py
@@ -52,14 +52,14 @@ ctxt=None
reference = """startDocument:startElement html None:startElement body None:startElement foo {'url': 'tst'}:error: Tag foo invalid
:characters: bar:endElement foo:endElement body:endElement html:endDocument:"""
if log != reference:
- print "Error got: %s" % log
- print "Exprected: %s" % reference
+ print("Error got: %s" % log)
+ print("Exprected: %s" % reference)
sys.exit(1)
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/reader.py b/python/tests/reader.py
index 6c37762..173ce66 100755
--- a/python/tests/reader.py
+++ b/python/tests/reader.py
@@ -4,91 +4,96 @@
# this tests the basic APIs of the XmlTextReader interface
#
import libxml2
-import StringIO
import sys
+try:
+ import StringIO
+ str_io = StringIO.StringIO
+except:
+ import io
+ str_io = io.StringIO
# Memory debug specific
libxml2.debugMemory(1)
-f = StringIO.StringIO("""<a><b b1="b1"/><c>content of c</c></a>""")
+f = str_io("""<a><b b1="b1"/><c>content of c</c></a>""")
input = libxml2.inputBuffer(f)
reader = input.newTextReader("test1")
ret = reader.Read()
if ret != 1:
- print "test1: Error reading to first element"
+ print("test1: Error reading to first element")
sys.exit(1)
if reader.Name() != "a" or reader.IsEmptyElement() != 0 or \
reader.NodeType() != 1 or reader.HasAttributes() != 0:
- print "test1: Error reading the first element"
+ print("test1: Error reading the first element")
sys.exit(1)
ret = reader.Read()
if ret != 1:
- print "test1: Error reading to second element"
+ print("test1: Error reading to second element")
sys.exit(1)
if reader.Name() != "b" or reader.IsEmptyElement() != 1 or \
reader.NodeType() != 1 or reader.HasAttributes() != 1:
- print "test1: Error reading the second element"
+ print("test1: Error reading the second element")
sys.exit(1)
ret = reader.Read()
if ret != 1:
- print "test1: Error reading to third element"
+ print("test1: Error reading to third element")
sys.exit(1)
if reader.Name() != "c" or reader.IsEmptyElement() != 0 or \
reader.NodeType() != 1 or reader.HasAttributes() != 0:
- print "test1: Error reading the third element"
+ print("test1: Error reading the third element")
sys.exit(1)
ret = reader.Read()
if ret != 1:
- print "test1: Error reading to text node"
+ print("test1: Error reading to text node")
sys.exit(1)
if reader.Name() != "#text" or reader.IsEmptyElement() != 0 or \
reader.NodeType() != 3 or reader.HasAttributes() != 0 or \
reader.Value() != "content of c":
- print "test1: Error reading the text node"
+ print("test1: Error reading the text node")
sys.exit(1)
ret = reader.Read()
if ret != 1:
- print "test1: Error reading to end of third element"
+ print("test1: Error reading to end of third element")
sys.exit(1)
if reader.Name() != "c" or reader.IsEmptyElement() != 0 or \
reader.NodeType() != 15 or reader.HasAttributes() != 0:
- print "test1: Error reading the end of third element"
+ print("test1: Error reading the end of third element")
sys.exit(1)
ret = reader.Read()
if ret != 1:
- print "test1: Error reading to end of first element"
+ print("test1: Error reading to end of first element")
sys.exit(1)
if reader.Name() != "a" or reader.IsEmptyElement() != 0 or \
reader.NodeType() != 15 or reader.HasAttributes() != 0:
- print "test1: Error reading the end of first element"
+ print("test1: Error reading the end of first element")
sys.exit(1)
ret = reader.Read()
if ret != 0:
- print "test1: Error reading to end of document"
+ print("test1: Error reading to end of document")
sys.exit(1)
#
# example from the XmlTextReader docs
#
-f = StringIO.StringIO("""<test xmlns:dt="urn:datatypes" dt:type="int"/>""")
+f = str_io("""<test xmlns:dt="urn:datatypes" dt:type="int"/>""")
input = libxml2.inputBuffer(f)
reader = input.newTextReader("test2")
ret = reader.Read()
if ret != 1:
- print "Error reading test element"
+ print("Error reading test element")
sys.exit(1)
if reader.GetAttributeNo(0) != "urn:datatypes" or \
reader.GetAttributeNo(1) != "int" or \
reader.GetAttributeNs("type", "urn:datatypes") != "int" or \
reader.GetAttribute("dt:type") != "int":
- print "error reading test attributes"
+ print("error reading test attributes")
sys.exit(1)
#
# example from the XmlTextReader docs
#
-f = StringIO.StringIO("""<root xmlns:a="urn:456">
+f = str_io("""<root xmlns:a="urn:456">
<item>
<ref href="a:b"/>
</item>
@@ -100,203 +105,203 @@ ret = reader.Read()
while ret == 1:
if reader.Name() == "ref":
if reader.LookupNamespace("a") != "urn:456":
- print "error resolving namespace prefix"
+ print("error resolving namespace prefix")
sys.exit(1)
break
ret = reader.Read()
if ret != 1:
- print "Error finding the ref element"
+ print("Error finding the ref element")
sys.exit(1)
#
# Home made example for the various attribute access functions
#
-f = StringIO.StringIO("""<testattr xmlns="urn:1" xmlns:a="urn:2" b="b" a:b="a:b"/>""")
+f = str_io("""<testattr xmlns="urn:1" xmlns:a="urn:2" b="b" a:b="a:b"/>""")
input = libxml2.inputBuffer(f)
reader = input.newTextReader("test4")
ret = reader.Read()
if ret != 1:
- print "Error reading the testattr element"
+ print("Error reading the testattr element")
sys.exit(1)
#
# Attribute exploration by index
#
if reader.MoveToAttributeNo(0) != 1:
- print "Failed moveToAttribute(0)"
+ print("Failed moveToAttribute(0)")
sys.exit(1)
if reader.Value() != "urn:1":
- print "Failed to read attribute(0)"
+ print("Failed to read attribute(0)")
sys.exit(1)
if reader.Name() != "xmlns":
- print "Failed to read attribute(0) name"
+ print("Failed to read attribute(0) name")
sys.exit(1)
if reader.MoveToAttributeNo(1) != 1:
- print "Failed moveToAttribute(1)"
+ print("Failed moveToAttribute(1)")
sys.exit(1)
if reader.Value() != "urn:2":
- print "Failed to read attribute(1)"
+ print("Failed to read attribute(1)")
sys.exit(1)
if reader.Name() != "xmlns:a":
- print "Failed to read attribute(1) name"
+ print("Failed to read attribute(1) name")
sys.exit(1)
if reader.MoveToAttributeNo(2) != 1:
- print "Failed moveToAttribute(2)"
+ print("Failed moveToAttribute(2)")
sys.exit(1)
if reader.Value() != "b":
- print "Failed to read attribute(2)"
+ print("Failed to read attribute(2)")
sys.exit(1)
if reader.Name() != "b":
- print "Failed to read attribute(2) name"
+ print("Failed to read attribute(2) name")
sys.exit(1)
if reader.MoveToAttributeNo(3) != 1:
- print "Failed moveToAttribute(3)"
+ print("Failed moveToAttribute(3)")
sys.exit(1)
if reader.Value() != "a:b":
- print "Failed to read attribute(3)"
+ print("Failed to read attribute(3)")
sys.exit(1)
if reader.Name() != "a:b":
- print "Failed to read attribute(3) name"
+ print("Failed to read attribute(3) name")
sys.exit(1)
#
# Attribute exploration by name
#
if reader.MoveToAttribute("xmlns") != 1:
- print "Failed moveToAttribute('xmlns')"
+ print("Failed moveToAttribute('xmlns')")
sys.exit(1)
if reader.Value() != "urn:1":
- print "Failed to read attribute('xmlns')"
+ print("Failed to read attribute('xmlns')")
sys.exit(1)
if reader.MoveToAttribute("xmlns:a") != 1:
- print "Failed moveToAttribute('xmlns')"
+ print("Failed moveToAttribute('xmlns')")
sys.exit(1)
if reader.Value() != "urn:2":
- print "Failed to read attribute('xmlns:a')"
+ print("Failed to read attribute('xmlns:a')")
sys.exit(1)
if reader.MoveToAttribute("b") != 1:
- print "Failed moveToAttribute('b')"
+ print("Failed moveToAttribute('b')")
sys.exit(1)
if reader.Value() != "b":
- print "Failed to read attribute('b')"
+ print("Failed to read attribute('b')")
sys.exit(1)
if reader.MoveToAttribute("a:b") != 1:
- print "Failed moveToAttribute('a:b')"
+ print("Failed moveToAttribute('a:b')")
sys.exit(1)
if reader.Value() != "a:b":
- print "Failed to read attribute('a:b')"
+ print("Failed to read attribute('a:b')")
sys.exit(1)
if reader.MoveToAttributeNs("b", "urn:2") != 1:
- print "Failed moveToAttribute('b', 'urn:2')"
+ print("Failed moveToAttribute('b', 'urn:2')")
sys.exit(1)
if reader.Value() != "a:b":
- print "Failed to read attribute('b', 'urn:2')"
+ print("Failed to read attribute('b', 'urn:2')")
sys.exit(1)
#
# Go back and read in sequence
#
if reader.MoveToElement() != 1:
- print "Failed to move back to element"
+ print("Failed to move back to element")
sys.exit(1)
if reader.MoveToFirstAttribute() != 1:
- print "Failed to move to first attribute"
+ print("Failed to move to first attribute")
sys.exit(1)
if reader.Value() != "urn:1":
- print "Failed to read attribute(0)"
+ print("Failed to read attribute(0)")
sys.exit(1)
if reader.Name() != "xmlns":
- print "Failed to read attribute(0) name"
+ print("Failed to read attribute(0) name")
sys.exit(1)
if reader.MoveToNextAttribute() != 1:
- print "Failed to move to next attribute"
+ print("Failed to move to next attribute")
sys.exit(1)
if reader.Value() != "urn:2":
- print "Failed to read attribute(1)"
+ print("Failed to read attribute(1)")
sys.exit(1)
if reader.Name() != "xmlns:a":
- print "Failed to read attribute(1) name"
+ print("Failed to read attribute(1) name")
sys.exit(1)
if reader.MoveToNextAttribute() != 1:
- print "Failed to move to next attribute"
+ print("Failed to move to next attribute")
sys.exit(1)
if reader.Value() != "b":
- print "Failed to read attribute(2)"
+ print("Failed to read attribute(2)")
sys.exit(1)
if reader.Name() != "b":
- print "Failed to read attribute(2) name"
+ print("Failed to read attribute(2) name")
sys.exit(1)
if reader.MoveToNextAttribute() != 1:
- print "Failed to move to next attribute"
+ print("Failed to move to next attribute")
sys.exit(1)
if reader.Value() != "a:b":
- print "Failed to read attribute(3)"
+ print("Failed to read attribute(3)")
sys.exit(1)
if reader.Name() != "a:b":
- print "Failed to read attribute(3) name"
+ print("Failed to read attribute(3) name")
sys.exit(1)
if reader.MoveToNextAttribute() != 0:
- print "Failed to detect last attribute"
+ print("Failed to detect last attribute")
sys.exit(1)
#
# a couple of tests for namespace nodes
#
-f = StringIO.StringIO("""<a xmlns="http://example.com/foo"/>""")
+f = str_io("""<a xmlns="http://example.com/foo"/>""")
input = libxml2.inputBuffer(f)
reader = input.newTextReader("test6")
ret = reader.Read()
if ret != 1:
- print "test6: failed to Read()"
+ print("test6: failed to Read()")
sys.exit(1)
ret = reader.MoveToFirstAttribute()
if ret != 1:
- print "test6: failed to MoveToFirstAttribute()"
+ print("test6: failed to MoveToFirstAttribute()")
sys.exit(1)
if reader.NamespaceUri() != "http://www.w3.org/2000/xmlns/" or \
reader.LocalName() != "xmlns" or reader.Name() != "xmlns" or \
reader.Value() != "http://example.com/foo" or reader.NodeType() != 2:
- print "test6: failed to read the namespace node"
+ print("test6: failed to read the namespace node")
sys.exit(1)
-f = StringIO.StringIO("""<a xmlns:prefix="http://example.com/foo"/>""")
+f = str_io("""<a xmlns:prefix="http://example.com/foo"/>""")
input = libxml2.inputBuffer(f)
reader = input.newTextReader("test7")
ret = reader.Read()
if ret != 1:
- print "test7: failed to Read()"
+ print("test7: failed to Read()")
sys.exit(1)
ret = reader.MoveToFirstAttribute()
if ret != 1:
- print "test7: failed to MoveToFirstAttribute()"
+ print("test7: failed to MoveToFirstAttribute()")
sys.exit(1)
if reader.NamespaceUri() != "http://www.w3.org/2000/xmlns/" or \
reader.LocalName() != "prefix" or reader.Name() != "xmlns:prefix" or \
reader.Value() != "http://example.com/foo" or reader.NodeType() != 2:
- print "test7: failed to read the namespace node"
+ print("test7: failed to read the namespace node")
sys.exit(1)
#
# Test for a limit case:
#
-f = StringIO.StringIO("""<a/>""")
+f = str_io("""<a/>""")
input = libxml2.inputBuffer(f)
reader = input.newTextReader("test8")
ret = reader.Read()
if ret != 1:
- print "test8: failed to read the node"
+ print("test8: failed to read the node")
sys.exit(1)
if reader.Name() != "a" or reader.IsEmptyElement() != 1:
- print "test8: failed to analyze the node"
+ print("test8: failed to analyze the node")
sys.exit(1)
ret = reader.Read()
if ret != 0:
- print "test8: failed to detect the EOF"
+ print("test8: failed to detect the EOF")
sys.exit(1)
#
# Another test provided by Stéphane Bidoul and checked with C#
#
def tst_reader(s):
- f = StringIO.StringIO(s)
+ f = str_io(s)
input = libxml2.inputBuffer(f)
reader = input.newTextReader("tst")
res = ""
@@ -322,8 +327,8 @@ expect="""1 (a) [None] 0 0
"""
res = tst_reader(doc)
if res != expect:
- print "test5 failed"
- print res
+ print("test5 failed")
+ print(res)
sys.exit(1)
doc="""<test><b/><c/></test>"""
@@ -334,8 +339,8 @@ expect="""1 (test) [None] 0 0
"""
res = tst_reader(doc)
if res != expect:
- print "test9 failed"
- print res
+ print("test9 failed")
+ print(res)
sys.exit(1)
doc="""<a><b>bbb</b><c>ccc</c></a>"""
@@ -350,8 +355,8 @@ expect="""1 (a) [None] 0 0
"""
res = tst_reader(doc)
if res != expect:
- print "test10 failed"
- print res
+ print("test10 failed")
+ print(res)
sys.exit(1)
doc="""<test a="a"/>"""
@@ -360,8 +365,8 @@ expect="""1 (test) [None] 1 0
"""
res = tst_reader(doc)
if res != expect:
- print "test11 failed"
- print res
+ print("test11 failed")
+ print(res)
sys.exit(1)
doc="""<test><a>aaa</a><b/></test>"""
@@ -374,8 +379,8 @@ expect="""1 (test) [None] 0 0
"""
res = tst_reader(doc)
if res != expect:
- print "test12 failed"
- print res
+ print("test12 failed")
+ print(res)
sys.exit(1)
doc="""<test><p></p></test>"""
@@ -386,8 +391,8 @@ expect="""1 (test) [None] 0 0
"""
res = tst_reader(doc)
if res != expect:
- print "test13 failed"
- print res
+ print("test13 failed")
+ print(res)
sys.exit(1)
doc="""<p></p>"""
@@ -396,8 +401,8 @@ expect="""1 (p) [None] 0 0
"""
res = tst_reader(doc)
if res != expect:
- print "test14 failed"
- print res
+ print("test14 failed")
+ print(res)
sys.exit(1)
#
@@ -421,8 +426,8 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
"""
res = tst_reader(doc)
if res != expect:
- print "test15 failed"
- print res
+ print("test15 failed")
+ print(res)
sys.exit(1)
#
@@ -435,7 +440,7 @@ del reader
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/reader2.py b/python/tests/reader2.py
index ea890ec..8570575 100755
--- a/python/tests/reader2.py
+++ b/python/tests/reader2.py
@@ -5,8 +5,13 @@
import sys
import glob
import string
-import StringIO
import libxml2
+try:
+ import StringIO
+ str_io = StringIO.StringIO
+except:
+ import io
+ str_io = io.StringIO
# Memory debug specific
libxml2.debugMemory(1)
@@ -30,7 +35,11 @@ libxml2.registerErrorHandler(callback, "")
valid_files = glob.glob("../../test/valid/*.x*")
valid_files.sort()
for file in valid_files:
- if string.find(file, "t8") != -1:
+ if file.find("t8") != -1:
+ continue
+ if file == "../../test/valid/rss.xml":
+ continue
+ if file == "../../test/valid/xlink.xml":
continue
reader = libxml2.newTextReaderFilename(file)
#print "%s:" % (file)
@@ -39,11 +48,11 @@ for file in valid_files:
while ret == 1:
ret = reader.Read()
if ret != 0:
- print "Error parsing and validating %s" % (file)
+ print("Error parsing and validating %s" % (file))
#sys.exit(1)
if err != expect:
- print err
+ print(err)
#
# another separate test based on Stephane Bidoul one
@@ -79,7 +88,7 @@ expect="""10,test
res=""
err=""
-input = libxml2.inputBuffer(StringIO.StringIO(s))
+input = libxml2.inputBuffer(str_io(s))
reader = input.newTextReader("test2")
reader.SetParserProp(libxml2.PARSER_LOADDTD,1)
reader.SetParserProp(libxml2.PARSER_DEFAULTATTRS,1)
@@ -89,12 +98,12 @@ while reader.Read() == 1:
res = res + "%s,%s\n" % (reader.NodeType(),reader.Name())
if res != expect:
- print "test2 failed: unexpected output"
- print res
+ print("test2 failed: unexpected output")
+ print(res)
sys.exit(1)
if err != "":
- print "test2 failed: validation error found"
- print err
+ print("test2 failed: validation error found")
+ print(err)
sys.exit(1)
#
@@ -124,12 +133,12 @@ res=""
def myResolver(URL, ID, ctxt):
if URL == "tst.ent":
- return(StringIO.StringIO(tst_ent))
+ return(str_io(tst_ent))
return None
libxml2.setEntityLoader(myResolver)
-input = libxml2.inputBuffer(StringIO.StringIO(s))
+input = libxml2.inputBuffer(str_io(s))
reader = input.newTextReader("test3")
reader.SetParserProp(libxml2.PARSER_LOADDTD,1)
reader.SetParserProp(libxml2.PARSER_DEFAULTATTRS,1)
@@ -139,12 +148,12 @@ while reader.Read() == 1:
res = res + "%s %s\n" % (reader.NodeType(),reader.Name())
if res != expect:
- print "test3 failed: unexpected output"
- print res
+ print("test3 failed: unexpected output")
+ print(res)
sys.exit(1)
if err != "":
- print "test3 failed: validation error found"
- print err
+ print("test3 failed: validation error found")
+ print(err)
sys.exit(1)
#
@@ -183,7 +192,7 @@ expect="""10 test 0
res=""
err=""
-input = libxml2.inputBuffer(StringIO.StringIO(s))
+input = libxml2.inputBuffer(str_io(s))
reader = input.newTextReader("test4")
reader.SetParserProp(libxml2.PARSER_LOADDTD,1)
reader.SetParserProp(libxml2.PARSER_DEFAULTATTRS,1)
@@ -193,12 +202,12 @@ while reader.Read() == 1:
res = res + "%s %s %d\n" % (reader.NodeType(),reader.Name(),reader.Depth())
if res != expect:
- print "test4 failed: unexpected output"
- print res
+ print("test4 failed: unexpected output")
+ print(res)
sys.exit(1)
if err != "":
- print "test4 failed: validation error found"
- print err
+ print("test4 failed: validation error found")
+ print(err)
sys.exit(1)
#
@@ -228,18 +237,18 @@ expect="""10 test 0
res=""
err=""
-input = libxml2.inputBuffer(StringIO.StringIO(s))
+input = libxml2.inputBuffer(str_io(s))
reader = input.newTextReader("test5")
reader.SetParserProp(libxml2.PARSER_VALIDATE,1)
while reader.Read() == 1:
res = res + "%s %s %d\n" % (reader.NodeType(),reader.Name(),reader.Depth())
if res != expect:
- print "test5 failed: unexpected output"
- print res
+ print("test5 failed: unexpected output")
+ print(res)
if err != "":
- print "test5 failed: validation error found"
- print err
+ print("test5 failed: validation error found")
+ print(err)
#
# cleanup
@@ -250,7 +259,7 @@ del reader
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/reader3.py b/python/tests/reader3.py
index 2458c89..4302b6c 100755
--- a/python/tests/reader3.py
+++ b/python/tests/reader3.py
@@ -3,8 +3,13 @@
# this tests the entities substitutions with the XmlTextReader interface
#
import sys
-import StringIO
import libxml2
+try:
+ import StringIO
+ str_io = StringIO.StringIO
+except:
+ import io
+ str_io = io.StringIO
docstr="""<?xml version='1.0'?>
<!DOCTYPE doc [
@@ -18,90 +23,90 @@ libxml2.debugMemory(1)
#
# First test, normal don't substitute entities.
#
-f = StringIO.StringIO(docstr)
+f = str_io(docstr)
input = libxml2.inputBuffer(f)
reader = input.newTextReader("test_noent")
ret = reader.Read()
if ret != 1:
- print "Error reading to root"
+ print("Error reading to root")
sys.exit(1)
if reader.Name() == "doc" or reader.NodeType() == 10:
ret = reader.Read()
if ret != 1:
- print "Error reading to root"
+ print("Error reading to root")
sys.exit(1)
if reader.Name() != "doc" or reader.NodeType() != 1:
- print "test_normal: Error reading the root element"
+ print("test_normal: Error reading the root element")
sys.exit(1)
ret = reader.Read()
if ret != 1:
- print "test_normal: Error reading to the entity"
+ print("test_normal: Error reading to the entity")
sys.exit(1)
if reader.Name() != "tst" or reader.NodeType() != 5:
- print "test_normal: Error reading the entity"
+ print("test_normal: Error reading the entity")
sys.exit(1)
ret = reader.Read()
if ret != 1:
- print "test_normal: Error reading to the end of root"
+ print("test_normal: Error reading to the end of root")
sys.exit(1)
if reader.Name() != "doc" or reader.NodeType() != 15:
- print "test_normal: Error reading the end of the root element"
+ print("test_normal: Error reading the end of the root element")
sys.exit(1)
ret = reader.Read()
if ret != 0:
- print "test_normal: Error detecting the end"
+ print("test_normal: Error detecting the end")
sys.exit(1)
#
# Second test, completely substitute the entities.
#
-f = StringIO.StringIO(docstr)
+f = str_io(docstr)
input = libxml2.inputBuffer(f)
reader = input.newTextReader("test_noent")
reader.SetParserProp(libxml2.PARSER_SUBST_ENTITIES, 1)
ret = reader.Read()
if ret != 1:
- print "Error reading to root"
+ print("Error reading to root")
sys.exit(1)
if reader.Name() == "doc" or reader.NodeType() == 10:
ret = reader.Read()
if ret != 1:
- print "Error reading to root"
+ print("Error reading to root")
sys.exit(1)
if reader.Name() != "doc" or reader.NodeType() != 1:
- print "test_noent: Error reading the root element"
+ print("test_noent: Error reading the root element")
sys.exit(1)
ret = reader.Read()
if ret != 1:
- print "test_noent: Error reading to the entity content"
+ print("test_noent: Error reading to the entity content")
sys.exit(1)
if reader.Name() != "p" or reader.NodeType() != 1:
- print "test_noent: Error reading the p element from entity"
+ print("test_noent: Error reading the p element from entity")
sys.exit(1)
ret = reader.Read()
if ret != 1:
- print "test_noent: Error reading to the text node"
+ print("test_noent: Error reading to the text node")
sys.exit(1)
if reader.NodeType() != 3 or reader.Value() != "test":
- print "test_noent: Error reading the text node"
+ print("test_noent: Error reading the text node")
sys.exit(1)
ret = reader.Read()
if ret != 1:
- print "test_noent: Error reading to the end of p element"
+ print("test_noent: Error reading to the end of p element")
sys.exit(1)
if reader.Name() != "p" or reader.NodeType() != 15:
- print "test_noent: Error reading the end of the p element"
+ print("test_noent: Error reading the end of the p element")
sys.exit(1)
ret = reader.Read()
if ret != 1:
- print "test_noent: Error reading to the end of root"
+ print("test_noent: Error reading to the end of root")
sys.exit(1)
if reader.Name() != "doc" or reader.NodeType() != 15:
- print "test_noent: Error reading the end of the root element"
+ print("test_noent: Error reading the end of the root element")
sys.exit(1)
ret = reader.Read()
if ret != 0:
- print "test_noent: Error detecting the end"
+ print("test_noent: Error detecting the end")
sys.exit(1)
#
@@ -122,12 +127,12 @@ simplestruct2_ent="""<descr/>"""
def myResolver(URL, ID, ctxt):
if URL == "simplestruct2.ent":
- return(StringIO.StringIO(simplestruct2_ent))
+ return(str_io(simplestruct2_ent))
return None
libxml2.setEntityLoader(myResolver)
-input = libxml2.inputBuffer(StringIO.StringIO(s))
+input = libxml2.inputBuffer(str_io(s))
reader = input.newTextReader("test3")
reader.SetParserProp(libxml2.PARSER_SUBST_ENTITIES,1)
while reader.Read() == 1:
@@ -135,8 +140,8 @@ while reader.Read() == 1:
reader.Depth(),reader.IsEmptyElement())
if res != expect:
- print "test3 failed: unexpected output"
- print res
+ print("test3 failed: unexpected output")
+ print(res)
sys.exit(1)
#
@@ -149,7 +154,7 @@ del reader
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/reader4.py b/python/tests/reader4.py
index 0824929..0bb3e3f 100755
--- a/python/tests/reader4.py
+++ b/python/tests/reader4.py
@@ -3,14 +3,19 @@
# this tests the basic APIs of the XmlTextReader interface
#
import libxml2
-import StringIO
import sys
+try:
+ import StringIO
+ str_io = StringIO.StringIO
+except:
+ import io
+ str_io = io.StringIO
# Memory debug specific
libxml2.debugMemory(1)
def tst_reader(s):
- f = StringIO.StringIO(s)
+ f = str_io(s)
input = libxml2.inputBuffer(f)
reader = input.newTextReader("tst")
res = ""
@@ -32,14 +37,14 @@ expect="""1 (test) [None] 0
res = tst_reader("""<test><b/><c/></test>""")
if res != expect:
- print "Did not get the expected error message:"
- print res
+ print("Did not get the expected error message:")
+ print(res)
sys.exit(1)
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/reader5.py b/python/tests/reader5.py
index fcbad61..82d0dae 100755
--- a/python/tests/reader5.py
+++ b/python/tests/reader5.py
@@ -4,7 +4,6 @@
# this extract the Dragon bibliography entries from the XML specification
#
import libxml2
-import StringIO
import sys
# Memory debug specific
@@ -15,11 +14,11 @@ Ravi Sethi, and Jeffrey D. Ullman.
<emph>Compilers: Principles, Techniques, and Tools</emph>.
Reading: Addison-Wesley, 1986, rpt. corr. 1988.</bibl>"""
-f = open('../../test/valid/REC-xml-19980210.xml')
+f = open('../../test/valid/REC-xml-19980210.xml', 'rb')
input = libxml2.inputBuffer(f)
reader = input.newTextReader("REC")
res=""
-while reader.Read():
+while reader.Read() > 0:
while reader.Name() == 'bibl':
node = reader.Expand() # expand the subtree
if node.xpathEval("@id = 'Aho'"): # use XPath on it
@@ -28,9 +27,9 @@ while reader.Read():
break;
if res != expect:
- print "Error: didn't get the expected output"
- print "got '%s'" % (res)
- print "expected '%s'" % (expect)
+ print("Error: didn't get the expected output")
+ print("got '%s'" % (res))
+ print("expected '%s'" % (expect))
#
@@ -42,7 +41,7 @@ del reader
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/reader6.py b/python/tests/reader6.py
index 7a34601..ef33b18 100755
--- a/python/tests/reader6.py
+++ b/python/tests/reader6.py
@@ -3,8 +3,13 @@
# this tests the entities substitutions with the XmlTextReader interface
#
import sys
-import StringIO
import libxml2
+try:
+ import StringIO
+ str_io = StringIO.StringIO
+except:
+ import io
+ str_io = io.StringIO
schema="""<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
@@ -41,7 +46,7 @@ docstr="""<foo>
<item>100</item>
</foo>"""
-f = StringIO.StringIO(docstr)
+f = str_io(docstr)
input = libxml2.inputBuffer(f)
reader = input.newTextReader("correct")
reader.RelaxNGSetSchema(rngs)
@@ -50,11 +55,11 @@ while ret == 1:
ret = reader.Read()
if ret != 0:
- print "Error parsing the document"
+ print("Error parsing the document")
sys.exit(1)
if reader.IsValid() != 1:
- print "Document failed to validate"
+ print("Document failed to validate")
sys.exit(1)
#
@@ -84,7 +89,7 @@ def callback(ctx, str):
err = err + "%s" % (str)
libxml2.registerErrorHandler(callback, "")
-f = StringIO.StringIO(docstr)
+f = str_io(docstr)
input = libxml2.inputBuffer(f)
reader = input.newTextReader("error")
reader.RelaxNGSetSchema(rngs)
@@ -93,16 +98,16 @@ while ret == 1:
ret = reader.Read()
if ret != 0:
- print "Error parsing the document"
+ print("Error parsing the document")
sys.exit(1)
if reader.IsValid() != 0:
- print "Document failed to detect the validation error"
+ print("Document failed to detect the validation error")
sys.exit(1)
if err != expect:
- print "Did not get the expected error message:"
- print err
+ print("Did not get the expected error message:")
+ print(err)
sys.exit(1)
#
@@ -117,7 +122,7 @@ libxml2.relaxNGCleanupTypes()
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/reader7.py b/python/tests/reader7.py
index 35a426f..c88e370 100755
--- a/python/tests/reader7.py
+++ b/python/tests/reader7.py
@@ -3,7 +3,6 @@
# this tests the entities substitutions with the XmlTextReader interface
#
import sys
-import StringIO
import libxml2
# Memory debug specific
@@ -44,12 +43,12 @@ while ret == 1:
ret = reader.Read()
if ret != 0:
- print "Error parsing the document test1"
+ print("Error parsing the document test1")
sys.exit(1)
if result != expect:
- print "Unexpected result for test1"
- print result
+ print("Unexpected result for test1")
+ print(result)
sys.exit(1)
#
@@ -80,12 +79,12 @@ while ret == 1:
ret = reader.Read()
if ret != 0:
- print "Error parsing the document test2"
+ print("Error parsing the document test2")
sys.exit(1)
if result != expect:
- print "Unexpected result for test2"
- print result
+ print("Unexpected result for test2")
+ print(result)
sys.exit(1)
#
@@ -96,7 +95,7 @@ del reader
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/reader8.py b/python/tests/reader8.py
index 53b7f27..de2dcd6 100755
--- a/python/tests/reader8.py
+++ b/python/tests/reader8.py
@@ -3,7 +3,6 @@
# this tests the entities substitutions with the XmlTextReader interface
#
import sys
-import StringIO
import libxml2
# Memory debug specific
@@ -23,7 +22,7 @@ ret = reader.Read()
ret = reader.Close()
if ret != 0:
- print "Error closing the document test1"
+ print("Error closing the document test1")
sys.exit(1)
del reader
@@ -31,7 +30,7 @@ del reader
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/readererr.py b/python/tests/readererr.py
index 0dad36e..c8ceba5 100644..100755
--- a/python/tests/readererr.py
+++ b/python/tests/readererr.py
@@ -3,8 +3,13 @@
# this tests the basic APIs of the XmlTextReader interface
#
import libxml2
-import StringIO
import sys
+try:
+ import StringIO
+ str_io = StringIO.StringIO
+except:
+ import io
+ str_io = io.StringIO
# Memory debug specific
libxml2.debugMemory(1)
@@ -17,7 +22,7 @@ def myErrorHandler(arg,msg,severity,locator):
global err
err = err + "%s (%d) %s:%d:%s" % (arg,severity,locator.BaseURI(),locator.LineNumber(),msg)
-f = StringIO.StringIO("""<a xmlns="foo"><b b1="b1"/><c>content of c</a>""")
+f = str_io("""<a xmlns="foo"><b b1="b1"/><c>content of c</a>""")
input = libxml2.inputBuffer(f)
reader = input.newTextReader("test1")
reader.SetErrorHandler(myErrorHandler,"-->")
@@ -25,14 +30,14 @@ while reader.Read() == 1:
pass
if err != expect:
- print "error"
- print "received %s" %(err)
- print "expected %s" %(expect)
+ print("error")
+ print("received %s" %(err))
+ print("expected %s" %(expect))
sys.exit(1)
reader.SetErrorHandler(None,None)
if reader.GetErrorHandler() != (None,None):
- print "GetErrorHandler failed"
+ print("GetErrorHandler failed")
sys.exit(1)
#
@@ -45,7 +50,7 @@ del reader
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/readernext.py b/python/tests/readernext.py
index b01a49d..fcb9ae3 100755
--- a/python/tests/readernext.py
+++ b/python/tests/readernext.py
@@ -4,65 +4,70 @@
# this tests the next API of the XmlTextReader interface
#
import libxml2
-import StringIO
import sys
+try:
+ import StringIO
+ str_io = StringIO.StringIO
+except:
+ import io
+ str_io = io.StringIO
# Memory debug specific
libxml2.debugMemory(1)
-f = StringIO.StringIO("""<a><b><c /></b><d>content of d</d></a>""")
+f = str_io("""<a><b><c /></b><d>content of d</d></a>""")
input = libxml2.inputBuffer(f)
reader = input.newTextReader("test_next")
ret = reader.Read()
if ret != 1:
- print "test_next: Error reading to first element"
+ print("test_next: Error reading to first element")
sys.exit(1)
if reader.Name() != "a" or reader.IsEmptyElement() != 0 or \
reader.NodeType() != 1 or reader.HasAttributes() != 0:
- print "test_next: Error reading the first element"
+ print("test_next: Error reading the first element")
sys.exit(1)
ret = reader.Read()
if ret != 1:
- print "test_next: Error reading to second element"
+ print("test_next: Error reading to second element")
sys.exit(1)
if reader.Name() != "b" or reader.IsEmptyElement() != 0 or \
reader.NodeType() != 1 or reader.HasAttributes() != 0:
- print "test_next: Error reading the second element"
+ print("test_next: Error reading the second element")
sys.exit(1)
ret = reader.Read()
if ret != 1:
- print "test_next: Error reading to third element"
+ print("test_next: Error reading to third element")
sys.exit(1)
if reader.Name() != "c" or reader.NodeType() != 1 or \
reader.HasAttributes() != 0:
- print "test_next: Error reading the third element"
+ print("test_next: Error reading the third element")
sys.exit(1)
ret = reader.Read()
if ret != 1:
- print "test_next: Error reading to end of third element"
+ print("test_next: Error reading to end of third element")
sys.exit(1)
if reader.Name() != "b" or reader.NodeType() != 15:
- print "test_next: Error reading to end of second element"
+ print("test_next: Error reading to end of second element")
sys.exit(1)
ret = reader.Next()
if ret != 1:
- print "test_next: Error moving to third element"
+ print("test_next: Error moving to third element")
sys.exit(1)
if reader.Name() != "d" or reader.IsEmptyElement() != 0 or \
reader.NodeType() != 1 or reader.HasAttributes() != 0:
- print "test_next: Error reading third element"
+ print("test_next: Error reading third element")
sys.exit(1)
ret = reader.Next()
if ret != 1:
- print "test_next: Error reading to end of first element"
+ print("test_next: Error reading to end of first element")
sys.exit(1)
if reader.Name() != "a" or reader.IsEmptyElement() != 0 or \
reader.NodeType() != 15 or reader.HasAttributes() != 0:
- print "test_next: Error reading the end of first element"
+ print("test_next: Error reading the end of first element")
sys.exit(1)
ret = reader.Read()
if ret != 0:
- print "test_next: Error reading to end of document"
+ print("test_next: Error reading to end of document")
sys.exit(1)
#
@@ -75,7 +80,7 @@ del reader
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/regexp.py b/python/tests/regexp.py
index 4c05502..a03e459 100644..100755
--- a/python/tests/regexp.py
+++ b/python/tests/regexp.py
@@ -6,19 +6,19 @@ libxml2.debugMemory(1)
re = libxml2.regexpCompile("a|b")
if re.regexpExec("a") != 1:
- print "error checking 'a'"
+ print("error checking 'a'")
sys.exit(1)
if re.regexpExec("b") != 1:
- print "error checking 'b'"
+ print("error checking 'b'")
sys.exit(1)
if re.regexpExec("ab") != 0:
- print "error checking 'ab'"
+ print("error checking 'ab'")
sys.exit(1)
if re.regexpExec("") != 0:
- print "error checking 'ab'"
+ print("error checking 'ab'")
sys.exit(1)
if re.regexpIsDeterminist() != 1:
- print "error checking determinism"
+ print("error checking determinism")
sys.exit(1)
del re
@@ -26,7 +26,7 @@ del re
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/relaxng.py b/python/tests/relaxng.py
index 2c83635..fa3d327 100755
--- a/python/tests/relaxng.py
+++ b/python/tests/relaxng.py
@@ -29,7 +29,7 @@ ctxt = rngs.relaxNGNewValidCtxt()
doc = libxml2.parseDoc(instance)
ret = doc.relaxNGValidateDoc(ctxt)
if ret != 0:
- print "error doing RelaxNG validation"
+ print("error doing RelaxNG validation")
sys.exit(1)
doc.freeDoc()
@@ -41,8 +41,8 @@ libxml2.relaxNGCleanupTypes()
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/resolver.py b/python/tests/resolver.py
index 9f4a478..6f21f52 100755
--- a/python/tests/resolver.py
+++ b/python/tests/resolver.py
@@ -1,20 +1,25 @@
#!/usr/bin/python -u
import sys
import libxml2
-import StringIO
+try:
+ import StringIO
+ str_io = StringIO.StringIO
+except:
+ import io
+ str_io = io.StringIO
# Memory debug specific
libxml2.debugMemory(1)
def myResolver(URL, ID, ctxt):
- return(StringIO.StringIO("<foo/>"))
+ return(str_io("<foo/>"))
libxml2.setEntityLoader(myResolver)
doc = libxml2.parseFile("doesnotexist.xml")
root = doc.children
if root.name != "foo":
- print "root element name error"
+ print("root element name error")
sys.exit(1)
doc.freeDoc()
@@ -23,7 +28,7 @@ while i < 5000:
doc = libxml2.parseFile("doesnotexist.xml")
root = doc.children
if root.name != "foo":
- print "root element name error"
+ print("root element name error")
sys.exit(1)
doc.freeDoc()
i = i + 1
@@ -32,8 +37,8 @@ while i < 5000:
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/schema.py b/python/tests/schema.py
index bfa8423..8089272 100755
--- a/python/tests/schema.py
+++ b/python/tests/schema.py
@@ -33,7 +33,7 @@ ctxt_valid = ctxt_schema.schemaNewValidCtxt()
doc = libxml2.parseDoc(instance)
ret = doc.schemaValidateDoc(ctxt_valid)
if ret != 0:
- print "error doing schema validation"
+ print("error doing schema validation")
sys.exit(1)
doc.freeDoc()
@@ -45,8 +45,8 @@ libxml2.schemaCleanupTypes()
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/serialize.py b/python/tests/serialize.py
index 91753e7..80b901a 100755
--- a/python/tests/serialize.py
+++ b/python/tests/serialize.py
@@ -13,13 +13,13 @@ str = doc.serialize()
if str != """<?xml version="1.0"?>
<root><foo>hello</foo></root>
""":
- print "error serializing XML document 1"
+ print("error serializing XML document 1")
sys.exit(1)
str = doc.serialize("iso-8859-1")
if str != """<?xml version="1.0" encoding="iso-8859-1"?>
<root><foo>hello</foo></root>
""":
- print "error serializing XML document 2"
+ print("error serializing XML document 2")
sys.exit(1)
str = doc.serialize(format=1)
if str != """<?xml version="1.0"?>
@@ -27,7 +27,7 @@ if str != """<?xml version="1.0"?>
<foo>hello</foo>
</root>
""":
- print "error serializing XML document 3"
+ print("error serializing XML document 3")
sys.exit(1)
str = doc.serialize("iso-8859-1", 1)
if str != """<?xml version="1.0" encoding="iso-8859-1"?>
@@ -35,7 +35,7 @@ if str != """<?xml version="1.0" encoding="iso-8859-1"?>
<foo>hello</foo>
</root>
""":
- print "error serializing XML document 4"
+ print("error serializing XML document 4")
sys.exit(1)
#
@@ -44,23 +44,23 @@ if str != """<?xml version="1.0" encoding="iso-8859-1"?>
root = doc.getRootElement()
str = root.serialize()
if str != """<root><foo>hello</foo></root>""":
- print "error serializing XML root 1"
+ print("error serializing XML root 1")
sys.exit(1)
str = root.serialize("iso-8859-1")
if str != """<root><foo>hello</foo></root>""":
- print "error serializing XML root 2"
+ print("error serializing XML root 2")
sys.exit(1)
str = root.serialize(format=1)
if str != """<root>
<foo>hello</foo>
</root>""":
- print "error serializing XML root 3"
+ print("error serializing XML root 3")
sys.exit(1)
str = root.serialize("iso-8859-1", 1)
if str != """<root>
<foo>hello</foo>
</root>""":
- print "error serializing XML root 4"
+ print("error serializing XML root 4")
sys.exit(1)
doc.freeDoc()
@@ -72,13 +72,13 @@ str = doc.serialize()
if str != """<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><head><title>Hello</title></head><body><p>hello</p></body></html>
""":
- print "error serializing HTML document 1"
+ print("error serializing HTML document 1")
sys.exit(1)
str = doc.serialize("ISO-8859-1")
if str != """<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Hello</title></head><body><p>hello</p></body></html>
""":
- print "error serializing HTML document 2"
+ print("error serializing HTML document 2")
sys.exit(1)
str = doc.serialize(format=1)
if str != """<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
@@ -90,7 +90,7 @@ if str != """<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http
<body><p>hello</p></body>
</html>
""":
- print "error serializing HTML document 3"
+ print("error serializing HTML document 3")
sys.exit(1)
str = doc.serialize("iso-8859-1", 1)
if str != """<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
@@ -102,7 +102,7 @@ if str != """<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http
<body><p>hello</p></body>
</html>
""":
- print "error serializing HTML document 4"
+ print("error serializing HTML document 4")
sys.exit(1)
#
@@ -112,11 +112,11 @@ doc.htmlSetMetaEncoding(None)
root = doc.getRootElement()
str = root.serialize()
if str != """<html><head><title>Hello</title></head><body><p>hello</p></body></html>""":
- print "error serializing HTML root 1"
+ print("error serializing HTML root 1")
sys.exit(1)
str = root.serialize("ISO-8859-1")
if str != """<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Hello</title></head><body><p>hello</p></body></html>""":
- print "error serializing HTML root 2"
+ print("error serializing HTML root 2")
sys.exit(1)
str = root.serialize(format=1)
if str != """<html>
@@ -126,7 +126,7 @@ if str != """<html>
</head>
<body><p>hello</p></body>
</html>""":
- print "error serializing HTML root 3"
+ print("error serializing HTML root 3")
sys.exit(1)
str = root.serialize("iso-8859-1", 1)
if str != """<html>
@@ -136,7 +136,7 @@ if str != """<html>
</head>
<body><p>hello</p></body>
</html>""":
- print "error serializing HTML root 4"
+ print("error serializing HTML root 4")
sys.exit(1)
doc.freeDoc()
@@ -144,7 +144,7 @@ doc.freeDoc()
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/sync.py b/python/tests/sync.py
index 2141875..9d565db 100755
--- a/python/tests/sync.py
+++ b/python/tests/sync.py
@@ -50,8 +50,8 @@ ctxt=None
reference = "startDocument:startElement foo None:startElement bar2 None:endElement bar2:"
if log != reference:
- print "Error got: %s" % log
- print "Exprected: %s" % reference
+ print("Error got: %s" % log)
+ print("Exprected: %s" % reference)
sys.exit(1)
log=""
@@ -62,8 +62,8 @@ ctxt=None
reference = "startDocument:startElement foo None:startElement bar2 None:endElement bar2:"
if log != reference:
- print "Error got: %s" % log
- print "Exprected: %s" % reference
+ print("Error got: %s" % log)
+ print("Exprected: %s" % reference)
sys.exit(1)
log=""
@@ -74,8 +74,8 @@ ctxt=None
reference = "startDocument:startElement foo None:startElement bar2 None:"
if log != reference:
- print "Error got: %s" % log
- print "Exprected: %s" % reference
+ print("Error got: %s" % log)
+ print("Exprected: %s" % reference)
sys.exit(1)
log=""
@@ -86,8 +86,8 @@ ctxt=None
reference = "startDocument:startElement foo None:startElement bar2 {'a': '1', 'b': '2'}:endElement bar2:"
if log != reference:
- print "Error got: %s" % log
- print "Exprected: %s" % reference
+ print("Error got: %s" % log)
+ print("Exprected: %s" % reference)
sys.exit(1)
log=""
@@ -98,8 +98,8 @@ ctxt=None
reference = "startDocument:startElement foo None:startElement bar2 {'a': '1', 'b': '2'}:"
if log != reference:
- print "Error got: %s" % log
- print "Exprected: %s" % reference
+ print("Error got: %s" % log)
+ print("Exprected: %s" % reference)
sys.exit(1)
log=""
@@ -110,8 +110,8 @@ ctxt=None
reference = "startDocument:startElement foo None:startElement bar2 {'a': '1', 'b': '2'}:endElement bar2:"
if log != reference:
- print "Error got: %s" % log
- print "Exprected: %s" % reference
+ print("Error got: %s" % log)
+ print("Exprected: %s" % reference)
sys.exit(1)
log=""
@@ -122,14 +122,14 @@ ctxt=None
reference = "startDocument:startElement foo None:"
if log != reference:
- print "Error got: %s" % log
- print "Exprected: %s" % reference
+ print("Error got: %s" % log)
+ print("Exprected: %s" % reference)
sys.exit(1)
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/thread2.py b/python/tests/thread2.py
index c8ac5ed..2749eb0 100755
--- a/python/tests/thread2.py
+++ b/python/tests/thread2.py
@@ -1,6 +1,9 @@
#!/usr/bin/python -u
import string, sys, time
-import thread
+try:
+ from _thread import get_ident
+except:
+ from thread import get_ident
from threading import Thread, Lock
import libxml2
@@ -31,8 +34,8 @@ def test(expectedLineNumbersDefault):
# check a per thread-global
if expectedLineNumbersDefault != getLineNumbersDefault():
failed = 1
- print "FAILED to obtain correct value for " \
- "lineNumbersDefault in thread %d" % thread.get_ident()
+ print("FAILED to obtain correct value for " \
+ "lineNumbersDefault in thread %d" % get_ident())
# check ther global error handler
# (which is NOT per-thread in the python bindings)
try:
@@ -51,7 +54,7 @@ libxml2.lineNumbersDefault(1)
test(1)
ec = len(eh.errors)
if ec == 0:
- print "FAILED: should have obtained errors"
+ print("FAILED: should have obtained errors")
sys.exit(1)
ts = []
@@ -65,7 +68,7 @@ for t in ts:
t.join()
if len(eh.errors) != ec+THREADS_COUNT*ec:
- print "FAILED: did not obtain the correct number of errors"
+ print("FAILED: did not obtain the correct number of errors")
sys.exit(1)
# set lineNumbersDefault for future new threads
@@ -80,17 +83,17 @@ for t in ts:
t.join()
if len(eh.errors) != ec+THREADS_COUNT*ec*2:
- print "FAILED: did not obtain the correct number of errors"
+ print("FAILED: did not obtain the correct number of errors")
sys.exit(1)
if failed:
- print "FAILED"
+ print("FAILED")
sys.exit(1)
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/tst.py b/python/tests/tst.py
index 9540cda..57a7318 100755
--- a/python/tests/tst.py
+++ b/python/tests/tst.py
@@ -7,22 +7,22 @@ libxml2.debugMemory(1)
doc = libxml2.parseFile("tst.xml")
if doc.name != "tst.xml":
- print "doc.name failed"
+ print("doc.name failed")
sys.exit(1)
root = doc.children
if root.name != "doc":
- print "root.name failed"
+ print("root.name failed")
sys.exit(1)
child = root.children
if child.name != "foo":
- print "child.name failed"
+ print("child.name failed")
sys.exit(1)
doc.freeDoc()
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/tstLastError.py b/python/tests/tstLastError.py
index d26e82c..d5f9be7 100755
--- a/python/tests/tstLastError.py
+++ b/python/tests/tstLastError.py
@@ -17,8 +17,8 @@ class TestCase(unittest.TestCase):
if libxml2.debugMemory(1) != 0:
libxml2.dumpMemory()
self.fail("Memory leak %d bytes" % (libxml2.debugMemory(1),))
- else:
- print "OK"
+ else:
+ print("OK")
def failUnlessXmlError(self,f,args,exc,domain,code,message,level,file,line):
"""Run function f, with arguments args and expect an exception exc;
@@ -27,19 +27,19 @@ class TestCase(unittest.TestCase):
# disable the default error handler
libxml2.registerErrorHandler(None,None)
try:
- apply(f,args)
+ f(*args)
except exc:
e = libxml2.lastError()
if e is None:
self.fail("lastError not set")
if 0:
- print "domain = ",e.domain()
- print "code = ",e.code()
- print "message =",repr(e.message())
- print "level =",e.level()
- print "file =",e.file()
- print "line =",e.line()
- print
+ print("domain = ",e.domain())
+ print("code = ",e.code())
+ print("message =",repr(e.message()))
+ print("level =",e.level())
+ print("file =",e.file())
+ print("line =",e.line())
+ print()
self.failUnlessEqual(domain,e.domain())
self.failUnlessEqual(code,e.code())
self.failUnlessEqual(message,e.message())
diff --git a/python/tests/tstURI.py b/python/tests/tstURI.py
index 58b7ad8..e4d58af 100755
--- a/python/tests/tstURI.py
+++ b/python/tests/tstURI.py
@@ -7,35 +7,35 @@ libxml2.debugMemory(1)
uri = libxml2.parseURI("http://example.org:8088/foo/bar?query=simple#fragid")
if uri.scheme() != 'http':
- print "Error parsing URI: wrong scheme"
+ print("Error parsing URI: wrong scheme")
sys.exit(1)
if uri.server() != 'example.org':
- print "Error parsing URI: wrong server"
+ print("Error parsing URI: wrong server")
sys.exit(1)
if uri.port() != 8088:
- print "Error parsing URI: wrong port"
+ print("Error parsing URI: wrong port")
sys.exit(1)
if uri.path() != '/foo/bar':
- print "Error parsing URI: wrong path"
+ print("Error parsing URI: wrong path")
sys.exit(1)
if uri.query() != 'query=simple':
- print "Error parsing URI: wrong query"
+ print("Error parsing URI: wrong query")
sys.exit(1)
if uri.fragment() != 'fragid':
- print "Error parsing URI: wrong query"
+ print("Error parsing URI: wrong query")
sys.exit(1)
uri.setScheme("https")
uri.setPort(223)
uri.setFragment(None)
result=uri.saveUri()
if result != "https://example.org:223/foo/bar?query=simple":
- print "Error modifying or saving the URI"
+ print("Error modifying or saving the URI")
uri = None
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/tstmem.py b/python/tests/tstmem.py
index 553096d..6b34cf3 100755
--- a/python/tests/tstmem.py
+++ b/python/tests/tstmem.py
@@ -19,7 +19,7 @@ libxml2mod.xmlSetValidErrors(ctxt._o, error, error)
doc = libxml2.parseDoc(instance)
ret = doc.validateDtd(ctxt, dtd)
if ret != 1:
- print "error doing DTD validation"
+ print("error doing DTD validation")
sys.exit(1)
doc.freeDoc()
@@ -30,7 +30,7 @@ del ctxt
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/tstxpath.py b/python/tests/tstxpath.py
index e47c34d..0ba5a6d 100755
--- a/python/tests/tstxpath.py
+++ b/python/tests/tstxpath.py
@@ -25,10 +25,10 @@ doc = libxml2.parseFile("tst.xml")
ctxt = doc.xpathNewContext()
res = ctxt.xpathEval("//*")
if len(res) != 2:
- print "xpath query: wrong node set size"
+ print("xpath query: wrong node set size")
sys.exit(1)
if res[0].name != "doc" or res[1].name != "foo":
- print "xpath query: wrong node set value"
+ print("xpath query: wrong node set value")
sys.exit(1)
libxml2.registerXPathFunction(ctxt._o, "foo", None, foo)
libxml2.registerXPathFunction(ctxt._o, "bar", None, bar)
@@ -36,28 +36,28 @@ i = 10000
while i > 0:
res = ctxt.xpathEval("foo(1)")
if res != 2:
- print "xpath extension failure"
+ print("xpath extension failure")
sys.exit(1)
i = i - 1
i = 10000
while i > 0:
res = ctxt.xpathEval("bar(1)")
if res != "3":
- print "xpath extension failure got %s expecting '3'"
+ print("xpath extension failure got %s expecting '3'")
sys.exit(1)
i = i - 1
doc.freeDoc()
ctxt.xpathFreeContext()
if called != "foo":
- print "xpath function: failed to access the context"
- print "xpath function: %s" % (called)
+ print("xpath function: failed to access the context")
+ print("xpath function: %s" % (called))
sys.exit(1)
#memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/validDTD.py b/python/tests/validDTD.py
index 1222f9f..4b03b8e 100755
--- a/python/tests/validDTD.py
+++ b/python/tests/validDTD.py
@@ -11,7 +11,7 @@ class ErrorHandler:
def handler(self, msg, data):
if data != ARG:
- raise Exception, "Error handler did not receive correct argument"
+ raise Exception("Error handler did not receive correct argument")
self.errors.append(msg)
@@ -34,7 +34,7 @@ ctxt.setValidityErrorHandler(e.handler, e.handler, ARG)
doc = libxml2.parseDoc(valid)
ret = doc.validateDtd(ctxt, dtd)
if ret != 1 or e.errors:
- print "error doing DTD validation"
+ print("error doing DTD validation")
sys.exit(1)
doc.freeDoc()
@@ -42,7 +42,7 @@ doc.freeDoc()
doc = libxml2.parseDoc(invalid)
ret = doc.validateDtd(ctxt, dtd)
if ret != 0 or not e.errors:
- print "Error: document supposed to be invalid"
+ print("Error: document supposed to be invalid")
doc.freeDoc()
dtd.freeDtd()
@@ -52,8 +52,8 @@ del ctxt
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/validRNG.py b/python/tests/validRNG.py
index 7022efe..57f13a4 100755
--- a/python/tests/validRNG.py
+++ b/python/tests/validRNG.py
@@ -11,7 +11,7 @@ class ErrorHandler:
def handler(self, msg, data):
if data != ARG:
- raise Exception, "Error handler did not receive correct argument"
+ raise Exception("Error handler did not receive correct argument")
self.errors.append(msg)
# Memory debug specific
@@ -49,7 +49,7 @@ ctxt.setValidityErrorHandler(e.handler, e.handler, ARG)
doc = libxml2.parseDoc(valid)
ret = doc.relaxNGValidateDoc(ctxt)
if ret != 0 or e.errors:
- print "error doing RelaxNG validation"
+ print("error doing RelaxNG validation")
sys.exit(1)
doc.freeDoc()
@@ -57,7 +57,7 @@ doc.freeDoc()
doc = libxml2.parseDoc(invalid)
ret = doc.relaxNGValidateDoc(ctxt)
if ret == 0 or not e.errors:
- print "Error: document supposed to be RelaxNG invalid"
+ print("Error: document supposed to be RelaxNG invalid")
sys.exit(1)
doc.freeDoc()
@@ -69,8 +69,8 @@ libxml2.relaxNGCleanupTypes()
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/validSchemas.py b/python/tests/validSchemas.py
index d4d62b2..cc543f3 100755
--- a/python/tests/validSchemas.py
+++ b/python/tests/validSchemas.py
@@ -11,7 +11,7 @@ class ErrorHandler:
def handler(self, msg, data):
if data != ARG:
- raise Exception, "Error handler did not receive correct argument"
+ raise Exception("Error handler did not receive correct argument")
self.errors.append(msg)
# Memory debug specific
@@ -56,7 +56,7 @@ ctxt_valid.setValidityErrorHandler(e.handler, e.handler, ARG)
doc = libxml2.parseDoc(valid)
ret = doc.schemaValidateDoc(ctxt_valid)
if ret != 0 or e.errors:
- print "error doing schema validation"
+ print("error doing schema validation")
sys.exit(1)
doc.freeDoc()
@@ -64,7 +64,7 @@ doc.freeDoc()
doc = libxml2.parseDoc(invalid)
ret = doc.schemaValidateDoc(ctxt_valid)
if ret == 0 or not e.errors:
- print "Error: document supposer to be schema invalid"
+ print("Error: document supposer to be schema invalid")
sys.exit(1)
doc.freeDoc()
@@ -76,8 +76,8 @@ libxml2.schemaCleanupTypes()
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/validate.py b/python/tests/validate.py
index 0dc86f4..16c0386 100755
--- a/python/tests/validate.py
+++ b/python/tests/validate.py
@@ -12,14 +12,14 @@ doc = ctxt.doc()
valid = ctxt.isValid()
if doc.name != "valid.xml":
- print "doc.name failed"
+ print("doc.name failed")
sys.exit(1)
root = doc.children
if root.name != "doc":
- print "root.name failed"
+ print("root.name failed")
sys.exit(1)
if valid != 1:
- print "validity chec failed"
+ print("validity chec failed")
sys.exit(1)
doc.freeDoc()
@@ -32,7 +32,7 @@ while i > 0:
valid = ctxt.isValid()
doc.freeDoc()
if valid != 1:
- print "validity check failed"
+ print("validity check failed")
sys.exit(1)
i = i - 1
@@ -48,14 +48,14 @@ ctxt.parseDocument()
doc = ctxt.doc()
valid = ctxt.isValid()
if doc.name != "invalid.xml":
- print "doc.name failed"
+ print("doc.name failed")
sys.exit(1)
root = doc.children
if root.name != "doc":
- print "root.name failed"
+ print("root.name failed")
sys.exit(1)
if valid != 0:
- print "validity chec failed"
+ print("validity chec failed")
sys.exit(1)
doc.freeDoc()
@@ -68,7 +68,7 @@ while i > 0:
valid = ctxt.isValid()
doc.freeDoc()
if valid != 0:
- print "validity check failed"
+ print("validity check failed")
sys.exit(1)
i = i - 1
del ctxt
@@ -76,7 +76,7 @@ del ctxt
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/walker.py b/python/tests/walker.py
index 3b5a62a..47f0557 100755
--- a/python/tests/walker.py
+++ b/python/tests/walker.py
@@ -3,7 +3,6 @@
# this tests the entities substitutions with the XmlTextReader interface
#
import sys
-import StringIO
import libxml2
# Memory debug specific
@@ -45,12 +44,12 @@ while ret == 1:
ret = reader.Read()
if ret != 0:
- print "Error parsing the document test1"
+ print("Error parsing the document test1")
sys.exit(1)
if result != expect:
- print "Unexpected result for test1"
- print result
+ print("Unexpected result for test1")
+ print(result)
sys.exit(1)
doc.freeDoc()
@@ -85,12 +84,12 @@ while ret == 1:
ret = reader.Read()
if ret != 0:
- print "Error parsing the document test2"
+ print("Error parsing the document test2")
sys.exit(1)
if result != expect:
- print "Unexpected result for test2"
- print result
+ print("Unexpected result for test2")
+ print(result)
sys.exit(1)
doc.freeDoc()
@@ -123,12 +122,12 @@ while ret == 1:
ret = reader.Read()
if ret != 0:
- print "Error parsing the document test3"
+ print("Error parsing the document test3")
sys.exit(1)
if result != expect:
- print "Unexpected result for test3"
- print result
+ print("Unexpected result for test3")
+ print(result)
sys.exit(1)
#
@@ -139,7 +138,7 @@ del reader
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/xpath.py b/python/tests/xpath.py
index 2e036e1..72e6c9d 100755
--- a/python/tests/xpath.py
+++ b/python/tests/xpath.py
@@ -11,24 +11,24 @@ libxml2.debugMemory(1)
doc = libxml2.parseFile("tst.xml")
if doc.name != "tst.xml":
- print "doc.name error"
+ print("doc.name error")
sys.exit(1);
ctxt = doc.xpathNewContext()
res = ctxt.xpathEval("//*")
if len(res) != 2:
- print "xpath query: wrong node set size"
+ print("xpath query: wrong node set size")
sys.exit(1)
if res[0].name != "doc" or res[1].name != "foo":
- print "xpath query: wrong node set value"
+ print("xpath query: wrong node set value")
sys.exit(1)
ctxt.setContextNode(res[0])
res = ctxt.xpathEval("foo")
if len(res) != 1:
- print "xpath query: wrong node set size"
+ print("xpath query: wrong node set size")
sys.exit(1)
if res[0].name != "foo":
- print "xpath query: wrong node set value"
+ print("xpath query: wrong node set value")
sys.exit(1)
doc.freeDoc()
ctxt.xpathFreeContext()
@@ -45,7 +45,7 @@ del ctxt
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/xpathext.py b/python/tests/xpathext.py
index 4769626..b83d283 100755
--- a/python/tests/xpathext.py
+++ b/python/tests/xpathext.py
@@ -15,10 +15,10 @@ doc = libxml2.parseFile("tst.xml")
ctxt = doc.xpathNewContext()
res = ctxt.xpathEval("//*")
if len(res) != 2:
- print "xpath query: wrong node set size"
+ print("xpath query: wrong node set size")
sys.exit(1)
if res[0].name != "doc" or res[1].name != "foo":
- print "xpath query: wrong node set value"
+ print("xpath query: wrong node set value")
sys.exit(1)
libxml2.registerXPathFunction(ctxt._o, "foo", None, foo)
@@ -27,14 +27,14 @@ i = 10000
while i > 0:
res = ctxt.xpathEval("foo(1)")
if res != 2:
- print "xpath extension failure"
+ print("xpath extension failure")
sys.exit(1)
i = i - 1
i = 10000
while i > 0:
res = ctxt.xpathEval("bar(1)")
if res != "3":
- print "xpath extension failure got %s expecting '3'"
+ print("xpath extension failure got %s expecting '3'")
sys.exit(1)
i = i - 1
doc.freeDoc()
@@ -43,7 +43,7 @@ ctxt.xpathFreeContext()
# Memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/xpathleak.py b/python/tests/xpathleak.py
index 39f49e3..33ab61c 100644..100755
--- a/python/tests/xpathleak.py
+++ b/python/tests/xpathleak.py
@@ -42,24 +42,24 @@ badexprs = (
for expr in badexprs:
try:
ctxt.xpathEval(expr)
- except libxml2.xpathError, e:
+ except libxml2.xpathError:
pass
else:
- print "Unexpectedly legal expression:", expr
+ print("Unexpectedly legal expression:", expr)
ctxt.xpathFreeContext()
doc.freeDoc()
if err != expect:
- print "error"
- print "received %s" %(err)
- print "expected %s" %(expect)
+ print("error")
+ print("received %s" %(err))
+ print("expected %s" %(expect))
sys.exit(1)
libxml2.cleanupParser()
leakedbytes = libxml2.debugMemory(True)
if leakedbytes == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak", leakedbytes, "bytes"
+ print("Memory leak", leakedbytes, "bytes")
# drop file to .memdump file in cwd, but won't work if not compiled in
libxml2.dumpMemory()
diff --git a/python/tests/xpathns.py b/python/tests/xpathns.py
index e67e550..379535e 100755
--- a/python/tests/xpathns.py
+++ b/python/tests/xpathns.py
@@ -14,8 +14,8 @@ for n in d.xpathEval("//namespace::*"):
d.freeDoc()
if res != expect:
- print "test5 failed: unexpected output"
- print res
+ print("test5 failed: unexpected output")
+ print(res)
del res
del d
del n
@@ -23,7 +23,7 @@ del n
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/tests/xpathret.py b/python/tests/xpathret.py
index 2b5576a..11c8b32 100755
--- a/python/tests/xpathret.py
+++ b/python/tests/xpathret.py
@@ -27,21 +27,21 @@ ctxt = doc.xpathNewContext()
libxml2.registerXPathFunction(ctxt._o, "foo", None, foo)
res = ctxt.xpathEval("foo('hello')")
if type(res) != type([]):
- print "Failed to return a nodeset"
+ print("Failed to return a nodeset")
sys.exit(1)
if len(res) != 1:
- print "Unexpected nodeset size"
+ print("Unexpected nodeset size")
sys.exit(1)
node = res[0]
if node.name != 'p':
- print "Unexpected nodeset element result"
+ print("Unexpected nodeset element result")
sys.exit(1)
node = node.children
if node.type != 'text':
- print "Unexpected nodeset element children type"
+ print("Unexpected nodeset element children type")
sys.exit(1)
if node.content != 'hello':
- print "Unexpected nodeset element children content"
+ print("Unexpected nodeset element children content")
sys.exit(1)
doc.freeDoc()
@@ -51,7 +51,7 @@ ctxt.xpathFreeContext()
#memory debug specific
libxml2.cleanupParser()
if libxml2.debugMemory(1) == 0:
- print "OK"
+ print("OK")
else:
- print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+ print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
libxml2.dumpMemory()
diff --git a/python/types.c b/python/types.c
index 54b50de..31c909a 100644
--- a/python/types.c
+++ b/python/types.c
@@ -9,6 +9,83 @@
#include "libxml_wrap.h"
#include <libxml/xpathInternals.h>
+#if PY_MAJOR_VERSION >= 3
+#define PY_IMPORT_STRING_SIZE PyUnicode_FromStringAndSize
+#define PY_IMPORT_STRING PyUnicode_FromString
+#define PY_IMPORT_INT PyLong_FromLong
+#else
+#define PY_IMPORT_STRING_SIZE PyString_FromStringAndSize
+#define PY_IMPORT_STRING PyString_FromString
+#define PY_IMPORT_INT PyInt_FromLong
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+FILE *
+libxml_PyFileGet(PyObject *f) {
+ int fd, flags;
+ FILE *res;
+ const char *mode;
+
+ fd = PyObject_AsFileDescriptor(f);
+ if (!_PyVerify_fd(fd))
+ return(NULL);
+ /*
+ * Get the flags on the fd to understand how it was opened
+ */
+ flags = fcntl(fd, F_GETFL, 0);
+ switch (flags & O_ACCMODE) {
+ case O_RDWR:
+ if (flags & O_APPEND)
+ mode = "a+";
+ else
+ mode = "rw";
+ break;
+ case O_RDONLY:
+ if (flags & O_APPEND)
+ mode = "r+";
+ else
+ mode = "r";
+ break;
+ case O_WRONLY:
+ if (flags & O_APPEND)
+ mode = "a";
+ else
+ mode = "w";
+ break;
+ default:
+ return(NULL);
+ }
+
+ /*
+ * the FILE struct gets a new fd, so that it can be closed
+ * independently of the file descriptor given. The risk though is
+ * lack of sync. So at the python level sync must be implemented
+ * before and after a conversion took place. No way around it
+ * in the Python3 infrastructure !
+ * The duplicated fd and FILE * will be released in the subsequent
+ * call to libxml_PyFileRelease() which must be genrated accodingly
+ */
+ fd = dup(fd);
+ if (fd == -1)
+ return(NULL);
+ res = fdopen(fd, mode);
+ if (res == NULL) {
+ close(fd);
+ return(NULL);
+ }
+ return(res);
+}
+
+void libxml_PyFileRelease(FILE *f) {
+ if (f != NULL)
+ fclose(f);
+}
+#endif
+
PyObject *
libxml_intWrap(int val)
{
@@ -17,7 +94,7 @@ libxml_intWrap(int val)
#ifdef DEBUG
printf("libxml_intWrap: val = %d\n", val);
#endif
- ret = PyInt_FromLong((long) val);
+ ret = PY_IMPORT_INT((long) val);
return (ret);
}
@@ -29,7 +106,7 @@ libxml_longWrap(long val)
#ifdef DEBUG
printf("libxml_longWrap: val = %ld\n", val);
#endif
- ret = PyInt_FromLong(val);
+ ret = PyLong_FromLong(val);
return (ret);
}
@@ -57,8 +134,7 @@ libxml_charPtrWrap(char *str)
Py_INCREF(Py_None);
return (Py_None);
}
- /* TODO: look at deallocation */
- ret = PyString_FromString(str);
+ ret = PY_IMPORT_STRING(str);
xmlFree(str);
return (ret);
}
@@ -75,8 +151,7 @@ libxml_charPtrConstWrap(const char *str)
Py_INCREF(Py_None);
return (Py_None);
}
- /* TODO: look at deallocation */
- ret = PyString_FromString(str);
+ ret = PY_IMPORT_STRING(str);
return (ret);
}
@@ -92,8 +167,7 @@ libxml_xmlCharPtrWrap(xmlChar * str)
Py_INCREF(Py_None);
return (Py_None);
}
- /* TODO: look at deallocation */
- ret = PyString_FromString((char *) str);
+ ret = PY_IMPORT_STRING((char *) str);
xmlFree(str);
return (ret);
}
@@ -110,8 +184,7 @@ libxml_xmlCharPtrConstWrap(const xmlChar * str)
Py_INCREF(Py_None);
return (Py_None);
}
- /* TODO: look at deallocation */
- ret = PyString_FromString((char *) str);
+ ret = PY_IMPORT_STRING((char *) str);
return (ret);
}
@@ -127,8 +200,7 @@ libxml_constcharPtrWrap(const char *str)
Py_INCREF(Py_None);
return (Py_None);
}
- /* TODO: look at deallocation */
- ret = PyString_FromString(str);
+ ret = PY_IMPORT_STRING(str);
return (ret);
}
@@ -144,8 +216,7 @@ libxml_constxmlCharPtrWrap(const xmlChar * str)
Py_INCREF(Py_None);
return (Py_None);
}
- /* TODO: look at deallocation */
- ret = PyString_FromString((char *) str);
+ ret = PY_IMPORT_STRING((char *) str);
return (ret);
}
@@ -162,9 +233,7 @@ libxml_xmlDocPtrWrap(xmlDocPtr doc)
return (Py_None);
}
/* TODO: look at deallocation */
- ret =
- PyCObject_FromVoidPtrAndDesc((void *) doc, (char *) "xmlDocPtr",
- NULL);
+ ret = PyCapsule_New((void *) doc, (char *) "xmlDocPtr", NULL);
return (ret);
}
@@ -180,9 +249,7 @@ libxml_xmlNodePtrWrap(xmlNodePtr node)
Py_INCREF(Py_None);
return (Py_None);
}
- ret =
- PyCObject_FromVoidPtrAndDesc((void *) node, (char *) "xmlNodePtr",
- NULL);
+ ret = PyCapsule_New((void *) node, (char *) "xmlNodePtr", NULL);
return (ret);
}
@@ -198,9 +265,7 @@ libxml_xmlURIPtrWrap(xmlURIPtr uri)
Py_INCREF(Py_None);
return (Py_None);
}
- ret =
- PyCObject_FromVoidPtrAndDesc((void *) uri, (char *) "xmlURIPtr",
- NULL);
+ ret = PyCapsule_New((void *) uri, (char *) "xmlURIPtr", NULL);
return (ret);
}
@@ -216,9 +281,7 @@ libxml_xmlNsPtrWrap(xmlNsPtr ns)
Py_INCREF(Py_None);
return (Py_None);
}
- ret =
- PyCObject_FromVoidPtrAndDesc((void *) ns, (char *) "xmlNsPtr",
- NULL);
+ ret = PyCapsule_New((void *) ns, (char *) "xmlNsPtr", NULL);
return (ret);
}
@@ -234,9 +297,7 @@ libxml_xmlAttrPtrWrap(xmlAttrPtr attr)
Py_INCREF(Py_None);
return (Py_None);
}
- ret =
- PyCObject_FromVoidPtrAndDesc((void *) attr, (char *) "xmlAttrPtr",
- NULL);
+ ret = PyCapsule_New((void *) attr, (char *) "xmlAttrPtr", NULL);
return (ret);
}
@@ -252,9 +313,7 @@ libxml_xmlAttributePtrWrap(xmlAttributePtr attr)
Py_INCREF(Py_None);
return (Py_None);
}
- ret =
- PyCObject_FromVoidPtrAndDesc((void *) attr,
- (char *) "xmlAttributePtr", NULL);
+ ret = PyCapsule_New((void *) attr, (char *) "xmlAttributePtr", NULL);
return (ret);
}
@@ -270,9 +329,7 @@ libxml_xmlElementPtrWrap(xmlElementPtr elem)
Py_INCREF(Py_None);
return (Py_None);
}
- ret =
- PyCObject_FromVoidPtrAndDesc((void *) elem,
- (char *) "xmlElementPtr", NULL);
+ ret = PyCapsule_New((void *) elem, (char *) "xmlElementPtr", NULL);
return (ret);
}
@@ -288,9 +345,7 @@ libxml_xmlXPathContextPtrWrap(xmlXPathContextPtr ctxt)
Py_INCREF(Py_None);
return (Py_None);
}
- ret =
- PyCObject_FromVoidPtrAndDesc((void *) ctxt,
- (char *) "xmlXPathContextPtr", NULL);
+ ret = PyCapsule_New((void *) ctxt, (char *) "xmlXPathContextPtr", NULL);
return (ret);
}
@@ -306,9 +361,7 @@ libxml_xmlXPathParserContextPtrWrap(xmlXPathParserContextPtr ctxt)
Py_INCREF(Py_None);
return (Py_None);
}
- ret = PyCObject_FromVoidPtrAndDesc((void *) ctxt,
- (char *) "xmlXPathParserContextPtr",
- NULL);
+ ret = PyCapsule_New((void *)ctxt, (char *)"xmlXPathParserContextPtr", NULL);
return (ret);
}
@@ -325,28 +378,35 @@ libxml_xmlParserCtxtPtrWrap(xmlParserCtxtPtr ctxt)
return (Py_None);
}
- ret =
- PyCObject_FromVoidPtrAndDesc((void *) ctxt,
- (char *) "xmlParserCtxtPtr", NULL);
+ ret = PyCapsule_New((void *) ctxt, (char *) "xmlParserCtxtPtr", NULL);
return (ret);
}
/**
* libxml_xmlXPathDestructNsNode:
- * cobj: xmlNsPtr namespace node
- * desc: ignored string
+ * cap: xmlNsPtr namespace node capsule object
*
* This function is called if and when a namespace node returned in
* an XPath node set is to be destroyed. That's the only kind of
* object returned in node set not directly linked to the original
* xmlDoc document, see xmlXPathNodeSetDupNs.
*/
+#if PY_VERSION_HEX < 0x02070000
+static void
+libxml_xmlXPathDestructNsNode(void *cap, void *desc ATTRIBUTE_UNUSED)
+#else
static void
-libxml_xmlXPathDestructNsNode(void *cobj, void *desc ATTRIBUTE_UNUSED) {
+libxml_xmlXPathDestructNsNode(PyObject *cap)
+#endif
+{
#ifdef DEBUG
- fprintf(stderr, "libxml_xmlXPathDestructNsNode called %p\n", cobj);
+ fprintf(stderr, "libxml_xmlXPathDestructNsNode called %p\n", cap);
+#endif
+#if PY_VERSION_HEX < 0x02070000
+ xmlXPathNodeSetFreeNs((xmlNsPtr) cap);
+#else
+ xmlXPathNodeSetFreeNs((xmlNsPtr) PyCapsule_GetPointer(cap, "xmlNsPtr"));
#endif
- xmlXPathNodeSetFreeNs((xmlNsPtr) cobj);
}
PyObject *
@@ -400,8 +460,7 @@ libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj)
for (i = 0; i < obj->nodesetval->nodeNr; i++) {
node = obj->nodesetval->nodeTab[i];
if (node->type == XML_NAMESPACE_DECL) {
- PyObject *ns =
- PyCObject_FromVoidPtrAndDesc((void *) node,
+ PyObject *ns = PyCapsule_New((void *) node,
(char *) "xmlNsPtr",
libxml_xmlXPathDestructNsNode);
PyList_SetItem(ret, i, ns);
@@ -414,13 +473,13 @@ libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj)
}
break;
case XPATH_BOOLEAN:
- ret = PyInt_FromLong((long) obj->boolval);
+ ret = PY_IMPORT_INT((long) obj->boolval);
break;
case XPATH_NUMBER:
ret = PyFloat_FromDouble(obj->floatval);
break;
case XPATH_STRING:
- ret = PyString_FromString((char *) obj->stringval);
+ ret = PY_IMPORT_STRING((char *) obj->stringval);
break;
case XPATH_POINT:
{
@@ -429,7 +488,7 @@ libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj)
PyObject *tuple;
node = libxml_xmlNodePtrWrap(obj->user);
- indexIntoNode = PyInt_FromLong((long) obj->index);
+ indexIntoNode = PY_IMPORT_INT((long) obj->index);
tuple = PyTuple_New(2);
PyTuple_SetItem(tuple, 0, node);
@@ -453,7 +512,7 @@ libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj)
list = PyList_New(1);
node = libxml_xmlNodePtrWrap(obj->user);
- indexIntoNode = PyInt_FromLong((long) obj->index);
+ indexIntoNode = PY_IMPORT_INT((long) obj->index);
tuple = PyTuple_New(2);
PyTuple_SetItem(tuple, 0, node);
@@ -471,7 +530,7 @@ libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj)
list = PyList_New(2);
node = libxml_xmlNodePtrWrap(obj->user);
- indexIntoNode = PyInt_FromLong((long) obj->index);
+ indexIntoNode = PY_IMPORT_INT((long) obj->index);
tuple = PyTuple_New(2);
PyTuple_SetItem(tuple, 0, node);
@@ -480,7 +539,7 @@ libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj)
PyList_SetItem(list, 0, tuple);
node = libxml_xmlNodePtrWrap(obj->user2);
- indexIntoNode = PyInt_FromLong((long) obj->index2);
+ indexIntoNode = PY_IMPORT_INT((long) obj->index2);
tuple = PyTuple_New(2);
PyTuple_SetItem(tuple, 0, node);
@@ -545,14 +604,14 @@ libxml_xmlXPathObjectPtrConvert(PyObject * obj)
if (obj == NULL) {
return (NULL);
}
- if PyFloat_Check
- (obj) {
+ if PyFloat_Check (obj) {
ret = xmlXPathNewFloat((double) PyFloat_AS_DOUBLE(obj));
-
- } else if PyInt_Check(obj) {
-
+ } else if PyLong_Check(obj) {
+#ifdef PyLong_AS_LONG
+ ret = xmlXPathNewFloat((double) PyLong_AS_LONG(obj));
+#else
ret = xmlXPathNewFloat((double) PyInt_AS_LONG(obj));
-
+#endif
#ifdef PyBool_Check
} else if PyBool_Check (obj) {
@@ -563,15 +622,37 @@ libxml_xmlXPathObjectPtrConvert(PyObject * obj)
ret = xmlXPathNewBoolean(0);
}
#endif
- } else if PyString_Check
- (obj) {
+ } else if PyBytes_Check (obj) {
xmlChar *str;
- str = xmlStrndup((const xmlChar *) PyString_AS_STRING(obj),
- PyString_GET_SIZE(obj));
+ str = xmlStrndup((const xmlChar *) PyBytes_AS_STRING(obj),
+ PyBytes_GET_SIZE(obj));
ret = xmlXPathWrapString(str);
- } else if PyList_Check
- (obj) {
+#ifdef PyUnicode_Check
+ } else if PyUnicode_Check (obj) {
+#if PY_VERSION_HEX >= 0x03030000
+ xmlChar *str;
+ const char *tmp;
+ size_t size;
+
+ /* tmp doesn't need to be deallocated */
+ tmp = PyUnicode_AsUTF8AndSize(obj, &size);
+ str = xmlStrndup(tmp, (int) size);
+ ret = xmlXPathWrapString(str);
+#else
+ xmlChar *str = NULL;
+ PyObject *b;
+
+ b = PyUnicode_AsUTF8String(obj);
+ if (b != NULL) {
+ str = xmlStrndup((const xmlChar *) PyBytes_AS_STRING(b),
+ PyBytes_GET_SIZE(b));
+ Py_DECREF(b);
+ }
+ ret = xmlXPathWrapString(str);
+#endif
+#endif
+ } else if PyList_Check (obj) {
int i;
PyObject *node;
xmlNodePtr cur;
@@ -585,28 +666,18 @@ libxml_xmlXPathObjectPtrConvert(PyObject * obj)
continue;
cur = NULL;
- if (PyCObject_Check(node)) {
+ if (PyCapsule_CheckExact(node)) {
#ifdef DEBUG
- printf("Got a CObject\n");
+ printf("Got a Capsule\n");
#endif
cur = PyxmlNode_Get(node);
- } else if (PyInstance_Check(node)) {
- PyInstanceObject *inst = (PyInstanceObject *) node;
- PyObject *name = inst->in_class->cl_name;
-
- if PyString_Check
- (name) {
- char *type = PyString_AS_STRING(name);
- PyObject *wrapper;
-
- if (!strcmp(type, "xmlNode")) {
- wrapper =
- PyObject_GetAttrString(node, (char *) "_o");
- if (wrapper != NULL) {
- cur = PyxmlNode_Get(wrapper);
- }
- }
- }
+ } else if ((PyObject_HasAttrString(node, (char *) "_o")) &&
+ (PyObject_HasAttrString(node, (char *) "get_doc"))) {
+ PyObject *wrapper;
+
+ wrapper = PyObject_GetAttrString(node, (char *) "_o");
+ if (wrapper != NULL)
+ cur = PyxmlNode_Get(wrapper);
} else {
#ifdef DEBUG
printf("Unknown object in Python return list\n");
@@ -622,7 +693,6 @@ libxml_xmlXPathObjectPtrConvert(PyObject * obj)
printf("Unable to convert Python Object to XPath");
#endif
}
- Py_DECREF(obj);
return (ret);
}
@@ -630,7 +700,7 @@ PyObject *
libxml_xmlValidCtxtPtrWrap(xmlValidCtxtPtr valid)
{
PyObject *ret;
-
+
#ifdef DEBUG
printf("libxml_xmlValidCtxtPtrWrap: valid = %p\n", valid);
#endif
@@ -640,7 +710,7 @@ libxml_xmlValidCtxtPtrWrap(xmlValidCtxtPtr valid)
}
ret =
- PyCObject_FromVoidPtrAndDesc((void *) valid,
+ PyCapsule_New((void *) valid,
(char *) "xmlValidCtxtPtr", NULL);
return (ret);
@@ -659,7 +729,7 @@ libxml_xmlCatalogPtrWrap(xmlCatalogPtr catal)
return (Py_None);
}
ret =
- PyCObject_FromVoidPtrAndDesc((void *) catal,
+ PyCapsule_New((void *) catal,
(char *) "xmlCatalogPtr", NULL);
return (ret);
}
@@ -677,7 +747,7 @@ libxml_xmlOutputBufferPtrWrap(xmlOutputBufferPtr buffer)
return (Py_None);
}
ret =
- PyCObject_FromVoidPtrAndDesc((void *) buffer,
+ PyCapsule_New((void *) buffer,
(char *) "xmlOutputBufferPtr", NULL);
return (ret);
}
@@ -695,7 +765,7 @@ libxml_xmlParserInputBufferPtrWrap(xmlParserInputBufferPtr buffer)
return (Py_None);
}
ret =
- PyCObject_FromVoidPtrAndDesc((void *) buffer,
+ PyCapsule_New((void *) buffer,
(char *) "xmlParserInputBufferPtr", NULL);
return (ret);
}
@@ -714,7 +784,7 @@ libxml_xmlRegexpPtrWrap(xmlRegexpPtr regexp)
return (Py_None);
}
ret =
- PyCObject_FromVoidPtrAndDesc((void *) regexp,
+ PyCapsule_New((void *) regexp,
(char *) "xmlRegexpPtr", NULL);
return (ret);
}
@@ -734,7 +804,7 @@ libxml_xmlTextReaderPtrWrap(xmlTextReaderPtr reader)
return (Py_None);
}
ret =
- PyCObject_FromVoidPtrAndDesc((void *) reader,
+ PyCapsule_New((void *) reader,
(char *) "xmlTextReaderPtr", NULL);
return (ret);
}
@@ -752,7 +822,7 @@ libxml_xmlTextReaderLocatorPtrWrap(xmlTextReaderLocatorPtr locator)
return (Py_None);
}
ret =
- PyCObject_FromVoidPtrAndDesc((void *) locator,
+ PyCapsule_New((void *) locator,
(char *) "xmlTextReaderLocatorPtr", NULL);
return (ret);
}
@@ -772,7 +842,7 @@ libxml_xmlRelaxNGPtrWrap(xmlRelaxNGPtr ctxt)
return (Py_None);
}
ret =
- PyCObject_FromVoidPtrAndDesc((void *) ctxt,
+ PyCapsule_New((void *) ctxt,
(char *) "xmlRelaxNGPtr", NULL);
return (ret);
}
@@ -790,7 +860,7 @@ libxml_xmlRelaxNGParserCtxtPtrWrap(xmlRelaxNGParserCtxtPtr ctxt)
return (Py_None);
}
ret =
- PyCObject_FromVoidPtrAndDesc((void *) ctxt,
+ PyCapsule_New((void *) ctxt,
(char *) "xmlRelaxNGParserCtxtPtr", NULL);
return (ret);
}
@@ -807,7 +877,7 @@ libxml_xmlRelaxNGValidCtxtPtrWrap(xmlRelaxNGValidCtxtPtr valid)
return (Py_None);
}
ret =
- PyCObject_FromVoidPtrAndDesc((void *) valid,
+ PyCapsule_New((void *) valid,
(char *) "xmlRelaxNGValidCtxtPtr", NULL);
return (ret);
}
@@ -825,7 +895,7 @@ libxml_xmlSchemaPtrWrap(xmlSchemaPtr ctxt)
return (Py_None);
}
ret =
- PyCObject_FromVoidPtrAndDesc((void *) ctxt,
+ PyCapsule_New((void *) ctxt,
(char *) "xmlSchemaPtr", NULL);
return (ret);
}
@@ -843,7 +913,7 @@ libxml_xmlSchemaParserCtxtPtrWrap(xmlSchemaParserCtxtPtr ctxt)
return (Py_None);
}
ret =
- PyCObject_FromVoidPtrAndDesc((void *) ctxt,
+ PyCapsule_New((void *) ctxt,
(char *) "xmlSchemaParserCtxtPtr", NULL);
return (ret);
@@ -863,7 +933,7 @@ libxml_xmlSchemaValidCtxtPtrWrap(xmlSchemaValidCtxtPtr valid)
}
ret =
- PyCObject_FromVoidPtrAndDesc((void *) valid,
+ PyCapsule_New((void *) valid,
(char *) "xmlSchemaValidCtxtPtr", NULL);
return (ret);
@@ -882,8 +952,6 @@ libxml_xmlErrorPtrWrap(xmlErrorPtr error)
Py_INCREF(Py_None);
return (Py_None);
}
- ret =
- PyCObject_FromVoidPtrAndDesc((void *) error,
- (char *) "xmlErrorPtr", NULL);
+ ret = PyCapsule_New((void *) error, (char *) "xmlErrorPtr", NULL);
return (ret);
}
diff --git a/relaxng.c b/relaxng.c
index f600d07..370e314 100644
--- a/relaxng.c
+++ b/relaxng.c
@@ -8347,7 +8347,7 @@ xmlRelaxNGValidatePushElement(xmlRelaxNGValidCtxtPtr ctxt,
* xmlRelaxNGValidatePushCData:
* @ctxt: the RelaxNG validation context
* @data: some character data read
- * @len: the lenght of the data
+ * @len: the length of the data
*
* check the CData parsed for validation in the current stack
*
diff --git a/runtest.c b/runtest.c
index c6517a3..ccdd49b 100644
--- a/runtest.c
+++ b/runtest.c
@@ -2093,7 +2093,7 @@ static void processNode(FILE *out, xmlTextReaderPtr reader) {
}
static int
streamProcessTest(const char *filename, const char *result, const char *err,
- xmlTextReaderPtr reader, const char *rng) {
+ xmlTextReaderPtr reader, const char *rng, int options) {
int ret;
char *temp = NULL;
FILE *t = NULL;
@@ -2189,7 +2189,7 @@ streamParseTest(const char *filename, const char *result, const char *err,
int ret;
reader = xmlReaderForFile(filename, NULL, options);
- ret = streamProcessTest(filename, result, err, reader, NULL);
+ ret = streamProcessTest(filename, result, err, reader, NULL, options);
xmlFreeTextReader(reader);
return(ret);
}
@@ -2217,7 +2217,7 @@ walkerParseTest(const char *filename, const char *result, const char *err,
return(-1);
}
reader = xmlReaderWalker(doc);
- ret = streamProcessTest(filename, result, err, reader, NULL);
+ ret = streamProcessTest(filename, result, err, reader, NULL, options);
xmlFreeTextReader(reader);
xmlFreeDoc(doc);
return(ret);
@@ -2249,7 +2249,7 @@ streamMemParseTest(const char *filename, const char *result, const char *err,
return(-1);
}
reader = xmlReaderForMemory(base, size, filename, NULL, options);
- ret = streamProcessTest(filename, result, err, reader, NULL);
+ ret = streamProcessTest(filename, result, err, reader, NULL, options);
free((char *)base);
xmlFreeTextReader(reader);
return(ret);
@@ -3308,9 +3308,11 @@ rngStreamTest(const char *filename,
fprintf(stderr, "Failed to build reder for %s\n", instance);
}
if (disable_err == 1)
- ret = streamProcessTest(instance, result, NULL, reader, filename);
+ ret = streamProcessTest(instance, result, NULL, reader, filename,
+ options);
else
- ret = streamProcessTest(instance, result, err, reader, filename);
+ ret = streamProcessTest(instance, result, err, reader, filename,
+ options);
xmlFreeTextReader(reader);
if (ret != 0) {
fprintf(stderr, "instance %s failed\n", instance);
@@ -4203,6 +4205,14 @@ testDesc testDescriptions[] = {
{ "Validity checking regression tests" ,
errParseTest, "./test/VC/*", "result/VC/", NULL, "",
XML_PARSE_DTDVALID },
+#ifdef LIBXML_READER_ENABLED
+ { "Streaming validity checking regression tests" ,
+ streamParseTest, "./test/valid/*.xml", "result/valid/", NULL, ".err.rdr",
+ XML_PARSE_DTDVALID },
+ { "Streaming validity error checking regression tests" ,
+ streamParseTest, "./test/VC/*", "result/VC/", NULL, ".rdr",
+ XML_PARSE_DTDVALID },
+#endif
{ "General documents valid regression tests" ,
errParseTest, "./test/valid/*", "result/valid/", "", ".err",
XML_PARSE_DTDVALID },
diff --git a/testapi.c b/testapi.c
index 48656b3..c745ec3 100644
--- a/testapi.c
+++ b/testapi.c
@@ -17832,7 +17832,7 @@ test_xmlRelaxNGValidatePushCData(void) {
int n_ctxt;
xmlChar * data; /* some character data read */
int n_data;
- int len; /* the lenght of the data */
+ int len; /* the length of the data */
int n_len;
for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
@@ -27094,7 +27094,7 @@ test_xmlValidatePushCData(void) {
int n_ctxt;
xmlChar * data; /* some character data read */
int n_data;
- int len; /* the lenght of the data */
+ int len; /* the length of the data */
int n_len;
for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
@@ -33167,7 +33167,7 @@ test_xmlExpGetLanguage(void) {
int n_exp;
xmlChar ** langList; /* where to store the tokens */
int n_langList;
- int len; /* the allocated lenght of @list */
+ int len; /* the allocated length of @list */
int n_len;
for (n_ctxt = 0;n_ctxt < gen_nb_xmlExpCtxtPtr;n_ctxt++) {
@@ -33222,7 +33222,7 @@ test_xmlExpGetStart(void) {
int n_exp;
xmlChar ** tokList; /* where to store the tokens */
int n_tokList;
- int len; /* the allocated lenght of @list */
+ int len; /* the allocated length of @list */
int n_len;
for (n_ctxt = 0;n_ctxt < gen_nb_xmlExpCtxtPtr;n_ctxt++) {
@@ -46852,6 +46852,54 @@ test_xmlXPathNewContext(void) {
static int
+test_xmlXPathNodeEval(void) {
+ int test_ret = 0;
+
+#if defined(LIBXML_XPATH_ENABLED)
+ int mem_base;
+ xmlXPathObjectPtr ret_val;
+ xmlNodePtr node; /* the node to to use as the context node */
+ int n_node;
+ xmlChar * str; /* the XPath expression */
+ int n_str;
+ xmlXPathContextPtr ctx; /* the XPath context */
+ int n_ctx;
+
+ for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
+ for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
+ for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
+ mem_base = xmlMemBlocks();
+ node = gen_xmlNodePtr(n_node, 0);
+ str = gen_const_xmlChar_ptr(n_str, 1);
+ ctx = gen_xmlXPathContextPtr(n_ctx, 2);
+
+ ret_val = xmlXPathNodeEval(node, (const xmlChar *)str, ctx);
+ desret_xmlXPathObjectPtr(ret_val);
+ call_tests++;
+ des_xmlNodePtr(n_node, node, 0);
+ des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
+ des_xmlXPathContextPtr(n_ctx, ctx, 2);
+ xmlResetLastError();
+ if (mem_base != xmlMemBlocks()) {
+ printf("Leak of %d blocks found in xmlXPathNodeEval",
+ xmlMemBlocks() - mem_base);
+ test_ret++;
+ printf(" %d", n_node);
+ printf(" %d", n_str);
+ printf(" %d", n_ctx);
+ printf("\n");
+ }
+ }
+ }
+ }
+ function_tests++;
+#endif
+
+ return(test_ret);
+}
+
+
+static int
test_xmlXPathNodeSetCreate(void) {
int test_ret = 0;
@@ -46952,11 +47000,52 @@ test_xmlXPathOrderDocElems(void) {
return(test_ret);
}
+
+static int
+test_xmlXPathSetContextNode(void) {
+ int test_ret = 0;
+
+#if defined(LIBXML_XPATH_ENABLED)
+ int mem_base;
+ int ret_val;
+ xmlNodePtr node; /* the node to to use as the context node */
+ int n_node;
+ xmlXPathContextPtr ctx; /* the XPath context */
+ int n_ctx;
+
+ for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
+ for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
+ mem_base = xmlMemBlocks();
+ node = gen_xmlNodePtr(n_node, 0);
+ ctx = gen_xmlXPathContextPtr(n_ctx, 1);
+
+ ret_val = xmlXPathSetContextNode(node, ctx);
+ desret_int(ret_val);
+ call_tests++;
+ des_xmlNodePtr(n_node, node, 0);
+ des_xmlXPathContextPtr(n_ctx, ctx, 1);
+ xmlResetLastError();
+ if (mem_base != xmlMemBlocks()) {
+ printf("Leak of %d blocks found in xmlXPathSetContextNode",
+ xmlMemBlocks() - mem_base);
+ test_ret++;
+ printf(" %d", n_node);
+ printf(" %d", n_ctx);
+ printf("\n");
+ }
+ }
+ }
+ function_tests++;
+#endif
+
+ return(test_ret);
+}
+
static int
test_xpath(void) {
int test_ret = 0;
- if (quiet == 0) printf("Testing xpath : 30 of 38 functions ...\n");
+ if (quiet == 0) printf("Testing xpath : 32 of 40 functions ...\n");
test_ret += test_xmlXPathCastBooleanToNumber();
test_ret += test_xmlXPathCastBooleanToString();
test_ret += test_xmlXPathCastNodeSetToBoolean();
@@ -46987,9 +47076,11 @@ test_xpath(void) {
test_ret += test_xmlXPathIsInf();
test_ret += test_xmlXPathIsNaN();
test_ret += test_xmlXPathNewContext();
+ test_ret += test_xmlXPathNodeEval();
test_ret += test_xmlXPathNodeSetCreate();
test_ret += test_xmlXPathObjectCopy();
test_ret += test_xmlXPathOrderDocElems();
+ test_ret += test_xmlXPathSetContextNode();
if (test_ret != 0)
printf("Module xpath: %d errors\n", test_ret);
diff --git a/testlimits.c b/testlimits.c
index 7ee6fb9..41994c4 100644
--- a/testlimits.c
+++ b/testlimits.c
@@ -1384,19 +1384,19 @@ struct limitDesc {
};
static limitDesc limitDescriptions[] = {
- /* max lenght of a text node in content */
+ /* max length of a text node in content */
{"huge:textNode", XML_MAX_TEXT_LENGTH - CHUNK, 0, 0},
{"huge:textNode", XML_MAX_TEXT_LENGTH + CHUNK, 0, 1},
{"huge:textNode", XML_MAX_TEXT_LENGTH + CHUNK, XML_PARSE_HUGE, 0},
- /* max lenght of a text node in content */
+ /* max length of a text node in content */
{"huge:attrNode", XML_MAX_TEXT_LENGTH - CHUNK, 0, 0},
{"huge:attrNode", XML_MAX_TEXT_LENGTH + CHUNK, 0, 1},
{"huge:attrNode", XML_MAX_TEXT_LENGTH + CHUNK, XML_PARSE_HUGE, 0},
- /* max lenght of a comment node */
+ /* max length of a comment node */
{"huge:commentNode", XML_MAX_TEXT_LENGTH - CHUNK, 0, 0},
{"huge:commentNode", XML_MAX_TEXT_LENGTH + CHUNK, 0, 1},
{"huge:commentNode", XML_MAX_TEXT_LENGTH + CHUNK, XML_PARSE_HUGE, 0},
- /* max lenght of a PI node */
+ /* max length of a PI node */
{"huge:piNode", XML_MAX_TEXT_LENGTH - CHUNK, 0, 0},
{"huge:piNode", XML_MAX_TEXT_LENGTH + CHUNK, 0, 1},
{"huge:piNode", XML_MAX_TEXT_LENGTH + CHUNK, XML_PARSE_HUGE, 0},
diff --git a/threads.c b/threads.c
index f206149..f2f2703 100644
--- a/threads.c
+++ b/threads.c
@@ -146,6 +146,7 @@ struct _xmlRMutex {
static pthread_key_t globalkey;
static pthread_t mainthread;
static pthread_once_t once_control = PTHREAD_ONCE_INIT;
+static pthread_once_t once_control_init = PTHREAD_ONCE_INIT;
static pthread_mutex_t global_init_lock = PTHREAD_MUTEX_INITIALIZER;
#elif defined HAVE_WIN32_THREADS
#if defined(HAVE_COMPILER_TLS)
@@ -251,7 +252,6 @@ xmlMutexLock(xmlMutexPtr tok)
#ifdef DEBUG_THREADS
xmlGenericError(xmlGenericErrorContext,
"xmlMutexLock():BeOS:Couldn't aquire semaphore\n");
- exit();
#endif
}
tok->tid = find_thread(NULL);
@@ -499,7 +499,6 @@ __xmlGlobalInitMutexLock(void)
#ifdef DEBUG_THREADS
xmlGenericError(xmlGenericErrorContext,
"xmlGlobalInitMutexLock():BeOS:Couldn't acquire semaphore\n");
- exit();
#endif
}
#endif
@@ -915,7 +914,7 @@ xmlCleanupThreads(void)
#ifdef HAVE_PTHREAD_H
if ((libxml_is_threaded) && (pthread_key_delete != NULL))
pthread_key_delete(globalkey);
- once_control = PTHREAD_ONCE_INIT;
+ once_control = once_control_init;
#elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
if (globalkey != TLS_OUT_OF_INDEXES) {
xmlGlobalStateCleanupHelperParams *p;
@@ -955,6 +954,7 @@ xmlOnceInit(void)
#ifdef HAVE_PTHREAD_H
(void) pthread_key_create(&globalkey, xmlFreeGlobalState);
mainthread = pthread_self();
+ __xmlInitializeDict();
#elif defined(HAVE_WIN32_THREADS)
if (!run_once.done) {
if (InterlockedIncrement(&run_once.control) == 1) {
@@ -962,6 +962,7 @@ xmlOnceInit(void)
globalkey = TlsAlloc();
#endif
mainthread = GetCurrentThreadId();
+ __xmlInitializeDict();
run_once.done = 1;
} else {
/* Another thread is working; give up our slice and
@@ -975,6 +976,7 @@ xmlOnceInit(void)
globalkey = tls_allocate();
tls_set(globalkey, NULL);
mainthread = find_thread(NULL);
+ __xmlInitializeDict();
} else
atomic_add(&run_once_init, -1);
#endif
diff --git a/timsort.h b/timsort.h
index 95f412b..99697a0 100644
--- a/timsort.h
+++ b/timsort.h
@@ -30,6 +30,14 @@ typedef unsigned __int64 uint64_t;
#endif
#endif
+#ifndef MK_UINT64
+#if defined(WIN32) && defined(_MSC_VER) && _MSC_VER < 1300
+#define MK_UINT64(x) ((uint64_t)(x))
+#else
+#define MK_UINT64(x) x##ULL
+#endif
+#endif
+
#ifndef MAX
#define MAX(x,y) (((x) > (y) ? (x) : (y)))
#endif
@@ -40,7 +48,7 @@ typedef unsigned __int64 uint64_t;
int compute_minrun(uint64_t);
#ifndef CLZ
-#ifdef __GNUC__
+#if defined(__GNUC__) && ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ > 3))
#define CLZ __builtin_clzll
#else
@@ -67,12 +75,12 @@ int clzll(uint64_t x) /* {{{ */
#endif
#endif
-int compute_minrun(const uint64_t size) /* {{{ */
+int compute_minrun(uint64_t size) /* {{{ */
{
const int top_bit = 64 - CLZ(size);
const int shift = MAX(top_bit, 6) - 6;
const int minrun = size >> shift;
- const uint64_t mask = (1ULL << shift) - 1;
+ const uint64_t mask = (MK_UINT64(1) << shift) - 1;
if (mask & size) return minrun + 1;
return minrun;
}
diff --git a/tree.c b/tree.c
index 145a689..7e5af26 100644
--- a/tree.c
+++ b/tree.c
@@ -314,7 +314,7 @@ xmlSplitQName2(const xmlChar *name, xmlChar **prefix) {
* parse an XML qualified name string,i
*
* returns NULL if it is not a Qualified Name, otherwise, update len
- * with the lenght in byte of the prefix and return a pointer
+ * with the length in byte of the prefix and return a pointer
* to the start of the name without the prefix
*/
diff --git a/valid.c b/valid.c
index 10bc4f4..6e53a76 100644
--- a/valid.c
+++ b/valid.c
@@ -5796,7 +5796,7 @@ xmlValidatePushElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
* xmlValidatePushCData:
* @ctxt: the validation context
* @data: some character data read
- * @len: the lenght of the data
+ * @len: the length of the data
*
* check the CData parsed for validation in the current stack
*
diff --git a/win32/Makefile.msvc b/win32/Makefile.msvc
index d917541..2b3d544 100644
--- a/win32/Makefile.msvc
+++ b/win32/Makefile.msvc
@@ -43,7 +43,7 @@ CPPFLAGS = $(CPPFLAGS) /D "_REENTRANT"
# The compiler and its options.
CC = cl.exe
-CFLAGS = /nologo /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "NOLIBTOOL" /W1 $(CRUNTIME)
+CFLAGS = /nologo /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "HAVE_CONFIG_H" /D "NOLIBTOOL" /W1 $(CRUNTIME)
CFLAGS = $(CFLAGS) /I$(XML_SRCDIR) /I$(XML_SRCDIR)\include /I$(INCPREFIX)
!if "$(WITH_THREADS)" != "no"
CFLAGS = $(CFLAGS) /D "_REENTRANT"
@@ -263,7 +263,8 @@ UTILS = $(BINDIR)\xmllint.exe\
$(BINDIR)\runtest.exe\
$(BINDIR)\runsuite.exe\
$(BINDIR)\testapi.exe\
- $(BINDIR)\testlimits.exe
+ $(BINDIR)\testlimits.exe\
+ $(BINDIR)\testrecurse.exe
!if "$(WITH_THREADS)" == "yes" || "$(WITH_THREADS)" == "ctls" || "$(WITH_THREADS)" == "native"
UTILS = $(UTILS) $(BINDIR)\testThreadsWin32.exe
@@ -416,7 +417,15 @@ $(UTILS) : $(UTILS_INTDIR) $(BINDIR) libxml libxmla libxmladll
# TESTS
-tests : XPathtests
+tests : checktests XPathtests
+
+checktests : $(UTILS)
+ cd .. && win32\$(BINDIR)\runtest.exe
+ cd .. && win32\$(BINDIR)\testrecurse.exe
+ cd .. && win32\$(BINDIR)\testapi.exe
+ cd .. && win32\$(BINDIR)\testchar.exe
+ cd .. && win32\$(BINDIR)\testdict.exe
+ cd .. && win32\$(BINDIR)\runxmlconf.exe
XPathtests : $(BINDIR)\testXPath.exe
@echo. 2> .memdump
diff --git a/win32/configure.js b/win32/configure.js
index 11d2898..edd943a 100644
--- a/win32/configure.js
+++ b/win32/configure.js
@@ -305,6 +305,8 @@ function configureLibxml()
of.WriteLine(s.replace(/\@WITH_TRIO\@/, withTrio? "1" : "0"));
} else if (s.search(/\@WITH_THREADS\@/) != -1) {
of.WriteLine(s.replace(/\@WITH_THREADS\@/, withThreads == "no"? "0" : "1"));
+ } else if (s.search(/\@WITH_THREAD_ALLOC\@/) != -1) {
+ of.WriteLine(s.replace(/\@WITH_THREAD_ALLOC\@/, "0"));
} else if (s.search(/\@WITH_FTP\@/) != -1) {
of.WriteLine(s.replace(/\@WITH_FTP\@/, withFtp? "1" : "0"));
} else if (s.search(/\@WITH_HTTP\@/) != -1) {
diff --git a/xmlIO.c b/xmlIO.c
index f8f438b..847cb7e 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -800,7 +800,7 @@ xmlCheckFilename (const char *path)
return 1;
}
-static int
+int
xmlNop(void) {
return(0);
}
@@ -3238,7 +3238,7 @@ xmlParserInputBufferPush(xmlParserInputBufferPtr in,
* convert as much as possible to the parser reading buffer.
*/
use = xmlBufUse(in->raw);
- nbchars = xmlCharEncInput(in);
+ nbchars = xmlCharEncInput(in, 1);
if (nbchars < 0) {
xmlIOErr(XML_IO_ENCODER, NULL);
in->error = XML_IO_ENCODER;
@@ -3343,7 +3343,7 @@ xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len) {
* convert as much as possible to the parser reading buffer.
*/
use = xmlBufUse(in->raw);
- nbchars = xmlCharEncInput(in);
+ nbchars = xmlCharEncInput(in, 1);
if (nbchars < 0) {
xmlIOErr(XML_IO_ENCODER, NULL);
in->error = XML_IO_ENCODER;
@@ -3725,14 +3725,16 @@ xmlOutputBufferFlush(xmlOutputBufferPtr out) {
*/
if ((out->conv != NULL) && (out->encoder != NULL)) {
/*
- * convert as much as possible to the parser reading buffer.
+ * convert as much as possible to the parser output buffer.
*/
- nbchars = xmlCharEncOutput(out, 0);
- if (nbchars < 0) {
- xmlIOErr(XML_IO_ENCODER, NULL);
- out->error = XML_IO_ENCODER;
- return(-1);
- }
+ do {
+ nbchars = xmlCharEncOutput(out, 0);
+ if (nbchars < 0) {
+ xmlIOErr(XML_IO_ENCODER, NULL);
+ out->error = XML_IO_ENCODER;
+ return(-1);
+ }
+ } while (nbchars);
}
/*
diff --git a/xmllint.c b/xmllint.c
index 9415d9a..26d8db1 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -168,6 +168,7 @@ static int nodefdtd = 0;
#endif
#ifdef LIBXML_PUSH_ENABLED
static int push = 0;
+static int pushsize = 4096;
#endif /* LIBXML_PUSH_ENABLED */
#ifdef HAVE_MMAP
static int memory = 0;
@@ -1874,7 +1875,8 @@ static void streamFile(char *filename) {
xmlTextReaderSetParserProp(reader, XML_PARSER_VALIDATE, 1);
else
#endif /* LIBXML_VALID_ENABLED */
- xmlTextReaderSetParserProp(reader, XML_PARSER_LOADDTD, 1);
+ if (loaddtd)
+ xmlTextReaderSetParserProp(reader, XML_PARSER_LOADDTD, 1);
#ifdef LIBXML_SCHEMAS_ENABLED
if (relaxng != NULL) {
if ((timing) && (!repeat)) {
@@ -2192,17 +2194,15 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
f = fopen(filename, "r");
#endif
if (f != NULL) {
- int res, size = 3;
+ int res;
char chars[4096];
htmlParserCtxtPtr ctxt;
- /* if (repeat) */
- size = 4096;
res = fread(chars, 1, 4, f);
if (res > 0) {
ctxt = htmlCreatePushParserCtxt(NULL, NULL,
chars, res, filename, XML_CHAR_ENCODING_NONE);
- while ((res = fread(chars, 1, size, f)) > 0) {
+ while ((res = fread(chars, 1, pushsize, f)) > 0) {
htmlParseChunk(ctxt, chars, res, 0);
}
htmlParseChunk(ctxt, chars, 0, 1);
@@ -3017,6 +3017,7 @@ static void usage(const char *name) {
#endif
#ifdef LIBXML_PUSH_ENABLED
printf("\t--push : use the push mode of the parser\n");
+ printf("\t--pushsmall : use the push mode of the parser using tiny increments\n");
#endif /* LIBXML_PUSH_ENABLED */
#ifdef HAVE_MMAP
printf("\t--memory : parse from memory\n");
@@ -3076,7 +3077,7 @@ static void usage(const char *name) {
printf("\t--sax: do not build a tree but work just at the SAX level\n");
printf("\t--oldxml10: use XML-1.0 parsing rules before the 5th edition\n");
#ifdef LIBXML_XPATH_ENABLED
- printf("\t--xpath expr: evaluate the XPath expression, inply --noout\n");
+ printf("\t--xpath expr: evaluate the XPath expression, imply --noout\n");
#endif
printf("\nLibxml project home page: http://xmlsoft.org/\n");
@@ -3247,6 +3248,11 @@ main(int argc, char **argv) {
else if ((!strcmp(argv[i], "-push")) ||
(!strcmp(argv[i], "--push")))
push++;
+ else if ((!strcmp(argv[i], "-pushsmall")) ||
+ (!strcmp(argv[i], "--pushsmall"))) {
+ push++;
+ pushsize = 10;
+ }
#endif /* LIBXML_PUSH_ENABLED */
#ifdef HAVE_MMAP
else if ((!strcmp(argv[i], "-memory")) ||
diff --git a/xmlreader.c b/xmlreader.c
index 579e943..00083d0 100644
--- a/xmlreader.c
+++ b/xmlreader.c
@@ -984,7 +984,7 @@ printf("Expand failed !\n");
* xmlTextReaderValidateCData:
* @reader: the xmlTextReaderPtr used
* @data: pointer to the CData
- * @len: lenght of the CData block in bytes.
+ * @len: length of the CData block in bytes.
*
* Push some CData for validation
*/
@@ -1409,8 +1409,7 @@ get_next_node:
#endif
(reader->entNr == 0) &&
(reader->node->prev != NULL) &&
- (reader->node->prev->type != XML_DTD_NODE) &&
- (reader->entNr == 0)) {
+ (reader->node->prev->type != XML_DTD_NODE)) {
xmlNodePtr tmp = reader->node->prev;
if ((tmp->extra & NODE_IS_PRESERVED) == 0) {
xmlUnlinkNode(tmp);
@@ -1459,8 +1458,7 @@ get_next_node:
#endif
(reader->entNr == 0) &&
(oldnode->type != XML_DTD_NODE) &&
- ((oldnode->extra & NODE_IS_PRESERVED) == 0) &&
- (reader->entNr == 0)) {
+ ((oldnode->extra & NODE_IS_PRESERVED) == 0)) {
xmlUnlinkNode(oldnode);
xmlTextReaderFreeNode(reader, oldnode);
}
diff --git a/xmlregexp.c b/xmlregexp.c
index 68e7bed..1f9911c 100644
--- a/xmlregexp.c
+++ b/xmlregexp.c
@@ -6838,7 +6838,7 @@ xmlExpRef(xmlExpNodePtr exp) {
* xmlExpNewAtom:
* @ctxt: the expression context
* @name: the atom name
- * @len: the atom name lenght in byte (or -1);
+ * @len: the atom name length in byte (or -1);
*
* Get the atom associated to this name from that context
*
@@ -6975,7 +6975,7 @@ tail:
* @ctxt: the expression context
* @exp: the expression
* @langList: where to store the tokens
- * @len: the allocated lenght of @list
+ * @len: the allocated length of @list
*
* Find all the strings used in @exp and store them in @list
*
@@ -7041,7 +7041,7 @@ tail:
* @ctxt: the expression context
* @exp: the expression
* @tokList: where to store the tokens
- * @len: the allocated lenght of @list
+ * @len: the allocated length of @list
*
* Find all the strings that appears at the start of the languages
* accepted by @exp and store them in @list. E.g. for (a, b) | c
diff --git a/xmlsave.c b/xmlsave.c
index 829abb3..774404b 100644
--- a/xmlsave.c
+++ b/xmlsave.c
@@ -2247,6 +2247,7 @@ xmlBufNodeDump(xmlBufPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level,
size_t use;
int ret;
xmlOutputBufferPtr outbuf;
+ int oldalloc;
xmlInitParser();
@@ -2278,7 +2279,10 @@ xmlBufNodeDump(xmlBufPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level,
outbuf->written = 0;
use = xmlBufUse(buf);
+ oldalloc = xmlBufGetAllocationScheme(buf);
+ xmlBufSetAllocationScheme(buf, XML_BUFFER_ALLOC_DOUBLEIT);
xmlNodeDumpOutput(outbuf, doc, cur, level, format, NULL);
+ xmlBufSetAllocationScheme(buf, oldalloc);
xmlFree(outbuf);
ret = xmlBufUse(buf) - use;
return (ret);
diff --git a/xmlschemas.c b/xmlschemas.c
index d6a47e4..121533f 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -26063,6 +26063,20 @@ xmlSchemaValidatorPopElem(xmlSchemaValidCtxtPtr vctxt)
"AUTOMATON create on '%s'\n", inode->localName);
#endif
}
+
+ /*
+ * Do not check further content if the node has been nilled
+ */
+ if (INODE_NILLED(inode)) {
+ ret = 0;
+#ifdef DEBUG_AUTOMATA
+ xmlGenericError(xmlGenericErrorContext,
+ "AUTOMATON succeeded on nilled '%s'\n",
+ inode->localName);
+#endif
+ goto skip_nilled;
+ }
+
/*
* Get hold of the still expected content, since a further
* call to xmlRegExecPushString() will loose this information.
@@ -26100,6 +26114,9 @@ xmlSchemaValidatorPopElem(xmlSchemaValidCtxtPtr vctxt)
}
}
+
+skip_nilled:
+
if (inode->typeDef->contentType == XML_SCHEMA_CONTENT_ELEMENTS)
goto end_elem;
@@ -27846,7 +27863,10 @@ xmlSchemaVDocWalk(xmlSchemaValidCtxtPtr vctxt)
const xmlChar *nsName;
/* DOC VAL TODO: Move this to the start function. */
- valRoot = xmlDocGetRootElement(vctxt->doc);
+ if (vctxt->validationRoot != NULL)
+ valRoot = vctxt->validationRoot;
+ else
+ valRoot = xmlDocGetRootElement(vctxt->doc);
if (valRoot == NULL) {
/* VAL TODO: Error code? */
VERROR(1, NULL, "The document has no document element");
diff --git a/xpath.c b/xpath.c
index 9a82e90..97410e7 100644
--- a/xpath.c
+++ b/xpath.c
@@ -12399,7 +12399,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt,
break;
}
} else if (cur->type == type) {
- if (type == XML_NAMESPACE_DECL)
+ if (cur->type == XML_NAMESPACE_DECL)
XP_TEST_HIT_NS
else
XP_TEST_HIT
@@ -15079,6 +15079,49 @@ xmlXPathEval(const xmlChar *str, xmlXPathContextPtr ctx) {
}
/**
+ * xmlXPathSetContextNode:
+ * @node: the node to to use as the context node
+ * @ctx: the XPath context
+ *
+ * Sets 'node' as the context node. The node must be in the same
+ * document as that associated with the context.
+ *
+ * Returns -1 in case of error or 0 if successful
+ */
+int
+xmlXPathSetContextNode(xmlNodePtr node, xmlXPathContextPtr ctx) {
+ if ((node == NULL) || (ctx == NULL))
+ return(-1);
+
+ if (node->doc == ctx->doc) {
+ ctx->node = node;
+ return(0);
+ }
+ return(-1);
+}
+
+/**
+ * xmlXPathNodeEval:
+ * @node: the node to to use as the context node
+ * @str: the XPath expression
+ * @ctx: the XPath context
+ *
+ * Evaluate the XPath Location Path in the given context. The node 'node'
+ * is set as the context node. The context node is not restored.
+ *
+ * Returns the xmlXPathObjectPtr resulting from the evaluation or NULL.
+ * the caller has to free the object.
+ */
+xmlXPathObjectPtr
+xmlXPathNodeEval(xmlNodePtr node, const xmlChar *str, xmlXPathContextPtr ctx) {
+ if (str == NULL)
+ return(NULL);
+ if (xmlXPathSetContextNode(node, ctx) < 0)
+ return(NULL);
+ return(xmlXPathEval(str, ctx));
+}
+
+/**
* xmlXPathEvalExpression:
* @str: the XPath expression
* @ctxt: the XPath context
diff --git a/xstc/Makefile.in b/xstc/Makefile.in
index 1df0fad..d2eeaf8 100644
--- a/xstc/Makefile.in
+++ b/xstc/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -15,6 +15,23 @@
@SET_MAKE@
VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -54,6 +71,11 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
SOURCES =
DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@@ -151,7 +173,6 @@ RANLIB = @RANLIB@
RDL_LIBS = @RDL_LIBS@
READER_TEST = @READER_TEST@
RELDATE = @RELDATE@
-RM = @RM@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
@@ -208,6 +229,7 @@ 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@