Imported Upstream version 2.11.5 upstream/2.11.5
authorTizenOpenSource <tizenopensrc@samsung.com>
Thu, 7 Dec 2023 04:31:41 +0000 (13:31 +0900)
committerTizenOpenSource <tizenopensrc@samsung.com>
Thu, 7 Dec 2023 04:31:41 +0000 (13:31 +0900)
541 files changed:
.editorconfig [new file with mode: 0644]
.gitignore
.gitlab-ci.yml
.gitlab-ci/Dockerfile [new file with mode: 0644]
.gitlab-ci/Test-Msvc.ps1 [new file with mode: 0644]
.gitlab-ci/llvm-symbolizer [new file with mode: 0755]
.gitlab-ci/setup_mingw.sh [new file with mode: 0644]
.gitlab-ci/test.sh [new file with mode: 0644]
.gitlab-ci/test_cmake.sh [new file with mode: 0644]
CMakeLists.txt
HTMLparser.c
HTMLtree.c
MAINTAINERS.md [new file with mode: 0644]
Makefile.am
Makefile.tests [deleted file]
NEWS
README.md
README.tests [deleted file]
SAX2.c
TODO [deleted file]
TODO_SCHEMAS [deleted file]
buf.c
buf.h [deleted file]
build_glob.py
c14n.c
catalog.c
check-relaxng-test-suite.py
check-relaxng-test-suite2.py
check-xinclude-test-suite.py
check-xml-test-suite.py
check-xsddata-test-suite.py
chvalid.c
config.h.cmake.in
configure.ac
debugXML.c
dict.c
doc/Makefile.am
doc/apibuild.py
doc/buildDocBookCatalog [deleted file]
doc/checkapisym.xsl [deleted file]
doc/devhelp/html.xsl
doc/devhelp/libxml2-HTMLparser.html
doc/devhelp/libxml2-HTMLtree.html
doc/devhelp/libxml2-SAX2.html
doc/devhelp/libxml2-dict.html
doc/devhelp/libxml2-encoding.html
doc/devhelp/libxml2-globals.html
doc/devhelp/libxml2-hash.html
doc/devhelp/libxml2-parser.html
doc/devhelp/libxml2-parserInternals.html
doc/devhelp/libxml2-threads.html
doc/devhelp/libxml2-tree.html
doc/devhelp/libxml2-uri.html
doc/devhelp/libxml2-valid.html
doc/devhelp/libxml2-xmlIO.html
doc/devhelp/libxml2-xmlerror.html
doc/devhelp/libxml2-xmlexports.html
doc/devhelp/libxml2-xmlmemory.html
doc/devhelp/libxml2-xmlreader.html
doc/devhelp/libxml2-xmlschemastypes.html
doc/devhelp/libxml2-xmlversion.html
doc/devhelp/libxml2-xmlwriter.html
doc/devhelp/libxml2-xpath.html
doc/devhelp/libxml2-xpathInternals.html
doc/devhelp/libxml2.devhelp2
doc/examples/examples.xml
doc/examples/index.html
doc/examples/index.py
doc/examples/parse4.c
doc/libxml-doc.el [deleted file]
doc/libxml2-api.xml
doc/symbols.xml [deleted file]
doc/syms.xsl [deleted file]
doc/xmlcatalog.1
doc/xmlcatalog.html
doc/xmlcatalog.xml
doc/xmllint.1
doc/xmllint.html
doc/xmllint.xml
enc.h [deleted file]
encoding.c
entities.c
error.c
fuzz/.gitignore
fuzz/Makefile.am
fuzz/fuzz.c
fuzz/fuzz.h
fuzz/genSeed.c
fuzz/html.c
fuzz/regexp.c
fuzz/schema.c
fuzz/static_seed/regexp/branch-1
fuzz/static_seed/regexp/branch-10
fuzz/static_seed/regexp/branch-11
fuzz/static_seed/regexp/branch-12
fuzz/static_seed/regexp/branch-13
fuzz/static_seed/regexp/branch-2
fuzz/static_seed/regexp/branch-3
fuzz/static_seed/regexp/branch-4
fuzz/static_seed/regexp/branch-5
fuzz/static_seed/regexp/branch-6
fuzz/static_seed/regexp/branch-7
fuzz/static_seed/regexp/branch-8
fuzz/static_seed/regexp/branch-9
fuzz/static_seed/regexp/bug316338-1
fuzz/static_seed/regexp/bug316338-10
fuzz/static_seed/regexp/bug316338-11
fuzz/static_seed/regexp/bug316338-12
fuzz/static_seed/regexp/bug316338-13
fuzz/static_seed/regexp/bug316338-14
fuzz/static_seed/regexp/bug316338-15
fuzz/static_seed/regexp/bug316338-16
fuzz/static_seed/regexp/bug316338-2
fuzz/static_seed/regexp/bug316338-3
fuzz/static_seed/regexp/bug316338-4
fuzz/static_seed/regexp/bug316338-5
fuzz/static_seed/regexp/bug316338-6
fuzz/static_seed/regexp/bug316338-7
fuzz/static_seed/regexp/bug316338-8
fuzz/static_seed/regexp/bug316338-9
fuzz/static_seed/regexp/bug420596-1
fuzz/static_seed/regexp/bug420596-2
fuzz/static_seed/regexp/bug420596-3
fuzz/static_seed/regexp/bug420596-4
fuzz/static_seed/regexp/bug420596-5
fuzz/static_seed/regexp/bug420596-6
fuzz/static_seed/regexp/bug420596-7
fuzz/static_seed/regexp/bug420596-8
fuzz/static_seed/regexp/content-1
fuzz/static_seed/regexp/content-10
fuzz/static_seed/regexp/content-2
fuzz/static_seed/regexp/content-3
fuzz/static_seed/regexp/content-4
fuzz/static_seed/regexp/content-5
fuzz/static_seed/regexp/content-6
fuzz/static_seed/regexp/content-7
fuzz/static_seed/regexp/content-8
fuzz/static_seed/regexp/content-9
fuzz/static_seed/regexp/hard-1
fuzz/static_seed/regexp/hard-10
fuzz/static_seed/regexp/hard-2
fuzz/static_seed/regexp/hard-3
fuzz/static_seed/regexp/hard-4
fuzz/static_seed/regexp/hard-5
fuzz/static_seed/regexp/hard-6
fuzz/static_seed/regexp/hard-7
fuzz/static_seed/regexp/hard-8
fuzz/static_seed/regexp/hard-9
fuzz/static_seed/regexp/ncname-1
fuzz/static_seed/regexp/ncname-2
fuzz/static_seed/regexp/ncname-3
fuzz/static_seed/regexp/ncname-4
fuzz/static_seed/regexp/ncname-5
fuzz/static_seed/regexp/ranges-1
fuzz/static_seed/regexp/ranges-10
fuzz/static_seed/regexp/ranges-11
fuzz/static_seed/regexp/ranges-12
fuzz/static_seed/regexp/ranges-2
fuzz/static_seed/regexp/ranges-3
fuzz/static_seed/regexp/ranges-4
fuzz/static_seed/regexp/ranges-5
fuzz/static_seed/regexp/ranges-6
fuzz/static_seed/regexp/ranges-7
fuzz/static_seed/regexp/ranges-8
fuzz/static_seed/regexp/ranges-9
fuzz/static_seed/regexp/ranges2-1
fuzz/static_seed/regexp/ranges2-10
fuzz/static_seed/regexp/ranges2-11
fuzz/static_seed/regexp/ranges2-12
fuzz/static_seed/regexp/ranges2-2
fuzz/static_seed/regexp/ranges2-3
fuzz/static_seed/regexp/ranges2-4
fuzz/static_seed/regexp/ranges2-5
fuzz/static_seed/regexp/ranges2-6
fuzz/static_seed/regexp/ranges2-7
fuzz/static_seed/regexp/ranges2-8
fuzz/static_seed/regexp/ranges2-9
fuzz/static_seed/regexp/xpath-1
fuzz/static_seed/regexp/xpath-10
fuzz/static_seed/regexp/xpath-11
fuzz/static_seed/regexp/xpath-12
fuzz/static_seed/regexp/xpath-13
fuzz/static_seed/regexp/xpath-14
fuzz/static_seed/regexp/xpath-15
fuzz/static_seed/regexp/xpath-16
fuzz/static_seed/regexp/xpath-17
fuzz/static_seed/regexp/xpath-18
fuzz/static_seed/regexp/xpath-19
fuzz/static_seed/regexp/xpath-2
fuzz/static_seed/regexp/xpath-20
fuzz/static_seed/regexp/xpath-21
fuzz/static_seed/regexp/xpath-22
fuzz/static_seed/regexp/xpath-23
fuzz/static_seed/regexp/xpath-24
fuzz/static_seed/regexp/xpath-25
fuzz/static_seed/regexp/xpath-26
fuzz/static_seed/regexp/xpath-27
fuzz/static_seed/regexp/xpath-28
fuzz/static_seed/regexp/xpath-29
fuzz/static_seed/regexp/xpath-3
fuzz/static_seed/regexp/xpath-30
fuzz/static_seed/regexp/xpath-31
fuzz/static_seed/regexp/xpath-32
fuzz/static_seed/regexp/xpath-33
fuzz/static_seed/regexp/xpath-34
fuzz/static_seed/regexp/xpath-35
fuzz/static_seed/regexp/xpath-4
fuzz/static_seed/regexp/xpath-5
fuzz/static_seed/regexp/xpath-6
fuzz/static_seed/regexp/xpath-7
fuzz/static_seed/regexp/xpath-8
fuzz/static_seed/regexp/xpath-9
fuzz/static_seed/uri/dot
fuzz/static_seed/uri/full
fuzz/testFuzzer.c
fuzz/uri.c
fuzz/valid.c [new file with mode: 0644]
fuzz/valid.options [new file with mode: 0644]
fuzz/xinclude.c [new file with mode: 0644]
fuzz/xinclude.options [new file with mode: 0644]
fuzz/xml.c
fuzz/xpath.c
genChRanges.py
genUnicode.py
gentest.py
globals.c
hash.c
include/Makefile.am
include/libxml/HTMLparser.h
include/libxml/HTMLtree.h
include/libxml/SAX.h
include/libxml/SAX2.h
include/libxml/c14n.h
include/libxml/catalog.h
include/libxml/chvalid.h
include/libxml/debugXML.h
include/libxml/dict.h
include/libxml/encoding.h
include/libxml/entities.h
include/libxml/globals.h
include/libxml/hash.h
include/libxml/list.h
include/libxml/nanoftp.h
include/libxml/nanohttp.h
include/libxml/parser.h
include/libxml/parserInternals.h
include/libxml/pattern.h
include/libxml/relaxng.h
include/libxml/schemasInternals.h
include/libxml/schematron.h
include/libxml/threads.h
include/libxml/tree.h
include/libxml/uri.h
include/libxml/valid.h
include/libxml/xinclude.h
include/libxml/xlink.h
include/libxml/xmlIO.h
include/libxml/xmlautomata.h
include/libxml/xmlerror.h
include/libxml/xmlexports.h
include/libxml/xmlmemory.h
include/libxml/xmlmodule.h
include/libxml/xmlreader.h
include/libxml/xmlregexp.h
include/libxml/xmlsave.h
include/libxml/xmlschemas.h
include/libxml/xmlschemastypes.h
include/libxml/xmlstring.h
include/libxml/xmlunicode.h
include/libxml/xmlversion.h.in
include/libxml/xmlwriter.h
include/libxml/xpath.h
include/libxml/xpathInternals.h
include/libxml/xpointer.h
include/private/Makefile.am [new file with mode: 0644]
include/private/buf.h [new file with mode: 0644]
include/private/dict.h [new file with mode: 0644]
include/private/enc.h [new file with mode: 0644]
include/private/entities.h [new file with mode: 0644]
include/private/error.h [new file with mode: 0644]
include/private/globals.h [new file with mode: 0644]
include/private/html.h [new file with mode: 0644]
include/private/io.h [new file with mode: 0644]
include/private/memory.h [new file with mode: 0644]
include/private/parser.h [new file with mode: 0644]
include/private/regexp.h [new file with mode: 0644]
include/private/save.h [new file with mode: 0644]
include/private/string.h [new file with mode: 0644]
include/private/threads.h [new file with mode: 0644]
include/private/tree.h [new file with mode: 0644]
include/private/xinclude.h [new file with mode: 0644]
include/private/xpath.h [new file with mode: 0644]
include/private/xzlib.h [new file with mode: 0644]
include/win32config.h
include/wsockcompat.h
libxml.h
libxml.m4
libxml.spec.in [deleted file]
libxml2.syms
m4/ax_append_flag.m4 [new file with mode: 0644]
m4/ax_append_link_flags.m4 [new file with mode: 0644]
m4/ax_check_link_flag.m4 [new file with mode: 0644]
m4/ax_require_defined.m4 [new file with mode: 0644]
nanoftp.c
nanohttp.c
optim/TOTRY [deleted file]
optim/hash_dict.patch [deleted file]
optim/hash_dict.txt [deleted file]
parser.c
parserInternals.c
pattern.c
python/Makefile.am
python/TODO [deleted file]
python/generator.py
python/libxml.c
python/libxml_wrap.h
python/setup.py.in
python/tests/attribs.py
python/tests/build.py
python/tests/compareNodes.py
python/tests/ctxterror.py
python/tests/cutnpaste.py
python/tests/dtdvalid.py
python/tests/error.py
python/tests/inbuf.py
python/tests/indexes.py
python/tests/input_callback.py
python/tests/nsdel.py
python/tests/outbuf.py
python/tests/push.py
python/tests/pushSAX.py
python/tests/pushSAXhtml.py
python/tests/reader.py
python/tests/reader2.py
python/tests/reader3.py
python/tests/reader4.py
python/tests/reader5.py
python/tests/reader6.py
python/tests/reader7.py
python/tests/reader8.py
python/tests/readererr.py
python/tests/readernext.py
python/tests/regexp.py
python/tests/relaxng.py
python/tests/resolver.py
python/tests/schema.py
python/tests/serialize.py
python/tests/sync.py
python/tests/thread2.py
python/tests/tst.py
python/tests/tstLastError.py
python/tests/tstURI.py
python/tests/tstmem.py
python/tests/tstxpath.py
python/tests/validDTD.py
python/tests/validRNG.py
python/tests/validSchemas.py
python/tests/validate.py
python/tests/walker.py
python/tests/xpath.py
python/tests/xpathext.py
python/tests/xpathleak.py
python/tests/xpathns.py
python/tests/xpathret.py
python/types.c
relaxng.c
result/HTML/doc3.htm
result/HTML/names.html [new file with mode: 0644]
result/HTML/names.html.err [new file with mode: 0644]
result/HTML/names.html.sax [new file with mode: 0644]
result/HTML/utf8bug.html
result/HTML/utf8bug.html.err
result/HTML/wired.html
result/URI/file.uri [new file with mode: 0644]
result/URI/port.uri [new file with mode: 0644]
result/URI/uri.data
result/VC/ElementValid5.rdr
result/VC/ElementValid6.rdr
result/VC/ElementValid7.rdr
result/VC/ElementValid8
result/VC/ElementValid8.rdr
result/XInclude/fallback.xml.err [new file with mode: 0644]
result/XInclude/fallback2.xml.err [new file with mode: 0644]
result/XInclude/fallback4.xml.err [new file with mode: 0644]
result/XInclude/fallback5.xml.err [new file with mode: 0644]
result/XInclude/fallback6.xml.err [new file with mode: 0644]
result/XInclude/fallback7.xml [new file with mode: 0644]
result/XInclude/fallback7.xml.err [new file with mode: 0644]
result/XInclude/invalid_char.xml.err [new file with mode: 0644]
result/XInclude/invalid_char.xml.rdr [new file with mode: 0644]
result/XInclude/issue424-1.xml [new file with mode: 0644]
result/XInclude/issue424-2.xml [new file with mode: 0644]
result/XInclude/loop.xml.err [new file with mode: 0644]
result/XInclude/max-recurse.xml.err [new file with mode: 0644]
result/XInclude/nodes3.xml [deleted file]
result/XInclude/nodes3.xml.err [new file with mode: 0644]
result/XInclude/ns1.xml.err [new file with mode: 0644]
result/XInclude/ns1.xml.rdr [deleted file]
result/XPath/expr/functions
result/boundaries1.xml [new file with mode: 0644]
result/boundaries1.xml.rde [new file with mode: 0644]
result/boundaries1.xml.rdr [new file with mode: 0644]
result/boundaries1.xml.sax [new file with mode: 0644]
result/boundaries1.xml.sax2 [new file with mode: 0644]
result/errors/754946.xml.ent
result/errors/754946.xml.err
result/errors/754946.xml.str
result/errors/754947.xml.ent
result/errors/754947.xml.err
result/errors/754947.xml.str
result/errors/759573-2.xml.ent
result/errors/759573-2.xml.err
result/errors/759573-2.xml.str
result/errors/759573.xml.ent
result/errors/759573.xml.err
result/errors/759573.xml.str
result/errors/759579.xml.ent
result/errors/759579.xml.err
result/errors/759579.xml.str
result/errors/cdata.xml.ent
result/errors/cdata.xml.err
result/errors/cdata.xml.str
result/errors/content1.xml.ent
result/errors/content1.xml.err
result/errors/content1.xml.str
result/errors/rec_att_default.xml.ent [new file with mode: 0644]
result/errors/rec_att_default.xml.err [new file with mode: 0644]
result/errors/rec_att_default.xml.str [new file with mode: 0644]
result/errors/rec_ext_ent.xml.ent
result/errors/utf8-1.xml.ent [new file with mode: 0644]
result/errors/utf8-1.xml.err [new file with mode: 0644]
result/errors/utf8-1.xml.str [new file with mode: 0644]
result/errors/utf8-2.xml.ent [new file with mode: 0644]
result/errors/utf8-2.xml.err [new file with mode: 0644]
result/errors/utf8-2.xml.str [new file with mode: 0644]
result/errors10/781205.xml.err
result/errors10/781361.xml.err
result/noent/boundaries1.xml [new file with mode: 0644]
result/noent/boundaries1.xml.sax2 [new file with mode: 0644]
result/schemas/issue491_0_0.err [new file with mode: 0644]
result/schemas/oss-fuzz-51295_0_0.err [new file with mode: 0644]
result/valid/781333.xml.err.rdr
result/valid/t8.xml.err
result/valid/t8.xml.err.rdr
result/valid/t8a.xml.err
result/valid/t8a.xml.err.rdr
runsuite.c
runtest.c
runxmlconf.c
save.h [deleted file]
schematron.c
test/HTML/names.html [new file with mode: 0644]
test/URI/file.uri [new file with mode: 0644]
test/URI/port.uri [new file with mode: 0644]
test/URI/uri.data
test/XInclude/docs/invalid_char.xml [new file with mode: 0644]
test/XInclude/ents/invalid_char.txt [new file with mode: 0644]
test/XInclude/without-reader/fallback7.xml [new file with mode: 0644]
test/XInclude/without-reader/issue424-1.xml [new file with mode: 0644]
test/XInclude/without-reader/issue424-2.xml [new file with mode: 0644]
test/XInclude/without-reader/loop.xml [new file with mode: 0644]
test/XInclude/without-reader/max-recurse.xml [new file with mode: 0644]
test/XInclude/without-reader/ns1.xml [moved from test/XInclude/docs/ns1.xml with 100% similarity]
test/XPath/expr/functions
test/boundaries1.xml [new file with mode: 0644]
test/errors/rec_att_default.xml [new file with mode: 0644]
test/errors/utf8-1.xml [new file with mode: 0644]
test/errors/utf8-2.xml [new file with mode: 0644]
test/recurse/g0.ent [new file with mode: 0644]
test/recurse/g1.ent [new file with mode: 0644]
test/recurse/g2.ent [new file with mode: 0644]
test/recurse/g3.ent [new file with mode: 0644]
test/recurse/ga.ent [new file with mode: 0644]
test/recurse/gb.ent [new file with mode: 0644]
test/recurse/gc.ent [new file with mode: 0644]
test/recurse/good.xml
test/recurse/good_attr.xml [new file with mode: 0644]
test/recurse/goodattr.xml [deleted file]
test/recurse/huge_dtd.xml [new file with mode: 0644]
test/recurse/lol3.xml [deleted file]
test/recurse/lol4.patch [deleted file]
test/recurse/lol_classic.xml [moved from test/recurse/lol5.xml with 100% similarity]
test/recurse/lol_eg.xml [new file with mode: 0644]
test/recurse/lol_ep.xml [new file with mode: 0644]
test/recurse/lol_ig_attr.xml [moved from test/recurse/lol2.xml with 100% similarity]
test/recurse/lol_ig_content.xml [moved from test/recurse/lol1.xml with 100% similarity]
test/recurse/lol_ip_content.dtd [new file with mode: 0644]
test/recurse/lol_ip_content.xml [new file with mode: 0644]
test/recurse/lol_ip_value.dtd [moved from test/recurse/lol3.dtd with 100% similarity]
test/recurse/lol_ip_value.xml [new file with mode: 0644]
test/recurse/lol_long_name.xml [moved from test/recurse/lol6.xml with 100% similarity]
test/recurse/lol_long_value.xml [moved from test/recurse/lol4.xml with 100% similarity]
test/recurse/lol_param.xml [new file with mode: 0644]
test/recurse/p0.ent [new file with mode: 0644]
test/recurse/p1.ent [new file with mode: 0644]
test/recurse/p2.ent [new file with mode: 0644]
test/recurse/p3.ent [new file with mode: 0644]
test/recurse/pa.ent [new file with mode: 0644]
test/recurse/pb.ent [new file with mode: 0644]
test/recurse/pc.ent [new file with mode: 0644]
test/schemas/issue491_0.xml [new file with mode: 0644]
test/schemas/issue491_0.xsd [new file with mode: 0644]
test/schemas/oss-fuzz-51295_0.xml [new file with mode: 0644]
test/schemas/oss-fuzz-51295_0.xsd [new file with mode: 0644]
testAutomata.c [deleted file]
testModule.c
testThreads.c
testapi.c
testchar.c
testdict.c
testlimits.c
testrecurse.c
threads.c
tree.c
uri.c
valid.c
win32/Makefile.bcb
win32/Makefile.mingw
win32/Makefile.msvc
win32/configure.js
win32/defgen.xsl [deleted file]
win32/libxml2.def.src [deleted file]
xinclude.c
xmlIO.c
xmlcatalog.c
xmllint.c
xmlmemory.c
xmlmodule.c
xmlreader.c
xmlregexp.c
xmlsave.c
xmlschemas.c
xmlschemastypes.c
xmlstring.c
xmlwriter.c
xpath.c
xpointer.c
xstc/fixup-tests.py
xstc/xstc.py
xzlib.c
xzlib.h [deleted file]

diff --git a/.editorconfig b/.editorconfig
new file mode 100644 (file)
index 0000000..273bb06
--- /dev/null
@@ -0,0 +1,15 @@
+# EditorConfig : http://EditorConfig.org
+
+root = true
+
+[Makefile*]
+indent_style = tab
+
+[CMakeLists.txt]
+indent_style = tab
+indent_size = 4
+
+[*.{c,h}]
+indent_style = space
+indent_size = 4
+tab_width = 8
index 5053db2..6f5dc0b 100644 (file)
@@ -64,7 +64,6 @@ libxml-2.0-uninstalled.pc
 libxml-2.0.pc
 libxml2-config.cmake
 libxml2.la
-libxml2.spec
 list
 ltmain.sh
 log
@@ -96,7 +95,6 @@ runxmlconf.log
 stamp-h1
 tags
 test.out
-testAutomata
 testModule
 testThreads
 testapi
index 8aa58e9..b547f24 100644 (file)
@@ -1,32 +1,13 @@
 .test:
-  # The image was generated with the following Dockerfile. It is also used
-  # for libxslt, that's why we need git and libgcrypt-dev.
-  #
-  # FROM ubuntu:20.04
-  # ENV DEBIAN_FRONTEND=noninteractive
-  # RUN apt-get update && \
-  #     apt-get upgrade -y && \
-  #     apt-get install -y --no-install-recommends \
-  #         curl git ca-certificates \
-  #         autoconf automake libtool pkg-config \
-  #         make gcc clang llvm \
-  #         zlib1g-dev liblzma-dev libgcrypt-dev \
-  #         python-dev python3-dev \
-  #         cmake
-  # WORKDIR /tests
-  # RUN curl https://www.w3.org/XML/Test/xmlts20080827.tar.gz |tar xz
   image: registry.gitlab.gnome.org/gnome/libxml2
   variables:
     BASE_CONFIG: "--with-ftp --with-legacy --with-xptr-locs"
+  before_script:
+    - rm -rf libxml2-build
+    - mkdir libxml2-build
+    - ln -s /tests/xmlconf libxml2-build
   script:
-    - |
-      rm -rf build
-      mkdir build
-      cd build
-      ln -s /tests/xmlconf
-      sh ../autogen.sh $BASE_CONFIG $CONFIG
-      make -j$(nproc) V=1 CFLAGS="$CFLAGS -Werror"
-      make CFLAGS="$CFLAGS -Werror" check
+    - sh .gitlab-ci/test.sh
 
 gcc:
   extends: .test
@@ -42,60 +23,92 @@ gcc:minimum:
 gcc:python3:
   extends: .test
   variables:
-    # TODO: Re-enable the warning after #208 is fixed.
-    CFLAGS: "-O2 -Wno-error=deprecated-declarations"
+    CFLAGS: "-O2"
     PYTHON: "/usr/bin/python3"
 
 gcc:static:
   extends: .test
   variables:
-    CONFIG: "--disable-shared --without-python"
+    CONFIG: "--disable-shared --without-python --without-modules"
     CFLAGS: "-O2"
 
 clang:asan:
   extends: .test
+  tags:
+    - asan
   variables:
     CONFIG: "--without-python"
     CC: clang
-    CFLAGS: "-O2 -g -fno-omit-frame-pointer -fsanitize=address,undefined,unsigned-integer-overflow,implicit-conversion -fno-sanitize-recover=all -Wno-error=cast-align"
-    # LeakSanitizer requires SYS_CAP_PTRACE
-    ASAN_OPTIONS: "detect_leaks=0"
+    CFLAGS: "-O2 -g -fno-omit-frame-pointer -fsanitize=address,undefined,integer -fno-sanitize-recover=all -Wno-error=cast-align"
     UBSAN_OPTIONS: "print_stacktrace=1"
+    ASAN_SYMBOLIZER_PATH: "$CI_PROJECT_DIR/.gitlab-ci/llvm-symbolizer"
 
 clang:msan:
   extends: .test
-  only:
-    - schedules
+#  only:
+#    - schedules
   variables:
     CONFIG: "--without-python --without-zlib --without-lzma"
     CC: clang
     CFLAGS: "-O2 -g -fno-omit-frame-pointer -fsanitize=memory -Wno-error=cast-align"
+    MSAN_SYMBOLIZER_PATH: "$CI_PROJECT_DIR/.gitlab-ci/llvm-symbolizer"
+
+.mingw:
+  tags:
+    - win32-ps
+  variables:
+    BASE_CONFIG: "--with-ftp --with-legacy --with-xptr-locs"
+    CHERE_INVOKING: "yes"
+  before_script:
+    - $Env:Path="C:\msys64\usr\bin;$Env:Path"
+    - bash -lc 'sh .gitlab-ci/setup_mingw.sh autotools'
+  script:
+    - bash -lc 'sh .gitlab-ci/test.sh'
+  cache:
+    key: "$MSYSTEM"
+    paths:
+      - libxml2-build/xmlconf/
+
+mingw:w64-x86_64:shared:
+  extends: .mingw
+  variables:
+    CFLAGS: "-O2"
+    MSYSTEM: MINGW64
+
+mingw:w64-i686:shared:
+  extends: .mingw
+  only:
+    - schedules
+  variables:
+    CFLAGS: "-O2"
+    MSYSTEM: MINGW32
+
+# Disabled, GCC missing?
+.mingw:msys:shared:
+  extends: .mingw
+  variables:
+    CFLAGS: "-O2"
+    MSYSTEM: MSYS
 
 .cmake:linux:
   image: registry.gitlab.gnome.org/gnome/libxml2
+  before_script:
+    - rm -rf libxml2-build
+    - mkdir libxml2-build
+    - ln -s /tests/xmlconf libxml2-build
   script:
-    - cmake -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS -DCMAKE_INSTALL_PREFIX=libxml2-install -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLIBXML2_XMLCONF_WORKING_DIR=/tests -S . -B libxml2-build
-    - cmake --build libxml2-build --target install
-    - mkdir -p libxml2-install/share/libxml2
-    - cp Copyright libxml2-install/share/libxml2
-    - cd libxml2-build
-    - ctest -VV
-  after_script:
-    - cd libxml2-install
-    - tar -czf ../libxml2-$CI_COMMIT_SHORT_SHA-$CC-$SUFFIX.tar.gz *
+    - sh .gitlab-ci/test_cmake.sh
   artifacts:
     paths:
-      - libxml2-$CI_COMMIT_SHORT_SHA-$CC-$SUFFIX.tar.gz
+      - libxml2-$CI_COMMIT_SHORT_SHA-$SUFFIX.tar.gz
     expire_in: 1 day
 
 cmake:linux:gcc:shared:
   extends: .cmake:linux
-  only:
-    - schedules
   variables:
     BUILD_SHARED_LIBS: "ON"
     CC: gcc
-    SUFFIX: shared
+    SUFFIX: linux-gcc-shared
 
 cmake:linux:gcc:static:
   extends: .cmake:linux
@@ -104,7 +117,7 @@ cmake:linux:gcc:static:
   variables:
     BUILD_SHARED_LIBS: "OFF"
     CC: gcc
-    SUFFIX: static
+    SUFFIX: linux-gcc-static
 
 cmake:linux:clang:shared:
   extends: .cmake:linux
@@ -113,7 +126,8 @@ cmake:linux:clang:shared:
   variables:
     BUILD_SHARED_LIBS: "ON"
     CC: clang
-    SUFFIX: shared
+    CFLAGS: "-Wno-error=cast-align"
+    SUFFIX: linux-clang-shared
 
 cmake:linux:clang:static:
   extends: .cmake:linux
@@ -122,48 +136,26 @@ cmake:linux:clang:static:
   variables:
     BUILD_SHARED_LIBS: "OFF"
     CC: clang
-    SUFFIX: static
+    CFLAGS: "-Wno-error=cast-align"
+    SUFFIX: linux-clang-static
 
 .cmake:mingw:
   tags:
     - win32-ps
+  variables:
+    CHERE_INVOKING: "yes"
   before_script:
-    - "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12"
-    - $Env:Path="C:\msys64\$Env:MINGW_PATH\bin;C:\msys64\usr\bin;$Env:Path"
-    - pacman --noconfirm -Syu
-    - pacman --noconfirm -S
-        $Env:MINGW_PACKAGE_PREFIX-cmake
-        $Env:MINGW_PACKAGE_PREFIX-libiconv
-        $Env:MINGW_PACKAGE_PREFIX-ninja
-        $Env:MINGW_PACKAGE_PREFIX-python
-        $Env:MINGW_PACKAGE_PREFIX-python2
-        $Env:MINGW_PACKAGE_PREFIX-xz
-        $Env:MINGW_PACKAGE_PREFIX-zlib
-    - if (-not (Test-Path 7za.exe)) {
-        Invoke-WebRequest -Uri https://www.7-zip.org/a/7z1900-extra.7z -OutFile 7z1900-extra.7z ;
-        cmake -E tar xf 7z1900-extra.7z 7za.exe
-      }
-    - if (-not (Test-Path libxml2-build/xmlconf)) {
-        Invoke-WebRequest -Uri https://www.w3.org/XML/Test/xmlts20080827.tar.gz -OutFile xmlts20080827.tar.gz ;
-        .\7za.exe x xmlts20080827.tar.gz -olibxml2-build
-      }
+    - $Env:Path="C:\msys64\usr\bin;$Env:Path"
+    - bash -lc 'sh .gitlab-ci/setup_mingw.sh cmake ninja'
   script:
-    - cmake -G Ninja -DBUILD_SHARED_LIBS="$Env:BUILD_SHARED_LIBS" -DCMAKE_INSTALL_PREFIX=libxml2-install -DCMAKE_BUILD_TYPE=RelWithDebInfo -S . -B libxml2-build
-    - cmake --build libxml2-build --target install
-    - New-Item -ItemType Directory libxml2-install\share\libxml2
-    - Copy-Item Copyright libxml2-install\share\libxml2
-    - cd libxml2-build
-    - ctest -VV
-  after_script:
-    - .\7za.exe a libxml2-$Env:CI_COMMIT_SHORT_SHA-$Env:MINGW_PACKAGE_PREFIX-$Env:SUFFIX.7z .\libxml2-install\*
+    - bash -lc 'sh .gitlab-ci/test_cmake.sh -G Ninja'
   cache:
-    key: "$MINGW_PACKAGE_PREFIX"
+    key: "$MSYSTEM"
     paths:
       - libxml2-build/xmlconf/
-      - 7za.exe
   artifacts:
     paths:
-      - libxml2-$Env:CI_COMMIT_SHORT_SHA-$Env:MINGW_PACKAGE_PREFIX-$Env:SUFFIX.7z
+      - libxml2-$Env:CI_COMMIT_SHORT_SHA-$Env:SUFFIX.tar.gz
     expire_in: 1 day
 
 cmake:mingw:w64-i686:shared:
@@ -172,9 +164,8 @@ cmake:mingw:w64-i686:shared:
     - schedules
   variables:
     BUILD_SHARED_LIBS: "ON"
-    MINGW_PACKAGE_PREFIX: mingw-w64-i686
-    MINGW_PATH: mingw32
-    SUFFIX: shared
+    MSYSTEM: MINGW32
+    SUFFIX: mingw-w64-i686-shared
 
 cmake:mingw:w64-i686:static:
   extends: .cmake:mingw
@@ -182,17 +173,15 @@ cmake:mingw:w64-i686:static:
     - schedules
   variables:
     BUILD_SHARED_LIBS: "OFF"
-    MINGW_PACKAGE_PREFIX: mingw-w64-i686
-    MINGW_PATH: mingw32
-    SUFFIX: static
+    MSYSTEM: MINGW32
+    SUFFIX: mingw-w64-i686-static
 
 cmake:mingw:w64-x86_64:shared:
   extends: .cmake:mingw
   variables:
     BUILD_SHARED_LIBS: "ON"
-    MINGW_PACKAGE_PREFIX: mingw-w64-x86_64
-    MINGW_PATH: mingw64
-    SUFFIX: shared
+    MSYSTEM: MINGW64
+    SUFFIX: mingw-w64-x86_64-shared
 
 cmake:mingw:w64-x86_64:static:
   extends: .cmake:mingw
@@ -200,41 +189,19 @@ cmake:mingw:w64-x86_64:static:
     - schedules
   variables:
     BUILD_SHARED_LIBS: "OFF"
-    MINGW_PACKAGE_PREFIX: mingw-w64-x86_64
-    MINGW_PATH: mingw64
-    SUFFIX: static
+    MSYSTEM: MINGW64
+    SUFFIX: mingw-w64-x86_64-static
 
 .cmake:msvc:
   tags:
     - win32-ps
   variables:
+    # MSVC warns when casting `const char **` to `void *` which is wrong.
+    # Disable warning C4090.
+    CFLAGS: /WX /wd4090
     CMAKE_VERSION: 3.19.4
-  before_script:
-    - "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12"
-    - if (-not (Test-Path cmake-$Env:CMAKE_VERSION-win64-x64)) {
-        Invoke-WebRequest -Uri http://github.com/Kitware/CMake/releases/download/v$Env:CMAKE_VERSION/cmake-$Env:CMAKE_VERSION-win64-x64.zip -OutFile cmake-$Env:CMAKE_VERSION-win64-x64.zip ;
-        Expand-Archive cmake-$Env:CMAKE_VERSION-win64-x64.zip -DestinationPath .
-      }
-    - $Env:Path="$Env:CI_PROJECT_DIR\cmake-$Env:CMAKE_VERSION-win64-x64\bin;$Env:Path"
-    - if (-not (Test-Path 7za.exe)) {
-        Invoke-WebRequest -Uri https://www.7-zip.org/a/7z1900-extra.7z -OutFile 7z1900-extra.7z ;
-        cmake -E tar xf 7z1900-extra.7z 7za.exe
-      }
-    - if (-not (Test-Path libxml2-build/xmlconf)) {
-        Invoke-WebRequest -Uri https://www.w3.org/XML/Test/xmlts20080827.tar.gz -OutFile xmlts20080827.tar.gz ;
-        .\7za.exe x xmlts20080827.tar.gz -olibxml2-build
-      }
   script:
-    - cmake -DBUILD_SHARED_LIBS="$Env:BUILD_SHARED_LIBS" -DCMAKE_INSTALL_PREFIX=libxml2-install -DLIBXML2_WITH_ICONV=OFF -DLIBXML2_WITH_LZMA=OFF -DLIBXML2_WITH_PYTHON=OFF -DLIBXML2_WITH_ZLIB=OFF -S . -B libxml2-build
-    - cmake --build libxml2-build --config Debug --target install
-    - cmake --build libxml2-build --config Release --target install
-    - New-Item -ItemType Directory libxml2-install\share\libxml2
-    - Copy-Item Copyright libxml2-install\share\libxml2
-    - cd libxml2-build
-    - ctest -C Debug -VV
-    - ctest -C Release -VV
-  after_script:
-    - .\7za.exe a libxml2-$Env:CI_COMMIT_SHORT_SHA-$Env:CMAKE_GENERATOR_TOOLSET-$Env:CMAKE_GENERATOR_PLATFORM-$Env:SUFFIX.7z .\libxml2-install\*
+    - .gitlab-ci/Test-Msvc
   cache:
     key: "msvc"
     paths:
diff --git a/.gitlab-ci/Dockerfile b/.gitlab-ci/Dockerfile
new file mode 100644 (file)
index 0000000..3937c7d
--- /dev/null
@@ -0,0 +1,16 @@
+# The image is also used for libxslt, that's why we need git and
+# libgcrypt-dev.
+
+FROM ubuntu:22.10
+ENV DEBIAN_FRONTEND=noninteractive
+RUN apt-get update && \
+    apt-get upgrade -y && \
+    apt-get install -y --no-install-recommends \
+        curl git ca-certificates \
+        autoconf automake libtool pkg-config \
+        make gcc clang llvm \
+        zlib1g-dev liblzma-dev libgcrypt-dev \
+        python2-dev python3-dev \
+        cmake
+WORKDIR /tests
+RUN curl https://www.w3.org/XML/Test/xmlts20080827.tar.gz |tar xz
diff --git a/.gitlab-ci/Test-Msvc.ps1 b/.gitlab-ci/Test-Msvc.ps1
new file mode 100644 (file)
index 0000000..796d75c
--- /dev/null
@@ -0,0 +1,49 @@
+[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
+
+if (-not (Test-Path cmake-$Env:CMAKE_VERSION-win64-x64)) {
+    Invoke-WebRequest `
+        -Uri http://github.com/Kitware/CMake/releases/download/v$Env:CMAKE_VERSION/cmake-$Env:CMAKE_VERSION-win64-x64.zip `
+        -OutFile cmake-$Env:CMAKE_VERSION-win64-x64.zip
+    Expand-Archive cmake-$Env:CMAKE_VERSION-win64-x64.zip -DestinationPath .
+}
+$Env:Path="$Env:CI_PROJECT_DIR\cmake-$Env:CMAKE_VERSION-win64-x64\bin;$Env:Path"
+
+if (-not (Test-Path 7za.exe)) {
+    Invoke-WebRequest `
+        -Uri https://www.7-zip.org/a/7z1900-extra.7z `
+        -OutFile 7z1900-extra.7z
+    cmake -E tar xf 7z1900-extra.7z 7za.exe
+}
+
+if (-not (Test-Path libxml2-build/xmlconf)) {
+    Invoke-WebRequest `
+        -Uri https://www.w3.org/XML/Test/xmlts20080827.tar.gz `
+        -OutFile xmlts20080827.tar.gz ;
+    .\7za.exe x xmlts20080827.tar.gz -olibxml2-build
+}
+
+cmake `
+    -DBUILD_SHARED_LIBS="$Env:BUILD_SHARED_LIBS" `
+    -DCMAKE_INSTALL_PREFIX=libxml2-install `
+    -DLIBXML2_WITH_ICONV=OFF `
+    -DLIBXML2_WITH_LZMA=OFF `
+    -DLIBXML2_WITH_PYTHON=OFF `
+    -DLIBXML2_WITH_ZLIB=OFF `
+    -S . -B libxml2-build
+cmake --build libxml2-build --config Debug --target install
+cmake --build libxml2-build --config Release --target install
+New-Item -ItemType Directory libxml2-install\share\libxml2
+Copy-Item Copyright libxml2-install\share\libxml2
+
+cd libxml2-build
+ctest -C Debug -VV
+if ($LastExitCode -ne 0) {
+    throw "ctest failed"
+}
+ctest -C Release -VV
+if ($LastExitCode -ne 0) {
+    throw "ctest failed"
+}
+cd ..
+
+.\7za.exe a libxml2-$Env:CI_COMMIT_SHORT_SHA-$Env:CMAKE_GENERATOR_TOOLSET-$Env:CMAKE_GENERATOR_PLATFORM-$Env:SUFFIX.7z .\libxml2-install\*
diff --git a/.gitlab-ci/llvm-symbolizer b/.gitlab-ci/llvm-symbolizer
new file mode 100755 (executable)
index 0000000..cfc85e8
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Newer versions of llvm-symbolizer require libxml2 themselves. Running
+# a test program with LD_LIBRARY_PATH set to .libs makes llvm-symbolizer
+# pick up the tested development version of libxml2 which breaks
+# completely if the build is instrumented with ASan. This wrapper script
+# invokes llvm-symbolizer with an empty LD_LIBRARY_PATH.
+
+LD_LIBRARY_PATH='' llvm-symbolizer "$@"
diff --git a/.gitlab-ci/setup_mingw.sh b/.gitlab-ci/setup_mingw.sh
new file mode 100644 (file)
index 0000000..7e61c34
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+pacman --noconfirm -Syu
+
+prefix=
+if [ -n "$MINGW_PACKAGE_PREFIX" ]; then
+    prefix="${MINGW_PACKAGE_PREFIX}-"
+fi
+for module in libiconv python xz zlib "$@"; do
+    pacman --noconfirm -S --needed ${prefix}$module
+done
+
+if [ ! -e libxml2-build/xmlconf ]; then
+    mkdir -p libxml2-build
+    wget https://www.w3.org/XML/Test/xmlts20080827.tar -O - |
+       tar -x -C libxml2-build
+fi
diff --git a/.gitlab-ci/test.sh b/.gitlab-ci/test.sh
new file mode 100644 (file)
index 0000000..0d8942f
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+set -e
+
+cd libxml2-build
+sh ../autogen.sh $BASE_CONFIG $CONFIG
+make -j$(nproc) V=1 CFLAGS="$CFLAGS -Werror"
+make CFLAGS="$CFLAGS -Werror" check
diff --git a/.gitlab-ci/test_cmake.sh b/.gitlab-ci/test_cmake.sh
new file mode 100644 (file)
index 0000000..99c22a8
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+set -e
+
+CFLAGS="-Werror $CFLAGS" \
+cmake "$@" \
+    -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \
+    -DCMAKE_INSTALL_PREFIX=libxml2-install \
+    -DCMAKE_BUILD_TYPE=RelWithDebInfo \
+    -S . -B libxml2-build
+cmake --build libxml2-build --target install
+
+(cd libxml2-build && ctest -VV)
+
+mkdir -p libxml2-install/share/libxml2
+cp Copyright libxml2-install/share/libxml2
+(cd libxml2-install &&
+    tar -czf ../libxml2-$CI_COMMIT_SHORT_SHA-$SUFFIX.tar.gz *)
index 730aec7..834b35d 100644 (file)
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.15)
+cmake_minimum_required(VERSION 3.18)
 
 file(STRINGS "configure.ac" CONFIGURE_AC_LINES)
 foreach(line ${CONFIGURE_AC_LINES})
@@ -16,6 +16,7 @@ include(CheckCSourceCompiles)
 include(CheckFunctionExists)
 include(CheckIncludeFiles)
 include(CheckLibraryExists)
+include(CheckLinkerFlag)
 include(CheckStructHasMember)
 include(CheckSymbolExists)
 include(CMakePackageConfigHelpers)
@@ -44,7 +45,6 @@ option(LIBXML2_WITH_PUSH "Add the PUSH parser interfaces" ON)
 option(LIBXML2_WITH_PYTHON "Build Python bindings" ON)
 option(LIBXML2_WITH_READER "Add the xmlReader parsing interface" ON)
 option(LIBXML2_WITH_REGEXPS "Add Regular Expressions support" ON)
-option(LIBXML2_WITH_RUN_DEBUG "Add the runtime debugging module" OFF)
 option(LIBXML2_WITH_SAX1 "Add the older SAX1 interface" ON)
 option(LIBXML2_WITH_SCHEMAS "Add Relax-NG and Schemas support" ON)
 option(LIBXML2_WITH_SCHEMATRON "Add Schematron support" ON)
@@ -78,15 +78,10 @@ endif()
 if(LIBXML2_WITH_PYTHON)
        check_include_files(unistd.h HAVE_UNISTD_H)
        check_symbol_exists(F_GETFL fcntl.h HAVE_F_GETFL)
-       if(HAVE_UNISTD_H AND HAVE_F_GETFL)
-               find_package(Python COMPONENTS Interpreter Development REQUIRED)
-       else()
-               find_package(Python2 COMPONENTS Interpreter Development REQUIRED)
-               add_library(Python::Python ALIAS Python2::Python)
-               set(Python_EXECUTABLE ${Python2_EXECUTABLE})
-               set(Python_SITEARCH ${Python2_SITEARCH})
-       endif()
-       set(LIBXML2_PYTHON_INSTALL_DIR ${Python_SITEARCH} CACHE PATH "Python bindings install directory")
+       find_package(Python COMPONENTS Interpreter Development REQUIRED)
+        #set(LIBXML2_PYTHON_INSTALL_DIR ${Python_SITEARCH} CACHE PATH "Python bindings install directory")
+        set(LIBXML2_PYTHON_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/python"
+           CACHE PATH "Python bindings install directory")
 endif()
 
 if(LIBXML2_WITH_THREADS)
@@ -97,7 +92,7 @@ if(LIBXML2_WITH_ZLIB)
        find_package(ZLIB REQUIRED)
 endif()
 
-foreach(VARIABLE IN ITEMS WITH_AUTOMATA WITH_C14N WITH_CATALOG WITH_DEBUG WITH_EXPR WITH_FTP WITH_HTML WITH_HTTP WITH_ICONV WITH_ICU WITH_ISO8859X WITH_LEGACY WITH_LZMA WITH_MEM_DEBUG WITH_MODULES WITH_OUTPUT WITH_PATTERN WITH_PUSH WITH_READER WITH_REGEXPS WITH_RUN_DEBUG WITH_SAX1 WITH_SCHEMAS WITH_SCHEMATRON WITH_THREADS WITH_THREAD_ALLOC WITH_TREE WITH_TRIO WITH_UNICODE WITH_VALID WITH_WRITER WITH_XINCLUDE WITH_XPATH WITH_XPTR WITH_XPTR_LOCS WITH_ZLIB)
+foreach(VARIABLE IN ITEMS WITH_AUTOMATA WITH_C14N WITH_CATALOG WITH_DEBUG WITH_EXPR WITH_FTP WITH_HTML WITH_HTTP WITH_ICONV WITH_ICU WITH_ISO8859X WITH_LEGACY WITH_LZMA WITH_MEM_DEBUG WITH_MODULES WITH_OUTPUT WITH_PATTERN WITH_PUSH WITH_READER WITH_REGEXPS WITH_SAX1 WITH_SCHEMAS WITH_SCHEMATRON WITH_THREADS WITH_THREAD_ALLOC WITH_TREE WITH_TRIO WITH_UNICODE WITH_VALID WITH_WRITER WITH_XINCLUDE WITH_XPATH WITH_XPTR WITH_XPTR_LOCS WITH_ZLIB)
        if(LIBXML2_${VARIABLE})
                set(${VARIABLE} 1)
        else()
@@ -144,22 +139,7 @@ if (NOT MSVC)
        if(HAVE_ATTRIBUTE_DESTRUCTOR)
                set(ATTRIBUTE_DESTRUCTOR "__attribute__((destructor))")
        endif()
-       check_c_source_compiles("
-               #include <netdb.h>
-               int main() { (void) gethostbyname((const char*) \"\"); return 0; }
-       " GETHOSTBYNAME_ARG_CAST_CONST)
-       if(NOT GETHOSTBYNAME_ARG_CAST_CONST)
-               set(GETHOSTBYNAME_ARG_CAST "(char *)")
-       else()
-               set(GETHOSTBYNAME_ARG_CAST "/**/")
-       endif()
        check_include_files(arpa/inet.h HAVE_ARPA_INET_H)
-       check_include_files(arpa/nameser.h HAVE_ARPA_NAMESER_H)
-       check_struct_has_member("struct sockaddr_storage" ss_family "sys/socket.h;sys/types.h" HAVE_SS_FAMILY)
-       check_struct_has_member("struct sockaddr_storage" __ss_family "sys/socket.h;sys/types.h" HAVE_BROKEN_SS_FAMILY)
-       if(HAVE_BROKEN_SS_FAMILY)
-               set(ss_family __ss_family)
-       endif()
        check_function_exists(class HAVE_CLASS)
        check_include_files(dlfcn.h HAVE_DLFCN_H)
        check_library_exists(dl dlopen "" HAVE_DLOPEN)
@@ -167,7 +147,6 @@ if (NOT MSVC)
        check_include_files(fcntl.h HAVE_FCNTL_H)
        check_function_exists(fpclass HAVE_FPCLASS)
        check_function_exists(ftime HAVE_FTIME)
-       check_function_exists(getaddrinfo HAVE_GETADDRINFO)
        check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
        check_include_files(inttypes.h HAVE_INTTYPES_H)
        check_function_exists(isascii HAVE_ISASCII)
@@ -180,7 +159,6 @@ if (NOT MSVC)
        check_include_files(poll.h HAVE_POLL_H)
        check_function_exists(putenv HAVE_PUTENV)
        check_function_exists(rand_r HAVE_RAND_R)
-       check_include_files(resolv.h HAVE_RESOLV_H)
        check_library_exists(dld shl_load "" HAVE_SHLLOAD)
        check_function_exists(stat HAVE_STAT)
        check_include_files(stdint.h HAVE_STDINT_H)
@@ -190,22 +168,11 @@ if (NOT MSVC)
        check_include_files(sys/stat.h HAVE_SYS_STAT_H)
        check_include_files(sys/timeb.h HAVE_SYS_TIMEB_H)
        check_include_files(sys/time.h HAVE_SYS_TIME_H)
-       check_include_files(sys/types.h HAVE_SYS_TYPES_H)
        check_include_files(unistd.h HAVE_UNISTD_H)
-       check_function_exists(va_copy HAVE_VA_COPY)
-       check_function_exists(__va_copy HAVE___VA_COPY)
+       check_symbol_exists(va_copy stdarg.h HAVE_VA_COPY)
+       check_symbol_exists(__va_copy stdarg.h HAVE___VA_COPY)
        set(LT_OBJDIR ".libs/")
        check_c_source_compiles("
-               #include <sys/socket.h>
-               #include <sys/types.h>
-               int main() { (void) send(1, (const char*) \"\", 1, 1); return 0; }
-       " SEND_ARG2_CAST_CONST)
-       if(NOT SEND_ARG2_CAST_CONST)
-               set(SEND_ARG2_CAST "(char *)")
-       else()
-               set(SEND_ARG2_CAST "/**/")
-       endif()
-       check_c_source_compiles("
                #include <stdarg.h>
                void a(va_list* ap) {};
                int main() { va_list ap1, ap2; a(&ap1); ap2 = (va_list) ap1; return 0; }
@@ -218,7 +185,6 @@ if (NOT MSVC)
        check_c_source_compiles("
                #include <stddef.h>
                #include <sys/socket.h>
-               #include <sys/types.h>
                int main() { (void) getsockopt(1, 1, 1, NULL, (socklen_t*) NULL); return 0; }
        " XML_SOCKLEN_T_SOCKLEN_T)
        if(XML_SOCKLEN_T_SOCKLEN_T)
@@ -227,7 +193,6 @@ if (NOT MSVC)
                check_c_source_compiles("
                        #include <stddef.h>
                        #include <sys/socket.h>
-                       #include <sys/types.h>
                        int main() { (void) getsockopt(1, 1, 1, NULL, (size_t*) NULL); return 0; }
                " XML_SOCKLEN_T_SIZE_T)
                if(XML_SOCKLEN_T_SIZE_T)
@@ -236,7 +201,6 @@ if (NOT MSVC)
                        check_c_source_compiles("
                                #include <stddef.h>
                                #include <sys/socket.h>
-                               #include <sys/types.h>
                                int main() { (void) getsockopt (1, 1, 1, NULL, (int*) NULL); return 0; }
                        " XML_SOCKLEN_T_INT)
                        set(XML_SOCKLEN_T int)
@@ -363,21 +327,28 @@ add_library(LibXml2::LibXml2 ALIAS LibXml2)
 target_compile_definitions(LibXml2 PRIVATE SYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}")
 
 if(NOT BUILD_SHARED_LIBS)
-       target_compile_definitions(LibXml2 INTERFACE LIBXML_STATIC)
+       target_compile_definitions(LibXml2 PUBLIC LIBXML_STATIC)
        set(XML_CFLAGS "-DLIBXML_STATIC")
 endif()
 
-if(BUILD_SHARED_LIBS AND UNIX AND NOT APPLE)
-       if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID STREQUAL "GNU")
-               target_link_options(LibXml2 PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libxml2.syms")
+if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID STREQUAL "GNU")
+       set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra -Wshadow \
+-Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return \
+-Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline \
+-Wredundant-decls -Wno-long-long -Wno-format-extra-args")
+
+       if(BUILD_SHARED_LIBS AND UNIX AND NOT APPLE)
+               check_linker_flag(C "LINKER:--undefined-version" FLAG_UNDEFINED_VERSION)
+               if (FLAG_UNDEFINED_VERSION)
+                       target_link_options(LibXml2 PRIVATE "LINKER:--undefined-version")
+               endif()
+               target_link_options(LibXml2 PRIVATE "LINKER:--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libxml2.syms")
        endif()
 endif()
 
 if(LIBXML2_WITH_THREADS)
        target_compile_definitions(LibXml2 PRIVATE _REENTRANT)
-       if(WIN32)
-               target_compile_definitions(LibXml2 PRIVATE HAVE_WIN32_THREADS)
-       else()
+        if(NOT WIN32)
                check_include_files(pthread.h HAVE_PTHREAD_H)
        endif()
 endif()
@@ -390,14 +361,16 @@ target_include_directories(
        $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}/libxml2>
 )
 
-if(HAVE_DLOPEN)
-       target_link_libraries(LibXml2 PRIVATE dl)
-       set(MODULE_PLATFORM_LIBS "-ldl")
-endif()
+if(LIBXML2_WITH_MODULES)
+       if(HAVE_DLOPEN)
+               target_link_libraries(LibXml2 PRIVATE dl)
+               set(MODULE_PLATFORM_LIBS "-ldl")
+       endif()
 
-if(HAVE_SHLLOAD)
-       target_link_libraries(LibXml2 PRIVATE dld)
-       set(MODULE_PLATFORM_LIBS "-ldld")
+       if(HAVE_SHLLOAD)
+               target_link_libraries(LibXml2 PRIVATE dld)
+               set(MODULE_PLATFORM_LIBS "-ldld")
+       endif()
 endif()
 
 if(UNIX)
@@ -407,7 +380,7 @@ endif()
 
 if(WIN32)
        target_link_libraries(LibXml2 PRIVATE ws2_32)
-       set(WIN32_EXTRA_LIBADD "-lws2_32")
+       set(WINSOCK_LIBS "-lws2_32")
 endif()
 
 if(LIBXML2_WITH_ICONV)
@@ -449,6 +422,7 @@ set_target_properties(
        POSITION_INDEPENDENT_CODE ON
        PREFIX lib
        VERSION ${PROJECT_VERSION}
+        SOVERSION ${LIBXML_MAJOR_VERSION}
 )
 
 if(MSVC)
@@ -513,7 +487,6 @@ if(LIBXML2_WITH_TESTS)
                runxmlconf
                runsuite
                testapi
-               testAutomata
                testchar
                testdict
                testModule
@@ -528,13 +501,11 @@ if(LIBXML2_WITH_TESTS)
        endforeach()
        if(Threads_FOUND)
                foreach(TEST runtest testThreads)
-                       if(WIN32)
-                               target_compile_definitions(${TEST} PRIVATE HAVE_WIN32_THREADS)
-                       endif()
                        target_link_libraries(${TEST} Threads::Threads)
                endforeach()
        endif()
        add_test(NAME runtest COMMAND runtest --out ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+       add_test(NAME runsuite COMMAND runsuite WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
        if(EXISTS ${LIBXML2_XMLCONF_WORKING_DIR}/xmlconf/xmlconf.xml)
                add_test(NAME runxmlconf COMMAND runxmlconf WORKING_DIRECTORY ${LIBXML2_XMLCONF_WORKING_DIR})
        endif()
@@ -584,6 +555,9 @@ if(LIBXML2_WITH_PYTHON)
                PREFIX lib
                VERSION ${PROJECT_VERSION}
        )
+       if (WIN32)
+               set_target_properties(LibXml2Mod PROPERTIES SUFFIX ".pyd")
+       endif()
        install(
                TARGETS LibXml2Mod
                ARCHIVE DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT development
@@ -655,7 +629,7 @@ endif()
 set(XML_INCLUDEDIR "-I\${includedir}/libxml2")
 set(XML_LIBDIR "-L\${libdir}")
 set(XML_LIBS "-lxml2")
-set(XML_PRIVATE_LIBS "${Z_LIBS} ${LZMA_LIBS} ${THREAD_LIBS} ${ICONV_LIBS} ${ICU_LIBS} ${LIBM} ${WIN32_EXTRA_LIBADD}")
+set(XML_PRIVATE_LIBS "${Z_LIBS} ${LZMA_LIBS} ${THREAD_LIBS} ${ICONV_LIBS} ${ICU_LIBS} ${LIBM} ${WINSOCK_LIBS}")
 
 file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig" "${CMAKE_INSTALL_PREFIX}")
 string(REGEX REPLACE "/$" "" PACKAGE_RELATIVE_PATH "${PACKAGE_RELATIVE_PATH}")
index ba88690..abcdfe2 100644 (file)
 #include <libxml/globals.h>
 #include <libxml/uri.h>
 
-#include "buf.h"
-#include "enc.h"
+#include "private/buf.h"
+#include "private/enc.h"
+#include "private/error.h"
+#include "private/html.h"
+#include "private/parser.h"
+#include "private/tree.h"
 
 #define HTML_MAX_NAMELEN 1000
 #define HTML_PARSER_BIG_BUFFER_SIZE 1000
@@ -145,7 +149,7 @@ htmlParseErrInt(xmlParserCtxtPtr ctxt, xmlParserErrors error,
  *
  * Pushes a new element name on top of the name stack
  *
- * Returns 0 in case of error, the index in the stack otherwise
+ * Returns -1 in case of error, the index in the stack otherwise
  */
 static int
 htmlnamePush(htmlParserCtxtPtr ctxt, const xmlChar * value)
@@ -155,15 +159,17 @@ htmlnamePush(htmlParserCtxtPtr ctxt, const xmlChar * value)
     if ((ctxt->html < 10) && (xmlStrEqual(value, BAD_CAST "body")))
         ctxt->html = 10;
     if (ctxt->nameNr >= ctxt->nameMax) {
-        ctxt->nameMax *= 2;
-        ctxt->nameTab = (const xmlChar * *)
-                         xmlRealloc((xmlChar * *)ctxt->nameTab,
-                                    ctxt->nameMax *
-                                    sizeof(ctxt->nameTab[0]));
-        if (ctxt->nameTab == NULL) {
+        size_t newSize = ctxt->nameMax * 2;
+        const xmlChar **tmp;
+
+        tmp = xmlRealloc((xmlChar **) ctxt->nameTab,
+                         newSize * sizeof(ctxt->nameTab[0]));
+        if (tmp == NULL) {
             htmlErrMemory(ctxt, NULL);
-            return (0);
+            return (-1);
         }
+        ctxt->nameTab = tmp;
+        ctxt->nameMax = newSize;
     }
     ctxt->nameTab[ctxt->nameNr] = value;
     ctxt->name = value;
@@ -270,8 +276,6 @@ htmlNodeInfoPop(htmlParserCtxtPtr ctxt)
  *
  * Clean macros, not dependent of an ASCII context, expect UTF-8 encoding
  *
- *   CURRENT Returns the current char value, with the full decoding of
- *           UTF-8 if we are using this mode. It returns an int.
  *   NEXT    Skip to the next character, this does the proper decoding
  *           in UTF-8 mode. It also pop-up unfinished entities on the fly.
  *   NEXTL(l) Skip the current unicode character of l xmlChars long.
@@ -291,20 +295,17 @@ htmlNodeInfoPop(htmlParserCtxtPtr ctxt)
 
 #define SHRINK if ((ctxt->input->cur - ctxt->input->base > 2 * INPUT_CHUNK) && \
                   (ctxt->input->end - ctxt->input->cur < 2 * INPUT_CHUNK)) \
-       xmlParserInputShrink(ctxt->input)
+       xmlParserShrink(ctxt)
 
 #define GROW if ((ctxt->progressive == 0) &&                           \
                 (ctxt->input->end - ctxt->input->cur < INPUT_CHUNK))   \
-       xmlParserInputGrow(ctxt->input, INPUT_CHUNK)
-
-#define CURRENT ((int) (*ctxt->input->cur))
+       xmlParserGrow(ctxt)
 
 #define SKIP_BLANKS htmlSkipBlankChars(ctxt)
 
 /* Imported from XML */
 
-/* #define CUR (ctxt->token ? ctxt->token : (int) (*ctxt->input->cur)) */
-#define CUR ((int) (*ctxt->input->cur))
+#define CUR (*ctxt->input->cur)
 #define NEXT xmlNextChar(ctxt)
 
 #define RAW (ctxt->token ? -1 : (*ctxt->input->cur))
@@ -327,7 +328,7 @@ htmlNodeInfoPop(htmlParserCtxtPtr ctxt)
 #define CUR_SCHAR(s, l) xmlStringCurrentChar(ctxt, s, &l)
 
 #define COPY_BUF(l,b,i,v)                                              \
-    if (l == 1) b[i++] = (xmlChar) v;                                  \
+    if (l == 1) b[i++] = v;                                            \
     else i += xmlCopyChar(l,&b[i],v)
 
 /**
@@ -409,6 +410,11 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
        *len = 0;
        return(ctxt->token);
     }
+
+    if ((ctxt->input->end - ctxt->input->cur < INPUT_CHUNK) &&
+        (xmlParserGrow(ctxt) < 0))
+        return(0);
+
     if (ctxt->charset != XML_CHAR_ENCODING_UTF8) {
         xmlChar * guess;
         xmlCharEncodingHandlerPtr handler;
@@ -418,7 +424,7 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
          * a compatible encoding for the ASCII set, since
          * HTML constructs only use < 128 chars
          */
-        if ((int) *ctxt->input->cur < 0x80) {
+        if (*ctxt->input->cur < 0x80) {
             *len = 1;
             if ((*ctxt->input->cur == 0) &&
                 (ctxt->input->cur < ctxt->input->end)) {
@@ -426,7 +432,7 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
                                 "Char 0x%X out of allowed range\n", 0);
                 return(' ');
             }
-            return((int) *ctxt->input->cur);
+            return(*ctxt->input->cur);
         }
 
         /*
@@ -469,29 +475,21 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
     cur = ctxt->input->cur;
     c = *cur;
     if (c & 0x80) {
+        size_t avail;
+
         if ((c & 0x40) == 0)
             goto encoding_error;
-        if (cur[1] == 0) {
-            xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
-            cur = ctxt->input->cur;
-        }
-        if ((cur[1] & 0xc0) != 0x80)
+
+        avail = ctxt->input->end - ctxt->input->cur;
+
+        if ((avail < 2) || ((cur[1] & 0xc0) != 0x80))
             goto encoding_error;
         if ((c & 0xe0) == 0xe0) {
-
-            if (cur[2] == 0) {
-                xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
-                cur = ctxt->input->cur;
-            }
-            if ((cur[2] & 0xc0) != 0x80)
+            if ((avail < 3) || ((cur[2] & 0xc0) != 0x80))
                 goto encoding_error;
             if ((c & 0xf0) == 0xf0) {
-                if (cur[3] == 0) {
-                    xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
-                    cur = ctxt->input->cur;
-                }
                 if (((c & 0xf8) != 0xf0) ||
-                    ((cur[3] & 0xc0) != 0x80))
+                    (avail < 4) || ((cur[3] & 0xc0) != 0x80))
                     goto encoding_error;
                 /* 4-byte code */
                 *len = 4;
@@ -533,7 +531,7 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
         }
         /* 1-byte code */
         *len = 1;
-        return((int) *ctxt->input->cur);
+        return(*ctxt->input->cur);
     }
 
 encoding_error:
@@ -570,7 +568,7 @@ encoding_error:
         (ctxt->input->buf->encoder == NULL))
         xmlSwitchEncoding(ctxt, XML_CHAR_ENCODING_8859_1);
     *len = 1;
-    return((int) *ctxt->input->cur);
+    return(*ctxt->input->cur);
 }
 
 /**
@@ -587,17 +585,12 @@ htmlSkipBlankChars(xmlParserCtxtPtr ctxt) {
     int res = 0;
 
     while (IS_BLANK_CH(*(ctxt->input->cur))) {
-       if ((*ctxt->input->cur == 0) &&
-           (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) {
-               xmlPopInput(ctxt);
-       } else {
-           if (*(ctxt->input->cur) == '\n') {
-               ctxt->input->line++; ctxt->input->col = 1;
-           } else ctxt->input->col++;
-           ctxt->input->cur++;
-           if (*ctxt->input->cur == 0)
-               xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
-       }
+        if (*(ctxt->input->cur) == '\n') {
+            ctxt->input->line++; ctxt->input->col = 1;
+        } else ctxt->input->col++;
+        ctxt->input->cur++;
+        if (*ctxt->input->cur == 0)
+            xmlParserGrow(ctxt);
        if (res < INT_MAX)
            res++;
     }
@@ -1223,7 +1216,6 @@ static const htmlStartCloseEntry htmlStartClose[] = {
     { "menu", "form" },
     { "menu", "ul" },
     { "ol", "form" },
-    { "ol", "ul" },
     { "option", "optgroup" },
     { "option", "option" },
     { "p", "address" },
@@ -1307,7 +1299,6 @@ static const htmlStartCloseEntry htmlStartClose[] = {
     { "ul", "address" },
     { "ul", "form" },
     { "ul", "menu" },
-    { "ul", "ol" },
     { "ul", "pre" },
     { "xmp", "dd" },
     { "xmp", "dl" },
@@ -1395,10 +1386,7 @@ static const elementPriority htmlEndPriority[] = {
 /**
  * htmlInitAutoClose:
  *
- * DEPRECATED: This function will be made private. Call xmlInitParser to
- * initialize the library.
- *
- * This is a no-op now.
+ * DEPRECATED: This is a no-op.
  */
 void
 htmlInitAutoClose(void) {
@@ -2075,8 +2063,8 @@ static const htmlEntityDesc  html40EntitiesTable[] = {
 #define growBuffer(buffer) {                                           \
     xmlChar *tmp;                                                      \
     buffer##_size *= 2;                                                        \
-    tmp = (xmlChar *) xmlRealloc(buffer, buffer##_size * sizeof(xmlChar)); \
-    if (tmp == NULL) {                                         \
+    tmp = (xmlChar *) xmlRealloc(buffer, buffer##_size);               \
+    if (tmp == NULL) {                                                 \
        htmlErrMemory(ctxt, "growing buffer\n");                        \
        xmlFree(buffer);                                                \
        return(NULL);                                                   \
@@ -2320,7 +2308,7 @@ htmlEncodeEntities(unsigned char* out, int *outlen,
            else
                cp = ent->name;
            len = strlen(cp);
-           if (out + 2 + len > outend)
+           if (outend - out < len + 2)
                break;
            *out++ = '&';
            memcpy(out, cp, len);
@@ -2572,6 +2560,7 @@ htmlSkipBogusComment(htmlParserCtxtPtr ctxt) {
 
 static const xmlChar *
 htmlParseHTMLName(htmlParserCtxtPtr ctxt) {
+    const xmlChar *ret;
     int i = 0;
     xmlChar loc[HTML_PARSER_BUFFER_SIZE];
 
@@ -2589,7 +2578,11 @@ htmlParseHTMLName(htmlParserCtxtPtr ctxt) {
        NEXT;
     }
 
-    return(xmlDictLookup(ctxt->dict, loc, i));
+    ret = xmlDictLookup(ctxt->dict, loc, i);
+    if (ret == NULL)
+        htmlErrMemory(ctxt, NULL);
+
+    return(ret);
 }
 
 
@@ -2674,13 +2667,14 @@ static const xmlChar *
 htmlParseNameComplex(xmlParserCtxtPtr ctxt) {
     int len = 0, l;
     int c;
-    int count = 0;
+    int maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+                    XML_MAX_TEXT_LENGTH :
+                    XML_MAX_NAME_LENGTH;
     const xmlChar *base = ctxt->input->base;
 
     /*
      * Handler for more complex cases
      */
-    GROW;
     c = CUR_CHAR(l);
     if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */
        (!IS_LETTER(c) && (c != '_') &&
@@ -2694,11 +2688,11 @@ htmlParseNameComplex(xmlParserCtxtPtr ctxt) {
            (c == '_') || (c == ':') ||
            (IS_COMBINING(c)) ||
            (IS_EXTENDER(c)))) {
-       if (count++ > 100) {
-           count = 0;
-           GROW;
-       }
        len += l;
+        if (len > maxLength) {
+            htmlParseErr(ctxt, XML_ERR_NAME_TOO_LONG, "name too long", NULL, NULL);
+            return(NULL);
+        }
        NEXTL(l);
        c = CUR_CHAR(l);
        if (ctxt->input->base != base) {
@@ -2709,6 +2703,8 @@ htmlParseNameComplex(xmlParserCtxtPtr ctxt) {
            return(htmlParseNameComplex(ctxt));
        }
     }
+    if (ctxt->instate == XML_PARSER_EOF)
+        return(NULL);
 
     if (ctxt->input->cur - ctxt->input->base < len) {
         /* Sanity check */
@@ -2736,6 +2732,9 @@ static xmlChar *
 htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) {
     xmlChar *buffer = NULL;
     int buffer_size = 0;
+    int maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+                    XML_MAX_HUGE_LENGTH :
+                    XML_MAX_TEXT_LENGTH;
     xmlChar *out = NULL;
     const xmlChar *name = NULL;
     const xmlChar *cur = NULL;
@@ -2745,7 +2744,7 @@ htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) {
      * allocate a translation buffer.
      */
     buffer_size = HTML_PARSER_BUFFER_SIZE;
-    buffer = (xmlChar *) xmlMallocAtomic(buffer_size * sizeof(xmlChar));
+    buffer = (xmlChar *) xmlMallocAtomic(buffer_size);
     if (buffer == NULL) {
        htmlErrMemory(ctxt, "buffer allocation failed\n");
        return(NULL);
@@ -2841,6 +2840,10 @@ htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) {
                out = &buffer[indx];
            }
            c = CUR_CHAR(l);
+            if (ctxt->instate == XML_PARSER_EOF) {
+                xmlFree(buffer);
+                return(NULL);
+            }
            if      (c <    0x80)
                    { *out++  = c;                bits= -6; }
            else if (c <   0x800)
@@ -2853,8 +2856,14 @@ htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) {
            for ( ; bits >= 0; bits-= 6) {
                *out++  = ((c >> bits) & 0x3F) | 0x80;
            }
-           NEXT;
+           NEXTL(l);
        }
+        if (out - buffer > maxLength) {
+            htmlParseErr(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
+                         "attribute value too long\n", NULL, NULL);
+            xmlFree(buffer);
+            return(NULL);
+        }
     }
     *out = 0;
     return(buffer);
@@ -2865,6 +2874,8 @@ htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) {
  * @ctxt:  an HTML parser context
  * @str:  location to store the entity name
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse an HTML ENTITY references
  *
  * [68] EntityRef ::= '&' Name ';'
@@ -2999,9 +3010,9 @@ htmlParseSystemLiteral(htmlParserCtxtPtr ctxt) {
         htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED,
                      "Unfinished SystemLiteral\n", NULL, NULL);
     } else {
-        NEXT;
         if (err == 0)
             ret = xmlStrndup((BASE_PTR+startPosition), len);
+        NEXT;
     }
 
     return(ret);
@@ -3054,9 +3065,9 @@ htmlParsePubidLiteral(htmlParserCtxtPtr ctxt) {
         htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED,
                      "Unfinished PubidLiteral\n", NULL, NULL);
     } else {
-        NEXT;
         if (err == 0)
             ret = xmlStrndup((BASE_PTR + startPosition), len);
+        NEXT;
     }
 
     return(ret);
@@ -3089,7 +3100,6 @@ htmlParseScript(htmlParserCtxtPtr ctxt) {
     int nbchar = 0;
     int cur,l;
 
-    SHRINK;
     cur = CUR_CHAR(l);
     while (cur != 0) {
        if ((cur == '<') && (NXT(1) == '/')) {
@@ -3128,6 +3138,7 @@ htmlParseScript(htmlParserCtxtPtr ctxt) {
             htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR,
                             "Invalid char in CDATA 0x%X\n", cur);
         }
+       NEXTL(l);
        if (nbchar >= HTML_PARSER_BIG_BUFFER_SIZE) {
             buf[nbchar] = 0;
            if (ctxt->sax->cdataBlock!= NULL) {
@@ -3139,12 +3150,14 @@ htmlParseScript(htmlParserCtxtPtr ctxt) {
                ctxt->sax->characters(ctxt->userData, buf, nbchar);
            }
            nbchar = 0;
+            SHRINK;
        }
-       GROW;
-       NEXTL(l);
        cur = CUR_CHAR(l);
     }
 
+    if (ctxt->instate == XML_PARSER_EOF)
+        return;
+
     if ((nbchar != 0) && (ctxt->sax != NULL) && (!ctxt->disableSAX)) {
         buf[nbchar] = 0;
        if (ctxt->sax->cdataBlock!= NULL) {
@@ -3175,12 +3188,10 @@ htmlParseCharDataInternal(htmlParserCtxtPtr ctxt, int readahead) {
     xmlChar buf[HTML_PARSER_BIG_BUFFER_SIZE + 6];
     int nbchar = 0;
     int cur, l;
-    int chunk = 0;
 
     if (readahead)
         buf[nbchar++] = readahead;
 
-    SHRINK;
     cur = CUR_CHAR(l);
     while (((cur != '<') || (ctxt->token == '<')) &&
            ((cur != '&') || (ctxt->token == '&')) &&
@@ -3191,6 +3202,7 @@ htmlParseCharDataInternal(htmlParserCtxtPtr ctxt, int readahead) {
        } else {
            COPY_BUF(l,buf,nbchar,cur);
        }
+       NEXTL(l);
        if (nbchar >= HTML_PARSER_BIG_BUFFER_SIZE) {
             buf[nbchar] = 0;
 
@@ -3214,21 +3226,12 @@ htmlParseCharDataInternal(htmlParserCtxtPtr ctxt, int readahead) {
                }
            }
            nbchar = 0;
-       }
-       NEXTL(l);
-        chunk++;
-        if (chunk > HTML_PARSER_BUFFER_SIZE) {
-            chunk = 0;
             SHRINK;
-            GROW;
-        }
-       cur = CUR_CHAR(l);
-       if (cur == 0) {
-           SHRINK;
-           GROW;
-           cur = CUR_CHAR(l);
        }
+       cur = CUR_CHAR(l);
     }
+    if (ctxt->instate == XML_PARSER_EOF)
+        return;
     if (nbchar != 0) {
         buf[nbchar] = 0;
 
@@ -3251,12 +3254,6 @@ htmlParseCharDataInternal(htmlParserCtxtPtr ctxt, int readahead) {
                    ctxt->sax->characters(ctxt->userData, buf, nbchar);
            }
        }
-    } else {
-       /*
-        * Loop detection
-        */
-       if (cur == 0)
-           ctxt->instate = XML_PARSER_EOF;
     }
 }
 
@@ -3347,9 +3344,11 @@ htmlParsePI(htmlParserCtxtPtr ctxt) {
     int len = 0;
     int size = HTML_PARSER_BUFFER_SIZE;
     int cur, l;
+    int maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+                    XML_MAX_HUGE_LENGTH :
+                    XML_MAX_TEXT_LENGTH;
     const xmlChar *target;
     xmlParserInputState state;
-    int count = 0;
 
     if ((RAW == '<') && (NXT(1) == '?')) {
        state = ctxt->instate;
@@ -3358,7 +3357,6 @@ htmlParsePI(htmlParserCtxtPtr ctxt) {
         * this is a Processing Instruction.
         */
        SKIP(2);
-       SHRINK;
 
        /*
         * Parse the target name and check for special support like
@@ -3379,7 +3377,7 @@ htmlParsePI(htmlParserCtxtPtr ctxt) {
                ctxt->instate = state;
                return;
            }
-           buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
+           buf = (xmlChar *) xmlMallocAtomic(size);
            if (buf == NULL) {
                htmlErrMemory(ctxt, NULL);
                ctxt->instate = state;
@@ -3397,7 +3395,7 @@ htmlParsePI(htmlParserCtxtPtr ctxt) {
                    xmlChar *tmp;
 
                    size *= 2;
-                   tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
+                   tmp = (xmlChar *) xmlRealloc(buf, size);
                    if (tmp == NULL) {
                        htmlErrMemory(ctxt, NULL);
                        xmlFree(buf);
@@ -3406,11 +3404,6 @@ htmlParsePI(htmlParserCtxtPtr ctxt) {
                    }
                    buf = tmp;
                }
-               count++;
-               if (count > 50) {
-                   GROW;
-                   count = 0;
-               }
                 if (IS_CHAR(cur)) {
                    COPY_BUF(l,buf,len,cur);
                 } else {
@@ -3418,15 +3411,21 @@ htmlParsePI(htmlParserCtxtPtr ctxt) {
                                     "Invalid char in processing instruction "
                                     "0x%X\n", cur);
                 }
+                if (len > maxLength) {
+                    htmlParseErr(ctxt, XML_ERR_PI_NOT_FINISHED,
+                                 "PI %s too long", target, NULL);
+                    xmlFree(buf);
+                    ctxt->instate = state;
+                    return;
+                }
                NEXTL(l);
                cur = CUR_CHAR(l);
-               if (cur == 0) {
-                   SHRINK;
-                   GROW;
-                   cur = CUR_CHAR(l);
-               }
            }
            buf[len] = 0;
+            if (ctxt->instate == XML_PARSER_EOF) {
+                xmlFree(buf);
+                return;
+            }
            if (cur != '>') {
                htmlParseErr(ctxt, XML_ERR_PI_NOT_FINISHED,
                      "ParsePI: PI %s never end ...\n", target, NULL);
@@ -3467,6 +3466,9 @@ htmlParseComment(htmlParserCtxtPtr ctxt) {
     int r, rl;
     int cur, l;
     int next, nl;
+    int maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+                    XML_MAX_HUGE_LENGTH :
+                    XML_MAX_TEXT_LENGTH;
     xmlParserInputState state;
 
     /*
@@ -3477,9 +3479,8 @@ htmlParseComment(htmlParserCtxtPtr ctxt) {
 
     state = ctxt->instate;
     ctxt->instate = XML_PARSER_COMMENT;
-    SHRINK;
     SKIP(4);
-    buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
+    buf = (xmlChar *) xmlMallocAtomic(size);
     if (buf == NULL) {
         htmlErrMemory(ctxt, "buffer allocation failed\n");
        ctxt->instate = state;
@@ -3511,11 +3512,6 @@ htmlParseComment(htmlParserCtxtPtr ctxt) {
            (r != '-') || (q != '-'))) {
        NEXTL(l);
        next = CUR_CHAR(nl);
-       if (next == 0) {
-           SHRINK;
-           GROW;
-           next = CUR_CHAR(nl);
-       }
 
        if ((q == '-') && (r == '-') && (cur == '!') && (next == '>')) {
          htmlParseErr(ctxt, XML_ERR_COMMENT_NOT_FINISHED,
@@ -3528,7 +3524,7 @@ htmlParseComment(htmlParserCtxtPtr ctxt) {
            xmlChar *tmp;
 
            size *= 2;
-           tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
+           tmp = (xmlChar *) xmlRealloc(buf, size);
            if (tmp == NULL) {
                xmlFree(buf);
                htmlErrMemory(ctxt, "growing buffer failed\n");
@@ -3543,6 +3539,13 @@ htmlParseComment(htmlParserCtxtPtr ctxt) {
             htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR,
                             "Invalid char in comment 0x%X\n", q);
         }
+        if (len > maxLength) {
+            htmlParseErr(ctxt, XML_ERR_COMMENT_NOT_FINISHED,
+                         "comment too long", NULL, NULL);
+            xmlFree(buf);
+            ctxt->instate = state;
+            return;
+        }
 
        q = r;
        ql = rl;
@@ -3553,6 +3556,10 @@ htmlParseComment(htmlParserCtxtPtr ctxt) {
     }
 finished:
     buf[len] = 0;
+    if (ctxt->instate == XML_PARSER_EOF) {
+        xmlFree(buf);
+        return;
+    }
     if (cur == '>') {
         NEXT;
        if ((ctxt->sax != NULL) && (ctxt->sax->comment != NULL) &&
@@ -3573,6 +3580,8 @@ unfinished:
  * htmlParseCharRef:
  * @ctxt:  an HTML parser context
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse Reference declarations
  *
  * [66] CharRef ::= '&#' [0-9]+ ';' |
@@ -3701,7 +3710,8 @@ htmlParseDocTypeDecl(htmlParserCtxtPtr ctxt) {
        htmlParseErr(ctxt, XML_ERR_DOCTYPE_NOT_FINISHED,
                     "DOCTYPE improperly terminated\n", NULL, NULL);
         /* Ignore bogus content */
-        while ((CUR != 0) && (CUR != '>'))
+        while ((CUR != 0) && (CUR != '>') &&
+               (ctxt->instate != XML_PARSER_EOF))
             NEXT;
     }
     if (CUR == '>')
@@ -3838,7 +3848,7 @@ htmlCheckEncodingDirect(htmlParserCtxtPtr ctxt, const xmlChar *encoding) {
            (ctxt->input->buf->raw != NULL) &&
            (ctxt->input->buf->buffer != NULL)) {
            int nbchars;
-           int processed;
+           size_t processed;
 
            /*
             * convert as much as possible to the parser reading buffer.
@@ -4033,7 +4043,8 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
     SKIP_BLANKS;
     while ((CUR != 0) &&
            (CUR != '>') &&
-          ((CUR != '/') || (NXT(1) != '>'))) {
+          ((CUR != '/') || (NXT(1) != '>')) &&
+           (ctxt->instate != XML_PARSER_EOF)) {
        GROW;
        attname = htmlParseAttribute(ctxt, &attvalue);
         if (attname != NULL) {
@@ -4094,7 +4105,8 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
             * the end of the tag. */
            while ((CUR != 0) &&
                   !(IS_BLANK_CH(CUR)) && (CUR != '>') &&
-                  ((CUR != '/') || (NXT(1) != '>')))
+                  ((CUR != '/') || (NXT(1) != '>')) &&
+                   (ctxt->instate != XML_PARSER_EOF))
                NEXT;
        }
 
@@ -4461,6 +4473,8 @@ htmlParseContent(htmlParserCtxtPtr ctxt) {
         else {
             htmlParseCharData(ctxt);
         }
+
+        SHRINK;
         GROW;
     }
     if (currentNode != NULL) xmlFree(currentNode);
@@ -4470,6 +4484,8 @@ htmlParseContent(htmlParserCtxtPtr ctxt) {
  * htmlParseElement:
  * @ctxt:  an HTML parser context
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse an HTML element, this is highly recursive
  * this is kept for compatibility with previous code versions
  *
@@ -4727,8 +4743,16 @@ htmlParseContentInternal(htmlParserCtxtPtr ctxt) {
     int depth;
     const xmlChar *name;
 
-    currentNode = xmlStrdup(ctxt->name);
     depth = ctxt->nameNr;
+    if (depth <= 0) {
+        currentNode = NULL;
+    } else {
+        currentNode = xmlStrdup(ctxt->name);
+        if (currentNode == NULL) {
+            htmlErrMemory(ctxt, NULL);
+            return;
+        }
+    }
     while (1) {
         GROW;
 
@@ -4744,8 +4768,16 @@ htmlParseContentInternal(htmlParserCtxtPtr ctxt) {
                if (currentNode != NULL)
                    xmlFree(currentNode);
 
-               currentNode = xmlStrdup(ctxt->name);
                depth = ctxt->nameNr;
+                if (depth <= 0) {
+                    currentNode = NULL;
+                } else {
+                    currentNode = xmlStrdup(ctxt->name);
+                    if (currentNode == NULL) {
+                        htmlErrMemory(ctxt, NULL);
+                        break;
+                    }
+                }
            }
            continue; /* while */
         }
@@ -4767,6 +4799,10 @@ htmlParseContentInternal(htmlParserCtxtPtr ctxt) {
                    xmlFree(currentNode);
 
                currentNode = xmlStrdup(ctxt->name);
+                if (currentNode == NULL) {
+                    htmlErrMemory(ctxt, NULL);
+                    break;
+                }
                depth = ctxt->nameNr;
                continue;
            }
@@ -4790,6 +4826,10 @@ htmlParseContentInternal(htmlParserCtxtPtr ctxt) {
            if (currentNode != NULL) xmlFree(currentNode);
 
            currentNode = xmlStrdup(ctxt->name);
+            if (currentNode == NULL) {
+                htmlErrMemory(ctxt, NULL);
+                break;
+            }
            depth = ctxt->nameNr;
            continue;
        }
@@ -4841,6 +4881,10 @@ htmlParseContentInternal(htmlParserCtxtPtr ctxt) {
             if (currentNode != NULL) xmlFree(currentNode);
 
             currentNode = xmlStrdup(ctxt->name);
+            if (currentNode == NULL) {
+                htmlErrMemory(ctxt, NULL);
+                break;
+            }
             depth = ctxt->nameNr;
         }
         else if (CUR == '<') {
@@ -4872,6 +4916,8 @@ htmlParseContentInternal(htmlParserCtxtPtr ctxt) {
         else {
             htmlParseCharData(ctxt);
         }
+
+        SHRINK;
         GROW;
     }
     if (currentNode != NULL) xmlFree(currentNode);
@@ -4910,15 +4956,11 @@ htmlParseDocument(htmlParserCtxtPtr ctxt) {
 
     xmlInitParser();
 
-    htmlDefaultSAXHandlerInit();
-
     if ((ctxt == NULL) || (ctxt->input == NULL)) {
        htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR,
                     "htmlParseDocument: context error\n", NULL, NULL);
        return(XML_ERR_INTERNAL_ERROR);
     }
-    ctxt->html = 1;
-    ctxt->linenumbers = 1;
     GROW;
     /*
      * SAX: beginning of the document processing.
@@ -5032,6 +5074,8 @@ htmlParseDocument(htmlParserCtxtPtr ctxt) {
 /**
  * htmlInitParserCtxt:
  * @ctxt:  an HTML parser context
+ * @sax:  SAX handler
+ * @userData:  user data
  *
  * Initialize a parser context
  *
@@ -5039,10 +5083,9 @@ htmlParseDocument(htmlParserCtxtPtr ctxt) {
  */
 
 static int
-htmlInitParserCtxt(htmlParserCtxtPtr ctxt)
+htmlInitParserCtxt(htmlParserCtxtPtr ctxt, const htmlSAXHandler *sax,
+                   void *userData)
 {
-    htmlSAXHandler *sax;
-
     if (ctxt == NULL) return(-1);
     memset(ctxt, 0, sizeof(htmlParserCtxt));
 
@@ -5051,12 +5094,21 @@ htmlInitParserCtxt(htmlParserCtxtPtr ctxt)
         htmlErrMemory(NULL, "htmlInitParserCtxt: out of memory\n");
        return(-1);
     }
-    sax = (htmlSAXHandler *) xmlMalloc(sizeof(htmlSAXHandler));
-    if (sax == NULL) {
+
+    if (ctxt->sax == NULL)
+        ctxt->sax = (htmlSAXHandler *) xmlMalloc(sizeof(htmlSAXHandler));
+    if (ctxt->sax == NULL) {
         htmlErrMemory(NULL, "htmlInitParserCtxt: out of memory\n");
        return(-1);
     }
-    memset(sax, 0, sizeof(htmlSAXHandler));
+    if (sax == NULL) {
+        memset(ctxt->sax, 0, sizeof(htmlSAXHandler));
+        xmlSAX2InitHtmlDefaultSAXHandler(ctxt->sax);
+        ctxt->userData = ctxt;
+    } else {
+        memcpy(ctxt->sax, sax, sizeof(htmlSAXHandler));
+        ctxt->userData = userData ? userData : ctxt;
+    }
 
     /* Allocate the Input stack */
     ctxt->inputTab = (htmlParserInputPtr *)
@@ -5115,10 +5167,6 @@ htmlInitParserCtxt(htmlParserCtxtPtr ctxt)
     ctxt->nodeInfoNr  = 0;
     ctxt->nodeInfoMax = 0;
 
-    ctxt->sax = sax;
-    xmlSAX2InitHtmlDefaultSAXHandler(sax);
-
-    ctxt->userData = ctxt;
     ctxt->myDoc = NULL;
     ctxt->wellFormed = 1;
     ctxt->replaceEntities = 0;
@@ -5162,6 +5210,23 @@ htmlFreeParserCtxt(htmlParserCtxtPtr ctxt)
 htmlParserCtxtPtr
 htmlNewParserCtxt(void)
 {
+    return(htmlNewSAXParserCtxt(NULL, NULL));
+}
+
+/**
+ * htmlNewSAXParserCtxt:
+ * @sax:  SAX handler
+ * @userData:  user data
+ *
+ * Allocate and initialize a new SAX parser context. If userData is NULL,
+ * the parser context will be passed as user data.
+ *
+ * Returns the htmlParserCtxtPtr or NULL in case of allocation error
+ */
+
+htmlParserCtxtPtr
+htmlNewSAXParserCtxt(const htmlSAXHandler *sax, void *userData)
+{
     xmlParserCtxtPtr ctxt;
 
     ctxt = (xmlParserCtxtPtr) xmlMalloc(sizeof(xmlParserCtxt));
@@ -5170,7 +5235,7 @@ htmlNewParserCtxt(void)
        return(NULL);
     }
     memset(ctxt, 0, sizeof(xmlParserCtxt));
-    if (htmlInitParserCtxt(ctxt) < 0) {
+    if (htmlInitParserCtxt(ctxt, sax, userData) < 0) {
         htmlFreeParserCtxt(ctxt);
        return(NULL);
     }
@@ -5202,7 +5267,10 @@ htmlCreateMemoryParserCtxt(const char *buffer, int size) {
        return(NULL);
 
     buf = xmlParserInputBufferCreateMem(buffer, size, XML_CHAR_ENCODING_NONE);
-    if (buf == NULL) return(NULL);
+    if (buf == NULL) {
+       xmlFreeParserCtxt(ctxt);
+        return(NULL);
+    }
 
     input = xmlNewInputStream(ctxt);
     if (input == NULL) {
@@ -5307,33 +5375,20 @@ static int
 htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first,
                         xmlChar next, xmlChar third, int ignoreattrval)
 {
-    int base, len;
+    size_t base, len;
     htmlParserInputPtr in;
     const xmlChar *buf;
-    int invalue = 0;
-    char valdellim = 0x0;
+    int quote;
 
     in = ctxt->input;
     if (in == NULL)
         return (-1);
 
-    base = in->cur - in->base;
-    if (base < 0)
-        return (-1);
-
-    if (ctxt->checkIndex > base) {
-        base = ctxt->checkIndex;
-        /* Abuse hasPErefs member to restore current state. */
-        invalue = ctxt->hasPErefs & 1 ? 1 : 0;
-    }
+    base = ctxt->checkIndex;
+    quote = ctxt->endCheckState;
 
-    if (in->buf == NULL) {
-        buf = in->base;
-        len = in->length;
-    } else {
-        buf = xmlBufContent(in->buf->buffer);
-        len = xmlBufUse(in->buf->buffer);
-    }
+    buf = in->cur;
+    len = in->end - in->cur;
 
     /* take into account the sequence length */
     if (third)
@@ -5341,19 +5396,19 @@ htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first,
     else if (next)
         len--;
     for (; base < len; base++) {
+        if (base >= INT_MAX / 2) {
+            ctxt->checkIndex = 0;
+            ctxt->endCheckState = 0;
+            return (base - 2);
+        }
         if (ignoreattrval) {
+            if (quote) {
+                if (buf[base] == quote)
+                    quote = 0;
+                continue;
+            }
             if (buf[base] == '"' || buf[base] == '\'') {
-                if (invalue) {
-                    if (buf[base] == valdellim) {
-                        invalue = 0;
-                        continue;
-                    }
-                } else {
-                    valdellim = buf[base];
-                    invalue = 1;
-                    continue;
-                }
-            } else if (invalue) {
+                quote = buf[base];
                 continue;
             }
         }
@@ -5366,29 +5421,12 @@ htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first,
                     continue;
             }
             ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
-            if (next == 0)
-                xmlGenericError(xmlGenericErrorContext,
-                                "HPP: lookup '%c' found at %d\n",
-                                first, base);
-            else if (third == 0)
-                xmlGenericError(xmlGenericErrorContext,
-                                "HPP: lookup '%c%c' found at %d\n",
-                                first, next, base);
-            else
-                xmlGenericError(xmlGenericErrorContext,
-                                "HPP: lookup '%c%c%c' found at %d\n",
-                                first, next, third, base);
-#endif
-            return (base - (in->cur - in->base));
+            ctxt->endCheckState = 0;
+            return (base);
         }
     }
     ctxt->checkIndex = base;
-    /* Abuse hasPErefs member to track current state. */
-    if (invalue)
-        ctxt->hasPErefs |= 1;
-    else
-        ctxt->hasPErefs &= ~1;
+    ctxt->endCheckState = quote;
 #ifdef DEBUG_PUSH
     if (next == 0)
         xmlGenericError(xmlGenericErrorContext,
@@ -5422,16 +5460,23 @@ static int
 htmlParseLookupCommentEnd(htmlParserCtxtPtr ctxt)
 {
     int mark = 0;
-    int cur = CUR_PTR - BASE_PTR;
+    int offset;
 
-    while (mark >= 0) {
+    while (1) {
        mark = htmlParseLookupSequence(ctxt, '-', '-', 0, 0);
-       if ((mark < 0) ||
-           (NXT(mark+2) == '>') ||
+       if (mark < 0)
+            break;
+        if ((NXT(mark+2) == '>') ||
            ((NXT(mark+2) == '!') && (NXT(mark+3) == '>'))) {
-           return mark;
+            ctxt->checkIndex = 0;
+           break;
        }
-       ctxt->checkIndex = cur + mark + 1;
+        offset = (NXT(mark+2) == '!') ? 3 : 2;
+        if (mark + offset >= ctxt->input->end - ctxt->input->cur) {
+           ctxt->checkIndex = mark;
+            return(-1);
+        }
+       ctxt->checkIndex = mark + 1;
     }
     return mark;
 }
@@ -5512,11 +5557,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
 
        in = ctxt->input;
        if (in == NULL) break;
-       if (in->buf == NULL)
-           avail = in->length - (in->cur - in->base);
-       else
-           avail = (ptrdiff_t)xmlBufUse(in->buf->buffer) -
-                    (in->cur - in->base);
+       avail = in->end - in->cur;
        if ((avail == 0) && (terminate)) {
            htmlAutoCloseOnEnd(ctxt);
            if ((ctxt->nameNr == 0) && (ctxt->instate != XML_PARSER_EOF)) {
@@ -5555,11 +5596,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
                cur = in->cur[0];
                if (IS_BLANK_CH(cur)) {
                    SKIP_BLANKS;
-                   if (in->buf == NULL)
-                       avail = in->length - (in->cur - in->base);
-                   else
-                       avail = (ptrdiff_t)xmlBufUse(in->buf->buffer) -
-                                (in->cur - in->base);
+                    avail = in->end - in->cur;
                }
                if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
                    ctxt->sax->setDocumentLocator(ctxt->userData,
@@ -5598,11 +5635,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
                break;
             case XML_PARSER_MISC:
                SKIP_BLANKS;
-               if (in->buf == NULL)
-                   avail = in->length - (in->cur - in->base);
-               else
-                   avail = (ptrdiff_t)xmlBufUse(in->buf->buffer) -
-                            (in->cur - in->base);
+                avail = in->end - in->cur;
                /*
                 * no chars in buffer
                 */
@@ -5671,11 +5704,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
                break;
             case XML_PARSER_PROLOG:
                SKIP_BLANKS;
-               if (in->buf == NULL)
-                   avail = in->length - (in->cur - in->base);
-               else
-                   avail = (ptrdiff_t)xmlBufUse(in->buf->buffer) -
-                            (in->cur - in->base);
+                avail = in->end - in->cur;
                if (avail < 2)
                    goto done;
                cur = in->cur[0];
@@ -5712,11 +5741,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
                }
                break;
             case XML_PARSER_EPILOG:
-               if (in->buf == NULL)
-                   avail = in->length - (in->cur - in->base);
-               else
-                   avail = (ptrdiff_t)xmlBufUse(in->buf->buffer) -
-                            (in->cur - in->base);
+                avail = in->end - in->cur;
                if (avail < 1)
                    goto done;
                cur = in->cur[0];
@@ -5900,7 +5925,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
                 * Handle preparsed entities and charRef
                 */
                if (ctxt->token != 0) {
-                   chr[0] = (xmlChar) ctxt->token;
+                   chr[0] = ctxt->token;
                    htmlCheckParagraph(ctxt);
                    if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL))
                        ctxt->sax->characters(ctxt->userData, chr, 1);
@@ -5952,8 +5977,14 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
                        if (idx < 0)
                            goto done;
                        val = in->cur[idx + 2];
-                       if (val == 0) /* bad cut of input */
+                       if (val == 0) { /* bad cut of input */
+                            /*
+                             * FIXME: htmlParseScript checks for additional
+                             * characters after '</'.
+                             */
+                            ctxt->checkIndex = idx;
                            goto done;
+                        }
                    }
                    htmlParseScript(ctxt);
                    if ((cur == '<') && (next == '/')) {
@@ -5966,6 +5997,8 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
                        break;
                    }
                } else if ((cur == '<') && (next == '!')) {
+                    if (avail < 4)
+                        goto done;
                     /*
                      * Sometimes DOCTYPE arrives in the middle of the document
                      */
@@ -6006,8 +6039,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
 #endif
                     htmlParsePI(ctxt);
                     ctxt->instate = XML_PARSER_CONTENT;
-                } else if ((cur == '<') && (next == '!') && (avail < 4)) {
-                    goto done;
                 } else if ((cur == '<') && (next == '/')) {
                     ctxt->instate = XML_PARSER_END_TAG;
                     ctxt->checkIndex = 0;
@@ -6248,9 +6279,8 @@ htmlParseChunk(htmlParserCtxtPtr ctxt, const char *chunk, int size,
        res = xmlParserInputBufferPush(ctxt->input->buf, size, chunk);
         xmlBufSetInputBaseCur(ctxt->input->buf->buffer, ctxt->input, base, cur);
        if (res < 0) {
-           ctxt->errNo = XML_PARSER_EOF;
-           ctxt->disableSAX = 1;
-           return (XML_PARSER_EOF);
+            htmlErrMemory(ctxt, NULL);
+           return (ctxt->errNo);
        }
 #ifdef DEBUG_PUSH
        xmlGenericError(xmlGenericErrorContext, "HPP: pushed %d\n", size);
@@ -6330,26 +6360,13 @@ htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data,
     buf = xmlAllocParserInputBuffer(enc);
     if (buf == NULL) return(NULL);
 
-    ctxt = htmlNewParserCtxt();
+    ctxt = htmlNewSAXParserCtxt(sax, user_data);
     if (ctxt == NULL) {
        xmlFreeParserInputBuffer(buf);
        return(NULL);
     }
     if(enc==XML_CHAR_ENCODING_UTF8 || buf->encoder)
        ctxt->charset=XML_CHAR_ENCODING_UTF8;
-    if (sax != NULL) {
-       if (ctxt->sax != (xmlSAXHandlerPtr) &htmlDefaultSAXHandler)
-           xmlFree(ctxt->sax);
-       ctxt->sax = (htmlSAXHandlerPtr) xmlMalloc(sizeof(htmlSAXHandler));
-       if (ctxt->sax == NULL) {
-           xmlFree(buf);
-           xmlFree(ctxt);
-           return(NULL);
-       }
-       memcpy(ctxt->sax, sax, sizeof(htmlSAXHandler));
-       if (user_data != NULL)
-           ctxt->userData = user_data;
-    }
     if (filename == NULL) {
        ctxt->directory = NULL;
     } else {
@@ -6359,7 +6376,7 @@ htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data,
     inputStream = htmlNewInputStream(ctxt);
     if (inputStream == NULL) {
        xmlFreeParserCtxt(ctxt);
-       xmlFree(buf);
+       xmlFreeParserInputBuffer(buf);
        return(NULL);
     }
 
@@ -6398,6 +6415,8 @@ htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data,
  * @sax:  the SAX handler block
  * @userData: if using SAX, this pointer will be provided on callbacks.
  *
+ * DEPRECATED: Use htmlNewSAXParserCtxt and htmlCtxtReadDoc.
+ *
  * Parse an HTML in-memory document. If sax is not NULL, use the SAX callbacks
  * to handle parse events. If sax is NULL, fallback to the default DOM
  * behavior and return a tree.
@@ -6481,11 +6500,6 @@ htmlCreateFileParserCtxt(const char *filename, const char *encoding)
     }
     canonicFilename = (char *) xmlCanonicPath((const xmlChar *) filename);
     if (canonicFilename == NULL) {
-#ifdef LIBXML_SAX1_ENABLED
-       if (xmlDefaultSAXHandler.error != NULL) {
-           xmlDefaultSAXHandler.error(NULL, "out of memory\n");
-       }
-#endif
        xmlFreeParserCtxt(ctxt);
        return(NULL);
     }
@@ -6524,6 +6538,8 @@ htmlCreateFileParserCtxt(const char *filename, const char *encoding)
  * @sax:  the SAX handler block
  * @userData: if using SAX, this pointer will be provided on callbacks.
  *
+ * DEPRECATED: Use htmlNewSAXParserCtxt and htmlCtxtReadFile.
+ *
  * parse an HTML file and build a tree. Automatic support for ZLIB/Compress
  * compressed document is provided by default if found at compile-time.
  * It use the given SAX function block to handle the parsing callback.
@@ -6792,10 +6808,12 @@ htmlCtxtReset(htmlParserCtxtPtr ctxt)
     ctxt->disableSAX = 0;
     ctxt->valid = 1;
     ctxt->vctxt.userData = ctxt;
+    ctxt->vctxt.flags = XML_VCTXT_USE_PCTXT;
     ctxt->vctxt.error = xmlParserValidityError;
     ctxt->vctxt.warning = xmlParserValidityWarning;
     ctxt->record_info = 0;
     ctxt->checkIndex = 0;
+    ctxt->endCheckState = 0;
     ctxt->inSubset = 0;
     ctxt->errNo = XML_ERR_OK;
     ctxt->depth = 0;
@@ -6811,6 +6829,11 @@ htmlCtxtReset(htmlParserCtxtPtr ctxt)
         xmlHashFree(ctxt->attsSpecial, NULL);
         ctxt->attsSpecial = NULL;
     }
+
+    ctxt->nbErrors = 0;
+    ctxt->nbWarnings = 0;
+    if (ctxt->lastError.code != XML_ERR_OK)
+        xmlResetError(&ctxt->lastError);
 }
 
 /**
@@ -6881,6 +6904,7 @@ htmlCtxtUseOptions(htmlParserCtxtPtr ctxt, int options)
         options -= HTML_PARSE_NOIMPLIED;
     }
     ctxt->dictNames = 0;
+    ctxt->linenumbers = 1;
     return (options);
 }
 
@@ -6997,12 +7021,9 @@ htmlReadMemory(const char *buffer, int size, const char *URL, const char *encodi
     htmlParserCtxtPtr ctxt;
 
     xmlInitParser();
-    ctxt = xmlCreateMemoryParserCtxt(buffer, size);
+    ctxt = htmlCreateMemoryParserCtxt(buffer, size);
     if (ctxt == NULL)
         return (NULL);
-    htmlDefaultSAXHandlerInit();
-    if (ctxt->sax != NULL)
-        memcpy(ctxt->sax, &htmlDefaultSAXHandler, sizeof(xmlSAXHandlerV1));
     return (htmlDoRead(ctxt, URL, encoding, options, 0));
 }
 
index 3dd78a9..fa3a0ed 100644 (file)
 #include <libxml/globals.h>
 #include <libxml/uri.h>
 
-#include "buf.h"
+#include "private/buf.h"
+#include "private/error.h"
+#include "private/io.h"
+#include "private/save.h"
 
 /************************************************************************
  *                                                                     *
@@ -328,11 +331,6 @@ htmlIsBooleanAttr(const xmlChar *name)
 }
 
 #ifdef LIBXML_OUTPUT_ENABLED
-/*
- * private routine exported from xmlIO.c
- */
-xmlOutputBufferPtr
-xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder);
 /************************************************************************
  *                                                                     *
  *                     Output error handlers                           *
@@ -417,7 +415,7 @@ htmlBufNodeDumpFormat(xmlBufPtr buf, xmlDocPtr doc, xmlNodePtr cur,
         htmlSaveErrMemory("allocating HTML output buffer");
        return (-1);
     }
-    memset(outbuf, 0, (size_t) sizeof(xmlOutputBuffer));
+    memset(outbuf, 0, sizeof(xmlOutputBuffer));
     outbuf->buffer = buf;
     outbuf->encoder = NULL;
     outbuf->writecallback = NULL;
@@ -622,8 +620,6 @@ htmlDocDumpMemory(xmlDocPtr cur, xmlChar**mem, int *size) {
  *                                                                     *
  ************************************************************************/
 
-void xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur);
-
 /**
  * htmlDtdDumpOutput:
  * @buf:  the HTML buffer output
@@ -705,10 +701,15 @@ htmlAttrDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur) {
                while (IS_BLANK_CH(*tmp)) tmp++;
 
                /*
-                * the < and > have already been escaped at the entity level
-                * And doing so here breaks server side includes
+                 * Angle brackets are technically illegal in URIs, but they're
+                 * used in server side includes, for example. Curly brackets
+                 * are illegal as well and often used in templates.
+                 * Don't escape non-whitespace, printable ASCII chars for
+                 * improved interoperability. Only escape space, control
+                 * and non-ASCII chars.
                 */
-               escaped = xmlURIEscapeStr(tmp, BAD_CAST"@/:=?;#%&,+<>");
+               escaped = xmlURIEscapeStr(tmp,
+                        BAD_CAST "\"#$%&+,/:;<=>?@[\\]^`{|}");
                if (escaped != NULL) {
                    xmlBufWriteQuotedString(buf->buffer, escaped);
                    xmlFree(escaped);
diff --git a/MAINTAINERS.md b/MAINTAINERS.md
new file mode 100644 (file)
index 0000000..2d9204e
--- /dev/null
@@ -0,0 +1,65 @@
+# Maintainer's Guide
+
+## Making a release
+
+### Rebuild generated files and documentation
+
+The documentation and some generated files can be rebuilt by running
+
+    make -C doc rebuild
+
+This requires `xsltproc` and the libxml2 Python bindings to be installed.
+
+### Update the NEWS file
+
+You can get started by running
+
+    git log --format='- %s (%an)' [previous-release-tag]..
+
+### Bump the version number
+
+Edit the version number in `configure.ac` if you haven't done so already.
+
+### Build the tarball
+
+I'd recommend to build the tarball by running
+
+    make distcheck
+
+which performs some useful checks as well.
+
+### Upload the tarball
+
+Follow the instructions at
+<https://wiki.gnome.org/MaintainersCorner/Releasing>:
+
+    scp libxml2-[version].tar.xz master.gnome.org:
+    ssh master.gnome.org ftpadmin install libxml2-[version].tar.xz
+
+### Tag the release
+
+Create an annotated tag and push it:
+
+    git tag -a [version] -m 'Release [version]'
+    git push origin [version]
+
+### Create a GitLab release
+
+Create a new GitLab release on
+<https://gitlab.gnome.org/GNOME/libxml2/-/releases>.
+
+### Announce the release
+
+Announce the release by sending an email to the mailing list at
+xml@gnome.org.
+
+## Updating the CI Docker image
+
+Note that the CI image is used for libxslt as well. Run the following
+commands with the Dockerfile in the .gitlab-ci directory:
+
+    docker login registry.gitlab.gnome.org
+    docker build -t registry.gitlab.gnome.org/gnome/libxml2 - \
+        < .gitlab-ci/Dockerfile
+    docker push registry.gitlab.gnome.org/gnome/libxml2
+
index 316109b..5bc4018 100644 (file)
@@ -2,22 +2,22 @@
 
 ACLOCAL_AMFLAGS = -I m4
 
-SUBDIRS = include . doc example fuzz xstc
+SUBDIRS = include . doc example xstc
 if WITH_PYTHON
 SUBDIRS += python
 endif
+if WITH_GLOB
+SUBDIRS += fuzz
+endif
 
 DIST_SUBDIRS = include . doc example fuzz python xstc
 
 AM_CPPFLAGS = -I$(top_builddir)/include -I$(srcdir)/include -DSYSCONFDIR='"$(sysconfdir)"'
 
-AM_CFLAGS = $(EXTRA_CFLAGS)
-
 check_PROGRAMS = \
        runsuite \
        runtest \
        runxmlconf \
-       testAutomata \
        testModule \
        testThreads \
        testapi \
@@ -28,107 +28,145 @@ check_PROGRAMS = \
 
 bin_PROGRAMS = xmllint xmlcatalog
 
-nodist_bin_SCRIPTS = xml2-config
+bin_SCRIPTS = xml2-config
 
 lib_LTLIBRARIES = libxml2.la
-libxml2_la_CFLAGS = $(EXTRA_CFLAGS) $(THREAD_CFLAGS) $(Z_CFLAGS) $(LZMA_CFLAGS)
+libxml2_la_CFLAGS = $(AM_CFLAGS) $(XML_PRIVATE_CFLAGS)
 libxml2_la_LIBADD = $(XML_PRIVATE_LIBS)
 
-if USE_VERSION_SCRIPT
-LIBXML2_VERSION_SCRIPT = $(VERSION_SCRIPT_FLAGS)$(srcdir)/libxml2.syms
-else
-LIBXML2_VERSION_SCRIPT =
-endif
-
-libxml2_la_LDFLAGS = $(CYGWIN_EXTRA_LDFLAGS) $(WIN32_EXTRA_LDFLAGS) \
-                    $(LIBXML2_VERSION_SCRIPT) \
+libxml2_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined \
                     -version-info $(LIBXML_VERSION_INFO) \
                     $(MODULE_PLATFORM_LIBS)
+if USE_VERSION_SCRIPT
+libxml2_la_LDFLAGS += $(VERSION_SCRIPT_FLAGS)$(srcdir)/libxml2.syms
+endif
 
+libxml2_la_SOURCES = buf.c chvalid.c dict.c entities.c encoding.c error.c \
+                    globals.c hash.c list.c parser.c parserInternals.c \
+                    SAX2.c threads.c tree.c uri.c valid.c xmlIO.c \
+                    xmlmemory.c xmlstring.c
+if WITH_C14N_SOURCES
+libxml2_la_SOURCES += c14n.c
+endif
+if WITH_CATALOG_SOURCES
+libxml2_la_SOURCES += catalog.c
+endif
+if WITH_DEBUG_SOURCES
+libxml2_la_SOURCES += debugXML.c
+endif
+if WITH_FTP_SOURCES
+libxml2_la_SOURCES += nanoftp.c
+endif
+if WITH_HTML_SOURCES
+libxml2_la_SOURCES += HTMLparser.c HTMLtree.c
+endif
+if WITH_HTTP_SOURCES
+libxml2_la_SOURCES += nanohttp.c
+endif
+if WITH_LEGACY_SOURCES
+libxml2_la_SOURCES += legacy.c
+if WITH_SAX1_SOURCES
+libxml2_la_SOURCES += SAX.c
+endif
+endif
+if WITH_LZMA_SOURCES
+libxml2_la_SOURCES += xzlib.c
+endif
+if WITH_MODULES_SOURCES
+libxml2_la_SOURCES += xmlmodule.c
+endif
+if WITH_OUTPUT_SOURCES
+libxml2_la_SOURCES += xmlsave.c
+endif
+if WITH_PATTERN_SOURCES
+libxml2_la_SOURCES += pattern.c
+endif
+if WITH_READER_SOURCES
+libxml2_la_SOURCES += xmlreader.c
+endif
+if WITH_REGEXPS_SOURCES
+libxml2_la_SOURCES += xmlregexp.c xmlunicode.c
+endif
+if WITH_SCHEMAS_SOURCES
+libxml2_la_SOURCES += relaxng.c xmlschemas.c xmlschemastypes.c
+if !WITH_XPATH_SOURCES
+libxml2_la_SOURCES += xpath.c
+endif
+endif
+if WITH_SCHEMATRON_SOURCES
+libxml2_la_SOURCES += schematron.c
+endif
 if WITH_TRIO_SOURCES
-trio_sources = triostr.c trio.c
-else
-trio_sources =
+libxml2_la_SOURCES += triostr.c trio.c
+endif
+if WITH_WRITER_SOURCES
+libxml2_la_SOURCES += xmlwriter.c
+endif
+if WITH_XINCLUDE_SOURCES
+libxml2_la_SOURCES += xinclude.c
+endif
+if WITH_XPATH_SOURCES
+libxml2_la_SOURCES += xpath.c
+endif
+if WITH_XPTR_SOURCES
+libxml2_la_SOURCES += xlink.c xpointer.c
 endif
-
-libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c  \
-               parser.c tree.c hash.c list.c xmlIO.c xmlmemory.c uri.c  \
-               valid.c xlink.c HTMLparser.c HTMLtree.c debugXML.c xpath.c  \
-               xpointer.c xinclude.c nanohttp.c nanoftp.c \
-               catalog.c globals.c threads.c c14n.c xmlstring.c buf.c \
-               xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c \
-               $(trio_sources) \
-               xmlreader.c relaxng.c dict.c SAX2.c \
-               xmlwriter.c legacy.c chvalid.c pattern.c xmlsave.c \
-               xmlmodule.c schematron.c xzlib.c
 
 DEPS = $(top_builddir)/libxml2.la
 LDADDS = $(top_builddir)/libxml2.la
 
 
 m4datadir = $(datadir)/aclocal
-m4data_DATA = libxml.m4
+dist_m4data_DATA = libxml.m4
 
 runtest_SOURCES=runtest.c
-runtest_CFLAGS = $(EXTRA_CFLAGS) $(THREAD_CFLAGS)
-runtest_LDFLAGS = 
+runtest_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
 runtest_DEPENDENCIES = $(DEPS)
 runtest_LDADD= $(BASE_THREAD_LIBS) $(THREAD_LIBS) $(LDADDS)
 
 testrecurse_SOURCES=testrecurse.c
-testrecurse_LDFLAGS = 
 testrecurse_DEPENDENCIES = $(DEPS)
 testrecurse_LDADD= $(LDADDS)
 
 testlimits_SOURCES=testlimits.c
-testlimits_LDFLAGS = 
 testlimits_DEPENDENCIES = $(DEPS)
 testlimits_LDADD= $(LDADDS)
 
 testchar_SOURCES=testchar.c
-testchar_LDFLAGS = 
 testchar_DEPENDENCIES = $(DEPS)
 testchar_LDADD= $(LDADDS)
 
 testdict_SOURCES=testdict.c
-testdict_LDFLAGS = 
 testdict_DEPENDENCIES = $(DEPS)
 testdict_LDADD= $(LDADDS)
 
 runsuite_SOURCES=runsuite.c
-runsuite_LDFLAGS = 
 runsuite_DEPENDENCIES = $(DEPS)
 runsuite_LDADD= $(LDADDS)
 
 xmllint_SOURCES=xmllint.c
-xmllint_LDFLAGS = 
+xmllint_CFLAGS = $(AM_CFLAGS) $(RDL_CFLAGS) $(ICONV_CFLAGS)
 xmllint_DEPENDENCIES = $(DEPS)
 xmllint_LDADD=  $(RDL_LIBS) $(LDADDS)
 
 xmlcatalog_SOURCES=xmlcatalog.c
-xmlcatalog_LDFLAGS = 
+xmlcatalog_CFLAGS = $(AM_CFLAGS) $(RDL_CFLAGS) $(ICONV_CFLAGS)
 xmlcatalog_DEPENDENCIES = $(DEPS)
 xmlcatalog_LDADD = $(RDL_LIBS) $(LDADDS)
 
 testThreads_SOURCES = testThreads.c
-testThreads_CFLAGS = $(EXTRA_CFLAGS) $(THREAD_CFLAGS)
-testThreads_LDFLAGS = 
+testThreads_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
 testThreads_DEPENDENCIES = $(DEPS)
 testThreads_LDADD= $(BASE_THREAD_LIBS) $(THREAD_LIBS) $(LDADDS)
 
-testAutomata_SOURCES=testAutomata.c
-testAutomata_LDFLAGS = 
-testAutomata_DEPENDENCIES = $(DEPS)
-testAutomata_LDADD= $(LDADDS)
-
 testModule_SOURCES=testModule.c
-testModule_LDFLAGS = 
 testModule_DEPENDENCIES = $(DEPS)
 testModule_LDADD= $(LDADDS)
 
 noinst_LTLIBRARIES = testdso.la
 testdso_la_SOURCES = testdso.c
-testdso_la_LDFLAGS = -module -no-undefined -avoid-version -rpath $(libdir)
+testdso_la_LDFLAGS = $(AM_LDFLAGS) \
+                    -module -no-undefined -avoid-version -rpath $(libdir)
 
 # that one forces the rebuild when "make rebuild" is run on doc/
 rebuild_testapi:
@@ -136,17 +174,14 @@ rebuild_testapi:
            $(PYTHON) $(srcdir)/gentest.py $(srcdir) ; fi )
 
 testapi_SOURCES=testapi.c
-testapi_LDFLAGS = 
 testapi_DEPENDENCIES = $(DEPS)
 testapi_LDADD= $(LDADDS)
 
 runxmlconf_SOURCES=runxmlconf.c
-runxmlconf_LDFLAGS = 
 runxmlconf_DEPENDENCIES = $(DEPS)
 runxmlconf_LDADD= $(LDADDS)
 
 #testOOM_SOURCES=testOOM.c testOOMlib.h testOOMlib.c
-#testOOM_LDFLAGS = 
 #testOOM_DEPENDENCIES = $(DEPS)
 #testOOM_LDADD= $(LDADDS)
 
@@ -155,12 +190,13 @@ check-local:
        [ -d result ] || $(LN_S) $(srcdir)/result .
        $(CHECKER) ./runtest$(EXEEXT)
        $(CHECKER) ./testrecurse$(EXEEXT)
-       ASAN_OPTIONS="$$ASAN_OPTIONS:detect_leaks=0" $(CHECKER) ./testapi$(EXEEXT)
+       $(CHECKER) ./testapi$(EXEEXT)
        $(CHECKER) ./testchar$(EXEEXT)
        $(CHECKER) ./testdict$(EXEEXT)
        $(CHECKER) ./testModule$(EXEEXT)
        $(CHECKER) ./testThreads$(EXEEXT)
        $(CHECKER) ./runxmlconf$(EXEEXT)
+       $(CHECKER) ./runsuite$(EXEEXT)
 
 # Compatibility name of the check target
 runtests: check
@@ -175,7 +211,27 @@ asan:
        ./configure CFLAGS="-fsanitize=address,undefined -Wformat -Werror=format-security -Werror=array-bounds -g" CXXFLAGS="-fsanitize=address,undefined -Wformat -Werror=format-security -Werror=array-bounds -g" LDFLAGS="-fsanitize=address,undefined" CC="clang" CXX="clang++" --disable-shared ; OptimOff  ; $(MAKE) clean ; $(MAKE)
 
 # Old test suite. This should be ported to C.
-tests: $(TEST_DEBUG) $(TEST_CATALOG) $(TEST_REGEXPS) $(TEST_SCHEMATRON) Timingtests $(TEST_VTIME) $(PYTHON_TESTS)
+
+OLD_TESTS = Timingtests
+if WITH_CATALOG_SOURCES
+OLD_TESTS += Catatests
+endif
+if WITH_DEBUG_SOURCES
+OLD_TESTS += Scripttests
+endif
+if WITH_SCHEMAS_SOURCES
+if WITH_PYTHON
+OLD_TESTS += RelaxNGPythonTests SchemasPythonTests
+endif
+endif
+if WITH_SCHEMATRON_SOURCES
+OLD_TESTS += Schematrontests
+endif
+if WITH_VALID_SOURCES
+OLD_TESTS += VTimingtests
+endif
+
+tests: $(OLD_TESTS)
 
 Scripttests : xmllint$(EXEEXT)
        @(echo > .memdump)
@@ -252,24 +308,6 @@ Catatests : xmlcatalog$(EXEEXT)
        grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
        rm -f $(srcdir)/result/catalogs/mycatalog)
 
-Automatatests: testAutomata$(EXEEXT)
-       @(echo > .memdump)
-       @echo "## Automata regression tests"
-       -@(for i in $(srcdir)/test/automata/* ; do \
-         name=`basename $$i`; \
-         if [ ! -d $$i ] ; then \
-         if [ ! -f $(srcdir)/result/automata/$$name ] ; then \
-             echo New test file $$name ; \
-             $(CHECKER) $(top_builddir)/testAutomata $$i > $(srcdir)/result/automata/$$name; \
-             grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
-         else \
-             log=`$(CHECKER) $(top_builddir)/testAutomata $$i 2>&1 > result.$$name ; \
-             grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
-             diff $(srcdir)/result/automata/$$name result.$$name` ; \
-             if [ -n "$$log" ] ; then echo $$name result ; echo "$$log" ; fi ; \
-             rm result.$$name ; \
-         fi ; fi ; done)
-
 dba100000.xml: dbgenattr.pl
        @echo "## generating dba100000.xml"
        @($(PERL) $(top_srcdir)/dbgenattr.pl 100000 > dba100000.xml)
@@ -365,42 +403,25 @@ cleanup:
 dist-hook: cleanup
        (cd $(srcdir) ; tar -cf - --exclude .git win32 os400 vms test result) | (cd $(distdir); tar xf -)
 
-dist-source: distdir
-       $(AMTAR) -chof - --exclude Tests --exclude test --exclude result $(distdir) | GZIP=$(GZIP_ENV) gzip -c >`echo "$(distdir)" | sed "s+libxml2+libxml2-sources+"`.tar.gz
-
-dist-test: distdir
-       (mkdir -p $(distdir))
-       (cd $(srcdir) ; tar -cf - --exclude .git xstc/Tests) | (cd $(distdir); tar xf -)
-       tar -cf - $(distdir)/test $(distdir)/result $(distdir)/xstc/Tests  $(distdir)/Makefile.tests $(distdir)/README.md $(distdir)/README.tests $(distdir)/testapi.c $(distdir)/runtest.c $(distdir)/runsuite.c | GZIP=$(GZIP_ENV) gzip -c >`echo "$(distdir)" | sed "s+libxml2+libxml2-tests+"`.tar.gz
-       @(rm -rf $(distdir)/xstc/Test)
-
-cleantar:
-       @(rm -f libxml*.tar.gz COPYING.LIB)
-
-rpm: cleanup cleantar
-       @(unset CDPATH ; $(MAKE) dist-source dist && rpmbuild -ta $(distdir).tar.gz)
-
-CLEANFILES = runxmlconf.log test.out *.gcda *.gcno *.res
+CLEANFILES = runsuite.log runxmlconf.log test.out *.gcda *.gcno *.res
 DISTCLEANFILES = COPYING missing.lst
 
-EXTRA_DIST = xml2-config.in libxml.spec.in \
-             libxml.m4 Copyright check-xml-test-suite.py gentest.py \
+EXTRA_DIST = Copyright check-xml-test-suite.py gentest.py \
             check-relaxng-test-suite.py check-relaxng-test-suite2.py \
             check-xsddata-test-suite.py check-xinclude-test-suite.py \
              example/Makefile.am example/gjobread.c example/gjobs.xml \
-            libxml-2.0.pc.in libxml-2.0-uninstalled.pc.in \
             libxml2-config.cmake.in autogen.sh \
             trionan.c trionan.h triostr.c triostr.h trio.c trio.h \
-            triop.h triodef.h libxml.h xzlib.h buf.h \
-            enc.h save.h genUnicode.py TODO_SCHEMAS \
+            triop.h triodef.h libxml.h \
+            genUnicode.py \
             dbgen.pl dbgenattr.pl \
-            README.tests Makefile.tests libxml2.syms timsort.h \
+            libxml2.syms timsort.h \
             README.zOS README.md \
             CMakeLists.txt config.h.cmake.in libxml2-config.cmake.cmake.in
 
 
 pkgconfigdir = $(libdir)/pkgconfig
-nodist_pkgconfig_DATA = libxml-2.0.pc
+pkgconfig_DATA = libxml-2.0.pc
 
 cmakedir = $(libdir)/cmake/libxml2
 cmake_DATA = libxml2-config.cmake
@@ -425,7 +446,7 @@ LCOV = /usr/bin/lcov
 GENHTML = /usr/bin/genhtml
 
 cov: clean-cov
-       if [ "`echo $(LDFLAGS) | grep coverage`" = "" ] ; then \
+       if [ "`echo $(AM_LDFLAGS) | grep coverage`" = "" ] ; then \
            echo not configured with coverage; exit 1 ; fi
        if [ ! -x $(LCOV) -o ! -x $(GENHTML) ] ; then \
            echo Need $(LCOV) and $(GENHTML) excecutables; exit 1 ; fi
diff --git a/Makefile.tests b/Makefile.tests
deleted file mode 100644 (file)
index 9f08dcf..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-# You may have to adjust to call the right compiler, or other options
-# for compiling and linking
-#
-
-CFLAGS=`xml2-config --cflags`
-LIBS=`xml2-config --libs`
-THREADLIB= -lpthread
-EXEEXT=
-
-all: runtest$(EXEEXT) runsuite$(EXEEXT) testapi$(EXEEXT) testchar$(EXEEXT)
-
-clean:
-       $(RM) runtest$(EXEEXT) runsuite$(EXEEXT) testapi$(EXEEXT)
-
-check: do_runtest do_testchar do_testapi do_runsuite
-
-runtest$(EXEEXT): runtest.c
-       $(CC) -o runtest$(EXEEXT) $(CFLAGS) runtest.c $(LIBS) $(THREADLIB)
-
-do_runtest: runtest$(EXEEXT)
-       ./runtest
-
-runsuite$(EXEEXT): runsuite.c
-       $(CC) -o runsuite$(EXEEXT) $(CFLAGS) runsuite.c $(LIBS)
-
-do_runsuite: runsuite$(EXEEXT)
-       ./runsuite
-
-testapi$(EXEEXT): testapi.c
-       $(CC) -o testapi$(EXEEXT) $(CFLAGS) testapi.c $(LIBS)
-
-do_testapi: testapi$(EXEEXT)
-       ./testapi
-
-testchar$(EXEEXT): testchar.c
-       $(CC) -o testchar$(EXEEXT) $(CFLAGS) testchar.c $(LIBS)
-
-do_testchar: testchar$(EXEEXT)
-       ./testchar
-
diff --git a/NEWS b/NEWS
index 7e35a4d..c92eb88 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,442 @@
 NEWS file for libxml2
 
+v2.11.5: Aug 9 2023
+
+### Regressions
+
+- parser: Make xmlSwitchEncoding always skip the BOM
+- autotools: Improve iconv check
+
+### Bug fixes
+
+- valid: Fix c1->parent pointer in xmlCopyDocElementContent
+- encoding: Always call ucnv_convertEx with flush set to false
+
+### Portability
+
+- autotools: fix Python module file ext for cygwin/msys2 (Christoph Reiter)
+
+### Tests
+
+- runtest: Fix compilation without LIBXML_HTML_ENABLED
+
+
+v2.11.4: May 18 2023
+
+Fixes a serious regression.
+
+- parser: Fix regression when push parsing UTF-8 sequences
+
+
+v2.11.3: May 11 2023
+
+Fixes more regressions.
+
+- xinclude: Fix false positives in inclusion loop detection
+- autotools: Fix ICU detection
+- parser: Fix "huge input lookup" error with push parser
+- xpath: Fix build without LIBXML_XPATH_ENABLED
+- hash: Fix possible startup crash with old libxslt versions
+- autoconf: fix iconv library paths (Mike Dalessio)
+
+
+v2.11.2: May 5 2023
+
+Fix regressions.
+
+- threads: Fix startup crash with weak symbol hack
+- win32: Don't depend on removed .def file
+- schemas: Fix memory leak in xmlSchemaValidateStream
+
+
+v2.11.1: Apr 30 2023
+
+Fixes build and ABI issues.
+
+- cmake: Fix va_copy detection (Luca Niccoli)
+- libxml.m4: Fix quoting
+- Link with --undefined-version
+- libxml2.syms: Revert removal of version information
+
+
+v2.11.0: Apr 28 2023
+
+### Major changes
+
+Protection against entity expansion attacks, also known as "billion laughs"
+has been greatly improved. Malicious files should be detected reliably now
+and false positives should be reduced. It is possible though that large
+documents which make heavy use of entities are rejected now.
+
+This release finally fixes symbol visibility on UNIX systems. Internal
+symbols will now be hidden. While these symbols were never declared in public
+headers, it was still possible to declare them manually. Now this won't work.
+
+All symbol information has been removed from the ELF version script to fix
+link errors with --no-undefined-version. The version nodes are kept so it
+should still be possible to run binaries linked against older versions.
+
+About 90 memory errors in code paths handling malloc failures have been fixed.
+While these issues shouldn't impact security, this improves robustness under
+memory pressure.
+
+The XInclude engine has been reworked to properly support nested includes.
+
+Several cases of quadratic behavior in the XML push parser have been fixed.
+
+Refactoring has begun on some buffering and encoding code with the goal of
+simplifying this part of the code base and improving error reporting.
+
+Other highlights:
+
+- Consolidated private header files.
+- Major rework of the autoconf build.
+- Deprecated several outdated and internal functions.
+
+Special thanks to Google's Open Source Security Subsidies program for
+sponsoring much of the work on this release!
+
+Ongoing work on libxml2 relies on funding. For a list of important open
+issues see <https://gitlab.gnome.org/GNOME/libxml2/-/issues/507>
+
+### Security
+
+- Fix use-after-free in xmlParseContentInternal() (David Kilzer)
+- xmllint: Fix use-after-free with --maxmem
+- parser: Fix OOB read when formatting error message
+- entities: Rework entity amplification checks
+
+### Regressions
+
+- parser: Fix regression in xmlParserNodeInfo accounting
+
+### Bug fixes
+
+- Fix memory errors in code handling malloc failures
+- encoding: Fix error code in asciiToUTF8
+- xpath: number('-') should return NaN
+- xmlParseStartTag2() contains typo when checking for default definitions for
+  an attribute in a namespace (David Kilzer)
+- uri: Fix handling of port numbers
+- error: Make sure that error messages are valid UTF-8
+- xinclude: Fix nested includes
+
+### Improvements
+
+- xmllint: Validate --maxmem integer option
+- xmlValidatePopElement() can return invalid value (-1) (David Kilzer)
+- parser: Rework EBCDIC code page detection
+- parser: Limit name length in xmlParseEncName
+- parser: Rework shrinking of input buffers
+- html: Rely on CUR_CHAR to grow the input buffer
+- parser: Rely on CUR_CHAR/NEXT to grow the input buffer
+- valid: Make xmlValidateElement non-recursive
+- html: Fix quadratic behavior in htmlParseTryOrFinish
+- xmllint: Fix memory leak with --pattern --stream
+- parser: Stop calling xmlParserInputShrink
+- html: Impose some length limits
+- valid: Allow xmlFreeValidCtxt(NULL)
+- parser: Stop calling xmlParserInputGrow
+- xinclude: Fix quadratic behavior in xmlXIncludeLoadTxt
+- xinclude: Abort immediately if max depth was exceeded
+- xpath: Only report the first error
+- error: Don't move past current position
+- error: Limit number of parser errors
+- parser: Lower entity nesting limit with XML_PARSE_HUGE
+- parser: Don't increase depth twice when parsing internal entities
+- parser: Improve detection of entity loops
+- parser: Only report a single entity error
+- libxml.h: Remove dubious definition of LIBXML_STATIC
+- html: Improve parsing of nested lists
+- memory: Don't use locks in xmlMemUsed
+- encoding: Remove unused variable xmlDefaultCharEncodingHandler
+- Rework initialization code
+- Add .editorconfig
+- parser: Merge misc, prolog and epilog cases in push parser
+- parser: Fix 'consumed' accounting when switching encodings
+- html: Fix check for end of comment in push parser
+- parser: Fix push parser with 1-3 byte initial chunk
+- parser: Rewrite push parser boundary checks
+- reader: Switch to xmlParserInputBufferCreateMem
+- html: Don't escape ASCII chars in href attributes
+- io: Don't shrink memory input buffers
+- parser: Don't call xmlSHRINK from push parser
+- parser: Ignore cdata argument in xmlParseCharData
+- parser: Rework push parser parser progress checks
+- io: Fix a few integer overflows in I/O statistics
+- io: Rework xmlParserInputBufferGrow with encodings
+- io: Remove xmlInputReadCallbackNop
+- io: Check for memory buffer early in xmlParserInputGrow
+- parser: Fix error message in xmlParseCommentComplex
+- Bypass proxy in nanoHTTP for hosts in "no_proxy" (Markus Jörg)
+- schemas: Fix infinite loop in xmlSchemaCheckElemSubstGroup
+- threads: Remove check for pthread_equal
+- xinclude: Rework XInclude cache
+- xinclude: Remove inefficient refcounting scheme
+- xmllint: Improve handling of empty XPath node sets
+- parser: Fix potential memory leak in xmlParseAttValueInternal
+- error: Don't use initGenericErrorDefaultFunc
+- xpath: Lower XPath recursion limit on Windows
+- Stop including sys/types.h
+- Don't define WIN32 macro
+- Make xmlNewSAXParserCtx take a const sax handler
+- Consolidate private header files
+- Remove internal macros from parserInternals.h
+- Move some HTML functions to correct header file
+- xmllint: Stop calling xmlSAXDefaultVersion
+- Introduce xmlNewSAXParserCtxt and htmlNewSAXParserCtxt
+- Don't mess with parser options in htmlParseDocument
+- Remove useless call to htmlDefaultSAXHandlerInit
+- Remove htmlDefaultSAXHandler from non-SAX1 build
+- Don't initialize SAX handler in htmlReadMemory
+- Fix htmlReadMemory mixing up XML and HTML functions
+- Don't use default SAX handler to report unrelated errors
+- Create stream with buffer in xmlNewStringInputStream
+- xmlcatalog: Fix memory leaks
+
+### Code quality
+
+- xzlib: Fix implicit sign change in xz_open
+- parser: Simplify calculation of available buffer space
+- parser: Use size_t when subtracting input buffer pointers
+- parser: Check for integer overflow when updating checkIndex
+- xpath: Fix harmless integer overflow in xmlXPathTranslateFunction
+- schematron: Use logical and
+- relaxng: Remove useless if statement
+- schemas: Remove useless if statement
+- pattern: Merge identical branches
+- regexp: Add sanity check in xmlRegCalloc2
+- regexp: Simplify xmlRegAtomPush
+- encoding: Cast toupper argument to unsigned char
+- uri: Add explicit cast in xmlSaveUri
+- buf: Fix return value of xmlBufGetInputBase
+- parser: Fix integer overflow of input ID
+- parser: Remove useless ent->etype test in xmlParseReference
+- parser: Remove useless ent->children tests in xmlParseReference
+- xmlmemory.c: Remove xmlMemContentShow
+- libxml.h: Add comments and indentation
+- libxml.h: Don't include stdio.h
+- xmlexports.h: Disable docs for internal macro XMLPUBLIC
+- parser: Simplify xmlParseConditionalSections
+- io: Rearrange code in xmlSwitchInputEncodingInt
+- warnings: Fix -Wstrict-prototypes warning
+- warnings: Remove set-but-unused variables
+- Fix compiler warnings in SAX2.c
+- Fix unused variable warning in python/types.c
+- Fix compiler warning in examples
+- Fix compiler warnings in fuzzing code
+- Remove unused code in nanohttp.c
+- Remove or annotate char casts
+- Don't use sizeof(xmlChar) or sizeof(char)
+- Remove explicit integer casts
+
+### Deprecations
+
+- parser: Deprecate more internal functions
+- parser: Deprecate some parser input functions
+- parser: Deprecate xmlString*DecodeEntities
+- threads: Deprecate some internal functions
+- buf: Deprecate static/immutable buffers
+- Deprecate internal parser functions
+- Deprecate old HTML SAX API
+- Generate deprecation warnings for old SAX API
+- Mark more functions setting globals as deprecated
+- Mark more parser functions as deprecated
+- Mark most SAX1 functions as deprecated
+- Deprecate some global variables
+
+### Portability
+
+- autoconf: Warn about outdated C compilers
+- win32: Remove broken libxml2.def.src
+- Remove symbols from version script
+- catalog.c: Silence a cast warning on VS 2022 (Lukáš Tyrychtr)
+- libxml.h: Remove ancient LynxOS setup
+- Use python3 not python (Ross Burton)
+- xstc/fixup-tests.py: port to Python 3 (Ross Burton)
+- xstc/fixup-tests.py: unify whitespace (Ross Burton)
+- Remove hacky heuristic from b2dc5675 (Alex Richardson)
+- Avoid creating an out-of-bounds pointer by rewriting a check
+  (Alex Richardson)
+- Hide internal functions
+- Correctly relocate internal pointers after realloc() (Alex Richardson)
+- Visual Studio builds: Allow silencing deprecation warnings (Chun-wei Fan)
+- Visual Studio: Define XML_DEPRECATED (Chun-wei Fan)
+- xmllint: Include <io.h> on Windows
+- warnings: Work around MSVC bug
+- sources: Silence C4013 warnings on Visual Studio (Chun-wei Fan)
+- python/setup.py.in: Improve Windows import patching (Chun-wei Fan)
+- python: Create .pyd on Windows
+- Fix Python build on Windows
+- Fix Windows compiler warnings in python/types.c
+- Fix libxml_PyFileGet
+- Remove BeOS support
+- Fix libxml_PyFileGet with stdout on macOS
+- Migrate from PyEval_ to PyObject_
+- Port build_glob.py to Python 3
+- Port genChRanges.py to Python 3
+- xmlexports.h: Remove LIBXML_FASTCALL optimization
+- Remove XMLCALL and XMLCDECL macros from public headers
+- Remove XMLDECL macro from .c files
+
+### Build systems
+
+- cmake: Link against `dl` and `dld` only when `LIBXML2_WITH_MODULES` is
+  enabled (Alexander Kutelev)
+- autotools: Fix make distcheck
+- Remove RPM build, Makefile.tests, README.tests
+- libxml.m4: deprecate AM_PATH_XML2, wrap PKG_CHECK_MODULES instead
+  (Ross Burton)
+- libxml.m4: fix -Wstrict-prototypes (Sam James)
+- cmake: Build static library with -DLIBXML_STATIC
+- autotools: Don't use version script on Windows
+- autotools: Fix winsock detection
+- autotools: Only add network libraries if HTTP/FTP enabled
+- autotools: Disable parallel Python build
+- python: Don't output missing generators during build
+- build: Remove check for broken ss_family
+- http: Simplify IPv6 checks
+- autotools: Fix network checks on Windows
+- Fix detection of GNU libiconv
+- cmake: Fix Python installation
+- cmake: Don't check for Python 2
+- configure.ac: Also check for MSYS host
+- Improve network library detection
+- Detect ws2_32 with AC_SEARCH_LIBS
+- Rework network configure checks
+- Remove arg cast configure checks
+- Fix dlopen check
+- Remove HAVE_WIN32_THREADS configuration flag
+- Rework dlopen and pthread detection
+- Fix test in configure.ac
+- cmake: Enable GCC compiler warnings
+- Always link with -no-undefined
+- Use AM_CFLAGS and AM_LDFLAGS consistently
+- Remove -Wredundant-decls
+- Call AC_CHECK_* with multiple arguments
+- configure.ac: Remove checks for unused programs
+- Rework library detection in configure.ac
+- Rearrange configure.ac
+- Consolidate zlib and lzma detection
+- Remove "runtime debugging"
+- Consolidate simple API modules in configure.ac
+- Fix dependency resolution in configure.ac
+- Fix --with-valid --without-regexps build
+- Fix --with-schemas --without-xpath build
+- Don't build unneeded .c source files
+- Move xmlIsXHTML to tree.c
+- Cleanup distribution settings in Makefile.am
+- Also clean *.pyc files for Python 2
+- Don't distribute libxml2.spec
+
+### Tests
+
+- testchar: Add test for memory pull parser with encoding
+- fuzz: Also test init function of URI fuzzer
+- fuzz: Separate fuzzer for DTD validation
+- gitlab-ci: Enable all "integer" sanitizers
+- fuzz: Inject random malloc failures
+- fuzz: Support variable integer sizes in fuzz data
+- fuzz: Fix duplicate detection in fuzzEntityRecorder
+- fuzz: Set filename in xmlFuzzEntityLoader
+- fuzz: Allow xmlFuzzReadString(NULL)
+- fuzz: Fix Makefile dependencies
+- fuzz: Add test/recurse to seed corpus
+- fuzz: Add separate XInclude fuzzer
+- runsuite: Some errors are expected
+- testrecurse: Test entity expansion stats
+- testapi.c: Initialize catalog early
+- gentest.py: Fix memory leak in API tests
+- tests: Enable "runsuite" test
+- python/tests/reader2: use absolute paths everywhere (Ross Burton)
+- python/tests/reader2: always exit(1) if a test fails (Ross Burton)
+- testModule: exit if the module can't be opened (Ross Burton)
+- CI: disable modules in gcc:static build (Ross Burton)
+- CI: fix CI on MinGW builds (Ross Burton)
+- python: Fix memory leak checks
+- tests: Check that xmlInitParser doesn't allocate memory
+- tests: Fix use-after-free in Python tests
+- tests: Remove unneeded #includes
+- gitlab-ci: Make Test-Msvc exit if ctest fails
+- gitlab-ci: Treat compiler warnings as errors on MSVC
+- test: Add test for push parser boundaries
+- gitlab-ci: Upgrade image to Ubuntu 22.10, reenable MSan
+- gitlab-ci: Reenable LeakSanitizer
+- gitlab-ci: Fix llvm-symbolizer
+- xinclude: Don't create result doc for test with errors
+- xinclude: Also test error messages
+- gitlab-ci: Allow cast-align warnings from clang
+- gitlab-ci: Fix tar invocation
+- gitlab-ci: Move MSVC test to separate script
+- gitlab-ci: Fix SUFFIX, remove MINGW_PATH
+- gitlab-ci: Consolidate CMake test scripts
+- gitlab-ci: Only install MinGW autotools if needed
+- gitlab-ci: Only install cmake MinGW package if needed
+- gitlab-ci: Install 7-Zip using the .msi
+- Use $MSYSTEM and 'bash -lc' in MinGW CI
+- Add CI job for MinGW/Autotools
+- Consolidate CI scripts
+- Allow empty MINGW_PACKAGE_PREFIX
+- Move Dockerfile to .gitlab-ci directory
+- testapi: Disable on Windows for now
+- Disable fuzzer tests if glob.h wasn't found
+- Move automata test to runtest.c
+- Fix testapi when building --without-sax1
+
+# Documentation
+
+- doc: Remove ancient files
+- Remove ancient TODOs
+- html: Fix htmlInitAutoClose documentation
+- doc: Mention new location of XML catalog as breaking change
+- doc: Mention potentially breaking changes in NEWS
+- doc: Remove xmlDllMain from documentation and version script
+- doc: Mention ${sysconfdir} in man pages
+- doc: Document xmlcatalog --convert
+- doc: Document xmllint --nodict and --pedantic
+- doc: Fix indentation in source XML files
+- xmllint: Document --quiet option
+- Improve cross-references in API docs
+- Improve documentation of globals
+- Fix documentation parser
+- Support comments for global variables in documentation
+- Fix update call in apibuild.py
+- Don't index anything in DOC_DISABLE sections
+- Fix warnings from apibuild.py
+- Start with documentation for maintainers
+
+
+v2.10.4: Apr 11 2023
+
+### Security
+
+- [CVE-2023-29469] Hashing of empty dict strings isn't deterministic
+- [CVE-2023-28484] Fix null deref in xmlSchemaFixupComplexType
+- schemas: Fix null-pointer-deref in xmlSchemaCheckCOSSTDerivedOK
+
+### Regressions
+
+- SAX2: Ignore namespaces in HTML documents
+- io: Fix "buffer full" error with certain buffer sizes
+
+
+v2.10.3: Oct 14 2022
+
+### Security
+
+- [CVE-2022-40304] Fix dict corruption caused by entity reference cycles
+- [CVE-2022-40303] Fix integer overflows with XML_PARSE_HUGE
+- Fix overflow check in SAX2.c
+
+### Portability
+
+- win32: Fix build with VS2013
+
+### Build system
+
+- cmake: Set SOVERSION
+
+
 v2.10.2: Aug 29 2022
 
 ### Improvements
@@ -43,6 +480,47 @@ v2.10.1: Aug 25 2022
 
 v2.10.0: Aug 17 2022
 
+### Breaking changes
+
+The Docbook parser module and all related symbols habe been removed completely.
+This was experimental code which never worked and generated a deprecation
+warning for 15+ years. The library's soname wasn't changed in order to allow
+seamless upgrades to later versions. If this concerns you, consider bumping
+soname yourself.
+
+Some other modules are now disabled by default and will eventually be removed
+completely:
+
+- Support for XPointer locations (ranges and points): This was based on
+  a W3C specification which never got beyond Working Draft status. To my
+  knowledge, there's no software supporting this spec which is still
+  maintained. You now have to enable this code by passing the
+  `--with-xptr-locs` configuration option. Be warned that this part of
+  the code base is buggy and had many security issues in the past.
+
+- Support for the built-in FTP client (`--with-ftp`).
+
+- Support for "legacy" functions (`--with-legacy`).
+
+If you're concerned about ABI stability and haven't disabled these modules
+already, add the following configuration options or bump soname yourself:
+
+    --with-ftp
+    --with-legacy
+    --with-xptr-locs
+
+Several functions of the public API were deprecated. Most of them should be
+completely unused and will generate a deprecation warning now.
+
+The autoconf build now uses the sysconfdir variable for the location of
+the default catalog file. The path changed from hardcoded /etc/xml/catalog
+to ${sysconfdir}/xml/catalog. The sysconfdir variable defaults to
+${prefix}/etc, prefix defaults to /usr/local, so without other options
+the path becomes /usr/local/etc/xml/catalog. If you want the old behavior,
+configure with
+
+    --sysconfdir=/etc
+
 ### Security
 
 - [CVE-2022-2309] Reset nsNr in xmlCtxtReset
index ad423e6..f8c6aac 100644 (file)
--- a/README.md
+++ b/README.md
@@ -3,15 +3,17 @@
 libxml2 is an XML toolkit implemented in C, originally developed for
 the GNOME Project.
 
-Full documentation is available at
-<https://gitlab.gnome.org/GNOME/libxml2/-/wikis>.
+Official releases can be downloaded from
+<https://download.gnome.org/sources/libxml2/>
+
+The git repository is hosted on GNOME's GitLab server:
+<https://gitlab.gnome.org/GNOME/libxml2>
 
 Bugs should be reported at
-<https://gitlab.gnome.org/GNOME/libxml2/-/issues>.
+<https://gitlab.gnome.org/GNOME/libxml2/-/issues>
 
-A mailing list xml@gnome.org is available. You can subscribe at
-<https://mail.gnome.org/mailman/listinfo/xml>. The list archive is at
-<https://mail.gnome.org/archives/xml/>.
+Documentation is available at
+<https://gitlab.gnome.org/GNOME/libxml2/-/wikis>
 
 ## License
 
diff --git a/README.tests b/README.tests
deleted file mode 100644 (file)
index 8d86f2a..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-                       README.tests
-
-   Instructions for standalone test regressions of libxml2
-
-libxml2-tests-$version.tar.gz contains 3 standalone C programs as well
-as a large amount of tests and results coming from libxml2 itself and
-from W3C, NIST, Sun Microsystems, Microsoft and James Clark. Each C
-program has a different testing purpose:
-
-  runtest.c : runs libxml2 basic internal regression tests
-  runsuite.c: runs libxml2 against external regression tests
-  testapi.c : exercises the library public entry points
-  testchar.c: exercise the check of character ranges and UTF-8 validation
-
-The command:
-
-  make check
-or
-  make -f Makefile.tests check
-
-should be sufficient on an Unix system to build and exercise the tests
-for the version of the library installed on the system. Note however
-that there isn't backward compatibility provided so if the installed
-version is older than the testsuite one, failing to compile or run the tests
-is likely. In any event this won't work with an installed libxml2 older
-than 2.6.20.
-
-Building on other platforms should be a matter of compiling the C files
-like any other program using libxml2, running the test should be done
-simply by launching the resulting executables.
-
-Also note the availability of a "make valgrind" target which will run the
-above tests under valgrind to check for memory errors (but this relies
-on the availability of the valgrind command and take far more time to
-complete).
-
-Daniel Veillard
-Mon May  7 2012
-
diff --git a/SAX2.c b/SAX2.c
index ec89046..b6be1a6 100644 (file)
--- a/SAX2.c
+++ b/SAX2.c
 #include <libxml/HTMLtree.h>
 #include <libxml/globals.h>
 
-/* Define SIZE_T_MAX unless defined through <limits.h>. */
-#ifndef SIZE_T_MAX
-# define SIZE_T_MAX     ((size_t)-1)
-#endif /* !SIZE_T_MAX */
+#include "private/error.h"
+#include "private/parser.h"
+#include "private/tree.h"
 
 /* #define DEBUG_SAX2 */
 /* #define DEBUG_SAX2_TREE */
@@ -388,6 +387,9 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
        xmlCharEncoding enc;
        int oldcharset;
        const xmlChar *oldencoding;
+       int oldprogressive;
+        unsigned long consumed;
+        size_t buffered;
 
        /*
         * Ask the Entity resolver to load the damn thing
@@ -410,18 +412,22 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
        oldinputTab = ctxt->inputTab;
        oldcharset = ctxt->charset;
        oldencoding = ctxt->encoding;
+        oldprogressive = ctxt->progressive;
        ctxt->encoding = NULL;
+        ctxt->progressive = 0;
 
        ctxt->inputTab = (xmlParserInputPtr *)
                         xmlMalloc(5 * sizeof(xmlParserInputPtr));
        if (ctxt->inputTab == NULL) {
            xmlSAX2ErrMemory(ctxt, "xmlSAX2ExternalSubset");
+            xmlFreeInputStream(input);
            ctxt->input = oldinput;
            ctxt->inputNr = oldinputNr;
            ctxt->inputMax = oldinputMax;
            ctxt->inputTab = oldinputTab;
            ctxt->charset = oldcharset;
            ctxt->encoding = oldencoding;
+            ctxt->progressive = oldprogressive;
            return;
        }
        ctxt->inputNr = 0;
@@ -456,6 +462,18 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
 
        while (ctxt->inputNr > 1)
            xmlPopInput(ctxt);
+
+        consumed = ctxt->input->consumed;
+        buffered = ctxt->input->cur - ctxt->input->base;
+        if (buffered > ULONG_MAX - consumed)
+            consumed = ULONG_MAX;
+        else
+            consumed += buffered;
+        if (consumed > ULONG_MAX - ctxt->sizeentities)
+            ctxt->sizeentities = ULONG_MAX;
+        else
+            ctxt->sizeentities += consumed;
+
        xmlFreeInputStream(ctxt->input);
         xmlFree(ctxt->inputTab);
 
@@ -472,6 +490,7 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
             (!xmlDictOwns(ctxt->dict, ctxt->encoding))))
            xmlFree((xmlChar *) ctxt->encoding);
        ctxt->encoding = oldencoding;
+        ctxt->progressive = oldprogressive;
        /* ctxt->wellFormed = oldwellFormed; */
     }
 }
@@ -1316,25 +1335,25 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
 
     /* !!!!!! <a toto:arg="" xmlns:toto="http://toto.com"> */
     ret = xmlNewNsPropEatName(ctxt->node, namespace, name, NULL);
+    if (ret == NULL)
+        goto error;
 
-    if (ret != NULL) {
-        if ((ctxt->replaceEntities == 0) && (!ctxt->html)) {
-           xmlNodePtr tmp;
-
-           ret->children = xmlStringGetNodeList(ctxt->myDoc, value);
-           tmp = ret->children;
-           while (tmp != NULL) {
-               tmp->parent = (xmlNodePtr) ret;
-               if (tmp->next == NULL)
-                   ret->last = tmp;
-               tmp = tmp->next;
-           }
-       } else if (value != NULL) {
-           ret->children = xmlNewDocText(ctxt->myDoc, value);
-           ret->last = ret->children;
-           if (ret->children != NULL)
-               ret->children->parent = (xmlNodePtr) ret;
-       }
+    if ((ctxt->replaceEntities == 0) && (!ctxt->html)) {
+        xmlNodePtr tmp;
+
+        ret->children = xmlStringGetNodeList(ctxt->myDoc, value);
+        tmp = ret->children;
+        while (tmp != NULL) {
+            tmp->parent = (xmlNodePtr) ret;
+            if (tmp->next == NULL)
+                ret->last = tmp;
+            tmp = tmp->next;
+        }
+    } else if (value != NULL) {
+        ret->children = xmlNewDocText(ctxt->myDoc, value);
+        ret->last = ret->children;
+        if (ret->children != NULL)
+            ret->children->parent = (xmlNodePtr) ret;
     }
 
 #ifdef LIBXML_VALID_ENABLED
@@ -1613,12 +1632,15 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
        ctxt->validate = 0;
     }
 
-
-    /*
-     * Split the full name into a namespace prefix and the tag name
-     */
-    name = xmlSplitQName(ctxt, fullname, &prefix);
-
+    if (ctxt->html) {
+        prefix = NULL;
+        name = xmlStrdup(fullname);
+    } else {
+        /*
+         * Split the full name into a namespace prefix and the tag name
+         */
+        name = xmlSplitQName(ctxt, fullname, &prefix);
+    }
 
     /*
      * Note : the namespace resolution is deferred until the end of the
@@ -1643,8 +1665,8 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
     ctxt->nodemem = -1;
     if (ctxt->linenumbers) {
        if (ctxt->input != NULL) {
-           if (ctxt->input->line < USHRT_MAX)
-               ret->line = (unsigned short) ctxt->input->line;
+           if ((unsigned) ctxt->input->line < (unsigned) USHRT_MAX)
+               ret->line = ctxt->input->line;
            else
                ret->line = USHRT_MAX;
        }
@@ -1808,13 +1830,6 @@ xmlSAX2EndElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED)
        xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2EndElement(%s)\n", name);
 #endif
 
-    /* Capture end position and add node */
-    if (cur != NULL && ctxt->record_info) {
-      ctxt->nodeInfo->end_pos = ctxt->input->cur - ctxt->input->base;
-      ctxt->nodeInfo->end_line = ctxt->input->line;
-      ctxt->nodeInfo->node = cur;
-      xmlParserAddNodeInfo(ctxt, ctxt->nodeInfo);
-    }
     ctxt->nodemem = -1;
 
 #ifdef LIBXML_VALID_ENABLED
@@ -1908,8 +1923,8 @@ skip:
 
     if (ctxt->linenumbers) {
        if (ctxt->input != NULL) {
-           if (ctxt->input->line < USHRT_MAX)
-               ret->line = (unsigned short) ctxt->input->line;
+           if ((unsigned) ctxt->input->line < (unsigned) USHRT_MAX)
+               ret->line = ctxt->input->line;
            else {
                ret->line = USHRT_MAX;
                if (ctxt->options & XML_PARSE_BIG_LINES)
@@ -2265,6 +2280,7 @@ xmlSAX2StartElementNs(void *ctx,
                ret->name = lname;
            if (ret->name == NULL) {
                xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs");
+                xmlFree(ret);
                return;
            }
        }
@@ -2286,8 +2302,8 @@ xmlSAX2StartElementNs(void *ctx,
     }
     if (ctxt->linenumbers) {
        if (ctxt->input != NULL) {
-           if (ctxt->input->line < USHRT_MAX)
-               ret->line = (unsigned short) ctxt->input->line;
+           if ((unsigned) ctxt->input->line < (unsigned) USHRT_MAX)
+               ret->line = ctxt->input->line;
            else
                ret->line = USHRT_MAX;
        }
@@ -2456,24 +2472,15 @@ xmlSAX2EndElementNs(void *ctx,
                    const xmlChar * URI ATTRIBUTE_UNUSED)
 {
     xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
-    xmlParserNodeInfo node_info;
-    xmlNodePtr cur;
 
     if (ctx == NULL) return;
-    cur = ctxt->node;
-    /* Capture end position and add node */
-    if ((ctxt->record_info) && (cur != NULL)) {
-        node_info.end_pos = ctxt->input->cur - ctxt->input->base;
-        node_info.end_line = ctxt->input->line;
-        node_info.node = cur;
-        xmlParserAddNodeInfo(ctxt, &node_info);
-    }
     ctxt->nodemem = -1;
 
 #ifdef LIBXML_VALID_ENABLED
     if (ctxt->validate && ctxt->wellFormed &&
         ctxt->myDoc && ctxt->myDoc->intSubset)
-        ctxt->valid &= xmlValidateOneElement(&ctxt->vctxt, ctxt->myDoc, cur);
+        ctxt->valid &= xmlValidateOneElement(&ctxt->vctxt, ctxt->myDoc,
+                                             ctxt->node);
 #endif /* LIBXML_VALID_ENABLED */
 
     /*
@@ -2596,22 +2603,23 @@ xmlSAX2Text(xmlParserCtxtPtr ctxt, const xmlChar *ch, int len,
                xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters: xmlStrdup returned NULL");
                return;
            }
-            if (((size_t)ctxt->nodelen + (size_t)len > XML_MAX_TEXT_LENGTH) &&
+           if (ctxt->nodelen > INT_MAX - len) {
+                xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters overflow prevented");
+                return;
+           }
+            if ((ctxt->nodelen + len > XML_MAX_TEXT_LENGTH) &&
                 ((ctxt->options & XML_PARSE_HUGE) == 0)) {
                 xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters: huge text node");
                 return;
             }
-           if ((size_t)ctxt->nodelen > SIZE_T_MAX - (size_t)len ||
-               (size_t)ctxt->nodemem + (size_t)len > SIZE_T_MAX / 2) {
-                xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters overflow prevented");
-                return;
-           }
            if (ctxt->nodelen + len >= ctxt->nodemem) {
                xmlChar *newbuf;
-               size_t size;
+               int size;
 
-               size = ctxt->nodemem + len;
-               size *= 2;
+               size = ctxt->nodemem > INT_MAX - len ?
+                       INT_MAX :
+                       ctxt->nodemem + len;
+               size = size > INT_MAX / 2 ? INT_MAX : size * 2;
                 newbuf = (xmlChar *) xmlRealloc(lastChild->content,size);
                if (newbuf == NULL) {
                    xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters");
@@ -2635,7 +2643,8 @@ xmlSAX2Text(xmlParserCtxtPtr ctxt, const xmlChar *ch, int len,
            /* Mixed content, first time */
             if (type == XML_TEXT_NODE) {
                 lastChild = xmlSAX2TextNode(ctxt, ch, len);
-                lastChild->doc = ctxt->myDoc;
+                if (lastChild != NULL)
+                    lastChild->doc = ctxt->myDoc;
             } else
                 lastChild = xmlNewCDataBlock(ctxt->myDoc, ch, len);
            if (lastChild != NULL) {
@@ -2710,8 +2719,8 @@ xmlSAX2ProcessingInstruction(void *ctx, const xmlChar *target,
 
     if (ctxt->linenumbers) {
        if (ctxt->input != NULL) {
-           if (ctxt->input->line < USHRT_MAX)
-               ret->line = (unsigned short) ctxt->input->line;
+           if ((unsigned) ctxt->input->line < (unsigned) USHRT_MAX)
+               ret->line = ctxt->input->line;
            else
                ret->line = USHRT_MAX;
        }
@@ -2770,8 +2779,8 @@ xmlSAX2Comment(void *ctx, const xmlChar *value)
     if (ret == NULL) return;
     if (ctxt->linenumbers) {
        if (ctxt->input != NULL) {
-           if (ctxt->input->line < USHRT_MAX)
-               ret->line = (unsigned short) ctxt->input->line;
+           if ((unsigned) ctxt->input->line < (unsigned) USHRT_MAX)
+               ret->line = ctxt->input->line;
            else
                ret->line = USHRT_MAX;
        }
@@ -2829,6 +2838,8 @@ static int xmlSAX2DefaultVersionValue = 2;
  * xmlSAXDefaultVersion:
  * @version:  the version, 1 or 2
  *
+ * DEPRECATED: Use parser option XML_PARSE_SAX1.
+ *
  * Set the default version of SAX used globally by the library.
  * By default, during initialization the default is set to 2.
  * Note that it is generally a better coding style to use
@@ -2929,7 +2940,7 @@ xmlSAX2InitDefaultSAXHandler(xmlSAXHandler *hdlr, int warning)
 /**
  * xmlDefaultSAXHandlerInit:
  *
- * DEPRECATED: This function will be made private. Call xmlInitParser to
+ * DEPRECATED: This function is a no-op. Call xmlInitParser to
  * initialize the library.
  *
  * Initialize the default SAX2 handler
@@ -2937,9 +2948,6 @@ xmlSAX2InitDefaultSAXHandler(xmlSAXHandler *hdlr, int warning)
 void
 xmlDefaultSAXHandlerInit(void)
 {
-#ifdef LIBXML_SAX1_ENABLED
-    xmlSAXVersion((xmlSAXHandlerPtr) &xmlDefaultSAXHandler, 1);
-#endif /* LIBXML_SAX1_ENABLED */
 }
 
 #ifdef LIBXML_HTML_ENABLED
@@ -2990,15 +2998,12 @@ xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr)
 /**
  * htmlDefaultSAXHandlerInit:
  *
- * DEPRECATED: This function will be made private. Call xmlInitParser to
+ * DEPRECATED: This function is a no-op. Call xmlInitParser to
  * initialize the library.
- *
- * Initialize the default SAX handler
  */
 void
 htmlDefaultSAXHandlerInit(void)
 {
-    xmlSAX2InitHtmlDefaultSAXHandler((xmlSAXHandlerPtr) &htmlDefaultSAXHandler);
 }
 
 #endif /* LIBXML_HTML_ENABLED */
diff --git a/TODO b/TODO
deleted file mode 100644 (file)
index 95e1c34..0000000
--- a/TODO
+++ /dev/null
@@ -1,276 +0,0 @@
-124907 HTML parse buffer problem when parsing larse in-memory docs
-124110 DTD validation && wrong namespace
-123564 xmllint --html --format
-
-           TODO for the XML parser and stuff:
-          ==================================
-
-    this tend to be outdated :-\ ...
-
-DOCS:
-=====
-
-- use case of using XInclude to load for example a description.
-  order document + product base -(XSLT)-> quote with XIncludes 
-                                                   |
-  HTML output with description of parts <---(XSLT)--
-
-TODO:
-=====
-- XInclude at the SAX level (libSRVG)
-- fix the C code prototype to bring back doc/libxml-undocumented.txt
-  to a reasonable level
-- Computation of base when HTTP redirect occurs, might affect HTTP
-  interfaces.
-- Computation of base in XInclude. Relativization of URIs.
-- listing all attributes in a node.
-- Better checking of external parsed entities TAG 1234
-- Go through erratas and do the cleanup.
-  http://www.w3.org/XML/xml-19980210-errata ... started ...
-- jamesh suggestion: SAX like functions to save a document ie. call a
-  function to open a new element with given attributes, write character
-  data, close last element, etc
-  + inversted SAX, initial patch in April 2002 archives.
-- htmlParseDoc has parameter encoding which is not used.
-  Function htmlCreateDocParserCtxt ignore it.
-- fix realloc() usage.
-- Stricten the UTF8 conformance (Martin Duerst):
-  http://www.w3.org/2001/06/utf-8-test/.
-  The bad files are in http://www.w3.org/2001/06/utf-8-wrong/.
-- xml:id normalized value
-
-TODO:
-=====
-
-- move all string manipulation functions (xmlStrdup, xmlStrlen, etc.) to
-  global.c. Bjorn noted that the following files depends on parser.o solely
-  because of these string functions: entities.o, global.o, hash.o, tree.o,
-  xmlIO.o, and xpath.o.
-
-- Optimization of tag strings allocation ?
-
-- maintain coherency of namespace when doing cut'n paste operations
-  => the functions are coded, but need testing
-
-- function to rebuild the ID table
-- functions to rebuild the DTD hash tables (after DTD changes).
-   
-
-EXTENSIONS:
-===========
-
-- Tools to produce man pages from the SGML docs.
-
-- Add Xpointer recognition/API
-
-- Add Xlink recognition/API
-  => started adding an xlink.[ch] with a unified API for XML and HTML.
-     it's crap :-(
-
-- Implement XSchemas
-  => Really need to be done <grin/>
-  - datatype are complete, but structure support is very limited.
-
-- extend the shell with:
-   - edit
-   - load/save
-   - mv (yum, yum, but it's harder because directories are ordered in
-     our case, mvup and mvdown would be required)
-
-
-Done:
-=====
-
-- Add HTML validation using the XHTML DTD
-  - problem: do we want to keep and maintain the code for handling
-    DTD/System ID cache directly in libxml ?
-  => not really done that way, but there are new APIs to check elements
-     or attributes. Otherwise XHTML validation directly ...
-
-- XML Schemas datatypes except Base64 and BinHex
-
-- Relax NG validation
-
-- XmlTextReader streaming API + validation
-
-- Add a DTD cache prefilled with xhtml DTDs and entities and a program to
-  manage them -> like the /usr/bin/install-catalog from SGML
-  right place seems $datadir/xmldtds
-  Maybe this is better left to user apps
-  => use a catalog instead , and xhtml1-dtd package
-
-- Add output to XHTML
-  => XML serializer automatically recognize the DTd and apply the specific
-     rules.
-
-- Fix output of <tst val="x&#xA;y"/>
-
-- compliance to XML-Namespace checking, see section 6 of
-  http://www.w3.org/TR/REC-xml-names/
-
-- Correct standalone checking/emitting (hard)
-  2.9 Standalone Document Declaration
-
-- Implement OASIS XML Catalog support
-  http://www.oasis-open.org/committees/entity/
-
-- Get OASIS testsuite to a more friendly result, check all the results
-  once stable. the check-xml-test-suite.py script does this
-
-- Implement XSLT
-  => libxslt
-
-- Finish XPath
-  => attributes addressing troubles
-  => defaulted attributes handling
-  => namespace axis ?
-  done as XSLT got debugged
-
-- bug reported by Michael Meallin on validation problems
-  => Actually means I need to add support (and warn) for non-deterministic
-     content model.
-- Handle undefined namespaces in entity contents better ... at least
-  issue a warning
-- DOM needs
-  int xmlPruneProp(xmlNodePtr node, xmlAtttrPtr attr);
-  => done it's actually xmlRemoveProp xmlUnsetProp xmlUnsetNsProp
-
-- HTML: handling of Script and style data elements, need special code in
-  the parser and saving functions (handling of < > " ' ...):
-  http://www.w3.org/TR/html4/types.html#type-script
-  Attributes are no problems since entities are accepted.
-- DOM needs
-  xmlAttrPtr xmlNewDocProp(xmlDocPtr doc, const xmlChar *name, const xmlChar *value)
-- problem when parsing hrefs with & with the HTML parser (IRC ac)
-- If the internal encoding is not UTF8 saving to a given encoding doesn't
-  work => fix to force UTF8 encoding ...
-  done, added documentation too
-- Add an ASCII I/O encoder (asciiToUTF8 and UTF8Toascii)
-- Issue warning when using non-absolute namespaces URI.
-- the html parser should add <head> and <body> if they don't exist
-  started, not finished.
-  Done, the automatic closing is added and 3 testcases were inserted
-- Command to force the parser to stop parsing and ignore the rest of the file.
-  xmlStopParser() should allow this, mostly untested
-- support for HTML empty attributes like <hr noshade>
-- plugged iconv() in for support of a large set of encodings.
-- xmlSwitchToEncoding() rewrite done
-- URI checkings (no fragments) rfc2396.txt
-- Added a clean mechanism for overload or added input methods:
-  xmlRegisterInputCallbacks()
-- dynamically adapt the alloc entry point to use g_alloc()/g_free()
-  if the programmer wants it: 
-    - use xmlMemSetup() to reset the routines used.
-- Check attribute normalization especially xmlGetProp()
-- Validity checking problems for NOTATIONS attributes
-- Validity checking problems for ENTITY ENTITIES attributes
-- Parsing of a well balanced chunk xmlParseBalancedChunkMemory()
-- URI module: validation, base, etc ... see uri.[ch]
-- turn tester into a generic program xmllint installed with libxml
-- extend validity checks to go through entities content instead of
-  just labelling them PCDATA
-- Save Dtds using the children list instead of dumping the tables,
-  order is preserved as well as comments and PIs
-- Wrote a notice of changes requires to go from 1.x to 2.x
-- make sure that all SAX callbacks are disabled if a WF error is detected
-- checking/handling of newline normalization
-  http://localhost/www.xml.com/axml/target.html#sec-line-ends
-- correct checking of '&' '%' on entities content.
-- checking of PE/Nesting on entities declaration
-- checking/handling of xml:space
-   - checking done.
-   - handling done, not well tested
-- Language identification code, productions [33] to [38]
-  => done, the check has been added and report WFness errors
-- Conditional sections in DTDs [61] to [65]
-  => should this crap be really implemented ???
-  => Yep OASIS testsuite uses them
-- Allow parsed entities defined in the internal subset to override
-  the ones defined in the external subset (DtD customization).
-  => This mean that the entity content should be computed only at
-     use time, i.e. keep the orig string only at parse time and expand
-     only when referenced from the external subset :-(
-     Needed for complete use of most DTD from Eve Maler
-- Add regression tests for all WFC errors
-  => did some in test/WFC
-  => added OASIS testsuite routines
-     http://xmlsoft.org/conf/result.html
-
-- I18N: http://wap.trondheim.com/vaer/index.phtml is not XML and accepted
-  by the XML parser, UTF-8 should be checked when there is no "encoding"
-  declared !
-- Support for UTF-8 and UTF-16 encoding
-  => added some conversion routines provided by Martin Durst
-     patched them, got fixes from @@@
-     I plan to keep everything internally as UTF-8 (or ISO-Latin-X)
-     this is slightly more costly but more compact, and recent processors
-     efficiency is cache related. The key for good performances is keeping
-     the data set small, so will I.
-  => the new progressive reading routines call the detection code
-     is enabled, tested the ISO->UTF-8 stuff
-- External entities loading: 
-   - allow override by client code
-   - make sure it is called for all external entities referenced
-  Done, client code should use xmlSetExternalEntityLoader() to set
-  the default loading routine. It will be called each time an external
-  entity entity resolution is triggered.
-- maintain ID coherency when removing/changing attributes
-  The function used to deallocate attributes now check for it being an
-  ID and removes it from the table.
-- push mode parsing i.e. non-blocking state based parser
-  done, both for XML and HTML parsers. Use xmlCreatePushParserCtxt()
-  and xmlParseChunk() and html counterparts.
-  The tester program now has a --push option to select that parser 
-  front-end. Douplicated tests to use both and check results are similar.
-
-- Most of XPath, still see some troubles and occasionnal memleaks.
-- an XML shell, allowing to traverse/manipulate an XML document with
-  a shell like interface, and using XPath for the anming syntax
-  - use of readline and history added when available
-  - the shell interface has been cleanly separated and moved to debugXML.c
-- HTML parser, should be fairly stable now
-- API to search the lang of an attribute
-- Collect IDs at parsing and maintain a table. 
-   PBM: maintain the table coherency
-   PBM: how to detect ID types in absence of DtD !
-- Use it for XPath ID support
-- Add validity checking
-  Should be finished now !
-- Add regression tests with entity substitutions
-
-- External Parsed entities, either XML or external Subset [78] and [79]
-  parsing the xmllang DtD now works, so it should be sufficient for
-  most cases !
-
-- progressive reading. The entity support is a first step toward
-  abstraction of an input stream. A large part of the context is still
-  located on the stack, moving to a state machine and putting everything
-  in the parsing context should provide an adequate solution.
-  => Rather than progressive parsing, give more power to the SAX-like
-     interface. Currently the DOM-like representation is built but
-     => it should be possible to define that only as a set of SAX callbacks
-       and remove the tree creation from the parser code.
-       DONE
-
-- DOM support, instead of using a proprietary in memory
-  format for the document representation, the parser should
-  call a DOM API to actually build the resulting document.
-  Then the parser becomes independent of the in-memory
-  representation of the document. Even better using RPC's
-  the parser can actually build the document in another
-  program.
-  => Work started, now the internal representation is by default
-     very near a direct DOM implementation. The DOM glue is implemented
-     as a separate module. See the GNOME gdome module.
-
-- C++ support : John Ehresman <jehresma@dsg.harvard.edu>
-- Updated code to follow more recent specs, added compatibility flag
-- Better error handling, use a dedicated, overridable error
-  handling function.
-- Support for CDATA.
-- Keep track of line numbers for better error reporting.
-- Support for PI (SAX one).
-- Support for Comments (bad, should be in ASAP, they are parsed
-  but not stored), should be configurable.
-- Improve the support of entities on save (+SAX).
-
diff --git a/TODO_SCHEMAS b/TODO_SCHEMAS
deleted file mode 100644 (file)
index 145a4ed..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-- implement counted transitions at the automata level
-
-- Unicode:
-  + upgrade to 3.2
-  + improve the python script to generate better test
-    expressions to check the list of ranges.
-
-- Implement the interface at the SAX level
-
-- Implement the missing parts in the Structure part
-   + all content model
-   + enumerations
-   + countless others c.f. the TODO scattered in the code
-
-- Complete the Built-In datatype collections and Facets implementations
-
-- Regression tests based on
-  + the primer:
-    http://www.w3.org/TR/xmlschema-0/
-  + the Schemas Test Collection:
-    http://www.w3.org/2001/05/xmlschema-test-collection/
-  + archives of the schemas-dev list
-
-- Integrity constraints:
-  + what's that ? How need to read about it
-
-- "formal" checking, i.e. go through the full Structure spec and
-  bind code and associated parts of the Schemas spec
-
-- go though the erratas
-  http://www.w3.org/2001/05/xmlschema-errata
diff --git a/buf.c b/buf.c
index 6749d97..f876ea9 100644 (file)
--- a/buf.c
+++ b/buf.c
@@ -24,7 +24,9 @@
 #include <libxml/globals.h>
 #include <libxml/tree.h>
 #include <libxml/parserInternals.h> /* for XML_MAX_TEXT_LENGTH */
-#include "buf.h"
+
+#include "private/buf.h"
+#include "private/error.h"
 
 #ifndef SIZE_MAX
 #define SIZE_MAX ((size_t) -1)
@@ -133,7 +135,7 @@ xmlBufCreate(void) {
     ret->size = xmlDefaultBufferSize;
     UPDATE_COMPAT(ret);
     ret->alloc = xmlBufferAllocScheme;
-    ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar));
+    ret->content = (xmlChar *) xmlMallocAtomic(ret->size);
     if (ret->content == NULL) {
        xmlBufMemoryError(ret, "creating buffer");
        xmlFree(ret);
@@ -169,7 +171,7 @@ xmlBufCreateSize(size_t size) {
     ret->size = (size ? size + 1 : 0);         /* +1 for ending null */
     UPDATE_COMPAT(ret);
     if (ret->size){
-        ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar));
+        ret->content = (xmlChar *) xmlMallocAtomic(ret->size);
         if (ret->content == NULL) {
            xmlBufMemoryError(ret, "creating buffer");
             xmlFree(ret);
@@ -198,8 +200,6 @@ xmlBufDetach(xmlBufPtr buf) {
 
     if (buf == NULL)
         return(NULL);
-    if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE)
-        return(NULL);
     if (buf->buffer != NULL)
         return(NULL);
     if (buf->error)
@@ -214,40 +214,6 @@ xmlBufDetach(xmlBufPtr buf) {
     return ret;
 }
 
-
-/**
- * xmlBufCreateStatic:
- * @mem: the memory area
- * @size:  the size in byte
- *
- * routine to create an XML buffer from an immutable memory area.
- * The area won't be modified nor copied, and is expected to be
- * present until the end of the buffer lifetime.
- *
- * returns the new structure.
- */
-xmlBufPtr
-xmlBufCreateStatic(void *mem, size_t size) {
-    xmlBufPtr ret;
-
-    if (mem == NULL)
-        return(NULL);
-
-    ret = (xmlBufPtr) xmlMalloc(sizeof(xmlBuf));
-    if (ret == NULL) {
-       xmlBufMemoryError(NULL, "creating buffer");
-        return(NULL);
-    }
-    ret->use = size;
-    ret->size = size;
-    UPDATE_COMPAT(ret);
-    ret->alloc = XML_BUFFER_ALLOC_IMMUTABLE;
-    ret->content = (xmlChar *) mem;
-    ret->error = 0;
-    ret->buffer = NULL;
-    return(ret);
-}
-
 /**
  * xmlBufGetAllocationScheme:
  * @buf:  the buffer
@@ -287,13 +253,11 @@ xmlBufSetAllocationScheme(xmlBufPtr buf,
 #endif
         return(-1);
     }
-    if ((buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) ||
-        (buf->alloc == XML_BUFFER_ALLOC_IO))
+    if (buf->alloc == XML_BUFFER_ALLOC_IO)
         return(-1);
     if ((scheme == XML_BUFFER_ALLOC_DOUBLEIT) ||
         (scheme == XML_BUFFER_ALLOC_EXACT) ||
         (scheme == XML_BUFFER_ALLOC_HYBRID) ||
-        (scheme == XML_BUFFER_ALLOC_IMMUTABLE) ||
        (scheme == XML_BUFFER_ALLOC_BOUNDED)) {
        buf->alloc = scheme;
         if (buf->buffer)
@@ -331,8 +295,7 @@ xmlBufFree(xmlBufPtr buf) {
     if ((buf->alloc == XML_BUFFER_ALLOC_IO) &&
         (buf->contentIO != NULL)) {
         xmlFree(buf->contentIO);
-    } else if ((buf->content != NULL) &&
-        (buf->alloc != XML_BUFFER_ALLOC_IMMUTABLE)) {
+    } else if (buf->content != NULL) {
         xmlFree(buf->content);
     }
     xmlFree(buf);
@@ -350,9 +313,7 @@ xmlBufEmpty(xmlBufPtr buf) {
     if (buf->content == NULL) return;
     CHECK_COMPAT(buf)
     buf->use = 0;
-    if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) {
-        buf->content = BAD_CAST "";
-    } else if ((buf->alloc == XML_BUFFER_ALLOC_IO) &&
+    if ((buf->alloc == XML_BUFFER_ALLOC_IO) &&
                (buf->contentIO != NULL)) {
         size_t start_buf = buf->content - buf->contentIO;
 
@@ -385,8 +346,7 @@ xmlBufShrink(xmlBufPtr buf, size_t len) {
     if (len > buf->use) return(0);
 
     buf->use -= len;
-    if ((buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) ||
-        ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL))) {
+    if ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL)) {
        /*
         * we just move the content pointer, but also make sure
         * the perceived buffer size has shrunk accordingly
@@ -434,7 +394,6 @@ xmlBufGrowInternal(xmlBufPtr buf, size_t len) {
     if ((buf == NULL) || (buf->error != 0)) return(0);
     CHECK_COMPAT(buf)
 
-    if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0);
     if (len < buf->size - buf->use)
         return(buf->size - buf->use - 1);
     if (len >= SIZE_MAX - buf->use) {
@@ -504,7 +463,7 @@ xmlBufGrow(xmlBufPtr buf, int len) {
     ret = xmlBufGrowInternal(buf, len);
     if (buf->error != 0)
         return(-1);
-    return((int) ret);
+    return(ret > INT_MAX ? INT_MAX : ret);
 }
 
 /**
@@ -536,7 +495,7 @@ xmlBufDump(FILE *file, xmlBufPtr buf) {
     CHECK_COMPAT(buf)
     if (file == NULL)
        file = stdout;
-    ret = fwrite(buf->content, sizeof(xmlChar), buf->use, file);
+    ret = fwrite(buf->content, 1, buf->use, file);
     return(ret);
 }
 
@@ -699,7 +658,6 @@ xmlBufResize(xmlBufPtr buf, size_t size)
         return(0);
     CHECK_COMPAT(buf)
 
-    if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0);
     if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
         /*
         * Used to provide parsing limits
@@ -777,7 +735,8 @@ xmlBufResize(xmlBufPtr buf, size_t size)
        if (buf->content == NULL) {
            rebuf = (xmlChar *) xmlMallocAtomic(newSize);
            buf->use = 0;
-           rebuf[buf->use] = 0;
+            if (rebuf != NULL)
+               rebuf[buf->use] = 0;
        } else if (buf->size - buf->use < 100) {
            rebuf = (xmlChar *) xmlRealloc(buf->content, newSize);
         } else {
@@ -825,7 +784,6 @@ xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len) {
        return -1;
     CHECK_COMPAT(buf)
 
-    if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1;
     if (len < -1) {
 #ifdef DEBUG_BUFFER
         xmlGenericError(xmlGenericErrorContext,
@@ -863,7 +821,7 @@ xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len) {
         }
     }
 
-    memmove(&buf->content[buf->use], str, len*sizeof(xmlChar));
+    memmove(&buf->content[buf->use], str, len);
     buf->use += len;
     buf->content[buf->use] = 0;
     UPDATE_COMPAT(buf)
@@ -885,7 +843,6 @@ xmlBufCat(xmlBufPtr buf, const xmlChar *str) {
     if ((buf == NULL) || (buf->error))
         return(-1);
     CHECK_COMPAT(buf)
-    if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1;
     if (str == NULL) return -1;
     return xmlBufAdd(buf, str, -1);
 }
@@ -923,8 +880,6 @@ xmlBufWriteQuotedString(xmlBufPtr buf, const xmlChar *string) {
     if ((buf == NULL) || (buf->error))
         return(-1);
     CHECK_COMPAT(buf)
-    if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE)
-        return(-1);
     if (xmlStrchr(string, '\"')) {
         if (xmlStrchr(string, '\'')) {
 #ifdef DEBUG_BUFFER
@@ -1042,11 +997,11 @@ xmlBufBackToBuffer(xmlBufPtr buf) {
          * Keep the buffer but provide a truncated size value.
          */
         xmlBufOverflowError(buf, "Allocated size too big for xmlBuffer");
-        ret->use = (int) buf->use;
+        ret->use = buf->use;
         ret->size = INT_MAX;
     } else {
-        ret->use = (int) buf->use;
-        ret->size = (int) buf->size;
+        ret->use = buf->use;
+        ret->size = buf->size;
     }
     ret->alloc = buf->alloc;
     ret->content = buf->content;
@@ -1114,7 +1069,7 @@ xmlBufGetInputBase(xmlBufPtr buf, xmlParserInputPtr input) {
     size_t base;
 
     if ((input == NULL) || (buf == NULL) || (buf->error))
-        return(-1);
+        return(0);
     CHECK_COMPAT(buf)
     base = input->base - buf->content;
     /*
diff --git a/buf.h b/buf.h
deleted file mode 100644 (file)
index b7bcf61..0000000
--- a/buf.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Summary: Internal Interfaces for memory buffers in libxml2
- * Description: this module describes most of the new xmlBuf buffer
- *              entry points, those are private routines, with a
- *              few exceptions exported in tree.h. This was added
- *              in 2.9.0.
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_BUF_H__
-#define __XML_BUF_H__
-
-#include <libxml/tree.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-xmlBufPtr xmlBufCreate(void);
-xmlBufPtr xmlBufCreateSize(size_t size);
-xmlBufPtr xmlBufCreateStatic(void *mem, size_t size);
-
-int xmlBufSetAllocationScheme(xmlBufPtr buf,
-                              xmlBufferAllocationScheme scheme);
-int xmlBufGetAllocationScheme(xmlBufPtr buf);
-
-void xmlBufFree(xmlBufPtr buf);
-void xmlBufEmpty(xmlBufPtr buf);
-
-/* size_t xmlBufShrink(xmlBufPtr buf, size_t len); */
-int xmlBufGrow(xmlBufPtr buf, int len);
-int xmlBufResize(xmlBufPtr buf, size_t len);
-
-int xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len);
-int xmlBufCat(xmlBufPtr buf, const xmlChar *str);
-int xmlBufCCat(xmlBufPtr buf, const char *str);
-int xmlBufWriteQuotedString(xmlBufPtr buf, const xmlChar *string);
-
-size_t xmlBufAvail(const xmlBufPtr buf);
-size_t xmlBufLength(const xmlBufPtr buf);
-/* size_t xmlBufUse(const xmlBufPtr buf); */
-int xmlBufIsEmpty(const xmlBufPtr buf);
-int xmlBufAddLen(xmlBufPtr buf, size_t len);
-
-/* const xmlChar * xmlBufContent(const xmlBuf *buf); */
-/* const xmlChar * xmlBufEnd(xmlBufPtr buf); */
-
-xmlChar * xmlBufDetach(xmlBufPtr buf);
-
-size_t xmlBufDump(FILE *file, xmlBufPtr buf);
-
-xmlBufPtr xmlBufFromBuffer(xmlBufferPtr buffer);
-xmlBufferPtr xmlBufBackToBuffer(xmlBufPtr buf);
-int xmlBufMergeBuffer(xmlBufPtr buf, xmlBufferPtr buffer);
-
-int xmlBufResetInput(xmlBufPtr buf, xmlParserInputPtr input);
-size_t xmlBufGetInputBase(xmlBufPtr buf, xmlParserInputPtr input);
-int xmlBufSetInputBaseCur(xmlBufPtr buf, xmlParserInputPtr input,
-                          size_t base, size_t cur);
-#ifdef __cplusplus
-}
-#endif
-#endif /* __XML_BUF_H__ */
-
index 750fd70..20c3f97 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 ###
 #
 #       build_glob.py : Build the global_functions.h and global_functions.c
@@ -9,7 +9,6 @@
 #       See Copyright for the status of this software.
 #       Gary.Pennington@sun.com
 ###
-import os, string
 
 class globvar:
     def __init__(self, type, name):
@@ -41,8 +40,8 @@ if __name__ == "__main__":
     for line in global_hdr:
         line = striplinesep(line)
         if line == " * Automatically generated by build_glob.py.":
-           break
-       writeline(global_functions_hdr, line)
+            break
+        writeline(global_functions_hdr, line)
 
     writeline(global_functions_hdr, " * Automatically generated by build_glob.py.")
     writeline(global_functions_hdr, " * Do not modify the previous line.")
@@ -52,8 +51,8 @@ if __name__ == "__main__":
     for line in global_code:
         line = striplinesep(line)
         if line == " * Automatically generated by build_glob.py.":
-           break
-       writeline(global_functions_impl, line)
+            break
+        writeline(global_functions_impl, line)
 
     writeline(global_functions_impl, " * Automatically generated by build_glob.py.")
     writeline(global_functions_impl, " * Do not modify the previous line.")
@@ -65,10 +64,10 @@ if __name__ == "__main__":
         if line[0]=='#':
             continue
         line = striplinesep(line)
-        fields = string.split(line, ",")
+        fields = line.split(",")
         # Update the header file
         writeline(global_functions_hdr)
-        global_functions_hdr.write("XMLPUBFUN "+fields[0]+" * XMLCALL ")
+        global_functions_hdr.write("XMLPUBFUN "+fields[0]+" *\n\t")
         if fields[2]:
             global_functions_hdr.write("(*")
         global_functions_hdr.write("__"+fields[1]+"(void)")
@@ -86,7 +85,7 @@ if __name__ == "__main__":
         writeline(global_functions_hdr,"#endif")
         # set/get for per-thread global defaults
         if fields[3]:
-            writeline(global_functions_hdr,"XMLPUBFUN "+fields[0]+" XMLCALL "+fields[1][:3]+"ThrDef"+fields[1][3:]+"("+fields[0]+" v);")
+            writeline(global_functions_hdr,"XMLPUBFUN "+fields[0]+" "+fields[1][:3]+"ThrDef"+fields[1][3:]+"("+fields[0]+" v);")
         # Update the implementation file
         writeline(global_functions_impl)
 #        writeline(global_functions_impl, "extern "+fields[0]+" "+fields[1]+";")
diff --git a/c14n.c b/c14n.c
index d55729c..35fcf35 100644 (file)
--- a/c14n.c
+++ b/c14n.c
@@ -12,7 +12,6 @@
 #define IN_LIBXML
 #include "libxml.h"
 #ifdef LIBXML_C14N_ENABLED
-#ifdef LIBXML_OUTPUT_ENABLED
 
 #include <stdlib.h>
 #include <string.h>
@@ -25,7 +24,8 @@
 #include <libxml/xpathInternals.h>
 #include <libxml/c14n.h>
 
-#include "buf.h"
+#include "private/buf.h"
+#include "private/error.h"
 
 /************************************************************************
  *                                                                     *
@@ -286,7 +286,7 @@ xmlC14NVisibleNsStackCreate(void) {
         xmlC14NErrMemory("creating namespaces stack");
        return(NULL);
     }
-    memset(ret, 0 , (size_t) sizeof(xmlC14NVisibleNsStack));
+    memset(ret, 0, sizeof(xmlC14NVisibleNsStack));
     return(ret);
 }
 
@@ -2115,7 +2115,7 @@ xmlC14NDocSave(xmlDocPtr doc, xmlNodeSetPtr nodes,
 #define growBufferReentrant() {                                                \
     buffer_size *= 2;                                                  \
     buffer = (xmlChar *)                                               \
-               xmlRealloc(buffer, buffer_size * sizeof(xmlChar));      \
+               xmlRealloc(buffer, buffer_size);                        \
     if (buffer == NULL) {                                              \
        xmlC14NErrMemory("growing buffer");                             \
        return(NULL);                                                   \
@@ -2150,7 +2150,7 @@ xmlC11NNormalizeString(const xmlChar * input,
      * allocate an translation buffer.
      */
     buffer_size = 1000;
-    buffer = (xmlChar *) xmlMallocAtomic(buffer_size * sizeof(xmlChar));
+    buffer = (xmlChar *) xmlMallocAtomic(buffer_size);
     if (buffer == NULL) {
        xmlC14NErrMemory("allocating buffer");
         return (NULL);
@@ -2223,6 +2223,5 @@ xmlC11NNormalizeString(const xmlChar * input,
     *out = 0;
     return (buffer);
 }
-#endif /* LIBXML_OUTPUT_ENABLED */
 
 #endif /* LIBXML_C14N_ENABLED */
index b7837e3..24a49f3 100644 (file)
--- a/catalog.c
+++ b/catalog.c
 #ifdef LIBXML_CATALOG_ENABLED
 #include <stdlib.h>
 #include <string.h>
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#elif defined (_WIN32)
+#include <io.h>
 #endif
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
@@ -39,7 +38,8 @@
 #include <libxml/threads.h>
 #include <libxml/globals.h>
 
-#include "buf.h"
+#include "private/buf.h"
+#include "private/error.h"
 
 #define MAX_DELEGATE   50
 #define MAX_CATAL_DEPTH        50
@@ -891,11 +891,7 @@ xmlParseCatalogFile(const char *filename) {
 
     ctxt = xmlNewParserCtxt();
     if (ctxt == NULL) {
-#ifdef LIBXML_SAX1_ENABLED
-       if (xmlDefaultSAXHandler.error != NULL) {
-           xmlDefaultSAXHandler.error(NULL, "out of memory\n");
-       }
-#endif
+        xmlCatalogErrMemory("allocating parser context");
        return(NULL);
     }
 
@@ -2177,7 +2173,6 @@ xmlParseSGMLCatalogPubid(const xmlChar *cur, xmlChar **id) {
     int len = 0;
     int size = 50;
     xmlChar stop;
-    int count = 0;
 
     *id = NULL;
 
@@ -2190,7 +2185,7 @@ xmlParseSGMLCatalogPubid(const xmlChar *cur, xmlChar **id) {
     } else {
        stop = ' ';
     }
-    buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
+    buf = (xmlChar *) xmlMallocAtomic(size);
     if (buf == NULL) {
         xmlCatalogErrMemory("allocating public ID");
        return(NULL);
@@ -2202,7 +2197,7 @@ xmlParseSGMLCatalogPubid(const xmlChar *cur, xmlChar **id) {
            break;
        if (len + 1 >= size) {
            size *= 2;
-           tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
+           tmp = (xmlChar *) xmlRealloc(buf, size);
            if (tmp == NULL) {
                xmlCatalogErrMemory("allocating public ID");
                xmlFree(buf);
@@ -2211,7 +2206,6 @@ xmlParseSGMLCatalogPubid(const xmlChar *cur, xmlChar **id) {
            buf = tmp;
        }
        buf[len++] = *cur;
-       count++;
        NEXT;
     }
     buf[len] = 0;
@@ -2975,6 +2969,8 @@ xmlACatalogAdd(xmlCatalogPtr catal, const xmlChar * type,
            if (catal->sgml == NULL)
                catal->sgml = xmlHashCreate(10);
             res = xmlHashAddEntry(catal->sgml, orig, entry);
+            if (res < 0)
+                xmlFreeCatalogEntry(entry, NULL);
         }
     }
     return (res);
@@ -3135,7 +3131,7 @@ xmlInitializeCatalog(void) {
                                        strncpy(p, "\\..\\etc\\catalog", 255 - (p - buf));
                                        uri = xmlCanonicPath((const xmlChar*)buf);
                                        if (uri != NULL) {
-                                               strncpy(XML_XML_DEFAULT_CATALOG, uri, 255);
+                                               strncpy(XML_XML_DEFAULT_CATALOG, (char* )uri, 255);
                                                xmlFree(uri);
                                        }
                                }
index 87ec050..4372ddc 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import sys
 import time
 import os
index 559503a..5f286ce 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import sys
 import time
 import os
index 926ceb3..a0ee028 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import sys
 import time
 import os
index cecb59b..284f7f0 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import sys
 import time
 import os
index c34560e..69c43ff 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import sys
 import time
 import os
index f4fa44a..fb2c715 100644 (file)
--- a/chvalid.c
+++ b/chvalid.c
@@ -14,6 +14,8 @@
 #include "libxml.h"
 #include <libxml/chvalid.h>
 
+#include <stddef.h>
+
 /*
  * The initial tables ({func_name}_tab) are used to validate whether a
  * single-byte character is within the specified group.  Each table
index 1f8be71..5177e45 100644 (file)
@@ -4,18 +4,9 @@
 /* Define if __attribute__((destructor)) is accepted */
 #cmakedefine ATTRIBUTE_DESTRUCTOR @ATTRIBUTE_DESTRUCTOR@
 
-/* Type cast for the gethostbyname() argument */
-#cmakedefine GETHOSTBYNAME_ARG_CAST @GETHOSTBYNAME_ARG_CAST@
-
 /* Define to 1 if you have the <arpa/inet.h> header file. */
 #cmakedefine HAVE_ARPA_INET_H 1
 
-/* Define to 1 if you have the <arpa/nameser.h> header file. */
-#cmakedefine HAVE_ARPA_NAMESER_H 1
-
-/* Whether struct sockaddr::__ss_family exists */
-#cmakedefine HAVE_BROKEN_SS_FAMILY 1
-
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #cmakedefine HAVE_DLFCN_H 1
 
@@ -31,9 +22,6 @@
 /* Define to 1 if you have the `ftime' function. */
 #cmakedefine HAVE_FTIME 1
 
-/* Define if getaddrinfo is there */
-#cmakedefine HAVE_GETADDRINFO 1
-
 /* Define to 1 if you have the `gettimeofday' function. */
 #cmakedefine HAVE_GETTIMEOFDAY 1
 
@@ -78,9 +66,6 @@
 /* Define to 1 if you have the `rand_r' function. */
 #cmakedefine HAVE_RAND_R 1
 
-/* Define to 1 if you have the <resolv.h> header file. */
-#cmakedefine HAVE_RESOLV_H 1
-
 /* Have shl_load based dso */
 #cmakedefine HAVE_SHLLOAD 1
 
 /* Define to 1 if you have the <sys/time.h> header file. */
 #cmakedefine HAVE_SYS_TIME_H 1
 
-/* Define to 1 if you have the <sys/types.h> header file. */
-#cmakedefine HAVE_SYS_TYPES_H 1
-
 /* Define to 1 if you have the <unistd.h> header file. */
 #cmakedefine HAVE_UNISTD_H 1
 
 /* Define to the version of this package. */
 #define PACKAGE_VERSION "@PACKAGE_VERSION@"
 
-/* Type cast for the send() function 2nd arg */
-#cmakedefine SEND_ARG2_CAST @SEND_ARG2_CAST@
-
 /* Support for IPv6 */
 #cmakedefine SUPPORT_IP6 1
 
    #define below would cause a syntax error. */
 #cmakedefine _UINT32_T @_UINT32_T@
 
-/* ss_family is not defined here, use __ss_family instead */
-#cmakedefine ss_family @ss_family@
-
 /* Define to the type of an unsigned integer type of width exactly 32 bits if
    such a type exists and the standard includes do not define it. */
 #cmakedefine uint32_t @uint32_t@
index 9dedb3a..718546c 100644 (file)
@@ -2,8 +2,8 @@ dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ([2.63])
 
 m4_define([MAJOR_VERSION], 2)
-m4_define([MINOR_VERSION], 10)
-m4_define([MICRO_VERSION], 2)
+m4_define([MINOR_VERSION], 11)
+m4_define([MICRO_VERSION], 5)
 
 AC_INIT([libxml2],[MAJOR_VERSION.MINOR_VERSION.MICRO_VERSION])
 AC_CONFIG_SRCDIR([entities.c])
@@ -48,12 +48,9 @@ AC_PROG_CC
 AC_PROG_INSTALL
 AC_PROG_LN_S
 AC_PROG_MKDIR_P
-AC_PROG_CPP
-AC_PATH_PROG(MV, mv, /bin/mv)
 AC_PATH_PROG(TAR, tar, /bin/tar)
 AC_PATH_PROG(PERL, perl, /usr/bin/perl)
 AC_PATH_PROG(WGET, wget, /usr/bin/wget)
-AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint)
 AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc)
 PKG_PROG_PKG_CONFIG
 
@@ -61,33 +58,11 @@ LT_INIT([disable-static])
 LT_LIB_M
 
 dnl
-dnl if the system support linker version scripts for symbol versioning
-dnl then add it
-dnl
-VERSION_SCRIPT_FLAGS=
-# lt_cv_prog_gnu_ld is from libtool 2.+
-if test "$lt_cv_prog_gnu_ld" = yes; then
-  VERSION_SCRIPT_FLAGS=-Wl,--version-script=
-else
-  case $host in
-  *-*-sunos*) VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,";;
-  esac
-fi
-AC_SUBST(VERSION_SCRIPT_FLAGS)
-AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"])
-
-dnl
 dnl We process the AC_ARG_WITH first so that later we can modify
 dnl some of them to try to prevent impossible combinations.  This
 dnl also allows up so alphabetize the choices
 dnl
 
-dnl
-dnl zlib option might change flags, so we save them initially
-dnl
-_cppflags="${CPPFLAGS}"
-_libs="${LIBS}"
-
 AC_ARG_WITH(c14n,
 [  --with-c14n             add the Canonicalization support (on)])
 AC_ARG_WITH(catalog,
@@ -127,13 +102,7 @@ AC_ARG_WITH(python,
 AC_ARG_WITH(reader,
 [  --with-reader           add the xmlReader parsing interface (on)])
 AC_ARG_WITH(readline,
-[  --with-readline=DIR     use readline in DIR],[
-  if test "$withval" != "no" && test "$withval" != "yes"; then
-    RDL_DIR=$withval
-    CPPFLAGS="${CPPFLAGS} -I$withval/include"
-    LDFLAGS="${LDFLAGS} -L$withval/lib"
-  fi
-])
+[  --with-readline[[=DIR]]   use readline in DIR])
 AC_ARG_WITH(regexps,
 [  --with-regexps          add Regular Expressions support (on)])
 AC_ARG_WITH(run_debug,
@@ -165,327 +134,180 @@ AC_ARG_WITH(xptr-locs,
 AC_ARG_WITH(modules,
 [  --with-modules          add the dynamic modules support (on)])
 AC_ARG_WITH(zlib,
-[  --with-zlib[[=DIR]]       use libz in DIR],[
-  if test "$withval" != "no" && test "$withval" != "yes"; then
-    Z_DIR=$withval
-    CPPFLAGS="${CPPFLAGS} -I$withval/include"
-    LDFLAGS="${LDFLAGS} -L$withval/lib"
-  fi
-])
+[  --with-zlib[[=DIR]]       use libz in DIR])
 AC_ARG_WITH(lzma,
-[  --with-lzma[[=DIR]]       use liblzma in DIR],[
-  if test "$withval" != "no" && test "$withval" != "yes"; then
-    LZMA_DIR=$withval
-    CPPFLAGS="${CPPFLAGS} -I$withval/include"
-    LDFLAGS="${LDFLAGS} -L$withval/lib"
-  fi
-])
+[  --with-lzma[[=DIR]]       use liblzma in DIR])
 AC_ARG_WITH(coverage,
 [  --with-coverage         build for code coverage with GCC (off)])
 
 dnl
 dnl hard dependencies on options
 dnl
-if test "$with_schemas" = "yes"
-then
-    with_pattern=yes
-    with_regexps=yes
-fi
-if test "$with_schematron" = "yes"
-then
-    with_pattern=yes
-    with_tree=yes
-    with_xpath=yes
-fi
-if test "$with_reader" = "yes"
-then
-    with_push=yes
-fi
-if test "$with_xptr_locs" = "yes"
-then
-    with_xptr=yes
-fi
-if test "$with_xptr" = "yes"
-then
-    with_xpath=yes
-fi
-dnl
-dnl option to build a minimal libxml2 library
-dnl
-if test "$with_minimum" = "yes"
-then
-    echo "Configuring for a minimal library"
-    if test "$with_c14n" = ""
-    then
-      with_c14n=no
-    fi
-    if test "$with_catalog" = ""
-    then
-      with_catalog=no
-    fi
-    echo So far so good!
-    if test "$with_debug" = ""
-    then
-      with_debug=no
-    fi
-    if test "$with_fexceptions" = ""
-    then
-      with_fexceptions=no
-    fi
-    if test "$with_history" = ""
-    then
-      with_history=no
-    fi
-    if test "$with_html" = ""
-    then
-      with_html=no
-    fi
-    if test "$with_http" = ""
-    then
-      with_http=no 
-    fi
-    if test "$with_iconv" = ""
-    then
-      with_iconv=no
-    fi
-    if test "$with_iso8859x" = ""
-    then
-      with_iso8859x=no
-    fi
-    if test "$with_mem_debug" = ""
-    then 
-      with_mem_debug=no
-    fi
-    if test "$with_output" = ""
-    then
-      with_output=no
+if test "$with_c14n" = "yes"; then
+    if test "$with_output" = "no"; then
+        echo WARNING: --with-c14n overrides --without-output
     fi
-    if test "$with_pattern" = ""
-    then
-      with_pattern=no
-    fi
-    if test "$with_push" = ""
-    then
-      with_push=no
-    fi
-    if test "$with_python" = ""
-    then
-      with_python=no
-    fi
-    if test "$with_reader" = ""
-    then
-      with_reader=no
-    fi
-    if test "$with_readline" = ""
-    then
-      with_readline=no
-    fi
-    if test "$with_regexps" = ""
-    then
-      with_regexps=no
-    fi
-    if test "$with_run_debug" = ""
-    then
-      with_run_debug=no
+    with_output=yes
+    if test "$with_xpath" = "no"; then
+        echo WARNING: --with-c14n overrides --without-xpath
     fi
-    if test "$with_sax1" = ""
-    then
-      with_sax1=no
+    with_xpath=yes
+fi
+if test "$with_schemas" = "yes"; then
+    if test "$with_pattern" = "no"; then
+        echo WARNING: --with-schemas overrides --without-pattern
     fi
-    if test "$with_schemas" = ""
-    then
-      with_schemas=no
+    with_pattern=yes
+    if test "$with_regexps" = "no"; then
+        echo WARNING: --with-schemas overrides --without-regexps
     fi
-    if test "$with_schematron" = ""
-    then
-      with_schematron=no
+    with_regexps=yes
+fi
+if test "$with_schematron" = "yes"; then
+    if test "$with_pattern" = "no"; then
+        echo WARNING: --with-schematron overrides --without-pattern
     fi
-    if test "$with_threads" = ""
-    then
-      with_threads=no
+    with_pattern=yes
+    if test "$with_tree" = "no"; then
+        echo WARNING: --with-schematron overrides --without-tree
     fi
-    if test "$with_thread_alloc" = ""
-    then
-      with_thread_alloc=no
-   fi
-    if test "$with_tree" = ""
-    then
-      with_tree=no
+    with_tree=yes
+    if test "$with_xpath" = "no"; then
+        echo WARNING: --with-schematron overrides --without-xpath
     fi
-    if test "$with_valid" = ""
-    then
-      with_valid=no
+    with_xpath=yes
+fi
+if test "$with_reader" = "yes"; then
+    if test "$with_push" = "no"; then
+        echo WARNING: --with-reader overrides --without-push
     fi
-    if test "$with_writer" = ""
-    then
-      with_writer=no
+    with_push=yes
+    if test "$with_tree" = "no"; then
+        echo WARNING: --with-reader overrides --without-tree
     fi
-    if test "$with_xinclude" = ""
-    then
-      with_xinclude=no
+    with_tree=yes
+fi
+if test "$with_writer" = "yes"; then
+    if test "$with_output" = "no"; then
+        echo WARNING: --with-writer overrides --without-output
     fi
-    if test "$with_xpath" = ""
-    then
-      with_xpath=no
+    with_output=yes
+    if test "$with_push" = "no"; then
+        echo WARNING: --with-writer overrides --without-push
     fi
-    if test "$with_xptr" = ""
-    then
-      with_xptr=no
+    with_push=yes
+fi
+if test "$with_xinclude" = "yes"; then
+    if test "$with_xpath" = "no"; then
+        echo WARNING: --with-xinclude overrides --without-xpath
     fi
-    if test "$with_zlib" = ""
-    then
-      with_zlib=no
+    with_xpath=yes
+fi
+if test "$with_xptr_locs" = "yes"; then
+    if test "$with_xptr" = "no"; then
+        echo WARNING: --with-xptr-locs overrides --without-xptr
     fi
-    if test "$with_modules" = ""
-    then
-      with_modules=no
+    with_xptr=yes
+fi
+if test "$with_xptr" = "yes"; then
+    if test "$with_xpath" = "no"; then
+        echo WARNING: --with-xptr overrides --without-xpath
     fi
+    with_xpath=yes
 fi
 
-echo Checking zlib
-
-dnl Checks for zlib library.
-
-WITH_ZLIB=0
-if test "$with_zlib" = "no"; then
-    echo "Disabling zlib compression support"
+if test "$with_minimum" = "yes"; then
+    dnl
+    dnl option to build a minimal libxml2 library
+    dnl
+    echo "Configuring for a minimal library"
+    test "$with_c14n" = "" && with_c14n=no
+    test "$with_catalog" = "" && with_catalog=no
+    test "$with_debug" = "" && with_debug=no
+    test "$with_fexceptions" = "" && with_fexceptions=no
+    test "$with_history" = "" && with_history=no
+    test "$with_html" = "" && with_html=no
+    test "$with_http" = "" && with_http=no
+    test "$with_iconv" = "" && with_iconv=no
+    test "$with_iso8859x" = "" && with_iso8859x=no
+    test "$with_mem_debug" = "" && with_mem_debug=no
+    test "$with_output" = "" && with_output=no
+    test "$with_pattern" = "" && with_pattern=no
+    test "$with_push" = "" && with_push=no
+    test "$with_python" = "" && with_python=no
+    test "$with_reader" = "" && with_reader=no
+    test "$with_readline" = "" && with_readline=no
+    test "$with_regexps" = "" && with_regexps=no
+    test "$with_run_debug" = "" && with_run_debug=no
+    test "$with_sax1" = "" && with_sax1=no
+    test "$with_schemas" = "" && with_schemas=no
+    test "$with_schematron" = "" && with_schematron=no
+    test "$with_threads" = "" && with_threads=no
+    test "$with_thread_alloc" = "" && with_thread_alloc=no
+    test "$with_tree" = "" && with_tree=no
+    test "$with_valid" = "" && with_valid=no
+    test "$with_writer" = "" && with_writer=no
+    test "$with_xinclude" = "" && with_xinclude=no
+    test "$with_xpath" = "" && with_xpath=no
+    test "$with_xptr" = "" && with_xptr=no
+    test "$with_zlib" = "" && with_zlib=no
+    test "$with_modules" = "" && with_modules=no
 else
-    # Don't run pkg-config if with_zlib contains a path.
-    if test "x$Z_DIR" = "x"; then
-        # Try pkg-config first so that static linking works.
-        PKG_CHECK_MODULES([Z],[zlib],
-            [WITH_ZLIB=1],
-            [:])
+    dnl
+    dnl Disable dependent modules
+    dnl
+    if test "$with_output" = "no"; then
+        with_c14n=no
+        with_writer=no
     fi
-
-    if test "$WITH_ZLIB" = "0"; then
-        AC_CHECK_HEADERS(zlib.h,
-            AC_CHECK_LIB(z, gzread,[
-                WITH_ZLIB=1
-                if test "x${Z_DIR}" != "x"; then
-                    Z_CFLAGS="-I${Z_DIR}/include"
-                    Z_LIBS="-L${Z_DIR}/lib -lz"
-                    [case ${host} in
-                        *-*-solaris*)
-                            Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
-                            ;;
-                    esac]
-                else
-                    Z_LIBS="-lz"
-                fi])
-            )
+    if test "$with_pattern" = "no"; then
+        with_schemas=no
+        with_schematron=no
     fi
-fi
-
-AC_SUBST(Z_CFLAGS)
-AC_SUBST(Z_LIBS)
-AC_SUBST(WITH_ZLIB)
-
-echo Checking lzma
-
-dnl Checks for lzma library.
-
-WITH_LZMA=0
-if test "$with_lzma" = "no"; then
-    echo "Disabling lzma compression support"
-else
-    # Don't run pkg-config if with_lzma contains a path.
-    if test "x$LZMA_DIR" = "x"; then
-        # Try pkg-config first so that static linking works.
-        PKG_CHECK_MODULES([LZMA],[liblzma],
-            [WITH_LZMA=1],
-            [:])
+    if test "$with_push" = "no"; then
+        with_reader=no
+        with_writer=no
     fi
-
-    # If pkg-config failed, fall back to AC_CHECK_LIB. This
-    # will not pick up the necessary LIBS flags for liblzma's
-    # private dependencies, though, so static linking may fail.
-    if test "$WITH_LZMA" = "0"; then
-        AC_CHECK_HEADERS(lzma.h,
-            AC_CHECK_LIB(lzma, lzma_code,[
-                WITH_LZMA=1
-                if test "x${LZMA_DIR}" != "x"; then
-                    LZMA_CFLAGS="-I${LZMA_DIR}/include"
-                    LZMA_LIBS="-L${LZMA_DIR}/lib -llzma"
-                else
-                    LZMA_LIBS="-llzma"
-                fi])
-            )
+    if test "$with_regexps" = "no"; then
+        with_schemas=no
+    fi
+    if test "$with_tree" = "no"; then
+        with_reader=no
+        with_schematron=no
+    fi
+    if test "$with_xpath" = "no"; then
+        with_c14n=no
+        with_schematron=no
+        with_xinclude=no
+        with_xptr=no
     fi
 fi
 
-AC_SUBST(LZMA_CFLAGS)
-AC_SUBST(LZMA_LIBS)
-AC_SUBST(WITH_LZMA)
-
-CPPFLAGS=${_cppflags}
-LIBS=${_libs}
-
-echo Checking headers
-
+dnl
 dnl Checks for header files.
-AC_CHECK_HEADERS([fcntl.h])
-AC_CHECK_HEADERS([unistd.h])
-AC_CHECK_HEADERS([sys/stat.h])
-AC_CHECK_HEADERS([sys/types.h])
-AC_CHECK_HEADERS([stdint.h])
-AC_CHECK_HEADERS([inttypes.h])
-AC_CHECK_HEADERS([sys/socket.h], [], [],
-[#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-# endif
-])
-AC_CHECK_HEADERS([netinet/in.h], [], [],
-[#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-# endif
-])
-AC_CHECK_HEADERS([arpa/inet.h], [], [],
-[#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-# endif
-#if HAVE_ARPA_INET_H
-# include <arpa/inet.h>
-# endif
-])
-AC_CHECK_HEADERS([netdb.h])
-AC_CHECK_HEADERS([sys/time.h])
-AC_CHECK_HEADERS([sys/select.h])
-AC_CHECK_HEADERS([poll.h])
+dnl
+AC_CHECK_HEADERS([stdint.h inttypes.h])
+AC_CHECK_HEADERS([fcntl.h unistd.h sys/stat.h])
 AC_CHECK_HEADERS([sys/mman.h])
-AC_CHECK_HEADERS([sys/timeb.h])
-AC_CHECK_HEADERS([arpa/nameser.h], [], [],
-[#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-# endif
-])
-AC_CHECK_HEADERS([resolv.h], [], [],
-[#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-# endif
-#if HAVE_NETINET_IN_H
-# include <netinet/in.h>
-# endif
-#if HAVE_ARPA_NAMESER_H
-# include <arpa/nameser.h>
-# endif
-])
-AC_CHECK_HEADERS([dl.h])
-AC_CHECK_HEADERS([dlfcn.h])
-
-
-echo Checking types
+AC_CHECK_HEADERS([sys/socket.h netinet/in.h arpa/inet.h netdb.h])
+AC_CHECK_HEADERS([sys/select.h poll.h])
+AC_CHECK_HEADERS([sys/time.h sys/timeb.h])
+AC_CHECK_HEADERS([dl.h dlfcn.h])
+AC_CHECK_HEADERS([glob.h])
+AM_CONDITIONAL(WITH_GLOB, test "$ac_cv_header_glob_h" = "yes")
 
+dnl
+dnl Checking types
+dnl
 AC_TYPE_UINT32_T
 
-
-echo Checking libraries
+dnl
+dnl Checking libraries
+dnl
+AC_CHECK_FUNCS(snprintf vsnprintf,, NEED_TRIO=1)
 
 dnl Checks for library functions.
-AC_CHECK_FUNCS(gettimeofday ftime)
-AC_CHECK_FUNCS(stat)
-AC_CHECK_FUNCS(rand_r)
-AC_CHECK_FUNCS(isascii mmap munmap putenv)
+AC_CHECK_FUNCS([gettimeofday ftime stat rand_r isascii mmap munmap putenv])
 
 AH_VERBATIM([HAVE_MUNMAP_AFTER],[/* mmap() is no good without munmap() */
 #if defined(HAVE_MMAP) && !defined(HAVE_MUNMAP)
@@ -523,68 +345,95 @@ va_list ap1, ap2; a(&ap1); ap2 = (va_list) ap1],[
   AC_MSG_RESULT(yes)
   AC_DEFINE([VA_LIST_IS_ARRAY], [1],[Define if va_list is an array type])])
 
-dnl Checks for inet libraries:
-AC_SEARCH_LIBS(gethostent, [nsl])
-AC_SEARCH_LIBS(setsockopt, [socket net network])
-AC_SEARCH_LIBS(connect, [inet])
+dnl
+dnl Checks for inet libraries
+dnl
+if test "$with_http" != "no" || test "with_ftp" = "yes"; then
+    case "$host" in
+        *-*-mingw*)
+            dnl AC_SEARCH_LIBS doesn't work because of non-standard calling
+            dnl conventions on 32-bit Windows.
+            NET_LIBS="$NET_LIBS -lws2_32"
+            ;;
+        *)
+            _libs=$LIBS
+            AC_SEARCH_LIBS(gethostbyname, [nsl], [
+                if test "$ac_cv_search_gethostbyname" != "none required"; then
+                    NET_LIBS="$NET_LIBS $ac_cv_search_gethostbyname"
+                fi], [:], [$NET_LIBS])
+            AC_SEARCH_LIBS(connect, [bsd socket inet], [
+                if test "$ac_cv_search_connect" != "none required"; then
+                    NET_LIBS="$NET_LIBS $ac_cv_search_connect"
+                fi], [:], [$NET_LIBS])
+            LIBS=$_libs
+            ;;
+    esac
 
-dnl Determine what socket length (socklen_t) data type is
-AC_MSG_CHECKING([for type of socket length (socklen_t)])
-AC_TRY_COMPILE2([
-#include <stddef.h>
-#include <sys/types.h>
-#include <sys/socket.h>],[
-(void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[
-  AC_MSG_RESULT(socklen_t *)
-  XML_SOCKLEN_T=socklen_t],[
-  AC_TRY_COMPILE2([
-#include <stddef.h>
-#include <sys/types.h>
-#include <sys/socket.h>],[
-(void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[
-    AC_MSG_RESULT(size_t *)
-    XML_SOCKLEN_T=size_t],[
+    dnl Determine what socket length (socklen_t) data type is
+    AC_MSG_CHECKING([for type of socket length (socklen_t)])
     AC_TRY_COMPILE2([
-#include <stddef.h>
-#include <sys/types.h>
-#include <sys/socket.h>],[
-(void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[
-      AC_MSG_RESULT(int *)
-      XML_SOCKLEN_T=int],[
-      AC_MSG_WARN(could not determine)
-      XML_SOCKLEN_T="int"])])])
-AC_DEFINE_UNQUOTED(XML_SOCKLEN_T, $XML_SOCKLEN_T, [Determine what socket length (socklen_t) data type is])
-
-dnl Checking if gethostbyname() argument is const.
-AC_MSG_CHECKING([for const gethostbyname() argument])
-AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]],
-    [[(void)gethostbyname((const char *)"");]])],
-have_gethostbyname_const_arg=yes,
-have_gethostbyname_const_arg=no)
-AC_MSG_RESULT($have_gethostbyname_const_arg)
-if test x"$have_gethostbyname_const_arg" = x"yes"; then
-    AC_DEFINE([GETHOSTBYNAME_ARG_CAST], [],
-      [Type cast for the gethostbyname() argument])
-else
-    AC_DEFINE([GETHOSTBYNAME_ARG_CAST], [(char *)],
-      [Type cast for the gethostbyname() argument])
+    #include <stddef.h>
+    #ifdef _WIN32
+      #include <ws2tcpip.h>
+    #else
+      #include <sys/socket.h>
+    #endif],[
+    (void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[
+      AC_MSG_RESULT(socklen_t *)
+      XML_SOCKLEN_T=socklen_t],[
+      AC_TRY_COMPILE2([
+    #include <stddef.h>
+    #include <sys/socket.h>],[
+    (void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[
+        AC_MSG_RESULT(size_t *)
+        XML_SOCKLEN_T=size_t],[
+        AC_TRY_COMPILE2([
+    #include <stddef.h>
+    #include <sys/socket.h>],[
+    (void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[
+          AC_MSG_RESULT(int *)
+          XML_SOCKLEN_T=int],[
+          AC_MSG_WARN(could not determine)
+          XML_SOCKLEN_T="int"])])])
+    AC_DEFINE_UNQUOTED(XML_SOCKLEN_T, $XML_SOCKLEN_T, [Determine what socket length (socklen_t) data type is])
+
+    dnl
+    dnl Checking for availability of IPv6
+    dnl
+    AC_ARG_ENABLE(ipv6, [  --enable-ipv6[[=yes/no]]  enables compilation of IPv6 code [[default=yes]]],, enable_ipv6=yes)
+    if test "$with_minimum" = "yes"
+    then
+        enable_ipv6=no
+    fi
+    if test $enable_ipv6 = yes; then
+        AC_MSG_CHECKING([whether to enable IPv6])
+        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+            #ifdef _WIN32
+              #include <winsock2.h>
+            #else
+              #include <sys/socket.h>
+              #ifdef HAVE_NETDB_H
+                #include <netdb.h>
+              #endif
+            #endif
+            ]], [[
+            struct sockaddr_storage ss;
+            socket(AF_INET6, SOCK_STREAM, 0);
+            getaddrinfo(0, 0, 0, 0);
+            ]])], [
+            AC_DEFINE([SUPPORT_IP6], [], [Support for IPv6])
+            AC_MSG_RESULT([yes])], [
+            AC_MSG_RESULT([no])]
+        )
+    fi
 fi
 
-dnl Checking if send() second argument is const.
-AC_MSG_CHECKING([for const send() second argument])
-AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
-#include <sys/socket.h>]],
-    [[(void)send(1,(const char *)"",1,1);]])],
-have_send_const_arg2=yes,
-have_send_const_arg2=no)
-AC_MSG_RESULT($have_send_const_arg2)
-if test x"$have_send_const_arg2" = x"yes"; then
-    AC_DEFINE([SEND_ARG2_CAST], [],
-      [Type cast for the send() function 2nd arg])
-else
-    AC_DEFINE([SEND_ARG2_CAST], [(char *)],
-      [Type cast for the send() function 2nd arg])
-fi
+dnl
+dnl Extra flags
+dnl
+XML_LIBDIR='-L${libdir}'
+XML_INCLUDEDIR='-I${includedir}/libxml2'
+XML_CFLAGS=""
 
 dnl Checking whether __attribute__((destructor)) is accepted by the compiler
 AC_MSG_CHECKING([whether __attribute__((destructor)) is accepted])
@@ -596,99 +445,29 @@ f(void) {}], [], [
   AC_DEFINE([ATTRIBUTE_DESTRUCTOR], [__attribute__((destructor))],[A form that will not confuse apibuild.py])],[
   AC_MSG_RESULT(no)])
 
-
-dnl ***********************Checking for availability of IPv6*******************
-
-AC_MSG_CHECKING([whether to enable IPv6])
-AC_ARG_ENABLE(ipv6, [  --enable-ipv6[[=yes/no]]  enables compilation of IPv6 code [[default=yes]]],, enable_ipv6=yes)
-if test "$with_minimum" = "yes"
-then
-    enable_ipv6=no
-fi
-if test $enable_ipv6 = yes; then
-  have_ipv6=no
-  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#   include <sys/types.h>
-#   include <sys/socket.h>
-    ]], [[
-    struct sockaddr_storage ss;
-    socket(AF_INET6, SOCK_STREAM, 0)
-    ]])],
-    have_ipv6=yes,
-    have_ipv6=no
-  )
-  AC_MSG_RESULT($have_ipv6)
-
-  if test $have_ipv6 = yes; then
-    AC_DEFINE([SUPPORT_IP6], [], [Support for IPv6])
-    have_broken_ss_family=no
-
-    dnl *********************************************************************
-    dnl on some platforms (like AIX 5L), the structure sockaddr doesn't have
-    dnl a ss_family member, but rather __ss_family. Let's detect that
-    dnl and define the HAVE_BROKEN_SS_FAMILY when we are on one of these
-    dnl platforms.  However, we should only do this if ss_family is not
-    dnl present.
-    dnl ********************************************************************
-    AC_MSG_CHECKING([struct sockaddr::ss_family])
-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#     include <sys/types.h>
-#     include <sys/socket.h>
-      ]], [[
-      struct sockaddr_storage ss ;
-      ss.ss_family = 0 ;
-      ]])],
-      have_ss_family=yes,
-      have_ss_family=no
-    )
-    AC_MSG_RESULT($have_ss_family)
-    if test x$have_ss_family = xno ; then
-      AC_MSG_CHECKING([broken struct sockaddr::ss_family])
-      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#       include <sys/types.h>
-#       include <sys/socket.h>
-        ]], [[
-        struct sockaddr_storage ss ;
-        ss.__ss_family = 0 ;
-        ]])],
-        have_broken_ss_family=yes,
-        have_broken_ss_family=no
-      )
-      AC_MSG_RESULT($have_broken_ss_family)
-      if test x$have_broken_ss_family = xyes ; then
-        AC_DEFINE(HAVE_BROKEN_SS_FAMILY, [],
-         [Whether struct sockaddr::__ss_family exists]) 
-        AC_DEFINE(ss_family, __ss_family,
-         [ss_family is not defined here, use __ss_family instead])
-      else
-        AC_MSG_WARN(ss_family and __ss_family not found)
-      fi
-    fi
-
-    have_getaddrinfo=no
-    AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes)
-    if test $have_getaddrinfo != yes; then
-      for lib in bsd socket inet; do
-        AC_CHECK_LIB($lib, getaddrinfo, [LIBS="$LIBS -l$lib";have_getaddrinfo=yes;break])
-      done
-    fi
-
-    if test $have_getaddrinfo = yes; then
-      AC_DEFINE([HAVE_GETADDRINFO], [], [Define if getaddrinfo is there])
-    fi
-  fi
-fi 
-
-dnl ******************************End IPv6 checks******************************
-
-XML_LIBDIR='-L${libdir}'
-XML_INCLUDEDIR='-I${includedir}/libxml2'
-
 dnl
-dnl Extra flags
+dnl Linker version scripts for symbol versioning
 dnl
-XML_CFLAGS=""
-RDL_LIBS=""
+VERSION_SCRIPT_FLAGS=
+# lt_cv_prog_gnu_ld is from libtool 2.+
+if test "$lt_cv_prog_gnu_ld" = yes; then
+  case $host in
+    *-*-cygwin* | *-*-mingw* | *-*-msys* )
+      ;;
+    *)
+      dnl lld 16 defaults to --no-undefined-version but the version script
+      dnl can contain symbols disabled by configuration options.
+      AX_APPEND_LINK_FLAGS([-Wl,--undefined-version], [VERSION_SCRIPT_FLAGS])
+      AX_APPEND_FLAG([-Wl,--version-script=], [VERSION_SCRIPT_FLAGS])
+      ;;
+  esac
+else
+  case $host in
+  *-*-sunos*) VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,";;
+  esac
+fi
+AC_SUBST(VERSION_SCRIPT_FLAGS)
+AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"])
 
 dnl
 dnl Workaround for native compilers
@@ -698,13 +477,13 @@ dnl
 if test "${GCC}" != "yes" ; then
     case "${host}" in
           hppa*-*-hpux* )
-              EXTRA_CFLAGS="${EXTRA_CFLAGS} -Wp,-H30000"
+              AM_CFLAGS="${AM_CFLAGS} -Wp,-H30000"
               ;;
           *-dec-osf* )
-               EXTRA_CFLAGS="${EXTRA_CFLAGS} -ieee"
+               AM_CFLAGS="${AM_CFLAGS} -ieee"
                ;;
          alpha*-*-linux* )
-              EXTRA_CFLAGS="${EXTRA_CFLAGS} -ieee"
+              AM_CFLAGS="${AM_CFLAGS} -ieee"
               ;;
     esac
 else
@@ -714,19 +493,19 @@ else
        # Not activated by default because this inflates the code size
        # Used to allow propagation of C++ exceptions through the library
        #
-       EXTRA_CFLAGS="${EXTRA_CFLAGS} -fexceptions"
+       AM_CFLAGS="${AM_CFLAGS} -fexceptions"
     fi
 
     # warnings we'd like to see
-    EXTRA_CFLAGS="${EXTRA_CFLAGS} -pedantic -Wall -Wextra -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls"
+    AM_CFLAGS="${AM_CFLAGS} -pedantic -Wall -Wextra -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline"
     # warnings we'd like to suppress
-    EXTRA_CFLAGS="${EXTRA_CFLAGS} -Wno-long-long -Wno-format-extra-args"
+    AM_CFLAGS="${AM_CFLAGS} -Wno-long-long -Wno-format-extra-args"
     case "${host}" in
           alpha*-*-linux* )
-              EXTRA_CFLAGS="${EXTRA_CFLAGS} -mieee"
+              AM_CFLAGS="${AM_CFLAGS} -mieee"
               ;;
          alpha*-*-osf* )
-              EXTRA_CFLAGS="${EXTRA_CFLAGS} -mieee"
+              AM_CFLAGS="${AM_CFLAGS} -mieee"
               ;;
     esac
 fi
@@ -737,302 +516,99 @@ case ${host} in
     hppa*-hp-mpeix)
         NEED_TRIO=1
        ;;
-    *-*-mingw* | *-*-cygwin* | *-*-msvc* )
+    *-*-cygwin* | *-*-mingw* | *-*-msys* )
         # If the host is Windows, and shared libraries are disabled, we
-        # need to add -DLIBXML_STATIC to EXTRA_CFLAGS in order for linking to
+        # need to add -DLIBXML_STATIC to AM_CFLAGS in order for linking to
         # work properly (without it, xmlexports.h would force the use of
         # DLL imports, which obviously aren't present in a static
         # library).
         if test "x$enable_shared" = "xno"; then
             XML_CFLAGS="$XML_CFLAGS -DLIBXML_STATIC"
-            EXTRA_CFLAGS="$EXTRA_CFLAGS -DLIBXML_STATIC"
+            AM_CFLAGS="$AM_CFLAGS -DLIBXML_STATIC"
         fi
         ;;
 esac
 
 
 dnl
-dnl check for python
+dnl Simple API modules
 dnl
 
-PYTHON_TESTS=
-AS_IF([test "x$with_python" != "xno"], [
-    AM_PATH_PYTHON
-    PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}])
-])
-AM_CONDITIONAL([WITH_PYTHON], [test "x$with_python" != "xno"])
+if test "$with_tree" = "no" ; then
+    echo Disabling DOM like tree manipulation APIs
+    WITH_TREE=0
+else
+    WITH_TREE=1
+fi
+AC_SUBST(WITH_TREE)
 
-dnl check for dso support
-WITH_MODULES=0
-
-if test "$with_modules" != "no" ; then
- case "$host" in
-  *-*-cygwin*)
-  MODULE_EXTENSION=".dll"
-  AC_CHECK_LIB(cygwin, dlopen, [
-    WITH_MODULES=1
-    MODULE_PLATFORM_LIBS=
-    AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
-  ])
-  ;;
-  *-*-mingw*)
-  MODULE_EXTENSION=".dll"
-  WITH_MODULES=1
-  ;;
-  *)
-  AC_CHECK_FUNC(shl_load, libxml_have_shl_load=yes, [
-    AC_CHECK_LIB(dld, shl_load, [
-      MODULE_PLATFORM_LIBS="-ldld"
-      libxml_have_shl_load=yes], [
-      AC_CHECK_FUNC(dlopen, libxml_have_dlopen=yes, [
-        AC_CHECK_LIB(dl, dlopen, [
-          MODULE_PLATFORM_LIBS="-ldl"
-          libxml_have_dlopen=yes])])])])
-
-  if test "${libxml_have_shl_load}" = "yes"; then
-    MODULE_EXTENSION=".sl"
-    WITH_MODULES=1
-    AC_DEFINE([HAVE_SHLLOAD], [], [Have shl_load based dso])
-  fi
-  if test "${libxml_have_dlopen}" = "yes"; then
-    case "${host}" in
-      *-*-hpux* )
-       MODULE_EXTENSION=".sl"
-       ;;
-      * )
-       MODULE_EXTENSION=".so"
-       ;;
-    esac
-
-    WITH_MODULES=1
-    AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
-  fi
- ;;
- esac
-fi
-
-AC_SUBST(WITH_MODULES)
-AC_SUBST(MODULE_PLATFORM_LIBS)
-AC_SUBST(MODULE_EXTENSION)
-
-dnl
-dnl Check for trio string functions
-dnl
-
-if test "${NEED_TRIO}" = "1" ; then
-    echo Adding trio library for string functions
-    WITH_TRIO=1
-else    
-    WITH_TRIO=0
-fi
-AM_CONDITIONAL(WITH_TRIO_SOURCES, test "${NEED_TRIO}" = "1")
-AC_SUBST(WITH_TRIO)
-
-dnl
-dnl Allow to enable/disable various pieces
-dnl
-echo Checking configuration requirements
-
-dnl
-dnl Thread-related stuff
-dnl
-THREAD_LIBS=""
-BASE_THREAD_LIBS=""
-WITH_THREADS=0
-THREAD_CFLAGS=""
-THREADS_W32=""
-WITH_THREAD_ALLOC=0
-
-if test "$with_threads" = "no" ; then
-    echo Disabling multithreaded support
-else
-    echo Enabling multithreaded support
-
-    dnl Default to native threads on Windows
-    case $host_os in
-       *mingw*) if test "$with_threads" != "pthread" && test "$with_threads" != "no"; then
-               WITH_THREADS="1"
-               THREADS_W32="1"
-               THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS"
-           fi
-       ;;
-    esac
-
-    dnl Use pthread by default in other cases
-    if test -z "$THREADS_W32"; then
-        if test "$with_threads" = "pthread" || test "$with_threads" = "" || test "$with_threads" = "yes" ; then
-            AC_CHECK_HEADER(pthread.h,
-                AC_CHECK_LIB(pthread, pthread_join,[
-                THREAD_LIBS="-lpthread"
-                AC_DEFINE([HAVE_PTHREAD_H], [], [Define if <pthread.h> is there])
-                WITH_THREADS="1"]))
-        fi
-    fi
-
-    case $host_os in
-       *cygwin*) THREAD_LIBS=""
-       ;;
-       *beos*) WITH_THREADS="1"
-          THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_BEOS_THREADS"
-       ;;
-       *linux*)
-           if test "${GCC}" = "yes" ; then
-              GCC_VERSION=`${CC} --version | head -1 | awk '{print $3}'`
-              GCC_MAJOR=`echo ${GCC_VERSION} | sed 's+\..*++'`
-              GCC_MEDIUM=`echo ${GCC_VERSION} | sed 's+[[0-9]]*\.++' | sed 's+\..*++'`
-              if test "${THREAD_LIBS}" = "-lpthread" ; then
-                  if expr ${GCC_MEDIUM} \> 2 \& ${GCC_MAJOR} = 3 > /dev/null
-                  then
-                      THREAD_LIBS=""
-                      BASE_THREAD_LIBS="-lpthread"
-                  else
-                  if expr ${GCC_MAJOR} \> 3 > /dev/null
-                  then
-                      THREAD_LIBS=""
-                      BASE_THREAD_LIBS="-lpthread"
-                  else
-                      echo old GCC disabling weak symbols for pthread
-                  fi
-                  fi
-              fi
-          fi
-       ;;
-    esac
-    if test "$WITH_THREADS" = "1" ; then
-       THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT"
-    fi
-fi
-if test "$with_thread_alloc" = "yes" && test "$WITH_THREADS" = "1" ; then
-    WITH_THREAD_ALLOC=1
-fi
-
-AC_SUBST(THREAD_LIBS)
-AC_SUBST(BASE_THREAD_LIBS)
-AC_SUBST(WITH_THREADS)
-AC_SUBST(THREAD_CFLAGS)
-AC_SUBST(WITH_THREAD_ALLOC)
-AM_CONDITIONAL([THREADS_W32],[test -n "$THREADS_W32"])
-
-dnl
-dnl xmllint shell history
-dnl
-if test "$with_history" = "yes" ; then
-    echo Enabling xmllint shell history
-    dnl check for terminal library. this is a very cool solution
-    dnl from octave's configure.in
-    unset tcap
-    for termlib in ncurses curses termcap terminfo termlib; do
-       AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
-       test -n "$tcap" && break
-    done
-
-    AC_CHECK_HEADER(readline/history.h,
-       AC_CHECK_LIB(history, append_history,[
-          RDL_LIBS="-lhistory"
-          AC_DEFINE([HAVE_LIBHISTORY], [], [Define if history library is there (-lhistory)])]))
-    AC_CHECK_HEADER(readline/readline.h,
-       AC_CHECK_LIB(readline, readline,[
-          RDL_LIBS="-lreadline $RDL_LIBS $tcap"
-          AC_DEFINE([HAVE_LIBREADLINE], [], [Define if readline library is there (-lreadline)])], , $tcap))
-    if test -n "$RDL_DIR" && test -n "$RDL_LIBS"; then
-       CPPFLAGS="$CPPFLAGS -I${RDL_DIR}/include"
-       RDL_LIBS="-L${RDL_DIR}/lib $RDL_LIBS"
-    fi
-fi
-
-dnl
-dnl Tree functions
-dnl
-if test "$with_tree" = "no" ; then
-    echo Disabling DOM like tree manipulation APIs
-    WITH_TREE=0
-else    
-    WITH_TREE=1
-fi
-AC_SUBST(WITH_TREE)
-
-if test "$with_ftp" != "yes" ; then
-    echo Disabling FTP support
-    WITH_FTP=0
-    FTP_OBJ=
-else    
-    WITH_FTP=1
-    FTP_OBJ=nanoftp.o
-fi
-AC_SUBST(WITH_FTP)
-AC_SUBST(FTP_OBJ)
+if test "$with_ftp" != "yes" ; then
+    WITH_FTP=0
+else
+    echo Enabling FTP support
+    WITH_FTP=1
+fi
+AC_SUBST(WITH_FTP)
+AM_CONDITIONAL(WITH_FTP_SOURCES, test "$WITH_FTP" = "1")
 
 if test "$with_http" = "no" ; then
     echo Disabling HTTP support
     WITH_HTTP=0
-    HTTP_OBJ=
-else    
+else
     WITH_HTTP=1
-    HTTP_OBJ=nanohttp.o
 fi
 AC_SUBST(WITH_HTTP)
-AC_SUBST(HTTP_OBJ)
+AM_CONDITIONAL(WITH_HTTP_SOURCES, test "$WITH_HTTP" = "1")
 
 if test "$with_legacy" != "yes" ; then
-    echo Disabling deprecated APIs
     WITH_LEGACY=0
-else    
+else
+    echo Enabling deprecated APIs
     WITH_LEGACY=1
 fi
 AC_SUBST(WITH_LEGACY)
+AM_CONDITIONAL(WITH_LEGACY_SOURCES, test "$WITH_LEGACY" = "1")
 
 if test "$with_reader" = "no" ; then
     echo Disabling the xmlReader parsing interface
     WITH_READER=0
-else    
+else
     WITH_READER=1
-    if test "$with_push" = "no" ; then
-        echo xmlReader requires Push interface - enabling it
-       with_push=yes
-    fi
 fi
 AC_SUBST(WITH_READER)
+AM_CONDITIONAL(WITH_READER_SOURCES, test "$WITH_READER" = "1")
 
 if test "$with_writer" = "no" ; then
     echo Disabling the xmlWriter saving interface
     WITH_WRITER=0
-#    WRITER_TEST=
-else    
+else
     WITH_WRITER=1
-#    WRITER_TEST=Writertests
-    if test "$with_push" = "no" ; then
-        echo xmlWriter requires Push interface - enabling it
-       with_push=yes
-    fi
-    if test "$with_output" = "no" ; then
-        echo xmlWriter requires Output interface - enabling it
-       with_output=yes
-    fi
 fi
 AC_SUBST(WITH_WRITER)
-#AC_SUBST(WRITER_TEST)
+AM_CONDITIONAL(WITH_WRITER_SOURCES, test "$WITH_WRITER" = "1")
 
 if test "$with_pattern" = "no" ; then
     echo Disabling the xmlPattern parsing interface
     WITH_PATTERN=0
-else    
+else
     WITH_PATTERN=1
 fi
 AC_SUBST(WITH_PATTERN)
+AM_CONDITIONAL(WITH_PATTERN_SOURCES, test "$WITH_PATTERN" = "1")
 
 if test "$with_sax1" = "no" ; then
     echo Disabling the older SAX1 interface
     WITH_SAX1=0
-else    
+else
     WITH_SAX1=1
 fi
 AC_SUBST(WITH_SAX1)
+AM_CONDITIONAL(WITH_SAX1_SOURCES, test "$WITH_SAX1" = "1")
 
 if test "$with_push" = "no" ; then
     echo Disabling the PUSH parser interfaces
     WITH_PUSH=0
-else    
+else
     WITH_PUSH=1
 fi
 AC_SUBST(WITH_PUSH)
@@ -1040,296 +616,127 @@ AC_SUBST(WITH_PUSH)
 if test "$with_html" = "no" ; then
     echo Disabling HTML support
     WITH_HTML=0
-    HTML_OBJ=
-else    
+else
     WITH_HTML=1
-    HTML_OBJ="HTMLparser.o HTMLtree.o"
 fi
 AC_SUBST(WITH_HTML)
-AC_SUBST(HTML_OBJ)
+AM_CONDITIONAL(WITH_HTML_SOURCES, test "$WITH_HTML" = "1")
 
 if test "$with_valid" = "no" ; then
     echo Disabling DTD validation support
     WITH_VALID=0
-    TEST_VTIME=
-else    
+else
     WITH_VALID=1
-    TEST_VTIME=VTimingtests
 fi
 AC_SUBST(WITH_VALID)
-AC_SUBST(TEST_VALID)
-AC_SUBST(TEST_VTIME)
+AM_CONDITIONAL(WITH_VALID_SOURCES, test "$WITH_VALID" = "1")
 
 if test "$with_catalog" = "no" ; then
     echo Disabling Catalog support
     WITH_CATALOG=0
-    CATALOG_OBJ=
-    TEST_CATALOG=
-else    
+else
     WITH_CATALOG=1
-    CATALOG_OBJ="catalog.o"
-    TEST_CATALOG=Catatests
 fi
 AC_SUBST(WITH_CATALOG)
-AC_SUBST(CATALOG_OBJ)
-AC_SUBST(TEST_CATALOG)
+AM_CONDITIONAL(WITH_CATALOG_SOURCES, test "$WITH_CATALOG" = "1")
 
 if test "$with_xptr" = "no" ; then
     echo Disabling XPointer support
     WITH_XPTR=0
     WITH_XPTR_LOCS=0
-    XPTR_OBJ=
-else    
+else
     WITH_XPTR=1
-    XPTR_OBJ=xpointer.o
-    if test "$with_xpath" = "no" ; then
-        echo XPointer requires XPath support - enabling it
-       with_xpath=yes
-    fi
-    if test "$with_xptr_locs" = "yes" ; then
-        WITH_XPTR_LOCS=1
-    else
-        WITH_XPTR_LOCS=0
-    fi
 fi
 AC_SUBST(WITH_XPTR)
+AM_CONDITIONAL(WITH_XPTR_SOURCES, test "$WITH_XPTR" = "1")
+
+if test "$with_xptr_locs" != "yes" ; then
+    WITH_XPTR_LOCS=0
+else
+    echo Enabling Xpointer locations support
+    WITH_XPTR_LOCS=1
+fi
 AC_SUBST(WITH_XPTR_LOCS)
-AC_SUBST(XPTR_OBJ)
 
 if test "$with_c14n" = "no" ; then
     echo Disabling C14N support
     WITH_C14N=0
-    C14N_OBJ=
-else    
+else
     WITH_C14N=1
-    C14N_OBJ="c14n.c"
-    if test "$with_xpath" = "no" ; then
-        echo C14N requires XPath support - enabling it
-       with_xpath=yes
-    fi
 fi
 AC_SUBST(WITH_C14N)
-AC_SUBST(C14N_OBJ)
+AM_CONDITIONAL(WITH_C14N_SOURCES, test "$WITH_C14N" = "1")
 
 if test "$with_xinclude" = "no" ; then
     echo Disabling XInclude support
     WITH_XINCLUDE=0
-    XINCLUDE_OBJ=
-    with_xinclude="no"
-else    
+else
     WITH_XINCLUDE=1
-    XINCLUDE_OBJ=xinclude.o
-    if test "$with_xpath" = "no" ; then
-        echo XInclude requires XPath support - enabling it
-       with_xpath=yes
-    fi
 fi
 AC_SUBST(WITH_XINCLUDE)
-AC_SUBST(XINCLUDE_OBJ)
-
-if test "$with_xptr" = "" && test "$with_xpath" = "no" ; then
-    with_xptr=no
-fi
-
-if test "$with_schematron" = "" && test "$with_xpath" = "no" ; then
-    with_schematron=no
-fi
+AM_CONDITIONAL(WITH_XINCLUDE_SOURCES, test "$WITH_XINCLUDE" = "1")
 
 if test "$with_schematron" = "no" ; then
     echo "Disabling Schematron support"
     WITH_SCHEMATRON=0
-    TEST_SCHEMATRON=
-else 
-    echo "Enabled Schematron support"
+else
     WITH_SCHEMATRON=1
-    TEST_SCHEMATRON="Schematrontests"
-    with_xpath=yes
-    with_pattern=yes
-    with_schematron=yes
 fi
 AC_SUBST(WITH_SCHEMATRON)
-AC_SUBST(TEST_SCHEMATRON)
+AM_CONDITIONAL(WITH_SCHEMATRON_SOURCES, test "$WITH_SCHEMATRON" = "1")
 
 if test "$with_xpath" = "no" ; then
     echo Disabling XPATH support
     WITH_XPATH=0
-    XPATH_OBJ=
-else    
+else
     WITH_XPATH=1
-    XPATH_OBJ=xpath.o
 fi
 AC_SUBST(WITH_XPATH)
-AC_SUBST(XPATH_OBJ)
+AM_CONDITIONAL(WITH_XPATH_SOURCES, test "$WITH_XPATH" = "1")
 
-dnl
-dnl output functions
-dnl
 if test "$with_output" = "no" ; then
     echo Disabling serialization/saving support
     WITH_OUTPUT=0
-else    
+else
     WITH_OUTPUT=1
 fi
 AC_SUBST(WITH_OUTPUT)
+AM_CONDITIONAL(WITH_OUTPUT_SOURCES, test "$WITH_OUTPUT" = "1")
 
-WITH_ICONV=0
-if test "$with_iconv" = "no" ; then
-    echo Disabling ICONV support
-else
-    if test "$with_iconv" != "yes" && test "$with_iconv" != "" ; then
-       CPPFLAGS="${CPPFLAGS} -I$with_iconv/include"
-       # Export this since our headers include iconv.h
-       XML_INCLUDEDIR="${XML_INCLUDEDIR} -I$with_iconv/include"
-       ICONV_LIBS="-L$with_iconv/lib"
-    fi
-
-    AC_CHECK_HEADER(iconv.h,
-       AC_MSG_CHECKING(for iconv)
-       AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
-#include <iconv.h>]],[[
-iconv_t cd = iconv_open ("","");
-iconv (cd, NULL, NULL, NULL, NULL);]])],[
-           AC_MSG_RESULT(yes)
-           WITH_ICONV=1],[
-           AC_MSG_RESULT(no)
-           AC_MSG_CHECKING(for iconv in -liconv)
-
-           _ldflags="${LDFLAGS}"
-           _libs="${LIBS}"
-           LDFLAGS="${LDFLAGS} ${ICONV_LIBS}"
-           LIBS="${LIBS} -liconv"
-
-           AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
-#include <iconv.h>]],[[
-iconv_t cd = iconv_open ("","");
-iconv (cd, NULL, NULL, NULL, NULL);]])],[
-               AC_MSG_RESULT(yes)
-               WITH_ICONV=1
-               ICONV_LIBS="${ICONV_LIBS} -liconv"
-               LIBS="${_libs}"
-               LDFLAGS="${_ldflags}"],[
-               AC_MSG_RESULT(no)
-               LIBS="${_libs}"
-               LDFLAGS="${_ldflags}"])]))
-fi
-AC_SUBST(WITH_ICONV)
-
-WITH_ICU=0
-ICU_LIBS=""
-if test "$with_icu" != "yes" ; then
-    echo Disabling ICU support
-else
-    # Try pkg-config first so that static linking works.
-    # If this succeeeds, we ignore the WITH_ICU directory.
-    PKG_CHECK_MODULES([ICU],[icu-i18n],
-        [have_libicu=yes],
-        [have_libicu=no])
-
-    if test "x$have_libicu" = "xyes"; then
-        m4_ifdef([PKG_CHECK_VAR],
-            [PKG_CHECK_VAR([ICU_DEFS], [icu-i18n], [DEFS])])
-        if test "x$ICU_DEFS" != "x"; then
-            CPPFLAGS="$CPPFLAGS $ICU_DEFS"
-        fi
-    fi
-
-    # If pkg-config failed, fall back to AC_CHECK_LIB. This
-    # will not pick up the necessary LIBS flags for liblzma's
-    # private dependencies, though, so static linking may fail.
-    if test "x$have_libicu" = "xno"; then
-        ICU_CONFIG=icu-config
-        if ${ICU_CONFIG} --cflags >/dev/null 2>&1
-        then
-            ICU_LIBS=`${ICU_CONFIG} --ldflags`
-            have_libicu=yes
-            echo Enabling ICU support
-        else
-            if test "$with_icu" != "yes" && test "$with_iconv" != "" ; then
-                CPPFLAGS="${CPPFLAGS} -I$with_icu"
-            fi
-
-            AC_CHECK_HEADER(unicode/ucnv.h,
-            AC_MSG_CHECKING(for icu)
-            AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <unicode/ucnv.h>]], [[
-        UConverter *utf = ucnv_open("UTF-8", NULL);]])],[
-                AC_MSG_RESULT(yes)
-                have_libicu=yes],[
-                AC_MSG_RESULT(no)
-                AC_MSG_CHECKING(for icu in -licucore)
-
-                _ldflags="${LDFLAGS}"
-                _libs="${LIBS}"
-                LDFLAGS="${LDFLAGS} ${ICU_LIBS}"
-                LIBS="${LIBS} -licucore"
-
-                AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <unicode/ucnv.h>]], [[
-        UConverter *utf = ucnv_open("UTF-8", NULL);]])],[
-                    AC_MSG_RESULT(yes)
-                    have_libicu=yes
-                    ICU_LIBS="${ICU_LIBS} -licucore"
-                    LIBS="${_libs}"
-                    LDFLAGS="${_ldflags}"],[
-                    AC_MSG_RESULT(no)
-                    LIBS="${_libs}"
-                LDFLAGS="${_ldflags}"])]))
-        fi
-    fi
-
-    # Found the library via either method?
-    if test "x$have_libicu" = "xyes"; then
-        WITH_ICU=1
-    fi
-fi
-XML_LIBS="-lxml2"
-XML_LIBTOOLLIBS="libxml2.la"
-AC_SUBST(WITH_ICU)
-
-WITH_ISO8859X=1
-if test "$WITH_ICONV" != "1" ; then
-if test "$with_iso8859x" = "no" ; then
+if test "$WITH_ICONV" != "1" && test "$with_iso8859x" = "no" ; then
     echo Disabling ISO8859X support
     WITH_ISO8859X=0
-fi
+else
+    WITH_ISO8859X=1
 fi
 AC_SUBST(WITH_ISO8859X)
 
 if test "$with_schemas" = "no" ; then
     echo "Disabling Schemas/Relax-NG support"
     WITH_SCHEMAS=0
-else    
-    echo "Enabled Schemas/Relax-NG support"
+else
     WITH_SCHEMAS=1
-    AS_IF([test "x$with_python" != "xno"], [
-        PYTHON_TESTS="$PYTHON_TESTS RelaxNGPythonTests SchemasPythonTests"
-    ])
-    with_regexps=yes
 fi
 AC_SUBST(WITH_SCHEMAS)
+AM_CONDITIONAL(WITH_SCHEMAS_SOURCES, test "$WITH_SCHEMAS" = "1")
 
 if test "$with_regexps" = "no" ; then
     echo Disabling Regexps support
     WITH_REGEXPS=0
-    TEST_REGEXPS=
-else    
+else
     WITH_REGEXPS=1
-    TEST_REGEXPS="Automatatests"
 fi
 AC_SUBST(WITH_REGEXPS)
-AC_SUBST(TEST_REGEXPS)
+AM_CONDITIONAL(WITH_REGEXPS_SOURCES, test "$WITH_REGEXPS" = "1")
 
 if test "$with_debug" = "no" ; then
     echo Disabling DEBUG support
     WITH_DEBUG=0
-    DEBUG_OBJ=
-    TEST_DEBUG=
-else    
+else
     WITH_DEBUG=1
-    DEBUG_OBJ=debugXML.o
-    TEST_DEBUG=Scripttests
 fi
 AC_SUBST(WITH_DEBUG)
-AC_SUBST(DEBUG_OBJ)
-AC_SUBST(TEST_DEBUG)
+AM_CONDITIONAL(WITH_DEBUG_SOURCES, test "$WITH_DEBUG" = "1")
 
 if test "$with_mem_debug" = "yes" ; then
     if test "$with_thread_alloc" = "yes" ; then
@@ -1339,107 +746,420 @@ if test "$with_mem_debug" = "yes" ; then
         echo Enabling memory debug support
         WITH_MEM_DEBUG=1
     fi
-else    
+else
     WITH_MEM_DEBUG=0
 fi
 AC_SUBST(WITH_MEM_DEBUG)
 
-if test "$with_run_debug" = "yes" ; then
-    echo Enabling runtime debug support
-    WITH_RUN_DEBUG=1
+dnl
+dnl Check for Python
+dnl
+
+AS_IF([test "x$with_python" != "xno"], [
+    AM_PATH_PYTHON
+    PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}])
+])
+AM_CONDITIONAL([WITH_PYTHON], [test "x$with_python" != "xno"])
+
+dnl
+dnl Extra Python flags for Windows
+dnl
+PYTHON_LDFLAGS=
+if test "${PYTHON}" != ""; then
+    case "$host" in
+        *-*-mingw* )
+            PYTHON_LDFLAGS="-no-undefined -shrext .pyd"
+            ;;
+        *-*-cygwin* |*-*-msys* )
+            PYTHON_LDFLAGS="-no-undefined"
+            ;;
+    esac
+fi
+AC_SUBST(PYTHON_LDFLAGS)
+
+dnl
+dnl Check for DSO support
+dnl
+WITH_MODULES=0
+
+if test "$with_modules" != "no" ; then
+    case "$host" in
+        *-*-cygwin* | *-*-msys* )
+            MODULE_EXTENSION=".dll"
+            ;;
+        *-*-mingw*)
+            MODULE_EXTENSION=".dll"
+            WITH_MODULES=1
+            ;;
+        *-*-hpux*)
+           MODULE_EXTENSION=".sl"
+           ;;
+        *)
+           MODULE_EXTENSION=".so"
+           ;;
+    esac
+
+    if test "$WITH_MODULES" = "0"; then
+        _libs=$LIBS
+        AC_SEARCH_LIBS([dlopen], [dl], [
+            WITH_MODULES=1
+            if test "$ac_cv_search_dlopen" != "none required"; then
+                MODULE_PLATFORM_LIBS=$ac_cv_search_dlopen
+            fi
+            AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])], [
+            AC_SEARCH_LIBS([shl_load], [dld], [
+                WITH_MODULES=1
+                if test "$ac_cv_search_shl_load" != "none required"; then
+                    MODULE_PLATFORM_LIBS=$ac_cv_search_shl_load
+                fi
+                AC_DEFINE([HAVE_SHLLOAD], [], [Have shl_load based dso])])])
+        LIBS=$_libs
+    fi
+fi
+
+AC_SUBST(WITH_MODULES)
+AC_SUBST(MODULE_PLATFORM_LIBS)
+AC_SUBST(MODULE_EXTENSION)
+AM_CONDITIONAL(WITH_MODULES_SOURCES, test "$WITH_MODULES" = "1")
+
+dnl
+dnl Check for trio string functions
+dnl
+if test "${NEED_TRIO}" = "1" ; then
+    echo Adding trio library for string functions
+    WITH_TRIO=1
 else    
-    WITH_RUN_DEBUG=0
+    WITH_TRIO=0
 fi
-AC_SUBST(WITH_RUN_DEBUG)
-
-WIN32_EXTRA_LIBADD=
-WIN32_EXTRA_LDFLAGS=
-CYGWIN_EXTRA_LDFLAGS=
-CYGWIN_EXTRA_PYTHON_LIBADD=
-WIN32_EXTRA_PYTHON_LIBADD=
-case "$host" in
- *-*-mingw*)
- CPPFLAGS="$CPPFLAGS -DWIN32"
- WIN32_EXTRA_LIBADD="-lws2_32"
- WIN32_EXTRA_LDFLAGS="-no-undefined"
- if test "${PYTHON}" != ""
- then
-   case "$host" in
-     *-w64-mingw*)
-       WIN32_EXTRA_PYTHON_LIBADD="-shrext .pyd -L${pythondir}/../../lib -lpython${PYTHON_VERSION}"
-       ;;
-     *)
-       WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython$(echo ${PYTHON_VERSION} | tr -d .)"
-       ;;
-   esac
- fi
- ;;
- *-*-cygwin*)
- CYGWIN_EXTRA_LDFLAGS="-no-undefined"
- if test "${PYTHON}" != ""
- then
-   CYGWIN_EXTRA_PYTHON_LIBADD="-L/usr/lib/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}"
- fi
- ;;
-esac
+AM_CONDITIONAL(WITH_TRIO_SOURCES, test "${NEED_TRIO}" = "1")
+AC_SUBST(WITH_TRIO)
+
+dnl
+dnl Thread-related stuff
+dnl
+THREAD_LIBS=""
+BASE_THREAD_LIBS=""
+WITH_THREADS=0
+THREAD_CFLAGS=""
+WITH_THREAD_ALLOC=0
+
+if test "$with_threads" = "no" ; then
+    echo Disabling multithreaded support
+else
+    case $host_os in
+        *mingw*)
+            dnl Default to native threads on Windows
+            WITH_THREADS="1"
+            ;;
+        *)
+            dnl Use pthread by default in other cases
+            _libs=$LIBS
+            AC_CHECK_HEADERS(pthread.h,
+                AC_SEARCH_LIBS([pthread_join], [pthread], [
+                    WITH_THREADS="1"
+                    if test "$ac_cv_search_pthread_join" != "none required"; then
+                        THREAD_LIBS=$ac_cv_search_pthread_join
+                    fi
+                    AC_DEFINE([HAVE_PTHREAD_H], [],
+                              [Define if <pthread.h> is there])]))
+            LIBS=$_libs
+            ;;
+    esac
+
+    case $host_os in
+        *linux*)
+            if test "${GCC}" = "yes" ; then
+                BASE_THREAD_LIBS="$THREAD_LIBS"
+                THREAD_LIBS=""
+            fi
+            ;;
+    esac
+
+    if test "$WITH_THREADS" = "1" ; then
+       THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT"
+    fi
+fi
+if test "$with_thread_alloc" = "yes" && test "$WITH_THREADS" = "1" ; then
+    WITH_THREAD_ALLOC=1
+fi
+
+AC_SUBST(THREAD_LIBS)
+AC_SUBST(BASE_THREAD_LIBS)
+AC_SUBST(WITH_THREADS)
+AC_SUBST(THREAD_CFLAGS)
+AC_SUBST(WITH_THREAD_ALLOC)
+
+dnl
+dnl xmllint shell history
+dnl
+if test "$with_history" = "yes" && test "$with_readline" != "no"; then
+    echo Enabling xmllint shell history
+    dnl check for terminal library. this is a very cool solution
+    dnl from octave's configure.in
+    unset tcap
+    for termlib in ncurses curses termcap terminfo termlib; do
+       AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
+       test -n "$tcap" && break
+    done
+
+    _cppflags=$CPPFLAGS
+    _libs=$LIBS
+    if test "$with_readline" != "" && test "$with_readline" != "yes"; then
+        RDL_DIR=$with_readline
+        CPPFLAGS="${CPPFLAGS} -I$RDL_DIR/include"
+        LIBS="${LIBS} -L$RDL_DIR/lib"
+    fi
+    AC_CHECK_HEADER(readline/history.h,
+       AC_CHECK_LIB(history, append_history,[
+           RDL_LIBS="-lhistory"
+            if test "x${RDL_DIR}" != "x"; then
+                RDL_CFLAGS="-I$RDL_DIR/include"
+                RDL_LIBS="-L$RDL_DIR/lib $RDL_LIBS"
+            fi
+           AC_DEFINE([HAVE_LIBHISTORY], [], [Define if history library is there (-lhistory)])]))
+    AC_CHECK_HEADER(readline/readline.h,
+       AC_CHECK_LIB(readline, readline,[
+           RDL_LIBS="-lreadline $RDL_LIBS $tcap"
+            if test "x$RDL_DIR" != "x"; then
+                RDL_CFLAGS="-I$RDL_DIR/include"
+                RDL_LIBS="-L$RDL_DIR/lib $RDL_LIBS"
+            fi
+           AC_DEFINE([HAVE_LIBREADLINE], [], [Define if readline library is there (-lreadline)])], , $tcap))
+    CPPFLAGS=$_cppflags
+    LIBS=$_libs
+fi
+AC_SUBST(RDL_CFLAGS)
+AC_SUBST(RDL_LIBS)
+
+dnl
+dnl Checks for zlib library.
+dnl
+WITH_ZLIB=0
+
+if test "$with_zlib" = "no"; then
+    echo "Disabling zlib compression support"
+else
+    if test "$with_zlib" != "yes"; then
+        Z_DIR=$with_zlib
+    fi
+
+    # Don't run pkg-config if with_zlib contains a path.
+    if test "x$Z_DIR" = "x"; then
+        # Try pkg-config first so that static linking works.
+        PKG_CHECK_MODULES([Z],[zlib],
+            [WITH_ZLIB=1],
+            [:])
+    fi
 
-XML_PRIVATE_LIBS="$Z_LIBS $LZMA_LIBS $THREAD_LIBS $ICONV_LIBS $ICU_LIBS $LIBM $WIN32_EXTRA_LIBADD"
+    if test "$WITH_ZLIB" = "0"; then
+        _cppflags=$CPPFLAGS
+        _libs=$LIBS
+        if test "x$Z_DIR" != "x"; then
+            CPPFLAGS="${CPPFLAGS} -I$Z_DIR/include"
+            LIBS="${LIBS} -L$Z_DIR/lib"
+        fi
+        AC_CHECK_HEADERS(zlib.h,
+            AC_CHECK_LIB(z, gzread,[
+                WITH_ZLIB=1
+                if test "x${Z_DIR}" != "x"; then
+                    Z_CFLAGS="-I${Z_DIR}/include"
+                    Z_LIBS="-L${Z_DIR}/lib -lz"
+                    [case ${host} in
+                        *-*-solaris*)
+                            Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
+                            ;;
+                    esac]
+                else
+                    Z_LIBS="-lz"
+                fi])
+            )
+        CPPFLAGS=$_cppflags
+        LIBS=$_libs
+    fi
+fi
+AC_SUBST(WITH_ZLIB)
 
-AC_SUBST(WIN32_EXTRA_LIBADD)
-AC_SUBST(WIN32_EXTRA_LDFLAGS)
-AC_SUBST(WIN32_EXTRA_PYTHON_LIBADD)
-AC_SUBST(CYGWIN_EXTRA_LDFLAGS)
-AC_SUBST(CYGWIN_EXTRA_PYTHON_LIBADD)
+dnl
+dnl Checks for lzma library.
+dnl
+WITH_LZMA=0
+
+if test "$with_lzma" = "no"; then
+    echo "Disabling lzma compression support"
+else
+    if test "$with_lzma" != "yes"; then
+        LZMA_DIR=$with_lzma
+    fi
+
+    # Don't run pkg-config if with_lzma contains a path.
+    if test "x$LZMA_DIR" = "x"; then
+        # Try pkg-config first so that static linking works.
+        PKG_CHECK_MODULES([LZMA],[liblzma],
+            [WITH_LZMA=1],
+            [:])
+    fi
+
+    # If pkg-config failed, fall back to AC_CHECK_LIB. This
+    # will not pick up the necessary LIBS flags for liblzma's
+    # private dependencies, though, so static linking may fail.
+    if test "$WITH_LZMA" = "0"; then
+        _cppflags=$CPPFLAGS
+        _libs=$LIBS
+        if test "x$LZMA_DIR" != "x"; then
+            CPPFLAGS="${CPPFLAGS} -I$LZMA_DIR/include"
+            LIBS="${LIBS} -L$LZMA_DIR/lib"
+        fi
+        AC_CHECK_HEADERS(lzma.h,
+            AC_CHECK_LIB(lzma, lzma_code,[
+                WITH_LZMA=1
+                if test "x${LZMA_DIR}" != "x"; then
+                    LZMA_CFLAGS="-I${LZMA_DIR}/include"
+                    LZMA_LIBS="-L${LZMA_DIR}/lib -llzma"
+                else
+                    LZMA_LIBS="-llzma"
+                fi])
+            )
+        CPPFLAGS=$_cppflags
+        LIBS=$_libs
+    fi
+fi
+AC_SUBST(WITH_LZMA)
+AM_CONDITIONAL(WITH_LZMA_SOURCES, test "$WITH_LZMA" = "1")
 
-dnl Checking the standard string functions availability
 dnl
-dnl Note mingw* has C99 implementation that produce expected xml numbers
-dnl if code use {v}snprintf functions.
-dnl If you like to activate at run-time C99 compatible number output
-dnl see release note for mingw runtime 3.15:
-dnl  http://sourceforge.net/project/shownotes.php?release_id=24832
+dnl Checks for iconv library.
 dnl
-dnl Also *win32*config.h files redefine them for various MSC compilers.
+WITH_ICONV=0
+
+if test "$with_iconv" = "no" ; then
+    echo Disabling ICONV support
+else
+    _cppflags=$CPPFLAGS
+    _libs=$LIBS
+    if test "$with_iconv" != "yes" && test "$with_iconv" != "" ; then
+       ICONV_DIR=$with_iconv
+       CPPFLAGS="$CPPFLAGS -I$ICONV_DIR/include"
+       LIBS="$LIBS -L$ICONV_DIR/lib"
+    fi
+    AC_MSG_CHECKING([for libiconv])
+    AC_LINK_IFELSE([
+        AC_LANG_PROGRAM([#include <iconv.h>], [iconv_open(0,0);])
+    ], [
+        WITH_ICONV=1
+        AC_MSG_RESULT([none required])
+    ], [
+        LIBS="$LIBS -liconv"
+        AC_LINK_IFELSE([
+            AC_LANG_PROGRAM([#include <iconv.h>], [iconv_open(0,0);])
+        ], [
+            WITH_ICONV=1
+            ICONV_LIBS="-liconv"
+            AC_MSG_RESULT([yes])
+        ], [
+            AC_MSG_RESULT([no])
+        ])
+    ])
+    if test "$WITH_ICONV" = "1" && test "$ICONV_DIR" != ""; then
+        ICONV_CFLAGS="-I$ICONV_DIR/include"
+        ICONV_LIBS="-L$ICONV_DIR/lib $ICONV_LIBS"
+       # Export this since our headers include iconv.h
+       XML_INCLUDEDIR="$XML_INCLUDEDIR -I$ICONV_DIR/include"
+    fi
+    CPPFLAGS=$_cppflags
+    LIBS=$_libs
+fi
+AC_SUBST(WITH_ICONV)
+AC_SUBST(ICONV_CFLAGS)
+
 dnl
-dnl So do not redefine {v}snprintf to _{v}snprintf like following:
-dnl  AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
-dnl  AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
-dnl and do not redefine those functions is C-source files.
+dnl Checks for ICU library.
 dnl
-AC_CHECK_FUNCS(snprintf vsnprintf,,
-       NEED_TRIO=1)
+WITH_ICU=0
+ICU_LIBS=""
+
+if test "$with_icu" != "yes" ; then
+    echo Disabling ICU support
+else
+    # Try pkg-config first so that static linking works.
+    # If this succeeeds, we ignore the WITH_ICU directory.
+    PKG_CHECK_MODULES([ICU], [icu-i18n], [
+        WITH_ICU=1
+        m4_ifdef([PKG_CHECK_VAR],
+            [PKG_CHECK_VAR([ICU_DEFS], [icu-i18n], [DEFS])])
+        if test "x$ICU_DEFS" != "x"; then
+            ICU_CFLAGS="$ICU_CFLAGS $ICU_DEFS"
+        fi],[:])
+
+    if test "$WITH_ICU" = "0"; then
+        ICU_CONFIG=icu-config
+        if ${ICU_CONFIG} --cflags >/dev/null 2>&1
+        then
+            WITH_ICU=1
+            ICU_CFLAGS=`${ICU_CONFIG} --cflags`
+            ICU_LIBS=`${ICU_CONFIG} --ldflags`
+        else
+           _cppflags="${CPPFLAGS}"
+           _libs="${LIBS}"
+            if test "$with_icu" != "yes" && test "$with_icu" != "" ; then
+                ICU_DIR=$with_icu
+                CPPFLAGS="${CPPFLAGS} -I$ICU_DIR/include"
+                LIBS="${LIBS} -L$ICU_DIR/lib"
+            fi
+
+            AC_CHECK_HEADER(unicode/ucnv.h, [
+                AC_CHECK_LIB([icucore], [ucnv_open], [
+                    WITH_ICU=1
+                    ICU_LIBS=-licucore
+                    if test "$ICU_DIR" != ""; then
+                        ICU_CFLAGS="-I$ICU_DIR/include"
+                        ICU_LIBS="-L$ICU_DIR/lib $ICU_LIBS"
+                    fi])])
+            CPPFLAGS=$_cppflags
+            LIBS=$_libs
+        fi
+    fi
+fi
+AC_SUBST(WITH_ICU)
 
 if test "$with_coverage" = "yes" && test "${GCC}" = "yes"
 then
     echo Enabling code coverage for GCC
-    EXTRA_CFLAGS="$EXTRA_CFLAGS -fprofile-arcs -ftest-coverage"
-    LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage"
+    AM_CFLAGS="$AM_CFLAGS -fprofile-arcs -ftest-coverage"
+    AM_LDFLAGS="$AM_LDFLAGS -fprofile-arcs -ftest-coverage"
 else
     echo Disabling code coverage for GCC
 fi
 
-AC_SUBST(EXTRA_CFLAGS)
+XML_LIBS="-lxml2"
+XML_LIBTOOLLIBS="libxml2.la"
+XML_PRIVATE_LIBS="$Z_LIBS $LZMA_LIBS $THREAD_LIBS $ICONV_LIBS $ICU_LIBS $LIBM $NET_LIBS"
+XML_PRIVATE_CFLAGS="$Z_CFLAGS $LZMA_CFLAGS $THREAD_CFLAGS $ICONV_CFLAGS $ICU_CFLAGS"
+
+AC_SUBST(AM_CFLAGS)
+AC_SUBST(AM_LDFLAGS)
 AC_SUBST(XML_CFLAGS)
 
 AC_SUBST(XML_LIBDIR)
 AC_SUBST(XML_LIBS)
 AC_SUBST(XML_PRIVATE_LIBS)
+AC_SUBST(XML_PRIVATE_CFLAGS)
 AC_SUBST(XML_LIBTOOLLIBS)
-AC_SUBST(ICONV_LIBS)
-AC_SUBST(ICU_LIBS)
 AC_SUBST(XML_INCLUDEDIR)
 
-AC_SUBST(RDL_LIBS)
-
 dnl for the spec file
 RELDATE=`date +'%a %b %e %Y'`
 AC_SUBST(RELDATE)
-AC_SUBST(PYTHON_TESTS)
 
 # keep on one line for cygwin c.f. #130896
-AC_CONFIG_FILES([libxml2.spec:libxml.spec.in Makefile include/Makefile include/libxml/Makefile doc/Makefile doc/examples/Makefile doc/devhelp/Makefile example/Makefile fuzz/Makefile python/Makefile python/tests/Makefile xstc/Makefile include/libxml/xmlversion.h libxml-2.0.pc libxml-2.0-uninstalled.pc libxml2-config.cmake])
+AC_CONFIG_FILES([Makefile include/Makefile include/libxml/Makefile include/private/Makefile doc/Makefile doc/examples/Makefile doc/devhelp/Makefile example/Makefile fuzz/Makefile python/Makefile python/tests/Makefile xstc/Makefile include/libxml/xmlversion.h libxml-2.0.pc libxml-2.0-uninstalled.pc libxml2-config.cmake])
 AC_CONFIG_FILES([python/setup.py], [chmod +x python/setup.py])
 AC_CONFIG_FILES([xml2-config], [chmod +x xml2-config])
 AC_OUTPUT
 
-echo Done configuring
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([_Thread_local int v;])], [], [
+    echo "================================================================"
+    echo "WARNING: Your C compiler doesn't support C11."
+    echo "Future versions of libxml2 will probably require a C11 compiler,"
+    echo "at least for features like multi-threading."
+    echo "================================================================"
+])
index f451c9d..3bb1930 100644 (file)
@@ -30,6 +30,8 @@
 #include <libxml/relaxng.h>
 #endif
 
+#include "private/error.h"
+
 #define DUMP_TEXT_TYPE 1
 
 typedef struct _xmlDebugCtxt xmlDebugCtxt;
@@ -2633,7 +2635,7 @@ xmlShellValidate(xmlShellCtxtPtr ctxt, char *dtd,
     int res = -1;
 
     if ((ctxt == NULL) || (ctxt->doc == NULL)) return(-1);
-    vctxt.userData = NULL;
+    memset(&vctxt, 0, sizeof(vctxt));
     vctxt.error = xmlGenericError;
     vctxt.warning = xmlGenericError;
 
diff --git a/dict.c b/dict.c
index c29d2af..d7fd1a0 100644 (file)
--- a/dict.c
+++ b/dict.c
@@ -23,6 +23,9 @@
 #include <stdlib.h>
 #include <time.h>
 
+#include "private/dict.h"
+#include "private/threads.h"
+
 /*
  * Following http://www.ocert.org/advisories/ocert-2011-003.html
  * it seems that having hash randomization might be a good idea
@@ -127,12 +130,7 @@ struct _xmlDict {
  * A mutex for modifying the reference counter for shared
  * dictionaries.
  */
-static xmlMutexPtr xmlDictMutex = NULL;
-
-/*
- * Whether the dictionary mutex was initialized.
- */
-static int xmlDictInitialized = 0;
+static xmlMutex xmlDictMutex;
 
 #ifdef DICT_RANDOMIZATION
 #ifdef HAVE_RAND_R
@@ -146,15 +144,10 @@ static unsigned int rand_seed = 0;
 /**
  * xmlInitializeDict:
  *
- * DEPRECATED: This function will be made private. Call xmlInitParser to
- * initialize the library.
- *
- * Do the dictionary mutex initialization.
- *
- * Returns 0 if initialization was already done, and 1 if that
- * call led to the initialization
+ * DEPRECATED: Alias for xmlInitParser.
  */
 int xmlInitializeDict(void) {
+    xmlInitParser();
     return(0);
 }
 
@@ -163,20 +156,9 @@ int xmlInitializeDict(void) {
  *
  * 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);
-
-    if ((xmlDictMutex = xmlNewMutex()) == NULL)
-        return(0);
-    xmlMutexLock(xmlDictMutex);
+    xmlInitMutex(&xmlDictMutex);
 
 #ifdef DICT_RANDOMIZATION
 #ifdef HAVE_RAND_R
@@ -186,8 +168,6 @@ int __xmlInitializeDict(void) {
     srand(time(NULL));
 #endif
 #endif
-    xmlDictInitialized = 1;
-    xmlMutexUnlock(xmlDictMutex);
     return(1);
 }
 
@@ -195,16 +175,13 @@ int __xmlInitializeDict(void) {
 int __xmlRandom(void) {
     int ret;
 
-    if (xmlDictInitialized == 0)
-        __xmlInitializeDict();
-
-    xmlMutexLock(xmlDictMutex);
+    xmlMutexLock(&xmlDictMutex);
 #ifdef HAVE_RAND_R
     ret = rand_r(& rand_seed);
 #else
     ret = rand();
 #endif
-    xmlMutexUnlock(xmlDictMutex);
+    xmlMutexUnlock(&xmlDictMutex);
     return(ret);
 }
 #endif
@@ -212,22 +189,23 @@ int __xmlRandom(void) {
 /**
  * xmlDictCleanup:
  *
- * DEPRECATED: This function will be made private. Call xmlCleanupParser
+ * DEPRECATED: This function is a no-op. Call xmlCleanupParser
  * to free global state but see the warnings there. xmlCleanupParser
  * should be only called once at program exit. In most cases, you don't
  * have call cleanup functions at all.
- *
- * Free the dictionary mutex. Do not call unless sure the library
- * is not in use anymore !
  */
 void
 xmlDictCleanup(void) {
-    if (!xmlDictInitialized)
-        return;
-
-    xmlFreeMutex(xmlDictMutex);
+}
 
-    xmlDictInitialized = 0;
+/**
+ * xmlCleanupDictInternal:
+ *
+ * Free the dictionary mutex.
+ */
+void
+xmlCleanupDictInternal(void) {
+    xmlCleanupMutex(&xmlDictMutex);
 }
 
 /*
@@ -376,6 +354,7 @@ found_pool:
 
 #ifdef __clang__
 ATTRIBUTE_NO_SANITIZE("unsigned-integer-overflow")
+ATTRIBUTE_NO_SANITIZE("unsigned-shift-base")
 #endif
 static uint32_t
 xmlDictComputeBigKey(const xmlChar* data, int namelen, int seed) {
@@ -411,6 +390,7 @@ xmlDictComputeBigKey(const xmlChar* data, int namelen, int seed) {
  */
 #ifdef __clang__
 ATTRIBUTE_NO_SANITIZE("unsigned-integer-overflow")
+ATTRIBUTE_NO_SANITIZE("unsigned-shift-base")
 #endif
 static unsigned long
 xmlDictComputeBigQKey(const xmlChar *prefix, int plen,
@@ -453,7 +433,8 @@ static unsigned long
 xmlDictComputeFastKey(const xmlChar *name, int namelen, int seed) {
     unsigned long value = seed;
 
-    if (name == NULL) return(0);
+    if ((name == NULL) || (namelen <= 0))
+        return(value);
     value += *name;
     value <<= 5;
     if (namelen > 10) {
@@ -496,10 +477,10 @@ static unsigned long
 xmlDictComputeFastQKey(const xmlChar *prefix, int plen,
                        const xmlChar *name, int len, int seed)
 {
-    unsigned long value = (unsigned long) seed;
+    unsigned long value = seed;
 
     if (plen == 0)
-       value += 30 * (unsigned long) ':';
+       value += 30 * ':';
     else
        value += 30 * (*prefix);
 
@@ -537,7 +518,7 @@ xmlDictComputeFastQKey(const xmlChar *prefix, int plen,
     }
     len -= plen;
     if (len > 0) {
-        value += (unsigned long) ':';
+        value += ':';
        len--;
     }
     switch (len) {
@@ -577,9 +558,7 @@ xmlDictPtr
 xmlDictCreate(void) {
     xmlDictPtr dict;
 
-    if (!xmlDictInitialized)
-        if (!__xmlInitializeDict())
-            return(NULL);
+    xmlInitParser();
 
 #ifdef DICT_DEBUG_PATTERNS
     fprintf(stderr, "C");
@@ -645,14 +624,10 @@ xmlDictCreateSub(xmlDictPtr sub) {
  */
 int
 xmlDictReference(xmlDictPtr dict) {
-    if (!xmlDictInitialized)
-        if (!__xmlInitializeDict())
-            return(-1);
-
     if (dict == NULL) return -1;
-    xmlMutexLock(xmlDictMutex);
+    xmlMutexLock(&xmlDictMutex);
     dict->ref_counter++;
-    xmlMutexUnlock(xmlDictMutex);
+    xmlMutexUnlock(&xmlDictMutex);
     return(0);
 }
 
@@ -809,19 +784,15 @@ xmlDictFree(xmlDictPtr dict) {
     if (dict == NULL)
        return;
 
-    if (!xmlDictInitialized)
-        if (!__xmlInitializeDict())
-            return;
-
     /* decrement the counter, it may be shared by a parser and docs */
-    xmlMutexLock(xmlDictMutex);
+    xmlMutexLock(&xmlDictMutex);
     dict->ref_counter--;
     if (dict->ref_counter > 0) {
-        xmlMutexUnlock(xmlDictMutex);
+        xmlMutexUnlock(&xmlDictMutex);
         return;
     }
 
-    xmlMutexUnlock(xmlDictMutex);
+    xmlMutexUnlock(&xmlDictMutex);
 
     if (dict->subdict != NULL) {
         xmlDictFree(dict->subdict);
@@ -1005,7 +976,7 @@ xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) {
  */
 const xmlChar *
 xmlDictExists(xmlDictPtr dict, const xmlChar *name, int len) {
-    unsigned long key, okey, nbi = 0;
+    unsigned long key, okey;
     xmlDictEntryPtr insert;
     unsigned int l;
 
@@ -1040,7 +1011,6 @@ xmlDictExists(xmlDictPtr dict, const xmlChar *name, int len) {
                (!xmlStrncmp(insert->name, name, l)))
                return(insert->name);
 #endif
-           nbi++;
        }
 #ifdef __GNUC__
        if ((insert->okey == okey) && (insert->len == l)) {
@@ -1082,7 +1052,6 @@ xmlDictExists(xmlDictPtr dict, const xmlChar *name, int len) {
                    (!xmlStrncmp(tmp->name, name, l)))
                    return(tmp->name);
 #endif
-               nbi++;
            }
 #ifdef __GNUC__
            if ((tmp->okey == skey) && (tmp->len == l)) {
index 5daef3e..5f16fca 100644 (file)
@@ -58,10 +58,7 @@ dist_man_MANS = xml2-config.1 xmllint.1 xmlcatalog.1
 
 EXTRA_DIST = \
        apibuild.py \
-       checkapisym.xsl \
        libxml2-api.xml \
-       symbols.xml \
-       syms.xsl \
        xmlcatalog.xml \
        xmllint.xml
 
@@ -69,9 +66,6 @@ DOCBOOK_HTML = http://docbook.sourceforge.net/release/xsl/current/html/docbook.x
 
 rebuild:
        cd $(srcdir) && ./apibuild.py
-       cd $(srcdir) && $(XSLTPROC) checkapisym.xsl libxml2-api.xml
-       cd $(srcdir) && $(XSLTPROC) -o ../libxml2.syms syms.xsl symbols.xml
-       cd $(srcdir) && $(XSLTPROC) -o ../win32/libxml2.def.src ../win32/defgen.xsl libxml2-api.xml
        cd $(srcdir) && $(XSLTPROC) --nonet xmllint.xml
        cd $(srcdir) && $(XSLTPROC) --nonet -o xmllint.html $(DOCBOOK_HTML) xmllint.xml
        cd $(srcdir) && $(XSLTPROC) --nonet xmlcatalog.xml
index f46e106..faa297c 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # This is the API builder, it parses the C sources and build the
 # API formal description in XML.
@@ -23,15 +23,12 @@ ignored_files = {
   "trio.c": "too many non standard macros",
   "trionan.c": "too many non standard macros",
   "triostr.c": "too many non standard macros",
-  "acconfig.h": "generated portability layer",
   "config.h": "generated portability layer",
   "libxml.h": "internal only",
   "testOOM.c": "out of memory tester",
   "testOOMlib.h": "out of memory tester",
   "testOOMlib.c": "out of memory tester",
   "rngparser.c": "not yet integrated",
-  "rngparser.h": "not yet integrated",
-  "testAutomata.c": "test tool",
   "testModule.c": "test tool",
   "testThreads.c": "test tool",
   "testapi.c": "generated regression tests",
@@ -41,10 +38,6 @@ ignored_files = {
   "test.c": "not part of the library",
   "testdso.c": "test for dynamid shared libraries",
   "testrecurse.c": "test for entities recursions",
-  "xzlib.h": "Internal API only 2.8.0",
-  "buf.h": "Internal API only 2.9.0",
-  "enc.h": "Internal API only 2.9.0",
-  "/save.h": "Internal API only 2.9.0",
   "timsort.h": "Internal header only for xpath.c 2.9.0",
 }
 
@@ -57,9 +50,7 @@ ignored_words = {
   "XMLPUBFUN": (0, "Special macro for extern funcs for win32"),
   "XSLTPUBFUN": (0, "Special macro for extern funcs for win32"),
   "EXSLTPUBFUN": (0, "Special macro for extern funcs for win32"),
-  "XMLCALL": (0, "Special macro for win32 calls"),
   "XSLTCALL": (0, "Special macro for win32 calls"),
-  "XMLCDECL": (0, "Special macro for win32 calls"),
   "EXSLTCALL": (0, "Special macro for win32 calls"),
   "__declspec": (3, "Windows keyword"),
   "__stdcall": (0, "Windows keyword"),
@@ -192,10 +183,10 @@ class index:
         if name[0:2] == '__':
             return None
         d = None
-        try:
+        if name in self.identifiers:
            d = self.identifiers[name]
-           d.update(header, module, type, lineno, info, extra, conditionals)
-        except:
+           d.update(header, module, type, info, extra, conditionals)
+        else:
            d = identifier(name, header, module, type, lineno, info, extra, conditionals)
            self.identifiers[name] = d
 
@@ -214,10 +205,10 @@ class index:
         if name[0:2] == '__':
             return None
         d = None
-        try:
+        if name in self.identifiers:
            d = self.identifiers[name]
-           d.update(header, module, type, lineno, info, extra, conditionals)
-        except:
+           d.update(header, module, type, info, extra, conditionals)
+        else:
            d = identifier(name, header, module, type, lineno, info, extra, conditionals)
            self.identifiers[name] = d
 
@@ -330,7 +321,19 @@ class index:
          #     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.variables.keys()):
+            if id in self.variables:
+                # check that variable condition agrees with header
+                # TODO: produces many false positives
+                #if idx.variables[id].conditionals != \
+                #   self.variables[id].conditionals:
+                #    print("Header condition differs from Variable for %s:" \
+                #       % id)
+                #    print("  H: %s" % self.variables[id].conditionals)
+                #    print("  C: %s" % idx.variables[id].conditionals)
+                up = idx.variables[id]
+                self.variables[id].update(None, up.module, up.type, up.info, up.extra)
 
     def analyze_dict(self, type, dict):
         count = 0
@@ -577,23 +580,25 @@ class CParser:
         self.last_comment = ""
         self.comment = None
         self.collect_ref = 0
-        self.no_error = 0
+        self.doc_disable = 0
         self.conditionals = []
         self.defines = []
 
     def collect_references(self):
         self.collect_ref = 1
 
-    def stop_error(self):
-        self.no_error = 1
+    def disable(self):
+        self.doc_disable = 1
 
-    def start_error(self):
-        self.no_error = 0
+    def enable(self):
+        self.doc_disable = 0
 
     def lineno(self):
         return self.lexer.getlineno()
 
     def index_add(self, name, module, static, type, info=None, extra = None):
+        if self.doc_disable:
+            return
         if self.is_header == 1:
             self.index.add(name, module, module, static, type, self.lineno(),
                            info, extra, self.conditionals)
@@ -611,12 +616,12 @@ class CParser:
                                info, extra, self.conditionals)
 
     def warning(self, msg):
-        if self.no_error:
+        if self.doc_disable:
             return
         print(msg)
 
     def error(self, msg, token=-1):
-        if self.no_error:
+        if self.doc_disable:
             return
 
         print("Parse Error: " + msg)
@@ -669,17 +674,17 @@ class CParser:
         token = self.lexer.token()
 
         if self.comment.find("DOC_DISABLE") != -1:
-            self.stop_error()
+            self.disable()
 
         if self.comment.find("DOC_ENABLE") != -1:
-            self.start_error()
+            self.enable()
 
         return token
 
     #
-    # Parse a comment block associate to a typedef
+    # Parse a simple comment block for typedefs or global variables
     #
-    def parseTypeComment(self, name, quiet = 0):
+    def parseSimpleComment(self, name, quiet = False):
         if name[0:2] == '__':
             quiet = 1
 
@@ -688,20 +693,20 @@ class CParser:
 
         if self.comment == None:
             if not quiet:
-                self.warning("Missing comment for type %s" % (name))
-            return((args, desc))
+                self.warning("Missing comment for %s" % (name))
+            return(None)
         if self.comment[0] != '*':
             if not quiet:
-                self.warning("Missing * in type comment for %s" % (name))
-            return((args, desc))
+                self.warning("Missing * in comment for %s" % (name))
+            return(None)
         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("Misformatted comment for %s" % (name))
                 self.warning("  Expecting '* %s:' got '%s'" % (name, lines[0]))
-            return((args, desc))
+            return(None)
         del lines[0]
         while len(lines) > 0 and lines[0] == '*':
             del lines[0]
@@ -718,7 +723,7 @@ class CParser:
 
         if quiet == 0:
             if desc == "":
-                self.warning("Type comment for %s lack description of the macro" % (name))
+                self.warning("Comment for %s lacks description" % (name))
 
         return(desc)
     #
@@ -935,7 +940,7 @@ class CParser:
                     name = name.split('(') [0]
                 except:
                     pass
-                info = self.parseMacroComment(name, not self.is_header)
+                info = self.parseMacroComment(name, True)
                 self.index_add(name, self.filename, not self.is_header,
                                 "macro", info)
                 return token
@@ -1068,7 +1073,7 @@ class CParser:
                         base_type = "struct " + name
                     else:
                         # TODO report missing or misformatted comments
-                        info = self.parseTypeComment(name, 1)
+                        info = self.parseSimpleComment(name, True)
                         self.index_add(name, self.filename, not self.is_header,
                                     "typedef", type, info)
                 token = self.token()
@@ -1103,7 +1108,6 @@ class CParser:
                 token = self.token()
                 token = self.parseBlock(token)
             elif token[0] == "sep" and token[1] == "}":
-                self.comment = None
                 token = self.token()
                 return token
             else:
@@ -1518,25 +1522,24 @@ class CParser:
                     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:
+                        info = self.parseSimpleComment(self.name, True)
                         self.index_add(self.name, self.filename,
-                             not self.is_header, "variable", type)
+                             not self.is_header, "variable", type, info)
+                    self.comment = None
+                    token = self.token()
                     break
                 elif token[1] == "(":
                     token = self.token()
@@ -1548,18 +1551,20 @@ class CParser:
                                 ((type, None), self.signature), 1)
                         self.index_add(self.name, self.filename, static,
                                         "function", d)
+                        self.comment = None
                         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)
+                        self.comment = None
                         token = self.token()
                         token = self.parseBlock(token);
                 elif token[1] == ',':
-                    self.comment = None
                     self.index_add(self.name, self.filename, static,
                                     "variable", type)
+                    self.comment = None
                     type = type_orig
                     token = self.token()
                     while token != None and token[0] == "sep":
@@ -1732,11 +1737,17 @@ class docBuilder:
     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" % (
+            output.write("    <variable name='%s' file='%s' type='%s'" % (
                     name, self.modulename_file(id.header), id.info))
         else:
-            output.write("    <variable name='%s' file='%s'/>\n" % (
+            output.write("    <variable name='%s' file='%s'" % (
                     name, self.modulename_file(id.header)))
+        desc = id.extra
+        if desc != None and desc != "":
+            output.write(">\n      <info>%s</info>\n" % (escape(desc)))
+            output.write("    </variable>\n")
+        else:
+            output.write("/>\n")
 
     def serialize_function(self, output, name):
         id = self.idx.functions[name]
diff --git a/doc/buildDocBookCatalog b/doc/buildDocBookCatalog
deleted file mode 100755 (executable)
index d1b8c94..0000000
+++ /dev/null
@@ -1,414 +0,0 @@
-#! /bin/bash
-
-usage()
-{
-    cat <<EOF
-Usage: $pname [OPTION]
-
-Known values for OPTION are:
-  --prefix=DIR        change the output directory for catalog files
-                      [default $DIR]
-  --show              display the output filenames and paths
-  --version=x.y.z     change the DocBook version [default $VERSION]
-  --debug             display script action information
-  --help              display this help and exit
-EOF
-}
-
-setdefault()
-{
-    echo Unable to update root catalog $ROOTCATALOG
-    ROOTCATALOG=$HOME/xmlcatalog
-    CATALOG=$HOME/dbkxmlcatalog
-    DIR=$HOME
-    CAT=xmlcatalog
-    echo Using $ROOTCATALOG as the root catalog
-    echo Remember to export XML_CATALOG_FILES=$ROOTCATALOG
-    echo
-    prefix=1
-}
-
-fixname()
-{
-#
-# ROOTCATALOG contains the full pathname for the catalog.  We will
-# split that into the directory name and the filename, then we will
-# see if the directory exists.  If it does not, we will attempt to
-# create it.
-#
-    if test $verbose = 1
-    then
-        echo Checking path $ROOTCATALOG for permissions
-    fi
-# First we split the filename and directory name
-    CAT=`basename $ROOTCATALOG`
-    DIR=`dirname $ROOTCATALOG`
-    if test "$DIR" = ""
-    then
-        echo Unable to isolate directory name from '$ROOTCATALOG' - exiting
-        exit 1
-    fi
-    CATALOG=${DIR}/docbook
-    parent=`dirname $DIR`
-    if test "$parent" == ""
-    then
-        parent=/
-    fi
-    if [ ! -d $DIR ]
-    then
-        if test $verbose = 1
-        then
-            echo Directory $DIR missing - I will try to create it
-        fi
-        if [ ! -w $parent ]
-        then
-            if test $verbose = 1
-            then
-                echo No write permission for directory $parent
-            fi
-            setdefault
-        else
-            newdir=1
-        fi
-    else
-        if [ -f $ROOTCATALOG -a ! -w $ROOTCATALOG ] ||
-          [ -e $ROOTCATALOG -a ! -f $ROOTCATALOG ] ||
-           [ ! -e $ROOTCATALOG  -a ! -w $DIR ]
-        then
-            setdefault
-        fi
-    fi
-
-}
-finddbx()
-{
-dtd421=""
-s="//OASIS//DTD DocBook XML V${VERSION}//EN"
-found=`find $1 -name docbookx.dtd -exec grep -l "$s" {} \;`
-for dtd in $found; do
-    docbookdir=`dirname $dtd`
-    echo Found DocBook XML $VERSION DTD in $docbookdir
-#
-# The original script had a check for write permission on the file
-# but I can't see why it should be necessary
-#
-    dtd421=$dtd
-    break
-done
-}
-
-#
-# Preset script control params
-show=0
-prefix=0
-newdir=0
-verbose=0
-#
-# Isolate the script name for messages
-pname=`basename $0`
-VERSION=4.1.2
-
-if test "$XML_CATALOG_FILES" != ""
-then
-    ROOTCATALOG=$XML_CATALOG_FILES
-else
-    ROOTCATALOG=/etc/xml/catalog
-fi
-
-#
-# Interpret script parameters
-while test $# -gt 0; do
-    case "$1" in
-    -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
-    *) optarg= ;;
-    esac
-
-    case "$1" in
-    -p=* | --prefix=*)
-        ROOTCATALOG=$optarg/catalog
-        prefix=1
-        ;;
-
-    -s | --show)
-        show=1
-        ;;
-
-    -v=* | --version=*)
-        VERSION=$optarg
-       ;;
-
-    -d | --debug)
-        verbose=1
-        ;;
-
-    -h | --help)
-        usage
-       exit 0
-       ;;
-
-    * )
-        echo Invalid argument "$1"
-       usage
-        exit 1
-        ;;
-    esac
-    shift
-done
-fixname
-if test $prefix != 0
-then
-    export XML_CATALOG_FILES=$ROOTCATALOG
-fi
-if test $show != 0
-then
-    echo XML Catalog is $ROOTCATALOG
-    echo Docbook Catalog is $CATALOG
-    exit 0
-fi
-if test $newdir!=0
-then
-    mkdir -p $DIR
-    chmod 755 $DIR
-fi
-
-echo Starting run
-#
-# create the catalogs root and docbook specific
-#
-if [ ! -r $ROOTCATALOG ] ; then
-   echo creating XML Catalog root $ROOTCATALOG
-   xmlcatalog --noout --create $ROOTCATALOG
-fi
-if [ ! -r $ROOTCATALOG ] ; then
-   echo Failed creating XML Catalog root $ROOTCATALOG
-   exit 1
-fi
-if [ ! -r $CATALOG ] ; then
-   echo creating DocBook XML Catalog $CATALOG
-   xmlcatalog --noout --create $CATALOG
-fi
-if [ ! -r $CATALOG ] ; then
-   echo Failed creating DocBook XML Catalog $CATALOG
-   exit 1
-fi
-
-#
-# find the prefix for DocBook DTD
-#
-finddbx /usr/share/xml
-if [ "$dtd421" = "" ] ; then
-    finddbx $HOME
-fi
-if [ "$dtd421" = "" ] ; then
-    finddbx /usr/local
-fi
-if [ "$dtd421" = "" ] ; then
-    finddbx /usr/share/sgml
-fi
-
-if [ "$dtd421" = "" ] ; then
-    echo could not locate version $VERSION of DocBook XML
-    exit 1
-fi
-
-xmlcatalog --noout --add "public" \
-    "-//OASIS//ELEMENTS DocBook XML Information Pool V${VERSION}//EN" \
-    "file://$docbookdir/dbpoolx.mod" $CATALOG
-xmlcatalog --noout --add "public" \
-    "-//OASIS//DTD DocBook XML V${VERSION}//EN" \
-    "file://$docbookdir/docbookx.dtd" $CATALOG
-xmlcatalog --noout --add "public" \
-    "-//OASIS//ENTITIES DocBook XML Character Entities V${VERSION}//EN" \
-    "file://$docbookdir/dbcentx.mod" $CATALOG
-xmlcatalog --noout --add "public" \
-    "-//OASIS//ENTITIES DocBook XML Notations V${VERSION}//EN" \
-    "file://$docbookdir/dbnotnx.mod" $CATALOG
-xmlcatalog --noout --add "public" \
-    "-//OASIS//ENTITIES DocBook XML Additional General Entities V${VERSION}//EN" \
-    "file://$docbookdir/dbgenent.mod" $CATALOG
-xmlcatalog --noout --add "public" \
-    "-//OASIS//ELEMENTS DocBook XML Document Hierarchy V${VERSION}//EN" \
-    "file://$docbookdir/dbhierx.mod" $CATALOG
-xmlcatalog --noout --add "public" \
-    "-//OASIS//DTD XML Exchange Table Model 19990315//EN" \
-    "file://$docbookdir/soextblx.dtd" $CATALOG
-xmlcatalog --noout --add "public" \
-    "-//OASIS//DTD DocBook XML CALS Table Model V${VERSION}//EN" \
-    "file://$docbookdir/calstblx.dtd" $CATALOG
-xmlcatalog --noout --add "rewriteSystem" \
-    "http://www.oasis-open.org/docbook/xml/${VERSION}" \
-    "file://$docbookdir" $CATALOG
-xmlcatalog --noout --add "rewriteURI" \
-    "http://www.oasis-open.org/docbook/xml/${VERSION}" \
-    "file://$docbookdir" $CATALOG
-
-xmlcatalog --noout --add "delegatePublic" \
-    "-//OASIS//ENTITIES DocBook XML" \
-    "file://$CATALOG" $ROOTCATALOG
-xmlcatalog --noout --add "delegatePublic" \
-    "-//OASIS//DTD DocBook XML" \
-    "file://$CATALOG" $ROOTCATALOG
-xmlcatalog --noout --add "delegateSystem" \
-    "http://www.oasis-open.org/docbook/" \
-    "file://$CATALOG" $ROOTCATALOG
-xmlcatalog --noout --add "delegateURI" \
-    "http://www.oasis-open.org/docbook/" \
-    "file://$CATALOG" $ROOTCATALOG
-
-#
-# find the prefix for ISO DocBook entities
-#
-top=`dirname $docbookdir`
-found=`find $top -name iso-amsb.ent`
-if [ "$found" = "" ] ; then
-    found=`find /usr/share/xml -name iso-amsb.ent`
-fi
-if [ "$found" = "" ] ; then
-    found=`find $HOME -name iso-amsb.ent`
-fi
-if [ "$found" = "" ] ; then
-    found=`find /usr/local -name iso-amsb.ent`
-fi
-if [ "$found" = "" ] ; then
-    found=`find /usr/share/sgml -name iso-amsb.ent`
-fi
-if [ "$found" = "" ] ; then
-    echo could not locate iso-amsb.ent of ISO DocBook entities
-    exit 1
-fi
-
-entxml=""
-for tst in $found; do
-    check=`grep '<!ENTITY ominus."\&#x2296;">' $tst`
-    if [ "$check" != "" ] ; then
-        entxml=$tst
-        break
-    fi
-done
-
-if [ "$entxml" = "" ] ; then
-    echo could not locate ISO DocBook entities
-    exit 1
-fi
-isodir=`dirname $entxml`
-echo Found ISO DocBook entities in $isodir
-
-xmlcatalog --noout --add "public" \
-    "ISO 8879:1986//ENTITIES Publishing//EN" \
-    "file://$isodir/iso-pub.ent" $CATALOG
-xmlcatalog --noout --add "public" \
-    "ISO 8879:1986//ENTITIES Greek Letters//EN" \
-    "file://$isodir/iso-grk1.ent" $CATALOG
-xmlcatalog --noout --add "public" \
-    "ISO 8879:1986//ENTITIES Box and Line Drawing//EN" \
-    "file://$isodir/iso-box.ent" $CATALOG
-xmlcatalog --noout --add "public" \
-    "ISO 8879:1986//ENTITIES Greek Symbols//EN" \
-    "file://$isodir/iso-grk3.ent" $CATALOG
-xmlcatalog --noout --add "public" \
-    "ISO 8879:1986//ENTITIES Added Math Symbols: Negated Relations//EN" \
-    "file://$isodir/iso-amsn.ent" $CATALOG
-xmlcatalog --noout --add "public" \
-    "ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN" \
-    "file://$isodir/iso-num.ent" $CATALOG
-xmlcatalog --noout --add "public" \
-    "ISO 8879:1986//ENTITIES Alternative Greek Symbols//EN" \
-    "file://$isodir/iso-grk4.ent" $CATALOG
-xmlcatalog --noout --add "public" \
-    "ISO 8879:1986//ENTITIES Diacritical Marks//EN" \
-    "file://$isodir/iso-dia.ent" $CATALOG
-xmlcatalog --noout --add "public" \
-    "ISO 8879:1986//ENTITIES Monotoniko Greek//EN" \
-    "file://$isodir/iso-grk2.ent" $CATALOG
-xmlcatalog --noout --add "public" \
-    "ISO 8879:1986//ENTITIES Added Math Symbols: Arrow Relations//EN" \
-    "file://$isodir/iso-amsa.ent" $CATALOG
-xmlcatalog --noout --add "public" \
-    "ISO 8879:1986//ENTITIES Added Math Symbols: Ordinary//EN" \
-    "file://$isodir/iso-amso.ent" $CATALOG
-xmlcatalog --noout --add "public" \
-    "ISO 8879:1986//ENTITIES Russian Cyrillic//EN" \
-    "file://$isodir/iso-cyr1.ent" $CATALOG
-xmlcatalog --noout --add "public" \
-    "ISO 8879:1986//ENTITIES General Technical//EN" \
-    "file://$isodir/iso-tech.ent" $CATALOG
-xmlcatalog --noout --add "public" \
-    "ISO 8879:1986//ENTITIES Added Math Symbols: Delimiters//EN" \
-    "file://$isodir/iso-amsc.ent" $CATALOG
-xmlcatalog --noout --add "public" \
-    "ISO 8879:1986//ENTITIES Added Latin 1//EN" \
-    "file://$isodir/iso-lat1.ent" $CATALOG
-xmlcatalog --noout --add "public" \
-    "ISO 8879:1986//ENTITIES Added Math Symbols: Binary Operators//EN" \
-    "file://$isodir/iso-amsb.ent" $CATALOG
-xmlcatalog --noout --add "public" \
-    "ISO 8879:1986//ENTITIES Added Latin 2//EN" \
-    "file://$isodir/iso-lat2.ent" $CATALOG
-xmlcatalog --noout --add "public" \
-    "ISO 8879:1986//ENTITIES Added Math Symbols: Relations//EN" \
-    "file://$isodir/iso-amsr.ent" $CATALOG
-xmlcatalog --noout --add "public" \
-    "ISO 8879:1986//ENTITIES Non-Russian Cyrillic//EN" \
-    "file://$isodir/iso-cyr2.ent" $CATALOG
-
-xmlcatalog --noout --add "delegatePublic" \
-    "ISO 8879:1986" \
-    "file://$CATALOG" $ROOTCATALOG
-
-#
-# find the prefix for XSLT stylesheets
-#
-top=`dirname $docbookdir`
-found=`find $top -name chunk.xsl`
-if [ "$found" = "" ] ; then
-    found=`find /usr/share/xml -name chunk.xsl`
-fi
-if [ "$found" = "" ] ; then
-    found=`find $HOME -name chunk.xsl`
-fi
-if [ "$found" = "" ] ; then
-    found=`find /usr/local -name chunk.xsl`
-fi
-if [ "$found" = "" ] ; then
-    found=`find /usr/share/sgml -name chunk.xsl`
-fi
-if [ "$found" = "" ] ; then
-    echo could not locate chunk-common.xsl of DocBook XSLT stylesheets
-    exit 1
-fi
-
-xsldir=""
-for tst in $found; do
-    dir=`dirname $tst`
-    dir=`dirname $dir`
-    if [ -r $dir/html/docbook.xsl -a -r $dir/common/l10n.xml ]; then
-        xsldir=$dir
-        break
-    fi
-done
-
-if [ "$xsldir" = "" ] ; then
-    echo could not locate DocBook XSLT stylesheets
-    exit 1
-fi
-echo Found DocBook XSLT stylesheets in $xsldir
-for version in current 1.39 1.40 1.41 1.42 1.43 1.44 1.45 1.46 1.47 \
-               1.48 1.49 1.50
-do
-    xmlcatalog --noout --add "rewriteSystem" \
-       "http://docbook.sourceforge.net/release/xsl/$version" \
-       "file://$xsldir" $CATALOG
-    xmlcatalog --noout --add "rewriteURI" \
-       "http://docbook.sourceforge.net/release/xsl/$version" \
-       "file://$xsldir" $CATALOG
-done
-
-xmlcatalog --noout --add "delegateSystem" \
-    "http://docbook.sourceforge.net/release/xsl/" \
-    "file://$CATALOG" $ROOTCATALOG
-xmlcatalog --noout --add "delegateURI" \
-    "http://docbook.sourceforge.net/release/xsl/" \
-    "file://$CATALOG" $ROOTCATALOG
-
-#
-#
diff --git a/doc/checkapisym.xsl b/doc/checkapisym.xsl
deleted file mode 100644 (file)
index 8591393..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0"?>
-<!-- This stylesheet is used to check that symbols exported
-     from libxml2-api.xml are also present in the symbol file
-     symbols.xml which is used to generate libxml2.syms setting
-     up the allowed access point to the shared libraries -->
-
-
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                version="1.0">
-  <xsl:output method="text" encoding="UTF-8"/>
-
-  <xsl:variable name="syms" select="document('symbols.xml')"/>
-
-  <xsl:template match="/">
-    <xsl:message terminate="no">
-      <xsl:text>Looking for functions in symbols.xml</xsl:text>
-    </xsl:message>
-    <xsl:apply-templates select="/api/symbols/function"/>
-    <xsl:message terminate="no">
-      <xsl:text>Found </xsl:text>
-      <xsl:value-of select="count(/api/symbols/function)"/>
-      <xsl:text> functions</xsl:text>
-    </xsl:message>
-    <xsl:message terminate="no">
-      <xsl:text>Looking for variables in symbols.xml</xsl:text>
-    </xsl:message>
-    <xsl:apply-templates select="/api/symbols/variable"/>
-    <xsl:message terminate="no">
-      <xsl:text>Found </xsl:text>
-      <xsl:value-of select="count(/api/symbols/variable)"/>
-      <xsl:text> variables</xsl:text>
-    </xsl:message>
-  </xsl:template>
-
-  <xsl:template match="function|variable">
-    <xsl:variable name="name" select="@name"/>
-    <xsl:variable name="symbol"
-        select="$syms/symbols/release/symbol[. = $name]"/>
-    <xsl:if test="string($symbol) != $name">
-      <xsl:message terminate="yes">
-        <xsl:text>Failed to find export in symbols.xml: </xsl:text>
-        <xsl:value-of select="$name"/>
-      </xsl:message>
-    </xsl:if>
-  </xsl:template>
-
-</xsl:stylesheet>
-
index b658f67..3fce938 100644 (file)
       <xsl:when test="$ref">
         <a href="libxml2-{$ref/@file}.html#{$ref/@name}"><xsl:value-of select="$token"/></a>
       </xsl:when>
+      <!-- TODO: This hack only works for tokens followed by a period. -->
+      <xsl:when test="substring($token, string-length($token)) = '.'">
+        <xsl:variable name="token2" select="substring($token, 1, string-length($token) - 1)"/>
+        <xsl:variable name="ref2" select="key('symbols', $token2)"/>
+        <xsl:choose>
+          <xsl:when test="$ref2">
+            <a href="libxml2-{$ref2/@file}.html#{$ref2/@name}"><xsl:value-of select="$token2"/></a>
+            <xsl:text>.</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$token"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
       <xsl:otherwise>
         <xsl:value-of select="$token"/>
       </xsl:otherwise>
index 12362b4..a25e40b 100644 (file)
@@ -42,6 +42,7 @@ typedef enum <a href="#htmlStatus">htmlStatus</a>;
 int    <a href="#UTF8ToHtml">UTF8ToHtml</a>                    (unsigned char * out, <br>                                       int * outlen, <br>                                      const unsigned char * in, <br>                                  int * inlen);
 <a href="libxml2-HTMLparser.html#htmlStatus">htmlStatus</a>    <a href="#htmlAttrAllowed">htmlAttrAllowed</a>          (const <a href="libxml2-HTMLparser.html#htmlElemDesc">htmlElemDesc</a> * elt, <br>                                       const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * attr, <br>                                         int legacy);
 int    <a href="#htmlAutoCloseTag">htmlAutoCloseTag</a>                (<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> doc, <br>                                   const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br>                                         <a href="libxml2-HTMLparser.html#htmlNodePtr">htmlNodePtr</a> elem);
+<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a>      <a href="#htmlCreateFileParserCtxt">htmlCreateFileParserCtxt</a>        (const char * filename, <br>                                                     const char * encoding);
 <a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a>      <a href="#htmlCreateMemoryParserCtxt">htmlCreateMemoryParserCtxt</a>    (const char * buffer, <br>                                                       int size);
 <a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a>      <a href="#htmlCreatePushParserCtxt">htmlCreatePushParserCtxt</a>        (<a href="libxml2-HTMLparser.html#htmlSAXHandlerPtr">htmlSAXHandlerPtr</a> sax, <br>                                                     void * user_data, <br>                                                  const char * chunk, <br>                                                        int size, <br>                                                  const char * filename, <br>                                                     <a href="libxml2-encoding.html#xmlCharEncoding">xmlCharEncoding</a> enc);
 <a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a>    <a href="#htmlCtxtReadDoc">htmlCtxtReadDoc</a>          (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt, <br>                                    const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * cur, <br>                                  const char * URL, <br>                                  const char * encoding, <br>                                     int options);
@@ -58,9 +59,11 @@ const <a href="libxml2-HTMLparser.html#htmlEntityDesc">htmlEntityDesc</a> *  <a h
 const <a href="libxml2-HTMLparser.html#htmlEntityDesc">htmlEntityDesc</a> *    <a href="#htmlEntityValueLookup">htmlEntityValueLookup</a>      (unsigned int value);
 void   <a href="#htmlFreeParserCtxt">htmlFreeParserCtxt</a>            (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt);
 int    <a href="#htmlHandleOmittedElem">htmlHandleOmittedElem</a>              (int val);
+void   <a href="#htmlInitAutoClose">htmlInitAutoClose</a>              (void);
 int    <a href="#htmlIsAutoClosed">htmlIsAutoClosed</a>                (<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> doc, <br>                                   <a href="libxml2-HTMLparser.html#htmlNodePtr">htmlNodePtr</a> elem);
 int    <a href="#htmlIsScriptAttribute">htmlIsScriptAttribute</a>              (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name);
 <a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a>      <a href="#htmlNewParserCtxt">htmlNewParserCtxt</a>      (void);
+<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a>      <a href="#htmlNewSAXParserCtxt">htmlNewSAXParserCtxt</a>        (const <a href="libxml2-HTMLparser.html#htmlSAXHandler">htmlSAXHandler</a> * sax, <br>                                           void * userData);
 <a href="libxml2-HTMLparser.html#htmlStatus">htmlStatus</a>    <a href="#htmlNodeStatus">htmlNodeStatus</a>            (const <a href="libxml2-HTMLparser.html#htmlNodePtr">htmlNodePtr</a> node, <br>                                  int legacy);
 int    <a href="#htmlParseCharRef">htmlParseCharRef</a>                (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt);
 int    <a href="#htmlParseChunk">htmlParseChunk</a>                    (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt, <br>                                    const char * chunk, <br>                                        int size, <br>                                  int terminate);
@@ -385,6 +388,31 @@ const <a href="libxml2-HTMLparser.html#htmlElemDesc">htmlElemDesc</a> *    <a href=
 <hr>
 <div class="refsect2" lang="en">
 <h3>
+<a name="htmlCreateFileParserCtxt"></a>htmlCreateFileParserCtxt ()</h3>
+<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a>  htmlCreateFileParserCtxt        (const char * filename, <br>                                                     const char * encoding)<br>
+</pre>
+<p>Create a parser context for a file content. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time.</p>
+<div class="variablelist"><table border="0">
+<col align="left">
+<tbody>
+<tr>
+<td><span class="term"><i><tt>filename</tt></i>:</span></td>
+<td>the filename</td>
+</tr>
+<tr>
+<td><span class="term"><i><tt>encoding</tt></i>:</span></td>
+<td>a free form C string describing the HTML document encoding, or NULL</td>
+</tr>
+<tr>
+<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
+<td>the new parser context or NULL</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<h3>
 <a name="htmlCreateMemoryParserCtxt"></a>htmlCreateMemoryParserCtxt ()</h3>
 <pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a>  htmlCreateMemoryParserCtxt      (const char * buffer, <br>                                                       int size)<br>
 </pre>
@@ -850,6 +878,14 @@ const <a href="libxml2-HTMLparser.html#htmlElemDesc">htmlElemDesc</a> *    <a href=
 <hr>
 <div class="refsect2" lang="en">
 <h3>
+<a name="htmlInitAutoClose"></a>htmlInitAutoClose ()</h3>
+<pre class="programlisting">void       htmlInitAutoClose               (void)<br>
+</pre>
+<p>DEPRECATED: This is a no-op.</p>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<h3>
 <a name="htmlIsAutoClosed"></a>htmlIsAutoClosed ()</h3>
 <pre class="programlisting">int        htmlIsAutoClosed                (<a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a> doc, <br>                                   <a href="libxml2-HTMLparser.html#htmlNodePtr">htmlNodePtr</a> elem)<br>
 </pre>
@@ -911,6 +947,31 @@ const <a href="libxml2-HTMLparser.html#htmlElemDesc">htmlElemDesc</a> *    <a href=
 <hr>
 <div class="refsect2" lang="en">
 <h3>
+<a name="htmlNewSAXParserCtxt"></a>htmlNewSAXParserCtxt ()</h3>
+<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a>  htmlNewSAXParserCtxt    (const <a href="libxml2-HTMLparser.html#htmlSAXHandler">htmlSAXHandler</a> * sax, <br>                                           void * userData)<br>
+</pre>
+<p>Allocate and initialize a new SAX parser context. If userData is NULL, the parser context will be passed as user data.</p>
+<div class="variablelist"><table border="0">
+<col align="left">
+<tbody>
+<tr>
+<td><span class="term"><i><tt>sax</tt></i>:</span></td>
+<td>SAX handler</td>
+</tr>
+<tr>
+<td><span class="term"><i><tt>userData</tt></i>:</span></td>
+<td>user data</td>
+</tr>
+<tr>
+<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
+<td>the <a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> or NULL in case of allocation error</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<h3>
 <a name="htmlNodeStatus"></a>htmlNodeStatus ()</h3>
 <pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlStatus">htmlStatus</a>        htmlNodeStatus          (const <a href="libxml2-HTMLparser.html#htmlNodePtr">htmlNodePtr</a> node, <br>                                  int legacy)<br>
 </pre>
@@ -939,7 +1000,7 @@ const <a href="libxml2-HTMLparser.html#htmlElemDesc">htmlElemDesc</a> *    <a href=
 <a name="htmlParseCharRef"></a>htmlParseCharRef ()</h3>
 <pre class="programlisting">int        htmlParseCharRef                (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse Reference declarations [66] CharRef ::= '&amp;#' [0-9]+ ';' | '&amp;#x' [0-9a-fA-F]+ ';'</p>
+<p>DEPRECATED: Internal function, don't use. parse Reference declarations [66] CharRef ::= '&amp;#' [0-9]+ ';' | '&amp;#x' [0-9a-fA-F]+ ';'</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1040,7 +1101,7 @@ const <a href="libxml2-HTMLparser.html#htmlElemDesc">htmlElemDesc</a> *   <a href=
 <a name="htmlParseElement"></a>htmlParseElement ()</h3>
 <pre class="programlisting">void       htmlParseElement                (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse an HTML element, this is highly recursive this is kept for compatibility with previous code versions [39] element ::= EmptyElemTag | STag content ETag [41] Attribute ::= Name Eq AttValue</p>
+<p>DEPRECATED: Internal function, don't use. parse an HTML element, this is highly recursive this is kept for compatibility with previous code versions [39] element ::= EmptyElemTag | STag content ETag [41] Attribute ::= Name Eq AttValue</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
@@ -1055,7 +1116,7 @@ const <a href="libxml2-HTMLparser.html#htmlElemDesc">htmlElemDesc</a> *   <a href=
 <a name="htmlParseEntityRef"></a>htmlParseEntityRef ()</h3>
 <pre class="programlisting">const <a href="libxml2-HTMLparser.html#htmlEntityDesc">htmlEntityDesc</a> *        htmlParseEntityRef      (<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a> ctxt, <br>                                            const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** str)<br>
 </pre>
-<p>parse an HTML ENTITY references [68] EntityRef ::= '&amp;' Name ';'</p>
+<p>DEPRECATED: Internal function, don't use. parse an HTML ENTITY references [68] EntityRef ::= '&amp;' Name ';'</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1278,7 +1339,7 @@ const <a href="libxml2-HTMLparser.html#htmlElemDesc">htmlElemDesc</a> *   <a href=
 <a name="htmlSAXParseDoc"></a>htmlSAXParseDoc ()</h3>
 <pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a>        htmlSAXParseDoc         (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * cur, <br>                                  const char * encoding, <br>                                     <a href="libxml2-HTMLparser.html#htmlSAXHandlerPtr">htmlSAXHandlerPtr</a> sax, <br>                                     void * userData)<br>
 </pre>
-<p>Parse an HTML in-memory document. If sax is not NULL, use the SAX callbacks to handle parse events. If sax is NULL, fallback to the default DOM behavior and return a tree.</p>
+<p>DEPRECATED: Use <a href="libxml2-HTMLparser.html#htmlNewSAXParserCtxt">htmlNewSAXParserCtxt</a> and <a href="libxml2-HTMLparser.html#htmlCtxtReadDoc">htmlCtxtReadDoc</a>. Parse an HTML in-memory document. If sax is not NULL, use the SAX callbacks to handle parse events. If sax is NULL, fallback to the default DOM behavior and return a tree.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1312,7 +1373,7 @@ const <a href="libxml2-HTMLparser.html#htmlElemDesc">htmlElemDesc</a> *   <a href=
 <a name="htmlSAXParseFile"></a>htmlSAXParseFile ()</h3>
 <pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlDocPtr">htmlDocPtr</a>        htmlSAXParseFile        (const char * filename, <br>                                     const char * encoding, <br>                                     <a href="libxml2-HTMLparser.html#htmlSAXHandlerPtr">htmlSAXHandlerPtr</a> sax, <br>                                     void * userData)<br>
 </pre>
-<p>parse an HTML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.</p>
+<p>DEPRECATED: Use <a href="libxml2-HTMLparser.html#htmlNewSAXParserCtxt">htmlNewSAXParserCtxt</a> and <a href="libxml2-HTMLparser.html#htmlCtxtReadFile">htmlCtxtReadFile</a>. parse an HTML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
index 203cb38..7e60ab6 100644 (file)
@@ -250,7 +250,7 @@ int <a href="#htmlSetMetaEncoding">htmlSetMetaEncoding</a>          (<a href="libxml2-HT
 <a name="htmlIsBooleanAttr"></a>htmlIsBooleanAttr ()</h3>
 <pre class="programlisting">int        htmlIsBooleanAttr               (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name)<br>
 </pre>
-<p>Determine if a given <a href="libxml2-SAX.html#attribute">attribute</a> is a boolean attribute.</p>
+<p>Determine if a given <a href="libxml2-SAX.html#attribute">attribute</a> is a boolean <a href="libxml2-SAX.html#attribute">attribute</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
index 170423c..b0bb2c7 100644 (file)
@@ -69,7 +69,7 @@ int   <a href="#xmlSAXVersion">xmlSAXVersion</a>                      (<a href="libxml2-tree.html#xml
 <a name="htmlDefaultSAXHandlerInit"></a>htmlDefaultSAXHandlerInit ()</h3>
 <pre class="programlisting">void       htmlDefaultSAXHandlerInit       (void)<br>
 </pre>
-<p>DEPRECATED: This function will be made private. Call <a href="libxml2-parser.html#xmlInitParser">xmlInitParser</a> to initialize the library. Initialize the default SAX handler</p>
+<p>DEPRECATED: This function is a no-op. Call <a href="libxml2-parser.html#xmlInitParser">xmlInitParser</a> to initialize the library.</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -77,7 +77,7 @@ int   <a href="#xmlSAXVersion">xmlSAXVersion</a>                      (<a href="libxml2-tree.html#xml
 <a name="xmlDefaultSAXHandlerInit"></a>xmlDefaultSAXHandlerInit ()</h3>
 <pre class="programlisting">void       xmlDefaultSAXHandlerInit        (void)<br>
 </pre>
-<p>DEPRECATED: This function will be made private. Call <a href="libxml2-parser.html#xmlInitParser">xmlInitParser</a> to initialize the library. Initialize the default SAX2 handler</p>
+<p>DEPRECATED: This function is a no-op. Call <a href="libxml2-parser.html#xmlInitParser">xmlInitParser</a> to initialize the library. Initialize the default SAX2 handler</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -893,7 +893,7 @@ int <a href="#xmlSAXVersion">xmlSAXVersion</a>                      (<a href="libxml2-tree.html#xml
 <a name="xmlSAXDefaultVersion"></a>xmlSAXDefaultVersion ()</h3>
 <pre class="programlisting">int        xmlSAXDefaultVersion            (int version)<br>
 </pre>
-<p>Set the default version of SAX used globally by the library. By default, during initialization the default is set to 2. Note that it is generally a better coding style to use xmlSAXVersion() to set up the version explicitly for a given parsing context.</p>
+<p>DEPRECATED: Use parser option <a href="libxml2-parser.html#XML_PARSE_SAX1">XML_PARSE_SAX1</a>. Set the default version of SAX used globally by the library. By default, during initialization the default is set to 2. Note that it is generally a better coding style to use xmlSAXVersion() to set up the version explicitly for a given parsing context.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
index 5a2c883..08e914d 100644 (file)
@@ -66,7 +66,7 @@ The content of this structure is not made public by the API.
 <a name="xmlDictCleanup"></a>xmlDictCleanup ()</h3>
 <pre class="programlisting">void       xmlDictCleanup                  (void)<br>
 </pre>
-<p>DEPRECATED: This function will be made private. Call <a href="libxml2-parser.html#xmlCleanupParser">xmlCleanupParser</a> to free global state but see the warnings there. <a href="libxml2-parser.html#xmlCleanupParser">xmlCleanupParser</a> should be only called once at program exit. In most cases, you don't have call cleanup functions at all. Free the dictionary mutex. Do not call unless sure the library is not in use anymore !</p>
+<p>DEPRECATED: This function is a no-op. Call <a href="libxml2-parser.html#xmlCleanupParser">xmlCleanupParser</a> to free global state but see the warnings there. <a href="libxml2-parser.html#xmlCleanupParser">xmlCleanupParser</a> should be only called once at program exit. In most cases, you don't have call cleanup functions at all.</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -325,12 +325,12 @@ The content of this structure is not made public by the API.
 <a name="xmlInitializeDict"></a>xmlInitializeDict ()</h3>
 <pre class="programlisting">int        xmlInitializeDict               (void)<br>
 </pre>
-<p>DEPRECATED: This function will be made private. Call <a href="libxml2-parser.html#xmlInitParser">xmlInitParser</a> to initialize the library. Do the dictionary mutex initialization.</p>
+<p>DEPRECATED: Alias for <a href="libxml2-parser.html#xmlInitParser">xmlInitParser</a>.</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>
+<td></td>
 </tr></tbody>
 </table></div>
 </div>
index 94d7057..2eb52b3 100644 (file)
@@ -292,7 +292,7 @@ void        <a href="#xmlRegisterCharEncodingHandler">xmlRegisterCharEncodingHandler</a
 <a name="xmlCharEncFirstLine"></a>xmlCharEncFirstLine ()</h3>
 <pre class="programlisting">int        xmlCharEncFirstLine             (<a href="libxml2-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a> * handler, <br>                                       <a href="libxml2-tree.html#xmlBufferPtr">xmlBufferPtr</a> out, <br>                                     <a href="libxml2-tree.html#xmlBufferPtr">xmlBufferPtr</a> in)<br>
 </pre>
-<p>Front-end for the encoding handler input function, but handle only the very first line, i.e. limit itself to 45 chars.</p>
+<p>DEPERECATED: Don't use.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -310,7 +310,7 @@ void        <a href="#xmlRegisterCharEncodingHandler">xmlRegisterCharEncodingHandler</a
 </tr>
 <tr>
 <td><span class="term"><i><tt>Returns</tt></i>:</span></td>
-<td>the number of byte written if success, or -1 general error -2 if the transcoding fails (for *in is not valid utf8 string or the result of transformation can't fit into the encoding we want), or</td>
+<td></td>
 </tr>
 </tbody>
 </table></div>
@@ -441,7 +441,7 @@ void        <a href="#xmlRegisterCharEncodingHandler">xmlRegisterCharEncodingHandler</a
 <a name="xmlFindCharEncodingHandler"></a>xmlFindCharEncodingHandler ()</h3>
 <pre class="programlisting"><a href="libxml2-encoding.html#xmlCharEncodingHandlerPtr">xmlCharEncodingHandlerPtr</a>    xmlFindCharEncodingHandler      (const char * name)<br>
 </pre>
-<p>Search in the registered set the handler able to read/write that encoding.</p>
+<p>Search in the registered set the handler able to read/write that encoding or create a new one.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -525,7 +525,7 @@ void        <a href="#xmlRegisterCharEncodingHandler">xmlRegisterCharEncodingHandler</a
 <a name="xmlInitCharEncodingHandlers"></a>xmlInitCharEncodingHandlers ()</h3>
 <pre class="programlisting">void       xmlInitCharEncodingHandlers     (void)<br>
 </pre>
-<p>DEPRECATED: This function will be made private. Call <a href="libxml2-parser.html#xmlInitParser">xmlInitParser</a> to initialize the library. Initialize the char encoding support, it registers the default encoding supported. NOTE: while public, this function usually doesn't need to be called in normal processing.</p>
+<p>DEPRECATED: Alias for <a href="libxml2-parser.html#xmlInitParser">xmlInitParser</a>.</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -533,7 +533,7 @@ void        <a href="#xmlRegisterCharEncodingHandler">xmlRegisterCharEncodingHandler</a
 <a name="xmlNewCharEncodingHandler"></a>xmlNewCharEncodingHandler ()</h3>
 <pre class="programlisting"><a href="libxml2-encoding.html#xmlCharEncodingHandlerPtr">xmlCharEncodingHandlerPtr</a>    xmlNewCharEncodingHandler       (const char * name, <br>                                                         <a href="libxml2-encoding.html#xmlCharEncodingInputFunc">xmlCharEncodingInputFunc</a> input, <br>                                                       <a href="libxml2-encoding.html#xmlCharEncodingOutputFunc">xmlCharEncodingOutputFunc</a> output)<br>
 </pre>
-<p>Create and registers an xmlCharEncodingHandler.</p>
+<p>Create and registers an <a href="libxml2-encoding.html#xmlCharEncodingHandler">xmlCharEncodingHandler</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
index d3b24a6..0c1eb57 100644 (file)
@@ -199,7 +199,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="htmlDefaultSAXHandler">Variable </a>htmlDefaultSAXHandler</h3>
 <pre class="programlisting"><a href="libxml2-parser.html#xmlSAXHandlerV1">xmlSAXHandlerV1</a> htmlDefaultSAXHandler;
 </pre>
-<p></p>
+<p>DEPRECATED: This handler is unused and will be removed from future versions. Default old SAX v1 handler for HTML, builds the DOM tree</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -207,7 +207,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="oldXMLWDcompatibility">Variable </a>oldXMLWDcompatibility</h3>
 <pre class="programlisting">int oldXMLWDcompatibility;
 </pre>
-<p></p>
+<p>Global setting, DEPRECATED.</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -215,7 +215,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlBufferAllocScheme">Variable </a>xmlBufferAllocScheme</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlBufferAllocationScheme">xmlBufferAllocationScheme</a> xmlBufferAllocScheme;
 </pre>
-<p></p>
+<p>DEPRECATED: Don't use. Global setting, default allocation policy for buffers, default is <a href="libxml2-tree.html#XML_BUFFER_ALLOC_EXACT">XML_BUFFER_ALLOC_EXACT</a></p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -223,7 +223,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlDefaultBufferSize">Variable </a>xmlDefaultBufferSize</h3>
 <pre class="programlisting">int xmlDefaultBufferSize;
 </pre>
-<p></p>
+<p>DEPRECATED: Don't use. Global setting, default buffer size. Default value is <a href="libxml2-tree.html#BASE_BUFFER_SIZE">BASE_BUFFER_SIZE</a></p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -231,7 +231,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlDefaultSAXHandler">Variable </a>xmlDefaultSAXHandler</h3>
 <pre class="programlisting"><a href="libxml2-parser.html#xmlSAXHandlerV1">xmlSAXHandlerV1</a> xmlDefaultSAXHandler;
 </pre>
-<p></p>
+<p>DEPRECATED: This handler is unused and will be removed from future versions. Default SAX version1 handler for XML, builds the DOM tree</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -239,7 +239,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlDefaultSAXLocator">Variable </a>xmlDefaultSAXLocator</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlSAXLocator">xmlSAXLocator</a> xmlDefaultSAXLocator;
 </pre>
-<p></p>
+<p>DEPRECATED: Don't use The default SAX Locator { getPublicId, getSystemId, getLineNumber, getColumnNumber}</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -247,7 +247,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlDeregisterNodeDefaultValue">Variable </a>xmlDeregisterNodeDefaultValue</h3>
 <pre class="programlisting"><a href="libxml2-globals.html#xmlDeregisterNodeFunc">xmlDeregisterNodeFunc</a> xmlDeregisterNodeDefaultValue;
 </pre>
-<p></p>
+<p>DEPRECATED: Don't use</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -255,7 +255,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlDoValidityCheckingDefaultValue">Variable </a>xmlDoValidityCheckingDefaultValue</h3>
 <pre class="programlisting">int xmlDoValidityCheckingDefaultValue;
 </pre>
-<p></p>
+<p>DEPRECATED: Use the modern options API with <a href="libxml2-parser.html#XML_PARSE_DTDVALID">XML_PARSE_DTDVALID</a>. Global setting, indicate that the parser should work in validating mode. Disabled by default.</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -263,7 +263,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlFree">Variable </a>xmlFree</h3>
 <pre class="programlisting"><a href="libxml2-xmlmemory.html#xmlFreeFunc">xmlFreeFunc</a> xmlFree;
 </pre>
-<p></p>
+<p>@mem: an already allocated block of memory The variable holding the libxml free() implementation</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -271,7 +271,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlGenericError">Variable </a>xmlGenericError</h3>
 <pre class="programlisting"><a href="libxml2-xmlerror.html#xmlGenericErrorFunc">xmlGenericErrorFunc</a> xmlGenericError;
 </pre>
-<p></p>
+<p>Global setting: function used for generic error callbacks</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -279,7 +279,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlGenericErrorContext">Variable </a>xmlGenericErrorContext</h3>
 <pre class="programlisting">void * xmlGenericErrorContext;
 </pre>
-<p></p>
+<p>Global setting passed to generic error callbacks</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -287,7 +287,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlGetWarningsDefaultValue">Variable </a>xmlGetWarningsDefaultValue</h3>
 <pre class="programlisting">int xmlGetWarningsDefaultValue;
 </pre>
-<p></p>
+<p>DEPRECATED: Don't use Global setting, indicate that the DTD validation should provide warnings. Activated by default.</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -295,7 +295,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlIndentTreeOutput">Variable </a>xmlIndentTreeOutput</h3>
 <pre class="programlisting">int xmlIndentTreeOutput;
 </pre>
-<p></p>
+<p>Global setting, asking the serializer to indent the output tree by default Enabled by default</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -303,7 +303,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlKeepBlanksDefaultValue">Variable </a>xmlKeepBlanksDefaultValue</h3>
 <pre class="programlisting">int xmlKeepBlanksDefaultValue;
 </pre>
-<p></p>
+<p>DEPRECATED: Use the modern options API with <a href="libxml2-parser.html#XML_PARSE_NOBLANKS">XML_PARSE_NOBLANKS</a>. Global setting, indicate that the parser should keep all blanks nodes found in the content Activated by default, this is actually needed to have the parser conformant to the XML Recommendation, however the option is kept for some applications since this was libxml1 default behaviour.</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -319,7 +319,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlLineNumbersDefaultValue">Variable </a>xmlLineNumbersDefaultValue</h3>
 <pre class="programlisting">int xmlLineNumbersDefaultValue;
 </pre>
-<p></p>
+<p>DEPRECATED: The modern options API always enables line numbers. Global setting, indicate that the parser should store the line number in the content field of elements in the DOM tree. Disabled by default since this may not be safe for old classes of application.</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -327,7 +327,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlLoadExtDtdDefaultValue">Variable </a>xmlLoadExtDtdDefaultValue</h3>
 <pre class="programlisting">int xmlLoadExtDtdDefaultValue;
 </pre>
-<p></p>
+<p>DEPRECATED: Use the modern options API with <a href="libxml2-parser.html#XML_PARSE_DTDLOAD">XML_PARSE_DTDLOAD</a>. Global setting, indicate that the parser should load DTD while not validating. Disabled by default.</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -335,7 +335,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlMalloc">Variable </a>xmlMalloc</h3>
 <pre class="programlisting"><a href="libxml2-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> xmlMalloc;
 </pre>
-<p></p>
+<p>@size: the size requested in bytes The variable holding the libxml malloc() implementation Returns a pointer to the newly allocated block or NULL in case of error</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -343,7 +343,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlMallocAtomic">Variable </a>xmlMallocAtomic</h3>
 <pre class="programlisting"><a href="libxml2-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> xmlMallocAtomic;
 </pre>
-<p></p>
+<p>@size: the size requested in bytes The variable holding the libxml malloc() implementation for atomic data (i.e. blocks not containing pointers), useful when using a garbage collecting allocator. Returns a pointer to the newly allocated block or NULL in case of error</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -351,7 +351,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlMemStrdup">Variable </a>xmlMemStrdup</h3>
 <pre class="programlisting"><a href="libxml2-xmlmemory.html#xmlStrdupFunc">xmlStrdupFunc</a> xmlMemStrdup;
 </pre>
-<p></p>
+<p>@str: a zero terminated string The variable holding the libxml strdup() implementation Returns the copy of the string or NULL in case of error</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -359,7 +359,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlOutputBufferCreateFilenameValue">Variable </a>xmlOutputBufferCreateFilenameValue</h3>
 <pre class="programlisting"><a href="libxml2-globals.html#xmlOutputBufferCreateFilenameFunc">xmlOutputBufferCreateFilenameFunc</a> xmlOutputBufferCreateFilenameValue;
 </pre>
-<p></p>
+<p>DEPRECATED: Don't use</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -367,7 +367,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlParserDebugEntities">Variable </a>xmlParserDebugEntities</h3>
 <pre class="programlisting">int xmlParserDebugEntities;
 </pre>
-<p></p>
+<p>DEPRECATED: Don't use Global setting, asking the parser to print out debugging information. while handling entities. Disabled by default</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -375,7 +375,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlParserInputBufferCreateFilenameValue">Variable </a>xmlParserInputBufferCreateFilenameValue</h3>
 <pre class="programlisting"><a href="libxml2-globals.html#xmlParserInputBufferCreateFilenameFunc">xmlParserInputBufferCreateFilenameFunc</a> xmlParserInputBufferCreateFilenameValue;
 </pre>
-<p></p>
+<p>DEPRECATED: Don't use</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -383,7 +383,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlParserVersion">Variable </a>xmlParserVersion</h3>
 <pre class="programlisting">const char * xmlParserVersion;
 </pre>
-<p></p>
+<p>Constant string describing the internal version of the library</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -391,7 +391,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlPedanticParserDefaultValue">Variable </a>xmlPedanticParserDefaultValue</h3>
 <pre class="programlisting">int xmlPedanticParserDefaultValue;
 </pre>
-<p></p>
+<p>DEPRECATED: Use the modern options API with <a href="libxml2-parser.html#XML_PARSE_PEDANTIC">XML_PARSE_PEDANTIC</a>. Global setting, indicate that the parser be pedantic Disabled by default.</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -399,7 +399,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlRealloc">Variable </a>xmlRealloc</h3>
 <pre class="programlisting"><a href="libxml2-xmlmemory.html#xmlReallocFunc">xmlReallocFunc</a> xmlRealloc;
 </pre>
-<p></p>
+<p>@mem: an already allocated block of memory @size: the new size requested in bytes The variable holding the libxml realloc() implementation Returns a pointer to the newly reallocated block or NULL in case of error</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -407,7 +407,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlRegisterNodeDefaultValue">Variable </a>xmlRegisterNodeDefaultValue</h3>
 <pre class="programlisting"><a href="libxml2-globals.html#xmlRegisterNodeFunc">xmlRegisterNodeFunc</a> xmlRegisterNodeDefaultValue;
 </pre>
-<p></p>
+<p>DEPRECATED: Don't use</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -415,7 +415,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlSaveNoEmptyTags">Variable </a>xmlSaveNoEmptyTags</h3>
 <pre class="programlisting">int xmlSaveNoEmptyTags;
 </pre>
-<p></p>
+<p>Global setting, asking the serializer to not output empty tags as &lt;empty/&gt; but &lt;empty&gt;&lt;/empty&gt;. those two forms are indistinguishable once parsed. Disabled by default</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -423,7 +423,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlStructuredError">Variable </a>xmlStructuredError</h3>
 <pre class="programlisting"><a href="libxml2-xmlerror.html#xmlStructuredErrorFunc">xmlStructuredErrorFunc</a> xmlStructuredError;
 </pre>
-<p></p>
+<p>Global setting: function used for structured error callbacks</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -431,7 +431,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlStructuredErrorContext">Variable </a>xmlStructuredErrorContext</h3>
 <pre class="programlisting">void * xmlStructuredErrorContext;
 </pre>
-<p></p>
+<p>Global setting passed to structured error callbacks</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -439,7 +439,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlSubstituteEntitiesDefaultValue">Variable </a>xmlSubstituteEntitiesDefaultValue</h3>
 <pre class="programlisting">int xmlSubstituteEntitiesDefaultValue;
 </pre>
-<p></p>
+<p>DEPRECATED: Use the modern options API with <a href="libxml2-parser.html#XML_PARSE_NOENT">XML_PARSE_NOENT</a>. Global setting, indicate that the parser should not generate entity references but replace them with the actual content of the entity Disabled by default, this should be activated when using XPath since the XPath data model requires entities replacement and the XPath engine does not handle entities references transparently.</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -447,7 +447,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlTreeIndentString">Variable </a>xmlTreeIndentString</h3>
 <pre class="programlisting">const char * xmlTreeIndentString;
 </pre>
-<p></p>
+<p>The string used to do one-level indent. By default is equal to " " (two spaces)</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -455,7 +455,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlCleanupGlobals"></a>xmlCleanupGlobals ()</h3>
 <pre class="programlisting">void       xmlCleanupGlobals               (void)<br>
 </pre>
-<p>DEPRECATED: This function will be made private. Call <a href="libxml2-parser.html#xmlCleanupParser">xmlCleanupParser</a> to free global state but see the warnings there. <a href="libxml2-parser.html#xmlCleanupParser">xmlCleanupParser</a> should be only called once at program exit. In most cases, you don't have call cleanup functions at all. Additional cleanup for multi-threading</p>
+<p>DEPRECATED: This function is a no-op. Call <a href="libxml2-parser.html#xmlCleanupParser">xmlCleanupParser</a> to free global state but see the warnings there. <a href="libxml2-parser.html#xmlCleanupParser">xmlCleanupParser</a> should be only called once at program exit. In most cases, you don't have call cleanup functions at all.</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -484,7 +484,7 @@ const char *        <a href="#xmlThrDefTreeIndentString">xmlThrDefTreeIndentString</a>
 <a name="xmlInitGlobals"></a>xmlInitGlobals ()</h3>
 <pre class="programlisting">void       xmlInitGlobals                  (void)<br>
 </pre>
-<p>DEPRECATED: This function will be made private. Call <a href="libxml2-parser.html#xmlInitParser">xmlInitParser</a> to initialize the library. Additional initialisation for multi-threading</p>
+<p>DEPRECATED: Alias for <a href="libxml2-parser.html#xmlInitParser">xmlInitParser</a>.</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
index 894c3f8..2618680 100644 (file)
@@ -326,7 +326,7 @@ The content of this structure is not made public by the API.
 <a name="xmlHashCreate"></a>xmlHashCreate ()</h3>
 <pre class="programlisting"><a href="libxml2-hash.html#xmlHashTablePtr">xmlHashTablePtr</a>    xmlHashCreate           (int size)<br>
 </pre>
-<p>Create a new xmlHashTablePtr.</p>
+<p>Create a new <a href="libxml2-hash.html#xmlHashTablePtr">xmlHashTablePtr</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -372,7 +372,7 @@ The content of this structure is not made public by the API.
 <a name="xmlHashDefaultDeallocator"></a>xmlHashDefaultDeallocator ()</h3>
 <pre class="programlisting">void       xmlHashDefaultDeallocator       (void * entry, <br>                                      const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name)<br>
 </pre>
-<p>Free a hash table entry with xmlFree.</p>
+<p>Free a hash table entry with <a href="libxml2-globals.html#xmlFree">xmlFree</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
index fbddf5a..07410f1 100644 (file)
@@ -98,6 +98,7 @@ int   <a href="#xmlLineNumbersDefault">xmlLineNumbersDefault</a>              (int val);
 <a href="libxml2-tree.html#xmlParserInputPtr">xmlParserInputPtr</a>    <a href="#xmlLoadExternalEntity">xmlLoadExternalEntity</a>      (const char * URL, <br>                                          const char * ID, <br>                                           <a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt);
 <a href="libxml2-tree.html#xmlParserInputPtr">xmlParserInputPtr</a>    <a href="#xmlNewIOInputStream">xmlNewIOInputStream</a>  (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                            <a href="libxml2-tree.html#xmlParserInputBufferPtr">xmlParserInputBufferPtr</a> input, <br>                                             <a href="libxml2-encoding.html#xmlCharEncoding">xmlCharEncoding</a> enc);
 <a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a>      <a href="#xmlNewParserCtxt">xmlNewParserCtxt</a>        (void);
+<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a>      <a href="#xmlNewSAXParserCtxt">xmlNewSAXParserCtxt</a>  (const <a href="libxml2-tree.html#xmlSAXHandler">xmlSAXHandler</a> * sax, <br>                                           void * userData);
 int    <a href="#xmlParseBalancedChunkMemory">xmlParseBalancedChunkMemory</a>  (<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br>                                   <a href="libxml2-tree.html#xmlSAXHandlerPtr">xmlSAXHandlerPtr</a> sax, <br>                                     void * user_data, <br>                                  int depth, <br>                                         const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * string, <br>                                       <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> * lst);
 int    <a href="#xmlParseBalancedChunkMemoryRecover">xmlParseBalancedChunkMemoryRecover</a>    (<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br>                                           <a href="libxml2-tree.html#xmlSAXHandlerPtr">xmlSAXHandlerPtr</a> sax, <br>                                             void * user_data, <br>                                          int depth, <br>                                                 const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * string, <br>                                               <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> * lst, <br>                                               int recover);
 int    <a href="#xmlParseChunk">xmlParseChunk</a>                      (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                    const char * chunk, <br>                                        int size, <br>                                  int terminate);
@@ -151,7 +152,7 @@ int <a href="#xmlSubstituteEntitiesDefault">xmlSubstituteEntitiesDefault</a>        (in
 <a name="XML_COMPLETE_ATTRS">Macro </a>XML_COMPLETE_ATTRS</h3>
 <pre class="programlisting">#define <a href="#XML_COMPLETE_ATTRS">XML_COMPLETE_ATTRS</a>;
 </pre>
-<p>Bit in the loadsubset context field to tell to do complete the elements attributes lists with the ones defaulted from the DTDs. Use it to initialize xmlLoadExtDtdDefaultValue.</p>
+<p>Bit in the loadsubset context field to tell to do complete the elements attributes lists with the ones defaulted from the DTDs. Use it to initialize <a href="libxml2-globals.html#xmlLoadExtDtdDefaultValue">xmlLoadExtDtdDefaultValue</a>.</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -167,7 +168,7 @@ int <a href="#xmlSubstituteEntitiesDefault">xmlSubstituteEntitiesDefault</a>        (in
 <a name="XML_DETECT_IDS">Macro </a>XML_DETECT_IDS</h3>
 <pre class="programlisting">#define <a href="#XML_DETECT_IDS">XML_DETECT_IDS</a>;
 </pre>
-<p>Bit in the loadsubset context field to tell to do ID/REFs lookups. Use it to initialize xmlLoadExtDtdDefaultValue.</p>
+<p>Bit in the loadsubset context field to tell to do ID/REFs lookups. Use it to initialize <a href="libxml2-globals.html#xmlLoadExtDtdDefaultValue">xmlLoadExtDtdDefaultValue</a>.</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -845,7 +846,7 @@ The content of this structure is not made public by the API.
 <a name="ignorableWhitespaceSAXFunc"></a>Function type ignorableWhitespaceSAXFunc</h3>
 <pre class="programlisting">void       ignorableWhitespaceSAXFunc      (void * ctx, <br>                                        const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * ch, <br>                                   int len)<br>
 </pre>
-<p>Receiving some ignorable whitespaces from the parser. UNUSED: by default the DOM building will use characters.</p>
+<p>Receiving some ignorable whitespaces from the parser. UNUSED: by default the DOM building will use <a href="libxml2-SAX.html#characters">characters</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1025,7 +1026,7 @@ The content of this structure is not made public by the API.
 <a name="setDocumentLocatorSAXFunc"></a>Function type setDocumentLocatorSAXFunc</h3>
 <pre class="programlisting">void       setDocumentLocatorSAXFunc       (void * ctx, <br>                                        <a href="libxml2-tree.html#xmlSAXLocatorPtr">xmlSAXLocatorPtr</a> loc)<br>
 </pre>
-<p>Receive the document locator at startup, actually xmlDefaultSAXLocator. Everything is available on the context, so this is useless in our case.</p>
+<p>Receive the document locator at startup, actually <a href="libxml2-globals.html#xmlDefaultSAXLocator">xmlDefaultSAXLocator</a>. Everything is available on the context, so this is useless in our case.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1266,7 +1267,7 @@ The content of this structure is not made public by the API.
 <a name="xmlClearNodeInfoSeq"></a>xmlClearNodeInfoSeq ()</h3>
 <pre class="programlisting">void       xmlClearNodeInfoSeq             (<a href="libxml2-parser.html#xmlParserNodeInfoSeqPtr">xmlParserNodeInfoSeqPtr</a> seq)<br>
 </pre>
-<p>-- Clear (release memory and reinitialize) node info sequence</p>
+<p>DEPRECATED: Don't use. -- Clear (release memory and reinitialize) node info sequence</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
@@ -1359,7 +1360,7 @@ The content of this structure is not made public by the API.
 <a name="xmlCreatePushParserCtxt"></a>xmlCreatePushParserCtxt ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a>  xmlCreatePushParserCtxt (<a href="libxml2-tree.html#xmlSAXHandlerPtr">xmlSAXHandlerPtr</a> sax, <br>                                             void * user_data, <br>                                          const char * chunk, <br>                                                int size, <br>                                          const char * filename)<br>
 </pre>
-<p>Create a parser context for using the XML parser in push mode. If @buffer and @size are non-NULL, the data is used to detect the encoding. The remaining <a href="libxml2-SAX.html#characters">characters</a> will be parsed so they don't need to be fed in again through xmlParseChunk. To allow content encoding detection, @size should be &gt;= 4 The value of @filename is used for fetching external entities and error/warning reports.</p>
+<p>Create a parser context for using the XML parser in push mode. If @buffer and @size are non-NULL, the data is used to detect the encoding. The remaining <a href="libxml2-SAX.html#characters">characters</a> will be parsed so they don't need to be fed in again through <a href="libxml2-parser.html#xmlParseChunk">xmlParseChunk</a>. To allow content encoding detection, @size should be &gt;= 4 The value of @filename is used for fetching external entities and error/warning reports.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1806,7 +1807,7 @@ The content of this structure is not made public by the API.
 <a name="xmlInitNodeInfoSeq"></a>xmlInitNodeInfoSeq ()</h3>
 <pre class="programlisting">void       xmlInitNodeInfoSeq              (<a href="libxml2-parser.html#xmlParserNodeInfoSeqPtr">xmlParserNodeInfoSeqPtr</a> seq)<br>
 </pre>
-<p>-- Initialize (set to initial state) node info sequence</p>
+<p>DEPRECATED: Don't use. -- Initialize (set to initial state) node info sequence</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
@@ -1829,7 +1830,7 @@ The content of this structure is not made public by the API.
 <a name="xmlInitParserCtxt"></a>xmlInitParserCtxt ()</h3>
 <pre class="programlisting">int        xmlInitParserCtxt               (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>Initialize a parser context</p>
+<p>DEPRECATED: Internal function which will be made private in a future version. Initialize a parser context</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1850,7 +1851,7 @@ The content of this structure is not made public by the API.
 <a name="xmlKeepBlanksDefault"></a>xmlKeepBlanksDefault ()</h3>
 <pre class="programlisting">int        xmlKeepBlanksDefault            (int val)<br>
 </pre>
-<p>Set and return the previous value for default blanks text nodes support. The 1.x version of the parser used an heuristic to try to detect ignorable white spaces. As a result the SAX callback was generating xmlSAX2IgnorableWhitespace() callbacks instead of characters() one, and when using the DOM output text nodes containing those blanks were not generated. The 2.x and later version will switch to the XML standard way and ignorableWhitespace() are only generated when running the parser in validating mode and when the current element doesn't allow CDATA or mixed content. This function is provided as a way to force the standard behavior on 1.X libs and to switch back to the old mode for compatibility when running 1.X client code on 2.X . Upgrade of 1.X code should be done by using xmlIsBlankNode() commodity function to detect the "empty" nodes generated. This value also affect autogeneration of indentation when saving code if blanks sections are kept, indentation is not generated.</p>
+<p>DEPRECATED: Use the modern options API with <a href="libxml2-parser.html#XML_PARSE_NOBLANKS">XML_PARSE_NOBLANKS</a>. Set and return the previous value for default blanks text nodes support. The 1.x version of the parser used an heuristic to try to detect ignorable white spaces. As a result the SAX callback was generating xmlSAX2IgnorableWhitespace() callbacks instead of characters() one, and when using the DOM output text nodes containing those blanks were not generated. The 2.x and later version will switch to the XML standard way and ignorableWhitespace() are only generated when running the parser in validating mode and when the current element doesn't allow CDATA or mixed content. This function is provided as a way to force the standard behavior on 1.X libs and to switch back to the old mode for compatibility when running 1.X client code on 2.X . Upgrade of 1.X code should be done by using xmlIsBlankNode() commodity function to detect the "empty" nodes generated. This value also affect autogeneration of indentation when saving code if blanks sections are kept, indentation is not generated.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1871,7 +1872,7 @@ The content of this structure is not made public by the API.
 <a name="xmlLineNumbersDefault"></a>xmlLineNumbersDefault ()</h3>
 <pre class="programlisting">int        xmlLineNumbersDefault           (int val)<br>
 </pre>
-<p>Set and return the previous value for enabling line numbers in elements contents. This may break on old application and is turned off by default.</p>
+<p>DEPRECATED: The modern options API always enables line numbers. Set and return the previous value for enabling line numbers in elements contents. This may break on old application and is turned off by default.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1962,6 +1963,31 @@ The content of this structure is not made public by the API.
 <hr>
 <div class="refsect2" lang="en">
 <h3>
+<a name="xmlNewSAXParserCtxt"></a>xmlNewSAXParserCtxt ()</h3>
+<pre class="programlisting"><a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a>  xmlNewSAXParserCtxt     (const <a href="libxml2-tree.html#xmlSAXHandler">xmlSAXHandler</a> * sax, <br>                                           void * userData)<br>
+</pre>
+<p>Allocate and initialize a new SAX parser context. If userData is NULL, the parser context will be passed as user data.</p>
+<div class="variablelist"><table border="0">
+<col align="left">
+<tbody>
+<tr>
+<td><span class="term"><i><tt>sax</tt></i>:</span></td>
+<td>SAX handler</td>
+</tr>
+<tr>
+<td><span class="term"><i><tt>userData</tt></i>:</span></td>
+<td>user data</td>
+</tr>
+<tr>
+<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
+<td>the <a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> or NULL if memory allocation failed.</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<h3>
 <a name="xmlParseBalancedChunkMemory"></a>xmlParseBalancedChunkMemory ()</h3>
 <pre class="programlisting">int        xmlParseBalancedChunkMemory     (<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br>                                   <a href="libxml2-tree.html#xmlSAXHandlerPtr">xmlSAXHandlerPtr</a> sax, <br>                                     void * user_data, <br>                                  int depth, <br>                                         const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * string, <br>                                       <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> * lst)<br>
 </pre>
@@ -2142,7 +2168,7 @@ The content of this structure is not made public by the API.
 <a name="xmlParseDoc"></a>xmlParseDoc ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a>        xmlParseDoc             (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * cur)<br>
 </pre>
-<p>parse an XML in-memory document and build a tree.</p>
+<p>DEPRECATED: Use <a href="libxml2-parser.html#xmlReadDoc">xmlReadDoc</a>. parse an XML in-memory document and build a tree.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2272,7 +2298,7 @@ The content of this structure is not made public by the API.
 <a name="xmlParseFile"></a>xmlParseFile ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a>        xmlParseFile            (const char * filename)<br>
 </pre>
-<p>parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time.</p>
+<p>DEPRECATED: Use <a href="libxml2-parser.html#xmlReadFile">xmlReadFile</a>. parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2332,7 +2358,7 @@ The content of this structure is not made public by the API.
 <a name="xmlParseMemory"></a>xmlParseMemory ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a>        xmlParseMemory          (const char * buffer, <br>                                       int size)<br>
 </pre>
-<p>parse an XML in-memory block and build a tree.</p>
+<p>DEPRECATED: Use <a href="libxml2-parser.html#xmlReadMemory">xmlReadMemory</a>. parse an XML in-memory block and build a tree.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2357,7 +2383,7 @@ The content of this structure is not made public by the API.
 <a name="xmlParserAddNodeInfo"></a>xmlParserAddNodeInfo ()</h3>
 <pre class="programlisting">void       xmlParserAddNodeInfo            (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                    const <a href="libxml2-parser.html#xmlParserNodeInfoPtr">xmlParserNodeInfoPtr</a> info)<br>
 </pre>
-<p>Insert node info record into the sorted sequence</p>
+<p>DEPRECATED: Don't use. Insert node info record into the sorted sequence</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2378,7 +2404,7 @@ The content of this structure is not made public by the API.
 <a name="xmlParserFindNodeInfo"></a>xmlParserFindNodeInfo ()</h3>
 <pre class="programlisting">const <a href="libxml2-parser.html#xmlParserNodeInfo">xmlParserNodeInfo</a> *      xmlParserFindNodeInfo   (const <a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctx, <br>                                                       const <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> node)<br>
 </pre>
-<p>Find the parser node info struct for a given node</p>
+<p>DEPRECATED: Don't use. Find the parser node info struct for a given node</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2403,7 +2429,7 @@ The content of this structure is not made public by the API.
 <a name="xmlParserFindNodeInfoIndex"></a>xmlParserFindNodeInfoIndex ()</h3>
 <pre class="programlisting">unsigned long      xmlParserFindNodeInfoIndex      (const <a href="libxml2-parser.html#xmlParserNodeInfoSeqPtr">xmlParserNodeInfoSeqPtr</a> seq, <br>                                               const <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> node)<br>
 </pre>
-<p><a href="libxml2-parser.html#xmlParserFindNodeInfoIndex">xmlParserFindNodeInfoIndex</a> : Find the index that the info record for the given node is or should be at in a sorted sequence</p>
+<p>DEPRECATED: Don't use. <a href="libxml2-parser.html#xmlParserFindNodeInfoIndex">xmlParserFindNodeInfoIndex</a> : Find the index that the info record for the given node is or should be at in a sorted sequence</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2428,7 +2454,7 @@ The content of this structure is not made public by the API.
 <a name="xmlParserInputGrow"></a>xmlParserInputGrow ()</h3>
 <pre class="programlisting">int        xmlParserInputGrow              (<a href="libxml2-tree.html#xmlParserInputPtr">xmlParserInputPtr</a> in, <br>                                    int len)<br>
 </pre>
-<p>This function increase the input for the parser. It tries to preserve pointers to the input buffer, and keep already read data</p>
+<p>DEPRECATED: Don't use. This function increase the input for the parser. It tries to preserve pointers to the input buffer, and keep already read data</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2453,7 +2479,7 @@ The content of this structure is not made public by the API.
 <a name="xmlParserInputRead"></a>xmlParserInputRead ()</h3>
 <pre class="programlisting">int        xmlParserInputRead              (<a href="libxml2-tree.html#xmlParserInputPtr">xmlParserInputPtr</a> in, <br>                                    int len)<br>
 </pre>
-<p>This function was internal and is deprecated.</p>
+<p>DEPRECATED: This function was internal and is deprecated.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2478,7 +2504,7 @@ The content of this structure is not made public by the API.
 <a name="xmlPedanticParserDefault"></a>xmlPedanticParserDefault ()</h3>
 <pre class="programlisting">int        xmlPedanticParserDefault        (int val)<br>
 </pre>
-<p>Set and return the previous value for enabling pedantic warnings.</p>
+<p>DEPRECATED: Use the modern options API with <a href="libxml2-parser.html#XML_PARSE_PEDANTIC">XML_PARSE_PEDANTIC</a>. Set and return the previous value for enabling pedantic warnings.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2677,7 +2703,7 @@ The content of this structure is not made public by the API.
 <a name="xmlRecoverDoc"></a>xmlRecoverDoc ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a>        xmlRecoverDoc           (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * cur)<br>
 </pre>
-<p>parse an XML in-memory document and build a tree. In the case the document is not Well Formed, a attempt to build a tree is tried anyway</p>
+<p>DEPRECATED: Use <a href="libxml2-parser.html#xmlReadDoc">xmlReadDoc</a> with <a href="libxml2-parser.html#XML_PARSE_RECOVER">XML_PARSE_RECOVER</a>. parse an XML in-memory document and build a tree. In the case the document is not Well Formed, a attempt to build a tree is tried anyway</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2699,7 +2725,7 @@ The content of this structure is not made public by the API.
 <a name="xmlRecoverFile"></a>xmlRecoverFile ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a>        xmlRecoverFile          (const char * filename)<br>
 </pre>
-<p>parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. In the case the document is not Well Formed, it attempts to build a tree anyway</p>
+<p>DEPRECATED: Use <a href="libxml2-parser.html#xmlReadFile">xmlReadFile</a> with <a href="libxml2-parser.html#XML_PARSE_RECOVER">XML_PARSE_RECOVER</a>. parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. In the case the document is not Well Formed, it attempts to build a tree anyway</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2720,7 +2746,7 @@ The content of this structure is not made public by the API.
 <a name="xmlRecoverMemory"></a>xmlRecoverMemory ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a>        xmlRecoverMemory        (const char * buffer, <br>                                       int size)<br>
 </pre>
-<p>parse an XML in-memory block and build a tree. In the case the document is not Well Formed, an attempt to build a tree is tried anyway</p>
+<p>DEPRECATED: Use <a href="libxml2-parser.html#xmlReadMemory">xmlReadMemory</a> with <a href="libxml2-parser.html#XML_PARSE_RECOVER">XML_PARSE_RECOVER</a>. parse an XML in-memory block and build a tree. In the case the document is not Well Formed, an attempt to build a tree is tried anyway</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2745,7 +2771,7 @@ The content of this structure is not made public by the API.
 <a name="xmlSAXParseDTD"></a>xmlSAXParseDTD ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlDtdPtr">xmlDtdPtr</a>        xmlSAXParseDTD          (<a href="libxml2-tree.html#xmlSAXHandlerPtr">xmlSAXHandlerPtr</a> sax, <br>                                     const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * ExternalID, <br>                                   const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * SystemID)<br>
 </pre>
-<p>Load and parse an external subset.</p>
+<p>DEPRECATED: Don't use. Load and parse an external subset.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2774,7 +2800,7 @@ The content of this structure is not made public by the API.
 <a name="xmlSAXParseDoc"></a>xmlSAXParseDoc ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a>        xmlSAXParseDoc          (<a href="libxml2-tree.html#xmlSAXHandlerPtr">xmlSAXHandlerPtr</a> sax, <br>                                     const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * cur, <br>                                  int recovery)<br>
 </pre>
-<p>parse an XML in-memory document and build a tree. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.</p>
+<p>DEPRECATED: Use <a href="libxml2-parser.html#xmlNewSAXParserCtxt">xmlNewSAXParserCtxt</a> and <a href="libxml2-parser.html#xmlCtxtReadDoc">xmlCtxtReadDoc</a>. parse an XML in-memory document and build a tree. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2804,7 +2830,7 @@ The content of this structure is not made public by the API.
 <a name="xmlSAXParseEntity"></a>xmlSAXParseEntity ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a>        xmlSAXParseEntity       (<a href="libxml2-tree.html#xmlSAXHandlerPtr">xmlSAXHandlerPtr</a> sax, <br>                                     const char * filename)<br>
 </pre>
-<p>parse an XML external entity out of context and build a tree. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines. [78] extParsedEnt ::= TextDecl? content This correspond to a "Well Balanced" chunk</p>
+<p>DEPRECATED: Don't use. parse an XML external entity out of context and build a tree. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines. [78] extParsedEnt ::= TextDecl? content This correspond to a "Well Balanced" chunk</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2829,7 +2855,7 @@ The content of this structure is not made public by the API.
 <a name="xmlSAXParseFile"></a>xmlSAXParseFile ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a>        xmlSAXParseFile         (<a href="libxml2-tree.html#xmlSAXHandlerPtr">xmlSAXHandlerPtr</a> sax, <br>                                     const char * filename, <br>                                     int recovery)<br>
 </pre>
-<p>parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.</p>
+<p>DEPRECATED: Use <a href="libxml2-parser.html#xmlNewSAXParserCtxt">xmlNewSAXParserCtxt</a> and <a href="libxml2-parser.html#xmlCtxtReadFile">xmlCtxtReadFile</a>. parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2858,7 +2884,7 @@ The content of this structure is not made public by the API.
 <a name="xmlSAXParseFileWithData"></a>xmlSAXParseFileWithData ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a>        xmlSAXParseFileWithData (<a href="libxml2-tree.html#xmlSAXHandlerPtr">xmlSAXHandlerPtr</a> sax, <br>                                     const char * filename, <br>                                     int recovery, <br>                                      void * data)<br>
 </pre>
-<p>parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines. User data (void *) is stored within the parser context in the context's _private member, so it is available nearly everywhere in libxml</p>
+<p>DEPRECATED: Use <a href="libxml2-parser.html#xmlNewSAXParserCtxt">xmlNewSAXParserCtxt</a> and <a href="libxml2-parser.html#xmlCtxtReadFile">xmlCtxtReadFile</a>. parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines. User data (void *) is stored within the parser context in the context's _private member, so it is available nearly everywhere in libxml</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2891,7 +2917,7 @@ The content of this structure is not made public by the API.
 <a name="xmlSAXParseMemory"></a>xmlSAXParseMemory ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a>        xmlSAXParseMemory       (<a href="libxml2-tree.html#xmlSAXHandlerPtr">xmlSAXHandlerPtr</a> sax, <br>                                     const char * buffer, <br>                                       int size, <br>                                  int recovery)<br>
 </pre>
-<p>parse an XML in-memory block and use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.</p>
+<p>DEPRECATED: Use <a href="libxml2-parser.html#xmlNewSAXParserCtxt">xmlNewSAXParserCtxt</a> and <a href="libxml2-parser.html#xmlCtxtReadMemory">xmlCtxtReadMemory</a>. parse an XML in-memory block and use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2924,7 +2950,7 @@ The content of this structure is not made public by the API.
 <a name="xmlSAXParseMemoryWithData"></a>xmlSAXParseMemoryWithData ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a>        xmlSAXParseMemoryWithData       (<a href="libxml2-tree.html#xmlSAXHandlerPtr">xmlSAXHandlerPtr</a> sax, <br>                                             const char * buffer, <br>                                               int size, <br>                                          int recovery, <br>                                              void * data)<br>
 </pre>
-<p>parse an XML in-memory block and use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines. User data (void *) is stored within the parser context in the context's _private member, so it is available nearly everywhere in libxml</p>
+<p>DEPRECATED: Use <a href="libxml2-parser.html#xmlNewSAXParserCtxt">xmlNewSAXParserCtxt</a> and <a href="libxml2-parser.html#xmlCtxtReadMemory">xmlCtxtReadMemory</a>. parse an XML in-memory block and use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines. User data (void *) is stored within the parser context in the context's _private member, so it is available nearly everywhere in libxml</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2961,7 +2987,7 @@ The content of this structure is not made public by the API.
 <a name="xmlSAXUserParseFile"></a>xmlSAXUserParseFile ()</h3>
 <pre class="programlisting">int        xmlSAXUserParseFile             (<a href="libxml2-tree.html#xmlSAXHandlerPtr">xmlSAXHandlerPtr</a> sax, <br>                                     void * user_data, <br>                                  const char * filename)<br>
 </pre>
-<p>parse an XML file and call the given SAX handler routines. Automatic support for ZLIB/Compress compressed document is provided</p>
+<p>DEPRECATED: Use <a href="libxml2-parser.html#xmlNewSAXParserCtxt">xmlNewSAXParserCtxt</a> and <a href="libxml2-parser.html#xmlCtxtReadFile">xmlCtxtReadFile</a>. parse an XML file and call the given SAX handler routines. Automatic support for ZLIB/Compress compressed document is provided</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2990,7 +3016,7 @@ The content of this structure is not made public by the API.
 <a name="xmlSAXUserParseMemory"></a>xmlSAXUserParseMemory ()</h3>
 <pre class="programlisting">int        xmlSAXUserParseMemory           (<a href="libxml2-tree.html#xmlSAXHandlerPtr">xmlSAXHandlerPtr</a> sax, <br>                                     void * user_data, <br>                                  const char * buffer, <br>                                       int size)<br>
 </pre>
-<p>A better SAX parsing routine. parse an XML in-memory buffer and call the given SAX handler routines.</p>
+<p>DEPRECATED: Use <a href="libxml2-parser.html#xmlNewSAXParserCtxt">xmlNewSAXParserCtxt</a> and <a href="libxml2-parser.html#xmlCtxtReadMemory">xmlCtxtReadMemory</a>. parse an XML in-memory buffer and call the given SAX handler routines.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -3067,7 +3093,7 @@ The content of this structure is not made public by the API.
 <a name="xmlSetupParserForBuffer"></a>xmlSetupParserForBuffer ()</h3>
 <pre class="programlisting">void       xmlSetupParserForBuffer         (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                    const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * buffer, <br>                                       const char * filename)<br>
 </pre>
-<p>Setup the parser context to parse a new buffer; Clears any prior contents from the parser context. The buffer parameter must not be NULL, but the filename parameter can be</p>
+<p>DEPRECATED: Don't use. Setup the parser context to parse a new buffer; Clears any prior contents from the parser context. The buffer parameter must not be NULL, but the filename parameter can be</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -3107,7 +3133,7 @@ The content of this structure is not made public by the API.
 <a name="xmlSubstituteEntitiesDefault"></a>xmlSubstituteEntitiesDefault ()</h3>
 <pre class="programlisting">int        xmlSubstituteEntitiesDefault    (int val)<br>
 </pre>
-<p>Set and return the previous value for default entity support. Initially the parser always keep entity references instead of substituting entity values in the output. This function has to be used to change the default parser behavior SAX::substituteEntities() has to be used for changing that on a file by file basis.</p>
+<p>DEPRECATED: Use the modern options API with <a href="libxml2-parser.html#XML_PARSE_NOENT">XML_PARSE_NOENT</a>. Set and return the previous value for default entity support. Initially the parser always keep entity references instead of substituting entity values in the output. This function has to be used to change the default parser behavior SAX::substituteEntities() has to be used for changing that on a file by file basis.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
index 4de6e6d..2a0d6d5 100644 (file)
 #define <a href="#IS_LETTER_CH">IS_LETTER_CH</a>(c);
 #define <a href="#IS_PUBIDCHAR">IS_PUBIDCHAR</a>(c);
 #define <a href="#IS_PUBIDCHAR_CH">IS_PUBIDCHAR_CH</a>(c);
-#define <a href="#MOVETO_ENDTAG">MOVETO_ENDTAG</a>(p);
-#define <a href="#MOVETO_STARTTAG">MOVETO_STARTTAG</a>(p);
-#define <a href="#SKIP_EOL">SKIP_EOL</a>(p);
 #define <a href="#XML_MAX_DICTIONARY_LIMIT">XML_MAX_DICTIONARY_LIMIT</a>;
+#define <a href="#XML_MAX_HUGE_LENGTH">XML_MAX_HUGE_LENGTH</a>;
 #define <a href="#XML_MAX_LOOKUP_LIMIT">XML_MAX_LOOKUP_LIMIT</a>;
 #define <a href="#XML_MAX_NAMELEN">XML_MAX_NAMELEN</a>;
 #define <a href="#XML_MAX_NAME_LENGTH">XML_MAX_NAME_LENGTH</a>;
@@ -54,8 +52,6 @@
 #define <a href="#XML_SUBSTITUTE_NONE">XML_SUBSTITUTE_NONE</a>;
 #define <a href="#XML_SUBSTITUTE_PEREF">XML_SUBSTITUTE_PEREF</a>;
 #define <a href="#XML_SUBSTITUTE_REF">XML_SUBSTITUTE_REF</a>;
-<a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a>      <a href="#htmlCreateFileParserCtxt">htmlCreateFileParserCtxt</a>        (const char * filename, <br>                                                     const char * encoding);
-void   <a href="#htmlInitAutoClose">htmlInitAutoClose</a>              (void);
 <a href="libxml2-tree.html#xmlParserInputPtr">xmlParserInputPtr</a>    <a href="#inputPop">inputPop</a>        (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt);
 int    <a href="#inputPush">inputPush</a>                      (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                    <a href="libxml2-tree.html#xmlParserInputPtr">xmlParserInputPtr</a> value);
 const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *   <a href="#namePop">namePop</a>                  (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt);
@@ -72,7 +68,6 @@ int   <a href="#xmlCopyCharMultiByte">xmlCopyCharMultiByte</a>                (<a href="libxml2-
 int    <a href="#xmlCurrentChar">xmlCurrentChar</a>                    (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                    int * len);
 <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * <a href="#xmlDecodeEntities">xmlDecodeEntities</a>      (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                    int len, <br>                                   int what, <br>                                  <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> end, <br>                                  <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> end2, <br>                                         <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> end3);
 typedef void <a href="#xmlEntityReferenceFunc">xmlEntityReferenceFunc</a>              (<a href="libxml2-tree.html#xmlEntityPtr">xmlEntityPtr</a> ent, <br>                                     <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> firstNode, <br>                                   <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> lastNode);
-void   <a href="#xmlErrMemory">xmlErrMemory</a>                        (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                    const char * extra);
 void   <a href="#xmlFreeInputStream">xmlFreeInputStream</a>            (<a href="libxml2-tree.html#xmlParserInputPtr">xmlParserInputPtr</a> input);
 void   <a href="#xmlHandleEntity">xmlHandleEntity</a>                  (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                    <a href="libxml2-tree.html#xmlEntityPtr">xmlEntityPtr</a> entity);
 int    <a href="#xmlIsLetter">xmlIsLetter</a>                  (int c);
@@ -446,55 +441,18 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <hr>
 <div class="refsect2" lang="en">
 <h3>
-<a name="MOVETO_ENDTAG">Macro </a>MOVETO_ENDTAG</h3>
-<pre class="programlisting">#define <a href="#MOVETO_ENDTAG">MOVETO_ENDTAG</a>(p);
-</pre>
-<p>Skips to the next '&gt;' char.</p>
-<div class="variablelist"><table border="0">
-<col align="left">
-<tbody><tr>
-<td><span class="term"><i><tt>p</tt></i>:</span></td>
-<td>and UTF8 string pointer</td>
-</tr></tbody>
-</table></div>
-</div>
-<hr>
-<div class="refsect2" lang="en">
-<h3>
-<a name="MOVETO_STARTTAG">Macro </a>MOVETO_STARTTAG</h3>
-<pre class="programlisting">#define <a href="#MOVETO_STARTTAG">MOVETO_STARTTAG</a>(p);
-</pre>
-<p>Skips to the next '&lt;' char.</p>
-<div class="variablelist"><table border="0">
-<col align="left">
-<tbody><tr>
-<td><span class="term"><i><tt>p</tt></i>:</span></td>
-<td>and UTF8 string pointer</td>
-</tr></tbody>
-</table></div>
-</div>
-<hr>
-<div class="refsect2" lang="en">
-<h3>
-<a name="SKIP_EOL">Macro </a>SKIP_EOL</h3>
-<pre class="programlisting">#define <a href="#SKIP_EOL">SKIP_EOL</a>(p);
+<a name="XML_MAX_DICTIONARY_LIMIT">Macro </a>XML_MAX_DICTIONARY_LIMIT</h3>
+<pre class="programlisting">#define <a href="#XML_MAX_DICTIONARY_LIMIT">XML_MAX_DICTIONARY_LIMIT</a>;
 </pre>
-<p>Skips the end of line chars.</p>
-<div class="variablelist"><table border="0">
-<col align="left">
-<tbody><tr>
-<td><span class="term"><i><tt>p</tt></i>:</span></td>
-<td>and UTF8 string pointer</td>
-</tr></tbody>
-</table></div>
+<p>Maximum size allowed by the parser for a dictionary by default This is not a limitation of the parser but a safety boundary feature, use <a href="libxml2-parser.html#XML_PARSE_HUGE">XML_PARSE_HUGE</a> option to override it. Introduced in 2.9.0</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
 <h3>
-<a name="XML_MAX_DICTIONARY_LIMIT">Macro </a>XML_MAX_DICTIONARY_LIMIT</h3>
-<pre class="programlisting">#define <a href="#XML_MAX_DICTIONARY_LIMIT">XML_MAX_DICTIONARY_LIMIT</a>;
+<a name="XML_MAX_HUGE_LENGTH">Macro </a>XML_MAX_HUGE_LENGTH</h3>
+<pre class="programlisting">#define <a href="#XML_MAX_HUGE_LENGTH">XML_MAX_HUGE_LENGTH</a>;
 </pre>
-<p>Maximum size allowed by the parser for a dictionary by default This is not a limitation of the parser but a safety boundary feature, use <a href="libxml2-parser.html#XML_PARSE_HUGE">XML_PARSE_HUGE</a> option to override it. Introduced in 2.9.0</p>
+<p>Maximum size allowed when <a href="libxml2-parser.html#XML_PARSE_HUGE">XML_PARSE_HUGE</a> is set.</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -591,7 +549,7 @@ int <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParserMaxDepth">Variable </a>xmlParserMaxDepth</h3>
 <pre class="programlisting">unsigned int xmlParserMaxDepth;
 </pre>
-<p></p>
+<p>arbitrary depth limit for the XML documents that we allow to process. This is not a limitation of the parser but a safety boundary feature. It can be disabled with the <a href="libxml2-parser.html#XML_PARSE_HUGE">XML_PARSE_HUGE</a> parser option.</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -620,39 +578,6 @@ int        <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <hr>
 <div class="refsect2" lang="en">
 <h3>
-<a name="htmlCreateFileParserCtxt"></a>htmlCreateFileParserCtxt ()</h3>
-<pre class="programlisting"><a href="libxml2-HTMLparser.html#htmlParserCtxtPtr">htmlParserCtxtPtr</a>  htmlCreateFileParserCtxt        (const char * filename, <br>                                                     const char * encoding)<br>
-</pre>
-<p>Create a parser context for a file content. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time.</p>
-<div class="variablelist"><table border="0">
-<col align="left">
-<tbody>
-<tr>
-<td><span class="term"><i><tt>filename</tt></i>:</span></td>
-<td>the filename</td>
-</tr>
-<tr>
-<td><span class="term"><i><tt>encoding</tt></i>:</span></td>
-<td>a free form C string describing the HTML document encoding, or NULL</td>
-</tr>
-<tr>
-<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
-<td>the new parser context or NULL</td>
-</tr>
-</tbody>
-</table></div>
-</div>
-<hr>
-<div class="refsect2" lang="en">
-<h3>
-<a name="htmlInitAutoClose"></a>htmlInitAutoClose ()</h3>
-<pre class="programlisting">void       htmlInitAutoClose               (void)<br>
-</pre>
-<p>DEPRECATED: This function will be made private. Call <a href="libxml2-parser.html#xmlInitParser">xmlInitParser</a> to initialize the library. This is a no-op now.</p>
-</div>
-<hr>
-<div class="refsect2" lang="en">
-<h3>
 <a name="inputPop"></a>inputPop ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlParserInputPtr">xmlParserInputPtr</a>        inputPop        (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
@@ -702,7 +627,7 @@ int <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="namePop"></a>namePop ()</h3>
 <pre class="programlisting">const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *       namePop                 (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>Pops the top element name from the name stack</p>
+<p>DEPRECATED: Internal function, do not use. Pops the top element name from the name stack</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -723,7 +648,7 @@ int <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="namePush"></a>namePush ()</h3>
 <pre class="programlisting">int        namePush                        (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                    const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * value)<br>
 </pre>
-<p>Pushes a new element name on top of the name stack</p>
+<p>DEPRECATED: Internal function, do not use. Pushes a new element name on top of the name stack</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -748,7 +673,7 @@ int <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="nodePop"></a>nodePop ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a>      nodePop                 (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>Pops the top element node from the node stack</p>
+<p>DEPRECATED: Internal function, do not use. Pops the top element node from the node stack</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -769,7 +694,7 @@ int <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="nodePush"></a>nodePush ()</h3>
 <pre class="programlisting">int        nodePush                        (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                    <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> value)<br>
 </pre>
-<p>Pushes a new element node on top of the node stack</p>
+<p>DEPRECATED: Internal function, do not use. Pushes a new element node on top of the node stack</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -794,7 +719,7 @@ int <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlCheckLanguageID"></a>xmlCheckLanguageID ()</h3>
 <pre class="programlisting">int        xmlCheckLanguageID              (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * lang)<br>
 </pre>
-<p>Checks that the value conforms to the LanguageID production: NOTE: this is somewhat deprecated, those productions were removed from the XML Second edition. [33] LanguageID ::= Langcode ('-' Subcode)* [34] Langcode ::= ISO639Code | IanaCode | UserCode [35] ISO639Code ::= ([a-z] | [A-Z]) ([a-z] | [A-Z]) [36] IanaCode ::= ('i' | 'I') '-' ([a-z] | [A-Z])+ [37] UserCode ::= ('x' | 'X') '-' ([a-z] | [A-Z])+ [38] Subcode ::= ([a-z] | [A-Z])+ The current REC <a href="libxml2-SAX.html#reference">reference</a> the successors of RFC 1766, currently 5646 http://www.rfc-editor.org/rfc/rfc5646.txt langtag = language ["-" script] ["-" region] *("-" variant) *("-" extension) ["-" privateuse] language = 2*3ALPHA ; shortest ISO 639 code ["-" extlang] ; sometimes followed by ; extended language subtags / 4ALPHA ; or reserved for future use / 5*8ALPHA ; or registered language subtag extlang = 3ALPHA ; selected ISO 639 codes *2("-" 3ALPHA) ; permanently reserved script = 4ALPHA ; ISO 15924 code region = 2ALPHA ; ISO 3166-1 code / 3DIGIT ; UN M.49 code variant = 5*8alphanum ; registered variants / (DIGIT 3alphanum) extension = singleton 1*("-" (2*8alphanum)) ; Single alphanumerics ; "x" reserved for private use singleton = DIGIT ; 0 - 9 / %x41-57 ; A - W / %x59-5A ; Y - Z / %x61-77 ; a - w / %x79-7A ; y - z it sounds right to still allow Irregular i-xxx IANA and user codes too The parser below doesn't try to cope with extension or privateuse that could be added but that's not interoperable anyway</p>
+<p>DEPRECATED: Internal function, do not use. Checks that the value conforms to the LanguageID production: NOTE: this is somewhat deprecated, those productions were removed from the XML Second edition. [33] LanguageID ::= Langcode ('-' Subcode)* [34] Langcode ::= ISO639Code | IanaCode | UserCode [35] ISO639Code ::= ([a-z] | [A-Z]) ([a-z] | [A-Z]) [36] IanaCode ::= ('i' | 'I') '-' ([a-z] | [A-Z])+ [37] UserCode ::= ('x' | 'X') '-' ([a-z] | [A-Z])+ [38] Subcode ::= ([a-z] | [A-Z])+ The current REC <a href="libxml2-SAX.html#reference">reference</a> the successors of RFC 1766, currently 5646 http://www.rfc-editor.org/rfc/rfc5646.txt langtag = language ["-" script] ["-" region] *("-" variant) *("-" extension) ["-" privateuse] language = 2*3ALPHA ; shortest ISO 639 code ["-" extlang] ; sometimes followed by ; extended language subtags / 4ALPHA ; or reserved for future use / 5*8ALPHA ; or registered language subtag extlang = 3ALPHA ; selected ISO 639 codes *2("-" 3ALPHA) ; permanently reserved script = 4ALPHA ; ISO 15924 code region = 2ALPHA ; ISO 3166-1 code / 3DIGIT ; UN M.49 code variant = 5*8alphanum ; registered variants / (DIGIT 3alphanum) extension = singleton 1*("-" (2*8alphanum)) ; Single alphanumerics ; "x" reserved for private use singleton = DIGIT ; 0 - 9 / %x41-57 ; A - W / %x59-5A ; Y - Z / %x61-77 ; a - w / %x79-7A ; y - z it sounds right to still allow Irregular i-xxx IANA and user codes too The parser below doesn't try to cope with extension or privateuse that could be added but that's not interoperable anyway</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -972,7 +897,7 @@ int <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlCurrentChar"></a>xmlCurrentChar ()</h3>
 <pre class="programlisting">int        xmlCurrentChar                  (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                    int * len)<br>
 </pre>
-<p>The current char value, if using UTF-8 this may actually span multiple bytes in the input buffer. Implement the end of line normalization: 2.11 End-of-Line Handling Wherever an external parsed entity or the literal entity value of an internal parsed entity contains either the literal two-character sequence "#xD#xA" or a standalone literal #xD, an XML processor must pass to the application the single character #xA. This behavior can conveniently be produced by normalizing all line breaks to #xA on input, before parsing.)</p>
+<p>DEPRECATED: Internal function, do not use. The current char value, if using UTF-8 this may actually span multiple bytes in the input buffer. Implement the end of line normalization: 2.11 End-of-Line Handling Wherever an external parsed entity or the literal entity value of an internal parsed entity contains either the literal two-character sequence "#xD#xA" or a standalone literal #xD, an XML processor must pass to the application the single character #xA. This behavior can conveniently be produced by normalizing all line breaks to #xA on input, before parsing.)</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1036,27 +961,6 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <hr>
 <div class="refsect2" lang="en">
 <h3>
-<a name="xmlErrMemory"></a>xmlErrMemory ()</h3>
-<pre class="programlisting">void       xmlErrMemory                    (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                    const char * extra)<br>
-</pre>
-<p>Handle a redefinition of <a href="libxml2-SAX.html#attribute">attribute</a> error</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 XML parser context</td>
-</tr>
-<tr>
-<td><span class="term"><i><tt>extra</tt></i>:</span></td>
-<td>extra information</td>
-</tr>
-</tbody>
-</table></div>
-</div>
-<hr>
-<div class="refsect2" lang="en">
-<h3>
 <a name="xmlFreeInputStream"></a>xmlFreeInputStream ()</h3>
 <pre class="programlisting">void       xmlFreeInputStream              (<a href="libxml2-tree.html#xmlParserInputPtr">xmlParserInputPtr</a> input)<br>
 </pre>
@@ -1185,7 +1089,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlNewEntityInputStream"></a>xmlNewEntityInputStream ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlParserInputPtr">xmlParserInputPtr</a>        xmlNewEntityInputStream (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                            <a href="libxml2-tree.html#xmlEntityPtr">xmlEntityPtr</a> entity)<br>
 </pre>
-<p>Create a new input stream based on an <a href="libxml2-tree.html#xmlEntityPtr">xmlEntityPtr</a></p>
+<p>DEPRECATED: Internal function, do not use. Create a new input stream based on an <a href="libxml2-tree.html#xmlEntityPtr">xmlEntityPtr</a></p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1281,7 +1185,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlNextChar"></a>xmlNextChar ()</h3>
 <pre class="programlisting">void       xmlNextChar                     (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>Skip to the next char input char.</p>
+<p>DEPRECATED: Internal function, do not use. Skip to the next char input char.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
@@ -1296,7 +1200,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseAttValue"></a>xmlParseAttValue ()</h3>
 <pre class="programlisting"><a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *     xmlParseAttValue        (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse a value for an <a href="libxml2-SAX.html#attribute">attribute</a> Note: the parser won't do substitution of entities here, this will be handled later in <a href="libxml2-tree.html#xmlStringGetNodeList">xmlStringGetNodeList</a> [10] AttValue ::= '"' ([^&lt;&amp;"] | Reference)* '"' | "'" ([^&lt;&amp;'] | Reference)* "'" 3.3.3 Attribute-Value Normalization: Before the value of an <a href="libxml2-SAX.html#attribute">attribute</a> is passed to the application or checked for validity, the XML processor must normalize it as follows: - a character <a href="libxml2-SAX.html#reference">reference</a> is processed by appending the referenced character to the <a href="libxml2-SAX.html#attribute">attribute</a> value - an entity <a href="libxml2-SAX.html#reference">reference</a> is processed by recursively processing the replacement text of the entity - a whitespace character (#x20, #xD, #xA, #x9) is processed by appending #x20 to the normalized value, except that only a single #x20 is appended for a "#xD#xA" sequence that is part of an external parsed entity or the literal entity value of an internal parsed entity - other <a href="libxml2-SAX.html#characters">characters</a> are processed by appending them to the normalized value If the declared value is not CDATA, then the XML processor must further process the normalized <a href="libxml2-SAX.html#attribute">attribute</a> value by discarding any leading and trailing space (#x20) characters, and by replacing sequences of space (#x20) <a href="libxml2-SAX.html#characters">characters</a> by a single space (#x20) character. All attributes for which no declaration has been read should be treated by a non-validating parser as if declared CDATA.</p>
+<p>DEPRECATED: Internal function, don't use. parse a value for an <a href="libxml2-SAX.html#attribute">attribute</a> Note: the parser won't do substitution of entities here, this will be handled later in <a href="libxml2-tree.html#xmlStringGetNodeList">xmlStringGetNodeList</a> [10] AttValue ::= '"' ([^&lt;&amp;"] | Reference)* '"' | "'" ([^&lt;&amp;'] | Reference)* "'" 3.3.3 Attribute-Value Normalization: Before the value of an <a href="libxml2-SAX.html#attribute">attribute</a> is passed to the application or checked for validity, the XML processor must normalize it as follows: - a character <a href="libxml2-SAX.html#reference">reference</a> is processed by appending the referenced character to the <a href="libxml2-SAX.html#attribute">attribute</a> value - an entity <a href="libxml2-SAX.html#reference">reference</a> is processed by recursively processing the replacement text of the entity - a whitespace character (#x20, #xD, #xA, #x9) is processed by appending #x20 to the normalized value, except that only a single #x20 is appended for a "#xD#xA" sequence that is part of an external parsed entity or the literal entity value of an internal parsed entity - other <a href="libxml2-SAX.html#characters">characters</a> are processed by appending them to the normalized value If the declared value is not CDATA, then the XML processor must further process the normalized <a href="libxml2-SAX.html#attribute">attribute</a> value by discarding any leading and trailing space (#x20) characters, and by replacing sequences of space (#x20) <a href="libxml2-SAX.html#characters">characters</a> by a single space (#x20) character. All attributes for which no declaration has been read should be treated by a non-validating parser as if declared CDATA.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1317,7 +1221,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseAttribute"></a>xmlParseAttribute ()</h3>
 <pre class="programlisting">const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *       xmlParseAttribute       (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                    <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** value)<br>
 </pre>
-<p>parse an <a href="libxml2-SAX.html#attribute">attribute</a> [41] Attribute ::= Name Eq AttValue [ WFC: No External Entity References ] Attribute values cannot contain direct or indirect entity references to external entities. [ WFC: No &lt; in Attribute Values ] The replacement text of any entity referred to directly or indirectly in an <a href="libxml2-SAX.html#attribute">attribute</a> value (other than "&amp;lt;") must not contain a &lt;. [ VC: Attribute Value Type ] The <a href="libxml2-SAX.html#attribute">attribute</a> must have been declared; the value must be of the type declared for it. [25] Eq ::= S? '=' S? With namespace: [NS 11] Attribute ::= QName Eq AttValue Also the case QName == xmlns:??? is handled independently as a namespace definition.</p>
+<p>DEPRECATED: Internal function, don't use. parse an <a href="libxml2-SAX.html#attribute">attribute</a> [41] Attribute ::= Name Eq AttValue [ WFC: No External Entity References ] Attribute values cannot contain direct or indirect entity references to external entities. [ WFC: No &lt; in Attribute Values ] The replacement text of any entity referred to directly or indirectly in an <a href="libxml2-SAX.html#attribute">attribute</a> value (other than "&amp;lt;") must not contain a &lt;. [ VC: Attribute Value Type ] The <a href="libxml2-SAX.html#attribute">attribute</a> must have been declared; the value must be of the type declared for it. [25] Eq ::= S? '=' S? With namespace: [NS 11] Attribute ::= QName Eq AttValue Also the case QName == xmlns:??? is handled independently as a namespace definition.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1343,7 +1247,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseAttributeListDecl"></a>xmlParseAttributeListDecl ()</h3>
 <pre class="programlisting">void       xmlParseAttributeListDecl       (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>: parse the Attribute list def for an element [52] AttlistDecl ::= '&lt;!ATTLIST' S Name AttDef* S? '&gt;' [53] AttDef ::= S Name S AttType S DefaultDecl</p>
+<p>DEPRECATED: Internal function, don't use. Parse an <a href="libxml2-SAX.html#attribute">attribute</a> list declaration for an element. Always consumes '&lt;!'. [52] AttlistDecl ::= '&lt;!ATTLIST' S Name AttDef* S? '&gt;' [53] AttDef ::= S Name S AttType S DefaultDecl</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
@@ -1358,7 +1262,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseAttributeType"></a>xmlParseAttributeType ()</h3>
 <pre class="programlisting">int        xmlParseAttributeType           (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                    <a href="libxml2-tree.html#xmlEnumerationPtr">xmlEnumerationPtr</a> * tree)<br>
 </pre>
-<p>parse the Attribute list def for an element [54] AttType ::= StringType | TokenizedType | EnumeratedType [55] StringType ::= 'CDATA' [56] TokenizedType ::= 'ID' | 'IDREF' | 'IDREFS' | 'ENTITY' | 'ENTITIES' | 'NMTOKEN' | 'NMTOKENS' Validity constraints for <a href="libxml2-SAX.html#attribute">attribute</a> values syntax are checked in xmlValidateAttributeValue() [ VC: ID ] Values of type ID must match the Name production. A name must not appear more than once in an XML document as a value of this type; i.e., ID values must uniquely identify the elements which bear them. [ VC: One ID per Element Type ] No element type may have more than one ID <a href="libxml2-SAX.html#attribute">attribute</a> specified. [ VC: ID Attribute Default ] An ID <a href="libxml2-SAX.html#attribute">attribute</a> must have a declared default of #IMPLIED or #REQUIRED. [ VC: IDREF ] Values of type IDREF must match the Name production, and values of type IDREFS must match Names; each IDREF Name must match the value of an ID <a href="libxml2-SAX.html#attribute">attribute</a> on some element in the XML document; i.e. IDREF values must match the value of some ID attribute. [ VC: Entity Name ] Values of type ENTITY must match the Name production, values of type ENTITIES must match Names; each Entity Name must match the name of an unparsed entity declared in the DTD. [ VC: Name Token ] Values of type NMTOKEN must match the Nmtoken production; values of type NMTOKENS must match Nmtokens.</p>
+<p>DEPRECATED: Internal function, don't use. parse the Attribute list def for an element [54] AttType ::= StringType | TokenizedType | EnumeratedType [55] StringType ::= 'CDATA' [56] TokenizedType ::= 'ID' | 'IDREF' | 'IDREFS' | 'ENTITY' | 'ENTITIES' | 'NMTOKEN' | 'NMTOKENS' Validity constraints for <a href="libxml2-SAX.html#attribute">attribute</a> values syntax are checked in xmlValidateAttributeValue() [ VC: ID ] Values of type ID must match the Name production. A name must not appear more than once in an XML document as a value of this type; i.e., ID values must uniquely identify the elements which bear them. [ VC: One ID per Element Type ] No element type may have more than one ID <a href="libxml2-SAX.html#attribute">attribute</a> specified. [ VC: ID Attribute Default ] An ID <a href="libxml2-SAX.html#attribute">attribute</a> must have a declared default of #IMPLIED or #REQUIRED. [ VC: IDREF ] Values of type IDREF must match the Name production, and values of type IDREFS must match Names; each IDREF Name must match the value of an ID <a href="libxml2-SAX.html#attribute">attribute</a> on some element in the XML document; i.e. IDREF values must match the value of some ID <a href="libxml2-SAX.html#attribute">attribute</a>. [ VC: Entity Name ] Values of type ENTITY must match the Name production, values of type ENTITIES must match Names; each Entity Name must match the name of an unparsed entity declared in the DTD. [ VC: Name Token ] Values of type NMTOKEN must match the Nmtoken production; values of type NMTOKENS must match Nmtokens.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1383,7 +1287,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseCDSect"></a>xmlParseCDSect ()</h3>
 <pre class="programlisting">void       xmlParseCDSect                  (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>Parse escaped pure raw content. [18] CDSect ::= CDStart CData CDEnd [19] CDStart ::= '&lt;![CDATA[' [20] Data ::= (Char* - (Char* ']]&gt;' Char*)) [21] CDEnd ::= ']]&gt;'</p>
+<p>DEPRECATED: Internal function, don't use. Parse escaped pure raw content. Always consumes '&lt;!['. [18] CDSect ::= CDStart CData CDEnd [19] CDStart ::= '&lt;![CDATA[' [20] Data ::= (Char* - (Char* ']]&gt;' Char*)) [21] CDEnd ::= ']]&gt;'</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
@@ -1398,7 +1302,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseCharData"></a>xmlParseCharData ()</h3>
 <pre class="programlisting">void       xmlParseCharData                (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                    int cdata)<br>
 </pre>
-<p>parse a CharData section. if we are within a CDATA section ']]&gt;' marks an end of section. The right angle bracket (&gt;) may be represented using the string "&amp;gt;", and must, for compatibility, be escaped using "&amp;gt;" or a character <a href="libxml2-SAX.html#reference">reference</a> when it appears in the string "]]&gt;" in content, when that string is not marking the end of a CDATA section. [14] CharData ::= [^&lt;&amp;]* - ([^&lt;&amp;]* ']]&gt;' [^&lt;&amp;]*)</p>
+<p>DEPRECATED: Internal function, don't use. Parse character data. Always makes progress if the first char isn't '&lt;' or '&amp;'. if we are within a CDATA section ']]&gt;' marks an end of section. The right angle bracket (&gt;) may be represented using the string "&amp;gt;", and must, for compatibility, be escaped using "&amp;gt;" or a character <a href="libxml2-SAX.html#reference">reference</a> when it appears in the string "]]&gt;" in content, when that string is not marking the end of a CDATA section. [14] CharData ::= [^&lt;&amp;]* - ([^&lt;&amp;]* ']]&gt;' [^&lt;&amp;]*)</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1408,7 +1312,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 </tr>
 <tr>
 <td><span class="term"><i><tt>cdata</tt></i>:</span></td>
-<td>int indicating whether we are within a CDATA section</td>
+<td>unused</td>
 </tr>
 </tbody>
 </table></div>
@@ -1419,7 +1323,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseCharRef"></a>xmlParseCharRef ()</h3>
 <pre class="programlisting">int        xmlParseCharRef                 (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse Reference declarations [66] CharRef ::= '&amp;#' [0-9]+ ';' | '&amp;#x' [0-9a-fA-F]+ ';' [ WFC: Legal Character ] Characters referred to using character references must match the production for Char.</p>
+<p>DEPRECATED: Internal function, don't use. Parse a numeric character <a href="libxml2-SAX.html#reference">reference</a>. Always consumes '&amp;'. [66] CharRef ::= '&amp;#' [0-9]+ ';' | '&amp;#x' [0-9a-fA-F]+ ';' [ WFC: Legal Character ] Characters referred to using character references must match the production for Char.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1440,7 +1344,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseComment"></a>xmlParseComment ()</h3>
 <pre class="programlisting">void       xmlParseComment                 (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>Skip an XML (SGML) <a href="libxml2-SAX.html#comment">comment</a> &lt;!-- .... --&gt; The spec says that "For compatibility, the string "--" (double-hyphen) must not occur within comments. " [15] Comment ::= '&lt;!--' ((Char - '-') | ('-' (Char - '-')))* '--&gt;'</p>
+<p>DEPRECATED: Internal function, don't use. Parse an XML (SGML) <a href="libxml2-SAX.html#comment">comment</a>. Always consumes '&lt;!'. The spec says that "For compatibility, the string "--" (double-hyphen) must not occur within comments. " [15] Comment ::= '&lt;!--' ((Char - '-') | ('-' (Char - '-')))* '--&gt;'</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
@@ -1470,7 +1374,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseDefaultDecl"></a>xmlParseDefaultDecl ()</h3>
 <pre class="programlisting">int        xmlParseDefaultDecl             (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                    <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** value)<br>
 </pre>
-<p>Parse an <a href="libxml2-SAX.html#attribute">attribute</a> default declaration [60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue) [ VC: Required Attribute ] if the default declaration is the keyword #REQUIRED, then the <a href="libxml2-SAX.html#attribute">attribute</a> must be specified for all elements of the type in the attribute-list declaration. [ VC: Attribute Default Legal ] The declared default value must meet the lexical constraints of the declared <a href="libxml2-SAX.html#attribute">attribute</a> type c.f. xmlValidateAttributeDecl() [ VC: Fixed Attribute Default ] if an <a href="libxml2-SAX.html#attribute">attribute</a> has a default value declared with the #FIXED keyword, instances of that <a href="libxml2-SAX.html#attribute">attribute</a> must match the default value. [ WFC: No &lt; in Attribute Values ] handled in xmlParseAttValue()</p>
+<p>DEPRECATED: Internal function, don't use. Parse an <a href="libxml2-SAX.html#attribute">attribute</a> default declaration [60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue) [ VC: Required Attribute ] if the default declaration is the keyword #REQUIRED, then the <a href="libxml2-SAX.html#attribute">attribute</a> must be specified for all elements of the type in the attribute-list declaration. [ VC: Attribute Default Legal ] The declared default value must meet the lexical constraints of the declared <a href="libxml2-SAX.html#attribute">attribute</a> type c.f. xmlValidateAttributeDecl() [ VC: Fixed Attribute Default ] if an <a href="libxml2-SAX.html#attribute">attribute</a> has a default value declared with the #FIXED keyword, instances of that <a href="libxml2-SAX.html#attribute">attribute</a> must match the default value. [ WFC: No &lt; in Attribute Values ] handled in xmlParseAttValue()</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1485,7 +1389,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 </tr>
 <tr>
 <td><span class="term"><i><tt>Returns</tt></i>:</span></td>
-<td>XML_ATTRIBUTE_NONE, XML_ATTRIBUTE_REQUIRED, <a href="libxml2-tree.html#XML_ATTRIBUTE_IMPLIED">XML_ATTRIBUTE_IMPLIED</a> or XML_ATTRIBUTE_FIXED.</td>
+<td>XML_ATTRIBUTE_NONE, XML_ATTRIBUTE_REQUIRED, <a href="libxml2-tree.html#XML_ATTRIBUTE_IMPLIED">XML_ATTRIBUTE_IMPLIED</a> or <a href="libxml2-tree.html#XML_ATTRIBUTE_FIXED">XML_ATTRIBUTE_FIXED</a>.</td>
 </tr>
 </tbody>
 </table></div>
@@ -1496,7 +1400,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseDocTypeDecl"></a>xmlParseDocTypeDecl ()</h3>
 <pre class="programlisting">void       xmlParseDocTypeDecl             (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse a DOCTYPE declaration [28] doctypedecl ::= '&lt;!DOCTYPE' S Name (S ExternalID)? S? ('[' (markupdecl | PEReference | S)* ']' S?)? '&gt;' [ VC: Root Element Type ] The Name in the document type declaration must match the element type of the root element.</p>
+<p>DEPRECATED: Internal function, don't use. parse a DOCTYPE declaration [28] doctypedecl ::= '&lt;!DOCTYPE' S Name (S ExternalID)? S? ('[' (markupdecl | PEReference | S)* ']' S?)? '&gt;' [ VC: Root Element Type ] The Name in the document type declaration must match the element type of the root element.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
@@ -1511,7 +1415,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseElement"></a>xmlParseElement ()</h3>
 <pre class="programlisting">void       xmlParseElement                 (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse an XML element [39] element ::= EmptyElemTag | STag content ETag [ WFC: Element Type Match ] The Name in an element's end-tag must match the element type in the start-tag.</p>
+<p>DEPRECATED: Internal function, don't use. parse an XML element [39] element ::= EmptyElemTag | STag content ETag [ WFC: Element Type Match ] The Name in an element's end-tag must match the element type in the start-tag.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
@@ -1526,7 +1430,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseElementChildrenContentDecl"></a>xmlParseElementChildrenContentDecl ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlElementContentPtr">xmlElementContentPtr</a>  xmlParseElementChildrenContentDecl      (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                                    int inputchk)<br>
 </pre>
-<p>parse the declaration for a Mixed Element content The leading '(' and spaces have been skipped in <a href="libxml2-parserInternals.html#xmlParseElementContentDecl">xmlParseElementContentDecl</a> [47] children ::= (choice | seq) ('?' | '*' | '+')? [48] cp ::= (Name | choice | seq) ('?' | '*' | '+')? [49] choice ::= '(' S? cp ( S? '|' S? cp )* S? ')' [50] seq ::= '(' S? cp ( S? ',' S? cp )* S? ')' [ VC: Proper Group/PE Nesting ] applies to [49] and [50] TODO Parameter-entity replacement text must be properly nested with parenthesized groups. That is to say, if either of the opening or closing parentheses in a choice, seq, or Mixed construct is contained in the replacement text for a parameter entity, both must be contained in the same replacement text. For interoperability, if a parameter-entity <a href="libxml2-SAX.html#reference">reference</a> appears in a choice, seq, or Mixed construct, its replacement text should not be empty, and neither the first nor last non-blank character of the replacement text should be a connector (| or ,).</p>
+<p>DEPRECATED: Internal function, don't use. parse the declaration for a Mixed Element content The leading '(' and spaces have been skipped in <a href="libxml2-parserInternals.html#xmlParseElementContentDecl">xmlParseElementContentDecl</a> [47] children ::= (choice | seq) ('?' | '*' | '+')? [48] cp ::= (Name | choice | seq) ('?' | '*' | '+')? [49] choice ::= '(' S? cp ( S? '|' S? cp )* S? ')' [50] seq ::= '(' S? cp ( S? ',' S? cp )* S? ')' [ VC: Proper Group/PE Nesting ] applies to [49] and [50] TODO Parameter-entity replacement text must be properly nested with parenthesized groups. That is to say, if either of the opening or closing parentheses in a choice, seq, or Mixed construct is contained in the replacement text for a parameter entity, both must be contained in the same replacement text. For interoperability, if a parameter-entity <a href="libxml2-SAX.html#reference">reference</a> appears in a choice, seq, or Mixed construct, its replacement text should not be empty, and neither the first nor last non-blank character of the replacement text should be a connector (| or ,).</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1551,7 +1455,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseElementContentDecl"></a>xmlParseElementContentDecl ()</h3>
 <pre class="programlisting">int        xmlParseElementContentDecl      (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                    const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br>                                         <a href="libxml2-tree.html#xmlElementContentPtr">xmlElementContentPtr</a> * result)<br>
 </pre>
-<p>parse the declaration for an Element content either Mixed or Children, the cases EMPTY and ANY are handled directly in <a href="libxml2-parserInternals.html#xmlParseElementDecl">xmlParseElementDecl</a> [46] contentspec ::= 'EMPTY' | 'ANY' | Mixed | children</p>
+<p>DEPRECATED: Internal function, don't use. parse the declaration for an Element content either Mixed or Children, the cases EMPTY and ANY are handled directly in <a href="libxml2-parserInternals.html#xmlParseElementDecl">xmlParseElementDecl</a> [46] contentspec ::= 'EMPTY' | 'ANY' | Mixed | children</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1580,7 +1484,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseElementDecl"></a>xmlParseElementDecl ()</h3>
 <pre class="programlisting">int        xmlParseElementDecl             (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse an Element declaration. [45] elementdecl ::= '&lt;!ELEMENT' S Name S contentspec S? '&gt;' [ VC: Unique Element Type Declaration ] No element type may be declared more than once</p>
+<p>DEPRECATED: Internal function, don't use. Parse an element declaration. Always consumes '&lt;!'. [45] elementdecl ::= '&lt;!ELEMENT' S Name S contentspec S? '&gt;' [ VC: Unique Element Type Declaration ] No element type may be declared more than once</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1601,7 +1505,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseElementMixedContentDecl"></a>xmlParseElementMixedContentDecl ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlElementContentPtr">xmlElementContentPtr</a>  xmlParseElementMixedContentDecl (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                                    int inputchk)<br>
 </pre>
-<p>parse the declaration for a Mixed Element content The leading '(' and spaces have been skipped in <a href="libxml2-parserInternals.html#xmlParseElementContentDecl">xmlParseElementContentDecl</a> [51] Mixed ::= '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*' | '(' S? '#PCDATA' S? ')' [ VC: Proper Group/PE Nesting ] applies to [51] too (see [49]) [ VC: No Duplicate Types ] The same name must not appear more than once in a single mixed-content declaration.</p>
+<p>DEPRECATED: Internal function, don't use. parse the declaration for a Mixed Element content The leading '(' and spaces have been skipped in <a href="libxml2-parserInternals.html#xmlParseElementContentDecl">xmlParseElementContentDecl</a> [51] Mixed ::= '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*' | '(' S? '#PCDATA' S? ')' [ VC: Proper Group/PE Nesting ] applies to [51] too (see [49]) [ VC: No Duplicate Types ] The same name must not appear more than once in a single mixed-content declaration.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1626,7 +1530,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseEncName"></a>xmlParseEncName ()</h3>
 <pre class="programlisting"><a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *     xmlParseEncName         (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse the XML encoding name [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*</p>
+<p>DEPRECATED: Internal function, don't use. parse the XML encoding name [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1647,7 +1551,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseEncodingDecl"></a>xmlParseEncodingDecl ()</h3>
 <pre class="programlisting">const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *       xmlParseEncodingDecl    (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse the XML encoding declaration [80] EncodingDecl ::= S 'encoding' Eq ('"' EncName '"' | "'" EncName "'") this setups the conversion filters.</p>
+<p>DEPRECATED: Internal function, don't use. parse the XML encoding declaration [80] EncodingDecl ::= S 'encoding' Eq ('"' EncName '"' | "'" EncName "'") this setups the conversion filters.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1668,7 +1572,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseEndTag"></a>xmlParseEndTag ()</h3>
 <pre class="programlisting">void       xmlParseEndTag                  (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse an end of tag [42] ETag ::= '&lt;/' Name S? '&gt;' With namespace [NS 9] ETag ::= '&lt;/' QName S? '&gt;'</p>
+<p>DEPRECATED: Internal function, don't use. parse an end of tag [42] ETag ::= '&lt;/' Name S? '&gt;' With namespace [NS 9] ETag ::= '&lt;/' QName S? '&gt;'</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
@@ -1683,7 +1587,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseEntityDecl"></a>xmlParseEntityDecl ()</h3>
 <pre class="programlisting">void       xmlParseEntityDecl              (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse &lt;!ENTITY declarations [70] EntityDecl ::= GEDecl | PEDecl [71] GEDecl ::= '&lt;!ENTITY' S Name S EntityDef S? '&gt;' [72] PEDecl ::= '&lt;!ENTITY' S '%' S Name S PEDef S? '&gt;' [73] EntityDef ::= EntityValue | (ExternalID NDataDecl?) [74] PEDef ::= EntityValue | ExternalID [76] NDataDecl ::= S 'NDATA' S Name [ VC: Notation Declared ] The Name must match the declared name of a notation.</p>
+<p>DEPRECATED: Internal function, don't use. Parse an entity declaration. Always consumes '&lt;!'. [70] EntityDecl ::= GEDecl | PEDecl [71] GEDecl ::= '&lt;!ENTITY' S Name S EntityDef S? '&gt;' [72] PEDecl ::= '&lt;!ENTITY' S '%' S Name S PEDef S? '&gt;' [73] EntityDef ::= EntityValue | (ExternalID NDataDecl?) [74] PEDef ::= EntityValue | ExternalID [76] NDataDecl ::= S 'NDATA' S Name [ VC: Notation Declared ] The Name must match the declared name of a notation.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
@@ -1698,7 +1602,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseEntityRef"></a>xmlParseEntityRef ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlEntityPtr">xmlEntityPtr</a>  xmlParseEntityRef       (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse ENTITY references declarations [68] EntityRef ::= '&amp;' Name ';' [ WFC: Entity Declared ] In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with "standalone='yes'", the Name given in the entity <a href="libxml2-SAX.html#reference">reference</a> must match that in an entity declaration, except that well-formed documents need not declare any of the following entities: amp, lt, gt, apos, quot. The declaration of a parameter entity must precede any <a href="libxml2-SAX.html#reference">reference</a> to it. Similarly, the declaration of a general entity must precede any <a href="libxml2-SAX.html#reference">reference</a> to it which appears in a default value in an attribute-list declaration. Note that if entities are declared in the external subset or in external parameter entities, a non-validating processor is not obligated to read and process their declarations; for such documents, the rule that an entity must be declared is a well-formedness constraint only if standalone='yes'. [ WFC: Parsed Entity ] An entity <a href="libxml2-SAX.html#reference">reference</a> must not contain the name of an unparsed entity</p>
+<p>DEPRECATED: Internal function, don't use. Parse an entitiy <a href="libxml2-SAX.html#reference">reference</a>. Always consumes '&amp;'. [68] EntityRef ::= '&amp;' Name ';' [ WFC: Entity Declared ] In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with "standalone='yes'", the Name given in the entity <a href="libxml2-SAX.html#reference">reference</a> must match that in an entity declaration, except that well-formed documents need not declare any of the following entities: amp, lt, gt, apos, quot. The declaration of a parameter entity must precede any <a href="libxml2-SAX.html#reference">reference</a> to it. Similarly, the declaration of a general entity must precede any <a href="libxml2-SAX.html#reference">reference</a> to it which appears in a default value in an attribute-list declaration. Note that if entities are declared in the external subset or in external parameter entities, a non-validating processor is not obligated to read and process their declarations; for such documents, the rule that an entity must be declared is a well-formedness constraint only if standalone='yes'. [ WFC: Parsed Entity ] An entity <a href="libxml2-SAX.html#reference">reference</a> must not contain the name of an unparsed entity</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1719,7 +1623,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseEntityValue"></a>xmlParseEntityValue ()</h3>
 <pre class="programlisting"><a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *     xmlParseEntityValue     (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                    <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** orig)<br>
 </pre>
-<p>parse a value for ENTITY declarations [9] EntityValue ::= '"' ([^%&amp;"] | PEReference | Reference)* '"' | "'" ([^%&amp;'] | PEReference | Reference)* "'"</p>
+<p>DEPRECATED: Internal function, don't use. parse a value for ENTITY declarations [9] EntityValue ::= '"' ([^%&amp;"] | PEReference | Reference)* '"' | "'" ([^%&amp;'] | PEReference | Reference)* "'"</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1744,7 +1648,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseEnumeratedType"></a>xmlParseEnumeratedType ()</h3>
 <pre class="programlisting">int        xmlParseEnumeratedType          (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                    <a href="libxml2-tree.html#xmlEnumerationPtr">xmlEnumerationPtr</a> * tree)<br>
 </pre>
-<p>parse an Enumerated <a href="libxml2-SAX.html#attribute">attribute</a> type. [57] EnumeratedType ::= NotationType | Enumeration [58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')'</p>
+<p>DEPRECATED: Internal function, don't use. parse an Enumerated <a href="libxml2-SAX.html#attribute">attribute</a> type. [57] EnumeratedType ::= NotationType | Enumeration [58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')'</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1771,7 +1675,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseEnumerationType"></a>xmlParseEnumerationType ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlEnumerationPtr">xmlEnumerationPtr</a>        xmlParseEnumerationType (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse an Enumeration <a href="libxml2-SAX.html#attribute">attribute</a> type. [59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')' [ VC: Enumeration ] Values of this type must match one of the Nmtoken tokens in the declaration</p>
+<p>DEPRECATED: Internal function, don't use. parse an Enumeration <a href="libxml2-SAX.html#attribute">attribute</a> type. [59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')' [ VC: Enumeration ] Values of this type must match one of the Nmtoken tokens in the declaration</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1792,7 +1696,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseExternalID"></a>xmlParseExternalID ()</h3>
 <pre class="programlisting"><a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *     xmlParseExternalID      (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                    <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> ** publicID, <br>                                  int strict)<br>
 </pre>
-<p>Parse an External ID or a Public ID NOTE: Productions [75] and [83] interact badly since [75] can generate 'PUBLIC' S PubidLiteral S SystemLiteral [75] ExternalID ::= 'SYSTEM' S SystemLiteral | 'PUBLIC' S PubidLiteral S SystemLiteral [83] PublicID ::= 'PUBLIC' S PubidLiteral</p>
+<p>DEPRECATED: Internal function, don't use. Parse an External ID or a Public ID NOTE: Productions [75] and [83] interact badly since [75] can generate 'PUBLIC' S PubidLiteral S SystemLiteral [75] ExternalID ::= 'SYSTEM' S SystemLiteral | 'PUBLIC' S PubidLiteral S SystemLiteral [83] PublicID ::= 'PUBLIC' S PubidLiteral</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1846,7 +1750,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseMarkupDecl"></a>xmlParseMarkupDecl ()</h3>
 <pre class="programlisting">void       xmlParseMarkupDecl              (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse Markup declarations [29] markupdecl ::= elementdecl | AttlistDecl | EntityDecl | NotationDecl | PI | Comment [ VC: Proper Declaration/PE Nesting ] Parameter-entity replacement text must be properly nested with markup declarations. That is to say, if either the first character or the last character of a markup declaration (markupdecl above) is contained in the replacement text for a parameter-entity reference, both must be contained in the same replacement text. [ WFC: PEs in Internal Subset ] In the internal DTD subset, parameter-entity references can occur only where markup declarations can occur, not within markup declarations. (This does not apply to references that occur in external parameter entities or to the external subset.)</p>
+<p>DEPRECATED: Internal function, don't use. Parse markup declarations. Always consumes '&lt;!' or '&lt;?'. [29] markupdecl ::= elementdecl | AttlistDecl | EntityDecl | NotationDecl | PI | Comment [ VC: Proper Declaration/PE Nesting ] Parameter-entity replacement text must be properly nested with markup declarations. That is to say, if either the first character or the last character of a markup declaration (markupdecl above) is contained in the replacement text for a parameter-entity reference, both must be contained in the same replacement text. [ WFC: PEs in Internal Subset ] In the internal DTD subset, parameter-entity references can occur only where markup declarations can occur, not within markup declarations. (This does not apply to references that occur in external parameter entities or to the external subset.)</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
@@ -1861,7 +1765,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseMisc"></a>xmlParseMisc ()</h3>
 <pre class="programlisting">void       xmlParseMisc                    (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse an XML Misc* optional field. [27] Misc ::= Comment | PI | S</p>
+<p>DEPRECATED: Internal function, don't use. parse an XML Misc* optional field. [27] Misc ::= Comment | PI | S</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
@@ -1876,7 +1780,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseName"></a>xmlParseName ()</h3>
 <pre class="programlisting">const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *       xmlParseName            (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse an XML name. [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender [5] Name ::= (Letter | '_' | ':') (NameChar)* [6] Names ::= Name (#x20 Name)*</p>
+<p>DEPRECATED: Internal function, don't use. parse an XML name. [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender [5] Name ::= (Letter | '_' | ':') (NameChar)* [6] Names ::= Name (#x20 Name)*</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1912,7 +1816,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseNmtoken"></a>xmlParseNmtoken ()</h3>
 <pre class="programlisting"><a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *     xmlParseNmtoken         (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse an XML Nmtoken. [7] Nmtoken ::= (NameChar)+ [8] Nmtokens ::= Nmtoken (#x20 Nmtoken)*</p>
+<p>DEPRECATED: Internal function, don't use. parse an XML Nmtoken. [7] Nmtoken ::= (NameChar)+ [8] Nmtokens ::= Nmtoken (#x20 Nmtoken)*</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1933,7 +1837,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseNotationDecl"></a>xmlParseNotationDecl ()</h3>
 <pre class="programlisting">void       xmlParseNotationDecl            (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse a notation declaration [82] NotationDecl ::= '&lt;!NOTATION' S Name S (ExternalID | PublicID) S? '&gt;' Hence there is actually 3 choices: 'PUBLIC' S PubidLiteral 'PUBLIC' S PubidLiteral S SystemLiteral and 'SYSTEM' S SystemLiteral See the NOTE on xmlParseExternalID().</p>
+<p>DEPRECATED: Internal function, don't use. Parse a notation declaration. Always consumes '&lt;!'. [82] NotationDecl ::= '&lt;!NOTATION' S Name S (ExternalID | PublicID) S? '&gt;' Hence there is actually 3 choices: 'PUBLIC' S PubidLiteral 'PUBLIC' S PubidLiteral S SystemLiteral and 'SYSTEM' S SystemLiteral See the NOTE on xmlParseExternalID().</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
@@ -1948,7 +1852,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseNotationType"></a>xmlParseNotationType ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlEnumerationPtr">xmlEnumerationPtr</a>        xmlParseNotationType    (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse an Notation <a href="libxml2-SAX.html#attribute">attribute</a> type. Note: the leading 'NOTATION' S part has already being parsed... [58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')' [ VC: Notation Attributes ] Values of this type must match one of the notation names included in the declaration; all notation names in the declaration must be declared.</p>
+<p>DEPRECATED: Internal function, don't use. parse an Notation <a href="libxml2-SAX.html#attribute">attribute</a> type. Note: the leading 'NOTATION' S part has already being parsed... [58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')' [ VC: Notation Attributes ] Values of this type must match one of the notation names included in the declaration; all notation names in the declaration must be declared.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1969,7 +1873,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParsePEReference"></a>xmlParsePEReference ()</h3>
 <pre class="programlisting">void       xmlParsePEReference             (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse PEReference declarations The entity content is handled directly by pushing it's content as a new input stream. [69] PEReference ::= '%' Name ';' [ WFC: No Recursion ] A parsed entity must not contain a recursive <a href="libxml2-SAX.html#reference">reference</a> to itself, either directly or indirectly. [ WFC: Entity Declared ] In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with "standalone='yes'", ... ... The declaration of a parameter entity must precede any <a href="libxml2-SAX.html#reference">reference</a> to it... [ VC: Entity Declared ] In a document with an external subset or external parameter entities with "standalone='no'", ... ... The declaration of a parameter entity must precede any <a href="libxml2-SAX.html#reference">reference</a> to it... [ WFC: In DTD ] Parameter-entity references may only appear in the DTD. NOTE: misleading but this is handled.</p>
+<p>DEPRECATED: Internal function, don't use. Parse a parameter entity <a href="libxml2-SAX.html#reference">reference</a>. Always consumes '%'. The entity content is handled directly by pushing it's content as a new input stream. [69] PEReference ::= '%' Name ';' [ WFC: No Recursion ] A parsed entity must not contain a recursive <a href="libxml2-SAX.html#reference">reference</a> to itself, either directly or indirectly. [ WFC: Entity Declared ] In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with "standalone='yes'", ... ... The declaration of a parameter entity must precede any <a href="libxml2-SAX.html#reference">reference</a> to it... [ VC: Entity Declared ] In a document with an external subset or external parameter entities with "standalone='no'", ... ... The declaration of a parameter entity must precede any <a href="libxml2-SAX.html#reference">reference</a> to it... [ WFC: In DTD ] Parameter-entity references may only appear in the DTD. NOTE: misleading but this is handled.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
@@ -1984,7 +1888,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParsePI"></a>xmlParsePI ()</h3>
 <pre class="programlisting">void       xmlParsePI                      (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse an XML Processing Instruction. [16] PI ::= '&lt;?' PITarget (S (Char* - (Char* '?&gt;' Char*)))? '?&gt;' The processing is transferred to SAX once parsed.</p>
+<p>DEPRECATED: Internal function, don't use. parse an XML Processing Instruction. [16] PI ::= '&lt;?' PITarget (S (Char* - (Char* '?&gt;' Char*)))? '?&gt;' The processing is transferred to SAX once parsed.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
@@ -1999,7 +1903,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParsePITarget"></a>xmlParsePITarget ()</h3>
 <pre class="programlisting">const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *       xmlParsePITarget        (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse the name of a PI [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))</p>
+<p>DEPRECATED: Internal function, don't use. parse the name of a PI [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2020,7 +1924,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParsePubidLiteral"></a>xmlParsePubidLiteral ()</h3>
 <pre class="programlisting"><a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *     xmlParsePubidLiteral    (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse an XML public literal [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"</p>
+<p>DEPRECATED: Internal function, don't use. parse an XML public literal [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2062,7 +1966,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseReference"></a>xmlParseReference ()</h3>
 <pre class="programlisting">void       xmlParseReference               (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse and handle entity references in content, depending on the SAX interface, this may end-up in a call to character() if this is a CharRef, a predefined entity, if there is no reference() callback. or if the parser was asked to switch to that mode. [67] Reference ::= EntityRef | CharRef</p>
+<p>DEPRECATED: Internal function, don't use. parse and handle entity references in content, depending on the SAX interface, this may end-up in a call to character() if this is a CharRef, a predefined entity, if there is no reference() callback. or if the parser was asked to switch to that mode. Always consumes '&amp;'. [67] Reference ::= EntityRef | CharRef</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
@@ -2077,7 +1981,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseSDDecl"></a>xmlParseSDDecl ()</h3>
 <pre class="programlisting">int        xmlParseSDDecl                  (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse the XML standalone declaration [32] SDDecl ::= S 'standalone' Eq (("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no')'"')) [ VC: Standalone Document Declaration ] TODO The standalone document declaration must have the value "no" if any external markup declarations contain declarations of: - attributes with default values, if elements to which these attributes apply appear in the document without specifications of values for these attributes, or - entities (other than amp, lt, gt, apos, quot), if references to those entities appear in the document, or - attributes with values subject to normalization, where the <a href="libxml2-SAX.html#attribute">attribute</a> appears in the document with a value which will change as a result of normalization, or - element types with element content, if white space occurs directly within any instance of those types.</p>
+<p>DEPRECATED: Internal function, don't use. parse the XML standalone declaration [32] SDDecl ::= S 'standalone' Eq (("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no')'"')) [ VC: Standalone Document Declaration ] TODO The standalone document declaration must have the value "no" if any external markup declarations contain declarations of: - attributes with default values, if elements to which these attributes apply appear in the document without specifications of values for these attributes, or - entities (other than amp, lt, gt, apos, quot), if references to those entities appear in the document, or - attributes with values subject to normalization, where the <a href="libxml2-SAX.html#attribute">attribute</a> appears in the document with a value which will change as a result of normalization, or - element types with element content, if white space occurs directly within any instance of those types.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2098,7 +2002,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseStartTag"></a>xmlParseStartTag ()</h3>
 <pre class="programlisting">const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *       xmlParseStartTag        (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse a start of tag either for rule element or EmptyElement. In both case we don't parse the tag closing chars. [40] STag ::= '&lt;' Name (S Attribute)* S? '&gt;' [ WFC: Unique Att Spec ] No <a href="libxml2-SAX.html#attribute">attribute</a> name may appear more than once in the same start-tag or empty-element tag. [44] EmptyElemTag ::= '&lt;' Name (S Attribute)* S? '/&gt;' [ WFC: Unique Att Spec ] No <a href="libxml2-SAX.html#attribute">attribute</a> name may appear more than once in the same start-tag or empty-element tag. With namespace: [NS 8] STag ::= '&lt;' QName (S Attribute)* S? '&gt;' [NS 10] EmptyElement ::= '&lt;' QName (S Attribute)* S? '/&gt;'</p>
+<p>DEPRECATED: Internal function, don't use. Parse a start tag. Always consumes '&lt;'. [40] STag ::= '&lt;' Name (S Attribute)* S? '&gt;' [ WFC: Unique Att Spec ] No <a href="libxml2-SAX.html#attribute">attribute</a> name may appear more than once in the same start-tag or empty-element tag. [44] EmptyElemTag ::= '&lt;' Name (S Attribute)* S? '/&gt;' [ WFC: Unique Att Spec ] No <a href="libxml2-SAX.html#attribute">attribute</a> name may appear more than once in the same start-tag or empty-element tag. With namespace: [NS 8] STag ::= '&lt;' QName (S Attribute)* S? '&gt;' [NS 10] EmptyElement ::= '&lt;' QName (S Attribute)* S? '/&gt;'</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2119,7 +2023,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseSystemLiteral"></a>xmlParseSystemLiteral ()</h3>
 <pre class="programlisting"><a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *     xmlParseSystemLiteral   (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse an XML Literal [11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'")</p>
+<p>DEPRECATED: Internal function, don't use. parse an XML Literal [11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'")</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2140,7 +2044,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseTextDecl"></a>xmlParseTextDecl ()</h3>
 <pre class="programlisting">void       xmlParseTextDecl                (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse an XML declaration header for external entities [77] TextDecl ::= '&lt;?xml' VersionInfo? EncodingDecl S? '?&gt;'</p>
+<p>DEPRECATED: Internal function, don't use. parse an XML declaration header for external entities [77] TextDecl ::= '&lt;?xml' VersionInfo? EncodingDecl S? '?&gt;'</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
@@ -2155,7 +2059,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseVersionInfo"></a>xmlParseVersionInfo ()</h3>
 <pre class="programlisting"><a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *     xmlParseVersionInfo     (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse the XML version. [24] VersionInfo ::= S 'version' Eq (' VersionNum ' | " VersionNum ") [25] Eq ::= S? '=' S?</p>
+<p>DEPRECATED: Internal function, don't use. parse the XML version. [24] VersionInfo ::= S 'version' Eq (' VersionNum ' | " VersionNum ") [25] Eq ::= S? '=' S?</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2176,7 +2080,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseVersionNum"></a>xmlParseVersionNum ()</h3>
 <pre class="programlisting"><a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *     xmlParseVersionNum      (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse the XML version value. [26] VersionNum ::= '1.' [0-9]+ In practice allow [0-9].[0-9]+ at that level</p>
+<p>DEPRECATED: Internal function, don't use. parse the XML version value. [26] VersionNum ::= '1.' [0-9]+ In practice allow [0-9].[0-9]+ at that level</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2197,7 +2101,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParseXMLDecl"></a>xmlParseXMLDecl ()</h3>
 <pre class="programlisting">void       xmlParseXMLDecl                 (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>parse an XML declaration header [23] XMLDecl ::= '&lt;?xml' VersionInfo EncodingDecl? SDDecl? S? '?&gt;'</p>
+<p>DEPRECATED: Internal function, don't use. parse an XML declaration header [23] XMLDecl ::= '&lt;?xml' VersionInfo EncodingDecl? SDDecl? S? '?&gt;'</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
@@ -2212,7 +2116,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParserHandlePEReference"></a>xmlParserHandlePEReference ()</h3>
 <pre class="programlisting">void       xmlParserHandlePEReference      (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>[69] PEReference ::= '%' Name ';' [ WFC: No Recursion ] A parsed entity must not contain a recursive <a href="libxml2-SAX.html#reference">reference</a> to itself, either directly or indirectly. [ WFC: Entity Declared ] In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with "standalone='yes'", ... ... The declaration of a parameter entity must precede any <a href="libxml2-SAX.html#reference">reference</a> to it... [ VC: Entity Declared ] In a document with an external subset or external parameter entities with "standalone='no'", ... ... The declaration of a parameter entity must precede any <a href="libxml2-SAX.html#reference">reference</a> to it... [ WFC: In DTD ] Parameter-entity references may only appear in the DTD. NOTE: misleading but this is handled. A PEReference may have been detected in the current input stream the handling is done accordingly to http://www.w3.org/TR/REC-xml#entproc i.e. - Included in literal in entity values - Included as Parameter Entity <a href="libxml2-SAX.html#reference">reference</a> within DTDs</p>
+<p>DEPRECATED: Internal function, do not use. [69] PEReference ::= '%' Name ';' [ WFC: No Recursion ] A parsed entity must not contain a recursive <a href="libxml2-SAX.html#reference">reference</a> to itself, either directly or indirectly. [ WFC: Entity Declared ] In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with "standalone='yes'", ... ... The declaration of a parameter entity must precede any <a href="libxml2-SAX.html#reference">reference</a> to it... [ VC: Entity Declared ] In a document with an external subset or external parameter entities with "standalone='no'", ... ... The declaration of a parameter entity must precede any <a href="libxml2-SAX.html#reference">reference</a> to it... [ WFC: In DTD ] Parameter-entity references may only appear in the DTD. NOTE: misleading but this is handled. A PEReference may have been detected in the current input stream the handling is done accordingly to http://www.w3.org/TR/REC-xml#entproc i.e. - Included in literal in entity values - Included as Parameter Entity <a href="libxml2-SAX.html#reference">reference</a> within DTDs</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
@@ -2242,7 +2146,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlParserInputShrink"></a>xmlParserInputShrink ()</h3>
 <pre class="programlisting">void       xmlParserInputShrink            (<a href="libxml2-tree.html#xmlParserInputPtr">xmlParserInputPtr</a> in)<br>
 </pre>
-<p>This function removes used input for the parser.</p>
+<p>DEPRECATED: Don't use. This function removes used input for the parser.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
@@ -2339,7 +2243,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlSkipBlankChars"></a>xmlSkipBlankChars ()</h3>
 <pre class="programlisting">int        xmlSkipBlankChars               (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt)<br>
 </pre>
-<p>skip all blanks character found at that point in the input streams. It pops up finished entities in the process if allowable at that point.</p>
+<p>DEPRECATED: Internal function, do not use. skip all blanks character found at that point in the input streams. It pops up finished entities in the process if allowable at that point.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2389,7 +2293,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlStringCurrentChar"></a>xmlStringCurrentChar ()</h3>
 <pre class="programlisting">int        xmlStringCurrentChar            (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                    const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * cur, <br>                                  int * len)<br>
 </pre>
-<p>The current char value, if using UTF-8 this may actually span multiple bytes in the input buffer.</p>
+<p>DEPRECATED: Internal function, do not use. The current char value, if using UTF-8 this may actually span multiple bytes in the input buffer.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2418,7 +2322,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlStringDecodeEntities"></a>xmlStringDecodeEntities ()</h3>
 <pre class="programlisting"><a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *     xmlStringDecodeEntities (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                    const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * str, <br>                                  int what, <br>                                  <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> end, <br>                                  <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> end2, <br>                                         <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> end3)<br>
 </pre>
-<p>Takes a entity string content and process to do the adequate substitutions. [67] Reference ::= EntityRef | CharRef [69] PEReference ::= '%' Name ';'</p>
+<p>DEPRECATED: Internal function, don't use. Takes a entity string content and process to do the adequate substitutions. [67] Reference ::= EntityRef | CharRef [69] PEReference ::= '%' Name ';'</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2460,7 +2364,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlStringLenDecodeEntities"></a>xmlStringLenDecodeEntities ()</h3>
 <pre class="programlisting"><a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *     xmlStringLenDecodeEntities      (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                            const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * str, <br>                                          int len, <br>                                           int what, <br>                                          <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> end, <br>                                          <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> end2, <br>                                                 <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> end3)<br>
 </pre>
-<p>Takes a entity string content and process to do the adequate substitutions. [67] Reference ::= EntityRef | CharRef [69] PEReference ::= '%' Name ';'</p>
+<p>DEPRECATED: Internal function, don't use. Takes a entity string content and process to do the adequate substitutions. [67] Reference ::= EntityRef | CharRef [69] PEReference ::= '%' Name ';'</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2531,7 +2435,7 @@ int       <a href="#xmlSwitchToEncoding">xmlSwitchToEncoding</a>          (<a href="libxml2-tr
 <a name="xmlSwitchInputEncoding"></a>xmlSwitchInputEncoding ()</h3>
 <pre class="programlisting">int        xmlSwitchInputEncoding          (<a href="libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br>                                    <a href="libxml2-tree.html#xmlParserInputPtr">xmlParserInputPtr</a> input, <br>                                         <a href="libxml2-encoding.html#xmlCharEncodingHandlerPtr">xmlCharEncodingHandlerPtr</a> handler)<br>
 </pre>
-<p>DEPRECATED: Use <a href="libxml2-parserInternals.html#xmlSwitchToEncoding">xmlSwitchToEncoding</a> change the input functions when discovering the character encoding of a given entity.</p>
+<p>change the input functions when discovering the character encoding of a given entity.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
index 4ab52dc..2dcd5b0 100644 (file)
@@ -27,7 +27,6 @@ typedef <a href="libxml2-threads.html#xmlMutex">xmlMutex</a> * <a href="#xmlMute
 typedef struct _xmlRMutex <a href="#xmlRMutex">xmlRMutex</a>;
 typedef <a href="libxml2-threads.html#xmlRMutex">xmlRMutex</a> * <a href="#xmlRMutexPtr">xmlRMutexPtr</a>;
 void   <a href="#xmlCleanupThreads">xmlCleanupThreads</a>              (void);
-int    <a href="#xmlDllMain">xmlDllMain</a>                    (void * hinstDLL, <br>                                   unsigned long fdwReason, <br>                                   void * lpvReserved);
 void   <a href="#xmlFreeMutex">xmlFreeMutex</a>                        (<a href="libxml2-threads.html#xmlMutexPtr">xmlMutexPtr</a> tok);
 void   <a href="#xmlFreeRMutex">xmlFreeRMutex</a>                      (<a href="libxml2-threads.html#xmlRMutexPtr">xmlRMutexPtr</a> tok);
 <a href="libxml2-globals.html#xmlGlobalStatePtr">xmlGlobalStatePtr</a> <a href="#xmlGetGlobalState">xmlGetGlobalState</a>      (void);
@@ -89,36 +88,7 @@ The content of this structure is not made public by the API.
 <a name="xmlCleanupThreads"></a>xmlCleanupThreads ()</h3>
 <pre class="programlisting">void       xmlCleanupThreads               (void)<br>
 </pre>
-<p>DEPRECATED: This function will be made private. Call <a href="libxml2-parser.html#xmlCleanupParser">xmlCleanupParser</a> to free global state but see the warnings there. <a href="libxml2-parser.html#xmlCleanupParser">xmlCleanupParser</a> should be only called once at program exit. In most cases, you don't have call cleanup functions at all. xmlCleanupThreads() is used to to cleanup all the thread related data of the libxml2 library once processing has ended. WARNING: if your application is multithreaded or has plugin support calling this may crash the application if another thread or a plugin is still using libxml2. It's sometimes very hard to guess if libxml2 is in use in the application, some libraries or plugins may use it without notice. In case of doubt abstain from calling this function or do it just before calling exit() to avoid leak reports from valgrind !</p>
-</div>
-<hr>
-<div class="refsect2" lang="en">
-<h3>
-<a name="xmlDllMain"></a>xmlDllMain ()</h3>
-<pre class="programlisting">int        xmlDllMain                      (void * hinstDLL, <br>                                   unsigned long fdwReason, <br>                                   void * lpvReserved)<br>
-</pre>
-<p></p>
-<div class="variablelist"><table border="0">
-<col align="left">
-<tbody>
-<tr>
-<td><span class="term"><i><tt>hinstDLL</tt></i>:</span></td>
-<td></td>
-</tr>
-<tr>
-<td><span class="term"><i><tt>fdwReason</tt></i>:</span></td>
-<td></td>
-</tr>
-<tr>
-<td><span class="term"><i><tt>lpvReserved</tt></i>:</span></td>
-<td></td>
-</tr>
-<tr>
-<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
-<td></td>
-</tr>
-</tbody>
-</table></div>
+<p>DEPRECATED: This function is a no-op. Call <a href="libxml2-parser.html#xmlCleanupParser">xmlCleanupParser</a> to free global state but see the warnings there. <a href="libxml2-parser.html#xmlCleanupParser">xmlCleanupParser</a> should be only called once at program exit. In most cases, you don't have call cleanup functions at all.</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -126,7 +96,7 @@ The content of this structure is not made public by the API.
 <a name="xmlFreeMutex"></a>xmlFreeMutex ()</h3>
 <pre class="programlisting">void       xmlFreeMutex                    (<a href="libxml2-threads.html#xmlMutexPtr">xmlMutexPtr</a> tok)<br>
 </pre>
-<p>xmlFreeMutex() is used to reclaim resources associated with a libxml2 token struct.</p>
+<p>Free a mutex.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
@@ -156,7 +126,7 @@ The content of this structure is not made public by the API.
 <a name="xmlGetGlobalState"></a>xmlGetGlobalState ()</h3>
 <pre class="programlisting"><a href="libxml2-globals.html#xmlGlobalStatePtr">xmlGlobalStatePtr</a>     xmlGetGlobalState       (void)<br>
 </pre>
-<p>xmlGetGlobalState() is called to retrieve the global state for a thread.</p>
+<p>DEPRECATED: Internal function, do not use. xmlGetGlobalState() is called to retrieve the global state for a thread.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
@@ -171,7 +141,7 @@ The content of this structure is not made public by the API.
 <a name="xmlGetThreadId"></a>xmlGetThreadId ()</h3>
 <pre class="programlisting">int        xmlGetThreadId                  (void)<br>
 </pre>
-<p>xmlGetThreadId() find the current thread ID number Note that this is likely to be broken on some platforms using pthreads as the specification doesn't mandate pthread_t to be an integer type</p>
+<p>DEPRECATED: Internal function, do not use. xmlGetThreadId() find the current thread ID number Note that this is likely to be broken on some platforms using pthreads as the specification doesn't mandate pthread_t to be an integer type</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
@@ -186,7 +156,7 @@ The content of this structure is not made public by the API.
 <a name="xmlInitThreads"></a>xmlInitThreads ()</h3>
 <pre class="programlisting">void       xmlInitThreads                  (void)<br>
 </pre>
-<p>DEPRECATED: This function will be made private. Call <a href="libxml2-parser.html#xmlInitParser">xmlInitParser</a> to initialize the library. xmlInitThreads() is used to to initialize all the thread related data of the libxml2 library.</p>
+<p>DEPRECATED: Alias for <a href="libxml2-parser.html#xmlInitParser">xmlInitParser</a>.</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -194,7 +164,7 @@ The content of this structure is not made public by the API.
 <a name="xmlIsMainThread"></a>xmlIsMainThread ()</h3>
 <pre class="programlisting">int        xmlIsMainThread                 (void)<br>
 </pre>
-<p>xmlIsMainThread() check whether the current thread is the main thread.</p>
+<p>DEPRECATED: Internal function, do not use. xmlIsMainThread() check whether the current thread is the main thread.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
index 615abd7..4d4e1eb 100644 (file)
@@ -24,7 +24,6 @@
 <h2>Synopsis</h2>
 <pre class="synopsis">#define <a href="#BASE_BUFFER_SIZE">BASE_BUFFER_SIZE</a>;
 #define <a href="#LIBXML2_NEW_BUFFER">LIBXML2_NEW_BUFFER</a>;
-#define <a href="#XML_DOCB_DOCUMENT_NODE">XML_DOCB_DOCUMENT_NODE</a>;
 #define <a href="#XML_GET_CONTENT">XML_GET_CONTENT</a>;
 #define <a href="#XML_GET_LINE">XML_GET_LINE</a>;
 #define <a href="#XML_LOCAL_NAMESPACE">XML_LOCAL_NAMESPACE</a>;
@@ -269,15 +268,7 @@ int        <a href="#xmlValidateQName">xmlValidateQName</a>                (const <a href="libxml2-xm
 <a name="LIBXML2_NEW_BUFFER">Macro </a>LIBXML2_NEW_BUFFER</h3>
 <pre class="programlisting">#define <a href="#LIBXML2_NEW_BUFFER">LIBXML2_NEW_BUFFER</a>;
 </pre>
-<p>Macro used to express that the API use the new buffers for <a href="libxml2-tree.html#xmlParserInputBuffer">xmlParserInputBuffer</a> and xmlOutputBuffer. The change was introduced in 2.9.0.</p>
-</div>
-<hr>
-<div class="refsect2" lang="en">
-<h3>
-<a name="XML_DOCB_DOCUMENT_NODE">Macro </a>XML_DOCB_DOCUMENT_NODE</h3>
-<pre class="programlisting">#define <a href="#XML_DOCB_DOCUMENT_NODE">XML_DOCB_DOCUMENT_NODE</a>;
-</pre>
-<p></p>
+<p>Macro used to express that the API use the new buffers for <a href="libxml2-tree.html#xmlParserInputBuffer">xmlParserInputBuffer</a> and <a href="libxml2-tree.html#xmlOutputBuffer">xmlOutputBuffer</a>. The change was introduced in 2.9.0.</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -468,7 +459,7 @@ The content of this structure is not made public by the API.
 <pre class="programlisting">enum <a href="#xmlBufferAllocationScheme">xmlBufferAllocationScheme</a> {
     <a name="XML_BUFFER_ALLOC_DOUBLEIT">XML_BUFFER_ALLOC_DOUBLEIT</a> = 1 /* double each time one need to grow */
     <a name="XML_BUFFER_ALLOC_EXACT">XML_BUFFER_ALLOC_EXACT</a> = 2 /* grow only to the minimal size */
-    <a name="XML_BUFFER_ALLOC_IMMUTABLE">XML_BUFFER_ALLOC_IMMUTABLE</a> = 3 /* immutable buffer */
+    <a name="XML_BUFFER_ALLOC_IMMUTABLE">XML_BUFFER_ALLOC_IMMUTABLE</a> = 3 /* immutable buffer, deprecated */
     <a name="XML_BUFFER_ALLOC_IO">XML_BUFFER_ALLOC_IO</a> = 4 /* special allocation scheme used for I/O */
     <a name="XML_BUFFER_ALLOC_HYBRID">XML_BUFFER_ALLOC_HYBRID</a> = 5 /* exact up to a threshold, and doubleit thereafter */
     <a name="XML_BUFFER_ALLOC_BOUNDED">XML_BUFFER_ALLOC_BOUNDED</a> = 6 /*  limit the upper size of the buffer */
@@ -744,7 +735,8 @@ The content of this structure is not made public by the API.
     struct _xmlEntity *        nexte   : unused
     const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *       URI     : the full URI as computed
     int        owner   : does the entity own the childrens
-    int        checked : was the entity content checked this is also used to count entities *
+    int        flags   : various flags
+    unsigned long      expandedSize    : expanded size
 } xmlEntity;
 </pre>
 <p></p>
@@ -994,7 +986,7 @@ The content of this structure is not made public by the API.
     <a href="libxml2-tree.html#xmlAttrPtr">xmlAttrPtr</a>      freeAttrs       : * the complete error information for the last error. *
     <a href="libxml2-xmlerror.html#xmlError">xmlError</a>      lastError
     <a href="libxml2-parser.html#xmlParserMode">xmlParserMode</a>      parseMode       : the parser mode
-    unsigned long      nbentities      : number of entities references
+    unsigned long      nbentities      : unused
     unsigned long      sizeentities    : size of parsed entities for use by HTML non-recursive parser
     <a href="libxml2-parser.html#xmlParserNodeInfo">xmlParserNodeInfo</a> *    nodeInfo        : Current NodeInfo
     int        nodeInfoNr      : Depth of the parsing stack
@@ -1002,6 +994,9 @@ The content of this structure is not made public by the API.
     <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
+    int        endCheckState   : quote state for push parser
+    unsigned short     nbErrors        : number of errors
+    unsigned short     nbWarnings      : number of warnings
 } xmlParserCtxt;
 </pre>
 <p></p>
@@ -1027,13 +1022,15 @@ The content of this structure is not made public by the API.
     const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *       end     : end of the array to parse
     int        length  : length if known
     int        line    : Current line
-    int        col     : * NOTE: consumed is only tested for equality in the parser code, *
+    int        col     : Current column
     unsigned long      consumed        : How many xmlChars already consumed
     <a href="libxml2-parser.html#xmlParserInputDeallocate">xmlParserInputDeallocate</a>        free    : function to deallocate the base
     const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *       encoding        : the encoding string for entity
     const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *       version : the version string for entity
     int        standalone      : Was that entity marked standalone
     int        id      : an unique identifier for the entity
+    unsigned long      parentConsumed  : consumed bytes from parents
+    <a href="libxml2-tree.html#xmlEntityPtr">xmlEntityPtr</a>  entity  : entity, if any
 } xmlParserInput;
 </pre>
 <p></p>
@@ -1228,7 +1225,7 @@ The content of this structure is not made public by the API.
 <a name="xmlAddChildList"></a>xmlAddChildList ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a>      xmlAddChildList         (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> parent, <br>                                      <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> cur)<br>
 </pre>
-<p>Add a list of node at the end of the child list of the parent merging adjacent TEXT nodes (@cur may be freed) See the note regarding namespaces in xmlAddChild.</p>
+<p>Add a list of node at the end of the child list of the parent merging adjacent TEXT nodes (@cur may be freed) See the note regarding namespaces in <a href="libxml2-tree.html#xmlAddChild">xmlAddChild</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1253,7 +1250,7 @@ The content of this structure is not made public by the API.
 <a name="xmlAddNextSibling"></a>xmlAddNextSibling ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a>      xmlAddNextSibling       (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> cur, <br>                                         <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> elem)<br>
 </pre>
-<p>Add a new node @elem as the next sibling of @cur If the new node was already inserted in a document it is first unlinked from its existing context. As a result of text merging @elem may be freed. If the new node is ATTRIBUTE, it is added into properties instead of children. If there is an <a href="libxml2-SAX.html#attribute">attribute</a> with equal name, it is first destroyed. See the note regarding namespaces in xmlAddChild.</p>
+<p>Add a new node @elem as the next sibling of @cur If the new node was already inserted in a document it is first unlinked from its existing context. As a result of text merging @elem may be freed. If the new node is ATTRIBUTE, it is added into properties instead of children. If there is an <a href="libxml2-SAX.html#attribute">attribute</a> with equal name, it is first destroyed. See the note regarding namespaces in <a href="libxml2-tree.html#xmlAddChild">xmlAddChild</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1278,7 +1275,7 @@ The content of this structure is not made public by the API.
 <a name="xmlAddPrevSibling"></a>xmlAddPrevSibling ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a>      xmlAddPrevSibling       (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> cur, <br>                                         <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> elem)<br>
 </pre>
-<p>Add a new node @elem as the previous sibling of @cur merging adjacent TEXT nodes (@elem may be freed) If the new node was already inserted in a document it is first unlinked from its existing context. If the new node is ATTRIBUTE, it is added into properties instead of children. If there is an <a href="libxml2-SAX.html#attribute">attribute</a> with equal name, it is first destroyed. See the note regarding namespaces in xmlAddChild.</p>
+<p>Add a new node @elem as the previous sibling of @cur merging adjacent TEXT nodes (@elem may be freed) If the new node was already inserted in a document it is first unlinked from its existing context. If the new node is ATTRIBUTE, it is added into properties instead of children. If there is an <a href="libxml2-SAX.html#attribute">attribute</a> with equal name, it is first destroyed. See the note regarding namespaces in <a href="libxml2-tree.html#xmlAddChild">xmlAddChild</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1303,7 +1300,7 @@ The content of this structure is not made public by the API.
 <a name="xmlAddSibling"></a>xmlAddSibling ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a>      xmlAddSibling           (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> cur, <br>                                         <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> elem)<br>
 </pre>
-<p>Add a new element @elem to the list of siblings of @cur merging adjacent TEXT nodes (@elem may be freed) If the new element was already inserted in a document it is first unlinked from its existing context. See the note regarding namespaces in xmlAddChild.</p>
+<p>Add a new element @elem to the list of siblings of @cur merging adjacent TEXT nodes (@elem may be freed) If the new element was already inserted in a document it is first unlinked from its existing context. See the note regarding namespaces in <a href="libxml2-tree.html#xmlAddChild">xmlAddChild</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1673,7 +1670,7 @@ The content of this structure is not made public by the API.
 <a name="xmlBufferCreateStatic"></a>xmlBufferCreateStatic ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlBufferPtr">xmlBufferPtr</a>  xmlBufferCreateStatic   (void * mem, <br>                                        size_t size)<br>
 </pre>
-<p>routine to create an XML buffer from an immutable memory area. The area won't be modified nor copied, and is expected to be present until the end of the buffer lifetime.</p>
+<p>Create an XML buffer initialized with bytes.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1687,7 +1684,7 @@ The content of this structure is not made public by the API.
 </tr>
 <tr>
 <td><span class="term"><i><tt>Returns</tt></i>:</span></td>
-<td>the new structure.</td>
+<td></td>
 </tr>
 </tbody>
 </table></div>
@@ -2142,7 +2139,7 @@ The content of this structure is not made public by the API.
 <a name="xmlCopyProp"></a>xmlCopyProp ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlAttrPtr">xmlAttrPtr</a>      xmlCopyProp             (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> target, <br>                                      <a href="libxml2-tree.html#xmlAttrPtr">xmlAttrPtr</a> cur)<br>
 </pre>
-<p>Do a copy of the attribute.</p>
+<p>Do a copy of the <a href="libxml2-SAX.html#attribute">attribute</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -3060,7 +3057,7 @@ The content of this structure is not made public by the API.
 <a name="xmlGetProp"></a>xmlGetProp ()</h3>
 <pre class="programlisting"><a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *     xmlGetProp              (const <a href="libxml2-tree.html#xmlNode">xmlNode</a> * node, <br>                                      const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name)<br>
 </pre>
-<p>Search and get the value of an <a href="libxml2-SAX.html#attribute">attribute</a> associated to a node This does the entity substitution. This function looks in DTD <a href="libxml2-SAX.html#attribute">attribute</a> declaration for #FIXED or default declaration values unless DTD use has been turned off. NOTE: this function acts independently of namespaces associated to the attribute. Use xmlGetNsProp() or xmlGetNoNsProp() for namespace aware processing.</p>
+<p>Search and get the value of an <a href="libxml2-SAX.html#attribute">attribute</a> associated to a node This does the entity substitution. This function looks in DTD <a href="libxml2-SAX.html#attribute">attribute</a> declaration for #FIXED or default declaration values unless DTD use has been turned off. NOTE: this function acts independently of namespaces associated to the <a href="libxml2-SAX.html#attribute">attribute</a>. Use xmlGetNsProp() or xmlGetNoNsProp() for namespace aware processing.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -3293,7 +3290,7 @@ The content of this structure is not made public by the API.
 <a name="xmlNewComment"></a>xmlNewComment ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a>      xmlNewComment           (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * content)<br>
 </pre>
-<p>Use of this function is DISCOURAGED in favor of xmlNewDocComment. Creation of a new node containing a comment.</p>
+<p>Use of this function is DISCOURAGED in favor of <a href="libxml2-tree.html#xmlNewDocComment">xmlNewDocComment</a>. Creation of a new node containing a <a href="libxml2-SAX.html#comment">comment</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -3658,7 +3655,7 @@ The content of this structure is not made public by the API.
 <a name="xmlNewNode"></a>xmlNewNode ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a>      xmlNewNode              (<a href="libxml2-tree.html#xmlNsPtr">xmlNsPtr</a> ns, <br>                                      const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name)<br>
 </pre>
-<p>Creation of a new node element. @ns is optional (NULL). Use of this function is DISCOURAGED in favor of xmlNewDocNode.</p>
+<p>Creation of a new node element. @ns is optional (NULL). Use of this function is DISCOURAGED in favor of <a href="libxml2-tree.html#xmlNewDocNode">xmlNewDocNode</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -3683,7 +3680,7 @@ The content of this structure is not made public by the API.
 <a name="xmlNewNodeEatName"></a>xmlNewNodeEatName ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a>      xmlNewNodeEatName       (<a href="libxml2-tree.html#xmlNsPtr">xmlNsPtr</a> ns, <br>                                      <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name)<br>
 </pre>
-<p>Creation of a new node element. @ns is optional (NULL). Use of this function is DISCOURAGED in favor of xmlNewDocNodeEatName.</p>
+<p>Creation of a new node element. @ns is optional (NULL). Use of this function is DISCOURAGED in favor of <a href="libxml2-tree.html#xmlNewDocNodeEatName">xmlNewDocNodeEatName</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -3809,7 +3806,7 @@ The content of this structure is not made public by the API.
 <a name="xmlNewPI"></a>xmlNewPI ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a>      xmlNewPI                (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br>                                         const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * content)<br>
 </pre>
-<p>Creation of a processing instruction element. Use of this function is DISCOURAGED in favor of xmlNewDocPI.</p>
+<p>Creation of a processing instruction element. Use of this function is DISCOURAGED in favor of <a href="libxml2-tree.html#xmlNewDocPI">xmlNewDocPI</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -3891,7 +3888,7 @@ The content of this structure is not made public by the API.
 <a name="xmlNewText"></a>xmlNewText ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a>      xmlNewText              (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * content)<br>
 </pre>
-<p>Creation of a new text node. Use of this function is DISCOURAGED in favor of xmlNewDocText.</p>
+<p>Creation of a new text node. Use of this function is DISCOURAGED in favor of <a href="libxml2-tree.html#xmlNewDocText">xmlNewDocText</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -3945,7 +3942,7 @@ The content of this structure is not made public by the API.
 <a name="xmlNewTextLen"></a>xmlNewTextLen ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a>      xmlNewTextLen           (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * content, <br>                                      int len)<br>
 </pre>
-<p>Use of this function is DISCOURAGED in favor of xmlNewDocTextLen. Creation of a new text node with an extra parameter for the content's length</p>
+<p>Use of this function is DISCOURAGED in favor of <a href="libxml2-tree.html#xmlNewDocTextLen">xmlNewDocTextLen</a>. Creation of a new text node with an extra parameter for the content's length</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -4303,7 +4300,7 @@ The content of this structure is not made public by the API.
 <a name="xmlNodeSetBase"></a>xmlNodeSetBase ()</h3>
 <pre class="programlisting">void       xmlNodeSetBase                  (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> cur, <br>                                         const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * uri)<br>
 </pre>
-<p>Set (or reset) the base URI of a node, i.e. the value of the xml:base attribute.</p>
+<p>Set (or reset) the base URI of a node, i.e. the value of the xml:base <a href="libxml2-SAX.html#attribute">attribute</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -4370,7 +4367,7 @@ The content of this structure is not made public by the API.
 <a name="xmlNodeSetLang"></a>xmlNodeSetLang ()</h3>
 <pre class="programlisting">void       xmlNodeSetLang                  (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> cur, <br>                                         const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * lang)<br>
 </pre>
-<p>Set the language of a node, i.e. the values of the xml:lang attribute.</p>
+<p>Set the language of a node, i.e. the values of the xml:lang <a href="libxml2-SAX.html#attribute">attribute</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -4412,7 +4409,7 @@ The content of this structure is not made public by the API.
 <a name="xmlNodeSetSpacePreserve"></a>xmlNodeSetSpacePreserve ()</h3>
 <pre class="programlisting">void       xmlNodeSetSpacePreserve         (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> cur, <br>                                         int val)<br>
 </pre>
-<p>Set (or reset) the space preserving behaviour of a node, i.e. the value of the xml:space attribute.</p>
+<p>Set (or reset) the space preserving behaviour of a node, i.e. the value of the xml:space <a href="libxml2-SAX.html#attribute">attribute</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -4501,7 +4498,7 @@ The content of this structure is not made public by the API.
 <a name="xmlReplaceNode"></a>xmlReplaceNode ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a>      xmlReplaceNode          (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> old, <br>                                         <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> cur)<br>
 </pre>
-<p>Unlink the old node from its current context, prune the new one at the same place. If @cur was already inserted in a document it is first unlinked from its existing context. See the note regarding namespaces in xmlAddChild.</p>
+<p>Unlink the old node from its current context, prune the new one at the same place. If @cur was already inserted in a document it is first unlinked from its existing context. See the note regarding namespaces in <a href="libxml2-tree.html#xmlAddChild">xmlAddChild</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
index 755e78d..de7a0aa 100644 (file)
@@ -358,7 +358,7 @@ char *      <a href="#xmlURIUnescapeString">xmlURIUnescapeString</a>                (const char * s
 <a name="xmlURIEscapeStr"></a>xmlURIEscapeStr ()</h3>
 <pre class="programlisting"><a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *     xmlURIEscapeStr         (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * str, <br>                                  const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * list)<br>
 </pre>
-<p>This routine escapes a string to hex, ignoring reserved <a href="libxml2-SAX.html#characters">characters</a> (a-z) and the <a href="libxml2-SAX.html#characters">characters</a> in the exception list.</p>
+<p>This routine escapes a string to hex, ignoring reserved <a href="libxml2-SAX.html#characters">characters</a> (a-z, A-Z, 0-9, "@-_.!~*'()") and the <a href="libxml2-SAX.html#characters">characters</a> in the exception list.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
index 3ea0bb8..821d3fa 100644 (file)
@@ -22,9 +22,7 @@
 <p>Author(s): Daniel Veillard </p>
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
-<pre class="synopsis">#define <a href="#XML_VCTXT_DTD_VALIDATED">XML_VCTXT_DTD_VALIDATED</a>;
-#define <a href="#XML_VCTXT_USE_PCTXT">XML_VCTXT_USE_PCTXT</a>;
-typedef struct _xmlHashTable <a href="#xmlAttributeTable">xmlAttributeTable</a>;
+<pre class="synopsis">typedef struct _xmlHashTable <a href="#xmlAttributeTable">xmlAttributeTable</a>;
 typedef <a href="libxml2-valid.html#xmlAttributeTable">xmlAttributeTable</a> * <a href="#xmlAttributeTablePtr">xmlAttributeTablePtr</a>;
 typedef struct _xmlHashTable <a href="#xmlElementTable">xmlElementTable</a>;
 typedef <a href="libxml2-valid.html#xmlElementTable">xmlElementTable</a> * <a href="#xmlElementTablePtr">xmlElementTablePtr</a>;
@@ -93,7 +91,7 @@ int   <a href="#xmlValidateDocument">xmlValidateDocument</a>          (<a href="libxml2-va
 int    <a href="#xmlValidateDocumentFinal">xmlValidateDocumentFinal</a>        (<a href="libxml2-valid.html#xmlValidCtxtPtr">xmlValidCtxtPtr</a> ctxt, <br>                                     <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc);
 int    <a href="#xmlValidateDtd">xmlValidateDtd</a>                    (<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#xmlDtdPtr">xmlDtdPtr</a> dtd);
 int    <a href="#xmlValidateDtdFinal">xmlValidateDtdFinal</a>          (<a href="libxml2-valid.html#xmlValidCtxtPtr">xmlValidCtxtPtr</a> ctxt, <br>                                     <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc);
-int    <a href="#xmlValidateElement">xmlValidateElement</a>            (<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);
+int    <a href="#xmlValidateElement">xmlValidateElement</a>            (<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> root);
 int    <a href="#xmlValidateElementDecl">xmlValidateElementDecl</a>            (<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#xmlElementPtr">xmlElementPtr</a> elem);
 int    <a href="#xmlValidateNameValue">xmlValidateNameValue</a>                (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * value);
 int    <a href="#xmlValidateNamesValue">xmlValidateNamesValue</a>              (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * value);
@@ -118,22 +116,6 @@ typedef void <a href="#xmlValidityWarningFunc">xmlValidityWarningFunc</a>          (void
 <div class="refsect2" lang="en">
 <div class="refsect2" lang="en">
 <h3>
-<a name="XML_VCTXT_DTD_VALIDATED">Macro </a>XML_VCTXT_DTD_VALIDATED</h3>
-<pre class="programlisting">#define <a href="#XML_VCTXT_DTD_VALIDATED">XML_VCTXT_DTD_VALIDATED</a>;
-</pre>
-<p>Set after <a href="libxml2-valid.html#xmlValidateDtdFinal">xmlValidateDtdFinal</a> was called.</p>
-</div>
-<hr>
-<div class="refsect2" lang="en">
-<h3>
-<a name="XML_VCTXT_USE_PCTXT">Macro </a>XML_VCTXT_USE_PCTXT</h3>
-<pre class="programlisting">#define <a href="#XML_VCTXT_USE_PCTXT">XML_VCTXT_USE_PCTXT</a>;
-</pre>
-<p>Set if the validation context is part of a parser context.</p>
-</div>
-<hr>
-<div class="refsect2" lang="en">
-<h3>
 <a name="xmlAttributeTable">Structure </a>xmlAttributeTable</h3>
 <pre class="programlisting">struct _xmlHashTable {
 The content of this structure is not made public by the API.
@@ -1713,7 +1695,7 @@ The content of this structure is not made public by the API.
 <div class="refsect2" lang="en">
 <h3>
 <a name="xmlValidateElement"></a>xmlValidateElement ()</h3>
-<pre class="programlisting">int        xmlValidateElement              (<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>
+<pre class="programlisting">int        xmlValidateElement              (<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> root)<br>
 </pre>
 <p>Try to validate the subtree under an element</p>
 <div class="variablelist"><table border="0">
@@ -1728,8 +1710,8 @@ The content of this structure is not made public by the API.
 <td>a document instance</td>
 </tr>
 <tr>
-<td><span class="term"><i><tt>elem</tt></i>:</span></td>
-<td>an element instance</td>
+<td><span class="term"><i><tt>root</tt></i>:</span></td>
+<td></td>
 </tr>
 <tr>
 <td><span class="term"><i><tt>Returns</tt></i>:</span></td>
index e25ee02..1210a2f 100644 (file)
@@ -1211,7 +1211,7 @@ int       <a href="#xmlRegisterOutputCallbacks">xmlRegisterOutputCallbacks</a>    (<a hre
 <a name="xmlParserInputBufferCreateStatic"></a>xmlParserInputBufferCreateStatic ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlParserInputBufferPtr">xmlParserInputBufferPtr</a>    xmlParserInputBufferCreateStatic        (const char * mem, <br>                                                  int size, <br>                                                  <a href="libxml2-encoding.html#xmlCharEncoding">xmlCharEncoding</a> enc)<br>
 </pre>
-<p>Create a buffered parser input for the progressive parsing for the input from an immutable memory area. This will not copy the memory area to the buffer, but the memory is expected to be available until the end of the parsing, this is useful for example when using mmap'ed file.</p>
+<p>DEPRECATED: Use <a href="libxml2-xmlIO.html#xmlParserInputBufferCreateMem">xmlParserInputBufferCreateMem</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
index f97c8e1..b4d3a26 100644 (file)
@@ -929,7 +929,7 @@ typedef void <a href="#xmlStructuredErrorFunc">xmlStructuredErrorFunc</a>           (void
 <a name="initGenericErrorDefaultFunc"></a>initGenericErrorDefaultFunc ()</h3>
 <pre class="programlisting">void       initGenericErrorDefaultFunc     (<a href="libxml2-xmlerror.html#xmlGenericErrorFunc">xmlGenericErrorFunc</a> * handler)<br>
 </pre>
-<p>Set or reset (if NULL) the default handler for generic errors to the builtin error function.</p>
+<p>DEPRECATED: Use <a href="libxml2-xmlerror.html#xmlSetGenericErrorFunc">xmlSetGenericErrorFunc</a>. Set or reset (if NULL) the default handler for generic errors to the builtin error function.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody><tr>
index 9bf475e..937d7cb 100644 (file)
 <p>Author(s): </p>
 <div class="refsynopsisdiv">
 <h2>Synopsis</h2>
-<pre class="synopsis">#define <a href="#LIBXML_DLL_IMPORT">LIBXML_DLL_IMPORT</a>;
-#define <a href="#XMLCALL">XMLCALL</a>;
-#define <a href="#XMLCDECL">XMLCDECL</a>;
-#define <a href="#XMLPUBFUN">XMLPUBFUN</a>;
-#define <a href="#XMLPUBLIC">XMLPUBLIC</a>;
+<pre class="synopsis">#define <a href="#XMLPUBFUN">XMLPUBFUN</a>;
 #define <a href="#XMLPUBVAR">XMLPUBVAR</a>;
 </pre>
 </div>
 <div class="refsect2" lang="en">
 <div class="refsect2" lang="en">
 <h3>
-<a name="LIBXML_DLL_IMPORT">Macro </a>LIBXML_DLL_IMPORT</h3>
-<pre class="programlisting">#define <a href="#LIBXML_DLL_IMPORT">LIBXML_DLL_IMPORT</a>;
-</pre>
-<p></p>
-</div>
-<hr>
-<div class="refsect2" lang="en">
-<h3>
-<a name="XMLCALL">Macro </a>XMLCALL</h3>
-<pre class="programlisting">#define <a href="#XMLCALL">XMLCALL</a>;
-</pre>
-<p>Macro which declares the calling convention for exported functions</p>
-</div>
-<hr>
-<div class="refsect2" lang="en">
-<h3>
-<a name="XMLCDECL">Macro </a>XMLCDECL</h3>
-<pre class="programlisting">#define <a href="#XMLCDECL">XMLCDECL</a>;
-</pre>
-<p>Macro which declares the calling convention for exported functions that use '...'.</p>
-</div>
-<hr>
-<div class="refsect2" lang="en">
-<h3>
 <a name="XMLPUBFUN">Macro </a>XMLPUBFUN</h3>
 <pre class="programlisting">#define <a href="#XMLPUBFUN">XMLPUBFUN</a>;
 </pre>
 <hr>
 <div class="refsect2" lang="en">
 <h3>
-<a name="XMLPUBLIC">Macro </a>XMLPUBLIC</h3>
-<pre class="programlisting">#define <a href="#XMLPUBLIC">XMLPUBLIC</a>;
-</pre>
-<p>Macro which declares a public symbol</p>
-</div>
-<hr>
-<div class="refsect2" lang="en">
-<h3>
 <a name="XMLPUBVAR">Macro </a>XMLPUBVAR</h3>
 <pre class="programlisting">#define <a href="#XMLPUBVAR">XMLPUBVAR</a>;
 </pre>
index e1aef9d..f663bb6 100644 (file)
@@ -44,6 +44,7 @@ void *        <a href="#xmlMemMalloc">xmlMemMalloc</a>                        (size_t size);
 void * <a href="#xmlMemRealloc">xmlMemRealloc</a>                      (void * ptr, <br>                                        size_t size);
 int    <a href="#xmlMemSetup">xmlMemSetup</a>                  (<a href="libxml2-xmlmemory.html#xmlFreeFunc">xmlFreeFunc</a> freeFunc, <br>                                     <a href="libxml2-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> mallocFunc, <br>                                       <a href="libxml2-xmlmemory.html#xmlReallocFunc">xmlReallocFunc</a> reallocFunc, <br>                                    <a href="libxml2-xmlmemory.html#xmlStrdupFunc">xmlStrdupFunc</a> strdupFunc);
 void   <a href="#xmlMemShow">xmlMemShow</a>                    (FILE * fp, <br>                                         int nr);
+size_t <a href="#xmlMemSize">xmlMemSize</a>                    (void * ptr);
 char * <a href="#xmlMemStrdupLoc">xmlMemStrdupLoc</a>                  (const char * str, <br>                                  const char * file, <br>                                         int line);
 int    <a href="#xmlMemUsed">xmlMemUsed</a>                    (void);
 void   <a href="#xmlMemoryDump">xmlMemoryDump</a>                      (void);
@@ -152,7 +153,7 @@ typedef char * <a href="#xmlStrdupFunc">xmlStrdupFunc</a>                   (const char * str);
 <a name="xmlCleanupMemory"></a>xmlCleanupMemory ()</h3>
 <pre class="programlisting">void       xmlCleanupMemory                (void)<br>
 </pre>
-<p>DEPRECATED: This function will be made private. Call <a href="libxml2-parser.html#xmlCleanupParser">xmlCleanupParser</a> to free global state but see the warnings there. <a href="libxml2-parser.html#xmlCleanupParser">xmlCleanupParser</a> should be only called once at program exit. In most cases, you don't have call cleanup functions at all. Free up all the memory allocated by the library for its own use. This should not be called by user level code.</p>
+<p>DEPRECATED: This function is a no-op. Call <a href="libxml2-parser.html#xmlCleanupParser">xmlCleanupParser</a> to free global state but see the warnings there. <a href="libxml2-parser.html#xmlCleanupParser">xmlCleanupParser</a> should be only called once at program exit. In most cases, you don't have call cleanup functions at all.</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -234,12 +235,12 @@ typedef char * <a href="#xmlStrdupFunc">xmlStrdupFunc</a>                 (const char * str);
 <a name="xmlInitMemory"></a>xmlInitMemory ()</h3>
 <pre class="programlisting">int        xmlInitMemory                   (void)<br>
 </pre>
-<p>DEPRECATED: This function will be made private. Call <a href="libxml2-parser.html#xmlInitParser">xmlInitParser</a> to initialize the library. Initialize the memory layer.</p>
+<p>DEPRECATED: Alias for <a href="libxml2-parser.html#xmlInitParser">xmlInitParser</a>.</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 on success</td>
+<td></td>
 </tr></tbody>
 </table></div>
 </div>
@@ -503,6 +504,27 @@ typedef char * <a href="#xmlStrdupFunc">xmlStrdupFunc</a>                  (const char * str);
 <hr>
 <div class="refsect2" lang="en">
 <h3>
+<a name="xmlMemSize"></a>xmlMemSize ()</h3>
+<pre class="programlisting">size_t     xmlMemSize                      (void * ptr)<br>
+</pre>
+<p></p>
+<div class="variablelist"><table border="0">
+<col align="left">
+<tbody>
+<tr>
+<td><span class="term"><i><tt>ptr</tt></i>:</span></td>
+<td>pointer to the memory allocation</td>
+</tr>
+<tr>
+<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
+<td>the size of a memory allocation.</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<h3>
 <a name="xmlMemStrdupLoc"></a>xmlMemStrdupLoc ()</h3>
 <pre class="programlisting">char *     xmlMemStrdupLoc                 (const char * str, <br>                                  const char * file, <br>                                         int line)<br>
 </pre>
index 0230687..bb012e6 100644 (file)
@@ -312,7 +312,7 @@ The content of this structure is not made public by the API.
 <a name="xmlReaderForDoc"></a>xmlReaderForDoc ()</h3>
 <pre class="programlisting"><a href="libxml2-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a>     xmlReaderForDoc (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * cur, <br>                                  const char * URL, <br>                                  const char * encoding, <br>                                     int options)<br>
 </pre>
-<p>Create an xmltextReader for an XML in-memory document. The parsing flags @options are a combination of xmlParserOption.</p>
+<p>Create an xmltextReader for an XML in-memory document. The parsing flags @options are a combination of <a href="libxml2-parser.html#xmlParserOption">xmlParserOption</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -346,7 +346,7 @@ The content of this structure is not made public by the API.
 <a name="xmlReaderForFd"></a>xmlReaderForFd ()</h3>
 <pre class="programlisting"><a href="libxml2-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a>     xmlReaderForFd  (int fd, <br>                                    const char * URL, <br>                                  const char * encoding, <br>                                     int options)<br>
 </pre>
-<p>Create an xmltextReader for an XML from a file descriptor. The parsing flags @options are a combination of xmlParserOption. NOTE that the file descriptor will not be closed when the reader is closed or reset.</p>
+<p>Create an xmltextReader for an XML from a file descriptor. The parsing flags @options are a combination of <a href="libxml2-parser.html#xmlParserOption">xmlParserOption</a>. NOTE that the file descriptor will not be closed when the reader is closed or reset.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -380,7 +380,7 @@ The content of this structure is not made public by the API.
 <a name="xmlReaderForFile"></a>xmlReaderForFile ()</h3>
 <pre class="programlisting"><a href="libxml2-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a>     xmlReaderForFile        (const char * filename, <br>                                             const char * encoding, <br>                                             int options)<br>
 </pre>
-<p>parse an XML file from the filesystem or the network. The parsing flags @options are a combination of xmlParserOption.</p>
+<p>parse an XML file from the filesystem or the network. The parsing flags @options are a combination of <a href="libxml2-parser.html#xmlParserOption">xmlParserOption</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -410,7 +410,7 @@ The content of this structure is not made public by the API.
 <a name="xmlReaderForIO"></a>xmlReaderForIO ()</h3>
 <pre class="programlisting"><a href="libxml2-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a>     xmlReaderForIO  (<a href="libxml2-xmlIO.html#xmlInputReadCallback">xmlInputReadCallback</a> ioread, <br>                                         <a href="libxml2-xmlIO.html#xmlInputCloseCallback">xmlInputCloseCallback</a> ioclose, <br>                                      void * ioctx, <br>                                      const char * URL, <br>                                  const char * encoding, <br>                                     int options)<br>
 </pre>
-<p>Create an xmltextReader for an XML document from I/O functions and source. The parsing flags @options are a combination of xmlParserOption.</p>
+<p>Create an xmltextReader for an XML document from I/O functions and source. The parsing flags @options are a combination of <a href="libxml2-parser.html#xmlParserOption">xmlParserOption</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -452,7 +452,7 @@ The content of this structure is not made public by the API.
 <a name="xmlReaderForMemory"></a>xmlReaderForMemory ()</h3>
 <pre class="programlisting"><a href="libxml2-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a>     xmlReaderForMemory      (const char * buffer, <br>                                               int size, <br>                                          const char * URL, <br>                                          const char * encoding, <br>                                             int options)<br>
 </pre>
-<p>Create an xmltextReader for an XML in-memory document. The parsing flags @options are a combination of xmlParserOption.</p>
+<p>Create an xmltextReader for an XML in-memory document. The parsing flags @options are a combination of <a href="libxml2-parser.html#xmlParserOption">xmlParserOption</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -490,7 +490,7 @@ The content of this structure is not made public by the API.
 <a name="xmlReaderNewDoc"></a>xmlReaderNewDoc ()</h3>
 <pre class="programlisting">int        xmlReaderNewDoc                 (<a href="libxml2-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a> reader, <br>                                     const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * cur, <br>                                  const char * URL, <br>                                  const char * encoding, <br>                                     int options)<br>
 </pre>
-<p>Setup an xmltextReader to parse an XML in-memory document. The parsing flags @options are a combination of xmlParserOption. This reuses the existing @reader xmlTextReader.</p>
+<p>Setup an xmltextReader to parse an XML in-memory document. The parsing flags @options are a combination of <a href="libxml2-parser.html#xmlParserOption">xmlParserOption</a>. This reuses the existing @reader <a href="libxml2-xmlreader.html#xmlTextReader">xmlTextReader</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -528,7 +528,7 @@ The content of this structure is not made public by the API.
 <a name="xmlReaderNewFd"></a>xmlReaderNewFd ()</h3>
 <pre class="programlisting">int        xmlReaderNewFd                  (<a href="libxml2-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a> reader, <br>                                     int fd, <br>                                    const char * URL, <br>                                  const char * encoding, <br>                                     int options)<br>
 </pre>
-<p>Setup an xmltextReader to parse an XML from a file descriptor. NOTE that the file descriptor will not be closed when the reader is closed or reset. The parsing flags @options are a combination of xmlParserOption. This reuses the existing @reader xmlTextReader.</p>
+<p>Setup an xmltextReader to parse an XML from a file descriptor. NOTE that the file descriptor will not be closed when the reader is closed or reset. The parsing flags @options are a combination of <a href="libxml2-parser.html#xmlParserOption">xmlParserOption</a>. This reuses the existing @reader <a href="libxml2-xmlreader.html#xmlTextReader">xmlTextReader</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -566,7 +566,7 @@ The content of this structure is not made public by the API.
 <a name="xmlReaderNewFile"></a>xmlReaderNewFile ()</h3>
 <pre class="programlisting">int        xmlReaderNewFile                (<a href="libxml2-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a> reader, <br>                                     const char * filename, <br>                                     const char * encoding, <br>                                     int options)<br>
 </pre>
-<p>parse an XML file from the filesystem or the network. The parsing flags @options are a combination of xmlParserOption. This reuses the existing @reader xmlTextReader.</p>
+<p>parse an XML file from the filesystem or the network. The parsing flags @options are a combination of <a href="libxml2-parser.html#xmlParserOption">xmlParserOption</a>. This reuses the existing @reader <a href="libxml2-xmlreader.html#xmlTextReader">xmlTextReader</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -600,7 +600,7 @@ The content of this structure is not made public by the API.
 <a name="xmlReaderNewIO"></a>xmlReaderNewIO ()</h3>
 <pre class="programlisting">int        xmlReaderNewIO                  (<a href="libxml2-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a> reader, <br>                                     <a href="libxml2-xmlIO.html#xmlInputReadCallback">xmlInputReadCallback</a> ioread, <br>                                         <a href="libxml2-xmlIO.html#xmlInputCloseCallback">xmlInputCloseCallback</a> ioclose, <br>                                      void * ioctx, <br>                                      const char * URL, <br>                                  const char * encoding, <br>                                     int options)<br>
 </pre>
-<p>Setup an xmltextReader to parse an XML document from I/O functions and source. The parsing flags @options are a combination of xmlParserOption. This reuses the existing @reader xmlTextReader.</p>
+<p>Setup an xmltextReader to parse an XML document from I/O functions and source. The parsing flags @options are a combination of <a href="libxml2-parser.html#xmlParserOption">xmlParserOption</a>. This reuses the existing @reader <a href="libxml2-xmlreader.html#xmlTextReader">xmlTextReader</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -646,7 +646,7 @@ The content of this structure is not made public by the API.
 <a name="xmlReaderNewMemory"></a>xmlReaderNewMemory ()</h3>
 <pre class="programlisting">int        xmlReaderNewMemory              (<a href="libxml2-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a> reader, <br>                                     const char * buffer, <br>                                       int size, <br>                                  const char * URL, <br>                                  const char * encoding, <br>                                     int options)<br>
 </pre>
-<p>Setup an xmltextReader to parse an XML in-memory document. The parsing flags @options are a combination of xmlParserOption. This reuses the existing @reader xmlTextReader.</p>
+<p>Setup an xmltextReader to parse an XML in-memory document. The parsing flags @options are a combination of <a href="libxml2-parser.html#xmlParserOption">xmlParserOption</a>. This reuses the existing @reader <a href="libxml2-xmlreader.html#xmlTextReader">xmlTextReader</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -688,7 +688,7 @@ The content of this structure is not made public by the API.
 <a name="xmlReaderNewWalker"></a>xmlReaderNewWalker ()</h3>
 <pre class="programlisting">int        xmlReaderNewWalker              (<a href="libxml2-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a> reader, <br>                                     <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc)<br>
 </pre>
-<p>Setup an xmltextReader to parse a preparsed XML document. This reuses the existing @reader xmlTextReader.</p>
+<p>Setup an xmltextReader to parse a preparsed XML document. This reuses the existing @reader <a href="libxml2-xmlreader.html#xmlTextReader">xmlTextReader</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1032,7 +1032,7 @@ The content of this structure is not made public by the API.
 <a name="xmlTextReaderCurrentDoc"></a>xmlTextReaderCurrentDoc ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a>        xmlTextReaderCurrentDoc (<a href="libxml2-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a> reader)<br>
 </pre>
-<p>Hacking interface allowing to get the <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> corresponding to the current document being accessed by the xmlTextReader. NOTE: as a result of this call, the reader will not destroy the associated XML document and calling xmlFreeDoc() on the result is needed once the reader parsing has finished.</p>
+<p>Hacking interface allowing to get the <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> corresponding to the current document being accessed by the <a href="libxml2-xmlreader.html#xmlTextReader">xmlTextReader</a>. NOTE: as a result of this call, the reader will not destroy the associated XML document and calling xmlFreeDoc() on the result is needed once the reader parsing has finished.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1053,7 +1053,7 @@ The content of this structure is not made public by the API.
 <a name="xmlTextReaderCurrentNode"></a>xmlTextReaderCurrentNode ()</h3>
 <pre class="programlisting"><a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a>      xmlTextReaderCurrentNode        (<a href="libxml2-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a> reader)<br>
 </pre>
-<p>Hacking interface allowing to get the <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> corresponding to the current node being accessed by the xmlTextReader. This is dangerous because the underlying node may be destroyed on the next Reads.</p>
+<p>Hacking interface allowing to get the <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> corresponding to the current node being accessed by the <a href="libxml2-xmlreader.html#xmlTextReader">xmlTextReader</a>. This is dangerous because the underlying node may be destroyed on the next Reads.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1126,7 +1126,7 @@ The content of this structure is not made public by the API.
 </tr>
 <tr>
 <td><span class="term"><i><tt>name</tt></i>:</span></td>
-<td>the qualified name of the attribute.</td>
+<td>the qualified name of the <a href="libxml2-SAX.html#attribute">attribute</a>.</td>
 </tr>
 <tr>
 <td><span class="term"><i><tt>Returns</tt></i>:</span></td>
@@ -1176,11 +1176,11 @@ The content of this structure is not made public by the API.
 </tr>
 <tr>
 <td><span class="term"><i><tt>localName</tt></i>:</span></td>
-<td>the local name of the attribute.</td>
+<td>the local name of the <a href="libxml2-SAX.html#attribute">attribute</a>.</td>
 </tr>
 <tr>
 <td><span class="term"><i><tt>namespaceURI</tt></i>:</span></td>
-<td>the namespace URI of the attribute.</td>
+<td>the namespace URI of the <a href="libxml2-SAX.html#attribute">attribute</a>.</td>
 </tr>
 <tr>
 <td><span class="term"><i><tt>Returns</tt></i>:</span></td>
@@ -1392,7 +1392,7 @@ The content of this structure is not made public by the API.
 <a name="xmlTextReaderIsNamespaceDecl"></a>xmlTextReaderIsNamespaceDecl ()</h3>
 <pre class="programlisting">int        xmlTextReaderIsNamespaceDecl    (<a href="libxml2-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a> reader)<br>
 </pre>
-<p>Determine whether the current node is a namespace declaration rather than a regular attribute.</p>
+<p>Determine whether the current node is a namespace declaration rather than a regular <a href="libxml2-SAX.html#attribute">attribute</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1532,7 +1532,7 @@ The content of this structure is not made public by the API.
 </tr>
 <tr>
 <td><span class="term"><i><tt>name</tt></i>:</span></td>
-<td>the qualified name of the attribute.</td>
+<td>the qualified name of the <a href="libxml2-SAX.html#attribute">attribute</a>.</td>
 </tr>
 <tr>
 <td><span class="term"><i><tt>Returns</tt></i>:</span></td>
@@ -1582,11 +1582,11 @@ The content of this structure is not made public by the API.
 </tr>
 <tr>
 <td><span class="term"><i><tt>localName</tt></i>:</span></td>
-<td>the local name of the attribute.</td>
+<td>the local name of the <a href="libxml2-SAX.html#attribute">attribute</a>.</td>
 </tr>
 <tr>
 <td><span class="term"><i><tt>namespaceURI</tt></i>:</span></td>
-<td>the namespace URI of the attribute.</td>
+<td>the namespace URI of the <a href="libxml2-SAX.html#attribute">attribute</a>.</td>
 </tr>
 <tr>
 <td><span class="term"><i><tt>Returns</tt></i>:</span></td>
@@ -1861,7 +1861,7 @@ The content of this structure is not made public by the API.
 <a name="xmlTextReaderQuoteChar"></a>xmlTextReaderQuoteChar ()</h3>
 <pre class="programlisting">int        xmlTextReaderQuoteChar          (<a href="libxml2-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a> reader)<br>
 </pre>
-<p>The quotation mark character used to enclose the value of an attribute.</p>
+<p>The quotation mark character used to enclose the value of an <a href="libxml2-SAX.html#attribute">attribute</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
index 5760adf..011da78 100644 (file)
@@ -38,7 +38,7 @@ int   <a href="#xmlSchemaGetCanonValueWhtsp">xmlSchemaGetCanonValueWhtsp</a>  (<a h
 unsigned long  <a href="#xmlSchemaGetFacetValueAsULong">xmlSchemaGetFacetValueAsULong</a>      (<a href="libxml2-schemasInternals.html#xmlSchemaFacetPtr">xmlSchemaFacetPtr</a> facet);
 <a href="libxml2-schemasInternals.html#xmlSchemaTypePtr">xmlSchemaTypePtr</a>  <a href="#xmlSchemaGetPredefinedType">xmlSchemaGetPredefinedType</a>    (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br>                                                         const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * ns);
 <a href="libxml2-schemasInternals.html#xmlSchemaValType">xmlSchemaValType</a>  <a href="#xmlSchemaGetValType">xmlSchemaGetValType</a>  (<a href="libxml2-schemasInternals.html#xmlSchemaValPtr">xmlSchemaValPtr</a> val);
-void   <a href="#xmlSchemaInitTypes">xmlSchemaInitTypes</a>            (void);
+int    <a href="#xmlSchemaInitTypes">xmlSchemaInitTypes</a>            (void);
 int    <a href="#xmlSchemaIsBuiltInTypeFacet">xmlSchemaIsBuiltInTypeFacet</a>  (<a href="libxml2-schemasInternals.html#xmlSchemaTypePtr">xmlSchemaTypePtr</a> type, <br>                                        int facetType);
 <a href="libxml2-schemasInternals.html#xmlSchemaFacetPtr">xmlSchemaFacetPtr</a>        <a href="#xmlSchemaNewFacet">xmlSchemaNewFacet</a>      (void);
 <a href="libxml2-schemasInternals.html#xmlSchemaValPtr">xmlSchemaValPtr</a>    <a href="#xmlSchemaNewNOTATIONValue">xmlSchemaNewNOTATIONValue</a>      (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br>                                                 const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * ns);
@@ -114,7 +114,7 @@ const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *        <a href="#xmlSchema
 <a name="xmlSchemaCleanupTypes"></a>xmlSchemaCleanupTypes ()</h3>
 <pre class="programlisting">void       xmlSchemaCleanupTypes           (void)<br>
 </pre>
-<p>DEPRECATED: This function will be made private. Call <a href="libxml2-parser.html#xmlCleanupParser">xmlCleanupParser</a> to free global state but see the warnings there. <a href="libxml2-parser.html#xmlCleanupParser">xmlCleanupParser</a> should be only called once at program exit. In most cases, you don't have call cleanup functions at all. Cleanup the default XML Schemas type library</p>
+<p>DEPRECATED: This function will be made private. Call <a href="libxml2-parser.html#xmlCleanupParser">xmlCleanupParser</a> to free global state but see the warnings there. <a href="libxml2-parser.html#xmlCleanupParser">xmlCleanupParser</a> should be only called once at program exit. In most cases, you don't have to call cleanup functions at all. Cleanup the default XML Schemas type library</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -413,9 +413,16 @@ const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *       <a href="#xmlSchema
 <div class="refsect2" lang="en">
 <h3>
 <a name="xmlSchemaInitTypes"></a>xmlSchemaInitTypes ()</h3>
-<pre class="programlisting">void       xmlSchemaInitTypes              (void)<br>
+<pre class="programlisting">int        xmlSchemaInitTypes              (void)<br>
 </pre>
 <p>Initialize the default XML Schemas type library</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 on success, -1 on error.</td>
+</tr></tbody>
+</table></div>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -513,7 +520,7 @@ const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> *        <a href="#xmlSchema
 <a name="xmlSchemaNewStringValue"></a>xmlSchemaNewStringValue ()</h3>
 <pre class="programlisting"><a href="libxml2-schemasInternals.html#xmlSchemaValPtr">xmlSchemaValPtr</a>        xmlSchemaNewStringValue (<a href="libxml2-schemasInternals.html#xmlSchemaValType">xmlSchemaValType</a> type, <br>                                        const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * value)<br>
 </pre>
-<p>Allocate a new simple type value. The type can be of XML_SCHEMAS_STRING. WARNING: This one is intended to be expanded for other string based types. We need this for anySimpleType as well. The given value is consumed and freed with the struct.</p>
+<p>Allocate a new simple type value. The type can be of <a href="libxml2-schemasInternals.html#XML_SCHEMAS_STRING">XML_SCHEMAS_STRING</a>. WARNING: This one is intended to be expanded for other string based types. We need this for anySimpleType as well. The given value is consumed and freed with the struct.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
index 98b0819..7e202ac 100644 (file)
@@ -68,7 +68,6 @@
 #define <a href="#LIBXML_ZLIB_ENABLED">LIBXML_ZLIB_ENABLED</a>;
 #define <a href="#WITHOUT_TRIO">WITHOUT_TRIO</a>;
 #define <a href="#WITH_TRIO">WITH_TRIO</a>;
-#define <a href="#XML_DEPRECATED">XML_DEPRECATED</a>;
 void   <a href="#xmlCheckVersion">xmlCheckVersion</a>                  (int version);
 </pre>
 </div>
@@ -145,7 +144,7 @@ void        <a href="#xmlCheckVersion">xmlCheckVersion</a>                  (int version);
 <a name="LIBXML_DEBUG_RUNTIME">Macro </a>LIBXML_DEBUG_RUNTIME</h3>
 <pre class="programlisting">#define <a href="#LIBXML_DEBUG_RUNTIME">LIBXML_DEBUG_RUNTIME</a>;
 </pre>
-<p>Whether the runtime debugging is configured in</p>
+<p>Removed</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
@@ -446,14 +445,6 @@ void       <a href="#xmlCheckVersion">xmlCheckVersion</a>                  (int version);
 <hr>
 <div class="refsect2" lang="en">
 <h3>
-<a name="XML_DEPRECATED">Macro </a>XML_DEPRECATED</h3>
-<pre class="programlisting">#define <a href="#XML_DEPRECATED">XML_DEPRECATED</a>;
-</pre>
-<p>Macro used to indicate that a function, variable, type or struct member is deprecated.</p>
-</div>
-<hr>
-<div class="refsect2" lang="en">
-<h3>
 <a name="xmlCheckVersion"></a>xmlCheckVersion ()</h3>
 <pre class="programlisting">void       xmlCheckVersion                 (int version)<br>
 </pre>
index 9418ea8..a274d09 100644 (file)
@@ -364,7 +364,7 @@ The content of this structure is not made public by the API.
 <a name="xmlTextWriterEndComment"></a>xmlTextWriterEndComment ()</h3>
 <pre class="programlisting">int        xmlTextWriterEndComment         (<a href="libxml2-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> writer)<br>
 </pre>
-<p>End the current xml comment.</p>
+<p>End the current xml <a href="libxml2-SAX.html#comment">comment</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -662,7 +662,7 @@ The content of this structure is not made public by the API.
 <a name="xmlTextWriterStartAttribute"></a>xmlTextWriterStartAttribute ()</h3>
 <pre class="programlisting">int        xmlTextWriterStartAttribute     (<a href="libxml2-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> writer, <br>                                     const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name)<br>
 </pre>
-<p>Start an xml attribute.</p>
+<p>Start an xml <a href="libxml2-SAX.html#attribute">attribute</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -744,7 +744,7 @@ The content of this structure is not made public by the API.
 <a name="xmlTextWriterStartComment"></a>xmlTextWriterStartComment ()</h3>
 <pre class="programlisting">int        xmlTextWriterStartComment       (<a href="libxml2-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> writer)<br>
 </pre>
-<p>Start an xml comment.</p>
+<p>Start an xml <a href="libxml2-SAX.html#comment">comment</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1002,7 +1002,7 @@ The content of this structure is not made public by the API.
 <a name="xmlTextWriterWriteAttribute"></a>xmlTextWriterWriteAttribute ()</h3>
 <pre class="programlisting">int        xmlTextWriterWriteAttribute     (<a href="libxml2-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> writer, <br>                                     const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br>                                         const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * content)<br>
 </pre>
-<p>Write an xml attribute.</p>
+<p>Write an xml <a href="libxml2-SAX.html#attribute">attribute</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1034,7 +1034,7 @@ The content of this structure is not made public by the API.
 <a name="xmlTextWriterWriteAttributeNS"></a>xmlTextWriterWriteAttributeNS ()</h3>
 <pre class="programlisting">int        xmlTextWriterWriteAttributeNS   (<a href="libxml2-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> writer, <br>                                     const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * prefix, <br>                                       const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br>                                         const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * namespaceURI, <br>                                         const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * content)<br>
 </pre>
-<p>Write an xml attribute.</p>
+<p>Write an xml <a href="libxml2-SAX.html#attribute">attribute</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1168,7 +1168,7 @@ The content of this structure is not made public by the API.
 <a name="xmlTextWriterWriteComment"></a>xmlTextWriterWriteComment ()</h3>
 <pre class="programlisting">int        xmlTextWriterWriteComment       (<a href="libxml2-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> writer, <br>                                     const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * content)<br>
 </pre>
-<p>Write an xml comment.</p>
+<p>Write an xml <a href="libxml2-SAX.html#comment">comment</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1551,7 +1551,7 @@ The content of this structure is not made public by the API.
 <a name="xmlTextWriterWriteFormatAttribute"></a>xmlTextWriterWriteFormatAttribute ()</h3>
 <pre class="programlisting">int        xmlTextWriterWriteFormatAttribute       (<a href="libxml2-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> writer, <br>                                             const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br>                                                 const char * format, <br>                                               ... ...)<br>
 </pre>
-<p>Write a formatted xml attribute.</p>
+<p>Write a formatted xml <a href="libxml2-SAX.html#attribute">attribute</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -1659,7 +1659,7 @@ The content of this structure is not made public by the API.
 <a name="xmlTextWriterWriteFormatComment"></a>xmlTextWriterWriteFormatComment ()</h3>
 <pre class="programlisting">int        xmlTextWriterWriteFormatComment (<a href="libxml2-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> writer, <br>                                     const char * format, <br>                                       ... ...)<br>
 </pre>
-<p>Write an xml comment.</p>
+<p>Write an xml <a href="libxml2-SAX.html#comment">comment</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2119,7 +2119,7 @@ The content of this structure is not made public by the API.
 <a name="xmlTextWriterWriteVFormatAttribute"></a>xmlTextWriterWriteVFormatAttribute ()</h3>
 <pre class="programlisting">int        xmlTextWriterWriteVFormatAttribute      (<a href="libxml2-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> writer, <br>                                             const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br>                                                 const char * format, <br>                                               va_list argptr)<br>
 </pre>
-<p>Write a formatted xml attribute.</p>
+<p>Write a formatted xml <a href="libxml2-SAX.html#attribute">attribute</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2227,7 +2227,7 @@ The content of this structure is not made public by the API.
 <a name="xmlTextWriterWriteVFormatComment"></a>xmlTextWriterWriteVFormatComment ()</h3>
 <pre class="programlisting">int        xmlTextWriterWriteVFormatComment        (<a href="libxml2-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> writer, <br>                                             const char * format, <br>                                               va_list argptr)<br>
 </pre>
-<p>Write an xml comment.</p>
+<p>Write an xml <a href="libxml2-SAX.html#comment">comment</a>.</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
index 5b0e1c6..9a4c306 100644 (file)
@@ -117,30 +117,6 @@ typedef <a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> <a
 <hr>
 <div class="refsect2" lang="en">
 <h3>
-<a name="XPATH_LOCATIONSET">Macro </a>XPATH_LOCATIONSET</h3>
-<pre class="programlisting">#define <a href="#XPATH_LOCATIONSET">XPATH_LOCATIONSET</a>;
-</pre>
-<p></p>
-</div>
-<hr>
-<div class="refsect2" lang="en">
-<h3>
-<a name="XPATH_POINT">Macro </a>XPATH_POINT</h3>
-<pre class="programlisting">#define <a href="#XPATH_POINT">XPATH_POINT</a>;
-</pre>
-<p></p>
-</div>
-<hr>
-<div class="refsect2" lang="en">
-<h3>
-<a name="XPATH_RANGE">Macro </a>XPATH_RANGE</h3>
-<pre class="programlisting">#define <a href="#XPATH_RANGE">XPATH_RANGE</a>;
-</pre>
-<p></p>
-</div>
-<hr>
-<div class="refsect2" lang="en">
-<h3>
 <a name="xmlXPathNodeSetGetLength">Macro </a>xmlXPathNodeSetGetLength</h3>
 <pre class="programlisting">#define <a href="#xmlXPathNodeSetGetLength">xmlXPathNodeSetGetLength</a>(ns);
 </pre>
@@ -421,7 +397,7 @@ The content of this structure is not made public by the API.
     <a href="libxml2-xpath.html#xmlXPathCompExprPtr">xmlXPathCompExprPtr</a>   comp    : the precompiled expression
     int        xptr    : it this an XPointer expression
     <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a>      ancestor        : used for walking preceding axis
-    int        valueFrame      : used to limit Pop on the stack
+    int        valueFrame      : unused
 } xmlXPathParserContext;
 </pre>
 <p></p>
@@ -1313,7 +1289,7 @@ The content of this structure is not made public by the API.
 <a name="xmlXPathInit"></a>xmlXPathInit ()</h3>
 <pre class="programlisting">void       xmlXPathInit                    (void)<br>
 </pre>
-<p>DEPRECATED: This function will be made private. Call <a href="libxml2-parser.html#xmlInitParser">xmlInitParser</a> to initialize the library. Initialize the XPath environment</p>
+<p>DEPRECATED: Alias for <a href="libxml2-parser.html#xmlInitParser">xmlInitParser</a>.</p>
 </div>
 <hr>
 <div class="refsect2" lang="en">
index e5edfac..3a1f3ba 100644 (file)
@@ -650,7 +650,7 @@ void        <a href="#xmlXPatherror">xmlXPatherror</a>                      (<a href="libxml2-xpath.html#x
 </tr>
 <tr>
 <td><span class="term"><i><tt>Returns</tt></i>:</span></td>
-<td>the number of items on the value stack, or -1 in case of error.</td>
+<td>the number of items on the value stack, or -1 in case of error. The object is destroyed in case of error.</td>
 </tr>
 </tbody>
 </table></div>
@@ -1227,7 +1227,7 @@ void      <a href="#xmlXPatherror">xmlXPatherror</a>                      (<a href="libxml2-xpath.html#x
 <a name="xmlXPathLangFunction"></a>xmlXPathLangFunction ()</h3>
 <pre class="programlisting">void       xmlXPathLangFunction            (<a href="libxml2-xpath.html#xmlXPathParserContextPtr">xmlXPathParserContextPtr</a> ctxt, <br>                                   int nargs)<br>
 </pre>
-<p>Implement the lang() XPath function boolean lang(string) The lang function returns true or false depending on whether the language of the context node as specified by xml:lang attributes is the same as or is a sublanguage of the language specified by the argument string. The language of the context node is determined by the value of the xml:lang <a href="libxml2-SAX.html#attribute">attribute</a> on the context node, or, if the context node has no xml:lang attribute, by the value of the xml:lang <a href="libxml2-SAX.html#attribute">attribute</a> on the nearest ancestor of the context node that has an xml:lang attribute. If there is no such attribute, then lang</p>
+<p>Implement the lang() XPath function boolean lang(string) The lang function returns true or false depending on whether the language of the context node as specified by xml:lang attributes is the same as or is a sublanguage of the language specified by the argument string. The language of the context node is determined by the value of the xml:lang <a href="libxml2-SAX.html#attribute">attribute</a> on the context node, or, if the context node has no xml:lang attribute, by the value of the xml:lang <a href="libxml2-SAX.html#attribute">attribute</a> on the nearest ancestor of the context node that has an xml:lang <a href="libxml2-SAX.html#attribute">attribute</a>. If there is no such attribute, then lang</p>
 <div class="variablelist"><table border="0">
 <col align="left">
 <tbody>
@@ -2095,7 +2095,7 @@ void      <a href="#xmlXPatherror">xmlXPatherror</a>                      (<a href="libxml2-xpath.html#x
 </tr>
 <tr>
 <td><span class="term"><i><tt>Returns</tt></i>:</span></td>
-<td>@val1 once extended or NULL in case of error.</td>
+<td>@val1 once extended or NULL in case of error. Frees @val1 in case of error.</td>
 </tr>
 </tbody>
 </table></div>
@@ -3164,7 +3164,7 @@ void      <a href="#xmlXPatherror">xmlXPatherror</a>                      (<a href="libxml2-xpath.html#x
 </tr>
 <tr>
 <td><span class="term"><i><tt>Returns</tt></i>:</span></td>
-<td>the newly created object.</td>
+<td>the newly created object. In case of error the node set is destroyed and NULL is returned.</td>
 </tr>
 </tbody>
 </table></div>
@@ -3185,7 +3185,7 @@ void      <a href="#xmlXPatherror">xmlXPatherror</a>                      (<a href="libxml2-xpath.html#x
 </tr>
 <tr>
 <td><span class="term"><i><tt>Returns</tt></i>:</span></td>
-<td>the newly created object.</td>
+<td>the newly created object. Frees @val in case of error.</td>
 </tr>
 </tbody>
 </table></div>
index 7954132..1d9ec80 100644 (file)
@@ -98,7 +98,6 @@
     <keyword type="macro" name="LIBXML_CATALOG_ENABLED" link="libxml2-xmlversion.html#LIBXML_CATALOG_ENABLED"/>
     <keyword type="macro" name="LIBXML_DEBUG_ENABLED" link="libxml2-xmlversion.html#LIBXML_DEBUG_ENABLED"/>
     <keyword type="macro" name="LIBXML_DEBUG_RUNTIME" link="libxml2-xmlversion.html#LIBXML_DEBUG_RUNTIME"/>
-    <keyword type="macro" name="LIBXML_DLL_IMPORT" link="libxml2-xmlexports.html#LIBXML_DLL_IMPORT"/>
     <keyword type="macro" name="LIBXML_DOTTED_VERSION" link="libxml2-xmlversion.html#LIBXML_DOTTED_VERSION"/>
     <keyword type="macro" name="LIBXML_EXPR_ENABLED" link="libxml2-xmlversion.html#LIBXML_EXPR_ENABLED"/>
     <keyword type="macro" name="LIBXML_FTP_ENABLED" link="libxml2-xmlversion.html#LIBXML_FTP_ENABLED"/>
     <keyword type="macro" name="LIBXML_XPTR_ENABLED" link="libxml2-xmlversion.html#LIBXML_XPTR_ENABLED"/>
     <keyword type="macro" name="LIBXML_XPTR_LOCS_ENABLED" link="libxml2-xmlversion.html#LIBXML_XPTR_LOCS_ENABLED"/>
     <keyword type="macro" name="LIBXML_ZLIB_ENABLED" link="libxml2-xmlversion.html#LIBXML_ZLIB_ENABLED"/>
-    <keyword type="macro" name="MOVETO_ENDTAG" link="libxml2-parserInternals.html#MOVETO_ENDTAG"/>
-    <keyword type="macro" name="MOVETO_STARTTAG" link="libxml2-parserInternals.html#MOVETO_STARTTAG"/>
-    <keyword type="macro" name="SKIP_EOL" link="libxml2-parserInternals.html#SKIP_EOL"/>
     <keyword type="macro" name="SOCKET" link="libxml2-nanoftp.html#SOCKET"/>
     <keyword type="macro" name="WITHOUT_TRIO" link="libxml2-xmlversion.html#WITHOUT_TRIO"/>
     <keyword type="macro" name="WITH_TRIO" link="libxml2-xmlversion.html#WITH_TRIO"/>
     <keyword type="macro" name="XINCLUDE_PARSE_TEXT" link="libxml2-xinclude.html#XINCLUDE_PARSE_TEXT"/>
     <keyword type="macro" name="XINCLUDE_PARSE_XML" link="libxml2-xinclude.html#XINCLUDE_PARSE_XML"/>
     <keyword type="macro" name="XINCLUDE_PARSE_XPOINTER" link="libxml2-xinclude.html#XINCLUDE_PARSE_XPOINTER"/>
-    <keyword type="macro" name="XMLCALL" link="libxml2-xmlexports.html#XMLCALL"/>
-    <keyword type="macro" name="XMLCDECL" link="libxml2-xmlexports.html#XMLCDECL"/>
     <keyword type="macro" name="XMLPUBFUN" link="libxml2-xmlexports.html#XMLPUBFUN"/>
-    <keyword type="macro" name="XMLPUBLIC" link="libxml2-xmlexports.html#XMLPUBLIC"/>
     <keyword type="macro" name="XMLPUBVAR" link="libxml2-xmlexports.html#XMLPUBVAR"/>
     <keyword type="macro" name="XML_CAST_FPTR" link="libxml2-hash.html#XML_CAST_FPTR"/>
     <keyword type="macro" name="XML_CATALOGS_NAMESPACE" link="libxml2-catalog.html#XML_CATALOGS_NAMESPACE"/>
     <keyword type="macro" name="XML_CATALOG_PI" link="libxml2-catalog.html#XML_CATALOG_PI"/>
     <keyword type="macro" name="XML_COMPLETE_ATTRS" link="libxml2-parser.html#XML_COMPLETE_ATTRS"/>
     <keyword type="macro" name="XML_DEFAULT_VERSION" link="libxml2-parser.html#XML_DEFAULT_VERSION"/>
-    <keyword type="macro" name="XML_DEPRECATED" link="libxml2-xmlversion.html#XML_DEPRECATED"/>
     <keyword type="macro" name="XML_DETECT_IDS" link="libxml2-parser.html#XML_DETECT_IDS"/>
-    <keyword type="macro" name="XML_DOCB_DOCUMENT_NODE" link="libxml2-tree.html#XML_DOCB_DOCUMENT_NODE"/>
     <keyword type="macro" name="XML_GET_CONTENT" link="libxml2-tree.html#XML_GET_CONTENT"/>
     <keyword type="macro" name="XML_GET_LINE" link="libxml2-tree.html#XML_GET_LINE"/>
     <keyword type="macro" name="XML_LOCAL_NAMESPACE" link="libxml2-tree.html#XML_LOCAL_NAMESPACE"/>
     <keyword type="macro" name="XML_MAX_DICTIONARY_LIMIT" link="libxml2-parserInternals.html#XML_MAX_DICTIONARY_LIMIT"/>
+    <keyword type="macro" name="XML_MAX_HUGE_LENGTH" link="libxml2-parserInternals.html#XML_MAX_HUGE_LENGTH"/>
     <keyword type="macro" name="XML_MAX_LOOKUP_LIMIT" link="libxml2-parserInternals.html#XML_MAX_LOOKUP_LIMIT"/>
     <keyword type="macro" name="XML_MAX_NAMELEN" link="libxml2-parserInternals.html#XML_MAX_NAMELEN"/>
     <keyword type="macro" name="XML_MAX_NAME_LENGTH" link="libxml2-parserInternals.html#XML_MAX_NAME_LENGTH"/>
     <keyword type="macro" name="XML_SUBSTITUTE_NONE" link="libxml2-parserInternals.html#XML_SUBSTITUTE_NONE"/>
     <keyword type="macro" name="XML_SUBSTITUTE_PEREF" link="libxml2-parserInternals.html#XML_SUBSTITUTE_PEREF"/>
     <keyword type="macro" name="XML_SUBSTITUTE_REF" link="libxml2-parserInternals.html#XML_SUBSTITUTE_REF"/>
-    <keyword type="macro" name="XML_VCTXT_DTD_VALIDATED" link="libxml2-valid.html#XML_VCTXT_DTD_VALIDATED"/>
-    <keyword type="macro" name="XML_VCTXT_USE_PCTXT" link="libxml2-valid.html#XML_VCTXT_USE_PCTXT"/>
     <keyword type="macro" name="XML_XML_ID" link="libxml2-tree.html#XML_XML_ID"/>
     <keyword type="macro" name="XML_XML_NAMESPACE" link="libxml2-tree.html#XML_XML_NAMESPACE"/>
     <keyword type="macro" name="XML_XPATH_CHECKNS" link="libxml2-xpath.html#XML_XPATH_CHECKNS"/>
     <keyword type="macro" name="XML_XPATH_NOVAR" link="libxml2-xpath.html#XML_XPATH_NOVAR"/>
-    <keyword type="macro" name="XPATH_LOCATIONSET" link="libxml2-xpath.html#XPATH_LOCATIONSET"/>
-    <keyword type="macro" name="XPATH_POINT" link="libxml2-xpath.html#XPATH_POINT"/>
-    <keyword type="macro" name="XPATH_RANGE" link="libxml2-xpath.html#XPATH_RANGE"/>
     <keyword type="macro" name="XP_ERROR" link="libxml2-xpathInternals.html#XP_ERROR"/>
     <keyword type="macro" name="XP_ERROR0" link="libxml2-xpathInternals.html#XP_ERROR0"/>
     <keyword type="macro" name="htmlDefaultSubelement" link="libxml2-HTMLparser.html#htmlDefaultSubelement"/>
     <keyword type="function" name="hasInternalSubset ()" link="libxml2-SAX.html#hasInternalSubset"/>
     <keyword type="function" name="htmlAttrAllowed ()" link="libxml2-HTMLparser.html#htmlAttrAllowed"/>
     <keyword type="function" name="htmlAutoCloseTag ()" link="libxml2-HTMLparser.html#htmlAutoCloseTag"/>
-    <keyword type="function" name="htmlCreateFileParserCtxt ()" link="libxml2-parserInternals.html#htmlCreateFileParserCtxt"/>
+    <keyword type="function" name="htmlCreateFileParserCtxt ()" link="libxml2-HTMLparser.html#htmlCreateFileParserCtxt"/>
     <keyword type="function" name="htmlCreateMemoryParserCtxt ()" link="libxml2-HTMLparser.html#htmlCreateMemoryParserCtxt"/>
     <keyword type="function" name="htmlCreatePushParserCtxt ()" link="libxml2-HTMLparser.html#htmlCreatePushParserCtxt"/>
     <keyword type="function" name="htmlCtxtReadDoc ()" link="libxml2-HTMLparser.html#htmlCtxtReadDoc"/>
     <keyword type="function" name="htmlFreeParserCtxt ()" link="libxml2-HTMLparser.html#htmlFreeParserCtxt"/>
     <keyword type="function" name="htmlGetMetaEncoding ()" link="libxml2-HTMLtree.html#htmlGetMetaEncoding"/>
     <keyword type="function" name="htmlHandleOmittedElem ()" link="libxml2-HTMLparser.html#htmlHandleOmittedElem"/>
-    <keyword type="function" name="htmlInitAutoClose ()" link="libxml2-parserInternals.html#htmlInitAutoClose"/>
+    <keyword type="function" name="htmlInitAutoClose ()" link="libxml2-HTMLparser.html#htmlInitAutoClose"/>
     <keyword type="function" name="htmlIsAutoClosed ()" link="libxml2-HTMLparser.html#htmlIsAutoClosed"/>
     <keyword type="function" name="htmlIsBooleanAttr ()" link="libxml2-HTMLtree.html#htmlIsBooleanAttr"/>
     <keyword type="function" name="htmlIsScriptAttribute ()" link="libxml2-HTMLparser.html#htmlIsScriptAttribute"/>
     <keyword type="function" name="htmlNewDoc ()" link="libxml2-HTMLtree.html#htmlNewDoc"/>
     <keyword type="function" name="htmlNewDocNoDtD ()" link="libxml2-HTMLtree.html#htmlNewDocNoDtD"/>
     <keyword type="function" name="htmlNewParserCtxt ()" link="libxml2-HTMLparser.html#htmlNewParserCtxt"/>
+    <keyword type="function" name="htmlNewSAXParserCtxt ()" link="libxml2-HTMLparser.html#htmlNewSAXParserCtxt"/>
     <keyword type="function" name="htmlNodeDump ()" link="libxml2-HTMLtree.html#htmlNodeDump"/>
     <keyword type="function" name="htmlNodeDumpFile ()" link="libxml2-HTMLtree.html#htmlNodeDumpFile"/>
     <keyword type="function" name="htmlNodeDumpFileFormat ()" link="libxml2-HTMLtree.html#htmlNodeDumpFileFormat"/>
     <keyword type="function" name="xmlDictReference ()" link="libxml2-dict.html#xmlDictReference"/>
     <keyword type="function" name="xmlDictSetLimit ()" link="libxml2-dict.html#xmlDictSetLimit"/>
     <keyword type="function" name="xmlDictSize ()" link="libxml2-dict.html#xmlDictSize"/>
-    <keyword type="function" name="xmlDllMain ()" link="libxml2-threads.html#xmlDllMain"/>
     <keyword type="function" name="xmlDocCopyNode ()" link="libxml2-tree.html#xmlDocCopyNode"/>
     <keyword type="function" name="xmlDocCopyNodeList ()" link="libxml2-tree.html#xmlDocCopyNodeList"/>
     <keyword type="function" name="xmlDocDump ()" link="libxml2-tree.html#xmlDocDump"/>
     <keyword type="function" name="xmlEncodeEntities ()" link="libxml2-entities.html#xmlEncodeEntities"/>
     <keyword type="function" name="xmlEncodeEntitiesReentrant ()" link="libxml2-entities.html#xmlEncodeEntitiesReentrant"/>
     <keyword type="function" name="xmlEncodeSpecialChars ()" link="libxml2-entities.html#xmlEncodeSpecialChars"/>
-    <keyword type="function" name="xmlErrMemory ()" link="libxml2-parserInternals.html#xmlErrMemory"/>
     <keyword type="function" name="xmlExpCtxtNbCons ()" link="libxml2-xmlregexp.html#xmlExpCtxtNbCons"/>
     <keyword type="function" name="xmlExpCtxtNbNodes ()" link="libxml2-xmlregexp.html#xmlExpCtxtNbNodes"/>
     <keyword type="function" name="xmlExpDump ()" link="libxml2-xmlregexp.html#xmlExpDump"/>
     <keyword type="function" name="xmlMemRealloc ()" link="libxml2-xmlmemory.html#xmlMemRealloc"/>
     <keyword type="function" name="xmlMemSetup ()" link="libxml2-xmlmemory.html#xmlMemSetup"/>
     <keyword type="function" name="xmlMemShow ()" link="libxml2-xmlmemory.html#xmlMemShow"/>
+    <keyword type="function" name="xmlMemSize ()" link="libxml2-xmlmemory.html#xmlMemSize"/>
     <keyword type="function" name="xmlMemStrdupLoc ()" link="libxml2-xmlmemory.html#xmlMemStrdupLoc"/>
     <keyword type="function" name="xmlMemUsed ()" link="libxml2-xmlmemory.html#xmlMemUsed"/>
     <keyword type="function" name="xmlMemoryDump ()" link="libxml2-xmlmemory.html#xmlMemoryDump"/>
     <keyword type="function" name="xmlNewProp ()" link="libxml2-tree.html#xmlNewProp"/>
     <keyword type="function" name="xmlNewRMutex ()" link="libxml2-threads.html#xmlNewRMutex"/>
     <keyword type="function" name="xmlNewReference ()" link="libxml2-tree.html#xmlNewReference"/>
+    <keyword type="function" name="xmlNewSAXParserCtxt ()" link="libxml2-parser.html#xmlNewSAXParserCtxt"/>
     <keyword type="function" name="xmlNewStringInputStream ()" link="libxml2-parserInternals.html#xmlNewStringInputStream"/>
     <keyword type="function" name="xmlNewText ()" link="libxml2-tree.html#xmlNewText"/>
     <keyword type="function" name="xmlNewTextChild ()" link="libxml2-tree.html#xmlNewTextChild"/>
index 3b26bca..465ea82 100644 (file)
       <function line='103' file='tree' name='xmlFreeDoc'/>
       <function line='94' file='parser' name='xmlFreeParserCtxt'/>
       <function line='135' file='xmlmemory' name='xmlMemoryDump'/>
-      <function line='86' file='parser' name='xmlParseChunk'/>
+      <function line='80' file='parser' name='xmlParseChunk'/>
       <typedef line='45' file='tree' name='xmlParserCtxtPtr'/>
     </uses>
   </example>
       <function line='39' file='xmlreader' name='xmlTextReaderIsEmptyElement'/>
       <function line='37' file='xmlreader' name='xmlTextReaderNodeType'/>
       <typedef line='59' file='xmlreader' name='xmlTextReaderPtr'/>
-      <function line='67' file='xmlreader' name='xmlTextReaderRead'/>
+      <function line='64' file='xmlreader' name='xmlTextReaderRead'/>
     </uses>
   </example>
   <example filename='reader2.c'>
       <function line='81' file='xmlreader' name='xmlTextReaderIsValid'/>
       <function line='38' file='xmlreader' name='xmlTextReaderNodeType'/>
       <typedef line='60' file='xmlreader' name='xmlTextReaderPtr'/>
-      <function line='76' file='xmlreader' name='xmlTextReaderRead'/>
+      <function line='73' file='xmlreader' name='xmlTextReaderRead'/>
     </uses>
   </example>
   <example filename='reader3.c'>
     </includes>
     <uses>
       <function line='96' file='tree' name='xmlDocDump'/>
-      <function line='66' file='xmlreader' name='xmlFreeTextReader'/>
+      <function line='56' file='xmlreader' name='xmlFreeTextReader'/>
       <function line='38' file='xmlreader' name='xmlReaderForFile'/>
       <function line='62' file='xmlreader' name='xmlTextReaderCurrentDoc'/>
       <function line='43' file='xmlreader' name='xmlTextReaderPreservePattern'/>
       <typedef line='32' file='xmlreader' name='xmlTextReaderPtr'/>
-      <function line='52' file='xmlreader' name='xmlTextReaderRead'/>
+      <function line='50' file='xmlreader' name='xmlTextReaderRead'/>
     </uses>
   </example>
   <example filename='reader4.c'>
       <function line='104' file='xmlreader' name='xmlFreeTextReader'/>
       <function line='72' file='xmlreader' name='xmlReaderForFile'/>
       <function line='83' file='xmlreader' name='xmlReaderNewFile'/>
-      <function line='97' file='xmlreader' name='xmlTextReaderCurrentDoc'/>
+      <function line='34' file='xmlreader' name='xmlTextReaderCurrentDoc'/>
       <typedef line='54' file='xmlreader' name='xmlTextReaderPtr'/>
-      <function line='26' file='xmlreader' name='xmlTextReaderRead'/>
+      <function line='24' file='xmlreader' name='xmlTextReaderRead'/>
     </uses>
   </example>
   <example filename='testWriter.c'>
       <typedef line='1151' file='encoding' name='xmlCharEncodingHandlerPtr'/>
       <function line='901' file='tree' name='xmlDocSetRootElement'/>
       <function line='1156' file='encoding' name='xmlFindCharEncodingHandler'/>
-      <variable line='1180' file='globals' name='xmlFree'/>
-      <function line='1127' file='xmlwriter' name='xmlFreeTextWriter'/>
+      <variable line='113' file='globals' name='xmlFree'/>
+      <function line='327' file='xmlwriter' name='xmlFreeTextWriter'/>
       <variable line='1166' file='globals' name='xmlMalloc'/>
       <function line='885' file='tree' name='xmlNewDoc'/>
       <function line='894' file='tree' name='xmlNewDocNode'/>
       <function line='904' file='xmlwriter' name='xmlNewTextWriterTree'/>
       <typedef line='880' file='tree' name='xmlNodePtr'/>
       <variable line='1183' file='globals' name='xmlRealloc'/>
-      <function line='1129' file='tree' name='xmlSaveFileEnc'/>
-      <function line='1121' file='xmlwriter' name='xmlTextWriterEndDocument'/>
-      <function line='1111' file='xmlwriter' name='xmlTextWriterEndElement'/>
-      <typedef line='878' file='xmlwriter' name='xmlTextWriterPtr'/>
-      <function line='913' file='xmlwriter' name='xmlTextWriterStartDocument'/>
-      <function line='1096' file='xmlwriter' name='xmlTextWriterStartElement'/>
-      <function line='949' file='xmlwriter' name='xmlTextWriterWriteAttribute'/>
-      <function line='925' file='xmlwriter' name='xmlTextWriterWriteComment'/>
-      <function line='1103' file='xmlwriter' name='xmlTextWriterWriteElement'/>
-      <function line='959' file='xmlwriter' name='xmlTextWriterWriteFormatComment'/>
-      <function line='1073' file='xmlwriter' name='xmlTextWriterWriteFormatElement'/>
+      <function line='863' file='tree' name='xmlSaveFileEnc'/>
+      <function line='320' file='xmlwriter' name='xmlTextWriterEndDocument'/>
+      <function line='200' file='xmlwriter' name='xmlTextWriterEndElement'/>
+      <typedef line='72' file='xmlwriter' name='xmlTextWriterPtr'/>
+      <function line='85' file='xmlwriter' name='xmlTextWriterStartDocument'/>
+      <function line='94' file='xmlwriter' name='xmlTextWriterStartElement'/>
+      <function line='124' file='xmlwriter' name='xmlTextWriterWriteAttribute'/>
+      <function line='107' file='xmlwriter' name='xmlTextWriterWriteComment'/>
+      <function line='181' file='xmlwriter' name='xmlTextWriterWriteElement'/>
+      <function line='143' file='xmlwriter' name='xmlTextWriterWriteFormatComment'/>
+      <function line='162' file='xmlwriter' name='xmlTextWriterWriteFormatElement'/>
     </uses>
   </example>
   <example filename='tree1.c'>
       <include line='13'>&lt;libxml/tree.h&gt;</include>
     </includes>
     <uses>
-      <function line='77' file='tree' name='xmlAddChild'/>
+      <function line='76' file='tree' name='xmlAddChild'/>
       <function line='45' file='tree' name='xmlCreateIntSubset'/>
       <function line='40' file='tree' name='xmlDocSetRootElement'/>
-      <function line='87' file='tree' name='xmlNewChild'/>
+      <function line='51' file='tree' name='xmlNewChild'/>
       <function line='38' file='tree' name='xmlNewDoc'/>
-      <function line='73' file='tree' name='xmlNewDocNode'/>
+      <function line='39' file='tree' name='xmlNewDocNode'/>
       <function line='74' file='tree' name='xmlNewDocText'/>
-      <function line='88' file='tree' name='xmlNewProp'/>
+      <function line='65' file='tree' name='xmlNewProp'/>
       <function line='95' file='tree' name='xmlSaveFormatFileEnc'/>
     </uses>
   </example>
     <uses>
       <enum line='229' file='tree' name='XML_ELEMENT_NODE'/>
       <enum line='217' file='tree' name='XML_NAMESPACE_DECL'/>
-      <variable line='193' file='globals' name='xmlFree'/>
+      <variable line='173' file='globals' name='xmlFree'/>
       <function line='39' file='parser' name='xmlInitParser'/>
       <typedef line='206' file='tree' name='xmlNodePtr'/>
       <typedef line='218' file='tree' name='xmlNsPtr'/>
       <function line='94' file='parser' name='xmlParseFile'/>
-      <function line='180' file='xmlstring' name='xmlStrchr'/>
+      <function line='170' file='xmlstring' name='xmlStrchr'/>
       <function line='156' file='xmlstring' name='xmlStrdup'/>
       <typedef line='87' file='xpath' name='xmlXPathContextPtr'/>
       <function line='117' file='xpath' name='xmlXPathEvalExpression'/>
-      <function line='130' file='xpath' name='xmlXPathFreeContext'/>
+      <function line='111' file='xpath' name='xmlXPathFreeContext'/>
       <function line='129' file='xpath' name='xmlXPathFreeObject'/>
       <function line='101' file='xpath' name='xmlXPathNewContext'/>
       <typedef line='88' file='xpath' name='xmlXPathObjectPtr'/>
       <function line='95' file='parser' name='xmlParseFile'/>
       <typedef line='87' file='xpath' name='xmlXPathContextPtr'/>
       <function line='110' file='xpath' name='xmlXPathEvalExpression'/>
-      <function line='124' file='xpath' name='xmlXPathFreeContext'/>
+      <function line='113' file='xpath' name='xmlXPathFreeContext'/>
       <function line='123' file='xpath' name='xmlXPathFreeObject'/>
       <function line='102' file='xpath' name='xmlXPathNewContext'/>
       <typedef line='88' file='xpath' name='xmlXPathObjectPtr'/>
index 3f45687..ff7b1cd 100644 (file)
@@ -204,7 +204,7 @@ install</i> step or when installing the libxml2 development package:</p>
       <li> line 45: Type <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> from tree.h</li>
       <li> line 47: Type <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> from tree.h</li>
       <li> line 67: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-parser.html#xmlCreatePushParserCtxt">xmlCreatePushParserCtxt</a> from parser.h</li>
-      <li> line 86: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-parser.html#xmlParseChunk">xmlParseChunk</a> from parser.h</li>
+      <li> line 80: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-parser.html#xmlParseChunk">xmlParseChunk</a> from parser.h</li>
       <li> line 94: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-parser.html#xmlFreeParserCtxt">xmlFreeParserCtxt</a> from parser.h</li>
       <li> line 103: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlFreeDoc">xmlFreeDoc</a> from tree.h</li>
       <li> line 120: Macro <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlversion.html#LIBXML_TEST_VERSION">LIBXML_TEST_VERSION</a> from xmlversion.h</li>
@@ -248,13 +248,13 @@ install</i> step or when installing the libxml2 development package:</p>
     <p>Uses:</p>
     <ul>
       <li> line 38: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlNewDoc">xmlNewDoc</a> from tree.h</li>
+      <li> line 39: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlNewDocNode">xmlNewDocNode</a> from tree.h</li>
       <li> line 40: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlDocSetRootElement">xmlDocSetRootElement</a> from tree.h</li>
       <li> line 45: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlCreateIntSubset">xmlCreateIntSubset</a> from tree.h</li>
-      <li> line 73: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlNewDocNode">xmlNewDocNode</a> from tree.h</li>
+      <li> line 51: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlNewChild">xmlNewChild</a> from tree.h</li>
+      <li> line 65: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlNewProp">xmlNewProp</a> from tree.h</li>
       <li> line 74: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlNewDocText">xmlNewDocText</a> from tree.h</li>
-      <li> line 77: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlAddChild">xmlAddChild</a> from tree.h</li>
-      <li> line 87: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlNewChild">xmlNewChild</a> from tree.h</li>
-      <li> line 88: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlNewProp">xmlNewProp</a> from tree.h</li>
+      <li> line 76: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlAddChild">xmlAddChild</a> from tree.h</li>
       <li> line 95: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlSaveFormatFileEnc">xmlSaveFormatFileEnc</a> from tree.h</li>
     </ul>
     <p>Usage:</p>
@@ -285,11 +285,11 @@ install</i> step or when installing the libxml2 development package:</p>
       <li> line 88: Type <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> from xpath.h</li>
       <li> line 94: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-parser.html#xmlParseFile">xmlParseFile</a> from parser.h</li>
       <li> line 101: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xpath.html#xmlXPathNewContext">xmlXPathNewContext</a> from xpath.h</li>
+      <li> line 111: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xpath.html#xmlXPathFreeContext">xmlXPathFreeContext</a> from xpath.h</li>
       <li> line 117: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xpath.html#xmlXPathEvalExpression">xmlXPathEvalExpression</a> from xpath.h</li>
       <li> line 129: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xpath.html#xmlXPathFreeObject">xmlXPathFreeObject</a> from xpath.h</li>
-      <li> line 130: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xpath.html#xmlXPathFreeContext">xmlXPathFreeContext</a> from xpath.h</li>
       <li> line 156: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlstring.html#xmlStrdup">xmlStrdup</a> from xmlstring.h</li>
-      <li> line 180: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlstring.html#xmlStrchr">xmlStrchr</a> from xmlstring.h</li>
+      <li> line 170: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlstring.html#xmlStrchr">xmlStrchr</a> from xmlstring.h</li>
       <li> line 186: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xpathInternals.html#xmlXPathRegisterNs">xmlXPathRegisterNs</a> from xpathInternals.h</li>
       <li> line 206: Type <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> from tree.h</li>
       <li> line 218: Type <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlNsPtr">xmlNsPtr</a> from tree.h</li>
@@ -322,8 +322,8 @@ install</i> step or when installing the libxml2 development package:</p>
       <li> line 95: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-parser.html#xmlParseFile">xmlParseFile</a> from parser.h</li>
       <li> line 102: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xpath.html#xmlXPathNewContext">xmlXPathNewContext</a> from xpath.h</li>
       <li> line 110: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xpath.html#xmlXPathEvalExpression">xmlXPathEvalExpression</a> from xpath.h</li>
+      <li> line 113: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xpath.html#xmlXPathFreeContext">xmlXPathFreeContext</a> from xpath.h</li>
       <li> line 123: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xpath.html#xmlXPathFreeObject">xmlXPathFreeObject</a> from xpath.h</li>
-      <li> line 124: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xpath.html#xmlXPathFreeContext">xmlXPathFreeContext</a> from xpath.h</li>
       <li> line 127: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlDocDump">xmlDocDump</a> from tree.h</li>
       <li> line 162: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlNodeSetContent">xmlNodeSetContent</a> from tree.h</li>
     </ul>
@@ -350,7 +350,7 @@ install</i> step or when installing the libxml2 development package:</p>
       <li> line 44: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlstring.html#xmlStrlen">xmlStrlen</a> from xmlstring.h</li>
       <li> line 59: Type <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a> from xmlreader.h</li>
       <li> line 62: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlReaderForFile">xmlReaderForFile</a> from xmlreader.h</li>
-      <li> line 67: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlTextReaderRead">xmlTextReaderRead</a> from xmlreader.h</li>
+      <li> line 64: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlTextReaderRead">xmlTextReaderRead</a> from xmlreader.h</li>
       <li> line 69: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlFreeTextReader">xmlFreeTextReader</a> from xmlreader.h</li>
       <li> line 89: Macro <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlversion.html#LIBXML_TEST_VERSION">LIBXML_TEST_VERSION</a> from xmlversion.h</li>
       <li> line 94: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-parser.html#xmlCleanupParser">xmlCleanupParser</a> from parser.h</li>
@@ -378,7 +378,7 @@ install</i> step or when installing the libxml2 development package:</p>
       <li> line 45: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlstring.html#xmlStrlen">xmlStrlen</a> from xmlstring.h</li>
       <li> line 60: Type <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a> from xmlreader.h</li>
       <li> line 68: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlReaderForFile">xmlReaderForFile</a> from xmlreader.h</li>
-      <li> line 76: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlTextReaderRead">xmlTextReaderRead</a> from xmlreader.h</li>
+      <li> line 73: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlTextReaderRead">xmlTextReaderRead</a> from xmlreader.h</li>
       <li> line 81: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlTextReaderIsValid">xmlTextReaderIsValid</a> from xmlreader.h</li>
       <li> line 84: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlFreeTextReader">xmlFreeTextReader</a> from xmlreader.h</li>
     </ul>
@@ -398,9 +398,9 @@ install</i> step or when installing the libxml2 development package:</p>
       <li> line 32: Type <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a> from xmlreader.h</li>
       <li> line 38: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlReaderForFile">xmlReaderForFile</a> from xmlreader.h</li>
       <li> line 43: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlTextReaderPreservePattern">xmlTextReaderPreservePattern</a> from xmlreader.h</li>
-      <li> line 52: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlTextReaderRead">xmlTextReaderRead</a> from xmlreader.h</li>
+      <li> line 50: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlTextReaderRead">xmlTextReaderRead</a> from xmlreader.h</li>
+      <li> line 56: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlFreeTextReader">xmlFreeTextReader</a> from xmlreader.h</li>
       <li> line 62: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlTextReaderCurrentDoc">xmlTextReaderCurrentDoc</a> from xmlreader.h</li>
-      <li> line 66: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlFreeTextReader">xmlFreeTextReader</a> from xmlreader.h</li>
       <li> line 96: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlDocDump">xmlDocDump</a> from tree.h</li>
     </ul>
     <p>Usage:</p>
@@ -416,11 +416,11 @@ install</i> step or when installing the libxml2 development package:</p>
     </ul>
     <p>Uses:</p>
     <ul>
-      <li> line 26: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlTextReaderRead">xmlTextReaderRead</a> from xmlreader.h</li>
+      <li> line 24: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlTextReaderRead">xmlTextReaderRead</a> from xmlreader.h</li>
+      <li> line 34: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlTextReaderCurrentDoc">xmlTextReaderCurrentDoc</a> from xmlreader.h</li>
       <li> line 54: Type <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlTextReaderPtr">xmlTextReaderPtr</a> from xmlreader.h</li>
       <li> line 72: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlReaderForFile">xmlReaderForFile</a> from xmlreader.h</li>
       <li> line 83: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlReaderNewFile">xmlReaderNewFile</a> from xmlreader.h</li>
-      <li> line 97: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlTextReaderCurrentDoc">xmlTextReaderCurrentDoc</a> from xmlreader.h</li>
       <li> line 104: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlreader.html#xmlFreeTextReader">xmlFreeTextReader</a> from xmlreader.h</li>
     </ul>
     <p>Usage:</p>
@@ -440,30 +440,30 @@ install</i> step or when installing the libxml2 development package:</p>
     </ul>
     <p>Uses:</p>
     <ul>
+      <li> line 72: Type <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> from xmlwriter.h</li>
       <li> line 76: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlNewTextWriterFilename">xmlNewTextWriterFilename</a> from xmlwriter.h</li>
+      <li> line 85: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlTextWriterStartDocument">xmlTextWriterStartDocument</a> from xmlwriter.h</li>
+      <li> line 94: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlTextWriterStartElement">xmlTextWriterStartElement</a> from xmlwriter.h</li>
+      <li> line 107: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlTextWriterWriteComment">xmlTextWriterWriteComment</a> from xmlwriter.h</li>
+      <li> line 124: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlTextWriterWriteAttribute">xmlTextWriterWriteAttribute</a> from xmlwriter.h</li>
+      <li> line 143: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlTextWriterWriteFormatComment">xmlTextWriterWriteFormatComment</a> from xmlwriter.h</li>
+      <li> line 162: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlTextWriterWriteFormatElement">xmlTextWriterWriteFormatElement</a> from xmlwriter.h</li>
+      <li> line 181: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlTextWriterWriteElement">xmlTextWriterWriteElement</a> from xmlwriter.h</li>
+      <li> line 200: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlTextWriterEndElement">xmlTextWriterEndElement</a> from xmlwriter.h</li>
+      <li> line 320: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlTextWriterEndDocument">xmlTextWriterEndDocument</a> from xmlwriter.h</li>
+      <li> line 327: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlFreeTextWriter">xmlFreeTextWriter</a> from xmlwriter.h</li>
       <li> line 341: Type <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlBufferPtr">xmlBufferPtr</a> from tree.h</li>
       <li> line 347: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlBufferCreate">xmlBufferCreate</a> from tree.h</li>
       <li> line 355: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlNewTextWriterMemory">xmlNewTextWriterMemory</a> from xmlwriter.h</li>
       <li> line 613: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlBufferFree">xmlBufferFree</a> from tree.h</li>
       <li> line 632: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlNewTextWriterDoc">xmlNewTextWriterDoc</a> from xmlwriter.h</li>
-      <li> line 878: Type <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> from xmlwriter.h</li>
+      <li> line 863: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlSaveFileEnc">xmlSaveFileEnc</a> from tree.h</li>
       <li> line 880: Type <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> from tree.h</li>
       <li> line 885: Macro <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-parser.html#XML_DEFAULT_VERSION">XML_DEFAULT_VERSION</a> from parser.h</li>
       <li> line 885: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlNewDoc">xmlNewDoc</a> from tree.h</li>
       <li> line 894: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlNewDocNode">xmlNewDocNode</a> from tree.h</li>
       <li> line 901: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlDocSetRootElement">xmlDocSetRootElement</a> from tree.h</li>
       <li> line 904: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlNewTextWriterTree">xmlNewTextWriterTree</a> from xmlwriter.h</li>
-      <li> line 913: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlTextWriterStartDocument">xmlTextWriterStartDocument</a> from xmlwriter.h</li>
-      <li> line 925: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlTextWriterWriteComment">xmlTextWriterWriteComment</a> from xmlwriter.h</li>
-      <li> line 949: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlTextWriterWriteAttribute">xmlTextWriterWriteAttribute</a> from xmlwriter.h</li>
-      <li> line 959: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlTextWriterWriteFormatComment">xmlTextWriterWriteFormatComment</a> from xmlwriter.h</li>
-      <li> line 1073: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlTextWriterWriteFormatElement">xmlTextWriterWriteFormatElement</a> from xmlwriter.h</li>
-      <li> line 1096: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlTextWriterStartElement">xmlTextWriterStartElement</a> from xmlwriter.h</li>
-      <li> line 1103: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlTextWriterWriteElement">xmlTextWriterWriteElement</a> from xmlwriter.h</li>
-      <li> line 1111: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlTextWriterEndElement">xmlTextWriterEndElement</a> from xmlwriter.h</li>
-      <li> line 1121: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlTextWriterEndDocument">xmlTextWriterEndDocument</a> from xmlwriter.h</li>
-      <li> line 1127: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-xmlwriter.html#xmlFreeTextWriter">xmlFreeTextWriter</a> from xmlwriter.h</li>
-      <li> line 1129: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-tree.html#xmlSaveFileEnc">xmlSaveFileEnc</a> from tree.h</li>
       <li> line 1151: Type <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-encoding.html#xmlCharEncodingHandlerPtr">xmlCharEncodingHandlerPtr</a> from encoding.h</li>
       <li> line 1156: Function <a href="https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-encoding.html#xmlFindCharEncodingHandler">xmlFindCharEncodingHandler</a> from encoding.h</li>
     </ul>
index 8ce8d12..c422904 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # Indexes the examples and build an XML description
 #
index 49191d5..ae8d332 100644 (file)
@@ -136,7 +136,7 @@ int main(int argc, char **argv) {
     return(0);
 }
 #else /* ! LIBXML_PUSH_ENABLED */
-int main(int argc, char **argv) {
+int main(void) {
     fprintf(stderr, "Library not compiled with push parser support\n");
     return(0);
 }
diff --git a/doc/libxml-doc.el b/doc/libxml-doc.el
deleted file mode 100644 (file)
index 43d9688..0000000
+++ /dev/null
@@ -1,222 +0,0 @@
-;;; libxml-doc.el - look up libxml-symbols and start browser on documentation
-
-;; Author: Felix Natter <fnatter@gmx.net>, Geert Kloosterman <geertk@ai.rug.nl>
-;; Created: Jun 21 2000
-;; Keywords: libxml documentation
-
-;; 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 the Free Software Foundation; either version 2
-;; of the License, or (at your option) any later version.
-;; 
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-;; 
-;; 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- ;;; Commentary / README
-
-;; these functions allow you to browse the libxml documentation
-;; (using lynx within emacs by default)
-;;
-;; ----- Installing
-;; 1. add the following to ~/.emacs (adapt path and remove comments !)
-;; (autoload 'libxmldoc-lookup-symbol "~/elisp/libxml-doc" 
-;;  "Look up libxml-symbols and start browser on documentation." t)
-;; or put this file in load-path and use this:
-;; (autoload 'libxmldoc-lookup-symbol "libxml-doc"
-;;  "Look up libxml-symbols and start browser on documentation." t)
-;;
-;; 2. adapt libxmldoc-root:
-;; i.e. (setq libxmldoc-root "~/libxml2-2.0.0/doc/html")
-;;
-;; 3. change the filter-regex: by default, cpp-defines, callbacks and
-;; html-functions are excluded (C-h v libxmldoc-filter-regexp)
-;;
-;; 4. consider customizing libxmldoc-browse-url (lynx by default);
-;; cannot use Emacs/W3 4.0pre46 because it has problems with the html
-;;
-;; ----- Using
-;; call M-x libxmldoc-lookup-symbol: this will prompt with completion and
-;; then open the browser showing the documentation. If the word around the
-;; point matches a symbol, that is used instead.  You can also call
-;; libxmldoc-lookup-symbol noninteractively and pass the symbol.
-
-;; Note:
-;; an alternative to libxml-doc is emacs tags:
-;; $ cd libxml2-2.3.8
-;; $ make TAGS
-;; $ emacs
-;; M-. (M-x find-tag) ...  or
-;; M-x tags-search ... RET M-, M-, ...
-;; (for more information: info emacs RET m Tags RET)
-
-
- ;;; ChangeLog:
-;; Wed Jun 21 01:07:12 2000: initial release
-;; Wed Jun 21 01:45:29 2000: added libxmldoc-lookup-symbol-at-point
-;; Wed Jun 21 23:37:58 2000: libxmldoc-lookup-symbol now uses
-;; (thing-at-point 'word) if it matches a symbol
-;; Thu Jun 22 02:37:46 2000: filtering is only done for completion
-;; Thu Jun 22 21:03:41 2000: libxmldoc-browse-url can be customized
-;; Thu May 31 2001 (Geert): 
-;;       - Changed the `gnome-xml-' html file prefix into `libxml-'.
-;;       - Changed the 'word match from thing-at-point into 'symbol.
-;;         With 'word, identifiers with an underscore (e.g. BAD_CAST)
-;;         don't get matched.
-;; Fri Jun  8 16:29:18 2001, Sat Jun 23 16:19:47 2001:
-;; complete rewrite of libxmldoc-lookup-symbol
-;; by Felix Natter <fnatter@gmx.net>, Geert Kloosterman <geertk@ai.rug.nl>:
-;;       - Now keeps the list of symbols between calls to speed things up.
-;;       - filtering is only used when no symbol is passed and
-;;       thing-at-point does not match a symbol and "*" + thing-at-point
-;;       does not match a symbol (this is used to catch callbacks) and
-;;       libxmldoc-filter-regexp is non-nil.
-;; Sat Jun 23 16:20:34 2001: update the docstrings
-;; Sat Jun 23 16:22:54 2001 (Geert Kloosterman <geertk@ai.rug.nl>):
-;; update README: use autoload instead of load+c-mode-hook
-;; Sat Jul 7 19:00:31 2001: fixed a problem with XEmacs: the
-;; string-match of XEmacs when used in completing-read used the
-;; minibuffer's value of case-fold-search, and not the one in the
-;; c-mode buffer that we had set => so there's a new *-string-match-cs
-;; (case sensitive) function which binds case-fold-search and runs string-match
-;; Wed Sep 1 20:26:29 2004: adapted for libxml2-2.6.9: handle
-;; document-relative (#XXX) links
-
-;;; TODO:
-;; - use command-execute for libxmldoc-browse-url
-;; - keep (match-string 1) in a variable (libxmldoc-get-list-of-symbols)
-;;   (only if it improves performance)
-;; - check the (require ..)-statements
-
- ;;; Code:
-
-(require 'browse-url)
-(require 'term)
-
-(defvar libxmldoc-root "~/src/libxml2-2.3.8/doc/html"
-  "The root-directory of the libxml2-documentation (~ will be expanded).")
-(defvar libxmldoc-filter-regexp "^html\\|^\\*\\|^[A-Z_]+"
-  "Symbols that match this regular expression will be excluded when doing
-completion and no symbol is specified.
- For example:
-   callbacks:     \"^\\\\*\" 
-   cpp-defines:   \"[A-Z_]+\"
-   xml-functions  \"^xml\"
-   html-functions \"^html\"
-   sax-functions  \".*SAX\"
-By default, callbacks, cpp-defines and html* are excluded.
-Set this to nil if you don't want filtering.")
-(defvar libxmldoc-browse-url 'browse-url-lynx-emacs
-  "Browser used for browsing documentation. Emacs/W3 4.0pre46 cannot handle
-the html (and would be too slow), so lynx-emacs is used by default.")
-(defvar libxmldoc-symbol-history nil
-  "History for looking up libxml-symbols.")
-(defvar libxmldoc-symbols nil 
-  "The list of libxml-symbols.")
-
- ;;;; public functions
-
-(defun libxmldoc-lookup-symbol(&optional symbol)
-  "Look up xml-symbol." (interactive)
-  ;; setting case-fold-search is now done in libxmldoc-string-match-cs
-
-  ;; Build up a symbol list if necessary
-  (if (null libxmldoc-symbols)
-      (setq libxmldoc-symbols (libxmldoc-get-list-of-symbols)))
-    
-  (cond
-   (symbol ;; symbol is specified as argument
-    (if (not (assoc symbol libxmldoc-symbols))
-        (setq symbol nil)))
-   ((assoc (thing-at-point 'symbol) libxmldoc-symbols)
-    (setq symbol (thing-at-point 'symbol)))
-   ;; this is needed to catch callbacks
-   ;; note: this could be rewritten to use (thing-at-point 'word)
-   ((assoc (concat "*" (thing-at-point 'symbol)) libxmldoc-symbols)
-    (setq symbol (concat "*" (thing-at-point 'symbol))))
-   )
-
-  ;; omit "" t) from call to completing-read for the sake of xemacs
-  (setq symbol (completing-read 
-                "Libxml: " libxmldoc-symbols
-                (if (or symbol (null libxmldoc-filter-regexp))
-                    nil
-                  '(lambda(key,value)
-                     (not (libxmldoc-string-match-cs libxmldoc-filter-regexp
-                                                     (car key,value)))))
-                t symbol
-                'libxmldoc-symbol-history))
-    
-    
-  ;; start browser
-  (apply libxmldoc-browse-url 
-         (list (cdr (assoc symbol libxmldoc-symbols)))))
-
-;; (if (or symbol
-;;         (null libxmldoc-filter-regexp))
-;;     libxmldoc-symbols
-;;   (mapcar
-;;    '(lambda(key,value)
-;;       (if (null (string-match 
-;;                  libxmldoc-filter-regexp
-;;                  (car key,value)))
-;;           key,value))
-;;    libxmldoc-symbols))
-
-
-;;;; internal
-
-(defun libxmldoc-string-match-cs(regexp str)
-  "This is needed because string-match in XEmacs uses the current-
-buffer's value of case-fold-search (different from GNU Emacs)."
-  (let ((case-fold-search nil))
-    (string-match regexp str)))
-
-(defun libxmldoc-get-list-of-symbols()
-  "Get the list of html-links in the libxml-documentation."
-  (let ((files
-         (directory-files
-          libxmldoc-root t
-          (concat "^" (if (file-exists-p (concat libxmldoc-root
-                                                 "/libxml-parser.html"))
-                          "libxml-"
-                        "gnome-xml-")
-                  ".*\\.html$") t))
-        (symbols ())
-        (case-fold-search t)
-        (uri))
-    (message "collecting libxml-symbols...")
-    (while (car files)
-      (message "processing %s" (car files))
-      (with-temp-buffer
-        (insert-file-contents (car files))
-        (goto-char (point-min))
-        (while (re-search-forward
-                "<a[^>]*href[ \t\n]*=[ \t\n]*\"\\([^=>]*\\)\"[^>]*>" nil t nil)
-          ;; is it a relative link (#XXX)?
-          (if (char-equal (elt (match-string 1) 0) ?#)
-              (setq uri (concat "file://" (car files) (match-string 1)))
-            (setq uri (concat "file://" (expand-file-name libxmldoc-root)
-                              "/" (match-string 1))))
-          (if (not (re-search-forward "\\([^<]*\\)<" nil t nil))
-              (error "regexp error while getting libxml-symbols.."))
-          ;; this needs add-to-list because i.e. xmlChar appears often
-          (if (not (string-equal "" (match-string 1)))
-              (add-to-list 'symbols (cons (match-string 1) uri))))
-        ;;  (setq symbols (cons (cons (match-string 1) uri) symbols)))
-        )
-      (setq files (cdr files)))
-    symbols))
-
-(provide 'libxmldoc)
-
-;;; libxml-doc.el ends here
-\f
-;;; Local Variables:
-;;; indent-tabs-mode: nil
-;;; End:
index 89a4476..303da57 100644 (file)
@@ -43,6 +43,7 @@
      <exports symbol='UTF8ToHtml' type='function'/>
      <exports symbol='htmlAttrAllowed' type='function'/>
      <exports symbol='htmlAutoCloseTag' type='function'/>
+     <exports symbol='htmlCreateFileParserCtxt' type='function'/>
      <exports symbol='htmlCreateMemoryParserCtxt' type='function'/>
      <exports symbol='htmlCreatePushParserCtxt' type='function'/>
      <exports symbol='htmlCtxtReadDoc' type='function'/>
      <exports symbol='htmlEntityValueLookup' type='function'/>
      <exports symbol='htmlFreeParserCtxt' type='function'/>
      <exports symbol='htmlHandleOmittedElem' type='function'/>
+     <exports symbol='htmlInitAutoClose' type='function'/>
      <exports symbol='htmlIsAutoClosed' type='function'/>
      <exports symbol='htmlIsScriptAttribute' type='function'/>
      <exports symbol='htmlNewParserCtxt' type='function'/>
+     <exports symbol='htmlNewSAXParserCtxt' type='function'/>
      <exports symbol='htmlNodeStatus' type='function'/>
      <exports symbol='htmlParseCharRef' type='function'/>
      <exports symbol='htmlParseChunk' type='function'/>
      <exports symbol='xmlLoadExternalEntity' type='function'/>
      <exports symbol='xmlNewIOInputStream' type='function'/>
      <exports symbol='xmlNewParserCtxt' type='function'/>
+     <exports symbol='xmlNewSAXParserCtxt' type='function'/>
      <exports symbol='xmlParseBalancedChunkMemory' type='function'/>
      <exports symbol='xmlParseBalancedChunkMemoryRecover' type='function'/>
      <exports symbol='xmlParseChunk' type='function'/>
      <exports symbol='IS_LETTER_CH' type='macro'/>
      <exports symbol='IS_PUBIDCHAR' type='macro'/>
      <exports symbol='IS_PUBIDCHAR_CH' type='macro'/>
-     <exports symbol='MOVETO_ENDTAG' type='macro'/>
-     <exports symbol='MOVETO_STARTTAG' type='macro'/>
-     <exports symbol='SKIP_EOL' type='macro'/>
      <exports symbol='XML_MAX_DICTIONARY_LIMIT' type='macro'/>
+     <exports symbol='XML_MAX_HUGE_LENGTH' type='macro'/>
      <exports symbol='XML_MAX_LOOKUP_LIMIT' type='macro'/>
      <exports symbol='XML_MAX_NAMELEN' type='macro'/>
      <exports symbol='XML_MAX_NAME_LENGTH' type='macro'/>
      <exports symbol='xmlStringComment' type='variable'/>
      <exports symbol='xmlStringText' type='variable'/>
      <exports symbol='xmlStringTextNoenc' type='variable'/>
-     <exports symbol='htmlCreateFileParserCtxt' type='function'/>
-     <exports symbol='htmlInitAutoClose' type='function'/>
      <exports symbol='inputPop' type='function'/>
      <exports symbol='inputPush' type='function'/>
      <exports symbol='namePop' type='function'/>
      <exports symbol='xmlCurrentChar' type='function'/>
      <exports symbol='xmlDecodeEntities' type='function'/>
      <exports symbol='xmlEntityReferenceFunc' type='function'/>
-     <exports symbol='xmlErrMemory' type='function'/>
      <exports symbol='xmlFreeInputStream' type='function'/>
      <exports symbol='xmlHandleEntity' type='function'/>
      <exports symbol='xmlIsLetter' type='function'/>
      <exports symbol='xmlRMutex' type='typedef'/>
      <exports symbol='xmlRMutexPtr' type='typedef'/>
      <exports symbol='xmlCleanupThreads' type='function'/>
-     <exports symbol='xmlDllMain' type='function'/>
      <exports symbol='xmlFreeMutex' type='function'/>
      <exports symbol='xmlFreeRMutex' type='function'/>
      <exports symbol='xmlGetGlobalState' type='function'/>
      <author>Daniel Veillard </author>
      <exports symbol='BASE_BUFFER_SIZE' type='macro'/>
      <exports symbol='LIBXML2_NEW_BUFFER' type='macro'/>
-     <exports symbol='XML_DOCB_DOCUMENT_NODE' type='macro'/>
      <exports symbol='XML_GET_CONTENT' type='macro'/>
      <exports symbol='XML_GET_LINE' type='macro'/>
      <exports symbol='XML_LOCAL_NAMESPACE' type='macro'/>
      <summary>The DTD validation</summary>
      <description>API for the DTD handling and the validity checking </description>
      <author>Daniel Veillard </author>
-     <exports symbol='XML_VCTXT_DTD_VALIDATED' type='macro'/>
-     <exports symbol='XML_VCTXT_USE_PCTXT' type='macro'/>
      <exports symbol='xmlAttributeTable' type='typedef'/>
      <exports symbol='xmlAttributeTablePtr' type='typedef'/>
      <exports symbol='xmlElementTable' type='typedef'/>
     <file name='xmlexports'>
      <summary>macros for marking symbols as exportable/importable.</summary>
      <description>macros for marking symbols as exportable/importable. </description>
-     <exports symbol='LIBXML_DLL_IMPORT' type='macro'/>
-     <exports symbol='XMLCALL' type='macro'/>
-     <exports symbol='XMLCDECL' type='macro'/>
      <exports symbol='XMLPUBFUN' type='macro'/>
-     <exports symbol='XMLPUBLIC' type='macro'/>
      <exports symbol='XMLPUBVAR' type='macro'/>
     </file>
     <file name='xmlmemory'>
      <exports symbol='xmlMemRealloc' type='function'/>
      <exports symbol='xmlMemSetup' type='function'/>
      <exports symbol='xmlMemShow' type='function'/>
+     <exports symbol='xmlMemSize' type='function'/>
      <exports symbol='xmlMemStrdupLoc' type='function'/>
      <exports symbol='xmlMemUsed' type='function'/>
      <exports symbol='xmlMemoryDump' type='function'/>
      <exports symbol='LIBXML_ZLIB_ENABLED' type='macro'/>
      <exports symbol='WITHOUT_TRIO' type='macro'/>
      <exports symbol='WITH_TRIO' type='macro'/>
-     <exports symbol='XML_DEPRECATED' type='macro'/>
      <exports symbol='xmlCheckVersion' type='function'/>
     </file>
     <file name='xmlwriter'>
       <info>Whether Debugging module is configured in</info>
     </macro>
     <macro name='LIBXML_DEBUG_RUNTIME' file='xmlversion'>
-      <info>Whether the runtime debugging is configured in</info>
-    </macro>
-    <macro name='LIBXML_DLL_IMPORT' file='xmlexports'>
+      <info>Removed</info>
     </macro>
     <macro name='LIBXML_DOTTED_VERSION' file='xmlversion'>
       <info>the version string like &quot;1.2.3&quot;</info>
     <macro name='LIBXML_ZLIB_ENABLED' file='xmlversion'>
       <info>Whether the Zlib support is compiled in</info>
     </macro>
-    <macro name='MOVETO_ENDTAG' file='parserInternals'>
-      <info>Skips to the next &apos;&gt;&apos; char.</info>
-      <arg name='p' info='and UTF8 string pointer'/>
-    </macro>
-    <macro name='MOVETO_STARTTAG' file='parserInternals'>
-      <info>Skips to the next &apos;&lt;&apos; char.</info>
-      <arg name='p' info='and UTF8 string pointer'/>
-    </macro>
-    <macro name='SKIP_EOL' file='parserInternals'>
-      <info>Skips the end of line chars.</info>
-      <arg name='p' info='and UTF8 string pointer'/>
-    </macro>
     <macro name='SOCKET' file='nanoftp'>
       <info>macro used to provide portability of code to windows sockets</info>
     </macro>
     <macro name='XINCLUDE_PARSE_XPOINTER' file='xinclude'>
       <info>Macro defining &quot;xpointer&quot;</info>
     </macro>
-    <macro name='XMLCALL' file='xmlexports'>
-      <info>Macro which declares the calling convention for exported functions</info>
-    </macro>
-    <macro name='XMLCDECL' file='xmlexports'>
-      <info>Macro which declares the calling convention for exported functions that use &apos;...&apos;.</info>
-    </macro>
     <macro name='XMLPUBFUN' file='xmlexports'>
       <info>Macro which declares an exportable function</info>
     </macro>
-    <macro name='XMLPUBLIC' file='xmlexports'>
-      <info>Macro which declares a public symbol</info>
-    </macro>
     <macro name='XMLPUBVAR' file='xmlexports'>
       <info>Macro which declares an exportable variable</info>
     </macro>
     <macro name='XML_DEFAULT_VERSION' file='parser'>
       <info>The default version of XML used: 1.0</info>
     </macro>
-    <macro name='XML_DEPRECATED' file='xmlversion'>
-      <info>Macro used to indicate that a function, variable, type or struct member is deprecated.</info>
-    </macro>
     <macro name='XML_DETECT_IDS' file='parser'>
       <info>Bit in the loadsubset context field to tell to do ID/REFs lookups. Use it to initialize xmlLoadExtDtdDefaultValue.</info>
     </macro>
-    <macro name='XML_DOCB_DOCUMENT_NODE' file='tree'>
-    </macro>
     <macro name='XML_GET_CONTENT' file='tree'>
       <info>Macro to extract the content pointer of a node.</info>
     </macro>
     <macro name='XML_MAX_DICTIONARY_LIMIT' file='parserInternals'>
       <info>Maximum size allowed by the parser for a dictionary by default This is not a limitation of the parser but a safety boundary feature, use XML_PARSE_HUGE option to override it. Introduced in 2.9.0</info>
     </macro>
+    <macro name='XML_MAX_HUGE_LENGTH' file='parserInternals'>
+      <info>Maximum size allowed when XML_PARSE_HUGE is set.</info>
+    </macro>
     <macro name='XML_MAX_LOOKUP_LIMIT' file='parserInternals'>
       <info>Maximum size allowed by the parser for ahead lookup This is an upper boundary enforced by the parser to avoid bad behaviour on &quot;unfriendly&apos; content Introduced in 2.9.0</info>
     </macro>
     <macro name='XML_SUBSTITUTE_REF' file='parserInternals'>
       <info>Whether general entities need to be substituted.</info>
     </macro>
-    <macro name='XML_VCTXT_DTD_VALIDATED' file='valid'>
-      <info>Set after xmlValidateDtdFinal was called.</info>
-    </macro>
-    <macro name='XML_VCTXT_USE_PCTXT' file='valid'>
-      <info>Set if the validation context is part of a parser context.</info>
-    </macro>
     <macro name='XML_XML_ID' file='tree'>
       <info>This is the name for the special xml:id attribute</info>
     </macro>
     <macro name='XML_XPATH_NOVAR' file='xpath'>
       <info>forbid variables in expression</info>
     </macro>
-    <macro name='XPATH_LOCATIONSET' file='xpath'>
-    </macro>
-    <macro name='XPATH_POINT' file='xpath'>
-    </macro>
-    <macro name='XPATH_RANGE' file='xpath'>
-    </macro>
     <macro name='XP_ERROR' file='xpathInternals'>
       <info>Macro to raise an XPath error and return.</info>
       <arg name='X' info='the error code'/>
     <enum name='XML_BUFFER_ALLOC_DOUBLEIT' file='tree' value='1' type='xmlBufferAllocationScheme' info='double each time one need to grow'/>
     <enum name='XML_BUFFER_ALLOC_EXACT' file='tree' value='2' type='xmlBufferAllocationScheme' info='grow only to the minimal size'/>
     <enum name='XML_BUFFER_ALLOC_HYBRID' file='tree' value='5' type='xmlBufferAllocationScheme' info='exact up to a threshold, and doubleit thereafter'/>
-    <enum name='XML_BUFFER_ALLOC_IMMUTABLE' file='tree' value='3' type='xmlBufferAllocationScheme' info='immutable buffer'/>
+    <enum name='XML_BUFFER_ALLOC_IMMUTABLE' file='tree' value='3' type='xmlBufferAllocationScheme' info='immutable buffer, deprecated'/>
     <enum name='XML_BUFFER_ALLOC_IO' file='tree' value='4' type='xmlBufferAllocationScheme' info='special allocation scheme used for I/O'/>
     <enum name='XML_BUF_OVERFLOW' file='xmlerror' value='7000' type='xmlParserErrors'/>
     <enum name='XML_C14N_1_0' file='c14n' value='0' type='xmlC14NMode' info='Original C14N 1.0 spec'/>
@@ -6180,9 +6134,8 @@ set at the end of parsing'/>
       <field name='nexte' type='struct _xmlEntity *' info=' unused'/>
       <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 entities
-* references done from that entity
-* and if it contains &apos;&lt;&apos;'/>
+      <field name='flags' type='int' info=' various flags'/>
+      <field name='expandedSize' type='unsigned long' info=' expanded size'/>
     </struct>
     <typedef name='xmlEntityPtr' file='tree' type='xmlEntity *'/>
     <typedef name='xmlEntityType' file='entities' type='enum'/>
@@ -6425,7 +6378,7 @@ actually an xmlCharEncoding'/>
 *'/>
       <field name='lastError' type='xmlError' info=''/>
       <field name='parseMode' type='xmlParserMode' info=' the parser mode'/>
-      <field name='nbentities' type='unsigned long' info=' number of entities references'/>
+      <field name='nbentities' type='unsigned long' info=' unused'/>
       <field name='sizeentities' type='unsigned long' info=' size of parsed entities for use by HTML non-recursive parser'/>
       <field name='nodeInfo' type='xmlParserNodeInfo *' info=' Current NodeInfo'/>
       <field name='nodeInfoNr' type='int' info=' Depth of the parsing stack'/>
@@ -6433,6 +6386,9 @@ actually an xmlCharEncoding'/>
       <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'/>
+      <field name='endCheckState' type='int' info=' quote state for push parser'/>
+      <field name='nbErrors' type='unsigned short' info=' number of errors'/>
+      <field name='nbWarnings' type='unsigned short' info=' number of warnings'/>
     </struct>
     <typedef name='xmlParserCtxtPtr' file='tree' type='xmlParserCtxt *'/>
     <typedef name='xmlParserErrors' file='xmlerror' type='enum'/>
@@ -6445,16 +6401,15 @@ actually an xmlCharEncoding'/>
       <field name='end' type='const xmlChar *' info=' end of the array to parse'/>
       <field name='length' type='int' info=' length if known'/>
       <field name='line' type='int' info=' Current line'/>
-      <field name='col' type='int' info='* NOTE: consumed is only tested for equality in the parser code,
-*       so even if there is an overflow this should not give troubles
-*       for parsing very large instances.
-*'/>
+      <field name='col' type='int' info=' Current column'/>
       <field name='consumed' type='unsigned long' info=' How many xmlChars already consumed'/>
       <field name='free' type='xmlParserInputDeallocate' info=' function to deallocate the base'/>
       <field name='encoding' type='const xmlChar *' info=' the encoding string for entity'/>
       <field name='version' type='const xmlChar *' info=' the version string for entity'/>
       <field name='standalone' type='int' info=' Was that entity marked standalone'/>
       <field name='id' type='int' info=' an unique identifier for the entity'/>
+      <field name='parentConsumed' type='unsigned long' info=' consumed bytes from parents'/>
+      <field name='entity' type='xmlEntityPtr' info=' entity, if any'/>
     </struct>
     <struct name='xmlParserInputBuffer' file='tree' type='struct _xmlParserInputBuffer'>
       <field name='context' type='void *' info=''/>
@@ -6948,7 +6903,7 @@ Could we use @subtypes for this?'/>
       <field name='comp' type='xmlXPathCompExprPtr' info=' the precompiled expression'/>
       <field name='xptr' type='int' info=' it this an XPointer expression'/>
       <field name='ancestor' type='xmlNodePtr' info=' used for walking preceding axis'/>
-      <field name='valueFrame' type='int' info=' used to limit Pop on the stack'/>
+      <field name='valueFrame' type='int' info=' unused'/>
     </struct>
     <typedef name='xmlXPathParserContextPtr' file='xpath' type='xmlXPathParserContext *'/>
     <struct name='xmlXPathType' file='xpath' type='struct _xmlXPathType'>
@@ -6963,19 +6918,45 @@ Could we use @subtypes for this?'/>
     <typedef name='xmlXPathVariablePtr' file='xpath' type='xmlXPathVariable *'/>
     <variable name='emptyExp' file='xmlregexp' type='xmlExpNodePtr'/>
     <variable name='forbiddenExp' file='xmlregexp' type='xmlExpNodePtr'/>
-    <variable name='htmlDefaultSAXHandler' file='globals' type='xmlSAXHandlerV1'/>
-    <variable name='oldXMLWDcompatibility' file='globals' type='int'/>
-    <variable name='xmlBufferAllocScheme' file='globals' type='xmlBufferAllocationScheme'/>
-    <variable name='xmlDefaultBufferSize' file='globals' type='int'/>
-    <variable name='xmlDefaultSAXHandler' file='globals' type='xmlSAXHandlerV1'/>
-    <variable name='xmlDefaultSAXLocator' file='globals' type='xmlSAXLocator'/>
-    <variable name='xmlDeregisterNodeDefaultValue' file='globals' type='xmlDeregisterNodeFunc'/>
-    <variable name='xmlDoValidityCheckingDefaultValue' file='globals' type='int'/>
-    <variable name='xmlFree' file='globals' type='xmlFreeFunc'/>
-    <variable name='xmlGenericError' file='globals' type='xmlGenericErrorFunc'/>
-    <variable name='xmlGenericErrorContext' file='globals' type='void *'/>
-    <variable name='xmlGetWarningsDefaultValue' file='globals' type='int'/>
-    <variable name='xmlIndentTreeOutput' file='globals' type='int'/>
+    <variable name='htmlDefaultSAXHandler' file='globals' type='xmlSAXHandlerV1'>
+      <info>DEPRECATED: This handler is unused and will be removed from future versions.  Default old SAX v1 handler for HTML, builds the DOM tree</info>
+    </variable>
+    <variable name='oldXMLWDcompatibility' file='globals' type='int'>
+      <info>Global setting, DEPRECATED.</info>
+    </variable>
+    <variable name='xmlBufferAllocScheme' file='globals' type='xmlBufferAllocationScheme'>
+      <info>DEPRECATED: Don&apos;t use.  Global setting, default allocation policy for buffers, default is XML_BUFFER_ALLOC_EXACT</info>
+    </variable>
+    <variable name='xmlDefaultBufferSize' file='globals' type='int'>
+      <info>DEPRECATED: Don&apos;t use.  Global setting, default buffer size. Default value is BASE_BUFFER_SIZE</info>
+    </variable>
+    <variable name='xmlDefaultSAXHandler' file='globals' type='xmlSAXHandlerV1'>
+      <info>DEPRECATED: This handler is unused and will be removed from future versions.  Default SAX version1 handler for XML, builds the DOM tree</info>
+    </variable>
+    <variable name='xmlDefaultSAXLocator' file='globals' type='xmlSAXLocator'>
+      <info>DEPRECATED: Don&apos;t use  The default SAX Locator { getPublicId, getSystemId, getLineNumber, getColumnNumber}</info>
+    </variable>
+    <variable name='xmlDeregisterNodeDefaultValue' file='globals' type='xmlDeregisterNodeFunc'>
+      <info>DEPRECATED: Don&apos;t use</info>
+    </variable>
+    <variable name='xmlDoValidityCheckingDefaultValue' file='globals' type='int'>
+      <info>DEPRECATED: Use the modern options API with XML_PARSE_DTDVALID.  Global setting, indicate that the parser should work in validating mode. Disabled by default.</info>
+    </variable>
+    <variable name='xmlFree' file='globals' type='xmlFreeFunc'>
+      <info>@mem: an already allocated block of memory  The variable holding the libxml free() implementation</info>
+    </variable>
+    <variable name='xmlGenericError' file='globals' type='xmlGenericErrorFunc'>
+      <info>Global setting: function used for generic error callbacks</info>
+    </variable>
+    <variable name='xmlGenericErrorContext' file='globals' type='void *'>
+      <info>Global setting passed to generic error callbacks</info>
+    </variable>
+    <variable name='xmlGetWarningsDefaultValue' file='globals' type='int'>
+      <info>DEPRECATED: Don&apos;t use  Global setting, indicate that the DTD validation should provide warnings. Activated by default.</info>
+    </variable>
+    <variable name='xmlIndentTreeOutput' file='globals' type='int'>
+      <info>Global setting, asking the serializer to indent the output tree by default Enabled by default</info>
+    </variable>
     <variable name='xmlIsBaseCharGroup' file='chvalid' type='const xmlChRangeGroup'/>
     <variable name='xmlIsCharGroup' file='chvalid' type='const xmlChRangeGroup'/>
     <variable name='xmlIsCombiningGroup' file='chvalid' type='const xmlChRangeGroup'/>
@@ -6983,29 +6964,67 @@ Could we use @subtypes for this?'/>
     <variable name='xmlIsExtenderGroup' file='chvalid' type='const xmlChRangeGroup'/>
     <variable name='xmlIsIdeographicGroup' file='chvalid' type='const xmlChRangeGroup'/>
     <variable name='xmlIsPubidChar_tab' file='chvalid' type='const unsigned charxmlIsPubidChar_tab[256]'/>
-    <variable name='xmlKeepBlanksDefaultValue' file='globals' type='int'/>
+    <variable name='xmlKeepBlanksDefaultValue' file='globals' type='int'>
+      <info>DEPRECATED: Use the modern options API with XML_PARSE_NOBLANKS.  Global setting, indicate that the parser should keep all blanks nodes found in the content Activated by default, this is actually needed to have the parser conformant to the XML Recommendation, however the option is kept for some applications since this was libxml1 default behaviour.</info>
+    </variable>
     <variable name='xmlLastError' file='globals' type='xmlError'/>
-    <variable name='xmlLineNumbersDefaultValue' file='globals' type='int'/>
-    <variable name='xmlLoadExtDtdDefaultValue' file='globals' type='int'/>
-    <variable name='xmlMalloc' file='globals' type='xmlMallocFunc'/>
-    <variable name='xmlMallocAtomic' file='globals' type='xmlMallocFunc'/>
-    <variable name='xmlMemStrdup' file='globals' type='xmlStrdupFunc'/>
-    <variable name='xmlOutputBufferCreateFilenameValue' file='globals' type='xmlOutputBufferCreateFilenameFunc'/>
-    <variable name='xmlParserDebugEntities' file='globals' type='int'/>
-    <variable name='xmlParserInputBufferCreateFilenameValue' file='globals' type='xmlParserInputBufferCreateFilenameFunc'/>
-    <variable name='xmlParserMaxDepth' file='parserInternals' type='unsigned int'/>
-    <variable name='xmlParserVersion' file='globals' type='const char *'/>
-    <variable name='xmlPedanticParserDefaultValue' file='globals' type='int'/>
-    <variable name='xmlRealloc' file='globals' type='xmlReallocFunc'/>
-    <variable name='xmlRegisterNodeDefaultValue' file='globals' type='xmlRegisterNodeFunc'/>
-    <variable name='xmlSaveNoEmptyTags' file='globals' type='int'/>
+    <variable name='xmlLineNumbersDefaultValue' file='globals' type='int'>
+      <info>DEPRECATED: The modern options API always enables line numbers.  Global setting, indicate that the parser should store the line number in the content field of elements in the DOM tree. Disabled by default since this may not be safe for old classes of application.</info>
+    </variable>
+    <variable name='xmlLoadExtDtdDefaultValue' file='globals' type='int'>
+      <info>DEPRECATED: Use the modern options API with XML_PARSE_DTDLOAD.  Global setting, indicate that the parser should load DTD while not validating. Disabled by default.</info>
+    </variable>
+    <variable name='xmlMalloc' file='globals' type='xmlMallocFunc'>
+      <info>@size:  the size requested in bytes  The variable holding the libxml malloc() implementation  Returns a pointer to the newly allocated block or NULL in case of error</info>
+    </variable>
+    <variable name='xmlMallocAtomic' file='globals' type='xmlMallocFunc'>
+      <info>@size:  the size requested in bytes  The variable holding the libxml malloc() implementation for atomic data (i.e. blocks not containing pointers), useful when using a garbage collecting allocator.  Returns a pointer to the newly allocated block or NULL in case of error</info>
+    </variable>
+    <variable name='xmlMemStrdup' file='globals' type='xmlStrdupFunc'>
+      <info>@str: a zero terminated string  The variable holding the libxml strdup() implementation  Returns the copy of the string or NULL in case of error</info>
+    </variable>
+    <variable name='xmlOutputBufferCreateFilenameValue' file='globals' type='xmlOutputBufferCreateFilenameFunc'>
+      <info>DEPRECATED: Don&apos;t use</info>
+    </variable>
+    <variable name='xmlParserDebugEntities' file='globals' type='int'>
+      <info>DEPRECATED: Don&apos;t use  Global setting, asking the parser to print out debugging information. while handling entities. Disabled by default</info>
+    </variable>
+    <variable name='xmlParserInputBufferCreateFilenameValue' file='globals' type='xmlParserInputBufferCreateFilenameFunc'>
+      <info>DEPRECATED: Don&apos;t use</info>
+    </variable>
+    <variable name='xmlParserMaxDepth' file='parserInternals' type='unsigned int'>
+      <info>arbitrary depth limit for the XML documents that we allow to process. This is not a limitation of the parser but a safety boundary feature. It can be disabled with the XML_PARSE_HUGE parser option.</info>
+    </variable>
+    <variable name='xmlParserVersion' file='globals' type='const char *'>
+      <info>Constant string describing the internal version of the library</info>
+    </variable>
+    <variable name='xmlPedanticParserDefaultValue' file='globals' type='int'>
+      <info>DEPRECATED: Use the modern options API with XML_PARSE_PEDANTIC.  Global setting, indicate that the parser be pedantic Disabled by default.</info>
+    </variable>
+    <variable name='xmlRealloc' file='globals' type='xmlReallocFunc'>
+      <info>@mem: an already allocated block of memory @size:  the new size requested in bytes  The variable holding the libxml realloc() implementation  Returns a pointer to the newly reallocated block or NULL in case of error</info>
+    </variable>
+    <variable name='xmlRegisterNodeDefaultValue' file='globals' type='xmlRegisterNodeFunc'>
+      <info>DEPRECATED: Don&apos;t use</info>
+    </variable>
+    <variable name='xmlSaveNoEmptyTags' file='globals' type='int'>
+      <info>Global setting, asking the serializer to not output empty tags as &lt;empty/&gt; but &lt;empty&gt;&lt;/empty&gt;. those two forms are indistinguishable once parsed. Disabled by default</info>
+    </variable>
     <variable name='xmlStringComment' file='parserInternals' type='const xmlCharxmlStringComment[]'/>
     <variable name='xmlStringText' file='parserInternals' type='const xmlCharxmlStringText[]'/>
     <variable name='xmlStringTextNoenc' file='parserInternals' type='const xmlCharxmlStringTextNoenc[]'/>
-    <variable name='xmlStructuredError' file='globals' type='xmlStructuredErrorFunc'/>
-    <variable name='xmlStructuredErrorContext' file='globals' type='void *'/>
-    <variable name='xmlSubstituteEntitiesDefaultValue' file='globals' type='int'/>
-    <variable name='xmlTreeIndentString' file='globals' type='const char *'/>
+    <variable name='xmlStructuredError' file='globals' type='xmlStructuredErrorFunc'>
+      <info>Global setting: function used for structured error callbacks</info>
+    </variable>
+    <variable name='xmlStructuredErrorContext' file='globals' type='void *'>
+      <info>Global setting passed to structured error callbacks</info>
+    </variable>
+    <variable name='xmlSubstituteEntitiesDefaultValue' file='globals' type='int'>
+      <info>DEPRECATED: Use the modern options API with XML_PARSE_NOENT.  Global setting, indicate that the parser should not generate entity references but replace them with the actual content of the entity Disabled by default, this should be activated when using XPath since the XPath data model requires entities replacement and the XPath engine does not handle entities references transparently.</info>
+    </variable>
+    <variable name='xmlTreeIndentString' file='globals' type='const char *'>
+      <info>The string used to do one-level indent. By default is equal to &quot;  &quot; (two spaces)</info>
+    </variable>
     <variable name='xmlXPathNAN' file='xpath' type='double'/>
     <variable name='xmlXPathNINF' file='xpath' type='double'/>
     <variable name='xmlXPathPINF' file='xpath' type='double'/>
@@ -7343,7 +7362,7 @@ Could we use @subtypes for this?'/>
       <arg name='name' type='const xmlChar *' info='The tag name'/>
       <arg name='elem' type='htmlNodePtr' info='the HTML element'/>
     </function>
-    <function name='htmlCreateFileParserCtxt' file='parserInternals' module='HTMLparser'>
+    <function name='htmlCreateFileParserCtxt' file='HTMLparser' module='HTMLparser'>
       <cond>defined(LIBXML_HTML_ENABLED)</cond>
       <info>Create a parser context for a file content. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time.</info>
       <return type='htmlParserCtxtPtr' info='the new parser context or NULL'/>
@@ -7435,7 +7454,7 @@ Could we use @subtypes for this?'/>
     </function>
     <function name='htmlDefaultSAXHandlerInit' file='SAX2' module='SAX2'>
       <cond>defined(LIBXML_HTML_ENABLED)</cond>
-      <info>DEPRECATED: This function will be made private. Call xmlInitParser to initialize the library.  Initialize the default SAX handler</info>
+      <info>DEPRECATED: This function is a no-op. Call xmlInitParser to initialize the library.</info>
       <return type='void'/>
     </function>
     <function name='htmlDocContentDumpFormatOutput' file='HTMLtree' module='HTMLtree'>
@@ -7533,9 +7552,9 @@ Could we use @subtypes for this?'/>
       <return type='int' info='the last value for 0 for no handling, 1 for auto insertion.'/>
       <arg name='val' type='int' info='int 0 or 1'/>
     </function>
-    <function name='htmlInitAutoClose' file='parserInternals' module='HTMLparser'>
+    <function name='htmlInitAutoClose' file='HTMLparser' module='HTMLparser'>
       <cond>defined(LIBXML_HTML_ENABLED)</cond>
-      <info>DEPRECATED: This function will be made private. Call xmlInitParser to initialize the library.  This is a no-op now.</info>
+      <info>DEPRECATED: This is a no-op.</info>
       <return type='void'/>
     </function>
     <function name='htmlIsAutoClosed' file='HTMLparser' module='HTMLparser'>
@@ -7576,6 +7595,13 @@ Could we use @subtypes for this?'/>
       <info>Allocate and initialize a new parser context.</info>
       <return type='htmlParserCtxtPtr' info='the htmlParserCtxtPtr or NULL in case of allocation error'/>
     </function>
+    <function name='htmlNewSAXParserCtxt' file='HTMLparser' module='HTMLparser'>
+      <cond>defined(LIBXML_HTML_ENABLED)</cond>
+      <info>Allocate and initialize a new SAX parser context. If userData is NULL, the parser context will be passed as user data.</info>
+      <return type='htmlParserCtxtPtr' info='the htmlParserCtxtPtr or NULL in case of allocation error'/>
+      <arg name='sax' type='const htmlSAXHandler *' info='SAX handler'/>
+      <arg name='userData' type='void *' info='user data'/>
+    </function>
     <function name='htmlNodeDump' file='HTMLtree' module='HTMLtree'>
       <cond>defined(LIBXML_HTML_ENABLED) &amp;&amp; defined(LIBXML_OUTPUT_ENABLED)</cond>
       <info>Dump an HTML node, recursive behaviour,children are printed too, and formatting returns are added.</info>
@@ -7630,7 +7656,7 @@ Could we use @subtypes for this?'/>
     </function>
     <function name='htmlParseCharRef' file='HTMLparser' module='HTMLparser'>
       <cond>defined(LIBXML_HTML_ENABLED)</cond>
-      <info>parse Reference declarations  [66] CharRef ::= &apos;&amp;#&apos; [0-9]+ &apos;;&apos; | &apos;&amp;#x&apos; [0-9a-fA-F]+ &apos;;&apos;</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse Reference declarations  [66] CharRef ::= &apos;&amp;#&apos; [0-9]+ &apos;;&apos; | &apos;&amp;#x&apos; [0-9a-fA-F]+ &apos;;&apos;</info>
       <return type='int' info='the value parsed (as an int)'/>
       <arg name='ctxt' type='htmlParserCtxtPtr' info='an HTML parser context'/>
     </function>
@@ -7658,13 +7684,13 @@ Could we use @subtypes for this?'/>
     </function>
     <function name='htmlParseElement' file='HTMLparser' module='HTMLparser'>
       <cond>defined(LIBXML_HTML_ENABLED)</cond>
-      <info>parse an HTML element, this is highly recursive this is kept for compatibility with previous code versions  [39] element ::= EmptyElemTag | STag content ETag  [41] Attribute ::= Name Eq AttValue</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse an HTML element, this is highly recursive this is kept for compatibility with previous code versions  [39] element ::= EmptyElemTag | STag content ETag  [41] Attribute ::= Name Eq AttValue</info>
       <return type='void'/>
       <arg name='ctxt' type='htmlParserCtxtPtr' info='an HTML parser context'/>
     </function>
     <function name='htmlParseEntityRef' file='HTMLparser' module='HTMLparser'>
       <cond>defined(LIBXML_HTML_ENABLED)</cond>
-      <info>parse an HTML ENTITY references  [68] EntityRef ::= &apos;&amp;&apos; Name &apos;;&apos;</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse an HTML ENTITY references  [68] EntityRef ::= &apos;&amp;&apos; Name &apos;;&apos;</info>
       <return type='const htmlEntityDesc *' info='the associated htmlEntityDescPtr if found, or NULL otherwise, if non-NULL *str will have to be freed by the caller.'/>
       <arg name='ctxt' type='htmlParserCtxtPtr' info='an HTML parser context'/>
       <arg name='str' type='const xmlChar **' info='location to store the entity name'/>
@@ -7725,7 +7751,7 @@ Could we use @subtypes for this?'/>
     </function>
     <function name='htmlSAXParseDoc' file='HTMLparser' module='HTMLparser'>
       <cond>defined(LIBXML_HTML_ENABLED)</cond>
-      <info>Parse an HTML in-memory document. If sax is not NULL, use the SAX callbacks to handle parse events. If sax is NULL, fallback to the default DOM behavior and return a tree.</info>
+      <info>DEPRECATED: Use htmlNewSAXParserCtxt and htmlCtxtReadDoc.  Parse an HTML in-memory document. If sax is not NULL, use the SAX callbacks to handle parse events. If sax is NULL, fallback to the default DOM behavior and return a tree.</info>
       <return type='htmlDocPtr' info='the resulting document tree unless SAX is NULL or the document is not well formed.'/>
       <arg name='cur' type='const xmlChar *' info='a pointer to an array of xmlChar'/>
       <arg name='encoding' type='const char *' info='a free form C string describing the HTML document encoding, or NULL'/>
@@ -7734,7 +7760,7 @@ Could we use @subtypes for this?'/>
     </function>
     <function name='htmlSAXParseFile' file='HTMLparser' module='HTMLparser'>
       <cond>defined(LIBXML_HTML_ENABLED)</cond>
-      <info>parse an HTML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.</info>
+      <info>DEPRECATED: Use htmlNewSAXParserCtxt and htmlCtxtReadFile.  parse an HTML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.</info>
       <return type='htmlDocPtr' info='the resulting document tree unless SAX is NULL or the document is not well formed.'/>
       <arg name='filename' type='const char *' info='the filename'/>
       <arg name='encoding' type='const char *' info='a free form C string describing the HTML document encoding, or NULL'/>
@@ -7794,7 +7820,7 @@ Could we use @subtypes for this?'/>
       <arg name='len' type='int' info='the number of xmlChar'/>
     </functype>
     <function name='initGenericErrorDefaultFunc' file='xmlerror' module='error'>
-      <info>Set or reset (if NULL) the default handler for generic errors to the builtin error function.</info>
+      <info>DEPRECATED: Use xmlSetGenericErrorFunc.  Set or reset (if NULL) the default handler for generic errors to the builtin error function.</info>
       <return type='void'/>
       <arg name='handler' type='xmlGenericErrorFunc *' info='the handler'/>
     </function>
@@ -7859,12 +7885,12 @@ Could we use @subtypes for this?'/>
       <arg name='inlen' type='int *' info='the length of @in'/>
     </function>
     <function name='namePop' file='parserInternals' module='parser'>
-      <info>Pops the top element name from the name stack</info>
+      <info>DEPRECATED: Internal function, do not use.  Pops the top element name from the name stack</info>
       <return type='const xmlChar *' info='the name just removed'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='namePush' file='parserInternals' module='parser'>
-      <info>Pushes a new element name on top of the name stack</info>
+      <info>DEPRECATED: Internal function, do not use.  Pushes a new element name on top of the name stack</info>
       <return type='int' info='-1 in case of error, the index in the stack otherwise'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
       <arg name='value' type='const xmlChar *' info='the element name'/>
@@ -7878,12 +7904,12 @@ Could we use @subtypes for this?'/>
       <arg name='prefix' type='const xmlChar *' info='the namespace prefix'/>
     </function>
     <function name='nodePop' file='parserInternals' module='parser'>
-      <info>Pops the top element node from the node stack</info>
+      <info>DEPRECATED: Internal function, do not use.  Pops the top element node from the node stack</info>
       <return type='xmlNodePtr' info='the node just removed'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='nodePush' file='parserInternals' module='parser'>
-      <info>Pushes a new element node on top of the node stack</info>
+      <info>DEPRECATED: Internal function, do not use.  Pushes a new element node on top of the node stack</info>
       <return type='int' info='-1 in case of error, the index in the stack otherwise'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
       <arg name='value' type='xmlNodePtr' info='the element node'/>
@@ -8035,7 +8061,7 @@ Could we use @subtypes for this?'/>
     <function name='valuePush' file='xpathInternals' module='xpath'>
       <cond>defined(LIBXML_XPATH_ENABLED)</cond>
       <info>Pushes a new XPath object on top of the value stack. If value is NULL, a memory error is recorded in the parser context.</info>
-      <return type='int' info='the number of items on the value stack, or -1 in case of error.'/>
+      <return type='int' info='the number of items on the value stack, or -1 in case of error.  The object is destroyed in case of error.'/>
       <arg name='ctxt' type='xmlXPathParserContextPtr' info='an XPath evaluation context'/>
       <arg name='value' type='xmlXPathObjectPtr' info='the XPath object'/>
     </function>
@@ -8539,8 +8565,8 @@ Could we use @subtypes for this?'/>
       <arg name='size' type='size_t' info='initial size of buffer'/>
     </function>
     <function name='xmlBufferCreateStatic' file='tree' module='tree'>
-      <info>routine to create an XML buffer from an immutable memory area. The area won&apos;t be modified nor copied, and is expected to be present until the end of the buffer lifetime.</info>
-      <return type='xmlBufferPtr' info='the new structure.'/>
+      <info>Create an XML buffer initialized with bytes.</info>
+      <return type='xmlBufferPtr' info=''/>
       <arg name='mem' type='void *' info='the memory area'/>
       <arg name='size' type='size_t' info='the size in byte'/>
     </function>
@@ -8826,8 +8852,8 @@ Could we use @subtypes for this?'/>
       <arg name='handler' type='xmlCharEncodingHandler *' info='char encoding transformation data structure'/>
     </function>
     <function name='xmlCharEncFirstLine' file='encoding' module='encoding'>
-      <info>Front-end for the encoding handler input function, but handle only the very first line, i.e. limit itself to 45 chars.</info>
-      <return type='int' info='the number of byte written if success, or -1 general error -2 if the transcoding fails (for *in is not valid utf8 string or the result of transformation can&apos;t fit into the encoding we want), or'/>
+      <info>DEPERECATED: Don&apos;t use.</info>
+      <return type='int' info=''/>
       <arg name='handler' type='xmlCharEncodingHandler *' info='char encoding transformation data structure'/>
       <arg name='out' type='xmlBufferPtr' info='an xmlBuffer for the output.'/>
       <arg name='in' type='xmlBufferPtr' info='an xmlBuffer for the input'/>
@@ -8891,7 +8917,7 @@ Could we use @subtypes for this?'/>
       <arg name='ret' type='xmlParserInputPtr' info='an XML parser input'/>
     </function>
     <function name='xmlCheckLanguageID' file='parserInternals' module='parser'>
-      <info>Checks that the value conforms to the LanguageID production:  NOTE: this is somewhat deprecated, those productions were removed from the XML Second edition.  [33] LanguageID ::= Langcode (&apos;-&apos; Subcode)* [34] Langcode ::= ISO639Code |  IanaCode |  UserCode [35] ISO639Code ::= ([a-z] | [A-Z]) ([a-z] | [A-Z]) [36] IanaCode ::= (&apos;i&apos; | &apos;I&apos;) &apos;-&apos; ([a-z] | [A-Z])+ [37] UserCode ::= (&apos;x&apos; | &apos;X&apos;) &apos;-&apos; ([a-z] | [A-Z])+ [38] Subcode ::= ([a-z] | [A-Z])+  The current REC reference the successors of RFC 1766, currently 5646  http://www.rfc-editor.org/rfc/rfc5646.txt langtag       = language [&quot;-&quot; script] [&quot;-&quot; region] *(&quot;-&quot; variant) *(&quot;-&quot; extension) [&quot;-&quot; privateuse] language      = 2*3ALPHA            ; shortest ISO 639 code [&quot;-&quot; extlang]       ; sometimes followed by ; extended language subtags / 4ALPHA              ; or reserved for future use / 5*8ALPHA            ; or registered language subtag  extlang       = 3ALPHA              ; selected ISO 639 codes *2(&quot;-&quot; 3ALPHA)      ; permanently reserved  script        = 4ALPHA              ; ISO 15924 code  region        = 2ALPHA              ; ISO 3166-1 code / 3DIGIT              ; UN M.49 code  variant       = 5*8alphanum         ; registered variants / (DIGIT 3alphanum)  extension     = singleton 1*(&quot;-&quot; (2*8alphanum))  ; Single alphanumerics ; &quot;x&quot; reserved for private use singleton     = DIGIT               ; 0 - 9 / %x41-57             ; A - W / %x59-5A             ; Y - Z / %x61-77             ; a - w / %x79-7A             ; y - z  it sounds right to still allow Irregular i-xxx IANA and user codes too The parser below doesn&apos;t try to cope with extension or privateuse that could be added but that&apos;s not interoperable anyway</info>
+      <info>DEPRECATED: Internal function, do not use.  Checks that the value conforms to the LanguageID production:  NOTE: this is somewhat deprecated, those productions were removed from the XML Second edition.  [33] LanguageID ::= Langcode (&apos;-&apos; Subcode)* [34] Langcode ::= ISO639Code |  IanaCode |  UserCode [35] ISO639Code ::= ([a-z] | [A-Z]) ([a-z] | [A-Z]) [36] IanaCode ::= (&apos;i&apos; | &apos;I&apos;) &apos;-&apos; ([a-z] | [A-Z])+ [37] UserCode ::= (&apos;x&apos; | &apos;X&apos;) &apos;-&apos; ([a-z] | [A-Z])+ [38] Subcode ::= ([a-z] | [A-Z])+  The current REC reference the successors of RFC 1766, currently 5646  http://www.rfc-editor.org/rfc/rfc5646.txt langtag       = language [&quot;-&quot; script] [&quot;-&quot; region] *(&quot;-&quot; variant) *(&quot;-&quot; extension) [&quot;-&quot; privateuse] language      = 2*3ALPHA            ; shortest ISO 639 code [&quot;-&quot; extlang]       ; sometimes followed by ; extended language subtags / 4ALPHA              ; or reserved for future use / 5*8ALPHA            ; or registered language subtag  extlang       = 3ALPHA              ; selected ISO 639 codes *2(&quot;-&quot; 3ALPHA)      ; permanently reserved  script        = 4ALPHA              ; ISO 15924 code  region        = 2ALPHA              ; ISO 3166-1 code / 3DIGIT              ; UN M.49 code  variant       = 5*8alphanum         ; registered variants / (DIGIT 3alphanum)  extension     = singleton 1*(&quot;-&quot; (2*8alphanum))  ; Single alphanumerics ; &quot;x&quot; reserved for private use singleton     = DIGIT               ; 0 - 9 / %x41-57             ; A - W / %x59-5A             ; Y - Z / %x61-77             ; a - w / %x79-7A             ; y - z  it sounds right to still allow Irregular i-xxx IANA and user codes too The parser below doesn&apos;t try to cope with extension or privateuse that could be added but that&apos;s not interoperable anyway</info>
       <return type='int' info='1 if correct 0 otherwise'/>
       <arg name='lang' type='const xmlChar *' info='pointer to the string value'/>
     </function>
@@ -8920,7 +8946,7 @@ Could we use @subtypes for this?'/>
       <return type='void'/>
     </function>
     <function name='xmlCleanupGlobals' file='globals' module='globals'>
-      <info>DEPRECATED: This function will be made private. Call xmlCleanupParser to free global state but see the warnings there. xmlCleanupParser should be only called once at program exit. In most cases, you don&apos;t have call cleanup functions at all.  Additional cleanup for multi-threading</info>
+      <info>DEPRECATED: This function is a no-op. Call xmlCleanupParser to free global state but see the warnings there. xmlCleanupParser should be only called once at program exit. In most cases, you don&apos;t have call cleanup functions at all.</info>
       <return type='void'/>
     </function>
     <function name='xmlCleanupInputCallbacks' file='xmlIO' module='xmlIO'>
@@ -8928,7 +8954,7 @@ Could we use @subtypes for this?'/>
       <return type='void'/>
     </function>
     <function name='xmlCleanupMemory' file='xmlmemory' module='xmlmemory'>
-      <info>DEPRECATED: This function will be made private. Call xmlCleanupParser to free global state but see the warnings there. xmlCleanupParser should be only called once at program exit. In most cases, you don&apos;t have call cleanup functions at all.  Free up all the memory allocated by the library for its own use. This should not be called by user level code.</info>
+      <info>DEPRECATED: This function is a no-op. Call xmlCleanupParser to free global state but see the warnings there. xmlCleanupParser should be only called once at program exit. In most cases, you don&apos;t have call cleanup functions at all.</info>
       <return type='void'/>
     </function>
     <function name='xmlCleanupOutputCallbacks' file='xmlIO' module='xmlIO'>
@@ -8946,11 +8972,11 @@ Could we use @subtypes for this?'/>
       <return type='void'/>
     </function>
     <function name='xmlCleanupThreads' file='threads' module='threads'>
-      <info>DEPRECATED: This function will be made private. Call xmlCleanupParser to free global state but see the warnings there. xmlCleanupParser should be only called once at program exit. In most cases, you don&apos;t have call cleanup functions at all.  xmlCleanupThreads() is used to to cleanup all the thread related data of the libxml2 library once processing has ended.  WARNING: if your application is multithreaded or has plugin support calling this may crash the application if another thread or a plugin is still using libxml2. It&apos;s sometimes very hard to guess if libxml2 is in use in the application, some libraries or plugins may use it without notice. In case of doubt abstain from calling this function or do it just before calling exit() to avoid leak reports from valgrind !</info>
+      <info>DEPRECATED: This function is a no-op. Call xmlCleanupParser to free global state but see the warnings there. xmlCleanupParser should be only called once at program exit. In most cases, you don&apos;t have call cleanup functions at all.</info>
       <return type='void'/>
     </function>
     <function name='xmlClearNodeInfoSeq' file='parser' module='parserInternals'>
-      <info>-- Clear (release memory and reinitialize) node info sequence</info>
+      <info>DEPRECATED: Don&apos;t use.  -- Clear (release memory and reinitialize) node info sequence</info>
       <return type='void'/>
       <arg name='seq' type='xmlParserNodeInfoSeqPtr' info='a node info sequence pointer'/>
     </function>
@@ -9219,7 +9245,7 @@ Could we use @subtypes for this?'/>
       <arg name='options' type='int' info='a combination of xmlParserOption'/>
     </function>
     <function name='xmlCurrentChar' file='parserInternals' module='parserInternals'>
-      <info>The current char value, if using UTF-8 this may actually span multiple bytes in the input buffer. Implement the end of line normalization: 2.11 End-of-Line Handling Wherever an external parsed entity or the literal entity value of an internal parsed entity contains either the literal two-character sequence &quot;#xD#xA&quot; or a standalone literal #xD, an XML processor must pass to the application the single character #xA. This behavior can conveniently be produced by normalizing all line breaks to #xA on input, before parsing.)</info>
+      <info>DEPRECATED: Internal function, do not use.  The current char value, if using UTF-8 this may actually span multiple bytes in the input buffer. Implement the end of line normalization: 2.11 End-of-Line Handling Wherever an external parsed entity or the literal entity value of an internal parsed entity contains either the literal two-character sequence &quot;#xD#xA&quot; or a standalone literal #xD, an XML processor must pass to the application the single character #xA. This behavior can conveniently be produced by normalizing all line breaks to #xA on input, before parsing.)</info>
       <return type='int' info='the current char value and its length'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='the XML parser context'/>
       <arg name='len' type='int *' info='pointer to the length of the char read'/>
@@ -9372,7 +9398,7 @@ Could we use @subtypes for this?'/>
       <arg name='end3' type='xmlChar' info='an end marker xmlChar, 0 if none'/>
     </function>
     <function name='xmlDefaultSAXHandlerInit' file='SAX2' module='SAX2'>
-      <info>DEPRECATED: This function will be made private. Call xmlInitParser to initialize the library.  Initialize the default SAX2 handler</info>
+      <info>DEPRECATED: This function is a no-op. Call xmlInitParser to initialize the library.  Initialize the default SAX2 handler</info>
       <return type='void'/>
     </function>
     <function name='xmlDelEncodingAlias' file='encoding' module='encoding'>
@@ -9397,7 +9423,7 @@ Could we use @subtypes for this?'/>
       <arg name='len' type='int' info='pointer to the length of the buffer'/>
     </function>
     <function name='xmlDictCleanup' file='dict' module='dict'>
-      <info>DEPRECATED: This function will be made private. Call xmlCleanupParser to free global state but see the warnings there. xmlCleanupParser should be only called once at program exit. In most cases, you don&apos;t have call cleanup functions at all.  Free the dictionary mutex. Do not call unless sure the library is not in use anymore !</info>
+      <info>DEPRECATED: This function is a no-op. Call xmlCleanupParser to free global state but see the warnings there. xmlCleanupParser should be only called once at program exit. In most cases, you don&apos;t have call cleanup functions at all.</info>
       <return type='void'/>
     </function>
     <function name='xmlDictCreate' file='dict' module='dict'>
@@ -9462,13 +9488,6 @@ Could we use @subtypes for this?'/>
       <return type='int' info='the number of elements in the dictionary or -1 in case of error'/>
       <arg name='dict' type='xmlDictPtr' info='the dictionary'/>
     </function>
-    <function name='xmlDllMain' file='threads' module='threads'>
-      <info></info>
-      <return type='int' info=''/>
-      <arg name='hinstDLL' type='void *' info=''/>
-      <arg name='fdwReason' type='unsigned long' info=''/>
-      <arg name='lpvReserved' type='void *' info=''/>
-    </function>
     <function name='xmlDocCopyNode' file='tree' module='tree'>
       <info>Do a copy of the node to a given document.</info>
       <return type='xmlNodePtr' info='a new #xmlNodePtr, or NULL in case of error.'/>
@@ -9636,12 +9655,6 @@ Could we use @subtypes for this?'/>
       <arg name='firstNode' type='xmlNodePtr' info='the fist node in the chunk'/>
       <arg name='lastNode' type='xmlNodePtr' info='the last nod in the chunk'/>
     </functype>
-    <function name='xmlErrMemory' file='parserInternals' module='parserInternals'>
-      <info>Handle a redefinition of attribute error</info>
-      <return type='void'/>
-      <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
-      <arg name='extra' type='const char *' info='extra information'/>
-    </function>
     <function name='xmlExpCtxtNbCons' file='xmlregexp' module='xmlregexp'>
       <cond>defined(LIBXML_REGEXP_ENABLED) &amp;&amp; defined(LIBXML_EXPR_ENABLED)</cond>
       <info>Debugging facility provides the number of allocated nodes over lifetime</info>
@@ -9812,7 +9825,7 @@ Could we use @subtypes for this?'/>
       <arg name='len' type='int' info='number of bytes to write'/>
     </function>
     <function name='xmlFindCharEncodingHandler' file='encoding' module='encoding'>
-      <info>Search in the registered set the handler able to read/write that encoding.</info>
+      <info>Search in the registered set the handler able to read/write that encoding or create a new one.</info>
       <return type='xmlCharEncodingHandlerPtr' info='the handler or NULL if not found'/>
       <arg name='name' type='const char *' info='a string describing the char encoding.'/>
     </function>
@@ -9891,7 +9904,7 @@ Could we use @subtypes for this?'/>
       <arg name='input' type='xmlParserInputPtr' info='an xmlParserInputPtr'/>
     </function>
     <function name='xmlFreeMutex' file='threads' module='threads'>
-      <info>xmlFreeMutex() is used to reclaim resources associated with a libxml2 token struct.</info>
+      <info>Free a mutex.</info>
       <return type='void'/>
       <arg name='tok' type='xmlMutexPtr' info='the simple mutex'/>
     </function>
@@ -10110,7 +10123,7 @@ Could we use @subtypes for this?'/>
       <arg name='result' type='const char **' info='an array of string to be filled with the features name.'/>
     </function>
     <function name='xmlGetGlobalState' file='threads' module='threads'>
-      <info>xmlGetGlobalState() is called to retrieve the global state for a thread.</info>
+      <info>DEPRECATED: Internal function, do not use.  xmlGetGlobalState() is called to retrieve the global state for a thread.</info>
       <return type='xmlGlobalStatePtr' info='the thread global state or NULL in case of error'/>
     </function>
     <function name='xmlGetID' file='valid' module='valid'>
@@ -10188,7 +10201,7 @@ Could we use @subtypes for this?'/>
       <arg name='ID' type='const xmlChar *' info='the ID value'/>
     </function>
     <function name='xmlGetThreadId' file='threads' module='threads'>
-      <info>xmlGetThreadId() find the current thread ID number Note that this is likely to be broken on some platforms using pthreads as the specification doesn&apos;t mandate pthread_t to be an integer type</info>
+      <info>DEPRECATED: Internal function, do not use.  xmlGetThreadId() find the current thread ID number Note that this is likely to be broken on some platforms using pthreads as the specification doesn&apos;t mandate pthread_t to be an integer type</info>
       <return type='int' info='the current thread ID number'/>
     </function>
     <function name='xmlGetUTF8Char' file='xmlstring' module='xmlstring'>
@@ -10509,19 +10522,19 @@ Could we use @subtypes for this?'/>
       <arg name='enc' type='xmlCharEncoding' info='the charset encoding if known'/>
     </function>
     <function name='xmlInitCharEncodingHandlers' file='encoding' module='encoding'>
-      <info>DEPRECATED: This function will be made private. Call xmlInitParser to initialize the library.  Initialize the char encoding support, it registers the default encoding supported. NOTE: while public, this function usually doesn&apos;t need to be called in normal processing.</info>
+      <info>DEPRECATED: Alias for xmlInitParser.</info>
       <return type='void'/>
     </function>
     <function name='xmlInitGlobals' file='globals' module='globals'>
-      <info>DEPRECATED: This function will be made private. Call xmlInitParser to initialize the library.  Additional initialisation for multi-threading</info>
+      <info>DEPRECATED: Alias for xmlInitParser.</info>
       <return type='void'/>
     </function>
     <function name='xmlInitMemory' file='xmlmemory' module='xmlmemory'>
-      <info>DEPRECATED: This function will be made private. Call xmlInitParser to initialize the library.  Initialize the memory layer.</info>
-      <return type='int' info='0 on success'/>
+      <info>DEPRECATED: Alias for xmlInitParser.</info>
+      <return type='int' info=''/>
     </function>
     <function name='xmlInitNodeInfoSeq' file='parser' module='parserInternals'>
-      <info>-- Initialize (set to initial state) node info sequence</info>
+      <info>DEPRECATED: Don&apos;t use.  -- Initialize (set to initial state) node info sequence</info>
       <return type='void'/>
       <arg name='seq' type='xmlParserNodeInfoSeqPtr' info='a node info sequence pointer'/>
     </function>
@@ -10530,12 +10543,12 @@ Could we use @subtypes for this?'/>
       <return type='void'/>
     </function>
     <function name='xmlInitParserCtxt' file='parser' module='parserInternals'>
-      <info>Initialize a parser context</info>
+      <info>DEPRECATED: Internal function which will be made private in a future version.  Initialize a parser context</info>
       <return type='int' info='0 in case of success and -1 in case of error'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlInitThreads' file='threads' module='threads'>
-      <info>DEPRECATED: This function will be made private. Call xmlInitParser to initialize the library.  xmlInitThreads() is used to to initialize all the thread related data of the libxml2 library.</info>
+      <info>DEPRECATED: Alias for xmlInitParser.</info>
       <return type='void'/>
     </function>
     <function name='xmlInitializeCatalog' file='catalog' module='catalog'>
@@ -10544,8 +10557,8 @@ Could we use @subtypes for this?'/>
       <return type='void'/>
     </function>
     <function name='xmlInitializeDict' file='dict' module='dict'>
-      <info>DEPRECATED: This function will be made private. Call xmlInitParser to initialize the library.  Do the dictionary mutex initialization.</info>
-      <return type='int' info='0 if initialization was already done, and 1 if that call led to the initialization'/>
+      <info>DEPRECATED: Alias for xmlInitParser.</info>
+      <return type='int' info=''/>
     </function>
     <function name='xmlInitializeGlobalState' file='globals' module='globals'>
       <info>xmlInitializeGlobalState() initialize a global state with all the default values of the library.</info>
@@ -10632,7 +10645,7 @@ Could we use @subtypes for this?'/>
       <arg name='c' type='int' info='an unicode character (int)'/>
     </function>
     <function name='xmlIsMainThread' file='threads' module='threads'>
-      <info>xmlIsMainThread() check whether the current thread is the main thread.</info>
+      <info>DEPRECATED: Internal function, do not use.  xmlIsMainThread() check whether the current thread is the main thread.</info>
       <return type='int' info='1 if the current thread is the main thread, 0 otherwise'/>
     </function>
     <function name='xmlIsMixedElement' file='valid' module='valid'>
@@ -10653,14 +10666,14 @@ Could we use @subtypes for this?'/>
       <arg name='elem' type='xmlNodePtr' info='the element carrying the attribute'/>
       <arg name='attr' type='xmlAttrPtr' info='the attribute'/>
     </function>
-    <function name='xmlIsXHTML' file='tree' module='xmlsave'>
+    <function name='xmlIsXHTML' file='tree' module='tree'>
       <info>Try to find if the document correspond to an XHTML DTD</info>
       <return type='int' info='1 if true, 0 if not and -1 in case of error'/>
       <arg name='systemID' type='const xmlChar *' info='the system identifier'/>
       <arg name='publicID' type='const xmlChar *' info='the public identifier'/>
     </function>
     <function name='xmlKeepBlanksDefault' file='parser' module='parserInternals'>
-      <info>Set and return the previous value for default blanks text nodes support. The 1.x version of the parser used an heuristic to try to detect ignorable white spaces. As a result the SAX callback was generating xmlSAX2IgnorableWhitespace() callbacks instead of characters() one, and when using the DOM output text nodes containing those blanks were not generated. The 2.x and later version will switch to the XML standard way and ignorableWhitespace() are only generated when running the parser in validating mode and when the current element doesn&apos;t allow CDATA or mixed content. This function is provided as a way to force the standard behavior on 1.X libs and to switch back to the old mode for compatibility when running 1.X client code on 2.X . Upgrade of 1.X code should be done by using xmlIsBlankNode() commodity function to detect the &quot;empty&quot; nodes generated. This value also affect autogeneration of indentation when saving code if blanks sections are kept, indentation is not generated.</info>
+      <info>DEPRECATED: Use the modern options API with XML_PARSE_NOBLANKS.  Set and return the previous value for default blanks text nodes support. The 1.x version of the parser used an heuristic to try to detect ignorable white spaces. As a result the SAX callback was generating xmlSAX2IgnorableWhitespace() callbacks instead of characters() one, and when using the DOM output text nodes containing those blanks were not generated. The 2.x and later version will switch to the XML standard way and ignorableWhitespace() are only generated when running the parser in validating mode and when the current element doesn&apos;t allow CDATA or mixed content. This function is provided as a way to force the standard behavior on 1.X libs and to switch back to the old mode for compatibility when running 1.X client code on 2.X . Upgrade of 1.X code should be done by using xmlIsBlankNode() commodity function to detect the &quot;empty&quot; nodes generated. This value also affect autogeneration of indentation when saving code if blanks sections are kept, indentation is not generated.</info>
       <return type='int' info='the last value for 0 for no substitution, 1 for substitution.'/>
       <arg name='val' type='int' info='int 0 or 1'/>
     </function>
@@ -10671,7 +10684,7 @@ Could we use @subtypes for this?'/>
       <arg name='parent' type='xmlNodePtr' info='the parent node'/>
     </function>
     <function name='xmlLineNumbersDefault' file='parser' module='parserInternals'>
-      <info>Set and return the previous value for enabling line numbers in elements contents. This may break on old application and is turned off by default.</info>
+      <info>DEPRECATED: The modern options API always enables line numbers.  Set and return the previous value for enabling line numbers in elements contents. This may break on old application and is turned off by default.</info>
       <return type='int' info='the last value for 0 for no substitution, 1 for substitution.'/>
       <arg name='val' type='int' info='int 0 or 1'/>
     </function>
@@ -10958,6 +10971,11 @@ Could we use @subtypes for this?'/>
       <arg name='fp' type='FILE *' info='a FILE descriptor used as the output file'/>
       <arg name='nr' type='int' info='number of entries to dump'/>
     </function>
+    <function name='xmlMemSize' file='xmlmemory' module='xmlmemory'>
+      <info></info>
+      <return type='size_t' info='the size of a memory allocation.'/>
+      <arg name='ptr' type='void *' info='pointer to the memory allocation'/>
+    </function>
     <function name='xmlMemStrdupLoc' file='xmlmemory' module='xmlmemory'>
       <info>a strdup() equivalent, with logging of the allocation info.</info>
       <return type='char *' info='a pointer to the new string or NULL if allocation error occurred.'/>
@@ -11446,7 +11464,7 @@ Could we use @subtypes for this?'/>
       <arg name='content' type='const xmlChar *' info='the entity content'/>
     </function>
     <function name='xmlNewEntityInputStream' file='parserInternals' module='parserInternals'>
-      <info>Create a new input stream based on an xmlEntityPtr</info>
+      <info>DEPRECATED: Internal function, do not use.  Create a new input stream based on an xmlEntityPtr</info>
       <return type='xmlParserInputPtr' info='the new input stream or NULL'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
       <arg name='entity' type='xmlEntityPtr' info='an Entity pointer'/>
@@ -11544,6 +11562,12 @@ Could we use @subtypes for this?'/>
       <arg name='doc' type='const xmlDoc *' info='the document'/>
       <arg name='name' type='const xmlChar *' info='the reference name, or the reference string with &amp; and ;'/>
     </function>
+    <function name='xmlNewSAXParserCtxt' file='parser' module='parserInternals'>
+      <info>Allocate and initialize a new SAX parser context. If userData is NULL, the parser context will be passed as user data.</info>
+      <return type='xmlParserCtxtPtr' info='the xmlParserCtxtPtr or NULL if memory allocation failed.'/>
+      <arg name='sax' type='const xmlSAXHandler *' info='SAX handler'/>
+      <arg name='userData' type='void *' info='user data'/>
+    </function>
     <function name='xmlNewStringInputStream' file='parserInternals' module='parserInternals'>
       <info>Create a new input stream based on a memory buffer.</info>
       <return type='xmlParserInputPtr' info='the new input stream'/>
@@ -11631,7 +11655,7 @@ Could we use @subtypes for this?'/>
       <return type='xmlValidCtxtPtr' info='NULL if not, otherwise the new validation context structure'/>
     </function>
     <function name='xmlNextChar' file='parserInternals' module='parserInternals'>
-      <info>Skip to the next char input char.</info>
+      <info>DEPRECATED: Internal function, do not use.  Skip to the next char input char.</info>
       <return type='void'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='the XML parser context'/>
     </function>
@@ -11905,24 +11929,24 @@ Could we use @subtypes for this?'/>
       <arg name='len' type='int' info='the length of the buffer in bytes'/>
     </functype>
     <function name='xmlParseAttValue' file='parserInternals' module='parser'>
-      <info>parse a value for an attribute Note: the parser won&apos;t do substitution of entities here, this will be handled later in xmlStringGetNodeList  [10] AttValue ::= &apos;&quot;&apos; ([^&lt;&amp;&quot;] | Reference)* &apos;&quot;&apos; | &quot;&apos;&quot; ([^&lt;&amp;&apos;] | Reference)* &quot;&apos;&quot;  3.3.3 Attribute-Value Normalization: Before the value of an attribute is passed to the application or checked for validity, the XML processor must normalize it as follows: - a character reference is processed by appending the referenced character to the attribute value - an entity reference is processed by recursively processing the replacement text of the entity - a whitespace character (#x20, #xD, #xA, #x9) is processed by appending #x20 to the normalized value, except that only a single #x20 is appended for a &quot;#xD#xA&quot; sequence that is part of an external parsed entity or the literal entity value of an internal parsed entity - other characters are processed by appending them to the normalized value If the declared value is not CDATA, then the XML processor must further process the normalized attribute value by discarding any leading and trailing space (#x20) characters, and by replacing sequences of space (#x20) characters by a single space (#x20) character. All attributes for which no declaration has been read should be treated by a non-validating parser as if declared CDATA.</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse a value for an attribute Note: the parser won&apos;t do substitution of entities here, this will be handled later in xmlStringGetNodeList  [10] AttValue ::= &apos;&quot;&apos; ([^&lt;&amp;&quot;] | Reference)* &apos;&quot;&apos; | &quot;&apos;&quot; ([^&lt;&amp;&apos;] | Reference)* &quot;&apos;&quot;  3.3.3 Attribute-Value Normalization: Before the value of an attribute is passed to the application or checked for validity, the XML processor must normalize it as follows: - a character reference is processed by appending the referenced character to the attribute value - an entity reference is processed by recursively processing the replacement text of the entity - a whitespace character (#x20, #xD, #xA, #x9) is processed by appending #x20 to the normalized value, except that only a single #x20 is appended for a &quot;#xD#xA&quot; sequence that is part of an external parsed entity or the literal entity value of an internal parsed entity - other characters are processed by appending them to the normalized value If the declared value is not CDATA, then the XML processor must further process the normalized attribute value by discarding any leading and trailing space (#x20) characters, and by replacing sequences of space (#x20) characters by a single space (#x20) character. All attributes for which no declaration has been read should be treated by a non-validating parser as if declared CDATA.</info>
       <return type='xmlChar *' info='the AttValue parsed or NULL. The value has to be freed by the caller.'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParseAttribute' file='parserInternals' module='parser'>
       <cond>defined(LIBXML_SAX1_ENABLED)</cond>
-      <info>parse an attribute  [41] Attribute ::= Name Eq AttValue  [ WFC: No External Entity References ] Attribute values cannot contain direct or indirect entity references to external entities.  [ WFC: No &lt; in Attribute Values ] The replacement text of any entity referred to directly or indirectly in an attribute value (other than &quot;&amp;lt;&quot;) must not contain a &lt;.  [ VC: Attribute Value Type ] The attribute must have been declared; the value must be of the type declared for it.  [25] Eq ::= S? &apos;=&apos; S?  With namespace:  [NS 11] Attribute ::= QName Eq AttValue  Also the case QName == xmlns:??? is handled independently as a namespace definition.</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse an attribute  [41] Attribute ::= Name Eq AttValue  [ WFC: No External Entity References ] Attribute values cannot contain direct or indirect entity references to external entities.  [ WFC: No &lt; in Attribute Values ] The replacement text of any entity referred to directly or indirectly in an attribute value (other than &quot;&amp;lt;&quot;) must not contain a &lt;.  [ VC: Attribute Value Type ] The attribute must have been declared; the value must be of the type declared for it.  [25] Eq ::= S? &apos;=&apos; S?  With namespace:  [NS 11] Attribute ::= QName Eq AttValue  Also the case QName == xmlns:??? is handled independently as a namespace definition.</info>
       <return type='const xmlChar *' info='the attribute name, and the value in *value.'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
       <arg name='value' type='xmlChar **' info='a xmlChar ** used to store the value of the attribute'/>
     </function>
     <function name='xmlParseAttributeListDecl' file='parserInternals' module='parser'>
-      <info>: parse the Attribute list def for an element  [52] AttlistDecl ::= &apos;&lt;!ATTLIST&apos; S Name AttDef* S? &apos;&gt;&apos;  [53] AttDef ::= S Name S AttType S DefaultDecl</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  Parse an attribute list declaration for an element. Always consumes &apos;&lt;!&apos;.  [52] AttlistDecl ::= &apos;&lt;!ATTLIST&apos; S Name AttDef* S? &apos;&gt;&apos;  [53] AttDef ::= S Name S AttType S DefaultDecl</info>
       <return type='void'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParseAttributeType' file='parserInternals' module='parser'>
-      <info>parse the Attribute list def for an element  [54] AttType ::= StringType | TokenizedType | EnumeratedType  [55] StringType ::= &apos;CDATA&apos;  [56] TokenizedType ::= &apos;ID&apos; | &apos;IDREF&apos; | &apos;IDREFS&apos; | &apos;ENTITY&apos; | &apos;ENTITIES&apos; | &apos;NMTOKEN&apos; | &apos;NMTOKENS&apos;  Validity constraints for attribute values syntax are checked in xmlValidateAttributeValue()  [ VC: ID ] Values of type ID must match the Name production. A name must not appear more than once in an XML document as a value of this type; i.e., ID values must uniquely identify the elements which bear them.  [ VC: One ID per Element Type ] No element type may have more than one ID attribute specified.  [ VC: ID Attribute Default ] An ID attribute must have a declared default of #IMPLIED or #REQUIRED.  [ VC: IDREF ] Values of type IDREF must match the Name production, and values of type IDREFS must match Names; each IDREF Name must match the value of an ID attribute on some element in the XML document; i.e. IDREF values must match the value of some ID attribute.  [ VC: Entity Name ] Values of type ENTITY must match the Name production, values of type ENTITIES must match Names; each Entity Name must match the name of an unparsed entity declared in the DTD.  [ VC: Name Token ] Values of type NMTOKEN must match the Nmtoken production; values of type NMTOKENS must match Nmtokens.</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse the Attribute list def for an element  [54] AttType ::= StringType | TokenizedType | EnumeratedType  [55] StringType ::= &apos;CDATA&apos;  [56] TokenizedType ::= &apos;ID&apos; | &apos;IDREF&apos; | &apos;IDREFS&apos; | &apos;ENTITY&apos; | &apos;ENTITIES&apos; | &apos;NMTOKEN&apos; | &apos;NMTOKENS&apos;  Validity constraints for attribute values syntax are checked in xmlValidateAttributeValue()  [ VC: ID ] Values of type ID must match the Name production. A name must not appear more than once in an XML document as a value of this type; i.e., ID values must uniquely identify the elements which bear them.  [ VC: One ID per Element Type ] No element type may have more than one ID attribute specified.  [ VC: ID Attribute Default ] An ID attribute must have a declared default of #IMPLIED or #REQUIRED.  [ VC: IDREF ] Values of type IDREF must match the Name production, and values of type IDREFS must match Names; each IDREF Name must match the value of an ID attribute on some element in the XML document; i.e. IDREF values must match the value of some ID attribute.  [ VC: Entity Name ] Values of type ENTITY must match the Name production, values of type ENTITIES must match Names; each Entity Name must match the name of an unparsed entity declared in the DTD.  [ VC: Name Token ] Values of type NMTOKEN must match the Nmtoken production; values of type NMTOKENS must match Nmtokens.</info>
       <return type='int' info='the attribute type'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
       <arg name='tree' type='xmlEnumerationPtr *' info='the enumeration tree built while parsing'/>
@@ -11951,7 +11975,7 @@ Could we use @subtypes for this?'/>
       <arg name='recover' type='int' info='return nodes even if the data is broken (use 0)'/>
     </function>
     <function name='xmlParseCDSect' file='parserInternals' module='parser'>
-      <info>Parse escaped pure raw content.  [18] CDSect ::= CDStart CData CDEnd  [19] CDStart ::= &apos;&lt;![CDATA[&apos;  [20] Data ::= (Char* - (Char* &apos;]]&gt;&apos; Char*))  [21] CDEnd ::= &apos;]]&gt;&apos;</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  Parse escaped pure raw content. Always consumes &apos;&lt;![&apos;.  [18] CDSect ::= CDStart CData CDEnd  [19] CDStart ::= &apos;&lt;![CDATA[&apos;  [20] Data ::= (Char* - (Char* &apos;]]&gt;&apos; Char*))  [21] CDEnd ::= &apos;]]&gt;&apos;</info>
       <return type='void'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
@@ -11962,10 +11986,10 @@ Could we use @subtypes for this?'/>
       <arg name='filename' type='const char *' info='the filename'/>
     </function>
     <function name='xmlParseCharData' file='parserInternals' module='parser'>
-      <info>parse a CharData section. if we are within a CDATA section &apos;]]&gt;&apos; marks an end of section.  The right angle bracket (&gt;) may be represented using the string &quot;&amp;gt;&quot;, and must, for compatibility, be escaped using &quot;&amp;gt;&quot; or a character reference when it appears in the string &quot;]]&gt;&quot; in content, when that string is not marking the end of a CDATA section.  [14] CharData ::= [^&lt;&amp;]* - ([^&lt;&amp;]* &apos;]]&gt;&apos; [^&lt;&amp;]*)</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  Parse character data. Always makes progress if the first char isn&apos;t &apos;&lt;&apos; or &apos;&amp;&apos;.  if we are within a CDATA section &apos;]]&gt;&apos; marks an end of section.  The right angle bracket (&gt;) may be represented using the string &quot;&amp;gt;&quot;, and must, for compatibility, be escaped using &quot;&amp;gt;&quot; or a character reference when it appears in the string &quot;]]&gt;&quot; in content, when that string is not marking the end of a CDATA section.  [14] CharData ::= [^&lt;&amp;]* - ([^&lt;&amp;]* &apos;]]&gt;&apos; [^&lt;&amp;]*)</info>
       <return type='void'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
-      <arg name='cdata' type='int' info='int indicating whether we are within a CDATA section'/>
+      <arg name='cdata' type='int' info='unused'/>
     </function>
     <function name='xmlParseCharEncoding' file='encoding' module='encoding'>
       <info>Compare the string to the encoding schemes already known. Note that the comparison is case insensitive accordingly to the section [XML] 4.3.3 Character Encoding in Entities.</info>
@@ -11973,7 +11997,7 @@ Could we use @subtypes for this?'/>
       <arg name='name' type='const char *' info='the encoding name as parsed, in UTF-8 format (ASCII actually)'/>
     </function>
     <function name='xmlParseCharRef' file='parserInternals' module='parser'>
-      <info>parse Reference declarations  [66] CharRef ::= &apos;&amp;#&apos; [0-9]+ &apos;;&apos; | &apos;&amp;#x&apos; [0-9a-fA-F]+ &apos;;&apos;  [ WFC: Legal Character ] Characters referred to using character references must match the production for Char.</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  Parse a numeric character reference. Always consumes &apos;&amp;&apos;.  [66] CharRef ::= &apos;&amp;#&apos; [0-9]+ &apos;;&apos; | &apos;&amp;#x&apos; [0-9a-fA-F]+ &apos;;&apos;  [ WFC: Legal Character ] Characters referred to using character references must match the production for Char.</info>
       <return type='int' info='the value parsed (as an int), 0 in case of error'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
@@ -11987,7 +12011,7 @@ Could we use @subtypes for this?'/>
       <arg name='terminate' type='int' info='last chunk indicator'/>
     </function>
     <function name='xmlParseComment' file='parserInternals' module='parser'>
-      <info>Skip an XML (SGML) comment &lt;!-- .... --&gt; The spec says that &quot;For compatibility, the string &quot;--&quot; (double-hyphen) must not occur within comments. &quot;  [15] Comment ::= &apos;&lt;!--&apos; ((Char - &apos;-&apos;) | (&apos;-&apos; (Char - &apos;-&apos;)))* &apos;--&gt;&apos;</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  Parse an XML (SGML) comment. Always consumes &apos;&lt;!&apos;.  The spec says that &quot;For compatibility, the string &quot;--&quot; (double-hyphen) must not occur within comments. &quot;  [15] Comment ::= &apos;&lt;!--&apos; ((Char - &apos;-&apos;) | (&apos;-&apos; (Char - &apos;-&apos;)))* &apos;--&gt;&apos;</info>
       <return type='void'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
@@ -12012,19 +12036,19 @@ Could we use @subtypes for this?'/>
       <arg name='SystemID' type='const xmlChar *' info='a NAME* containing the URL to the DTD'/>
     </function>
     <function name='xmlParseDefaultDecl' file='parserInternals' module='parser'>
-      <info>Parse an attribute default declaration  [60] DefaultDecl ::= &apos;#REQUIRED&apos; | &apos;#IMPLIED&apos; | ((&apos;#FIXED&apos; S)? AttValue)  [ VC: Required Attribute ] if the default declaration is the keyword #REQUIRED, then the attribute must be specified for all elements of the type in the attribute-list declaration.  [ VC: Attribute Default Legal ] The declared default value must meet the lexical constraints of the declared attribute type c.f. xmlValidateAttributeDecl()  [ VC: Fixed Attribute Default ] if an attribute has a default value declared with the #FIXED keyword, instances of that attribute must match the default value.  [ WFC: No &lt; in Attribute Values ] handled in xmlParseAttValue()</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  Parse an attribute default declaration  [60] DefaultDecl ::= &apos;#REQUIRED&apos; | &apos;#IMPLIED&apos; | ((&apos;#FIXED&apos; S)? AttValue)  [ VC: Required Attribute ] if the default declaration is the keyword #REQUIRED, then the attribute must be specified for all elements of the type in the attribute-list declaration.  [ VC: Attribute Default Legal ] The declared default value must meet the lexical constraints of the declared attribute type c.f. xmlValidateAttributeDecl()  [ VC: Fixed Attribute Default ] if an attribute has a default value declared with the #FIXED keyword, instances of that attribute must match the default value.  [ WFC: No &lt; in Attribute Values ] handled in xmlParseAttValue()</info>
       <return type='int' info='XML_ATTRIBUTE_NONE, XML_ATTRIBUTE_REQUIRED, XML_ATTRIBUTE_IMPLIED or XML_ATTRIBUTE_FIXED.'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
       <arg name='value' type='xmlChar **' info='Receive a possible fixed default value for the attribute'/>
     </function>
     <function name='xmlParseDoc' file='parser' module='parser'>
       <cond>defined(LIBXML_SAX1_ENABLED)</cond>
-      <info>parse an XML in-memory document and build a tree.</info>
+      <info>DEPRECATED: Use xmlReadDoc.  parse an XML in-memory document and build a tree.</info>
       <return type='xmlDocPtr' info='the resulting document tree'/>
       <arg name='cur' type='const xmlChar *' info='a pointer to an array of xmlChar'/>
     </function>
     <function name='xmlParseDocTypeDecl' file='parserInternals' module='parser'>
-      <info>parse a DOCTYPE declaration  [28] doctypedecl ::= &apos;&lt;!DOCTYPE&apos; S Name (S ExternalID)? S? (&apos;[&apos; (markupdecl | PEReference | S)* &apos;]&apos; S?)? &apos;&gt;&apos;  [ VC: Root Element Type ] The Name in the document type declaration must match the element type of the root element.</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse a DOCTYPE declaration  [28] doctypedecl ::= &apos;&lt;!DOCTYPE&apos; S Name (S ExternalID)? S? (&apos;[&apos; (markupdecl | PEReference | S)* &apos;]&apos; S?)? &apos;&gt;&apos;  [ VC: Root Element Type ] The Name in the document type declaration must match the element type of the root element.</info>
       <return type='void'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
@@ -12034,47 +12058,47 @@ Could we use @subtypes for this?'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParseElement' file='parserInternals' module='parser'>
-      <info>parse an XML element  [39] element ::= EmptyElemTag | STag content ETag  [ WFC: Element Type Match ] The Name in an element&apos;s end-tag must match the element type in the start-tag.</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse an XML element  [39] element ::= EmptyElemTag | STag content ETag  [ WFC: Element Type Match ] The Name in an element&apos;s end-tag must match the element type in the start-tag.</info>
       <return type='void'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParseElementChildrenContentDecl' file='parserInternals' module='parser'>
-      <info>parse the declaration for a Mixed Element content The leading &apos;(&apos; and spaces have been skipped in xmlParseElementContentDecl  [47] children ::= (choice | seq) (&apos;?&apos; | &apos;*&apos; | &apos;+&apos;)?  [48] cp ::= (Name | choice | seq) (&apos;?&apos; | &apos;*&apos; | &apos;+&apos;)?  [49] choice ::= &apos;(&apos; S? cp ( S? &apos;|&apos; S? cp )* S? &apos;)&apos;  [50] seq ::= &apos;(&apos; S? cp ( S? &apos;,&apos; S? cp )* S? &apos;)&apos;  [ VC: Proper Group/PE Nesting ] applies to [49] and [50] TODO Parameter-entity replacement text must be properly nested with parenthesized groups. That is to say, if either of the opening or closing parentheses in a choice, seq, or Mixed construct is contained in the replacement text for a parameter entity, both must be contained in the same replacement text. For interoperability, if a parameter-entity reference appears in a choice, seq, or Mixed construct, its replacement text should not be empty, and neither the first nor last non-blank character of the replacement text should be a connector (| or ,).</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse the declaration for a Mixed Element content The leading &apos;(&apos; and spaces have been skipped in xmlParseElementContentDecl  [47] children ::= (choice | seq) (&apos;?&apos; | &apos;*&apos; | &apos;+&apos;)?  [48] cp ::= (Name | choice | seq) (&apos;?&apos; | &apos;*&apos; | &apos;+&apos;)?  [49] choice ::= &apos;(&apos; S? cp ( S? &apos;|&apos; S? cp )* S? &apos;)&apos;  [50] seq ::= &apos;(&apos; S? cp ( S? &apos;,&apos; S? cp )* S? &apos;)&apos;  [ VC: Proper Group/PE Nesting ] applies to [49] and [50] TODO Parameter-entity replacement text must be properly nested with parenthesized groups. That is to say, if either of the opening or closing parentheses in a choice, seq, or Mixed construct is contained in the replacement text for a parameter entity, both must be contained in the same replacement text. For interoperability, if a parameter-entity reference appears in a choice, seq, or Mixed construct, its replacement text should not be empty, and neither the first nor last non-blank character of the replacement text should be a connector (| or ,).</info>
       <return type='xmlElementContentPtr' info='the tree of xmlElementContentPtr describing the element hierarchy.'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
       <arg name='inputchk' type='int' info='the input used for the current entity, needed for boundary checks'/>
     </function>
     <function name='xmlParseElementContentDecl' file='parserInternals' module='parser'>
-      <info>parse the declaration for an Element content either Mixed or Children, the cases EMPTY and ANY are handled directly in xmlParseElementDecl  [46] contentspec ::= &apos;EMPTY&apos; | &apos;ANY&apos; | Mixed | children</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse the declaration for an Element content either Mixed or Children, the cases EMPTY and ANY are handled directly in xmlParseElementDecl  [46] contentspec ::= &apos;EMPTY&apos; | &apos;ANY&apos; | Mixed | children</info>
       <return type='int' info='the type of element content XML_ELEMENT_TYPE_xxx'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
       <arg name='name' type='const xmlChar *' info='the name of the element being defined.'/>
       <arg name='result' type='xmlElementContentPtr *' info='the Element Content pointer will be stored here if any'/>
     </function>
     <function name='xmlParseElementDecl' file='parserInternals' module='parser'>
-      <info>parse an Element declaration.  [45] elementdecl ::= &apos;&lt;!ELEMENT&apos; S Name S contentspec S? &apos;&gt;&apos;  [ VC: Unique Element Type Declaration ] No element type may be declared more than once</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  Parse an element declaration. Always consumes &apos;&lt;!&apos;.  [45] elementdecl ::= &apos;&lt;!ELEMENT&apos; S Name S contentspec S? &apos;&gt;&apos;  [ VC: Unique Element Type Declaration ] No element type may be declared more than once</info>
       <return type='int' info='the type of the element, or -1 in case of error'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParseElementMixedContentDecl' file='parserInternals' module='parser'>
-      <info>parse the declaration for a Mixed Element content The leading &apos;(&apos; and spaces have been skipped in xmlParseElementContentDecl  [51] Mixed ::= &apos;(&apos; S? &apos;#PCDATA&apos; (S? &apos;|&apos; S? Name)* S? &apos;)*&apos; | &apos;(&apos; S? &apos;#PCDATA&apos; S? &apos;)&apos;  [ VC: Proper Group/PE Nesting ] applies to [51] too (see [49])  [ VC: No Duplicate Types ] The same name must not appear more than once in a single mixed-content declaration.</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse the declaration for a Mixed Element content The leading &apos;(&apos; and spaces have been skipped in xmlParseElementContentDecl  [51] Mixed ::= &apos;(&apos; S? &apos;#PCDATA&apos; (S? &apos;|&apos; S? Name)* S? &apos;)*&apos; | &apos;(&apos; S? &apos;#PCDATA&apos; S? &apos;)&apos;  [ VC: Proper Group/PE Nesting ] applies to [51] too (see [49])  [ VC: No Duplicate Types ] The same name must not appear more than once in a single mixed-content declaration.</info>
       <return type='xmlElementContentPtr' info='the list of the xmlElementContentPtr describing the element choices'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
       <arg name='inputchk' type='int' info='the input used for the current entity, needed for boundary checks'/>
     </function>
     <function name='xmlParseEncName' file='parserInternals' module='parser'>
-      <info>parse the XML encoding name  [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | &apos;-&apos;)*</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse the XML encoding name  [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | &apos;-&apos;)*</info>
       <return type='xmlChar *' info='the encoding name value or NULL'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParseEncodingDecl' file='parserInternals' module='parser'>
-      <info>parse the XML encoding declaration  [80] EncodingDecl ::= S &apos;encoding&apos; Eq (&apos;&quot;&apos; EncName &apos;&quot;&apos; |  &quot;&apos;&quot; EncName &quot;&apos;&quot;)  this setups the conversion filters.</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse the XML encoding declaration  [80] EncodingDecl ::= S &apos;encoding&apos; Eq (&apos;&quot;&apos; EncName &apos;&quot;&apos; |  &quot;&apos;&quot; EncName &quot;&apos;&quot;)  this setups the conversion filters.</info>
       <return type='const xmlChar *' info='the encoding value or NULL'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParseEndTag' file='parserInternals' module='parser'>
       <cond>defined(LIBXML_SAX1_ENABLED)</cond>
-      <info>parse an end of tag  [42] ETag ::= &apos;&lt;/&apos; Name S? &apos;&gt;&apos;  With namespace  [NS 9] ETag ::= &apos;&lt;/&apos; QName S? &apos;&gt;&apos;</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse an end of tag  [42] ETag ::= &apos;&lt;/&apos; Name S? &apos;&gt;&apos;  With namespace  [NS 9] ETag ::= &apos;&lt;/&apos; QName S? &apos;&gt;&apos;</info>
       <return type='void'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
@@ -12085,29 +12109,29 @@ Could we use @subtypes for this?'/>
       <arg name='filename' type='const char *' info='the filename'/>
     </function>
     <function name='xmlParseEntityDecl' file='parserInternals' module='parser'>
-      <info>parse &lt;!ENTITY declarations  [70] EntityDecl ::= GEDecl | PEDecl  [71] GEDecl ::= &apos;&lt;!ENTITY&apos; S Name S EntityDef S? &apos;&gt;&apos;  [72] PEDecl ::= &apos;&lt;!ENTITY&apos; S &apos;%&apos; S Name S PEDef S? &apos;&gt;&apos;  [73] EntityDef ::= EntityValue | (ExternalID NDataDecl?)  [74] PEDef ::= EntityValue | ExternalID  [76] NDataDecl ::= S &apos;NDATA&apos; S Name  [ VC: Notation Declared ] The Name must match the declared name of a notation.</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  Parse an entity declaration. Always consumes &apos;&lt;!&apos;.  [70] EntityDecl ::= GEDecl | PEDecl  [71] GEDecl ::= &apos;&lt;!ENTITY&apos; S Name S EntityDef S? &apos;&gt;&apos;  [72] PEDecl ::= &apos;&lt;!ENTITY&apos; S &apos;%&apos; S Name S PEDef S? &apos;&gt;&apos;  [73] EntityDef ::= EntityValue | (ExternalID NDataDecl?)  [74] PEDef ::= EntityValue | ExternalID  [76] NDataDecl ::= S &apos;NDATA&apos; S Name  [ VC: Notation Declared ] The Name must match the declared name of a notation.</info>
       <return type='void'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParseEntityRef' file='parserInternals' module='parser'>
-      <info>parse ENTITY references declarations  [68] EntityRef ::= &apos;&amp;&apos; Name &apos;;&apos;  [ WFC: Entity Declared ] In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with &quot;standalone=&apos;yes&apos;&quot;, the Name given in the entity reference must match that in an entity declaration, except that well-formed documents need not declare any of the following entities: amp, lt, gt, apos, quot.  The declaration of a parameter entity must precede any reference to it.  Similarly, the declaration of a general entity must precede any reference to it which appears in a default value in an attribute-list declaration. Note that if entities are declared in the external subset or in external parameter entities, a non-validating processor is not obligated to read and process their declarations; for such documents, the rule that an entity must be declared is a well-formedness constraint only if standalone=&apos;yes&apos;.  [ WFC: Parsed Entity ] An entity reference must not contain the name of an unparsed entity</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  Parse an entitiy reference. Always consumes &apos;&amp;&apos;.  [68] EntityRef ::= &apos;&amp;&apos; Name &apos;;&apos;  [ WFC: Entity Declared ] In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with &quot;standalone=&apos;yes&apos;&quot;, the Name given in the entity reference must match that in an entity declaration, except that well-formed documents need not declare any of the following entities: amp, lt, gt, apos, quot.  The declaration of a parameter entity must precede any reference to it.  Similarly, the declaration of a general entity must precede any reference to it which appears in a default value in an attribute-list declaration. Note that if entities are declared in the external subset or in external parameter entities, a non-validating processor is not obligated to read and process their declarations; for such documents, the rule that an entity must be declared is a well-formedness constraint only if standalone=&apos;yes&apos;.  [ WFC: Parsed Entity ] An entity reference must not contain the name of an unparsed entity</info>
       <return type='xmlEntityPtr' info='the xmlEntityPtr if found, or NULL otherwise.'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParseEntityValue' file='parserInternals' module='parser'>
-      <info>parse a value for ENTITY declarations  [9] EntityValue ::= &apos;&quot;&apos; ([^%&amp;&quot;] | PEReference | Reference)* &apos;&quot;&apos; | &quot;&apos;&quot; ([^%&amp;&apos;] | PEReference | Reference)* &quot;&apos;&quot;</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse a value for ENTITY declarations  [9] EntityValue ::= &apos;&quot;&apos; ([^%&amp;&quot;] | PEReference | Reference)* &apos;&quot;&apos; | &quot;&apos;&quot; ([^%&amp;&apos;] | PEReference | Reference)* &quot;&apos;&quot;</info>
       <return type='xmlChar *' info='the EntityValue parsed with reference substituted or NULL'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
       <arg name='orig' type='xmlChar **' info='if non-NULL store a copy of the original entity value'/>
     </function>
     <function name='xmlParseEnumeratedType' file='parserInternals' module='parser'>
-      <info>parse an Enumerated attribute type.  [57] EnumeratedType ::= NotationType | Enumeration  [58] NotationType ::= &apos;NOTATION&apos; S &apos;(&apos; S? Name (S? &apos;|&apos; S? Name)* S? &apos;)&apos;</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse an Enumerated attribute type.  [57] EnumeratedType ::= NotationType | Enumeration  [58] NotationType ::= &apos;NOTATION&apos; S &apos;(&apos; S? Name (S? &apos;|&apos; S? Name)* S? &apos;)&apos;</info>
       <return type='int' info='XML_ATTRIBUTE_ENUMERATION or XML_ATTRIBUTE_NOTATION'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
       <arg name='tree' type='xmlEnumerationPtr *' info='the enumeration tree built while parsing'/>
     </function>
     <function name='xmlParseEnumerationType' file='parserInternals' module='parser'>
-      <info>parse an Enumeration attribute type.  [59] Enumeration ::= &apos;(&apos; S? Nmtoken (S? &apos;|&apos; S? Nmtoken)* S? &apos;)&apos;  [ VC: Enumeration ] Values of this type must match one of the Nmtoken tokens in the declaration</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse an Enumeration attribute type.  [59] Enumeration ::= &apos;(&apos; S? Nmtoken (S? &apos;|&apos; S? Nmtoken)* S? &apos;)&apos;  [ VC: Enumeration ] Values of this type must match one of the Nmtoken tokens in the declaration</info>
       <return type='xmlEnumerationPtr' info='the enumeration attribute tree built while parsing'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
@@ -12129,7 +12153,7 @@ Could we use @subtypes for this?'/>
       <arg name='lst' type='xmlNodePtr *' info='the return value for the set of parsed nodes'/>
     </function>
     <function name='xmlParseExternalID' file='parserInternals' module='parser'>
-      <info>Parse an External ID or a Public ID  NOTE: Productions [75] and [83] interact badly since [75] can generate &apos;PUBLIC&apos; S PubidLiteral S SystemLiteral  [75] ExternalID ::= &apos;SYSTEM&apos; S SystemLiteral | &apos;PUBLIC&apos; S PubidLiteral S SystemLiteral  [83] PublicID ::= &apos;PUBLIC&apos; S PubidLiteral</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  Parse an External ID or a Public ID  NOTE: Productions [75] and [83] interact badly since [75] can generate &apos;PUBLIC&apos; S PubidLiteral S SystemLiteral  [75] ExternalID ::= &apos;SYSTEM&apos; S SystemLiteral | &apos;PUBLIC&apos; S PubidLiteral S SystemLiteral  [83] PublicID ::= &apos;PUBLIC&apos; S PubidLiteral</info>
       <return type='xmlChar *' info='the function returns SystemLiteral and in the second case publicID receives PubidLiteral, is strict is off it is possible to return NULL and have publicID set.'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
       <arg name='publicID' type='xmlChar **' info='a xmlChar** receiving PubidLiteral'/>
@@ -12144,7 +12168,7 @@ Could we use @subtypes for this?'/>
     </function>
     <function name='xmlParseFile' file='parser' module='parser'>
       <cond>defined(LIBXML_SAX1_ENABLED)</cond>
-      <info>parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time.</info>
+      <info>DEPRECATED: Use xmlReadFile.  parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time.</info>
       <return type='xmlDocPtr' info='the resulting document tree if the file was wellformed, NULL otherwise.'/>
       <arg name='filename' type='const char *' info='the filename'/>
     </function>
@@ -12158,24 +12182,24 @@ Could we use @subtypes for this?'/>
       <arg name='lst' type='xmlNodePtr *' info='the return value for the set of parsed nodes'/>
     </function>
     <function name='xmlParseMarkupDecl' file='parserInternals' module='parser'>
-      <info>parse Markup declarations  [29] markupdecl ::= elementdecl | AttlistDecl | EntityDecl | NotationDecl | PI | Comment  [ VC: Proper Declaration/PE Nesting ] Parameter-entity replacement text must be properly nested with markup declarations. That is to say, if either the first character or the last character of a markup declaration (markupdecl above) is contained in the replacement text for a parameter-entity reference, both must be contained in the same replacement text.  [ WFC: PEs in Internal Subset ] In the internal DTD subset, parameter-entity references can occur only where markup declarations can occur, not within markup declarations. (This does not apply to references that occur in external parameter entities or to the external subset.)</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  Parse markup declarations. Always consumes &apos;&lt;!&apos; or &apos;&lt;?&apos;.  [29] markupdecl ::= elementdecl | AttlistDecl | EntityDecl | NotationDecl | PI | Comment  [ VC: Proper Declaration/PE Nesting ] Parameter-entity replacement text must be properly nested with markup declarations. That is to say, if either the first character or the last character of a markup declaration (markupdecl above) is contained in the replacement text for a parameter-entity reference, both must be contained in the same replacement text.  [ WFC: PEs in Internal Subset ] In the internal DTD subset, parameter-entity references can occur only where markup declarations can occur, not within markup declarations. (This does not apply to references that occur in external parameter entities or to the external subset.)</info>
       <return type='void'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParseMemory' file='parser' module='parser'>
       <cond>defined(LIBXML_SAX1_ENABLED)</cond>
-      <info>parse an XML in-memory block and build a tree.</info>
+      <info>DEPRECATED: Use xmlReadMemory.  parse an XML in-memory block and build a tree.</info>
       <return type='xmlDocPtr' info='the resulting document tree'/>
       <arg name='buffer' type='const char *' info='an pointer to a char array'/>
       <arg name='size' type='int' info='the size of the array'/>
     </function>
     <function name='xmlParseMisc' file='parserInternals' module='parser'>
-      <info>parse an XML Misc* optional field.  [27] Misc ::= Comment | PI |  S</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse an XML Misc* optional field.  [27] Misc ::= Comment | PI |  S</info>
       <return type='void'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParseName' file='parserInternals' module='parser'>
-      <info>parse an XML name.  [4] NameChar ::= Letter | Digit | &apos;.&apos; | &apos;-&apos; | &apos;_&apos; | &apos;:&apos; | CombiningChar | Extender  [5] Name ::= (Letter | &apos;_&apos; | &apos;:&apos;) (NameChar)*  [6] Names ::= Name (#x20 Name)*</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse an XML name.  [4] NameChar ::= Letter | Digit | &apos;.&apos; | &apos;-&apos; | &apos;_&apos; | &apos;:&apos; | CombiningChar | Extender  [5] Name ::= (Letter | &apos;_&apos; | &apos;:&apos;) (NameChar)*  [6] Names ::= Name (#x20 Name)*</info>
       <return type='const xmlChar *' info='the Name parsed or NULL'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
@@ -12186,37 +12210,37 @@ Could we use @subtypes for this?'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParseNmtoken' file='parserInternals' module='parser'>
-      <info>parse an XML Nmtoken.  [7] Nmtoken ::= (NameChar)+  [8] Nmtokens ::= Nmtoken (#x20 Nmtoken)*</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse an XML Nmtoken.  [7] Nmtoken ::= (NameChar)+  [8] Nmtokens ::= Nmtoken (#x20 Nmtoken)*</info>
       <return type='xmlChar *' info='the Nmtoken parsed or NULL'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParseNotationDecl' file='parserInternals' module='parser'>
-      <info>parse a notation declaration  [82] NotationDecl ::= &apos;&lt;!NOTATION&apos; S Name S (ExternalID |  PublicID) S? &apos;&gt;&apos;  Hence there is actually 3 choices: &apos;PUBLIC&apos; S PubidLiteral &apos;PUBLIC&apos; S PubidLiteral S SystemLiteral and &apos;SYSTEM&apos; S SystemLiteral  See the NOTE on xmlParseExternalID().</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  Parse a notation declaration. Always consumes &apos;&lt;!&apos;.  [82] NotationDecl ::= &apos;&lt;!NOTATION&apos; S Name S (ExternalID |  PublicID) S? &apos;&gt;&apos;  Hence there is actually 3 choices: &apos;PUBLIC&apos; S PubidLiteral &apos;PUBLIC&apos; S PubidLiteral S SystemLiteral and &apos;SYSTEM&apos; S SystemLiteral  See the NOTE on xmlParseExternalID().</info>
       <return type='void'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParseNotationType' file='parserInternals' module='parser'>
-      <info>parse an Notation attribute type.  Note: the leading &apos;NOTATION&apos; S part has already being parsed...  [58] NotationType ::= &apos;NOTATION&apos; S &apos;(&apos; S? Name (S? &apos;|&apos; S? Name)* S? &apos;)&apos;  [ VC: Notation Attributes ] Values of this type must match one of the notation names included in the declaration; all notation names in the declaration must be declared.</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse an Notation attribute type.  Note: the leading &apos;NOTATION&apos; S part has already being parsed...  [58] NotationType ::= &apos;NOTATION&apos; S &apos;(&apos; S? Name (S? &apos;|&apos; S? Name)* S? &apos;)&apos;  [ VC: Notation Attributes ] Values of this type must match one of the notation names included in the declaration; all notation names in the declaration must be declared.</info>
       <return type='xmlEnumerationPtr' info='the notation attribute tree built while parsing'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParsePEReference' file='parserInternals' module='parser'>
-      <info>parse PEReference declarations The entity content is handled directly by pushing it&apos;s content as a new input stream.  [69] PEReference ::= &apos;%&apos; Name &apos;;&apos;  [ WFC: No Recursion ] A parsed entity must not contain a recursive reference to itself, either directly or indirectly.  [ WFC: Entity Declared ] In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with &quot;standalone=&apos;yes&apos;&quot;, ...  ... The declaration of a parameter entity must precede any reference to it...  [ VC: Entity Declared ] In a document with an external subset or external parameter entities with &quot;standalone=&apos;no&apos;&quot;, ...  ... The declaration of a parameter entity must precede any reference to it...  [ WFC: In DTD ] Parameter-entity references may only appear in the DTD. NOTE: misleading but this is handled.</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  Parse a parameter entity reference. Always consumes &apos;%&apos;.  The entity content is handled directly by pushing it&apos;s content as a new input stream.  [69] PEReference ::= &apos;%&apos; Name &apos;;&apos;  [ WFC: No Recursion ] A parsed entity must not contain a recursive reference to itself, either directly or indirectly.  [ WFC: Entity Declared ] In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with &quot;standalone=&apos;yes&apos;&quot;, ...  ... The declaration of a parameter entity must precede any reference to it...  [ VC: Entity Declared ] In a document with an external subset or external parameter entities with &quot;standalone=&apos;no&apos;&quot;, ...  ... The declaration of a parameter entity must precede any reference to it...  [ WFC: In DTD ] Parameter-entity references may only appear in the DTD. NOTE: misleading but this is handled.</info>
       <return type='void'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParsePI' file='parserInternals' module='parser'>
-      <info>parse an XML Processing Instruction.  [16] PI ::= &apos;&lt;?&apos; PITarget (S (Char* - (Char* &apos;?&gt;&apos; Char*)))? &apos;?&gt;&apos;  The processing is transferred to SAX once parsed.</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse an XML Processing Instruction.  [16] PI ::= &apos;&lt;?&apos; PITarget (S (Char* - (Char* &apos;?&gt;&apos; Char*)))? &apos;?&gt;&apos;  The processing is transferred to SAX once parsed.</info>
       <return type='void'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParsePITarget' file='parserInternals' module='parser'>
-      <info>parse the name of a PI  [17] PITarget ::= Name - ((&apos;X&apos; | &apos;x&apos;) (&apos;M&apos; | &apos;m&apos;) (&apos;L&apos; | &apos;l&apos;))</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse the name of a PI  [17] PITarget ::= Name - ((&apos;X&apos; | &apos;x&apos;) (&apos;M&apos; | &apos;m&apos;) (&apos;L&apos; | &apos;l&apos;))</info>
       <return type='const xmlChar *' info='the PITarget name or NULL'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParsePubidLiteral' file='parserInternals' module='parser'>
-      <info>parse an XML public literal  [12] PubidLiteral ::= &apos;&quot;&apos; PubidChar* &apos;&quot;&apos; | &quot;&apos;&quot; (PubidChar - &quot;&apos;&quot;)* &quot;&apos;&quot;</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse an XML public literal  [12] PubidLiteral ::= &apos;&quot;&apos; PubidChar* &apos;&quot;&apos; | &quot;&apos;&quot; (PubidChar - &quot;&apos;&quot;)* &quot;&apos;&quot;</info>
       <return type='xmlChar *' info='the PubidLiteral parsed or NULL.'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
@@ -12227,28 +12251,28 @@ Could we use @subtypes for this?'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParseReference' file='parserInternals' module='parser'>
-      <info>parse and handle entity references in content, depending on the SAX interface, this may end-up in a call to character() if this is a CharRef, a predefined entity, if there is no reference() callback. or if the parser was asked to switch to that mode.  [67] Reference ::= EntityRef | CharRef</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse and handle entity references in content, depending on the SAX interface, this may end-up in a call to character() if this is a CharRef, a predefined entity, if there is no reference() callback. or if the parser was asked to switch to that mode.  Always consumes &apos;&amp;&apos;.  [67] Reference ::= EntityRef | CharRef</info>
       <return type='void'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParseSDDecl' file='parserInternals' module='parser'>
-      <info>parse the XML standalone declaration  [32] SDDecl ::= S &apos;standalone&apos; Eq ((&quot;&apos;&quot; (&apos;yes&apos; | &apos;no&apos;) &quot;&apos;&quot;) | (&apos;&quot;&apos; (&apos;yes&apos; | &apos;no&apos;)&apos;&quot;&apos;))  [ VC: Standalone Document Declaration ] TODO The standalone document declaration must have the value &quot;no&quot; if any external markup declarations contain declarations of: - attributes with default values, if elements to which these attributes apply appear in the document without specifications of values for these attributes, or - entities (other than amp, lt, gt, apos, quot), if references to those entities appear in the document, or - attributes with values subject to normalization, where the attribute appears in the document with a value which will change as a result of normalization, or - element types with element content, if white space occurs directly within any instance of those types.</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse the XML standalone declaration  [32] SDDecl ::= S &apos;standalone&apos; Eq ((&quot;&apos;&quot; (&apos;yes&apos; | &apos;no&apos;) &quot;&apos;&quot;) | (&apos;&quot;&apos; (&apos;yes&apos; | &apos;no&apos;)&apos;&quot;&apos;))  [ VC: Standalone Document Declaration ] TODO The standalone document declaration must have the value &quot;no&quot; if any external markup declarations contain declarations of: - attributes with default values, if elements to which these attributes apply appear in the document without specifications of values for these attributes, or - entities (other than amp, lt, gt, apos, quot), if references to those entities appear in the document, or - attributes with values subject to normalization, where the attribute appears in the document with a value which will change as a result of normalization, or - element types with element content, if white space occurs directly within any instance of those types.</info>
       <return type='int' info='1 if standalone=&quot;yes&quot; 0 if standalone=&quot;no&quot; -2 if standalone attribute is missing or invalid (A standalone value of -2 means that the XML declaration was found, but no value was specified for the standalone attribute).'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParseStartTag' file='parserInternals' module='parser'>
       <cond>defined(LIBXML_SAX1_ENABLED)</cond>
-      <info>parse a start of tag either for rule element or EmptyElement. In both case we don&apos;t parse the tag closing chars.  [40] STag ::= &apos;&lt;&apos; Name (S Attribute)* S? &apos;&gt;&apos;  [ WFC: Unique Att Spec ] No attribute name may appear more than once in the same start-tag or empty-element tag.  [44] EmptyElemTag ::= &apos;&lt;&apos; Name (S Attribute)* S? &apos;/&gt;&apos;  [ WFC: Unique Att Spec ] No attribute name may appear more than once in the same start-tag or empty-element tag.  With namespace:  [NS 8] STag ::= &apos;&lt;&apos; QName (S Attribute)* S? &apos;&gt;&apos;  [NS 10] EmptyElement ::= &apos;&lt;&apos; QName (S Attribute)* S? &apos;/&gt;&apos;</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  Parse a start tag. Always consumes &apos;&lt;&apos;.  [40] STag ::= &apos;&lt;&apos; Name (S Attribute)* S? &apos;&gt;&apos;  [ WFC: Unique Att Spec ] No attribute name may appear more than once in the same start-tag or empty-element tag.  [44] EmptyElemTag ::= &apos;&lt;&apos; Name (S Attribute)* S? &apos;/&gt;&apos;  [ WFC: Unique Att Spec ] No attribute name may appear more than once in the same start-tag or empty-element tag.  With namespace:  [NS 8] STag ::= &apos;&lt;&apos; QName (S Attribute)* S? &apos;&gt;&apos;  [NS 10] EmptyElement ::= &apos;&lt;&apos; QName (S Attribute)* S? &apos;/&gt;&apos;</info>
       <return type='const xmlChar *' info='the element name parsed'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParseSystemLiteral' file='parserInternals' module='parser'>
-      <info>parse an XML Literal  [11] SystemLiteral ::= (&apos;&quot;&apos; [^&quot;]* &apos;&quot;&apos;) | (&quot;&apos;&quot; [^&apos;]* &quot;&apos;&quot;)</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse an XML Literal  [11] SystemLiteral ::= (&apos;&quot;&apos; [^&quot;]* &apos;&quot;&apos;) | (&quot;&apos;&quot; [^&apos;]* &quot;&apos;&quot;)</info>
       <return type='xmlChar *' info='the SystemLiteral parsed or NULL'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParseTextDecl' file='parserInternals' module='parser'>
-      <info>parse an XML declaration header for external entities  [77] TextDecl ::= &apos;&lt;?xml&apos; VersionInfo? EncodingDecl S? &apos;?&gt;&apos;</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse an XML declaration header for external entities  [77] TextDecl ::= &apos;&lt;?xml&apos; VersionInfo? EncodingDecl S? &apos;?&gt;&apos;</info>
       <return type='void'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
@@ -12270,22 +12294,22 @@ Could we use @subtypes for this?'/>
       <arg name='str' type='const char *' info='the string to analyze'/>
     </function>
     <function name='xmlParseVersionInfo' file='parserInternals' module='parser'>
-      <info>parse the XML version.  [24] VersionInfo ::= S &apos;version&apos; Eq (&apos; VersionNum &apos; | &quot; VersionNum &quot;)  [25] Eq ::= S? &apos;=&apos; S?</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse the XML version.  [24] VersionInfo ::= S &apos;version&apos; Eq (&apos; VersionNum &apos; | &quot; VersionNum &quot;)  [25] Eq ::= S? &apos;=&apos; S?</info>
       <return type='xmlChar *' info='the version string, e.g. &quot;1.0&quot;'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParseVersionNum' file='parserInternals' module='parser'>
-      <info>parse the XML version value.  [26] VersionNum ::= &apos;1.&apos; [0-9]+  In practice allow [0-9].[0-9]+ at that level</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse the XML version value.  [26] VersionNum ::= &apos;1.&apos; [0-9]+  In practice allow [0-9].[0-9]+ at that level</info>
       <return type='xmlChar *' info='the string giving the XML version number, or NULL'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParseXMLDecl' file='parserInternals' module='parser'>
-      <info>parse an XML declaration header  [23] XMLDecl ::= &apos;&lt;?xml&apos; VersionInfo EncodingDecl? SDDecl? S? &apos;?&gt;&apos;</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  parse an XML declaration header  [23] XMLDecl ::= &apos;&lt;?xml&apos; VersionInfo EncodingDecl? SDDecl? S? &apos;?&gt;&apos;</info>
       <return type='void'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
     </function>
     <function name='xmlParserAddNodeInfo' file='parser' module='parserInternals'>
-      <info>Insert node info record into the sorted sequence</info>
+      <info>DEPRECATED: Don&apos;t use.  Insert node info record into the sorted sequence</info>
       <return type='void'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
       <arg name='info' type='const xmlParserNodeInfoPtr' info='a node info sequence pointer'/>
@@ -12298,13 +12322,13 @@ Could we use @subtypes for this?'/>
       <arg name='...' type='...' info='extra parameters for the message display'/>
     </function>
     <function name='xmlParserFindNodeInfo' file='parser' module='parserInternals'>
-      <info>Find the parser node info struct for a given node</info>
+      <info>DEPRECATED: Don&apos;t use.  Find the parser node info struct for a given node</info>
       <return type='const xmlParserNodeInfo *' info='an xmlParserNodeInfo block pointer or NULL'/>
       <arg name='ctx' type='const xmlParserCtxtPtr' info='an XML parser context'/>
       <arg name='node' type='const xmlNodePtr' info='an XML node within the tree'/>
     </function>
     <function name='xmlParserFindNodeInfoIndex' file='parser' module='parserInternals'>
-      <info>xmlParserFindNodeInfoIndex : Find the index that the info record for the given node is or should be at in a sorted sequence</info>
+      <info>DEPRECATED: Don&apos;t use.  xmlParserFindNodeInfoIndex : Find the index that the info record for the given node is or should be at in a sorted sequence</info>
       <return type='unsigned long' info='a long indicating the position of the record'/>
       <arg name='seq' type='const xmlParserNodeInfoSeqPtr' info='a node info sequence pointer'/>
       <arg name='node' type='const xmlNodePtr' info='an XML node pointer'/>
@@ -12315,7 +12339,7 @@ Could we use @subtypes for this?'/>
       <arg name='filename' type='const char *' info='the path to a file'/>
     </function>
     <function name='xmlParserHandlePEReference' file='parserInternals' module='parser'>
-      <info>[69] PEReference ::= &apos;%&apos; Name &apos;;&apos;  [ WFC: No Recursion ] A parsed entity must not contain a recursive reference to itself, either directly or indirectly.  [ WFC: Entity Declared ] In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with &quot;standalone=&apos;yes&apos;&quot;, ...  ... The declaration of a parameter entity must precede any reference to it...  [ VC: Entity Declared ] In a document with an external subset or external parameter entities with &quot;standalone=&apos;no&apos;&quot;, ...  ... The declaration of a parameter entity must precede any reference to it...  [ WFC: In DTD ] Parameter-entity references may only appear in the DTD. NOTE: misleading but this is handled.  A PEReference may have been detected in the current input stream the handling is done accordingly to http://www.w3.org/TR/REC-xml#entproc i.e. - Included in literal in entity values - Included as Parameter Entity reference within DTDs</info>
+      <info>DEPRECATED: Internal function, do not use.  [69] PEReference ::= &apos;%&apos; Name &apos;;&apos;  [ WFC: No Recursion ] A parsed entity must not contain a recursive reference to itself, either directly or indirectly.  [ WFC: Entity Declared ] In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with &quot;standalone=&apos;yes&apos;&quot;, ...  ... The declaration of a parameter entity must precede any reference to it...  [ VC: Entity Declared ] In a document with an external subset or external parameter entities with &quot;standalone=&apos;no&apos;&quot;, ...  ... The declaration of a parameter entity must precede any reference to it...  [ WFC: In DTD ] Parameter-entity references may only appear in the DTD. NOTE: misleading but this is handled.  A PEReference may have been detected in the current input stream the handling is done accordingly to http://www.w3.org/TR/REC-xml#entproc i.e. - Included in literal in entity values - Included as Parameter Entity reference within DTDs</info>
       <return type='void'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='the parser context'/>
     </function>
@@ -12370,7 +12394,7 @@ Could we use @subtypes for this?'/>
       <arg name='enc' type='xmlCharEncoding' info='the charset encoding if known'/>
     </function>
     <function name='xmlParserInputBufferCreateStatic' file='xmlIO' module='xmlIO'>
-      <info>Create a buffered parser input for the progressive parsing for the input from an immutable memory area. This will not copy the memory area to the buffer, but the memory is expected to be available until the end of the parsing, this is useful for example when using mmap&apos;ed file.</info>
+      <info>DEPRECATED: Use xmlParserInputBufferCreateMem.</info>
       <return type='xmlParserInputBufferPtr' info='the new parser input or NULL'/>
       <arg name='mem' type='const char *' info='the memory input'/>
       <arg name='size' type='int' info='the length of the memory block'/>
@@ -12401,19 +12425,19 @@ Could we use @subtypes for this?'/>
       <arg name='str' type='xmlChar *' info='the string to deallocate'/>
     </functype>
     <function name='xmlParserInputGrow' file='parser' module='parserInternals'>
-      <info>This function increase the input for the parser. It tries to preserve pointers to the input buffer, and keep already read data</info>
+      <info>DEPRECATED: Don&apos;t use.  This function increase the input for the parser. It tries to preserve pointers to the input buffer, and keep already read data</info>
       <return type='int' info='the amount of char read, or -1 in case of error, 0 indicate the end of this entity'/>
       <arg name='in' type='xmlParserInputPtr' info='an XML parser input'/>
       <arg name='len' type='int' info='an indicative size for the lookahead'/>
     </function>
     <function name='xmlParserInputRead' file='parser' module='parserInternals'>
-      <info>This function was internal and is deprecated.</info>
+      <info>DEPRECATED: This function was internal and is deprecated.</info>
       <return type='int' info='-1 as this is an error to use it.'/>
       <arg name='in' type='xmlParserInputPtr' info='an XML parser input'/>
       <arg name='len' type='int' info='an indicative size for the lookahead'/>
     </function>
     <function name='xmlParserInputShrink' file='parserInternals' module='parserInternals'>
-      <info>This function removes used input for the parser.</info>
+      <info>DEPRECATED: Don&apos;t use.  This function removes used input for the parser.</info>
       <return type='void'/>
       <arg name='in' type='xmlParserInputPtr' info='an XML parser input'/>
     </function>
@@ -12500,7 +12524,7 @@ Could we use @subtypes for this?'/>
       <arg name='namespaces' type='const xmlChar **' info='the prefix definitions, array of [URI, prefix] or NULL'/>
     </function>
     <function name='xmlPedanticParserDefault' file='parser' module='parserInternals'>
-      <info>Set and return the previous value for enabling pedantic warnings.</info>
+      <info>DEPRECATED: Use the modern options API with XML_PARSE_PEDANTIC.  Set and return the previous value for enabling pedantic warnings.</info>
       <return type='int' info='the last value for 0 for no substitution, 1 for substitution.'/>
       <arg name='val' type='int' info='int 0 or 1'/>
     </function>
@@ -12723,19 +12747,19 @@ Could we use @subtypes for this?'/>
     </function>
     <function name='xmlRecoverDoc' file='parser' module='parser'>
       <cond>defined(LIBXML_SAX1_ENABLED)</cond>
-      <info>parse an XML in-memory document and build a tree. In the case the document is not Well Formed, a attempt to build a tree is tried anyway</info>
+      <info>DEPRECATED: Use xmlReadDoc with XML_PARSE_RECOVER.  parse an XML in-memory document and build a tree. In the case the document is not Well Formed, a attempt to build a tree is tried anyway</info>
       <return type='xmlDocPtr' info='the resulting document tree or NULL in case of failure'/>
       <arg name='cur' type='const xmlChar *' info='a pointer to an array of xmlChar'/>
     </function>
     <function name='xmlRecoverFile' file='parser' module='parser'>
       <cond>defined(LIBXML_SAX1_ENABLED)</cond>
-      <info>parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. In the case the document is not Well Formed, it attempts to build a tree anyway</info>
+      <info>DEPRECATED: Use xmlReadFile with XML_PARSE_RECOVER.  parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. In the case the document is not Well Formed, it attempts to build a tree anyway</info>
       <return type='xmlDocPtr' info='the resulting document tree or NULL in case of failure'/>
       <arg name='filename' type='const char *' info='the filename'/>
     </function>
     <function name='xmlRecoverMemory' file='parser' module='parser'>
       <cond>defined(LIBXML_SAX1_ENABLED)</cond>
-      <info>parse an XML in-memory block and build a tree. In the case the document is not Well Formed, an attempt to build a tree is tried anyway</info>
+      <info>DEPRECATED: Use xmlReadMemory with XML_PARSE_RECOVER.  parse an XML in-memory block and build a tree. In the case the document is not Well Formed, an attempt to build a tree is tried anyway</info>
       <return type='xmlDocPtr' info='the resulting document tree or NULL in case of error'/>
       <arg name='buffer' type='const char *' info='an pointer to a char array'/>
       <arg name='size' type='int' info='the size of the array'/>
@@ -13321,13 +13345,13 @@ Could we use @subtypes for this?'/>
     </function>
     <function name='xmlSAXDefaultVersion' file='SAX2' module='SAX2'>
       <cond>defined(LIBXML_SAX1_ENABLED)</cond>
-      <info>Set the default version of SAX used globally by the library. By default, during initialization the default is set to 2. Note that it is generally a better coding style to use xmlSAXVersion() to set up the version explicitly for a given parsing context.</info>
+      <info>DEPRECATED: Use parser option XML_PARSE_SAX1.  Set the default version of SAX used globally by the library. By default, during initialization the default is set to 2. Note that it is generally a better coding style to use xmlSAXVersion() to set up the version explicitly for a given parsing context.</info>
       <return type='int' info='the previous value in case of success and -1 in case of error.'/>
       <arg name='version' type='int' info='the version, 1 or 2'/>
     </function>
     <function name='xmlSAXParseDTD' file='parser' module='parser'>
       <cond>defined(LIBXML_VALID_ENABLED)</cond>
-      <info>Load and parse an external subset.</info>
+      <info>DEPRECATED: Don&apos;t use.  Load and parse an external subset.</info>
       <return type='xmlDtdPtr' info='the resulting xmlDtdPtr or NULL in case of error.'/>
       <arg name='sax' type='xmlSAXHandlerPtr' info='the SAX handler block'/>
       <arg name='ExternalID' type='const xmlChar *' info='a NAME* containing the External ID of the DTD'/>
@@ -13335,7 +13359,7 @@ Could we use @subtypes for this?'/>
     </function>
     <function name='xmlSAXParseDoc' file='parser' module='parser'>
       <cond>defined(LIBXML_SAX1_ENABLED)</cond>
-      <info>parse an XML in-memory document and build a tree. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.</info>
+      <info>DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadDoc.  parse an XML in-memory document and build a tree. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.</info>
       <return type='xmlDocPtr' info='the resulting document tree'/>
       <arg name='sax' type='xmlSAXHandlerPtr' info='the SAX handler block'/>
       <arg name='cur' type='const xmlChar *' info='a pointer to an array of xmlChar'/>
@@ -13343,14 +13367,14 @@ Could we use @subtypes for this?'/>
     </function>
     <function name='xmlSAXParseEntity' file='parser' module='parser'>
       <cond>defined(LIBXML_SAX1_ENABLED)</cond>
-      <info>parse an XML external entity out of context and build a tree. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.  [78] extParsedEnt ::= TextDecl? content  This correspond to a &quot;Well Balanced&quot; chunk</info>
+      <info>DEPRECATED: Don&apos;t use.  parse an XML external entity out of context and build a tree. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.  [78] extParsedEnt ::= TextDecl? content  This correspond to a &quot;Well Balanced&quot; chunk</info>
       <return type='xmlDocPtr' info='the resulting document tree'/>
       <arg name='sax' type='xmlSAXHandlerPtr' info='the SAX handler block'/>
       <arg name='filename' type='const char *' info='the filename'/>
     </function>
     <function name='xmlSAXParseFile' file='parser' module='parser'>
       <cond>defined(LIBXML_SAX1_ENABLED)</cond>
-      <info>parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.</info>
+      <info>DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadFile.  parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.</info>
       <return type='xmlDocPtr' info='the resulting document tree'/>
       <arg name='sax' type='xmlSAXHandlerPtr' info='the SAX handler block'/>
       <arg name='filename' type='const char *' info='the filename'/>
@@ -13358,7 +13382,7 @@ Could we use @subtypes for this?'/>
     </function>
     <function name='xmlSAXParseFileWithData' file='parser' module='parser'>
       <cond>defined(LIBXML_SAX1_ENABLED)</cond>
-      <info>parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.  User data (void *) is stored within the parser context in the context&apos;s _private member, so it is available nearly everywhere in libxml</info>
+      <info>DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadFile.  parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.  User data (void *) is stored within the parser context in the context&apos;s _private member, so it is available nearly everywhere in libxml</info>
       <return type='xmlDocPtr' info='the resulting document tree'/>
       <arg name='sax' type='xmlSAXHandlerPtr' info='the SAX handler block'/>
       <arg name='filename' type='const char *' info='the filename'/>
@@ -13367,7 +13391,7 @@ Could we use @subtypes for this?'/>
     </function>
     <function name='xmlSAXParseMemory' file='parser' module='parser'>
       <cond>defined(LIBXML_SAX1_ENABLED)</cond>
-      <info>parse an XML in-memory block and use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.</info>
+      <info>DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadMemory.  parse an XML in-memory block and use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.</info>
       <return type='xmlDocPtr' info='the resulting document tree'/>
       <arg name='sax' type='xmlSAXHandlerPtr' info='the SAX handler block'/>
       <arg name='buffer' type='const char *' info='an pointer to a char array'/>
@@ -13376,7 +13400,7 @@ Could we use @subtypes for this?'/>
     </function>
     <function name='xmlSAXParseMemoryWithData' file='parser' module='parser'>
       <cond>defined(LIBXML_SAX1_ENABLED)</cond>
-      <info>parse an XML in-memory block and use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.  User data (void *) is stored within the parser context in the context&apos;s _private member, so it is available nearly everywhere in libxml</info>
+      <info>DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadMemory.  parse an XML in-memory block and use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.  User data (void *) is stored within the parser context in the context&apos;s _private member, so it is available nearly everywhere in libxml</info>
       <return type='xmlDocPtr' info='the resulting document tree'/>
       <arg name='sax' type='xmlSAXHandlerPtr' info='the SAX handler block'/>
       <arg name='buffer' type='const char *' info='an pointer to a char array'/>
@@ -13386,7 +13410,7 @@ Could we use @subtypes for this?'/>
     </function>
     <function name='xmlSAXUserParseFile' file='parser' module='parser'>
       <cond>defined(LIBXML_SAX1_ENABLED)</cond>
-      <info>parse an XML file and call the given SAX handler routines. Automatic support for ZLIB/Compress compressed document is provided</info>
+      <info>DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadFile.  parse an XML file and call the given SAX handler routines. Automatic support for ZLIB/Compress compressed document is provided</info>
       <return type='int' info='0 in case of success or a error number otherwise'/>
       <arg name='sax' type='xmlSAXHandlerPtr' info='a SAX handler'/>
       <arg name='user_data' type='void *' info='The user data returned on SAX callbacks'/>
@@ -13394,7 +13418,7 @@ Could we use @subtypes for this?'/>
     </function>
     <function name='xmlSAXUserParseMemory' file='parser' module='parser'>
       <cond>defined(LIBXML_SAX1_ENABLED)</cond>
-      <info>A better SAX parsing routine. parse an XML in-memory buffer and call the given SAX handler routines.</info>
+      <info>DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadMemory.  parse an XML in-memory buffer and call the given SAX handler routines.</info>
       <return type='int' info='0 in case of success or a error number otherwise'/>
       <arg name='sax' type='xmlSAXHandlerPtr' info='a SAX handler'/>
       <arg name='user_data' type='void *' info='The user data returned on SAX callbacks'/>
@@ -13552,7 +13576,7 @@ Could we use @subtypes for this?'/>
     </function>
     <function name='xmlSchemaCleanupTypes' file='xmlschemastypes' module='xmlschemastypes'>
       <cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
-      <info>DEPRECATED: This function will be made private. Call xmlCleanupParser to free global state but see the warnings there. xmlCleanupParser should be only called once at program exit. In most cases, you don&apos;t have call cleanup functions at all.  Cleanup the default XML Schemas type library</info>
+      <info>DEPRECATED: This function will be made private. Call xmlCleanupParser to free global state but see the warnings there. xmlCleanupParser should be only called once at program exit. In most cases, you don&apos;t have to call cleanup functions at all.  Cleanup the default XML Schemas type library</info>
       <return type='void'/>
     </function>
     <function name='xmlSchemaCollapseString' file='xmlschemastypes' module='xmlschemastypes'>
@@ -13699,7 +13723,7 @@ Could we use @subtypes for this?'/>
     <function name='xmlSchemaInitTypes' file='xmlschemastypes' module='xmlschemastypes'>
       <cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
       <info>Initialize the default XML Schemas type library</info>
-      <return type='void'/>
+      <return type='int' info='0 on success, -1 on error.'/>
     </function>
     <function name='xmlSchemaIsBuiltInTypeFacet' file='xmlschemastypes' module='xmlschemastypes'>
       <cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
@@ -14195,7 +14219,7 @@ Could we use @subtypes for this?'/>
     </function>
     <function name='xmlSetupParserForBuffer' file='parser' module='parser'>
       <cond>defined(LIBXML_SAX1_ENABLED)</cond>
-      <info>Setup the parser context to parse a new buffer; Clears any prior contents from the parser context. The buffer parameter must not be NULL, but the filename parameter can be</info>
+      <info>DEPRECATED: Don&apos;t use.  Setup the parser context to parse a new buffer; Clears any prior contents from the parser context. The buffer parameter must not be NULL, but the filename parameter can be</info>
       <return type='void'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
       <arg name='buffer' type='const xmlChar *' info='a xmlChar * buffer'/>
@@ -14335,7 +14359,7 @@ Could we use @subtypes for this?'/>
       <arg name='node2' type='xmlNodePtr' info='unused'/>
     </function>
     <function name='xmlSkipBlankChars' file='parserInternals' module='parser'>
-      <info>skip all blanks character found at that point in the input streams. It pops up finished entities in the process if allowable at that point.</info>
+      <info>DEPRECATED: Internal function, do not use.  skip all blanks character found at that point in the input streams. It pops up finished entities in the process if allowable at that point.</info>
       <return type='int' info='the number of space chars skipped'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='the XML parser context'/>
     </function>
@@ -14486,14 +14510,14 @@ Could we use @subtypes for this?'/>
       <arg name='streamCtxt' type='xmlStreamCtxtPtr' info='the stream context'/>
     </function>
     <function name='xmlStringCurrentChar' file='parserInternals' module='parserInternals'>
-      <info>The current char value, if using UTF-8 this may actually span multiple bytes in the input buffer.</info>
+      <info>DEPRECATED: Internal function, do not use.  The current char value, if using UTF-8 this may actually span multiple bytes in the input buffer.</info>
       <return type='int' info='the current char value and its length'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='the XML parser context'/>
       <arg name='cur' type='const xmlChar *' info='pointer to the beginning of the char'/>
       <arg name='len' type='int *' info='pointer to the length of the char read'/>
     </function>
     <function name='xmlStringDecodeEntities' file='parserInternals' module='parser'>
-      <info>Takes a entity string content and process to do the adequate substitutions.  [67] Reference ::= EntityRef | CharRef  [69] PEReference ::= &apos;%&apos; Name &apos;;&apos;</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  Takes a entity string content and process to do the adequate substitutions.  [67] Reference ::= EntityRef | CharRef  [69] PEReference ::= &apos;%&apos; Name &apos;;&apos;</info>
       <return type='xmlChar *' info='A newly allocated string with the substitution done. The caller must deallocate it !'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='the parser context'/>
       <arg name='str' type='const xmlChar *' info='the input string'/>
@@ -14509,7 +14533,7 @@ Could we use @subtypes for this?'/>
       <arg name='value' type='const xmlChar *' info='the value of the attribute'/>
     </function>
     <function name='xmlStringLenDecodeEntities' file='parserInternals' module='parser'>
-      <info>Takes a entity string content and process to do the adequate substitutions.  [67] Reference ::= EntityRef | CharRef  [69] PEReference ::= &apos;%&apos; Name &apos;;&apos;</info>
+      <info>DEPRECATED: Internal function, don&apos;t use.  Takes a entity string content and process to do the adequate substitutions.  [67] Reference ::= EntityRef | CharRef  [69] PEReference ::= &apos;%&apos; Name &apos;;&apos;</info>
       <return type='xmlChar *' info='A newly allocated string with the substitution done. The caller must deallocate it !'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='the parser context'/>
       <arg name='str' type='const xmlChar *' info='the input string'/>
@@ -14585,7 +14609,7 @@ Could we use @subtypes for this?'/>
       <arg name='error' type='xmlErrorPtr' info='the error being raised.'/>
     </functype>
     <function name='xmlSubstituteEntitiesDefault' file='parser' module='parserInternals'>
-      <info>Set and return the previous value for default entity support. Initially the parser always keep entity references instead of substituting entity values in the output. This function has to be used to change the default parser behavior SAX::substituteEntities() has to be used for changing that on a file by file basis.</info>
+      <info>DEPRECATED: Use the modern options API with XML_PARSE_NOENT.  Set and return the previous value for default entity support. Initially the parser always keep entity references instead of substituting entity values in the output. This function has to be used to change the default parser behavior SAX::substituteEntities() has to be used for changing that on a file by file basis.</info>
       <return type='int' info='the last value for 0 for no substitution, 1 for substitution.'/>
       <arg name='val' type='int' info='int 0 or 1'/>
     </function>
@@ -14596,7 +14620,7 @@ Could we use @subtypes for this?'/>
       <arg name='enc' type='xmlCharEncoding' info='the encoding value (number)'/>
     </function>
     <function name='xmlSwitchInputEncoding' file='parserInternals' module='parserInternals'>
-      <info>DEPRECATED: Use xmlSwitchToEncoding  change the input functions when discovering the character encoding of a given entity.</info>
+      <info>change the input functions when discovering the character encoding of a given entity.</info>
       <return type='int' info='0 in case of success, -1 otherwise'/>
       <arg name='ctxt' type='xmlParserCtxtPtr' info='the parser context'/>
       <arg name='input' type='xmlParserInputPtr' info='the input stream'/>
@@ -16788,7 +16812,7 @@ Could we use @subtypes for this?'/>
       <arg name='str' type='const xmlChar *' info='the string of the URI to escape'/>
     </function>
     <function name='xmlURIEscapeStr' file='uri' module='uri'>
-      <info>This routine escapes a string to hex, ignoring reserved characters (a-z) and the characters in the exception list.</info>
+      <info>This routine escapes a string to hex, ignoring reserved characters (a-z, A-Z, 0-9, &quot;@-_.!~*&apos;()&quot;) and the characters in the exception list.</info>
       <return type='xmlChar *' info='a new escaped string or NULL in case of error.'/>
       <arg name='str' type='const xmlChar *' info='string to escape'/>
       <arg name='list' type='const xmlChar *' info='exception list string of chars not to escape'/>
@@ -16965,7 +16989,7 @@ Could we use @subtypes for this?'/>
       <return type='int' info='1 if valid or 0 otherwise'/>
       <arg name='ctxt' type='xmlValidCtxtPtr' info='the validation context'/>
       <arg name='doc' type='xmlDocPtr' info='a document instance'/>
-      <arg name='elem' type='xmlNodePtr' info='an element instance'/>
+      <arg name='root' type='xmlNodePtr' info=''/>
     </function>
     <function name='xmlValidateElementDecl' file='valid' module='valid'>
       <cond>defined(LIBXML_VALID_ENABLED)</cond>
@@ -17586,7 +17610,7 @@ Could we use @subtypes for this?'/>
     </function>
     <function name='xmlXPathInit' file='xpath' module='xpath'>
       <cond>defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)</cond>
-      <info>DEPRECATED: This function will be made private. Call xmlInitParser to initialize the library.  Initialize the XPath environment</info>
+      <info>DEPRECATED: Alias for xmlInitParser.</info>
       <return type='void'/>
     </function>
     <function name='xmlXPathIntersection' file='xpathInternals' module='xpath'>
@@ -17887,7 +17911,7 @@ Could we use @subtypes for this?'/>
     <function name='xmlXPathNodeSetMerge' file='xpathInternals' module='xpath'>
       <cond>defined(LIBXML_XPATH_ENABLED)</cond>
       <info>Merges two nodesets, all nodes from @val2 are added to @val1 if @val1 is NULL, a new set is created and copied from @val2</info>
-      <return type='xmlNodeSetPtr' info='@val1 once extended or NULL in case of error.'/>
+      <return type='xmlNodeSetPtr' info='@val1 once extended or NULL in case of error.  Frees @val1 in case of error.'/>
       <arg name='val1' type='xmlNodeSetPtr' info='the first NodeSet or NULL'/>
       <arg name='val2' type='xmlNodeSetPtr' info='the second NodeSet'/>
     </function>
@@ -18248,13 +18272,13 @@ Could we use @subtypes for this?'/>
     <function name='xmlXPathWrapNodeSet' file='xpathInternals' module='xpath'>
       <cond>defined(LIBXML_XPATH_ENABLED)</cond>
       <info>Wrap the Nodeset @val in a new xmlXPathObjectPtr</info>
-      <return type='xmlXPathObjectPtr' info='the newly created object.'/>
+      <return type='xmlXPathObjectPtr' info='the newly created object.  In case of error the node set is destroyed and NULL is returned.'/>
       <arg name='val' type='xmlNodeSetPtr' info='the NodePtr value'/>
     </function>
     <function name='xmlXPathWrapString' file='xpathInternals' module='xpath'>
       <cond>defined(LIBXML_XPATH_ENABLED)</cond>
       <info>Wraps the @val string into an XPath object.</info>
-      <return type='xmlXPathObjectPtr' info='the newly created object.'/>
+      <return type='xmlXPathObjectPtr' info='the newly created object.  Frees @val in case of error.'/>
       <arg name='val' type='xmlChar *' info='the xmlChar * value'/>
     </function>
     <function name='xmlXPatherror' file='xpathInternals' module='xpath'>
diff --git a/doc/symbols.xml b/doc/symbols.xml
deleted file mode 100644 (file)
index 2b667e0..0000000
+++ /dev/null
@@ -1,1774 +0,0 @@
-<!-- This file describes all the exported entry points from the
-     library, groupped by release with the first release being 2.4.30
-     Add new exported entry points at the end, this will be used to
-     generate libxml2.syms the definition of exported symbols from
-     shared libraries
-  -->
-<symbols>
-  <release version="2.4.30">
-    <symbol file="debugXML">xmlBoolToText</symbol>
-    <symbol file="debugXML">xmlDebugDumpAttr</symbol>
-    <symbol file="debugXML">xmlDebugDumpAttrList</symbol>
-    <symbol file="debugXML">xmlDebugDumpDTD</symbol>
-    <symbol file="debugXML">xmlDebugDumpDocument</symbol>
-    <symbol file="debugXML">xmlDebugDumpDocumentHead</symbol>
-    <symbol file="debugXML">xmlDebugDumpEntities</symbol>
-    <symbol file="debugXML">xmlDebugDumpNode</symbol>
-    <symbol file="debugXML">xmlDebugDumpNodeList</symbol>
-    <symbol file="debugXML">xmlDebugDumpOneNode</symbol>
-    <symbol file="debugXML">xmlDebugDumpString</symbol>
-    <symbol file="debugXML">xmlLsCountNode</symbol>
-    <symbol file="debugXML">xmlLsOneNode</symbol>
-    <symbol file="debugXML">xmlShell</symbol>
-    <symbol file="debugXML">xmlShellBase</symbol>
-    <symbol file="debugXML">xmlShellCat</symbol>
-    <symbol file="debugXML">xmlShellDir</symbol>
-    <symbol file="debugXML">xmlShellDu</symbol>
-    <symbol file="debugXML">xmlShellList</symbol>
-    <symbol file="debugXML">xmlShellLoad</symbol>
-    <symbol file="debugXML">xmlShellPrintNode</symbol>
-    <symbol file="debugXML">xmlShellPrintXPathError</symbol>
-    <symbol file="debugXML">xmlShellPrintXPathResult</symbol>
-    <symbol file="debugXML">xmlShellPwd</symbol>
-    <symbol file="debugXML">xmlShellSave</symbol>
-    <symbol file="debugXML">xmlShellValidate</symbol>
-    <symbol file="debugXML">xmlShellWrite</symbol>
-    <symbol file="xpointer">xmlXPtrBuildNodeList</symbol>
-    <symbol file="xpointer">xmlXPtrEval</symbol>
-    <symbol file="xpointer">xmlXPtrEvalRangePredicate</symbol>
-    <symbol file="xpointer">xmlXPtrFreeLocationSet</symbol>
-    <symbol file="xpointer">xmlXPtrLocationSetAdd</symbol>
-    <symbol file="xpointer">xmlXPtrLocationSetCreate</symbol>
-    <symbol file="xpointer">xmlXPtrLocationSetDel</symbol>
-    <symbol file="xpointer">xmlXPtrLocationSetMerge</symbol>
-    <symbol file="xpointer">xmlXPtrLocationSetRemove</symbol>
-    <symbol file="xpointer">xmlXPtrNewCollapsedRange</symbol>
-    <symbol file="xpointer">xmlXPtrNewContext</symbol>
-    <symbol file="xpointer">xmlXPtrNewLocationSetNodeSet</symbol>
-    <symbol file="xpointer">xmlXPtrNewLocationSetNodes</symbol>
-    <symbol file="xpointer">xmlXPtrNewRange</symbol>
-    <symbol file="xpointer">xmlXPtrNewRangeNodeObject</symbol>
-    <symbol file="xpointer">xmlXPtrNewRangeNodePoint</symbol>
-    <symbol file="xpointer">xmlXPtrNewRangeNodes</symbol>
-    <symbol file="xpointer">xmlXPtrNewRangePointNode</symbol>
-    <symbol file="xpointer">xmlXPtrNewRangePoints</symbol>
-    <symbol file="xpointer">xmlXPtrRangeToFunction</symbol>
-    <symbol file="xpointer">xmlXPtrWrapLocationSet</symbol>
-    <symbol file="SAX">attribute</symbol>
-    <symbol file="SAX">attributeDecl</symbol>
-    <symbol file="SAX">cdataBlock</symbol>
-    <symbol file="SAX">characters</symbol>
-    <symbol file="SAX">checkNamespace</symbol>
-    <symbol file="SAX">comment</symbol>
-    <symbol file="SAX2" removed="2.10.0">docbDefaultSAXHandlerInit</symbol>
-    <symbol file="SAX">elementDecl</symbol>
-    <symbol file="SAX">endDocument</symbol>
-    <symbol file="SAX">endElement</symbol>
-    <symbol file="SAX">entityDecl</symbol>
-    <symbol file="SAX">externalSubset</symbol>
-    <symbol file="SAX">getColumnNumber</symbol>
-    <symbol file="SAX">getEntity</symbol>
-    <symbol file="SAX">getLineNumber</symbol>
-    <symbol file="SAX">getNamespace</symbol>
-    <symbol file="SAX">getParameterEntity</symbol>
-    <symbol file="SAX">getPublicId</symbol>
-    <symbol file="SAX">getSystemId</symbol>
-    <symbol file="SAX">globalNamespace</symbol>
-    <symbol file="SAX">hasExternalSubset</symbol>
-    <symbol file="SAX">hasInternalSubset</symbol>
-    <symbol file="SAX2">htmlDefaultSAXHandlerInit</symbol>
-    <symbol file="SAX">ignorableWhitespace</symbol>
-    <symbol file="SAX" removed="2.10.0">initdocbDefaultSAXHandler</symbol>
-    <symbol file="SAX">inithtmlDefaultSAXHandler</symbol>
-    <symbol file="SAX">initxmlDefaultSAXHandler</symbol>
-    <symbol file="SAX">internalSubset</symbol>
-    <symbol file="SAX">isStandalone</symbol>
-    <symbol file="SAX">namespaceDecl</symbol>
-    <symbol file="SAX">notationDecl</symbol>
-    <symbol file="SAX">processingInstruction</symbol>
-    <symbol file="SAX">reference</symbol>
-    <symbol file="SAX">resolveEntity</symbol>
-    <symbol file="SAX">setDocumentLocator</symbol>
-    <symbol file="SAX">setNamespace</symbol>
-    <symbol file="SAX">startDocument</symbol>
-    <symbol file="SAX">startElement</symbol>
-    <symbol file="SAX">unparsedEntityDecl</symbol>
-    <symbol file="SAX2">xmlDefaultSAXHandlerInit</symbol>
-    <symbol file="parserInternals">htmlCreateFileParserCtxt</symbol>
-    <symbol file="parserInternals">htmlInitAutoClose</symbol>
-    <symbol file="parserInternals">inputPop</symbol>
-    <symbol file="parserInternals">inputPush</symbol>
-    <symbol file="parserInternals">namePop</symbol>
-    <symbol file="parserInternals">namePush</symbol>
-    <symbol file="parserInternals">nodePop</symbol>
-    <symbol file="parserInternals">nodePush</symbol>
-    <symbol file="parserInternals">xmlCheckLanguageID</symbol>
-    <symbol file="parserInternals">xmlCopyChar</symbol>
-    <symbol file="parserInternals">xmlCopyCharMultiByte</symbol>
-    <symbol file="parserInternals">xmlCreateEntityParserCtxt</symbol>
-    <symbol file="parserInternals">xmlCreateFileParserCtxt</symbol>
-    <symbol file="parserInternals">xmlCreateMemoryParserCtxt</symbol>
-    <symbol file="parserInternals">xmlCurrentChar</symbol>
-    <symbol file="parserInternals">xmlDecodeEntities</symbol>
-    <symbol file="parserInternals">xmlFreeInputStream</symbol>
-    <symbol file="parserInternals">xmlHandleEntity</symbol>
-    <symbol file="chvalid">xmlIsBaseChar</symbol>
-    <symbol file="chvalid">xmlIsBlank</symbol>
-    <symbol file="chvalid">xmlIsChar</symbol>
-    <symbol file="chvalid">xmlIsCombining</symbol>
-    <symbol file="chvalid">xmlIsDigit</symbol>
-    <symbol file="chvalid">xmlIsExtender</symbol>
-    <symbol file="chvalid">xmlIsIdeographic</symbol>
-    <symbol file="parserInternals">xmlIsLetter</symbol>
-    <symbol file="chvalid">xmlIsPubidChar</symbol>
-    <symbol file="parserInternals">xmlNamespaceParseNCName</symbol>
-    <symbol file="parserInternals">xmlNamespaceParseNSDef</symbol>
-    <symbol file="parserInternals">xmlNamespaceParseQName</symbol>
-    <symbol file="parserInternals">xmlNewEntityInputStream</symbol>
-    <symbol file="parserInternals">xmlNewInputFromFile</symbol>
-    <symbol file="parserInternals">xmlNewInputStream</symbol>
-    <symbol file="parser">xmlNewParserCtxt</symbol>
-    <symbol file="parserInternals">xmlNewStringInputStream</symbol>
-    <symbol file="parserInternals">xmlNextChar</symbol>
-    <symbol file="parserInternals">xmlParseAttValue</symbol>
-    <symbol file="parserInternals">xmlParseAttribute</symbol>
-    <symbol file="parserInternals">xmlParseAttributeListDecl</symbol>
-    <symbol file="parserInternals">xmlParseAttributeType</symbol>
-    <symbol file="parserInternals">xmlParseCDSect</symbol>
-    <symbol file="parserInternals">xmlParseCharData</symbol>
-    <symbol file="parserInternals">xmlParseCharRef</symbol>
-    <symbol file="parserInternals">xmlParseComment</symbol>
-    <symbol file="parserInternals">xmlParseContent</symbol>
-    <symbol file="parserInternals">xmlParseDefaultDecl</symbol>
-    <symbol file="parserInternals">xmlParseDocTypeDecl</symbol>
-    <symbol file="parserInternals">xmlParseElement</symbol>
-    <symbol file="parserInternals">xmlParseElementChildrenContentDecl</symbol>
-    <symbol file="parserInternals">xmlParseElementContentDecl</symbol>
-    <symbol file="parserInternals">xmlParseElementDecl</symbol>
-    <symbol file="parserInternals">xmlParseElementMixedContentDecl</symbol>
-    <symbol file="parserInternals">xmlParseEncName</symbol>
-    <symbol file="parserInternals">xmlParseEncodingDecl</symbol>
-    <symbol file="parserInternals">xmlParseEndTag</symbol>
-    <symbol file="parserInternals">xmlParseEntityDecl</symbol>
-    <symbol file="parserInternals">xmlParseEntityRef</symbol>
-    <symbol file="parserInternals">xmlParseEntityValue</symbol>
-    <symbol file="parserInternals">xmlParseEnumeratedType</symbol>
-    <symbol file="parserInternals">xmlParseEnumerationType</symbol>
-    <symbol file="parserInternals">xmlParseExternalID</symbol>
-    <symbol file="parserInternals">xmlParseExternalSubset</symbol>
-    <symbol file="parserInternals">xmlParseMarkupDecl</symbol>
-    <symbol file="parserInternals">xmlParseMisc</symbol>
-    <symbol file="parserInternals">xmlParseName</symbol>
-    <symbol file="parserInternals">xmlParseNamespace</symbol>
-    <symbol file="parserInternals">xmlParseNmtoken</symbol>
-    <symbol file="parserInternals">xmlParseNotationDecl</symbol>
-    <symbol file="parserInternals">xmlParseNotationType</symbol>
-    <symbol file="parserInternals">xmlParsePEReference</symbol>
-    <symbol file="parserInternals">xmlParsePI</symbol>
-    <symbol file="parserInternals">xmlParsePITarget</symbol>
-    <symbol file="parserInternals">xmlParsePubidLiteral</symbol>
-    <symbol file="parserInternals">xmlParseQuotedString</symbol>
-    <symbol file="parserInternals">xmlParseReference</symbol>
-    <symbol file="parserInternals">xmlParseSDDecl</symbol>
-    <symbol file="parserInternals">xmlParseStartTag</symbol>
-    <symbol file="parserInternals">xmlParseSystemLiteral</symbol>
-    <symbol file="parserInternals">xmlParseTextDecl</symbol>
-    <symbol file="parserInternals">xmlParseVersionInfo</symbol>
-    <symbol file="parserInternals">xmlParseVersionNum</symbol>
-    <symbol file="parserInternals">xmlParseXMLDecl</symbol>
-    <symbol file="parserInternals">xmlParserHandlePEReference</symbol>
-    <symbol file="parserInternals">xmlParserHandleReference</symbol>
-    <symbol file="parserInternals">xmlParserInputShrink</symbol>
-    <symbol file="parserInternals">xmlPopInput</symbol>
-    <symbol file="parserInternals">xmlPushInput</symbol>
-    <symbol file="parserInternals">xmlScanName</symbol>
-    <symbol file="parserInternals">xmlSetEntityReferenceFunc</symbol>
-    <symbol file="parserInternals">xmlSkipBlankChars</symbol>
-    <symbol file="parserInternals">xmlSplitQName</symbol>
-    <symbol file="parserInternals">xmlStringComment</symbol>
-    <symbol file="parserInternals">xmlStringCurrentChar</symbol>
-    <symbol file="parserInternals">xmlStringDecodeEntities</symbol>
-    <symbol file="parserInternals">xmlStringText</symbol>
-    <symbol file="parserInternals">xmlStringTextNoenc</symbol>
-    <symbol file="parserInternals">xmlSwitchEncoding</symbol>
-    <symbol file="parserInternals">xmlSwitchToEncoding</symbol>
-    <symbol file="c14n">xmlC14NDocDumpMemory</symbol>
-    <symbol file="c14n">xmlC14NDocSave</symbol>
-    <symbol file="c14n">xmlC14NDocSaveTo</symbol>
-    <symbol file="c14n">xmlC14NExecute</symbol>
-    <symbol file="catalog">xmlACatalogAdd</symbol>
-    <symbol file="catalog">xmlACatalogDump</symbol>
-    <symbol file="catalog">xmlACatalogRemove</symbol>
-    <symbol file="catalog">xmlACatalogResolve</symbol>
-    <symbol file="catalog">xmlACatalogResolvePublic</symbol>
-    <symbol file="catalog">xmlACatalogResolveSystem</symbol>
-    <symbol file="catalog">xmlACatalogResolveURI</symbol>
-    <symbol file="catalog">xmlCatalogAdd</symbol>
-    <symbol file="catalog">xmlCatalogAddLocal</symbol>
-    <symbol file="catalog">xmlCatalogCleanup</symbol>
-    <symbol file="catalog">xmlCatalogConvert</symbol>
-    <symbol file="catalog">xmlCatalogDump</symbol>
-    <symbol file="catalog">xmlCatalogFreeLocal</symbol>
-    <symbol file="catalog">xmlCatalogGetDefaults</symbol>
-    <symbol file="catalog">xmlCatalogGetPublic</symbol>
-    <symbol file="catalog">xmlCatalogGetSystem</symbol>
-    <symbol file="catalog">xmlCatalogIsEmpty</symbol>
-    <symbol file="catalog">xmlCatalogLocalResolve</symbol>
-    <symbol file="catalog">xmlCatalogLocalResolveURI</symbol>
-    <symbol file="catalog">xmlCatalogRemove</symbol>
-    <symbol file="catalog">xmlCatalogResolve</symbol>
-    <symbol file="catalog">xmlCatalogResolvePublic</symbol>
-    <symbol file="catalog">xmlCatalogResolveSystem</symbol>
-    <symbol file="catalog">xmlCatalogResolveURI</symbol>
-    <symbol file="catalog">xmlCatalogSetDebug</symbol>
-    <symbol file="catalog">xmlCatalogSetDefaultPrefer</symbol>
-    <symbol file="catalog">xmlCatalogSetDefaults</symbol>
-    <symbol file="catalog">xmlConvertSGMLCatalog</symbol>
-    <symbol file="catalog">xmlFreeCatalog</symbol>
-    <symbol file="catalog">xmlInitializeCatalog</symbol>
-    <symbol file="catalog">xmlLoadACatalog</symbol>
-    <symbol file="catalog">xmlLoadCatalog</symbol>
-    <symbol file="catalog">xmlLoadCatalogs</symbol>
-    <symbol file="catalog">xmlLoadSGMLSuperCatalog</symbol>
-    <symbol file="catalog">xmlNewCatalog</symbol>
-    <symbol file="catalog">xmlParseCatalogFile</symbol>
-    <symbol file="xpathInternals">valuePop</symbol>
-    <symbol file="xpathInternals">valuePush</symbol>
-    <symbol file="xpathInternals">xmlXPathAddValues</symbol>
-    <symbol file="xpathInternals">xmlXPathBooleanFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathCeilingFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathCompareValues</symbol>
-    <symbol file="xpathInternals">xmlXPathConcatFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathContainsFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathCountFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathDebugDumpCompExpr</symbol>
-    <symbol file="xpathInternals">xmlXPathDebugDumpObject</symbol>
-    <symbol file="xpathInternals">xmlXPathDifference</symbol>
-    <symbol file="xpathInternals">xmlXPathDistinct</symbol>
-    <symbol file="xpathInternals">xmlXPathDistinctSorted</symbol>
-    <symbol file="xpathInternals">xmlXPathDivValues</symbol>
-    <symbol file="xpathInternals">xmlXPathEqualValues</symbol>
-    <symbol file="xpathInternals">xmlXPathEvalExpr</symbol>
-    <symbol file="xpathInternals">xmlXPathEvaluatePredicateResult</symbol>
-    <symbol file="xpathInternals">xmlXPathFalseFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathFloorFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathFreeParserContext</symbol>
-    <symbol file="xpathInternals">xmlXPathFunctionLookup</symbol>
-    <symbol file="xpathInternals">xmlXPathFunctionLookupNS</symbol>
-    <symbol file="xpathInternals">xmlXPathHasSameNodes</symbol>
-    <symbol file="xpathInternals">xmlXPathIdFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathIntersection</symbol>
-    <symbol file="xpathInternals">xmlXPathIsNodeType</symbol>
-    <symbol file="xpathInternals">xmlXPathLangFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathLastFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathLeading</symbol>
-    <symbol file="xpathInternals">xmlXPathLeadingSorted</symbol>
-    <symbol file="xpathInternals">xmlXPathLocalNameFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathModValues</symbol>
-    <symbol file="xpathInternals">xmlXPathMultValues</symbol>
-    <symbol file="xpathInternals">xmlXPathNamespaceURIFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathNewBoolean</symbol>
-    <symbol file="xpathInternals">xmlXPathNewCString</symbol>
-    <symbol file="xpathInternals">xmlXPathNewFloat</symbol>
-    <symbol file="xpathInternals">xmlXPathNewNodeSet</symbol>
-    <symbol file="xpathInternals">xmlXPathNewNodeSetList</symbol>
-    <symbol file="xpathInternals">xmlXPathNewParserContext</symbol>
-    <symbol file="xpathInternals">xmlXPathNewString</symbol>
-    <symbol file="xpathInternals">xmlXPathNewValueTree</symbol>
-    <symbol file="xpathInternals">xmlXPathNextAncestor</symbol>
-    <symbol file="xpathInternals">xmlXPathNextAncestorOrSelf</symbol>
-    <symbol file="xpathInternals">xmlXPathNextAttribute</symbol>
-    <symbol file="xpathInternals">xmlXPathNextChild</symbol>
-    <symbol file="xpathInternals">xmlXPathNextDescendant</symbol>
-    <symbol file="xpathInternals">xmlXPathNextDescendantOrSelf</symbol>
-    <symbol file="xpathInternals">xmlXPathNextFollowing</symbol>
-    <symbol file="xpathInternals">xmlXPathNextFollowingSibling</symbol>
-    <symbol file="xpathInternals">xmlXPathNextNamespace</symbol>
-    <symbol file="xpathInternals">xmlXPathNextParent</symbol>
-    <symbol file="xpathInternals">xmlXPathNextPreceding</symbol>
-    <symbol file="xpathInternals">xmlXPathNextPrecedingSibling</symbol>
-    <symbol file="xpathInternals">xmlXPathNextSelf</symbol>
-    <symbol file="xpathInternals">xmlXPathNodeLeading</symbol>
-    <symbol file="xpathInternals">xmlXPathNodeLeadingSorted</symbol>
-    <symbol file="xpathInternals">xmlXPathNodeSetAdd</symbol>
-    <symbol file="xpathInternals">xmlXPathNodeSetAddNs</symbol>
-    <symbol file="xpathInternals">xmlXPathNodeSetAddUnique</symbol>
-    <symbol file="xpathInternals">xmlXPathNodeSetContains</symbol>
-    <symbol file="xpathInternals">xmlXPathNodeSetDel</symbol>
-    <symbol file="xpathInternals">xmlXPathNodeSetFreeNs</symbol>
-    <symbol file="xpathInternals">xmlXPathNodeSetMerge</symbol>
-    <symbol file="xpathInternals">xmlXPathNodeSetRemove</symbol>
-    <symbol file="xpathInternals">xmlXPathNodeSetSort</symbol>
-    <symbol file="xpathInternals">xmlXPathNodeTrailing</symbol>
-    <symbol file="xpathInternals">xmlXPathNodeTrailingSorted</symbol>
-    <symbol file="xpathInternals">xmlXPathNormalizeFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathNotEqualValues</symbol>
-    <symbol file="xpathInternals">xmlXPathNotFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathNsLookup</symbol>
-    <symbol file="xpathInternals">xmlXPathNumberFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathParseNCName</symbol>
-    <symbol file="xpathInternals">xmlXPathParseName</symbol>
-    <symbol file="xpathInternals">xmlXPathPopBoolean</symbol>
-    <symbol file="xpathInternals">xmlXPathPopExternal</symbol>
-    <symbol file="xpathInternals">xmlXPathPopNodeSet</symbol>
-    <symbol file="xpathInternals">xmlXPathPopNumber</symbol>
-    <symbol file="xpathInternals">xmlXPathPopString</symbol>
-    <symbol file="xpathInternals">xmlXPathPositionFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathRegisterAllFunctions</symbol>
-    <symbol file="xpathInternals">xmlXPathRegisterFunc</symbol>
-    <symbol file="xpathInternals">xmlXPathRegisterFuncLookup</symbol>
-    <symbol file="xpathInternals">xmlXPathRegisterFuncNS</symbol>
-    <symbol file="xpathInternals">xmlXPathRegisterNs</symbol>
-    <symbol file="xpathInternals">xmlXPathRegisterVariable</symbol>
-    <symbol file="xpathInternals">xmlXPathRegisterVariableLookup</symbol>
-    <symbol file="xpathInternals">xmlXPathRegisterVariableNS</symbol>
-    <symbol file="xpathInternals">xmlXPathRegisteredFuncsCleanup</symbol>
-    <symbol file="xpathInternals">xmlXPathRegisteredNsCleanup</symbol>
-    <symbol file="xpathInternals">xmlXPathRegisteredVariablesCleanup</symbol>
-    <symbol file="xpathInternals">xmlXPathRoot</symbol>
-    <symbol file="xpathInternals">xmlXPathRoundFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathStartsWithFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathStringEvalNumber</symbol>
-    <symbol file="xpathInternals">xmlXPathStringFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathStringLengthFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathSubValues</symbol>
-    <symbol file="xpathInternals">xmlXPathSubstringAfterFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathSubstringBeforeFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathSubstringFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathSumFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathTrailing</symbol>
-    <symbol file="xpathInternals">xmlXPathTrailingSorted</symbol>
-    <symbol file="xpathInternals">xmlXPathTranslateFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathTrueFunction</symbol>
-    <symbol file="xpathInternals">xmlXPathValueFlipSign</symbol>
-    <symbol file="xpathInternals">xmlXPathVariableLookup</symbol>
-    <symbol file="xpathInternals">xmlXPathVariableLookupNS</symbol>
-    <symbol file="xpathInternals">xmlXPathWrapCString</symbol>
-    <symbol file="xpathInternals">xmlXPathWrapExternal</symbol>
-    <symbol file="xpathInternals">xmlXPathWrapNodeSet</symbol>
-    <symbol file="xpathInternals">xmlXPathWrapString</symbol>
-    <symbol file="xpathInternals">xmlXPatherror</symbol>
-    <symbol file="xmlautomata">xmlAutomataCompile</symbol>
-    <symbol file="xmlautomata">xmlAutomataGetInitState</symbol>
-    <symbol file="xmlautomata">xmlAutomataIsDeterminist</symbol>
-    <symbol file="xmlautomata">xmlAutomataNewAllTrans</symbol>
-    <symbol file="xmlautomata">xmlAutomataNewCountTrans</symbol>
-    <symbol file="xmlautomata">xmlAutomataNewCountedTrans</symbol>
-    <symbol file="xmlautomata">xmlAutomataNewCounter</symbol>
-    <symbol file="xmlautomata">xmlAutomataNewCounterTrans</symbol>
-    <symbol file="xmlautomata">xmlAutomataNewEpsilon</symbol>
-    <symbol file="xmlautomata">xmlAutomataNewOnceTrans</symbol>
-    <symbol file="xmlautomata">xmlAutomataNewState</symbol>
-    <symbol file="xmlautomata">xmlAutomataNewTransition</symbol>
-    <symbol file="xmlautomata">xmlAutomataSetFinalState</symbol>
-    <symbol file="xmlautomata">xmlFreeAutomata</symbol>
-    <symbol file="xmlautomata">xmlNewAutomata</symbol>
-    <symbol file="HTMLtree">htmlDocContentDumpFormatOutput</symbol>
-    <symbol file="HTMLtree">htmlDocContentDumpOutput</symbol>
-    <symbol file="HTMLtree">htmlDocDump</symbol>
-    <symbol file="HTMLtree">htmlDocDumpMemory</symbol>
-    <symbol file="HTMLtree">htmlGetMetaEncoding</symbol>
-    <symbol file="HTMLtree">htmlIsBooleanAttr</symbol>
-    <symbol file="HTMLtree">htmlNewDoc</symbol>
-    <symbol file="HTMLtree">htmlNewDocNoDtD</symbol>
-    <symbol file="HTMLtree">htmlNodeDump</symbol>
-    <symbol file="HTMLtree">htmlNodeDumpFile</symbol>
-    <symbol file="HTMLtree">htmlNodeDumpFileFormat</symbol>
-    <symbol file="HTMLtree">htmlNodeDumpFormatOutput</symbol>
-    <symbol file="HTMLtree">htmlNodeDumpOutput</symbol>
-    <symbol file="HTMLtree">htmlSaveFile</symbol>
-    <symbol file="HTMLtree">htmlSaveFileEnc</symbol>
-    <symbol file="HTMLtree">htmlSaveFileFormat</symbol>
-    <symbol file="HTMLtree">htmlSetMetaEncoding</symbol>
-    <symbol file="nanoftp">xmlNanoFTPCheckResponse</symbol>
-    <symbol file="nanoftp">xmlNanoFTPCleanup</symbol>
-    <symbol file="nanoftp">xmlNanoFTPClose</symbol>
-    <symbol file="nanoftp">xmlNanoFTPCloseConnection</symbol>
-    <symbol file="nanoftp">xmlNanoFTPConnect</symbol>
-    <symbol file="nanoftp">xmlNanoFTPConnectTo</symbol>
-    <symbol file="nanoftp">xmlNanoFTPCwd</symbol>
-    <symbol file="nanoftp">xmlNanoFTPFreeCtxt</symbol>
-    <symbol file="nanoftp">xmlNanoFTPGet</symbol>
-    <symbol file="nanoftp">xmlNanoFTPGetConnection</symbol>
-    <symbol file="nanoftp">xmlNanoFTPGetResponse</symbol>
-    <symbol file="nanoftp">xmlNanoFTPGetSocket</symbol>
-    <symbol file="nanoftp">xmlNanoFTPInit</symbol>
-    <symbol file="nanoftp">xmlNanoFTPList</symbol>
-    <symbol file="nanoftp">xmlNanoFTPNewCtxt</symbol>
-    <symbol file="nanoftp">xmlNanoFTPOpen</symbol>
-    <symbol file="nanoftp">xmlNanoFTPProxy</symbol>
-    <symbol file="nanoftp">xmlNanoFTPQuit</symbol>
-    <symbol file="nanoftp">xmlNanoFTPRead</symbol>
-    <symbol file="nanoftp">xmlNanoFTPScanProxy</symbol>
-    <symbol file="nanoftp">xmlNanoFTPUpdateURL</symbol>
-    <symbol file="DOCBparser" removed="2.10.0">docbCreateFileParserCtxt</symbol>
-    <symbol file="DOCBparser" removed="2.10.0">docbCreatePushParserCtxt</symbol>
-    <symbol file="DOCBparser" removed="2.10.0">docbEncodeEntities</symbol>
-    <symbol file="DOCBparser" removed="2.10.0">docbFreeParserCtxt</symbol>
-    <symbol file="DOCBparser" removed="2.10.0">docbParseChunk</symbol>
-    <symbol file="DOCBparser" removed="2.10.0">docbParseDoc</symbol>
-    <symbol file="DOCBparser" removed="2.10.0">docbParseDocument</symbol>
-    <symbol file="DOCBparser" removed="2.10.0">docbParseFile</symbol>
-    <symbol file="DOCBparser" removed="2.10.0">docbSAXParseDoc</symbol>
-    <symbol file="DOCBparser" removed="2.10.0">docbSAXParseFile</symbol>
-    <symbol file="xpath">xmlXPathCastBooleanToNumber</symbol>
-    <symbol file="xpath">xmlXPathCastBooleanToString</symbol>
-    <symbol file="xpath">xmlXPathCastNodeSetToBoolean</symbol>
-    <symbol file="xpath">xmlXPathCastNodeSetToNumber</symbol>
-    <symbol file="xpath">xmlXPathCastNodeSetToString</symbol>
-    <symbol file="xpath">xmlXPathCastNodeToNumber</symbol>
-    <symbol file="xpath">xmlXPathCastNodeToString</symbol>
-    <symbol file="xpath">xmlXPathCastNumberToBoolean</symbol>
-    <symbol file="xpath">xmlXPathCastNumberToString</symbol>
-    <symbol file="xpath">xmlXPathCastStringToBoolean</symbol>
-    <symbol file="xpath">xmlXPathCastStringToNumber</symbol>
-    <symbol file="xpath">xmlXPathCastToBoolean</symbol>
-    <symbol file="xpath">xmlXPathCastToNumber</symbol>
-    <symbol file="xpath">xmlXPathCastToString</symbol>
-    <symbol file="xpath">xmlXPathCmpNodes</symbol>
-    <symbol file="xpath">xmlXPathCompile</symbol>
-    <symbol file="xpath">xmlXPathCompiledEval</symbol>
-    <symbol file="xpath">xmlXPathConvertBoolean</symbol>
-    <symbol file="xpath">xmlXPathConvertNumber</symbol>
-    <symbol file="xpath">xmlXPathConvertString</symbol>
-    <symbol file="xpath">xmlXPathEval</symbol>
-    <symbol file="xpath">xmlXPathEvalExpression</symbol>
-    <symbol file="xpath">xmlXPathEvalPredicate</symbol>
-    <symbol file="xpath">xmlXPathFreeCompExpr</symbol>
-    <symbol file="xpath">xmlXPathFreeContext</symbol>
-    <symbol file="xpath">xmlXPathFreeNodeSet</symbol>
-    <symbol file="xpath">xmlXPathFreeNodeSetList</symbol>
-    <symbol file="xpath">xmlXPathFreeObject</symbol>
-    <symbol file="xpath">xmlXPathInit</symbol>
-    <symbol file="xpath">xmlXPathIsInf</symbol>
-    <symbol file="xpath">xmlXPathIsNaN</symbol>
-    <symbol file="xpath">xmlXPathNAN</symbol>
-    <symbol file="xpath">xmlXPathNINF</symbol>
-    <symbol file="xpath">xmlXPathNewContext</symbol>
-    <symbol file="xpath">xmlXPathNodeSetCreate</symbol>
-    <symbol file="xpath">xmlXPathObjectCopy</symbol>
-    <symbol file="xpath">xmlXPathPINF</symbol>
-    <symbol file="xlink">xlinkGetDefaultDetect</symbol>
-    <symbol file="xlink">xlinkGetDefaultHandler</symbol>
-    <symbol file="xlink">xlinkIsLink</symbol>
-    <symbol file="xlink">xlinkSetDefaultDetect</symbol>
-    <symbol file="xlink">xlinkSetDefaultHandler</symbol>
-    <symbol file="entities">xmlAddDocEntity</symbol>
-    <symbol file="entities">xmlAddDtdEntity</symbol>
-    <symbol file="entities">xmlCleanupPredefinedEntities</symbol>
-    <symbol file="entities">xmlCopyEntitiesTable</symbol>
-    <symbol file="entities">xmlCreateEntitiesTable</symbol>
-    <symbol file="entities">xmlDumpEntitiesTable</symbol>
-    <symbol file="entities">xmlDumpEntityDecl</symbol>
-    <symbol file="entities">xmlEncodeEntities</symbol>
-    <symbol file="entities">xmlEncodeEntitiesReentrant</symbol>
-    <symbol file="entities">xmlEncodeSpecialChars</symbol>
-    <symbol file="entities">xmlFreeEntitiesTable</symbol>
-    <symbol file="entities">xmlGetDocEntity</symbol>
-    <symbol file="entities">xmlGetDtdEntity</symbol>
-    <symbol file="entities">xmlGetParameterEntity</symbol>
-    <symbol file="entities">xmlGetPredefinedEntity</symbol>
-    <symbol file="entities">xmlInitializePredefinedEntities</symbol>
-    <symbol file="xinclude">xmlXIncludeProcess</symbol>
-    <symbol file="list">xmlLinkGetData</symbol>
-    <symbol file="list">xmlListAppend</symbol>
-    <symbol file="list">xmlListClear</symbol>
-    <symbol file="list">xmlListCopy</symbol>
-    <symbol file="list">xmlListCreate</symbol>
-    <symbol file="list">xmlListDelete</symbol>
-    <symbol file="list">xmlListDup</symbol>
-    <symbol file="list">xmlListEmpty</symbol>
-    <symbol file="list">xmlListEnd</symbol>
-    <symbol file="list">xmlListFront</symbol>
-    <symbol file="list">xmlListInsert</symbol>
-    <symbol file="list">xmlListMerge</symbol>
-    <symbol file="list">xmlListPopBack</symbol>
-    <symbol file="list">xmlListPopFront</symbol>
-    <symbol file="list">xmlListPushBack</symbol>
-    <symbol file="list">xmlListPushFront</symbol>
-    <symbol file="list">xmlListRemoveAll</symbol>
-    <symbol file="list">xmlListRemoveFirst</symbol>
-    <symbol file="list">xmlListRemoveLast</symbol>
-    <symbol file="list">xmlListReverse</symbol>
-    <symbol file="list">xmlListReverseSearch</symbol>
-    <symbol file="list">xmlListReverseWalk</symbol>
-    <symbol file="list">xmlListSearch</symbol>
-    <symbol file="list">xmlListSize</symbol>
-    <symbol file="list">xmlListSort</symbol>
-    <symbol file="list">xmlListWalk</symbol>
-    <symbol file="xmlmemory">xmlInitMemory</symbol>
-    <symbol file="xmlmemory">xmlMallocLoc</symbol>
-    <symbol file="xmlmemory">xmlMemDisplay</symbol>
-    <symbol file="xmlmemory">xmlMemFree</symbol>
-    <symbol file="xmlmemory">xmlMemGet</symbol>
-    <symbol file="xmlmemory">xmlMemMalloc</symbol>
-    <symbol file="xmlmemory">xmlMemRealloc</symbol>
-    <symbol file="xmlmemory">xmlMemSetup</symbol>
-    <symbol file="xmlmemory">xmlMemShow</symbol>
-    <symbol file="xmlmemory">xmlMemStrdupLoc</symbol>
-    <symbol file="xmlmemory">xmlMemUsed</symbol>
-    <symbol file="xmlmemory">xmlMemoryDump</symbol>
-    <symbol file="xmlmemory">xmlMemoryStrdup</symbol>
-    <symbol file="xmlmemory">xmlReallocLoc</symbol>
-    <symbol file="xmlIO">xmlAllocOutputBuffer</symbol>
-    <symbol file="xmlIO">xmlAllocParserInputBuffer</symbol>
-    <symbol file="xmlIO">xmlCheckFilename</symbol>
-    <symbol file="xmlIO">xmlCleanupInputCallbacks</symbol>
-    <symbol file="xmlIO">xmlCleanupOutputCallbacks</symbol>
-    <symbol file="xmlIO">xmlFileClose</symbol>
-    <symbol file="xmlIO">xmlFileMatch</symbol>
-    <symbol file="xmlIO">xmlFileOpen</symbol>
-    <symbol file="xmlIO">xmlFileRead</symbol>
-    <symbol file="xmlIO">xmlFreeParserInputBuffer</symbol>
-    <symbol file="xmlIO">xmlIOFTPClose</symbol>
-    <symbol file="xmlIO">xmlIOFTPMatch</symbol>
-    <symbol file="xmlIO">xmlIOFTPOpen</symbol>
-    <symbol file="xmlIO">xmlIOFTPRead</symbol>
-    <symbol file="xmlIO">xmlIOHTTPClose</symbol>
-    <symbol file="xmlIO">xmlIOHTTPMatch</symbol>
-    <symbol file="xmlIO">xmlIOHTTPOpen</symbol>
-    <symbol file="xmlIO">xmlIOHTTPOpenW</symbol>
-    <symbol file="xmlIO">xmlIOHTTPRead</symbol>
-    <symbol file="xmlIO">xmlNoNetExternalEntityLoader</symbol>
-    <symbol file="xmlIO">xmlNormalizeWindowsPath</symbol>
-    <symbol file="xmlIO">xmlOutputBufferClose</symbol>
-    <symbol file="xmlIO">xmlOutputBufferCreateFd</symbol>
-    <symbol file="xmlIO">xmlOutputBufferCreateFile</symbol>
-    <symbol file="xmlIO">xmlOutputBufferCreateFilename</symbol>
-    <symbol file="xmlIO">xmlOutputBufferCreateIO</symbol>
-    <symbol file="xmlIO">xmlOutputBufferFlush</symbol>
-    <symbol file="xmlIO">xmlOutputBufferWrite</symbol>
-    <symbol file="xmlIO">xmlOutputBufferWriteString</symbol>
-    <symbol file="xmlIO">xmlParserGetDirectory</symbol>
-    <symbol file="xmlIO">xmlParserInputBufferCreateFd</symbol>
-    <symbol file="xmlIO">xmlParserInputBufferCreateFile</symbol>
-    <symbol file="xmlIO">xmlParserInputBufferCreateFilename</symbol>
-    <symbol file="xmlIO">xmlParserInputBufferCreateIO</symbol>
-    <symbol file="xmlIO">xmlParserInputBufferCreateMem</symbol>
-    <symbol file="xmlIO">xmlParserInputBufferGrow</symbol>
-    <symbol file="xmlIO">xmlParserInputBufferPush</symbol>
-    <symbol file="xmlIO">xmlParserInputBufferRead</symbol>
-    <symbol file="xmlIO">xmlRegisterDefaultInputCallbacks</symbol>
-    <symbol file="xmlIO">xmlRegisterDefaultOutputCallbacks</symbol>
-    <symbol file="xmlIO">xmlRegisterHTTPPostCallbacks</symbol>
-    <symbol file="xmlIO">xmlRegisterInputCallbacks</symbol>
-    <symbol file="xmlIO">xmlRegisterOutputCallbacks</symbol>
-    <symbol file="xmlversion">xmlCheckVersion</symbol>
-    <symbol file="valid">xmlAddAttributeDecl</symbol>
-    <symbol file="valid">xmlAddElementDecl</symbol>
-    <symbol file="valid">xmlAddID</symbol>
-    <symbol file="valid">xmlAddNotationDecl</symbol>
-    <symbol file="valid">xmlAddRef</symbol>
-    <symbol file="valid">xmlCopyAttributeTable</symbol>
-    <symbol file="valid">xmlCopyElementContent</symbol>
-    <symbol file="valid">xmlCopyElementTable</symbol>
-    <symbol file="valid">xmlCopyEnumeration</symbol>
-    <symbol file="valid">xmlCopyNotationTable</symbol>
-    <symbol file="valid">xmlCreateEnumeration</symbol>
-    <symbol file="valid">xmlDumpAttributeDecl</symbol>
-    <symbol file="valid">xmlDumpAttributeTable</symbol>
-    <symbol file="valid">xmlDumpElementDecl</symbol>
-    <symbol file="valid">xmlDumpElementTable</symbol>
-    <symbol file="valid">xmlDumpNotationDecl</symbol>
-    <symbol file="valid">xmlDumpNotationTable</symbol>
-    <symbol file="valid">xmlFreeAttributeTable</symbol>
-    <symbol file="valid">xmlFreeElementContent</symbol>
-    <symbol file="valid">xmlFreeElementTable</symbol>
-    <symbol file="valid">xmlFreeEnumeration</symbol>
-    <symbol file="valid">xmlFreeIDTable</symbol>
-    <symbol file="valid">xmlFreeNotationTable</symbol>
-    <symbol file="valid">xmlFreeRefTable</symbol>
-    <symbol file="valid">xmlGetDtdAttrDesc</symbol>
-    <symbol file="valid">xmlGetDtdElementDesc</symbol>
-    <symbol file="valid">xmlGetDtdNotationDesc</symbol>
-    <symbol file="valid">xmlGetDtdQAttrDesc</symbol>
-    <symbol file="valid">xmlGetDtdQElementDesc</symbol>
-    <symbol file="valid">xmlGetID</symbol>
-    <symbol file="valid">xmlGetRefs</symbol>
-    <symbol file="valid">xmlIsID</symbol>
-    <symbol file="valid">xmlIsMixedElement</symbol>
-    <symbol file="valid">xmlIsRef</symbol>
-    <symbol file="valid">xmlNewElementContent</symbol>
-    <symbol file="valid">xmlRemoveID</symbol>
-    <symbol file="valid">xmlRemoveRef</symbol>
-    <symbol file="valid">xmlSnprintfElementContent</symbol>
-    <symbol file="tree">xmlSplitQName2</symbol>
-    <symbol file="valid">xmlSprintfElementContent</symbol>
-    <symbol file="valid">xmlValidBuildContentModel</symbol>
-    <symbol file="valid">xmlValidCtxtNormalizeAttributeValue</symbol>
-    <symbol file="valid">xmlValidGetPotentialChildren</symbol>
-    <symbol file="valid">xmlValidGetValidElements</symbol>
-    <symbol file="valid">xmlValidNormalizeAttributeValue</symbol>
-    <symbol file="valid">xmlValidateAttributeDecl</symbol>
-    <symbol file="valid">xmlValidateAttributeValue</symbol>
-    <symbol file="valid">xmlValidateDocument</symbol>
-    <symbol file="valid">xmlValidateDocumentFinal</symbol>
-    <symbol file="valid">xmlValidateDtd</symbol>
-    <symbol file="valid">xmlValidateDtdFinal</symbol>
-    <symbol file="valid">xmlValidateElement</symbol>
-    <symbol file="valid">xmlValidateElementDecl</symbol>
-    <symbol file="valid">xmlValidateNameValue</symbol>
-    <symbol file="valid">xmlValidateNamesValue</symbol>
-    <symbol file="valid">xmlValidateNmtokenValue</symbol>
-    <symbol file="valid">xmlValidateNmtokensValue</symbol>
-    <symbol file="valid">xmlValidateNotationDecl</symbol>
-    <symbol file="valid">xmlValidateNotationUse</symbol>
-    <symbol file="valid">xmlValidateOneAttribute</symbol>
-    <symbol file="valid">xmlValidateOneElement</symbol>
-    <symbol file="valid">xmlValidateOneNamespace</symbol>
-    <symbol file="valid">xmlValidateRoot</symbol>
-    <symbol file="HTMLparser">UTF8ToHtml</symbol>
-    <symbol file="HTMLparser">htmlAutoCloseTag</symbol>
-    <symbol file="HTMLparser">htmlCreatePushParserCtxt</symbol>
-    <symbol file="HTMLparser">htmlEncodeEntities</symbol>
-    <symbol file="HTMLparser">htmlEntityLookup</symbol>
-    <symbol file="HTMLparser">htmlEntityValueLookup</symbol>
-    <symbol file="HTMLparser">htmlFreeParserCtxt</symbol>
-    <symbol file="HTMLparser">htmlHandleOmittedElem</symbol>
-    <symbol file="HTMLparser">htmlIsAutoClosed</symbol>
-    <symbol file="HTMLparser">htmlIsScriptAttribute</symbol>
-    <symbol file="HTMLparser">htmlParseCharRef</symbol>
-    <symbol file="HTMLparser">htmlParseChunk</symbol>
-    <symbol file="HTMLparser">htmlParseDoc</symbol>
-    <symbol file="HTMLparser">htmlParseDocument</symbol>
-    <symbol file="HTMLparser">htmlParseElement</symbol>
-    <symbol file="HTMLparser">htmlParseEntityRef</symbol>
-    <symbol file="HTMLparser">htmlParseFile</symbol>
-    <symbol file="HTMLparser">htmlSAXParseDoc</symbol>
-    <symbol file="HTMLparser">htmlSAXParseFile</symbol>
-    <symbol file="HTMLparser">htmlTagLookup</symbol>
-    <symbol file="xmlstring">xmlCharStrdup</symbol>
-    <symbol file="xmlstring">xmlCharStrndup</symbol>
-    <symbol file="parser">xmlCleanupParser</symbol>
-    <symbol file="parser">xmlClearNodeInfoSeq</symbol>
-    <symbol file="parser">xmlClearParserCtxt</symbol>
-    <symbol file="parser">xmlCreateDocParserCtxt</symbol>
-    <symbol file="parser">xmlCreateIOParserCtxt</symbol>
-    <symbol file="parser">xmlCreatePushParserCtxt</symbol>
-    <symbol file="parser">xmlFreeParserCtxt</symbol>
-    <symbol file="parser">xmlGetExternalEntityLoader</symbol>
-    <symbol file="parser">xmlGetFeature</symbol>
-    <symbol file="parser">xmlGetFeaturesList</symbol>
-    <symbol file="globals">xmlGetWarningsDefaultValue</symbol>
-    <symbol file="parser">xmlIOParseDTD</symbol>
-    <symbol file="parser">xmlInitNodeInfoSeq</symbol>
-    <symbol file="parser">xmlInitParser</symbol>
-    <symbol file="parser">xmlInitParserCtxt</symbol>
-    <symbol file="parser">xmlKeepBlanksDefault</symbol>
-    <symbol file="parser">xmlLineNumbersDefault</symbol>
-    <symbol file="parser">xmlLoadExternalEntity</symbol>
-    <symbol file="parser">xmlNewIOInputStream</symbol>
-    <symbol file="parser">xmlParseBalancedChunkMemory</symbol>
-    <symbol file="parser">xmlParseBalancedChunkMemoryRecover</symbol>
-    <symbol file="parser">xmlParseChunk</symbol>
-    <symbol file="parser">xmlParseCtxtExternalEntity</symbol>
-    <symbol file="parser">xmlParseDTD</symbol>
-    <symbol file="parser">xmlParseDoc</symbol>
-    <symbol file="parser">xmlParseDocument</symbol>
-    <symbol file="parser">xmlParseEntity</symbol>
-    <symbol file="parser">xmlParseExtParsedEnt</symbol>
-    <symbol file="parser">xmlParseExternalEntity</symbol>
-    <symbol file="parser">xmlParseFile</symbol>
-    <symbol file="parser">xmlParseMemory</symbol>
-    <symbol file="parser">xmlParserAddNodeInfo</symbol>
-    <symbol file="parser">xmlParserFindNodeInfo</symbol>
-    <symbol file="parser">xmlParserFindNodeInfoIndex</symbol>
-    <symbol file="parser">xmlParserInputGrow</symbol>
-    <symbol file="parser">xmlParserInputRead</symbol>
-    <symbol file="parser">xmlPedanticParserDefault</symbol>
-    <symbol file="parser">xmlRecoverDoc</symbol>
-    <symbol file="parser">xmlRecoverFile</symbol>
-    <symbol file="parser">xmlRecoverMemory</symbol>
-    <symbol file="parser">xmlSAXParseDTD</symbol>
-    <symbol file="parser">xmlSAXParseDoc</symbol>
-    <symbol file="parser">xmlSAXParseEntity</symbol>
-    <symbol file="parser">xmlSAXParseFile</symbol>
-    <symbol file="parser">xmlSAXParseFileWithData</symbol>
-    <symbol file="parser">xmlSAXParseMemory</symbol>
-    <symbol file="parser">xmlSAXParseMemoryWithData</symbol>
-    <symbol file="parser">xmlSAXUserParseFile</symbol>
-    <symbol file="parser">xmlSAXUserParseMemory</symbol>
-    <symbol file="parser">xmlSetExternalEntityLoader</symbol>
-    <symbol file="parser">xmlSetFeature</symbol>
-    <symbol file="parser">xmlSetupParserForBuffer</symbol>
-    <symbol file="parser">xmlStopParser</symbol>
-    <symbol file="xmlstring">xmlStrEqual</symbol>
-    <symbol file="xmlstring">xmlStrcasecmp</symbol>
-    <symbol file="xmlstring">xmlStrcasestr</symbol>
-    <symbol file="xmlstring">xmlStrcat</symbol>
-    <symbol file="xmlstring">xmlStrchr</symbol>
-    <symbol file="xmlstring">xmlStrcmp</symbol>
-    <symbol file="xmlstring">xmlStrdup</symbol>
-    <symbol file="xmlstring">xmlStrlen</symbol>
-    <symbol file="xmlstring">xmlStrncasecmp</symbol>
-    <symbol file="xmlstring">xmlStrncat</symbol>
-    <symbol file="xmlstring">xmlStrncmp</symbol>
-    <symbol file="xmlstring">xmlStrndup</symbol>
-    <symbol file="xmlstring">xmlStrstr</symbol>
-    <symbol file="xmlstring">xmlStrsub</symbol>
-    <symbol file="parser">xmlSubstituteEntitiesDefault</symbol>
-    <symbol file="xmlreader">xmlFreeTextReader</symbol>
-    <symbol file="xmlreader">xmlNewTextReader</symbol>
-    <symbol file="xmlreader">xmlNewTextReaderFilename</symbol>
-    <symbol file="xmlreader">xmlTextReaderAttributeCount</symbol>
-    <symbol file="xmlreader">xmlTextReaderBaseUri</symbol>
-    <symbol file="xmlreader">xmlTextReaderDepth</symbol>
-    <symbol file="xmlreader">xmlTextReaderHasAttributes</symbol>
-    <symbol file="xmlreader">xmlTextReaderHasValue</symbol>
-    <symbol file="xmlreader">xmlTextReaderIsDefault</symbol>
-    <symbol file="xmlreader">xmlTextReaderIsEmptyElement</symbol>
-    <symbol file="xmlreader">xmlTextReaderLocalName</symbol>
-    <symbol file="xmlreader">xmlTextReaderName</symbol>
-    <symbol file="xmlreader">xmlTextReaderNamespaceUri</symbol>
-    <symbol file="xmlreader">xmlTextReaderNodeType</symbol>
-    <symbol file="xmlreader">xmlTextReaderPrefix</symbol>
-    <symbol file="xmlreader">xmlTextReaderQuoteChar</symbol>
-    <symbol file="xmlreader">xmlTextReaderRead</symbol>
-    <symbol file="xmlreader">xmlTextReaderValue</symbol>
-    <symbol file="xmlreader">xmlTextReaderXmlLang</symbol>
-    <symbol file="globals" removed="2.10.0">docbDefaultSAXHandler</symbol>
-    <symbol file="globals">htmlDefaultSAXHandler</symbol>
-    <symbol file="globals">xmlDefaultSAXHandler</symbol>
-    <symbol file="globals">xmlDefaultSAXLocator</symbol>
-    <symbol file="globals">xmlDoValidityCheckingDefaultValue</symbol>
-    <symbol file="globals">xmlFree</symbol>
-    <symbol file="globals">xmlGenericError</symbol>
-    <symbol file="globals">xmlGenericErrorContext</symbol>
-    <symbol file="globals">xmlInitializeGlobalState</symbol>
-    <symbol file="globals">xmlKeepBlanksDefaultValue</symbol>
-    <symbol file="globals">xmlLineNumbersDefaultValue</symbol>
-    <symbol file="globals">xmlLoadExtDtdDefaultValue</symbol>
-    <symbol file="globals">xmlMalloc</symbol>
-    <symbol file="globals">xmlMemStrdup</symbol>
-    <symbol file="globals">xmlParserDebugEntities</symbol>
-    <symbol file="globals">xmlParserVersion</symbol>
-    <symbol file="globals">xmlPedanticParserDefaultValue</symbol>
-    <symbol file="globals">xmlRealloc</symbol>
-    <symbol file="globals">xmlSaveNoEmptyTags</symbol>
-    <symbol file="globals">xmlSubstituteEntitiesDefaultValue</symbol>
-    <symbol file="globals">xmlTreeIndentString</symbol>
-    <symbol file="threads">xmlCleanupThreads</symbol>
-    <symbol file="threads">xmlFreeMutex</symbol>
-    <symbol file="threads">xmlFreeRMutex</symbol>
-    <symbol file="threads">xmlGetGlobalState</symbol>
-    <symbol file="threads">xmlGetThreadId</symbol>
-    <symbol file="threads">xmlInitThreads</symbol>
-    <symbol file="threads">xmlIsMainThread</symbol>
-    <symbol file="threads">xmlLockLibrary</symbol>
-    <symbol file="threads">xmlMutexLock</symbol>
-    <symbol file="threads">xmlMutexUnlock</symbol>
-    <symbol file="threads">xmlNewMutex</symbol>
-    <symbol file="threads">xmlNewRMutex</symbol>
-    <symbol file="threads">xmlRMutexLock</symbol>
-    <symbol file="threads">xmlRMutexUnlock</symbol>
-    <symbol file="threads">xmlUnlockLibrary</symbol>
-    <symbol file="hash">xmlHashAddEntry</symbol>
-    <symbol file="hash">xmlHashAddEntry2</symbol>
-    <symbol file="hash">xmlHashAddEntry3</symbol>
-    <symbol file="hash">xmlHashCopy</symbol>
-    <symbol file="hash">xmlHashCreate</symbol>
-    <symbol file="hash">xmlHashFree</symbol>
-    <symbol file="hash">xmlHashLookup</symbol>
-    <symbol file="hash">xmlHashLookup2</symbol>
-    <symbol file="hash">xmlHashLookup3</symbol>
-    <symbol file="hash">xmlHashRemoveEntry</symbol>
-    <symbol file="hash">xmlHashRemoveEntry2</symbol>
-    <symbol file="hash">xmlHashRemoveEntry3</symbol>
-    <symbol file="hash">xmlHashScan</symbol>
-    <symbol file="hash">xmlHashScan3</symbol>
-    <symbol file="hash">xmlHashScanFull</symbol>
-    <symbol file="hash">xmlHashScanFull3</symbol>
-    <symbol file="hash">xmlHashSize</symbol>
-    <symbol file="hash">xmlHashUpdateEntry</symbol>
-    <symbol file="hash">xmlHashUpdateEntry2</symbol>
-    <symbol file="hash">xmlHashUpdateEntry3</symbol>
-    <symbol file="xmlerror">initGenericErrorDefaultFunc</symbol>
-    <symbol file="xmlerror">xmlParserError</symbol>
-    <symbol file="xmlerror">xmlParserPrintFileContext</symbol>
-    <symbol file="xmlerror">xmlParserPrintFileInfo</symbol>
-    <symbol file="xmlerror">xmlParserValidityError</symbol>
-    <symbol file="xmlerror">xmlParserValidityWarning</symbol>
-    <symbol file="xmlerror">xmlParserWarning</symbol>
-    <symbol file="xmlerror">xmlSetGenericErrorFunc</symbol>
-    <symbol file="globals">oldXMLWDcompatibility</symbol>
-    <symbol file="tree">xmlAddChild</symbol>
-    <symbol file="tree">xmlAddChildList</symbol>
-    <symbol file="tree">xmlAddNextSibling</symbol>
-    <symbol file="tree">xmlAddPrevSibling</symbol>
-    <symbol file="tree">xmlAddSibling</symbol>
-    <symbol file="tree">xmlBufferAdd</symbol>
-    <symbol file="tree">xmlBufferAddHead</symbol>
-    <symbol file="globals">xmlBufferAllocScheme</symbol>
-    <symbol file="tree">xmlBufferCCat</symbol>
-    <symbol file="tree">xmlBufferCat</symbol>
-    <symbol file="tree">xmlBufferContent</symbol>
-    <symbol file="tree">xmlBufferCreate</symbol>
-    <symbol file="tree">xmlBufferCreateSize</symbol>
-    <symbol file="tree">xmlBufferDump</symbol>
-    <symbol file="tree">xmlBufferEmpty</symbol>
-    <symbol file="tree">xmlBufferFree</symbol>
-    <symbol file="tree">xmlBufferGrow</symbol>
-    <symbol file="tree">xmlBufferLength</symbol>
-    <symbol file="tree">xmlBufferResize</symbol>
-    <symbol file="tree">xmlBufferSetAllocationScheme</symbol>
-    <symbol file="tree">xmlBufferShrink</symbol>
-    <symbol file="tree">xmlBufferWriteCHAR</symbol>
-    <symbol file="tree">xmlBufferWriteChar</symbol>
-    <symbol file="tree">xmlBufferWriteQuotedString</symbol>
-    <symbol file="tree">xmlCopyDoc</symbol>
-    <symbol file="tree">xmlCopyDtd</symbol>
-    <symbol file="tree">xmlCopyNamespace</symbol>
-    <symbol file="tree">xmlCopyNamespaceList</symbol>
-    <symbol file="tree">xmlCopyNode</symbol>
-    <symbol file="tree">xmlCopyNodeList</symbol>
-    <symbol file="tree">xmlCopyProp</symbol>
-    <symbol file="tree">xmlCopyPropList</symbol>
-    <symbol file="tree">xmlCreateIntSubset</symbol>
-    <symbol file="globals">xmlDefaultBufferSize</symbol>
-    <symbol file="tree">xmlDocCopyNode</symbol>
-    <symbol file="tree">xmlDocDump</symbol>
-    <symbol file="tree">xmlDocDumpFormatMemory</symbol>
-    <symbol file="tree">xmlDocDumpFormatMemoryEnc</symbol>
-    <symbol file="tree">xmlDocDumpMemory</symbol>
-    <symbol file="tree">xmlDocDumpMemoryEnc</symbol>
-    <symbol file="tree">xmlDocFormatDump</symbol>
-    <symbol file="tree">xmlDocGetRootElement</symbol>
-    <symbol file="tree">xmlDocSetRootElement</symbol>
-    <symbol file="tree">xmlElemDump</symbol>
-    <symbol file="tree">xmlFreeDoc</symbol>
-    <symbol file="tree">xmlFreeDtd</symbol>
-    <symbol file="tree">xmlFreeNode</symbol>
-    <symbol file="tree">xmlFreeNodeList</symbol>
-    <symbol file="tree">xmlFreeNs</symbol>
-    <symbol file="tree">xmlFreeNsList</symbol>
-    <symbol file="tree">xmlFreeProp</symbol>
-    <symbol file="tree">xmlFreePropList</symbol>
-    <symbol file="tree">xmlGetBufferAllocationScheme</symbol>
-    <symbol file="tree">xmlGetCompressMode</symbol>
-    <symbol file="tree">xmlGetDocCompressMode</symbol>
-    <symbol file="tree">xmlGetIntSubset</symbol>
-    <symbol file="tree">xmlGetLastChild</symbol>
-    <symbol file="tree">xmlGetLineNo</symbol>
-    <symbol file="tree">xmlGetNodePath</symbol>
-    <symbol file="tree">xmlGetNsList</symbol>
-    <symbol file="tree">xmlGetNsProp</symbol>
-    <symbol file="tree">xmlGetProp</symbol>
-    <symbol file="tree">xmlHasNsProp</symbol>
-    <symbol file="tree">xmlHasProp</symbol>
-    <symbol file="globals">xmlIndentTreeOutput</symbol>
-    <symbol file="tree">xmlIsBlankNode</symbol>
-    <symbol file="tree">xmlIsXHTML</symbol>
-    <symbol file="tree">xmlNewCDataBlock</symbol>
-    <symbol file="tree">xmlNewCharRef</symbol>
-    <symbol file="tree">xmlNewChild</symbol>
-    <symbol file="tree">xmlNewComment</symbol>
-    <symbol file="tree">xmlNewDoc</symbol>
-    <symbol file="tree">xmlNewDocComment</symbol>
-    <symbol file="tree">xmlNewDocFragment</symbol>
-    <symbol file="tree">xmlNewDocNode</symbol>
-    <symbol file="tree">xmlNewDocNodeEatName</symbol>
-    <symbol file="tree">xmlNewDocProp</symbol>
-    <symbol file="tree">xmlNewDocRawNode</symbol>
-    <symbol file="tree">xmlNewDocText</symbol>
-    <symbol file="tree">xmlNewDocTextLen</symbol>
-    <symbol file="tree">xmlNewDtd</symbol>
-    <symbol file="tree">xmlNewGlobalNs</symbol>
-    <symbol file="tree">xmlNewNode</symbol>
-    <symbol file="tree">xmlNewNodeEatName</symbol>
-    <symbol file="tree">xmlNewNs</symbol>
-    <symbol file="tree">xmlNewNsProp</symbol>
-    <symbol file="tree">xmlNewNsPropEatName</symbol>
-    <symbol file="tree">xmlNewPI</symbol>
-    <symbol file="tree">xmlNewProp</symbol>
-    <symbol file="tree">xmlNewReference</symbol>
-    <symbol file="tree">xmlNewText</symbol>
-    <symbol file="tree">xmlNewTextChild</symbol>
-    <symbol file="tree">xmlNewTextLen</symbol>
-    <symbol file="tree">xmlNodeAddContent</symbol>
-    <symbol file="tree">xmlNodeAddContentLen</symbol>
-    <symbol file="tree">xmlNodeDump</symbol>
-    <symbol file="tree">xmlNodeDumpOutput</symbol>
-    <symbol file="tree">xmlNodeGetBase</symbol>
-    <symbol file="tree">xmlNodeGetContent</symbol>
-    <symbol file="tree">xmlNodeGetLang</symbol>
-    <symbol file="tree">xmlNodeGetSpacePreserve</symbol>
-    <symbol file="tree">xmlNodeIsText</symbol>
-    <symbol file="tree">xmlNodeListGetRawString</symbol>
-    <symbol file="tree">xmlNodeListGetString</symbol>
-    <symbol file="tree">xmlNodeSetBase</symbol>
-    <symbol file="tree">xmlNodeSetContent</symbol>
-    <symbol file="tree">xmlNodeSetContentLen</symbol>
-    <symbol file="tree">xmlNodeSetLang</symbol>
-    <symbol file="tree">xmlNodeSetName</symbol>
-    <symbol file="tree">xmlNodeSetSpacePreserve</symbol>
-    <symbol file="tree">xmlReconciliateNs</symbol>
-    <symbol file="tree">xmlRemoveProp</symbol>
-    <symbol file="tree">xmlReplaceNode</symbol>
-    <symbol file="tree">xmlSaveFile</symbol>
-    <symbol file="tree">xmlSaveFileEnc</symbol>
-    <symbol file="tree">xmlSaveFileTo</symbol>
-    <symbol file="tree">xmlSaveFormatFile</symbol>
-    <symbol file="tree">xmlSaveFormatFileEnc</symbol>
-    <symbol file="tree">xmlSaveFormatFileTo</symbol>
-    <symbol file="tree">xmlSearchNs</symbol>
-    <symbol file="tree">xmlSearchNsByHref</symbol>
-    <symbol file="tree">xmlSetBufferAllocationScheme</symbol>
-    <symbol file="tree">xmlSetCompressMode</symbol>
-    <symbol file="tree">xmlSetDocCompressMode</symbol>
-    <symbol file="tree">xmlSetListDoc</symbol>
-    <symbol file="tree">xmlSetNs</symbol>
-    <symbol file="tree">xmlSetNsProp</symbol>
-    <symbol file="tree">xmlSetProp</symbol>
-    <symbol file="tree">xmlSetTreeDoc</symbol>
-    <symbol file="tree">xmlStringGetNodeList</symbol>
-    <symbol file="tree">xmlStringLenGetNodeList</symbol>
-    <symbol file="tree">xmlTextConcat</symbol>
-    <symbol file="tree">xmlTextMerge</symbol>
-    <symbol file="tree">xmlUnlinkNode</symbol>
-    <symbol file="tree">xmlUnsetNsProp</symbol>
-    <symbol file="tree">xmlUnsetProp</symbol>
-    <symbol file="xmlregexp">xmlRegExecPushString</symbol>
-    <symbol file="xmlregexp">xmlRegFreeExecCtxt</symbol>
-    <symbol file="xmlregexp">xmlRegFreeRegexp</symbol>
-    <symbol file="xmlregexp">xmlRegNewExecCtxt</symbol>
-    <symbol file="xmlregexp">xmlRegexpCompile</symbol>
-    <symbol file="xmlregexp">xmlRegexpExec</symbol>
-    <symbol file="xmlregexp">xmlRegexpIsDeterminist</symbol>
-    <symbol file="xmlregexp">xmlRegexpPrint</symbol>
-    <symbol file="nanohttp">xmlNanoHTTPAuthHeader</symbol>
-    <symbol file="nanohttp">xmlNanoHTTPCleanup</symbol>
-    <symbol file="nanohttp">xmlNanoHTTPClose</symbol>
-    <symbol file="nanohttp">xmlNanoHTTPFetch</symbol>
-    <symbol file="nanohttp">xmlNanoHTTPInit</symbol>
-    <symbol file="nanohttp">xmlNanoHTTPMethod</symbol>
-    <symbol file="nanohttp">xmlNanoHTTPMethodRedir</symbol>
-    <symbol file="nanohttp">xmlNanoHTTPOpen</symbol>
-    <symbol file="nanohttp">xmlNanoHTTPOpenRedir</symbol>
-    <symbol file="nanohttp">xmlNanoHTTPRead</symbol>
-    <symbol file="nanohttp">xmlNanoHTTPReturnCode</symbol>
-    <symbol file="nanohttp">xmlNanoHTTPSave</symbol>
-    <symbol file="nanohttp">xmlNanoHTTPScanProxy</symbol>
-    <symbol file="xmlunicode">xmlUCSIsAlphabeticPresentationForms</symbol>
-    <symbol file="xmlunicode">xmlUCSIsArabic</symbol>
-    <symbol file="xmlunicode">xmlUCSIsArabicPresentationFormsA</symbol>
-    <symbol file="xmlunicode">xmlUCSIsArabicPresentationFormsB</symbol>
-    <symbol file="xmlunicode">xmlUCSIsArmenian</symbol>
-    <symbol file="xmlunicode">xmlUCSIsArrows</symbol>
-    <symbol file="xmlunicode">xmlUCSIsBasicLatin</symbol>
-    <symbol file="xmlunicode">xmlUCSIsBengali</symbol>
-    <symbol file="xmlunicode">xmlUCSIsBlock</symbol>
-    <symbol file="xmlunicode">xmlUCSIsBlockElements</symbol>
-    <symbol file="xmlunicode">xmlUCSIsBopomofo</symbol>
-    <symbol file="xmlunicode">xmlUCSIsBopomofoExtended</symbol>
-    <symbol file="xmlunicode">xmlUCSIsBoxDrawing</symbol>
-    <symbol file="xmlunicode">xmlUCSIsBraillePatterns</symbol>
-    <symbol file="xmlunicode">xmlUCSIsByzantineMusicalSymbols</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCJKCompatibility</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCJKCompatibilityForms</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCJKCompatibilityIdeographs</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCJKCompatibilityIdeographsSupplement</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCJKRadicalsSupplement</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCJKSymbolsandPunctuation</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCJKUnifiedIdeographs</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCJKUnifiedIdeographsExtensionA</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCJKUnifiedIdeographsExtensionB</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCat</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatC</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatCc</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatCf</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatCo</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatCs</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatL</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatLl</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatLm</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatLo</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatLt</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatLu</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatM</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatMc</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatMe</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatMn</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatN</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatNd</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatNl</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatNo</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatP</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatPc</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatPd</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatPe</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatPf</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatPi</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatPo</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatPs</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatS</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatSc</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatSk</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatSm</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatSo</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatZ</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatZl</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatZp</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCatZs</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCherokee</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCombiningDiacriticalMarks</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCombiningHalfMarks</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCombiningMarksforSymbols</symbol>
-    <symbol file="xmlunicode">xmlUCSIsControlPictures</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCurrencySymbols</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCyrillic</symbol>
-    <symbol file="xmlunicode">xmlUCSIsDeseret</symbol>
-    <symbol file="xmlunicode">xmlUCSIsDevanagari</symbol>
-    <symbol file="xmlunicode">xmlUCSIsDingbats</symbol>
-    <symbol file="xmlunicode">xmlUCSIsEnclosedAlphanumerics</symbol>
-    <symbol file="xmlunicode">xmlUCSIsEnclosedCJKLettersandMonths</symbol>
-    <symbol file="xmlunicode">xmlUCSIsEthiopic</symbol>
-    <symbol file="xmlunicode">xmlUCSIsGeneralPunctuation</symbol>
-    <symbol file="xmlunicode">xmlUCSIsGeometricShapes</symbol>
-    <symbol file="xmlunicode">xmlUCSIsGeorgian</symbol>
-    <symbol file="xmlunicode">xmlUCSIsGothic</symbol>
-    <symbol file="xmlunicode">xmlUCSIsGreek</symbol>
-    <symbol file="xmlunicode">xmlUCSIsGreekExtended</symbol>
-    <symbol file="xmlunicode">xmlUCSIsGujarati</symbol>
-    <symbol file="xmlunicode">xmlUCSIsGurmukhi</symbol>
-    <symbol file="xmlunicode">xmlUCSIsHalfwidthandFullwidthForms</symbol>
-    <symbol file="xmlunicode">xmlUCSIsHangulCompatibilityJamo</symbol>
-    <symbol file="xmlunicode">xmlUCSIsHangulJamo</symbol>
-    <symbol file="xmlunicode">xmlUCSIsHangulSyllables</symbol>
-    <symbol file="xmlunicode">xmlUCSIsHebrew</symbol>
-    <symbol file="xmlunicode">xmlUCSIsHighPrivateUseSurrogates</symbol>
-    <symbol file="xmlunicode">xmlUCSIsHighSurrogates</symbol>
-    <symbol file="xmlunicode">xmlUCSIsHiragana</symbol>
-    <symbol file="xmlunicode">xmlUCSIsIPAExtensions</symbol>
-    <symbol file="xmlunicode">xmlUCSIsIdeographicDescriptionCharacters</symbol>
-    <symbol file="xmlunicode">xmlUCSIsKanbun</symbol>
-    <symbol file="xmlunicode">xmlUCSIsKangxiRadicals</symbol>
-    <symbol file="xmlunicode">xmlUCSIsKannada</symbol>
-    <symbol file="xmlunicode">xmlUCSIsKatakana</symbol>
-    <symbol file="xmlunicode">xmlUCSIsKhmer</symbol>
-    <symbol file="xmlunicode">xmlUCSIsLao</symbol>
-    <symbol file="xmlunicode">xmlUCSIsLatin1Supplement</symbol>
-    <symbol file="xmlunicode">xmlUCSIsLatinExtendedA</symbol>
-    <symbol file="xmlunicode">xmlUCSIsLatinExtendedAdditional</symbol>
-    <symbol file="xmlunicode">xmlUCSIsLatinExtendedB</symbol>
-    <symbol file="xmlunicode">xmlUCSIsLetterlikeSymbols</symbol>
-    <symbol file="xmlunicode">xmlUCSIsLowSurrogates</symbol>
-    <symbol file="xmlunicode">xmlUCSIsMalayalam</symbol>
-    <symbol file="xmlunicode">xmlUCSIsMathematicalAlphanumericSymbols</symbol>
-    <symbol file="xmlunicode">xmlUCSIsMathematicalOperators</symbol>
-    <symbol file="xmlunicode">xmlUCSIsMiscellaneousSymbols</symbol>
-    <symbol file="xmlunicode">xmlUCSIsMiscellaneousTechnical</symbol>
-    <symbol file="xmlunicode">xmlUCSIsMongolian</symbol>
-    <symbol file="xmlunicode">xmlUCSIsMusicalSymbols</symbol>
-    <symbol file="xmlunicode">xmlUCSIsMyanmar</symbol>
-    <symbol file="xmlunicode">xmlUCSIsNumberForms</symbol>
-    <symbol file="xmlunicode">xmlUCSIsOgham</symbol>
-    <symbol file="xmlunicode">xmlUCSIsOldItalic</symbol>
-    <symbol file="xmlunicode">xmlUCSIsOpticalCharacterRecognition</symbol>
-    <symbol file="xmlunicode">xmlUCSIsOriya</symbol>
-    <symbol file="xmlunicode">xmlUCSIsPrivateUse</symbol>
-    <symbol file="xmlunicode">xmlUCSIsRunic</symbol>
-    <symbol file="xmlunicode">xmlUCSIsSinhala</symbol>
-    <symbol file="xmlunicode">xmlUCSIsSmallFormVariants</symbol>
-    <symbol file="xmlunicode">xmlUCSIsSpacingModifierLetters</symbol>
-    <symbol file="xmlunicode">xmlUCSIsSpecials</symbol>
-    <symbol file="xmlunicode">xmlUCSIsSuperscriptsandSubscripts</symbol>
-    <symbol file="xmlunicode">xmlUCSIsSyriac</symbol>
-    <symbol file="xmlunicode">xmlUCSIsTags</symbol>
-    <symbol file="xmlunicode">xmlUCSIsTamil</symbol>
-    <symbol file="xmlunicode">xmlUCSIsTelugu</symbol>
-    <symbol file="xmlunicode">xmlUCSIsThaana</symbol>
-    <symbol file="xmlunicode">xmlUCSIsThai</symbol>
-    <symbol file="xmlunicode">xmlUCSIsTibetan</symbol>
-    <symbol file="xmlunicode">xmlUCSIsUnifiedCanadianAboriginalSyllabics</symbol>
-    <symbol file="xmlunicode">xmlUCSIsYiRadicals</symbol>
-    <symbol file="xmlunicode">xmlUCSIsYiSyllables</symbol>
-    <symbol file="uri">xmlBuildURI</symbol>
-    <symbol file="uri">xmlCreateURI</symbol>
-    <symbol file="uri">xmlFreeURI</symbol>
-    <symbol file="uri">xmlNormalizeURIPath</symbol>
-    <symbol file="uri">xmlParseURI</symbol>
-    <symbol file="uri">xmlParseURIReference</symbol>
-    <symbol file="uri">xmlPrintURI</symbol>
-    <symbol file="uri">xmlSaveUri</symbol>
-    <symbol file="uri">xmlURIEscape</symbol>
-    <symbol file="uri">xmlURIEscapeStr</symbol>
-    <symbol file="uri">xmlURIUnescapeString</symbol>
-    <symbol file="encoding">UTF8Toisolat1</symbol>
-    <symbol file="encoding">isolat1ToUTF8</symbol>
-    <symbol file="encoding">xmlAddEncodingAlias</symbol>
-    <symbol file="encoding">xmlCharEncCloseFunc</symbol>
-    <symbol file="encoding">xmlCharEncFirstLine</symbol>
-    <symbol file="encoding">xmlCharEncInFunc</symbol>
-    <symbol file="encoding">xmlCharEncOutFunc</symbol>
-    <symbol file="xmlstring">xmlCheckUTF8</symbol>
-    <symbol file="encoding">xmlCleanupCharEncodingHandlers</symbol>
-    <symbol file="encoding">xmlCleanupEncodingAliases</symbol>
-    <symbol file="encoding">xmlDelEncodingAlias</symbol>
-    <symbol file="encoding">xmlDetectCharEncoding</symbol>
-    <symbol file="encoding">xmlFindCharEncodingHandler</symbol>
-    <symbol file="encoding">xmlGetCharEncodingHandler</symbol>
-    <symbol file="encoding">xmlGetCharEncodingName</symbol>
-    <symbol file="encoding">xmlGetEncodingAlias</symbol>
-    <symbol file="xmlstring">xmlGetUTF8Char</symbol>
-    <symbol file="encoding">xmlInitCharEncodingHandlers</symbol>
-    <symbol file="encoding">xmlNewCharEncodingHandler</symbol>
-    <symbol file="encoding">xmlParseCharEncoding</symbol>
-    <symbol file="encoding">xmlRegisterCharEncodingHandler</symbol>
-    <symbol file="xmlstring">xmlUTF8Strlen</symbol>
-    <symbol file="xmlstring">xmlUTF8Strloc</symbol>
-    <symbol file="xmlstring">xmlUTF8Strndup</symbol>
-    <symbol file="xmlstring">xmlUTF8Strpos</symbol>
-    <symbol file="xmlstring">xmlUTF8Strsize</symbol>
-    <symbol file="xmlstring">xmlUTF8Strsub</symbol>
-  </release>
-  <release version="2.5.0">
-    <symbol file="globals">xmlDeregisterNodeDefault</symbol>
-    <symbol file="globals">xmlDeregisterNodeDefaultValue</symbol>
-    <symbol file="globals">xmlRegisterNodeDefault</symbol>
-    <symbol file="globals">xmlRegisterNodeDefaultValue</symbol>
-    <symbol file="xmlreader">xmlTextReaderClose</symbol>
-    <symbol file="xmlreader">xmlTextReaderCurrentDoc</symbol>
-    <symbol file="xmlreader">xmlTextReaderCurrentNode</symbol>
-    <symbol file="xmlreader">xmlTextReaderGetAttributeNo</symbol>
-    <symbol file="xmlreader">xmlTextReaderGetAttributeNs</symbol>
-    <symbol file="xmlreader">xmlTextReaderGetAttribute</symbol>
-    <symbol file="xmlreader">xmlTextReaderGetParserProp</symbol>
-    <symbol file="xmlreader">xmlTextReaderGetRemainder</symbol>
-    <symbol file="xmlreader">xmlTextReaderLookupNamespace</symbol>
-    <symbol file="xmlreader">xmlTextReaderMoveToAttributeNo</symbol>
-    <symbol file="xmlreader">xmlTextReaderMoveToAttributeNs</symbol>
-    <symbol file="xmlreader">xmlTextReaderMoveToAttribute</symbol>
-    <symbol file="xmlreader">xmlTextReaderMoveToElement</symbol>
-    <symbol file="xmlreader">xmlTextReaderMoveToFirstAttribute</symbol>
-    <symbol file="xmlreader">xmlTextReaderMoveToNextAttribute</symbol>
-    <symbol file="xmlreader">xmlTextReaderNormalization</symbol>
-    <symbol file="xmlreader">xmlTextReaderReadAttributeValue</symbol>
-    <symbol file="xmlreader">xmlTextReaderReadInnerXml</symbol>
-    <symbol file="xmlreader">xmlTextReaderReadOuterXml</symbol>
-    <symbol file="xmlreader">xmlTextReaderReadState</symbol>
-    <symbol file="xmlreader">xmlTextReaderReadString</symbol>
-    <symbol file="xmlreader">xmlTextReaderSetParserProp</symbol>
-    <symbol file="valid">xmlValidatePopElement</symbol>
-    <symbol file="valid">xmlValidatePushCData</symbol>
-    <symbol file="valid">xmlValidatePushElement</symbol>
-  </release>
-  <release version="2.5.2">
-    <symbol file="tree">xmlGetNoNsProp</symbol>
-    <symbol file="HTMLparser">htmlAttrAllowed</symbol>
-    <symbol file="HTMLparser">htmlElementAllowedHere</symbol>
-    <symbol file="HTMLparser">htmlElementStatusHere</symbol>
-    <symbol file="HTMLparser">htmlNodeStatus</symbol>
-    <symbol file="relaxng">xmlRelaxNGCleanupTypes</symbol>
-    <symbol file="relaxng">xmlRelaxNGDump</symbol>
-    <symbol file="relaxng">xmlRelaxNGFreeParserCtxt</symbol>
-    <symbol file="relaxng">xmlRelaxNGFree</symbol>
-    <symbol file="relaxng">xmlRelaxNGFreeValidCtxt</symbol>
-    <symbol file="relaxng">xmlRelaxNGNewMemParserCtxt</symbol>
-    <symbol file="relaxng">xmlRelaxNGNewParserCtxt</symbol>
-    <symbol file="relaxng">xmlRelaxNGNewValidCtxt</symbol>
-    <symbol file="relaxng">xmlRelaxNGParse</symbol>
-    <symbol file="relaxng">xmlRelaxNGSetParserErrors</symbol>
-    <symbol file="relaxng">xmlRelaxNGSetValidErrors</symbol>
-    <symbol file="relaxng">xmlRelaxNGValidateDoc</symbol>
-    <symbol file="xmlreader">xmlTextReaderGetErrorHandler</symbol>
-    <symbol file="xmlreader">xmlTextReaderLocatorBaseURI</symbol>
-    <symbol file="xmlreader">xmlTextReaderLocatorLineNumber</symbol>
-    <symbol file="xmlreader">xmlTextReaderSetErrorHandler</symbol>
-    <symbol removed="2.5.5" file="relaxng">xmlRelaxNGValidateStream</symbol>
-  </release>
-  <release version="2.5.4">
-    <symbol file="uri">xmlCanonicPath</symbol>
-    <symbol file="relaxng">xmlRelaxNGDumpTree</symbol>
-    <symbol file="tree">xmlValidateName</symbol>
-    <symbol file="tree">xmlValidateNCName</symbol>
-    <symbol file="tree">xmlValidateNMToken</symbol>
-    <symbol file="tree">xmlValidateQName</symbol>
-  </release>
-  <release version="2.5.5">
-    <symbol file="nanoftp">xmlNanoFTPDele</symbol>
-  </release>
-  <release version="2.5.6">
-    <symbol file="xpath">xmlXPathOrderDocElems</symbol>
-  </release>
-  <release version="2.5.7">
-    <symbol file="HTMLparser">htmlCreateMemoryParserCtxt</symbol>
-    <symbol file="xmlautomata">xmlAutomataNewTransition2</symbol>
-    <symbol file="tree">xmlBuildQName</symbol>
-    <symbol file="xmlmemory">xmlGcMemGet</symbol>
-    <symbol file="xmlmemory">xmlGcMemSetup</symbol>
-    <symbol file="globals">xmlMallocAtomic</symbol>
-    <symbol file="xmlregexp">xmlRegExecPushString2</symbol>
-    <symbol file="relaxng">xmlRelaxNGNewDocParserCtxt</symbol>
-    <symbol file="relaxng">xmlRelaxNGValidateFullElement</symbol>
-    <symbol file="relaxng">xmlRelaxNGValidatePopElement</symbol>
-    <symbol file="relaxng">xmlRelaxNGValidatePushCData</symbol>
-    <symbol file="relaxng">xmlRelaxNGValidatePushElement</symbol>
-    <symbol file="xmlreader">xmlTextReaderExpand</symbol>
-    <symbol file="xmlreader">xmlTextReaderIsValid</symbol>
-    <symbol file="xmlreader">xmlTextReaderNext</symbol>
-    <symbol file="xmlreader">xmlTextReaderRelaxNGSetSchema</symbol>
-    <symbol file="xmlreader">xmlTextReaderRelaxNGValidate</symbol>
-  </release>
-  <release version="2.5.8">
-    <symbol file="globals">xmlCleanupGlobals</symbol>
-    <symbol file="globals">xmlInitGlobals</symbol>
-    <symbol file="valid">xmlFreeValidCtxt</symbol>
-    <symbol file="valid">xmlNewValidCtxt</symbol>
-    <symbol file="schemasInternals">xmlSchemaFreeType</symbol>
-    <symbol file="xmlschemas">xmlSchemaDump</symbol>
-    <symbol file="xmlschemas">xmlSchemaFreeParserCtxt</symbol>
-    <symbol file="xmlschemas">xmlSchemaFreeValidCtxt</symbol>
-    <symbol file="xmlschemas">xmlSchemaFree</symbol>
-    <symbol file="xmlschemas">xmlSchemaNewMemParserCtxt</symbol>
-    <symbol file="xmlschemas">xmlSchemaNewParserCtxt</symbol>
-    <symbol file="xmlschemas">xmlSchemaNewValidCtxt</symbol>
-    <symbol file="xmlschemas">xmlSchemaParse</symbol>
-    <symbol file="xmlschemas">xmlSchemaSetParserErrors</symbol>
-    <symbol file="xmlschemas">xmlSchemaSetValidErrors</symbol>
-    <symbol file="xmlschemas">xmlSchemaValidateDoc</symbol>
-    <symbol file="xmlschemas">xmlSchemaValidateStream</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaCheckFacet</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaCleanupTypes</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaCompareValues</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaFreeFacet</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaFreeValue</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaGetPredefinedType</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaInitTypes</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaNewFacet</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaValidateFacet</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaValidatePredefinedType</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaValPredefTypeNode</symbol>
-    <symbol file="globals">xmlThrDefBufferAllocScheme</symbol>
-    <symbol file="globals">xmlThrDefDefaultBufferSize</symbol>
-    <symbol file="globals">xmlThrDefDeregisterNodeDefault</symbol>
-    <symbol file="globals">xmlThrDefDoValidityCheckingDefaultValue</symbol>
-    <symbol file="globals">xmlThrDefGetWarningsDefaultValue</symbol>
-    <symbol file="globals">xmlThrDefIndentTreeOutput</symbol>
-    <symbol file="globals">xmlThrDefKeepBlanksDefaultValue</symbol>
-    <symbol file="globals">xmlThrDefLineNumbersDefaultValue</symbol>
-    <symbol file="globals">xmlThrDefLoadExtDtdDefaultValue</symbol>
-    <symbol file="globals">xmlThrDefParserDebugEntities</symbol>
-    <symbol file="globals">xmlThrDefPedanticParserDefaultValue</symbol>
-    <symbol file="globals">xmlThrDefRegisterNodeDefault</symbol>
-    <symbol file="globals">xmlThrDefSaveNoEmptyTags</symbol>
-    <symbol file="globals">xmlThrDefSetGenericErrorFunc</symbol>
-    <symbol file="globals">xmlThrDefSubstituteEntitiesDefaultValue</symbol>
-    <symbol file="globals">xmlThrDefTreeIndentString</symbol>
-  </release>
-  <release version="2.5.9">
-    <symbol file="xmlmemory">xmlMallocAtomicLoc</symbol>
-    <symbol file="relaxng">xmlRelaxNGGetParserErrors</symbol>
-    <symbol file="relaxng">xmlRelaxNGGetValidErrors</symbol>
-    <symbol file="tree">xmlSplitQName3</symbol>
-    <symbol file="xmlstring">xmlUTF8Charcmp</symbol>
-    <symbol file="xmlstring">xmlUTF8Size</symbol>
-    <symbol file="xinclude">xmlXIncludeProcessTree</symbol>
-  </release>
-  <release version="2.6.0">
-    <symbol file="SAX2">xmlSAX2AttributeDecl</symbol>
-    <symbol file="SAX2">xmlSAX2CDataBlock</symbol>
-    <symbol file="SAX2">xmlSAX2Characters</symbol>
-    <symbol file="SAX2">xmlSAX2Comment</symbol>
-    <symbol file="SAX2">xmlSAX2ElementDecl</symbol>
-    <symbol file="SAX2">xmlSAX2EndDocument</symbol>
-    <symbol file="SAX2">xmlSAX2EndElementNs</symbol>
-    <symbol file="SAX2">xmlSAX2EndElement</symbol>
-    <symbol file="SAX2">xmlSAX2EntityDecl</symbol>
-    <symbol file="SAX2">xmlSAX2ExternalSubset</symbol>
-    <symbol file="SAX2">xmlSAX2GetColumnNumber</symbol>
-    <symbol file="SAX2">xmlSAX2GetEntity</symbol>
-    <symbol file="SAX2">xmlSAX2GetLineNumber</symbol>
-    <symbol file="SAX2">xmlSAX2GetParameterEntity</symbol>
-    <symbol file="SAX2">xmlSAX2GetPublicId</symbol>
-    <symbol file="SAX2">xmlSAX2GetSystemId</symbol>
-    <symbol file="SAX2">xmlSAX2HasExternalSubset</symbol>
-    <symbol file="SAX2">xmlSAX2HasInternalSubset</symbol>
-    <symbol file="SAX2">xmlSAX2IgnorableWhitespace</symbol>
-    <symbol file="SAX2">xmlSAX2InitDefaultSAXHandler</symbol>
-    <symbol file="SAX2" removed="2.10.0">xmlSAX2InitDocbDefaultSAXHandler</symbol>
-    <symbol file="SAX2">xmlSAX2InitHtmlDefaultSAXHandler</symbol>
-    <symbol file="SAX2">xmlSAX2InternalSubset</symbol>
-    <symbol file="SAX2">xmlSAX2IsStandalone</symbol>
-    <symbol file="SAX2">xmlSAX2NotationDecl</symbol>
-    <symbol file="SAX2">xmlSAX2ProcessingInstruction</symbol>
-    <symbol file="SAX2">xmlSAX2Reference</symbol>
-    <symbol file="SAX2">xmlSAX2ResolveEntity</symbol>
-    <symbol file="SAX2">xmlSAX2SetDocumentLocator</symbol>
-    <symbol file="SAX2">xmlSAX2StartDocument</symbol>
-    <symbol file="SAX2">xmlSAX2StartElementNs</symbol>
-    <symbol file="SAX2">xmlSAX2StartElement</symbol>
-    <symbol file="SAX2">xmlSAX2UnparsedEntityDecl</symbol>
-    <symbol file="SAX2">xmlSAXDefaultVersion</symbol>
-    <symbol file="SAX2">xmlSAXVersion</symbol>
-    <symbol file="HTMLparser">htmlCtxtReadDoc</symbol>
-    <symbol file="HTMLparser">htmlCtxtReadFd</symbol>
-    <symbol file="HTMLparser">htmlCtxtReadFile</symbol>
-    <symbol file="HTMLparser">htmlCtxtReadIO</symbol>
-    <symbol file="HTMLparser">htmlCtxtReadMemory</symbol>
-    <symbol file="HTMLparser">htmlCtxtReset</symbol>
-    <symbol file="HTMLparser">htmlCtxtUseOptions</symbol>
-    <symbol file="HTMLparser">htmlReadDoc</symbol>
-    <symbol file="HTMLparser">htmlReadFd</symbol>
-    <symbol file="HTMLparser">htmlReadFile</symbol>
-    <symbol file="HTMLparser">htmlReadIO</symbol>
-    <symbol file="HTMLparser">htmlReadMemory</symbol>
-    <symbol file="tree">xmlBufferCreateStatic</symbol>
-    <symbol file="chvalid">xmlCharInRange</symbol>
-    <symbol file="xmlIO">xmlCheckHTTPInput</symbol>
-    <symbol file="xmlerror">xmlCopyError</symbol>
-    <symbol file="xmlerror">xmlCtxtGetLastError</symbol>
-    <symbol file="xmlerror">xmlGetLastError</symbol>
-    <symbol file="xmlerror">xmlResetError</symbol>
-    <symbol file="xmlerror">xmlResetLastError</symbol>
-    <symbol file="xmlerror">xmlSetStructuredErrorFunc</symbol>
-    <symbol file="parser">xmlCtxtReadDoc</symbol>
-    <symbol file="parser">xmlCtxtReadFd</symbol>
-    <symbol file="parser">xmlCtxtReadFile</symbol>
-    <symbol file="parser">xmlCtxtReadIO</symbol>
-    <symbol file="parser">xmlCtxtReadMemory</symbol>
-    <symbol file="xmlerror">xmlCtxtResetLastError</symbol>
-    <symbol file="parser">xmlCtxtReset</symbol>
-    <symbol file="parser">xmlCtxtUseOptions</symbol>
-    <symbol file="parser">xmlReadDoc</symbol>
-    <symbol file="parser">xmlReadFd</symbol>
-    <symbol file="parser">xmlReadFile</symbol>
-    <symbol file="parser">xmlReadIO</symbol>
-    <symbol file="parser">xmlReadMemory</symbol>
-    <symbol file="xmlstring">xmlStrPrintf</symbol>
-    <symbol file="xmlstring">xmlStrQEqual</symbol>
-    <symbol file="dict">xmlDictCreate</symbol>
-    <symbol file="dict">xmlDictFree</symbol>
-    <symbol file="dict">xmlDictLookup</symbol>
-    <symbol file="dict">xmlDictOwns</symbol>
-    <symbol file="dict">xmlDictQLookup</symbol>
-    <symbol file="dict">xmlDictReference</symbol>
-    <symbol file="dict">xmlDictSize</symbol>
-    <symbol file="parserInternals">xmlErrMemory</symbol>
-    <symbol file="parserInternals">xmlParserMaxDepth</symbol>
-    <symbol file="parserInternals">xmlStringLenDecodeEntities</symbol>
-    <symbol file="parserInternals">xmlSwitchInputEncoding</symbol>
-    <symbol file="xmlwriter">xmlFreeTextWriter</symbol>
-    <symbol file="xmlwriter">xmlNewTextWriterFilename</symbol>
-    <symbol file="xmlwriter">xmlNewTextWriterMemory</symbol>
-    <symbol file="xmlwriter">xmlNewTextWriter</symbol>
-    <symbol file="xmlwriter">xmlTextWriterEndAttribute</symbol>
-    <symbol file="xmlwriter">xmlTextWriterEndCDATA</symbol>
-    <symbol file="xmlwriter">xmlTextWriterEndDocument</symbol>
-    <symbol file="xmlwriter">xmlTextWriterEndDTD</symbol>
-    <symbol file="xmlwriter">xmlTextWriterEndElement</symbol>
-    <symbol file="xmlwriter">xmlTextWriterEndPI</symbol>
-    <symbol file="xmlwriter">xmlTextWriterFlush</symbol>
-    <symbol file="xmlwriter">xmlTextWriterFullEndElement</symbol>
-    <symbol file="xmlwriter">xmlTextWriterStartAttributeNS</symbol>
-    <symbol file="xmlwriter">xmlTextWriterStartAttribute</symbol>
-    <symbol file="xmlwriter">xmlTextWriterStartCDATA</symbol>
-    <symbol file="xmlwriter">xmlTextWriterStartDocument</symbol>
-    <symbol file="xmlwriter">xmlTextWriterStartDTDAttlist</symbol>
-    <symbol file="xmlwriter">xmlTextWriterStartDTDElement</symbol>
-    <symbol file="xmlwriter">xmlTextWriterStartDTDEntity</symbol>
-    <symbol file="xmlwriter">xmlTextWriterStartDTD</symbol>
-    <symbol file="xmlwriter">xmlTextWriterStartElementNS</symbol>
-    <symbol file="xmlwriter">xmlTextWriterStartElement</symbol>
-    <symbol file="xmlwriter">xmlTextWriterStartPI</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteAttributeNS</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteAttribute</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteBase64</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteBinHex</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteCDATA</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteComment</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteDTDAttlist</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteDTDElement</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteDTDEntity</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteDTDExternalEntity</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteDTDInternalEntity</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteDTDNotation</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteDTD</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteElementNS</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteElement</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteFormatAttributeNS</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteFormatAttribute</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteFormatCDATA</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteFormatComment</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteFormatDTDAttlist</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteFormatDTDElement</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteFormatDTDInternalEntity</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteFormatDTD</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteFormatElementNS</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteFormatElement</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteFormatPI</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteFormatRaw</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteFormatString</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWritePI</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteRawLen</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteRaw</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteString</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteVFormatAttributeNS</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteVFormatAttribute</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteVFormatCDATA</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteVFormatComment</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteVFormatDTDAttlist</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteVFormatDTDElement</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteVFormatDTDInternalEntity</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteVFormatDTD</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteVFormatElementNS</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteVFormatElement</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteVFormatPI</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteVFormatRaw</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteVFormatString</symbol>
-    <symbol file="hash">xmlHashQLookup2</symbol>
-    <symbol file="hash">xmlHashQLookup3</symbol>
-    <symbol file="hash">xmlHashQLookup</symbol>
-    <symbol file="chvalid">xmlIsBaseCharGroup</symbol>
-    <symbol file="chvalid">xmlIsCharGroup</symbol>
-    <symbol file="chvalid">xmlIsCombiningGroup</symbol>
-    <symbol file="chvalid">xmlIsDigitGroup</symbol>
-    <symbol file="chvalid">xmlIsExtenderGroup</symbol>
-    <symbol file="chvalid">xmlIsIdeographicGroup</symbol>
-    <symbol file="chvalid">xmlIsPubidChar_tab</symbol>
-    <symbol file="globals">xmlLastError</symbol>
-    <symbol file="nanohttp">xmlNanoHTTPEncoding</symbol>
-    <symbol file="nanohttp">xmlNanoHTTPMimeType</symbol>
-    <symbol file="nanohttp">xmlNanoHTTPRedir</symbol>
-    <symbol file="tree">xmlNodeBufGetContent</symbol>
-    <symbol file="xmlIO">xmlParserInputBufferCreateStatic</symbol>
-    <symbol file="xmlreader">xmlReaderForDoc</symbol>
-    <symbol file="xmlreader">xmlReaderForFd</symbol>
-    <symbol file="xmlreader">xmlReaderForFile</symbol>
-    <symbol file="xmlreader">xmlReaderForIO</symbol>
-    <symbol file="xmlreader">xmlReaderForMemory</symbol>
-    <symbol file="xmlreader">xmlReaderNewDoc</symbol>
-    <symbol file="xmlreader">xmlReaderNewFd</symbol>
-    <symbol file="xmlreader">xmlReaderNewFile</symbol>
-    <symbol file="xmlreader">xmlReaderNewIO</symbol>
-    <symbol file="xmlreader">xmlReaderNewMemory</symbol>
-    <symbol file="xmlreader">xmlReaderNewWalker</symbol>
-    <symbol file="xmlreader">xmlReaderWalker</symbol>
-    <symbol file="xmlreader">xmlTextReaderConstBaseUri</symbol>
-    <symbol file="xmlreader">xmlTextReaderConstLocalName</symbol>
-    <symbol file="xmlreader">xmlTextReaderConstNamespaceUri</symbol>
-    <symbol file="xmlreader">xmlTextReaderConstName</symbol>
-    <symbol file="xmlreader">xmlTextReaderConstPrefix</symbol>
-    <symbol file="xmlreader">xmlTextReaderConstString</symbol>
-    <symbol file="xmlreader">xmlTextReaderConstValue</symbol>
-    <symbol file="xmlreader">xmlTextReaderConstXmlLang</symbol>
-    <symbol file="xmlreader">xmlTextReaderNextSibling</symbol>
-    <symbol file="xmlreader">xmlTextReaderPreserve</symbol>
-    <symbol file="globals">xmlStructuredError</symbol>
-    <symbol file="globals">xmlThrDefSetStructuredErrorFunc</symbol>
-    <symbol file="xpathInternals">xmlXPathErr</symbol>
-    <symbol removed="2.6.10" file="SAX2">xmlSAX2CheckNamespace</symbol>
-    <symbol removed="2.6.10" file="SAX2">xmlSAX2GetNamespace</symbol>
-    <symbol removed="2.6.10" file="SAX2">xmlSAX2GlobalNamespace</symbol>
-    <symbol removed="2.6.10" file="SAX2">xmlSAX2NamespaceDecl</symbol>
-    <symbol removed="2.6.10" file="SAX2">xmlSAX2SetNamespace</symbol>
-  </release>
-  <release version="2.6.1">
-    <symbol file="parser">xmlCtxtResetPush</symbol>
-  </release>
-  <release version="2.6.2">
-    <symbol file="parserInternals">xmlCreateURLParserCtxt</symbol>
-    <symbol file="xmlschemas">xmlSchemaNewDocParserCtxt</symbol>
-    <symbol file="xmlstring">xmlStrVPrintf</symbol>
-    <symbol file="xinclude">xmlXIncludeFreeContext</symbol>
-    <symbol file="xinclude">xmlXIncludeNewContext</symbol>
-    <symbol file="xinclude">xmlXIncludeProcessNode</symbol>
-  </release>
-  <release version="2.6.3">
-    <symbol file="pattern">xmlFreePatternList</symbol>
-    <symbol file="pattern">xmlFreePattern</symbol>
-    <symbol file="pattern">xmlPatterncompile</symbol>
-    <symbol file="pattern">xmlPatternMatch</symbol>
-    <symbol file="xmlwriter">xmlNewTextWriterDoc</symbol>
-    <symbol file="xmlwriter">xmlNewTextWriterPushParser</symbol>
-    <symbol file="xmlwriter">xmlNewTextWriterTree</symbol>
-    <symbol file="xmlreader">xmlTextReaderPreservePattern</symbol>
-    <symbol file="xmlunicode">xmlUCSIsAegeanNumbers</symbol>
-    <symbol file="xmlunicode">xmlUCSIsBuhid</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCombiningDiacriticalMarksforSymbols</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCypriotSyllabary</symbol>
-    <symbol file="xmlunicode">xmlUCSIsCyrillicSupplement</symbol>
-    <symbol file="xmlunicode">xmlUCSIsGreekandCoptic</symbol>
-    <symbol file="xmlunicode">xmlUCSIsHanunoo</symbol>
-    <symbol file="xmlunicode">xmlUCSIsKatakanaPhoneticExtensions</symbol>
-    <symbol file="xmlunicode">xmlUCSIsKhmerSymbols</symbol>
-    <symbol file="xmlunicode">xmlUCSIsLimbu</symbol>
-    <symbol file="xmlunicode">xmlUCSIsLinearBIdeograms</symbol>
-    <symbol file="xmlunicode">xmlUCSIsLinearBSyllabary</symbol>
-    <symbol file="xmlunicode">xmlUCSIsMiscellaneousMathematicalSymbolsA</symbol>
-    <symbol file="xmlunicode">xmlUCSIsMiscellaneousMathematicalSymbolsB</symbol>
-    <symbol file="xmlunicode">xmlUCSIsMiscellaneousSymbolsandArrows</symbol>
-    <symbol file="xmlunicode">xmlUCSIsOsmanya</symbol>
-    <symbol file="xmlunicode">xmlUCSIsPhoneticExtensions</symbol>
-    <symbol file="xmlunicode">xmlUCSIsPrivateUseArea</symbol>
-    <symbol file="xmlunicode">xmlUCSIsShavian</symbol>
-    <symbol file="xmlunicode">xmlUCSIsSupplementalArrowsA</symbol>
-    <symbol file="xmlunicode">xmlUCSIsSupplementalArrowsB</symbol>
-    <symbol file="xmlunicode">xmlUCSIsSupplementalMathematicalOperators</symbol>
-    <symbol file="xmlunicode">xmlUCSIsSupplementaryPrivateUseAreaA</symbol>
-    <symbol file="xmlunicode">xmlUCSIsSupplementaryPrivateUseAreaB</symbol>
-    <symbol file="xmlunicode">xmlUCSIsTagalog</symbol>
-    <symbol file="xmlunicode">xmlUCSIsTagbanwa</symbol>
-    <symbol file="xmlunicode">xmlUCSIsTaiLe</symbol>
-    <symbol file="xmlunicode">xmlUCSIsTaiXuanJingSymbols</symbol>
-    <symbol file="xmlunicode">xmlUCSIsUgaritic</symbol>
-    <symbol file="xmlunicode">xmlUCSIsVariationSelectorsSupplement</symbol>
-    <symbol file="xmlunicode">xmlUCSIsVariationSelectors</symbol>
-    <symbol file="xmlunicode">xmlUCSIsYijingHexagramSymbols</symbol>
-    <symbol file="xinclude">xmlXIncludeProcessFlags</symbol>
-    <symbol file="xinclude">xmlXIncludeProcessTreeFlags</symbol>
-    <symbol file="xinclude">xmlXIncludeSetFlags</symbol>
-  </release>
-  <release version="2.6.5">
-    <symbol file="xmlmemory">xmlCleanupMemory</symbol>
-    <symbol file="dict">xmlDictCreateSub</symbol>
-    <symbol file="relaxng">xmlRelaxParserSetFlag</symbol>
-    <symbol file="xmlstring">xmlStrncatNew</symbol>
-    <symbol file="xmlwriter">xmlTextWriterSetIndentString</symbol>
-    <symbol file="xmlwriter">xmlTextWriterSetIndent</symbol>
-    <symbol file="xpath">xmlXPathCtxtCompile</symbol>
-  </release>
-  <release version="2.6.6">
-    <symbol file="tree">xmlAttrSerializeTxtContent</symbol>
-    <symbol file="parser">xmlByteConsumed</symbol>
-    <symbol file="xmlreader">xmlTextReaderSetStructuredErrorHandler</symbol>
-  </release>
-  <release version="2.6.7">
-    <symbol file="xmlwriter">xmlTextWriterEndComment</symbol>
-    <symbol file="xmlwriter">xmlTextWriterStartComment</symbol>
-  </release>
-  <release version="2.6.8">
-    <symbol file="xmlsave">xmlSaveClose</symbol>
-    <symbol file="xmlsave">xmlSaveDoc</symbol>
-    <symbol file="xmlsave">xmlSaveFlush</symbol>
-    <symbol file="xmlsave">xmlSaveToFd</symbol>
-    <symbol file="xmlsave">xmlSaveToFilename</symbol>
-    <symbol file="xmlsave">xmlSaveToIO</symbol>
-    <symbol file="xmlsave">xmlSaveTree</symbol>
-    <symbol file="xmlwriter">xmlTextWriterEndDTDAttlist</symbol>
-    <symbol file="xmlwriter">xmlTextWriterEndDTDElement</symbol>
-    <symbol file="xmlwriter">xmlTextWriterEndDTDEntity</symbol>
-    <symbol file="xmlwriter">xmlTextWriterWriteDTDExternalEntityContents</symbol>
-  </release>
-  <release version="2.6.10">
-    <symbol file="xmlIO">xmlOutputBufferWriteEscape</symbol>
-    <symbol file="xmlIO">xmlPopInputCallbacks</symbol>
-    <symbol file="xmlsave">xmlSaveSetAttrEscape</symbol>
-    <symbol file="xmlsave">xmlSaveSetEscape</symbol>
-  </release>
-  <release version="2.6.11">
-    <symbol file="uri">xmlBuildRelativeURI</symbol>
-    <symbol file="globals">xmlOutputBufferCreateFilenameDefault</symbol>
-    <symbol file="globals">xmlOutputBufferCreateFilenameValue</symbol>
-    <symbol file="globals">xmlParserInputBufferCreateFilenameDefault</symbol>
-    <symbol file="globals">xmlParserInputBufferCreateFilenameValue</symbol>
-    <symbol file="globals">xmlThrDefOutputBufferCreateFilenameDefault</symbol>
-    <symbol file="globals">xmlThrDefParserInputBufferCreateFilenameDefault</symbol>
-    <symbol file="schemasInternals">xmlSchemaFreeWildcard</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaCollapseString</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaGetBuiltInListSimpleTypeItemType</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaGetBuiltInType</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaIsBuiltInTypeFacet</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaValidateListSimpleTypeFacet</symbol>
-  </release>
-  <release version="2.6.12">
-    <symbol file="parser">xmlParseInNodeContext</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaGetFacetValueAsULong</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaValidateLengthFacet</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaValPredefTypeNodeNoNorm</symbol>
-    <symbol file="xmlschemas">xmlSchemaGetParserErrors</symbol>
-    <symbol file="xmlschemas">xmlSchemaGetValidErrors</symbol>
-  </release>
-  <release version="2.6.14">
-    <symbol file="xmlautomata">xmlAutomataNewCountTrans2</symbol>
-    <symbol file="xmlautomata">xmlAutomataNewOnceTrans2</symbol>
-    <symbol file="nanohttp">xmlNanoHTTPContentLength</symbol>
-    <symbol file="xmlschemas">xmlSchemaSetValidOptions</symbol>
-    <symbol file="xmlschemas">xmlSchemaValidateOneElement</symbol>
-    <symbol file="xmlschemas">xmlSchemaValidCtxtGetOptions</symbol>
-  </release>
-  <release version="2.6.15">
-    <symbol file="debugXML">xmlDebugCheckDocument</symbol>
-    <symbol file="tree">xmlDocCopyNodeList</symbol>
-    <symbol file="tree">xmlNewDocPI</symbol>
-    <symbol file="xmlreader">xmlTextReaderConstEncoding</symbol>
-    <symbol file="xmlreader">xmlTextReaderConstXmlVersion</symbol>
-    <symbol file="xmlreader">xmlTextReaderIsNamespaceDecl</symbol>
-    <symbol file="xmlreader">xmlTextReaderStandalone</symbol>
-  </release>
-  <release version="2.6.16">
-    <symbol file="xmlmemory">xmlMemBlocks</symbol>
-    <symbol file="relaxng">xmlRelaxNGInitTypes</symbol>
-  </release>
-  <release version="2.6.17">
-    <symbol file="dict">xmlDictExists</symbol>
-    <symbol file="xmlmodule">xmlModuleClose</symbol>
-    <symbol file="xmlmodule">xmlModuleFree</symbol>
-    <symbol file="xmlmodule">xmlModuleOpen</symbol>
-    <symbol file="xmlmodule">xmlModuleSymbol</symbol>
-    <symbol file="xmlregexp">xmlRegExecErrInfo</symbol>
-    <symbol file="xmlregexp">xmlRegExecNextValues</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaWhiteSpaceReplace</symbol>
-    <symbol file="xmlreader">xmlTextReaderGetParserColumnNumber</symbol>
-    <symbol file="xmlreader">xmlTextReaderGetParserLineNumber</symbol>
-  </release>
-  <release version="2.6.18">
-    <symbol file="valid">xmlCopyDocElementContent</symbol>
-    <symbol file="valid">xmlFreeDocElementContent</symbol>
-    <symbol file="valid">xmlNewDocElementContent</symbol>
-    <symbol file="dict">xmlDictCleanup</symbol>
-    <symbol file="hash">xmlHashCreateDict</symbol>
-    <symbol file="pattern">xmlFreeStreamCtxt</symbol>
-    <symbol file="pattern">xmlPatternFromRoot</symbol>
-    <symbol file="pattern">xmlPatternGetStreamCtxt</symbol>
-    <symbol file="pattern">xmlPatternMaxDepth</symbol>
-    <symbol file="pattern">xmlPatternStreamable</symbol>
-    <symbol file="pattern">xmlStreamPop</symbol>
-    <symbol file="pattern">xmlStreamPushAttr</symbol>
-    <symbol file="pattern">xmlStreamPush</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaCompareValuesWhtsp</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaCopyValue</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaGetCanonValue</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaNewNOTATIONValue</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaNewStringValue</symbol>
-    <symbol file="xmlreader">xmlTextReaderByteConsumed</symbol>
-  </release>
-  <release version="2.6.19">
-    <symbol file="xmlschemastypes">xmlSchemaGetValType</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaValidateFacetWhtsp</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaValidateLengthFacetWhtsp</symbol>
-  </release>
-  <release version="2.6.20">
-    <symbol file="tree">xmlDOMWrapAdoptNode</symbol>
-    <symbol file="tree">xmlDOMWrapFreeCtxt</symbol>
-    <symbol file="tree">xmlDOMWrapNewCtxt</symbol>
-    <symbol file="tree">xmlDOMWrapReconcileNamespaces</symbol>
-    <symbol file="tree">xmlDOMWrapRemoveNode</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaGetCanonValueWhtsp</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaNewQNameValue</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaValueAppend</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaValueGetAsBoolean</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaValueGetAsString</symbol>
-    <symbol file="xmlschemastypes">xmlSchemaValueGetNext</symbol>
-    <symbol file="xmlschemas">xmlSchemaIsValid</symbol>
-    <symbol file="xmlschemas">xmlSchemaSAXPlug</symbol>
-    <symbol file="xmlschemas">xmlSchemaSAXUnplug</symbol>
-    <symbol file="xmlschemas">xmlSchemaValidateFile</symbol>
-    <symbol file="xmlreader">xmlTextReaderSchemaValidate</symbol>
-    <symbol file="xmlreader">xmlTextReaderSetSchema</symbol>
-  </release>
-  <release version="2.6.21">
-    <symbol file="xmlautomata">xmlAutomataNewNegTrans</symbol>
-    <symbol removed="2.9.10" file="xmlregexp">emptyExp</symbol>
-    <symbol removed="2.9.10" file="xmlregexp">forbiddenExp</symbol>
-    <symbol removed="2.9.10" file="xmlregexp">xmlExpCtxtNbCons</symbol>
-    <symbol removed="2.9.10" file="xmlregexp">xmlExpCtxtNbNodes</symbol>
-    <symbol removed="2.9.10" file="xmlregexp">xmlExpDump</symbol>
-    <symbol removed="2.9.10" file="xmlregexp">xmlExpExpDerive</symbol>
-    <symbol removed="2.9.10" file="xmlregexp">xmlExpFreeCtxt</symbol>
-    <symbol removed="2.9.10" file="xmlregexp">xmlExpFree</symbol>
-    <symbol removed="2.9.10" file="xmlregexp">xmlExpGetLanguage</symbol>
-    <symbol removed="2.9.10" file="xmlregexp">xmlExpGetStart</symbol>
-    <symbol removed="2.9.10" file="xmlregexp">xmlExpIsNillable</symbol>
-    <symbol removed="2.9.10" file="xmlregexp">xmlExpMaxToken</symbol>
-    <symbol removed="2.9.10" file="xmlregexp">xmlExpNewAtom</symbol>
-    <symbol removed="2.9.10" file="xmlregexp">xmlExpNewCtxt</symbol>
-    <symbol removed="2.9.10" file="xmlregexp">xmlExpNewOr</symbol>
-    <symbol removed="2.9.10" file="xmlregexp">xmlExpNewRange</symbol>
-    <symbol removed="2.9.10" file="xmlregexp">xmlExpNewSeq</symbol>
-    <symbol removed="2.9.10" file="xmlregexp">xmlExpParse</symbol>
-    <symbol removed="2.9.10" file="xmlregexp">xmlExpRef</symbol>
-    <symbol removed="2.9.10" file="xmlregexp">xmlExpStringDerive</symbol>
-    <symbol removed="2.9.10" file="xmlregexp">xmlExpSubsume</symbol>
-    <symbol file="parser">xmlHasFeature</symbol>
-    <symbol file="uri">xmlParseURIRaw</symbol>
-    <symbol file="pattern">xmlPatternMinDepth</symbol>
-    <symbol file="relaxng">xmlRelaxNGSetValidStructuredErrors</symbol>
-    <symbol file="xmlschemas">xmlSchemaSetValidStructuredErrors</symbol>
-    <symbol file="schematron">xmlSchematronFreeParserCtxt</symbol>
-    <symbol file="schematron">xmlSchematronFree</symbol>
-    <symbol file="schematron">xmlSchematronFreeValidCtxt</symbol>
-    <symbol file="schematron">xmlSchematronNewDocParserCtxt</symbol>
-    <symbol file="schematron">xmlSchematronNewMemParserCtxt</symbol>
-    <symbol file="schematron">xmlSchematronNewParserCtxt</symbol>
-    <symbol file="schematron">xmlSchematronNewValidCtxt</symbol>
-    <symbol file="schematron">xmlSchematronParse</symbol>
-    <symbol file="schematron">xmlSchematronValidateDoc</symbol>
-  </release>
-  <release version="2.6.23">
-    <symbol file="HTMLtree">htmlDocDumpMemoryFormat</symbol>
-    <symbol file="xmlIO">xmlOutputBufferCreateBuffer</symbol>
-    <symbol file="xmlsave" comment="suppressed in 2.6.11, readded in 2.6.23">xmlSaveToBuffer</symbol>
-    <symbol file="xmlschemas">xmlSchemaSetParserStructuredErrors</symbol>
-    <symbol file="pattern">xmlStreamPushNode</symbol>
-    <symbol file="pattern">xmlStreamWantsAnyNode</symbol>
-    <symbol file="xmlreader">xmlTextReaderSchemaValidateCtxt</symbol>
-  </release>
-  <release version="2.6.24">
-    <symbol file="tree">xmlDOMWrapCloneNode</symbol>
-    <symbol file="relaxng">xmlRelaxNGSetParserStructuredErrors</symbol>
-  </release>
-  <release version="2.6.25">
-    <symbol file="xpath">xmlXPathContextSetCache</symbol>
-  </release>
-  <release version="2.6.27">
-    <symbol file="HTMLparser">htmlNewParserCtxt</symbol>
-    <symbol file="uri">xmlPathToURI</symbol>
-    <symbol file="xinclude">xmlXIncludeProcessFlagsData</symbol>
-    <symbol file="xpath">xmlXPathCompiledEvalToBoolean</symbol>
-  </release>
-  <release version="2.6.28">
-    <symbol file="xmlreader">xmlTextReaderSetup</symbol>
-  </release>
-  <release version="2.6.29">
-    <symbol file="threads">xmlDllMain</symbol>
-  </release>
-  <release version="2.6.32">
-    <symbol file="schematron">xmlSchematronSetValidStructuredErrors</symbol>
-  </release>
-  <release version="2.7.0">
-    <symbol file="xmlmemory">xmlMemDisplayLast</symbol>
-    <symbol file="entities">xmlNewEntity</symbol>
-    <symbol file="xmlschemas">xmlSchemaValidCtxtGetParserCtxt</symbol>
-  </release>
-  <release version="2.7.3">
-    <symbol file="tree">xmlChildElementCount</symbol>
-    <symbol file="tree">xmlFirstElementChild</symbol>
-    <symbol file="tree">xmlLastElementChild</symbol>
-    <symbol file="tree">xmlNextElementSibling</symbol>
-    <symbol file="tree">xmlPreviousElementSibling</symbol>
-  </release>
-  <release version="2.7.4">
-    <symbol file="globals">xmlStructuredErrorContext</symbol>
-    <symbol file="xinclude">xmlXIncludeProcessTreeFlagsData</symbol>
-  </release>
-  <release version="2.8.0">
-    <symbol file="xmlreader">xmlTextReaderRelaxNGValidateCtxt</symbol>
-    <symbol file="tree">xmlBufferDetach</symbol>
-    <symbol file="dict">xmlInitializeDict</symbol>
-  </release>
-  <release version="2.9.0">
-    <symbol file="tree">xmlBufContent</symbol>
-    <symbol file="tree">xmlBufEnd</symbol>
-    <symbol file="tree">xmlBufGetNodeContent</symbol>
-    <symbol file="tree">xmlBufNodeDump</symbol>
-    <symbol file="tree">xmlBufShrink</symbol>
-    <symbol file="tree">xmlBufUse</symbol>
-    <symbol file="dict">xmlDictGetUsage</symbol>
-    <symbol file="dict">xmlDictSetLimit</symbol>
-    <symbol file="xmlschemas">xmlSchemaValidateSetFilename</symbol>
-    <symbol file="xmlschemas">xmlSchemaValidateSetLocator</symbol>
-    <symbol file="xmlIO">xmlOutputBufferGetContent</symbol>
-    <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>
-  <release version="2.9.8">
-    <symbol file="hash">xmlHashDefaultDeallocator</symbol>
-  </release>
-  <release version="2.9.11">
-    <symbol file="xmlIO">xmlPopOutputCallbacks</symbol>
-  </release>
-</symbols>
diff --git a/doc/syms.xsl b/doc/syms.xsl
deleted file mode 100644 (file)
index ebca88f..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-<?xml version="1.0"?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                version="1.0">
-  <xsl:output method="text" encoding="UTF-8"/>
-
-  <xsl:variable name="api" select="document('libxml2-api.xml')"/>
-
-  <xsl:template match="/">
-    <xsl:text>#
-# Officially exported symbols, for which header
-# file definitions are installed in /usr/include/libxml2
-#
-# Automatically generated from symbols.xml and syms.xsl
-#
-# Versions here are *fixed* to match the libxml2 version
-# at which the symbol was introduced. This ensures that
-# a new client app requiring symbol foo() can't accidentally
-# run with old libxml2.so not providing foo() - the global
-# soname version info can't enforce this since we never
-# change the soname
-#
-
-</xsl:text>
-    <xsl:apply-templates select="/symbols/release"/>
-  </xsl:template>
-
-  <xsl:template match="release">
-    <xsl:variable name="prev"
-                  select="preceding-sibling::release[position()=1]"/>
-    <xsl:text>LIBXML2_</xsl:text>
-    <xsl:value-of select="string(@version)"/>
-    <xsl:text> {
-    global:
-</xsl:text>
-    <xsl:for-each select="symbol">
-      <xsl:if test="string(preceding-sibling::symbol[position()=1]/@file) != string(@file)">
-        <xsl:text>
-# </xsl:text>
-        <xsl:value-of select="@file"/>
-        <xsl:text>
-</xsl:text>
-      </xsl:if>
-
-      <xsl:apply-templates select="."/>
-    </xsl:for-each>
-
-    <xsl:text>} </xsl:text>
-    <xsl:if test="$prev">
-      <xsl:text>LIBXML2_</xsl:text>
-      <xsl:value-of select="$prev/@version"/>
-    </xsl:if>
-    <xsl:text>;
-
-</xsl:text>
-  </xsl:template>
-
-  <xsl:template match="symbol">
-    <xsl:variable name="name" select="string(.)"/>
-    <xsl:variable name="file" select="string(@file)"/>
-    <xsl:choose>
-      <xsl:when test="@removed">
-        <xsl:text># </xsl:text>
-        <xsl:value-of select="$name"/>
-        <xsl:text>; removed in </xsl:text>
-        <xsl:value-of select="@removed"/>
-        <xsl:text>
-</xsl:text>
-      </xsl:when>
-      <xsl:otherwise>
-        <!-- make sure we can find that symbol exported from the API list -->
-        <xsl:variable name="def"
-            select="$api/api/files/file[@name = $file]/exports[@symbol = $name]"/>
-        <xsl:if test="string($def/@symbol) != $name">
-          <xsl:message terminate="yes">
-            <xsl:text>Failed to find definition in libxml2-api.xml:</xsl:text>
-            <xsl:value-of select="$name"/>
-          </xsl:message>
-        </xsl:if>
-
-        <xsl:text>  </xsl:text>
-        <xsl:value-of select="$name"/>
-        <xsl:text>;</xsl:text>
-        <xsl:if test="$def/@type = 'variable'">
-          <xsl:text> # variable</xsl:text>
-        </xsl:if>
-        <xsl:if test="@comment">
-          <xsl:text># </xsl:text>
-          <xsl:value-of select="@comment"/>
-          <xsl:text>
-</xsl:text>
-        </xsl:if>
-        <xsl:text>
-</xsl:text>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:template>
-
-</xsl:stylesheet>
-
index 5605bea..15ab9f7 100644 (file)
@@ -1,13 +1,13 @@
 '\" t
 .\"     Title: xmlcatalog
 .\"    Author: John Fleck <jfleck@inkstain.net>
-.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
-.\"      Date: 08/17/2022
+.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
+.\"      Date: 04/26/2023
 .\"    Manual: xmlcatalog Manual
 .\"    Source: libxml2
 .\"  Language: English
 .\"
-.TH "XMLCATALOG" "1" "08/17/2022" "libxml2" "xmlcatalog Manual"
+.TH "XMLCATALOG" "1" "04/26/2023" "libxml2" "xmlcatalog Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -31,7 +31,7 @@
 xmlcatalog \- Command line tool to parse and manipulate XML or SGML catalog files\&.
 .SH "SYNOPSIS"
 .HP \w'\fBxmlcatalog\fR\ 'u
-\fBxmlcatalog\fR [\fB\-\-sgml\fR | \fB\-\-shell\fR | \fB\-\-create\fR | \fB\-\-del\ \fR\fB\fIVALUE(S)\fR\fR | [\ \fB\-\-add\ \fR\fB\fITYPE\fR\fR\fB\ \fR\fB\fIORIG\fR\fR\fB\ \fR\fB\fIREPLACE\fR\fR\fB\ \fR\ |\ \fB\-\-add\ \fR\fB\fIFILENAME\fR\fR] | \fB\-\-noout\fR | \fB\-\-no\-super\-update\fR | [\fB\-v\fR\ |\ \fB\-\-verbose\fR]] {\fICATALOGFILE\fR} {\fIENTITIES\fR...}
+\fBxmlcatalog\fR [\fB\-\-sgml\fR | \fB\-\-shell\fR | \fB\-\-convert\fR | \fB\-\-create\fR | \fB\-\-del\ \fR\fB\fIVALUE(S)\fR\fR | [\ \fB\-\-add\ \fR\fB\fITYPE\fR\fR\fB\ \fR\fB\fIORIG\fR\fR\fB\ \fR\fB\fIREPLACE\fR\fR\fB\ \fR\ |\ \fB\-\-add\ \fR\fB\fIFILENAME\fR\fR] | \fB\-\-noout\fR | \fB\-\-no\-super\-update\fR | [\fB\-v\fR\ |\ \fB\-\-verbose\fR]] {\fICATALOGFILE\fR} {\fIENTITIES\fR...}
 .SH "DESCRIPTION"
 .PP
 \fBxmlcatalog\fR
@@ -91,6 +91,11 @@ SGML
 catalog files\&.
 .RE
 .PP
+\fB\-\-convert\fR
+.RS 4
+Convert SGML catalog to XML\&.
+.RE
+.PP
 \fB\-\-create\fR
 .RS 4
 Create a new
@@ -245,9 +250,10 @@ Execute a Formal Public Identifier lookup of the catalog entry for
 XML
 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 space\-separated list of catalogs\&. Use percent\-encoding to escape spaces or other characters\&. An empty variable should deactivate loading the default
+environment variable to a space\-separated list of catalogs\&. Use percent\-encoding to escape spaces or other characters\&. An empty variable should deactivate loading the default catalog from
 /etc/xml/catalog
-catalog\&.
+or, more specifically,
+${sysconfdir}/xml/catalog\&.
 .RE
 .SH "DIAGNOSTICS"
 .PP
index ae2ebab..01ff864 100644 (file)
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>xmlcatalog</title><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"><a name="idm1"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>xmlcatalog &#8212; 
-               Command line tool to parse and manipulate <acronym class="acronym">XML</acronym>
-               or <acronym class="acronym">SGML</acronym> catalog files.
-       </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">xmlcatalog</code>  [ <code class="option">--sgml</code>  |   <code class="option">--shell</code>  |   <code class="option">--create</code>  |   <code class="option">--del <em class="replaceable"><code>VALUE(S)</code></em></code>  |   
-                       [ 
-                                       <code class="option">--add
-                                        <em class="replaceable"><code>TYPE</code></em>
-                                        <em class="replaceable"><code>ORIG</code></em>
-                                        <em class="replaceable"><code>REPLACE</code></em>
-                                       </code>
-                                 |   <code class="option">--add <em class="replaceable"><code>FILENAME</code></em></code> ]            
-                 |   <code class="option">--noout</code>  |   <code class="option">--no-super-update</code>  |   
-                       [ <code class="option">-v</code>  |   <code class="option">--verbose</code> ]
-                ] {<em class="replaceable"><code>CATALOGFILE</code></em>} {<em class="replaceable"><code>ENTITIES</code></em>...}</p></div></div><div class="refsect1"><a name="description"></a><h2>DESCRIPTION</h2><p>
-               <span class="command"><strong>xmlcatalog</strong></span> is a command line application allowing users to monitor and
-               manipulate <acronym class="acronym">XML</acronym> and <acronym class="acronym">SGML</acronym> catalogs. It
-               is included in <span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span>.
-       </p><p>
-               Its functions can be invoked from a single command from the command line,
-               or it can perform multiple functions in interactive mode. It can operate
-               on both <acronym class="acronym">XML</acronym> and <acronym class="acronym">SGML</acronym> files.
-       </p></div><div class="refsect1"><a name="options"></a><h2>OPTIONS</h2><p>
-               <span class="command"><strong>xmlcatalog</strong></span> accepts the following options (in alphabetical order):
-       </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
-               <code class="option">--add
-                <em class="replaceable"><code>TYPE</code></em>
-                <em class="replaceable"><code>ORIG</code></em>
-                <em class="replaceable"><code>REPLACE</code></em>
-               </code>
-       </span></dt><dd><p>
-                       Add an entry to <code class="filename">CATALOGFILE</code>. <em class="replaceable"><code>TYPE</code></em>
-                       indicates the type of entry. Possible types are: <span class="simplelist"><em class="parameter"><code>public</code></em>, <em class="parameter"><code>system</code></em>, <em class="parameter"><code>uri</code></em>, <em class="parameter"><code>rewriteSystem</code></em>, <em class="parameter"><code>rewriteURI</code></em>, <em class="parameter"><code>delegatePublic</code></em>, <em class="parameter"><code>delegateSystem</code></em>, <em class="parameter"><code>delegateURI</code></em>, <em class="parameter"><code>nextCatalog</code></em></span>. <em class="replaceable"><code>ORIG</code></em> is the original
-                       reference to be replaced, and <em class="replaceable"><code>REPLACE</code></em>
-                       is the <acronym class="acronym">URI</acronym> of the replacement entity to be
-                       used. The <code class="option">--add</code> option will not overwrite
-                       <code class="filename">CATALOGFILE</code>, outputting
-                       to <code class="filename">stdout</code>, unless
-                       <code class="option">--noout</code> is used. The <code class="option">--add</code> will
-                       always take three parameters even if some of the <acronym class="acronym">XML</acronym>
-                       catalog constructs will have only a single argument.
-               </p></dd><dt><span class="term"><code class="option">--add <em class="replaceable"><code>FILENAME</code></em></code></span></dt><dd><p>
-                       If the <code class="option">--add</code> option is used following
-                       the <code class="option">--sgml</code> option, only a single argument,
-                       a <em class="replaceable"><code>FILENAME</code></em>, is used. This is used to add
-                       the name of a catalog file to an <acronym class="acronym">SGML</acronym> supercatalog,
-                       a file that contains references to other included <acronym class="acronym">SGML</acronym>
-                       catalog files.
-               </p></dd><dt><span class="term"><code class="option">--create</code></span></dt><dd><p>
-                       Create a new <acronym class="acronym">XML</acronym> catalog. Outputs
-                       to <code class="filename">stdout</code>,
-                       ignoring <em class="replaceable"><code>filename</code></em> unless <code class="option">--noout</code> is
-                       used, in which case it creates a new catalog
-                       file <em class="replaceable"><code>filename</code></em>.
-               </p></dd><dt><span class="term"><code class="option">--del <em class="replaceable"><code>VALUE(S)</code></em></code></span></dt><dd><p>
-                       Remove entries from <em class="replaceable"><code>CATALOGFILE</code></em>
-                       matching <em class="replaceable"><code>VALUE(S)</code></em>. The <code class="option">--del</code>
-                       option will not overwrite <em class="replaceable"><code>CATALOGFILE</code></em>,
-                       outputting to <code class="filename">stdout</code>,
-                       unless <code class="option">--noout</code> is used.
-               </p></dd><dt><span class="term"><code class="option">--noout</code></span></dt><dd><p>
-                       Save output to the named file rather than outputting
-                       to <code class="filename">stdout</code>.
-               </p></dd><dt><span class="term"><code class="option">--no-super-update</code></span></dt><dd><p>
-                       Do not update the <acronym class="acronym">SGML</acronym> super catalog.
-               </p></dd><dt><span class="term"><code class="option">--shell</code></span></dt><dd><p>
-                       Run a shell allowing interactive queries on catalog
-                       file <em class="replaceable"><code>CATALOGFILE</code></em>. For the set of available
-                       commands see <a class="xref" href="#shell" title="SHELL COMMANDS">the section called &#8220;SHELL COMMANDS&#8221;</a>.
-               </p></dd><dt><span class="term"><code class="option">--sgml</code></span></dt><dd><p>
-                       Uses <acronym class="acronym">SGML</acronym> super catalogs for <code class="option">--add</code>
-                       and <code class="option">--del</code> options.
-               </p></dd><dt><span class="term"><code class="option">-v</code>, </span><span class="term"><code class="option">--verbose</code></span></dt><dd><p>Output debugging information.</p></dd></dl></div><p>
-               Invoking <span class="command"><strong>xmlcatalog</strong></span> non-interactively without a designated action
-               (imposed with options like <code class="option">--add</code>) will result in a lookup
-               of the catalog entry for <em class="replaceable"><code>ENTITIES</code></em> in the
-               catalog denoted with <em class="replaceable"><code>CATALOGFILE</code></em>. The
-               corresponding entries will be output to the command line. This mode of
-               operation, together with <code class="option">--shell</code> mode and non-modifying
-               (i.e. without <code class="option">--noout</code>) direct actions, allows for
-               a special shortcut of the void <em class="replaceable"><code>CATALOGFILE</code></em>
-               specification (possibly expressed as "" in the shell
-               environment) appointing the default system catalog. That simplifies the
-               handling when its exact location is irrelevant but the respective built-in
-               still needs to be consulted.
-       </p></div><div class="refsect1"><a name="shell"></a><h2>SHELL COMMANDS</h2><p>
-               Invoking <span class="command"><strong>xmlcatalog</strong></span> with
-               the <code class="option">--shell <em class="replaceable"><code>CATALOGFILE</code></em></code> option opens
-               a command line shell allowing interactive access to the catalog file
-               identified by <em class="replaceable"><code>CATALOGFILE</code></em>. Invoking the shell
-               provides a command line prompt after which the following commands (described in
-               alphabetical order) can be entered.
-       </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
-               <code class="option">add
-                <em class="replaceable"><code>TYPE</code></em>
-                <em class="replaceable"><code>ORIG</code></em>
-                <em class="replaceable"><code>REPLACE</code></em>
-               </code>
-       </span></dt><dd><p>
-                       Add an entry to the catalog file. <em class="replaceable"><code>TYPE</code></em>
-                       indicates the type of entry. Possible types are: <span class="simplelist"><em class="parameter"><code>public</code></em>, <em class="parameter"><code>system</code></em>, <em class="parameter"><code>uri</code></em>, <em class="parameter"><code>rewriteSystem</code></em>, <em class="parameter"><code>rewriteURI</code></em>, <em class="parameter"><code>delegatePublic</code></em>, <em class="parameter"><code>delegateSystem</code></em>, <em class="parameter"><code>delegateURI</code></em>, <em class="parameter"><code>nextCatalog</code></em></span>. <em class="replaceable"><code>ORIG</code></em> is the original
-                       reference to be replaced, and <em class="replaceable"><code>REPLACE</code></em>
-                       is the <acronym class="acronym">URI</acronym> of the replacement entity to be
-                       used. The <code class="option">--add</code> option will not overwrite
-                       <code class="filename">CATALOGFILE</code>, outputting
-                       to <code class="filename">stdout</code>, unless
-                       <code class="option">--noout</code> is used. The <code class="option">--add</code> will
-                       always take three parameters even if some of the <acronym class="acronym">XML</acronym>
-                       catalog constructs will have only a single argument.
-               </p></dd><dt><span class="term"><code class="option">debug</code></span></dt><dd><p>
-                       Print debugging statements showing the steps <span class="command"><strong>xmlcatalog</strong></span> is executing.
-               </p></dd><dt><span class="term"><code class="option">del <em class="replaceable"><code>VALUE(S)</code></em></code></span></dt><dd><p>
-                       Remove the catalog entry corresponding to <em class="replaceable"><code>VALUE(S)</code></em>.
-               </p></dd><dt><span class="term"><code class="option">dump</code></span></dt><dd><p>Print the current catalog.</p></dd><dt><span class="term"><code class="option">exit</code></span></dt><dd><p>Quit the shell.</p></dd><dt><span class="term"><code class="option">public <em class="replaceable"><code>PUBLIC-ID</code></em></code></span></dt><dd><p>
-                       Execute a Formal Public Identifier lookup of the catalog entry
-                       for <em class="replaceable"><code>PUBLIC-ID</code></em>. The corresponding entry will be
-                       output to the command line.
-               </p></dd><dt><span class="term"><code class="option">quiet</code></span></dt><dd><p>Stop printing debugging statements.</p></dd><dt><span class="term"><code class="option">system <em class="replaceable"><code>SYSTEM-ID</code></em></code></span></dt><dd><p>
-                       Execute a Formal Public Identifier lookup of the catalog entry
-                       for <em class="replaceable"><code>SYSTEM-ID</code></em>. The corresponding entry will be
-                       output to the command line.
-               </p></dd></dl></div></div><div class="refsect1"><a name="environment"></a><h2>ENVIRONMENT</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">XML_CATALOG_FILES</code></span></dt><dd><p><acronym class="acronym">XML</acronym> catalog behavior can be changed by redirecting
-                       queries to the user's own set of catalogs. This can be done by setting
-                       the <code class="envar">XML_CATALOG_FILES</code> environment variable to a space-separated
-                       list of catalogs. Use percent-encoding to escape spaces or other characters.
-                       An empty variable should deactivate loading the default <code class="filename">/etc/xml/catalog</code> catalog.
-               </p></dd></dl></div></div><div class="refsect1"><a name="diagnostics"></a><h2>DIAGNOSTICS</h2><p>
-               <span class="command"><strong>xmlcatalog</strong></span> return codes provide information that can be used when
-               calling it from scripts.
-       </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="errorcode">0</span></span></dt><dd><p>No error</p></dd><dt><span class="term"><span class="errorcode">1</span></span></dt><dd><p>Failed to remove an entry from the catalog</p></dd><dt><span class="term"><span class="errorcode">2</span></span></dt><dd><p>Failed to save to the catalog, check file permissions</p></dd><dt><span class="term"><span class="errorcode">3</span></span></dt><dd><p>Failed to add an entry to the catalog</p></dd><dt><span class="term"><span class="errorcode">4</span></span></dt><dd><p>Failed to look up an entry in the catalog</p></dd></dl></div></div><div class="refsect1"><a name="seealso"></a><h2>SEE ALSO</h2><p><span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span>
-       </p><p>
-               More information can be found at
-               </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span> web page <a class="ulink" href="https://gitlab.gnome.org/GNOME/libxml2" target="_top">https://gitlab.gnome.org/GNOME/libxml2</a>
-                               </p></li><li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span> catalog support web page
-                                       at <a class="ulink" href="https://gitlab.gnome.org/GNOME/libxml2/-/wikis/Catalog-support" target="_top">https://gitlab.gnome.org/GNOME/libxml2/-/wikis/Catalog-support</a>
-                               </p></li><li class="listitem"><p>James Clark's <acronym class="acronym">SGML</acronym> catalog
-                                       page <a class="ulink" href="http://www.jclark.com/sp/catalog.htm" target="_top">http://www.jclark.com/sp/catalog.htm</a>
-                               </p></li><li class="listitem"><p><acronym class="acronym">OASIS</acronym> <acronym class="acronym">XML</acronym> catalog specification
-                                       <a class="ulink" href="http://www.oasis-open.org/committees/entity/spec.html" target="_top">http://www.oasis-open.org/committees/entity/spec.html</a>
-                               </p></li></ul></div><p>
-       </p></div></div></body></html>
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>xmlcatalog</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"><a name="idm1"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>xmlcatalog &#8212; 
+        Command line tool to parse and manipulate <acronym class="acronym">XML</acronym>
+        or <acronym class="acronym">SGML</acronym> catalog files.
+    </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">xmlcatalog</code>  [ <code class="option">--sgml</code>  |   <code class="option">--shell</code>  |   <code class="option">--convert</code>  |   <code class="option">--create</code>  |   <code class="option">--del <em class="replaceable"><code>VALUE(S)</code></em></code>  |   
+            [ 
+                    <code class="option">--add
+                     <em class="replaceable"><code>TYPE</code></em>
+                     <em class="replaceable"><code>ORIG</code></em>
+                     <em class="replaceable"><code>REPLACE</code></em>
+                    </code>
+                  |   <code class="option">--add <em class="replaceable"><code>FILENAME</code></em></code> ]
+          |   <code class="option">--noout</code>  |   <code class="option">--no-super-update</code>  |   
+            [ <code class="option">-v</code>  |   <code class="option">--verbose</code> ]
+         ] {<em class="replaceable"><code>CATALOGFILE</code></em>} {<em class="replaceable"><code>ENTITIES</code></em>...}</p></div></div><div class="refsect1"><a name="description"></a><h2>DESCRIPTION</h2><p>
+        <span class="command"><strong>xmlcatalog</strong></span> is a command line application allowing users to monitor and
+        manipulate <acronym class="acronym">XML</acronym> and <acronym class="acronym">SGML</acronym> catalogs. It
+        is included in <span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span>.
+    </p><p>
+        Its functions can be invoked from a single command from the command line,
+        or it can perform multiple functions in interactive mode. It can operate
+        on both <acronym class="acronym">XML</acronym> and <acronym class="acronym">SGML</acronym> files.
+    </p></div><div class="refsect1"><a name="options"></a><h2>OPTIONS</h2><p>
+        <span class="command"><strong>xmlcatalog</strong></span> accepts the following options (in alphabetical order):
+    </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
+                <code class="option">--add
+                 <em class="replaceable"><code>TYPE</code></em>
+                 <em class="replaceable"><code>ORIG</code></em>
+                 <em class="replaceable"><code>REPLACE</code></em>
+                </code>
+            </span></dt><dd><p>
+                    Add an entry to <code class="filename">CATALOGFILE</code>. <em class="replaceable"><code>TYPE</code></em>
+                    indicates the type of entry. Possible types are: <span class="simplelist"><em class="parameter"><code>public</code></em>, <em class="parameter"><code>system</code></em>, <em class="parameter"><code>uri</code></em>, <em class="parameter"><code>rewriteSystem</code></em>, <em class="parameter"><code>rewriteURI</code></em>, <em class="parameter"><code>delegatePublic</code></em>, <em class="parameter"><code>delegateSystem</code></em>, <em class="parameter"><code>delegateURI</code></em>, <em class="parameter"><code>nextCatalog</code></em></span>. <em class="replaceable"><code>ORIG</code></em> is the original
+                    reference to be replaced, and <em class="replaceable"><code>REPLACE</code></em>
+                    is the <acronym class="acronym">URI</acronym> of the replacement entity to be
+                    used. The <code class="option">--add</code> option will not overwrite
+                    <code class="filename">CATALOGFILE</code>, outputting
+                    to <code class="filename">stdout</code>, unless
+                    <code class="option">--noout</code> is used. The <code class="option">--add</code> will
+                    always take three parameters even if some of the <acronym class="acronym">XML</acronym>
+                    catalog constructs will have only a single argument.
+                </p></dd><dt><span class="term"><code class="option">--add <em class="replaceable"><code>FILENAME</code></em></code></span></dt><dd><p>
+                    If the <code class="option">--add</code> option is used following
+                    the <code class="option">--sgml</code> option, only a single argument,
+                    a <em class="replaceable"><code>FILENAME</code></em>, is used. This is used to add
+                    the name of a catalog file to an <acronym class="acronym">SGML</acronym> supercatalog,
+                    a file that contains references to other included <acronym class="acronym">SGML</acronym>
+                    catalog files.
+                </p></dd><dt><span class="term"><code class="option">--convert</code></span></dt><dd><p>
+                    Convert SGML catalog to XML.
+                </p></dd><dt><span class="term"><code class="option">--create</code></span></dt><dd><p>
+                    Create a new <acronym class="acronym">XML</acronym> catalog. Outputs
+                    to <code class="filename">stdout</code>,
+                    ignoring <em class="replaceable"><code>filename</code></em> unless <code class="option">--noout</code> is
+                    used, in which case it creates a new catalog
+                    file <em class="replaceable"><code>filename</code></em>.
+                </p></dd><dt><span class="term"><code class="option">--del <em class="replaceable"><code>VALUE(S)</code></em></code></span></dt><dd><p>
+                    Remove entries from <em class="replaceable"><code>CATALOGFILE</code></em>
+                    matching <em class="replaceable"><code>VALUE(S)</code></em>. The <code class="option">--del</code>
+                    option will not overwrite <em class="replaceable"><code>CATALOGFILE</code></em>,
+                    outputting to <code class="filename">stdout</code>,
+                    unless <code class="option">--noout</code> is used.
+                </p></dd><dt><span class="term"><code class="option">--noout</code></span></dt><dd><p>
+                    Save output to the named file rather than outputting
+                    to <code class="filename">stdout</code>.
+                </p></dd><dt><span class="term"><code class="option">--no-super-update</code></span></dt><dd><p>
+                    Do not update the <acronym class="acronym">SGML</acronym> super catalog.
+                </p></dd><dt><span class="term"><code class="option">--shell</code></span></dt><dd><p>
+                    Run a shell allowing interactive queries on catalog
+                    file <em class="replaceable"><code>CATALOGFILE</code></em>. For the set of available
+                    commands see <a class="xref" href="#shell" title="SHELL COMMANDS">the section called &#8220;SHELL COMMANDS&#8221;</a>.
+                </p></dd><dt><span class="term"><code class="option">--sgml</code></span></dt><dd><p>
+                    Uses <acronym class="acronym">SGML</acronym> super catalogs for <code class="option">--add</code>
+                    and <code class="option">--del</code> options.
+                </p></dd><dt><span class="term"><code class="option">-v</code>, </span><span class="term"><code class="option">--verbose</code></span></dt><dd><p>Output debugging information.</p></dd></dl></div><p>
+        Invoking <span class="command"><strong>xmlcatalog</strong></span> non-interactively without a designated action
+        (imposed with options like <code class="option">--add</code>) will result in a lookup
+        of the catalog entry for <em class="replaceable"><code>ENTITIES</code></em> in the
+        catalog denoted with <em class="replaceable"><code>CATALOGFILE</code></em>. The
+        corresponding entries will be output to the command line. This mode of
+        operation, together with <code class="option">--shell</code> mode and non-modifying
+        (i.e. without <code class="option">--noout</code>) direct actions, allows for
+        a special shortcut of the void <em class="replaceable"><code>CATALOGFILE</code></em>
+        specification (possibly expressed as "" in the shell
+        environment) appointing the default system catalog. That simplifies the
+        handling when its exact location is irrelevant but the respective built-in
+        still needs to be consulted.
+    </p></div><div class="refsect1"><a name="shell"></a><h2>SHELL COMMANDS</h2><p>
+        Invoking <span class="command"><strong>xmlcatalog</strong></span> with
+        the <code class="option">--shell <em class="replaceable"><code>CATALOGFILE</code></em></code> option opens
+        a command line shell allowing interactive access to the catalog file
+        identified by <em class="replaceable"><code>CATALOGFILE</code></em>. Invoking the shell
+        provides a command line prompt after which the following commands (described in
+        alphabetical order) can be entered.
+    </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
+                <code class="option">add
+                 <em class="replaceable"><code>TYPE</code></em>
+                 <em class="replaceable"><code>ORIG</code></em>
+                 <em class="replaceable"><code>REPLACE</code></em>
+                </code>
+            </span></dt><dd><p>
+                    Add an entry to the catalog file. <em class="replaceable"><code>TYPE</code></em>
+                    indicates the type of entry. Possible types are: <span class="simplelist"><em class="parameter"><code>public</code></em>, <em class="parameter"><code>system</code></em>, <em class="parameter"><code>uri</code></em>, <em class="parameter"><code>rewriteSystem</code></em>, <em class="parameter"><code>rewriteURI</code></em>, <em class="parameter"><code>delegatePublic</code></em>, <em class="parameter"><code>delegateSystem</code></em>, <em class="parameter"><code>delegateURI</code></em>, <em class="parameter"><code>nextCatalog</code></em></span>. <em class="replaceable"><code>ORIG</code></em> is the original
+                    reference to be replaced, and <em class="replaceable"><code>REPLACE</code></em>
+                    is the <acronym class="acronym">URI</acronym> of the replacement entity to be
+                    used. The <code class="option">--add</code> option will not overwrite
+                    <code class="filename">CATALOGFILE</code>, outputting
+                    to <code class="filename">stdout</code>, unless
+                    <code class="option">--noout</code> is used. The <code class="option">--add</code> will
+                    always take three parameters even if some of the <acronym class="acronym">XML</acronym>
+                    catalog constructs will have only a single argument.
+                </p></dd><dt><span class="term"><code class="option">debug</code></span></dt><dd><p>
+                    Print debugging statements showing the steps <span class="command"><strong>xmlcatalog</strong></span> is executing.
+                </p></dd><dt><span class="term"><code class="option">del <em class="replaceable"><code>VALUE(S)</code></em></code></span></dt><dd><p>
+                    Remove the catalog entry corresponding to <em class="replaceable"><code>VALUE(S)</code></em>.
+                </p></dd><dt><span class="term"><code class="option">dump</code></span></dt><dd><p>Print the current catalog.</p></dd><dt><span class="term"><code class="option">exit</code></span></dt><dd><p>Quit the shell.</p></dd><dt><span class="term"><code class="option">public <em class="replaceable"><code>PUBLIC-ID</code></em></code></span></dt><dd><p>
+                    Execute a Formal Public Identifier lookup of the catalog entry
+                    for <em class="replaceable"><code>PUBLIC-ID</code></em>. The corresponding entry will be
+                    output to the command line.
+                </p></dd><dt><span class="term"><code class="option">quiet</code></span></dt><dd><p>Stop printing debugging statements.</p></dd><dt><span class="term"><code class="option">system <em class="replaceable"><code>SYSTEM-ID</code></em></code></span></dt><dd><p>
+                    Execute a Formal Public Identifier lookup of the catalog entry
+                    for <em class="replaceable"><code>SYSTEM-ID</code></em>. The corresponding entry will be
+                    output to the command line.
+                </p></dd></dl></div></div><div class="refsect1"><a name="environment"></a><h2>ENVIRONMENT</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">XML_CATALOG_FILES</code></span></dt><dd><p><acronym class="acronym">XML</acronym> catalog behavior can be changed by redirecting
+                    queries to the user's own set of catalogs. This can be done by setting
+                    the <code class="envar">XML_CATALOG_FILES</code> environment variable to a space-separated
+                    list of catalogs. Use percent-encoding to escape spaces or other characters.
+                    An empty variable should deactivate loading the default catalog from
+                    <code class="filename">/etc/xml/catalog</code> or, more specifically,
+                    <code class="filename">${sysconfdir}/xml/catalog</code>.
+                </p></dd></dl></div></div><div class="refsect1"><a name="diagnostics"></a><h2>DIAGNOSTICS</h2><p>
+        <span class="command"><strong>xmlcatalog</strong></span> return codes provide information that can be used when
+        calling it from scripts.
+    </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="errorcode">0</span></span></dt><dd><p>No error</p></dd><dt><span class="term"><span class="errorcode">1</span></span></dt><dd><p>Failed to remove an entry from the catalog</p></dd><dt><span class="term"><span class="errorcode">2</span></span></dt><dd><p>Failed to save to the catalog, check file permissions</p></dd><dt><span class="term"><span class="errorcode">3</span></span></dt><dd><p>Failed to add an entry to the catalog</p></dd><dt><span class="term"><span class="errorcode">4</span></span></dt><dd><p>Failed to look up an entry in the catalog</p></dd></dl></div></div><div class="refsect1"><a name="seealso"></a><h2>SEE ALSO</h2><p><span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span>
+    </p><p>
+        More information can be found at
+        </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span> web page <a class="ulink" href="https://gitlab.gnome.org/GNOME/libxml2" target="_top">https://gitlab.gnome.org/GNOME/libxml2</a>
+                </p></li><li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span> catalog support web page
+                    at <a class="ulink" href="https://gitlab.gnome.org/GNOME/libxml2/-/wikis/Catalog-support" target="_top">https://gitlab.gnome.org/GNOME/libxml2/-/wikis/Catalog-support</a>
+                </p></li><li class="listitem"><p>James Clark's <acronym class="acronym">SGML</acronym> catalog
+                    page <a class="ulink" href="http://www.jclark.com/sp/catalog.htm" target="_top">http://www.jclark.com/sp/catalog.htm</a>
+                </p></li><li class="listitem"><p><acronym class="acronym">OASIS</acronym> <acronym class="acronym">XML</acronym> catalog specification
+                    <a class="ulink" href="http://www.oasis-open.org/committees/entity/spec.html" target="_top">http://www.oasis-open.org/committees/entity/spec.html</a>
+                </p></li></ul></div><p>
+    </p></div></div></body></html>
index 5d94b3b..bd3f682 100644 (file)
 <refentry>
 
 <refentryinfo>
-       <title>xmlcatalog Manual</title>
-       <productname>libxml2</productname>
-       <copyright>
-               <year>2001</year>
-               <year>2004</year>
-       </copyright>
-       <author>
-               <firstname>John</firstname>
-               <surname>Fleck</surname>
-               <affiliation>
-                       <address>
-                               <email>jfleck@inkstain.net</email>
-                       </address>
-               </affiliation>
-       </author>
-       <!-- still a bit buggy output, will talk to docbook-xsl upstream to fix this -->
-       <!-- <releaseinfo>This is release 0.3 of the xmlcatalog Manual.</releaseinfo> -->
-       <!-- <edition>0.3</edition> -->
+    <title>xmlcatalog Manual</title>
+    <productname>libxml2</productname>
+    <copyright>
+        <year>2001</year>
+        <year>2004</year>
+    </copyright>
+    <author>
+        <firstname>John</firstname>
+        <surname>Fleck</surname>
+        <affiliation>
+            <address>
+                <email>jfleck@inkstain.net</email>
+            </address>
+        </affiliation>
+    </author>
+    <!-- still a bit buggy output, will talk to docbook-xsl upstream to fix this -->
+    <!-- <releaseinfo>This is release 0.3 of the xmlcatalog Manual.</releaseinfo> -->
+    <!-- <edition>0.3</edition> -->
 </refentryinfo>
 
 <refmeta>
-       <refentrytitle>xmlcatalog</refentrytitle>
-       <manvolnum>1</manvolnum>
+    <refentrytitle>xmlcatalog</refentrytitle>
+    <manvolnum>1</manvolnum>
 </refmeta>
 
 <refnamediv>
-       <refname>xmlcatalog</refname>
-       <refpurpose>
-               Command line tool to parse and manipulate <acronym>XML</acronym>
-               or <acronym>SGML</acronym> catalog files.
-       </refpurpose>
+    <refname>xmlcatalog</refname>
+    <refpurpose>
+        Command line tool to parse and manipulate <acronym>XML</acronym>
+        or <acronym>SGML</acronym> catalog files.
+    </refpurpose>
 </refnamediv>
 
 <refsynopsisdiv>
-       <cmdsynopsis>
-       <command>xmlcatalog</command>
-       <group choice="opt">
-               <arg choice="plain"><option>--sgml</option></arg>
-               <arg choice="plain"><option>--shell</option></arg>
-               <arg choice="plain"><option>--create</option></arg>
-               <arg choice="plain"><option>--del <replaceable>VALUE(S)</replaceable></option></arg>
-               <arg choice="plain">
-                       <group choice="opt">
-                               <arg choice="plain">
-                                       <option>--add
-                                        <replaceable>TYPE</replaceable>
-                                        <replaceable>ORIG</replaceable>
-                                        <replaceable>REPLACE</replaceable>
-                                       </option>
-                               </arg>
-                               <arg choice="plain"><option>--add <replaceable>FILENAME</replaceable></option></arg>
-                       </group>                
-               </arg>
-               <arg choice="plain"><option>--noout</option></arg>
-               <arg choice="plain"><option>--no-super-update</option></arg>
-               <arg choice="plain">
-                       <group choice="opt">
-                               <arg choice="plain"><option>-v</option></arg>
-                               <arg choice="plain"><option>--verbose</option></arg>
-                       </group>
-               </arg>
-       </group>
-       <arg choice="req" rep="norepeat"><replaceable>CATALOGFILE</replaceable></arg>
-       <arg choice="req" rep="repeat"><replaceable>ENTITIES</replaceable></arg>
-       </cmdsynopsis>
+    <cmdsynopsis>
+    <command>xmlcatalog</command>
+    <group choice="opt">
+        <arg choice="plain"><option>--sgml</option></arg>
+        <arg choice="plain"><option>--shell</option></arg>
+        <arg choice="plain"><option>--convert</option></arg>
+        <arg choice="plain"><option>--create</option></arg>
+        <arg choice="plain"><option>--del <replaceable>VALUE(S)</replaceable></option></arg>
+        <arg choice="plain">
+            <group choice="opt">
+                <arg choice="plain">
+                    <option>--add
+                     <replaceable>TYPE</replaceable>
+                     <replaceable>ORIG</replaceable>
+                     <replaceable>REPLACE</replaceable>
+                    </option>
+                </arg>
+                <arg choice="plain"><option>--add <replaceable>FILENAME</replaceable></option></arg>
+            </group>
+        </arg>
+        <arg choice="plain"><option>--noout</option></arg>
+        <arg choice="plain"><option>--no-super-update</option></arg>
+        <arg choice="plain">
+            <group choice="opt">
+                <arg choice="plain"><option>-v</option></arg>
+                <arg choice="plain"><option>--verbose</option></arg>
+            </group>
+        </arg>
+    </group>
+    <arg choice="req" rep="norepeat"><replaceable>CATALOGFILE</replaceable></arg>
+    <arg choice="req" rep="repeat"><replaceable>ENTITIES</replaceable></arg>
+    </cmdsynopsis>
 </refsynopsisdiv>
 
 <refsect1 id="description">
-       <title>DESCRIPTION</title>
-       <para>
-               &xmlcatalog; is a command line application allowing users to monitor and
-               manipulate <acronym>XML</acronym> and <acronym>SGML</acronym> catalogs. It
-               is included in <citerefentry>
-                       <refentrytitle>libxml</refentrytitle>
-                       <manvolnum>3</manvolnum>
-               </citerefentry>.
-       </para>
-       <para>
-               Its functions can be invoked from a single command from the command line,
-               or it can perform multiple functions in interactive mode. It can operate
-               on both <acronym>XML</acronym> and <acronym>SGML</acronym> files.
-       </para>
+    <title>DESCRIPTION</title>
+    <para>
+        &xmlcatalog; is a command line application allowing users to monitor and
+        manipulate <acronym>XML</acronym> and <acronym>SGML</acronym> catalogs. It
+        is included in <citerefentry>
+            <refentrytitle>libxml</refentrytitle>
+            <manvolnum>3</manvolnum>
+        </citerefentry>.
+    </para>
+    <para>
+        Its functions can be invoked from a single command from the command line,
+        or it can perform multiple functions in interactive mode. It can operate
+        on both <acronym>XML</acronym> and <acronym>SGML</acronym> files.
+    </para>
 </refsect1>
 
 <refsect1 id="options">
-       <title>OPTIONS</title>
-       <para>
-               &xmlcatalog; accepts the following options (in alphabetical order):
-       </para>
-       
-       <variablelist>
-
-               <varlistentry>
-       <term>
-               <option>--add
-                <replaceable>TYPE</replaceable>
-                <replaceable>ORIG</replaceable>
-                <replaceable>REPLACE</replaceable>
-               </option>
-       </term>
-       <listitem>
-               <para>
-                       Add an entry to <filename>CATALOGFILE</filename>. <replaceable>TYPE</replaceable>
-                       indicates the type of entry. Possible types are: <simplelist type="inline">
-                               <member><parameter>public</parameter></member>
-                               <member><parameter>system</parameter></member>
-                               <member><parameter>uri</parameter></member>
-                               <member><parameter>rewriteSystem</parameter></member>
-                               <member><parameter>rewriteURI</parameter></member>
-                               <member><parameter>delegatePublic</parameter></member>
-                               <member><parameter>delegateSystem</parameter></member>
-                               <member><parameter>delegateURI</parameter></member>
-                               <member><parameter>nextCatalog</parameter></member>
-                       </simplelist>. <replaceable>ORIG</replaceable> is the original
-                       reference to be replaced, and <replaceable>REPLACE</replaceable>
-                       is the <acronym>URI</acronym> of the replacement entity to be
-                       used. The <option>--add</option> option will not overwrite
-                       <filename>CATALOGFILE</filename>, outputting
-                       to <filename class="devicefile">stdout</filename>, unless
-                       <option>--noout</option> is used. The <option>--add</option> will
-                       always take three parameters even if some of the <acronym>XML</acronym>
-                       catalog constructs will have only a single argument.
-               </para>
-               <!--
-                       FIXME - Is my list of possible types correct? Are SGML types the same?
-               -->
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--add <replaceable>FILENAME</replaceable></option></term>
-       <listitem>
-               <para>
-                       If the <option>--add</option> option is used following
-                       the <option>--sgml</option> option, only a single argument,
-                       a <replaceable>FILENAME</replaceable>, is used. This is used to add
-                       the name of a catalog file to an <acronym>SGML</acronym> supercatalog,
-                       a file that contains references to other included <acronym>SGML</acronym>
-                       catalog files.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--create</option></term>
-       <listitem>
-               <para>
-                       Create a new <acronym>XML</acronym> catalog. Outputs
-                       to <filename class="devicefile">stdout</filename>,
-                       ignoring <replaceable>filename</replaceable> unless <option>--noout</option> is
-                       used, in which case it creates a new catalog
-                       file <replaceable>filename</replaceable>.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--del <replaceable>VALUE(S)</replaceable></option></term>
-       <listitem>
-               <para>
-                       Remove entries from <replaceable>CATALOGFILE</replaceable>
-                       matching <replaceable>VALUE(S)</replaceable>. The <option>--del</option>
-                       option will not overwrite <replaceable>CATALOGFILE</replaceable>,
-                       outputting to <filename class="devicefile">stdout</filename>,
-                       unless <option>--noout</option> is used.
-               </para>
-       </listitem>
-               </varlistentry>
-               
-               <varlistentry>
-       <term><option>--noout</option></term>
-       <listitem>
-               <para>
-                       Save output to the named file rather than outputting
-                       to <filename class="devicefile">stdout</filename>.
-               </para>
-       </listitem>
-               </varlistentry>
-               
-               <varlistentry>
-       <term><option>--no-super-update</option></term>
-       <listitem>
-               <para>
-                       Do not update the <acronym>SGML</acronym> super catalog.
-               </para>
-       </listitem>
-               </varlistentry>
-               
-               <varlistentry>
-       <term><option>--shell</option></term>
-       <listitem>
-               <para>
-                       Run a shell allowing interactive queries on catalog
-                       file <replaceable>CATALOGFILE</replaceable>. For the set of available
-                       commands see <xref linkend="shell"/>.
-               </para>
-       </listitem>
-               </varlistentry>
-               
-               <varlistentry>
-       <term><option>--sgml</option></term>
-       <listitem>
-               <para>
-                       Uses <acronym>SGML</acronym> super catalogs for <option>--add</option>
-                       and <option>--del</option> options.
-               </para>
-       </listitem>
-               </varlistentry>
-               
-               <varlistentry>
-       <term><option>-v</option></term>
-       <term><option>--verbose</option></term>
-       <listitem>
-               <para>Output debugging information.</para>
-       </listitem>
-               </varlistentry>
-       
-       </variablelist>
-
-       <para>
-               Invoking &xmlcatalog; non-interactively without a designated action
-               (imposed with options like <option>--add</option>) will result in a lookup
-               of the catalog entry for <replaceable>ENTITIES</replaceable> in the
-               catalog denoted with <replaceable>CATALOGFILE</replaceable>. The
-               corresponding entries will be output to the command line. This mode of
-               operation, together with <option>--shell</option> mode and non-modifying
-               (i.e. without <option>--noout</option>) direct actions, allows for
-               a special shortcut of the void <replaceable>CATALOGFILE</replaceable>
-               specification (possibly expressed as &quot;&quot; in the shell
-               environment) appointing the default system catalog. That simplifies the
-               handling when its exact location is irrelevant but the respective built-in
-               still needs to be consulted.
-       </para>
+    <title>OPTIONS</title>
+    <para>
+        &xmlcatalog; accepts the following options (in alphabetical order):
+    </para>
+
+    <variablelist>
+
+        <varlistentry>
+            <term>
+                <option>--add
+                 <replaceable>TYPE</replaceable>
+                 <replaceable>ORIG</replaceable>
+                 <replaceable>REPLACE</replaceable>
+                </option>
+            </term>
+            <listitem>
+                <para>
+                    Add an entry to <filename>CATALOGFILE</filename>. <replaceable>TYPE</replaceable>
+                    indicates the type of entry. Possible types are: <simplelist type="inline">
+                        <member><parameter>public</parameter></member>
+                        <member><parameter>system</parameter></member>
+                        <member><parameter>uri</parameter></member>
+                        <member><parameter>rewriteSystem</parameter></member>
+                        <member><parameter>rewriteURI</parameter></member>
+                        <member><parameter>delegatePublic</parameter></member>
+                        <member><parameter>delegateSystem</parameter></member>
+                        <member><parameter>delegateURI</parameter></member>
+                        <member><parameter>nextCatalog</parameter></member>
+                    </simplelist>. <replaceable>ORIG</replaceable> is the original
+                    reference to be replaced, and <replaceable>REPLACE</replaceable>
+                    is the <acronym>URI</acronym> of the replacement entity to be
+                    used. The <option>--add</option> option will not overwrite
+                    <filename>CATALOGFILE</filename>, outputting
+                    to <filename class="devicefile">stdout</filename>, unless
+                    <option>--noout</option> is used. The <option>--add</option> will
+                    always take three parameters even if some of the <acronym>XML</acronym>
+                    catalog constructs will have only a single argument.
+                </para>
+                <!--
+                    FIXME - Is my list of possible types correct? Are SGML types the same?
+                -->
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--add <replaceable>FILENAME</replaceable></option></term>
+            <listitem>
+                <para>
+                    If the <option>--add</option> option is used following
+                    the <option>--sgml</option> option, only a single argument,
+                    a <replaceable>FILENAME</replaceable>, is used. This is used to add
+                    the name of a catalog file to an <acronym>SGML</acronym> supercatalog,
+                    a file that contains references to other included <acronym>SGML</acronym>
+                    catalog files.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--convert</option></term>
+            <listitem>
+                <para>
+                    Convert SGML catalog to XML.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--create</option></term>
+            <listitem>
+                <para>
+                    Create a new <acronym>XML</acronym> catalog. Outputs
+                    to <filename class="devicefile">stdout</filename>,
+                    ignoring <replaceable>filename</replaceable> unless <option>--noout</option> is
+                    used, in which case it creates a new catalog
+                    file <replaceable>filename</replaceable>.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--del <replaceable>VALUE(S)</replaceable></option></term>
+            <listitem>
+                <para>
+                    Remove entries from <replaceable>CATALOGFILE</replaceable>
+                    matching <replaceable>VALUE(S)</replaceable>. The <option>--del</option>
+                    option will not overwrite <replaceable>CATALOGFILE</replaceable>,
+                    outputting to <filename class="devicefile">stdout</filename>,
+                    unless <option>--noout</option> is used.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--noout</option></term>
+            <listitem>
+                <para>
+                    Save output to the named file rather than outputting
+                    to <filename class="devicefile">stdout</filename>.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--no-super-update</option></term>
+            <listitem>
+                <para>
+                    Do not update the <acronym>SGML</acronym> super catalog.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--shell</option></term>
+            <listitem>
+                <para>
+                    Run a shell allowing interactive queries on catalog
+                    file <replaceable>CATALOGFILE</replaceable>. For the set of available
+                    commands see <xref linkend="shell"/>.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--sgml</option></term>
+            <listitem>
+                <para>
+                    Uses <acronym>SGML</acronym> super catalogs for <option>--add</option>
+                    and <option>--del</option> options.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>-v</option></term>
+            <term><option>--verbose</option></term>
+            <listitem>
+                <para>Output debugging information.</para>
+            </listitem>
+        </varlistentry>
+
+    </variablelist>
+
+    <para>
+        Invoking &xmlcatalog; non-interactively without a designated action
+        (imposed with options like <option>--add</option>) will result in a lookup
+        of the catalog entry for <replaceable>ENTITIES</replaceable> in the
+        catalog denoted with <replaceable>CATALOGFILE</replaceable>. The
+        corresponding entries will be output to the command line. This mode of
+        operation, together with <option>--shell</option> mode and non-modifying
+        (i.e. without <option>--noout</option>) direct actions, allows for
+        a special shortcut of the void <replaceable>CATALOGFILE</replaceable>
+        specification (possibly expressed as &quot;&quot; in the shell
+        environment) appointing the default system catalog. That simplifies the
+        handling when its exact location is irrelevant but the respective built-in
+        still needs to be consulted.
+    </para>
 </refsect1>
 
 <refsect1 id="shell">
-       <title>SHELL COMMANDS</title>
-       <para>
-               Invoking &xmlcatalog; with
-               the <option>--shell <replaceable>CATALOGFILE</replaceable></option> option opens
-               a command line shell allowing interactive access to the catalog file
-               identified by <replaceable>CATALOGFILE</replaceable>. Invoking the shell
-               provides a command line prompt after which the following commands (described in
-               alphabetical order) can be entered.
-       </para>
-       
-       <variablelist>
-
-               <varlistentry>
-       <term>
-               <option>add
-                <replaceable>TYPE</replaceable>
-                <replaceable>ORIG</replaceable>
-                <replaceable>REPLACE</replaceable>
-               </option>
-       </term>
-       <listitem>
-               <para>
-                       Add an entry to the catalog file. <replaceable>TYPE</replaceable>
-                       indicates the type of entry. Possible types are: <simplelist type="inline">
-                               <member><parameter>public</parameter></member>
-                               <member><parameter>system</parameter></member>
-                               <member><parameter>uri</parameter></member>
-                               <member><parameter>rewriteSystem</parameter></member>
-                               <member><parameter>rewriteURI</parameter></member>
-                               <member><parameter>delegatePublic</parameter></member>
-                               <member><parameter>delegateSystem</parameter></member>
-                               <member><parameter>delegateURI</parameter></member>
-                               <member><parameter>nextCatalog</parameter></member>
-                       </simplelist>. <replaceable>ORIG</replaceable> is the original
-                       reference to be replaced, and <replaceable>REPLACE</replaceable>
-                       is the <acronym>URI</acronym> of the replacement entity to be
-                       used. The <option>--add</option> option will not overwrite
-                       <filename>CATALOGFILE</filename>, outputting
-                       to <filename class="devicefile">stdout</filename>, unless
-                       <option>--noout</option> is used. The <option>--add</option> will
-                       always take three parameters even if some of the <acronym>XML</acronym>
-                       catalog constructs will have only a single argument.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>debug</option></term>
-       <listitem>
-               <para>
-                       Print debugging statements showing the steps &xmlcatalog; is executing.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>del <replaceable>VALUE(S)</replaceable></option></term>
-       <listitem>
-               <para>
-                       Remove the catalog entry corresponding to <replaceable>VALUE(S)</replaceable>.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>dump</option></term>
-       <listitem>
-               <para>Print the current catalog.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>exit</option></term>
-       <listitem>
-               <para>Quit the shell.</para>
-       </listitem>
-               </varlistentry>
-       
-               <varlistentry>
-       <term><option>public <replaceable>PUBLIC-ID</replaceable></option></term>
-       <listitem>
-               <para>
-                       Execute a Formal Public Identifier lookup of the catalog entry
-                       for <replaceable>PUBLIC-ID</replaceable>. The corresponding entry will be
-                       output to the command line.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>quiet</option></term>
-       <listitem>
-               <para>Stop printing debugging statements.</para>
-       </listitem>
-               </varlistentry>
-               
-               <varlistentry>
-       <term><option>system <replaceable>SYSTEM-ID</replaceable></option></term>
-       <listitem>
-               <para>
-                       Execute a Formal Public Identifier lookup of the catalog entry
-                       for <replaceable>SYSTEM-ID</replaceable>. The corresponding entry will be
-                       output to the command line.
-               </para>
-       </listitem>
-               </varlistentry>
-
-       </variablelist>
+    <title>SHELL COMMANDS</title>
+    <para>
+        Invoking &xmlcatalog; with
+        the <option>--shell <replaceable>CATALOGFILE</replaceable></option> option opens
+        a command line shell allowing interactive access to the catalog file
+        identified by <replaceable>CATALOGFILE</replaceable>. Invoking the shell
+        provides a command line prompt after which the following commands (described in
+        alphabetical order) can be entered.
+    </para>
+
+    <variablelist>
+
+        <varlistentry>
+            <term>
+                <option>add
+                 <replaceable>TYPE</replaceable>
+                 <replaceable>ORIG</replaceable>
+                 <replaceable>REPLACE</replaceable>
+                </option>
+            </term>
+            <listitem>
+                <para>
+                    Add an entry to the catalog file. <replaceable>TYPE</replaceable>
+                    indicates the type of entry. Possible types are: <simplelist type="inline">
+                        <member><parameter>public</parameter></member>
+                        <member><parameter>system</parameter></member>
+                        <member><parameter>uri</parameter></member>
+                        <member><parameter>rewriteSystem</parameter></member>
+                        <member><parameter>rewriteURI</parameter></member>
+                        <member><parameter>delegatePublic</parameter></member>
+                        <member><parameter>delegateSystem</parameter></member>
+                        <member><parameter>delegateURI</parameter></member>
+                        <member><parameter>nextCatalog</parameter></member>
+                    </simplelist>. <replaceable>ORIG</replaceable> is the original
+                    reference to be replaced, and <replaceable>REPLACE</replaceable>
+                    is the <acronym>URI</acronym> of the replacement entity to be
+                    used. The <option>--add</option> option will not overwrite
+                    <filename>CATALOGFILE</filename>, outputting
+                    to <filename class="devicefile">stdout</filename>, unless
+                    <option>--noout</option> is used. The <option>--add</option> will
+                    always take three parameters even if some of the <acronym>XML</acronym>
+                    catalog constructs will have only a single argument.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>debug</option></term>
+            <listitem>
+                <para>
+                    Print debugging statements showing the steps &xmlcatalog; is executing.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>del <replaceable>VALUE(S)</replaceable></option></term>
+            <listitem>
+                <para>
+                    Remove the catalog entry corresponding to <replaceable>VALUE(S)</replaceable>.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>dump</option></term>
+            <listitem>
+                <para>Print the current catalog.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>exit</option></term>
+            <listitem>
+                <para>Quit the shell.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>public <replaceable>PUBLIC-ID</replaceable></option></term>
+            <listitem>
+                <para>
+                    Execute a Formal Public Identifier lookup of the catalog entry
+                    for <replaceable>PUBLIC-ID</replaceable>. The corresponding entry will be
+                    output to the command line.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>quiet</option></term>
+            <listitem>
+                <para>Stop printing debugging statements.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>system <replaceable>SYSTEM-ID</replaceable></option></term>
+            <listitem>
+                <para>
+                    Execute a Formal Public Identifier lookup of the catalog entry
+                    for <replaceable>SYSTEM-ID</replaceable>. The corresponding entry will be
+                    output to the command line.
+                </para>
+            </listitem>
+        </varlistentry>
+
+    </variablelist>
 </refsect1>
 
 <refsect1 id="environment">
-       <title>ENVIRONMENT</title>
-       <variablelist>
-
-               <varlistentry>
-       <term><envar>XML_CATALOG_FILES</envar></term>
-       <listitem>
-               <para><acronym>XML</acronym> catalog behavior can be changed by redirecting
-                       queries to the user's own set of catalogs. This can be done by setting
-                       the <envar>XML_CATALOG_FILES</envar> environment variable to a space-separated
-                       list of catalogs. Use percent-encoding to escape spaces or other characters.
-                       An empty variable should deactivate loading the default <filename>/etc/xml/catalog</filename> catalog.
-               </para>
-       </listitem>
-               </varlistentry>
-
-       </variablelist> 
+    <title>ENVIRONMENT</title>
+    <variablelist>
+
+        <varlistentry>
+            <term><envar>XML_CATALOG_FILES</envar></term>
+            <listitem>
+                <para><acronym>XML</acronym> catalog behavior can be changed by redirecting
+                    queries to the user's own set of catalogs. This can be done by setting
+                    the <envar>XML_CATALOG_FILES</envar> environment variable to a space-separated
+                    list of catalogs. Use percent-encoding to escape spaces or other characters.
+                    An empty variable should deactivate loading the default catalog from
+                    <filename>/etc/xml/catalog</filename> or, more specifically,
+                    <filename>${sysconfdir}/xml/catalog</filename>.
+                </para>
+            </listitem>
+        </varlistentry>
+
+    </variablelist>
 </refsect1>
 
 <refsect1 id="diagnostics">
-       <title>DIAGNOSTICS</title>
-       <para>
-               &xmlcatalog; return codes provide information that can be used when
-               calling it from scripts.
-       </para>
-       <variablelist>
-
-               <varlistentry>
-       <term><errorcode>0</errorcode></term>
-       <listitem>
-               <para>No error</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><errorcode>1</errorcode></term>
-       <listitem>
-               <para>Failed to remove an entry from the catalog</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><errorcode>2</errorcode></term>
-       <listitem>
-               <para>Failed to save to the catalog, check file permissions</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><errorcode>3</errorcode></term>
-       <listitem>
-               <para>Failed to add an entry to the catalog</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><errorcode>4</errorcode></term>
-       <listitem>
-               <para>Failed to look up an entry in the catalog</para>
-       </listitem>
-               </varlistentry>
-
-       </variablelist>
+    <title>DIAGNOSTICS</title>
+    <para>
+        &xmlcatalog; return codes provide information that can be used when
+        calling it from scripts.
+    </para>
+    <variablelist>
+
+        <varlistentry>
+            <term><errorcode>0</errorcode></term>
+            <listitem>
+                <para>No error</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><errorcode>1</errorcode></term>
+            <listitem>
+                <para>Failed to remove an entry from the catalog</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><errorcode>2</errorcode></term>
+            <listitem>
+                <para>Failed to save to the catalog, check file permissions</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><errorcode>3</errorcode></term>
+            <listitem>
+                <para>Failed to add an entry to the catalog</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><errorcode>4</errorcode></term>
+            <listitem>
+                <para>Failed to look up an entry in the catalog</para>
+            </listitem>
+        </varlistentry>
+
+    </variablelist>
 </refsect1>
 
 <refsect1 id="seealso">
-       <title>SEE ALSO</title>
-       <para><citerefentry>
-                       <refentrytitle>libxml</refentrytitle>
-                       <manvolnum>3</manvolnum>
-               </citerefentry>
-       </para>
-       <para>
-               More information can be found at
-               <itemizedlist>
-                       <listitem>
-                               <para><citerefentry>
-                                               <refentrytitle>libxml</refentrytitle>
-                                               <manvolnum>3</manvolnum>
-                                       </citerefentry> web page <ulink url="https://gitlab.gnome.org/GNOME/libxml2"/>
-                               </para>
-                       </listitem>
-                       <listitem>
-                               <para><citerefentry>
-                                               <refentrytitle>libxml</refentrytitle>
-                                               <manvolnum>3</manvolnum>
-                                       </citerefentry> catalog support web page
-                                       at <ulink url="https://gitlab.gnome.org/GNOME/libxml2/-/wikis/Catalog-support"/>
-                               </para>
-                       </listitem>
-                       <listitem>
-                               <para>James Clark's <acronym>SGML</acronym> catalog
-                                       page <ulink url="http://www.jclark.com/sp/catalog.htm"/>
-                               </para>
-                       </listitem>
-                       <listitem>
-                               <para><acronym>OASIS</acronym> <acronym>XML</acronym> catalog specification
-                                       <ulink url="http://www.oasis-open.org/committees/entity/spec.html"/>
-                               </para>
-                       </listitem>
-               </itemizedlist>
-       </para>
+    <title>SEE ALSO</title>
+    <para><citerefentry>
+            <refentrytitle>libxml</refentrytitle>
+            <manvolnum>3</manvolnum>
+        </citerefentry>
+    </para>
+    <para>
+        More information can be found at
+        <itemizedlist>
+            <listitem>
+                <para><citerefentry>
+                        <refentrytitle>libxml</refentrytitle>
+                        <manvolnum>3</manvolnum>
+                    </citerefentry> web page <ulink url="https://gitlab.gnome.org/GNOME/libxml2"/>
+                </para>
+            </listitem>
+            <listitem>
+                <para><citerefentry>
+                        <refentrytitle>libxml</refentrytitle>
+                        <manvolnum>3</manvolnum>
+                    </citerefentry> catalog support web page
+                    at <ulink url="https://gitlab.gnome.org/GNOME/libxml2/-/wikis/Catalog-support"/>
+                </para>
+            </listitem>
+            <listitem>
+                <para>James Clark's <acronym>SGML</acronym> catalog
+                    page <ulink url="http://www.jclark.com/sp/catalog.htm"/>
+                </para>
+            </listitem>
+            <listitem>
+                <para><acronym>OASIS</acronym> <acronym>XML</acronym> catalog specification
+                    <ulink url="http://www.oasis-open.org/committees/entity/spec.html"/>
+                </para>
+            </listitem>
+        </itemizedlist>
+    </para>
 </refsect1>
 
 </refentry>
index 512dfd6..a6b9ba6 100644 (file)
@@ -1,13 +1,13 @@
 '\" t
 .\"     Title: xmllint
 .\"    Author: John Fleck <jfleck@inkstain.net>
-.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
-.\"      Date: 08/17/2022
+.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
+.\"      Date: 04/26/2023
 .\"    Manual: xmllint Manual
 .\"    Source: libxml2
 .\"  Language: English
 .\"
-.TH "XMLLINT" "1" "08/17/2022" "libxml2" "xmllint Manual"
+.TH "XMLLINT" "1" "04/26/2023" "libxml2" "xmllint Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -31,7 +31,7 @@
 xmllint \- command line XML tool
 .SH "SYNOPSIS"
 .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... | \-}
+\fBxmllint\fR [\fB\-\-version\fR | \fB\-\-debug\fR | \fB\-\-quiet\fR | \fB\-\-shell\fR | \fB\-\-xpath\ "\fR\fB\fIXPath_expression\fR\fR\fB"\fR | \fB\-\-debugent\fR | \fB\-\-copy\fR | \fB\-\-recover\fR | \fB\-\-nodict\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 | \fB\-\-pedantic\fR] {\fIXML\-FILE(S)\fR... | \-}
 .HP \w'\fBxmllint\fR\ 'u
 \fBxmllint\fR \fB\-\-help\fR
 .SH "DESCRIPTION"
@@ -72,6 +72,8 @@ catalog(s) from
 XML
 catalogs starting from
 /etc/xml/catalog
+or, more specifically,
+${sysconfdir}/xml/catalog
 are used by default\&.
 .RE
 .PP
@@ -226,6 +228,11 @@ Do not use any catalogs\&.
 Substitute CDATA section by equivalent text nodes\&.
 .RE
 .PP
+\fB\-\-nodict\fR
+.RS 4
+Don\*(Aqt use dictionaries (parser option XML_PARSE_NODICT)\&. Only for debugging\&.
+.RE
+.PP
 \fB\-\-noent\fR
 .RS 4
 Substitute entity values for entity references\&. By default,
@@ -291,6 +298,11 @@ DTDs or entities\&. Enclose space\-separated lists by quotation marks\&.
 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\-\-pedantic\fR
+.RS 4
+Enable additional warnings\&.
+.RE
+.PP
 \fB\-\-postvalid\fR
 .RS 4
 Validate after parsing has completed\&.
@@ -301,6 +313,11 @@ Validate after parsing has completed\&.
 Use the push mode of the parser\&.
 .RE
 .PP
+\fB\-\-quiet\fR
+.RS 4
+Don\*(Aqt print informational messages to stderr\&.
+.RE
+.PP
 \fB\-\-recover\fR
 .RS 4
 Output any parsable portions of an invalid document\&.
@@ -501,9 +518,7 @@ Write the current node to the given filename\&.
 SGML
 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
-/etc/sgml/catalog
-catalog\&.
+environment variable to a list of catalogs\&. An empty one should deactivate loading the default catalog\&.
 .RE
 .PP
 \fBXML_CATALOG_FILES\fR
@@ -511,9 +526,7 @@ catalog\&.
 XML
 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 space\-separated list of catalogs\&. Use percent\-encoding to escape spaces or other characters\&. An empty variable should deactivate loading the default
-/etc/xml/catalog
-catalog\&.
+environment variable to a space\-separated list of catalogs\&. Use percent\-encoding to escape spaces or other characters\&. An empty variable should deactivate loading the default catalog\&.
 .RE
 .PP
 \fBXML_DEBUG_CATALOG\fR
index 8d4400f..9e2e7ce 100644 (file)
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>xmllint</title><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"><a name="idm1"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>xmllint &#8212; command line <acronym class="acronym">XML</acronym> tool</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">xmllint</code>  [ <code class="option">--version</code>  |   <code class="option">--debug</code>  |   <code class="option">--shell</code>  |   <code class="option">--xpath "<em class="replaceable"><code>XPath_expression</code></em>"</code>  |   <code class="option">--debugent</code>  |   <code class="option">--copy</code>  |   <code class="option">--recover</code>  |   <code class="option">--noent</code>  |   <code class="option">--noout</code>  |   <code class="option">--nonet</code>  |   <code class="option">--path "<em class="replaceable"><code>PATH(S)</code></em>"</code>  |   <code class="option">--load-trace</code>  |   <code class="option">--htmlout</code>  |   <code class="option">--nowrap</code>  |   <code class="option">--valid</code>  |   <code class="option">--postvalid</code>  |   <code class="option">--dtdvalid <em class="replaceable"><code>URL</code></em></code>  |   <code class="option">--dtdvalidfpi <em class="replaceable"><code>FPI</code></em></code>  |   <code class="option">--timing</code>  |   <code class="option">--output <em class="replaceable"><code>FILE</code></em></code>  |   <code class="option">--repeat</code>  |   <code class="option">--insert</code>  |   <code class="option">--compress</code>  |   <code class="option">--html</code>  |   <code class="option">--xmlout</code>  |   <code class="option">--push</code>  |   <code class="option">--memory</code>  |   <code class="option">--maxmem <em class="replaceable"><code>NBBYTES</code></em></code>  |   <code class="option">--nowarning</code>  |   <code class="option">--noblanks</code>  |   <code class="option">--nocdata</code>  |   <code class="option">--format</code>  |   <code class="option">--encode <em class="replaceable"><code>ENCODING</code></em></code>  |   <code class="option">--dropdtd</code>  |   <code class="option">--nsclean</code>  |   <code class="option">--testIO</code>  |   <code class="option">--catalogs</code>  |   <code class="option">--nocatalogs</code>  |   <code class="option">--auto</code>  |   <code class="option">--xinclude</code>  |   <code class="option">--noxincludenode</code>  |   <code class="option">--loaddtd</code>  |   <code class="option">--dtdattr</code>  |   <code class="option">--stream</code>  |   <code class="option">--walker</code>  |   <code class="option">--pattern <em class="replaceable"><code>PATTERNVALUE</code></em></code>  |   <code class="option">--chkregister</code>  |   <code class="option">--relaxng <em class="replaceable"><code>SCHEMA</code></em></code>  |   <code class="option">--schema <em class="replaceable"><code>SCHEMA</code></em></code>  |   <code class="option">--c14n</code> ] { <em class="replaceable"><code>XML-FILE(S)</code></em>...  |   - }</p></div><div class="cmdsynopsis"><p><code class="command">xmllint</code>   <code class="option">--help</code> </p></div></div><div class="refsect1"><a name="description"></a><h2>DESCRIPTION</h2><p>
-               The <span class="command"><strong>xmllint</strong></span> program parses one or more <acronym class="acronym">XML</acronym> files,
-               specified on the command line as <em class="replaceable"><code>XML-FILE</code></em>
-               (or the standard input if the filename provided
-               is <span class="bold"><strong>-</strong></span> ). It prints various types of
-               output, depending upon the options selected. It is useful for detecting
-               errors both in <acronym class="acronym">XML</acronym> code and in
-               the <acronym class="acronym">XML</acronym> parser itself.
-       </p><p><span class="command"><strong>xmllint</strong></span> is included in <span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span>.</p></div><div class="refsect1"><a name="options"></a><h2>OPTIONS</h2><p>
-               <span class="command"><strong>xmllint</strong></span> accepts the following options (in alphabetical order):
-       </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">--auto</code></span></dt><dd><p>Generate a small document for testing purposes.</p></dd><dt><span class="term"><code class="option">--catalogs</code></span></dt><dd><p>
-                       Use the <acronym class="acronym">SGML</acronym> catalog(s) from <code class="envar">SGML_CATALOG_FILES</code>.
-                       Otherwise <acronym class="acronym">XML</acronym> catalogs starting
-                       from <code class="filename">/etc/xml/catalog</code> are used by default.
-               </p></dd><dt><span class="term"><code class="option">--chkregister</code></span></dt><dd><p>
-                       Turn on node registration. Useful for developers testing <span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span> node tracking code.
-               </p></dd><dt><span class="term"><code class="option">--compress</code></span></dt><dd><p>
-                       Turn on <span class="citerefentry"><span class="refentrytitle">gzip</span>(1)</span> compression of output.
-               </p></dd><dt><span class="term"><code class="option">--copy</code></span></dt><dd><p>Test the internal copy implementation.</p></dd><dt><span class="term"><code class="option">--c14n</code></span></dt><dd><p>
-                       Use the W3C <acronym class="acronym">XML</acronym> Canonicalisation (<acronym class="acronym">C14N</acronym>) to
-                       serialize the result of parsing to <code class="filename">stdout</code>.
-                       It keeps comments in the result.
-               </p></dd><dt><span class="term"><code class="option">--dtdvalid <em class="replaceable"><code>URL</code></em></code></span></dt><dd><p>
-                       Use the <acronym class="acronym">DTD</acronym> specified by
-                       an <em class="replaceable"><code>URL</code></em> for validation.
-               </p></dd><dt><span class="term"><code class="option">--dtdvalidfpi <em class="replaceable"><code>FPI</code></em></code></span></dt><dd><p>
-                       Use the <acronym class="acronym">DTD</acronym> specified by a Formal Public
-                       Identifier <em class="replaceable"><code>FPI</code></em> for validation, note that this
-                       will require a catalog exporting that Formal Public Identifier to work.
-               </p></dd><dt><span class="term"><code class="option">--debug</code></span></dt><dd><p>
-                       Parse a file and output an annotated tree of the
-                       in-memory version of the document.
-               </p></dd><dt><span class="term"><code class="option">--debugent</code></span></dt><dd><p>Debug the entities defined in the document.</p></dd><dt><span class="term"><code class="option">--dropdtd</code></span></dt><dd><p>Remove <acronym class="acronym">DTD</acronym> from output.</p></dd><dt><span class="term"><code class="option">--dtdattr</code></span></dt><dd><p>
-                       Fetch external <acronym class="acronym">DTD</acronym> and populate the tree with
-                       inherited attributes.
-               </p></dd><dt><span class="term"><code class="option">--encode <em class="replaceable"><code>ENCODING</code></em></code></span></dt><dd><p>Output in the given encoding. Note that this works for full document not fragments or result from XPath queries.</p></dd><dt><span class="term"><code class="option">--format</code></span></dt><dd><p>
-                       Reformat and reindent the output. The <code class="envar">XMLLINT_INDENT</code>
-                       environment variable controls the indentation. The default value is two
-                       spaces "  ").
-               </p></dd><dt><span class="term"><code class="option">--help</code></span></dt><dd><p>Print out a short usage summary for <span class="command"><strong>xmllint</strong></span>.</p></dd><dt><span class="term"><code class="option">--html</code></span></dt><dd><p>Use the <acronym class="acronym">HTML</acronym> parser.</p></dd><dt><span class="term"><code class="option">--htmlout</code></span></dt><dd><p>
-                       Output results as an <acronym class="acronym">HTML</acronym> file. This
-                       causes <span class="command"><strong>xmllint</strong></span> to output the necessary <acronym class="acronym">HTML</acronym>
-                       tags surrounding the result tree output so the results can be
-                       displayed/viewed in a browser.
-               </p></dd><dt><span class="term"><code class="option">--insert</code></span></dt><dd><p>Test for valid insertions.</p></dd><dt><span class="term"><code class="option">--loaddtd</code></span></dt><dd><p>Fetch an external <acronym class="acronym">DTD</acronym>.</p></dd><dt><span class="term"><code class="option">--load-trace</code></span></dt><dd><p>
-                       Display all the documents loaded during the processing
-                       to <code class="filename">stderr</code>.
-               </p></dd><dt><span class="term"><code class="option">--maxmem <em class="replaceable"><code>NNBYTES</code></em></code></span></dt><dd><p>
-                       Test the parser memory support. <em class="replaceable"><code>NNBYTES</code></em>
-                       is the maximum number of bytes the library is allowed to allocate.
-                       This can also be used to make sure batch processing
-                       of <acronym class="acronym">XML</acronym> files will not exhaust the virtual memory
-                       of the server running them.
-               </p></dd><dt><span class="term"><code class="option">--memory</code></span></dt><dd><p>Parse from memory.</p></dd><dt><span class="term"><code class="option">--noblanks</code></span></dt><dd><p>Drop ignorable blank spaces.</p></dd><dt><span class="term"><code class="option">--nocatalogs</code></span></dt><dd><p>Do not use any catalogs.</p></dd><dt><span class="term"><code class="option">--nocdata</code></span></dt><dd><p>Substitute CDATA section by equivalent text nodes.</p></dd><dt><span class="term"><code class="option">--noent</code></span></dt><dd><p>
-                       Substitute entity values for entity references. By default, <span class="command"><strong>xmllint</strong></span>
-                       leaves entity references in place.
-               </p></dd><dt><span class="term"><code class="option">--nonet</code></span></dt><dd><p>
-                       Do not use the Internet to fetch <acronym class="acronym">DTD</acronym>s or entities.
-               </p></dd><dt><span class="term"><code class="option">--noout</code></span></dt><dd><p>
-                       Suppress output. By default, <span class="command"><strong>xmllint</strong></span> outputs the result tree.
-               </p></dd><dt><span class="term"><code class="option">--nowarning</code></span></dt><dd><p>Do not emit warnings from the parser and/or validator.</p></dd><dt><span class="term"><code class="option">--nowrap</code></span></dt><dd><p>Do not output <acronym class="acronym">HTML</acronym> doc wrapper.</p></dd><dt><span class="term"><code class="option">--noxincludenode</code></span></dt><dd><p>
-                       Do XInclude processing but do not generate XInclude start and end nodes.
-               </p></dd><dt><span class="term"><code class="option">--nsclean</code></span></dt><dd><p>Remove redundant namespace declarations.</p></dd><dt><span class="term"><code class="option">--output <em class="replaceable"><code>FILE</code></em></code></span></dt><dd><p>
-                       Define a file path where <span class="command"><strong>xmllint</strong></span> will save the result of parsing.
-                       Usually the programs build a tree and save it
-                       on <code class="filename">stdout</code>, with this option
-                       the result <acronym class="acronym">XML</acronym> instance will be saved onto a file.
-               </p></dd><dt><span class="term"><code class="option">--path "<em class="replaceable"><code>PATH(S)</code></em>"</code></span></dt><dd><p>
-                       Use the (space- or colon-separated) list of filesystem paths specified
-                       by <em class="replaceable"><code>PATHS</code></em> to load <acronym class="acronym">DTD</acronym>s or
-                       entities. Enclose space-separated lists by quotation marks.
-               </p></dd><dt><span class="term"><code class="option">--pattern <em class="replaceable"><code>PATTERNVALUE</code></em></code></span></dt><dd><p>
-                       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.
-               </p></dd><dt><span class="term"><code class="option">--postvalid</code></span></dt><dd><p>Validate after parsing has completed.</p></dd><dt><span class="term"><code class="option">--push</code></span></dt><dd><p>Use the push mode of the parser.</p></dd><dt><span class="term"><code class="option">--recover</code></span></dt><dd><p>Output any parsable portions of an invalid document.</p></dd><dt><span class="term"><code class="option">--relaxng <em class="replaceable"><code>SCHEMA</code></em></code></span></dt><dd><p>
-                       Use RelaxNG file named <em class="replaceable"><code>SCHEMA</code></em>
-                       for validation.
-               </p></dd><dt><span class="term"><code class="option">--repeat</code></span></dt><dd><p>Repeat 100 times, for timing or profiling.</p></dd><dt><span class="term"><code class="option">--schema <em class="replaceable"><code>SCHEMA</code></em></code></span></dt><dd><p>
-                       Use a W3C <acronym class="acronym">XML</acronym> Schema file
-                       named <em class="replaceable"><code>SCHEMA</code></em> for validation.
-               </p></dd><dt><span class="term"><code class="option">--shell</code></span></dt><dd><p>
-                       Run a navigating shell. Details on available commands in shell mode
-                       are below (see <a class="xref" href="#shell" title="SHELL COMMANDS">the section called &#8220;SHELL COMMANDS&#8221;</a>).
-               </p></dd><dt><span class="term"><code class="option">--xpath "<em class="replaceable"><code>XPath_expression</code></em>"</code></span></dt><dd><p>
-                       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.
-               </p></dd><dt><span class="term"><code class="option">--stream</code></span></dt><dd><p>
-                       Use streaming <acronym class="acronym">API</acronym> - useful when used in combination
-                       with <code class="option">--relaxng</code> or <code class="option">--valid</code> options
-                       for validation of files that are too large to be held in memory.
-               </p></dd><dt><span class="term"><code class="option">--testIO</code></span></dt><dd><p>Test user input/output support.</p></dd><dt><span class="term"><code class="option">--timing</code></span></dt><dd><p>
-                       Output information about the time it takes <span class="command"><strong>xmllint</strong></span> to perform the
-                       various steps.
-               </p></dd><dt><span class="term"><code class="option">--valid</code></span></dt><dd><p>
-                       Determine if the document is a valid instance of the included
-                       Document Type Definition (<acronym class="acronym">DTD</acronym>).
-                       A <acronym class="acronym">DTD</acronym> to be validated against also can be
-                       specified at the command line using the <code class="option">--dtdvalid</code>
-                       option. By default, <span class="command"><strong>xmllint</strong></span> also checks to determine if the
-                       document is well-formed.
-               </p></dd><dt><span class="term"><code class="option">--version</code></span></dt><dd><p>
-                       Display the version of <span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span> used.
-               </p></dd><dt><span class="term"><code class="option">--walker</code></span></dt><dd><p>
-                       Test the walker module, which is a reader interface but for a
-                       document tree, instead of using the reader <acronym class="acronym">API</acronym> on
-                       an unparsed document it works on an existing in-memory tree. Used for
-                       debugging.
-               </p></dd><dt><span class="term"><code class="option">--xinclude</code></span></dt><dd><p>Do XInclude processing.</p></dd><dt><span class="term"><code class="option">--xmlout</code></span></dt><dd><p>
-                       Used in conjunction with <code class="option">--html</code>. Usually
-                       when <acronym class="acronym">HTML</acronym> is parsed the document is saved with
-                       the <acronym class="acronym">HTML</acronym> serializer. But with this option the
-                       resulting document is saved with the <acronym class="acronym">XML</acronym>
-                       serializer. This is primarily used to
-                       generate <acronym class="acronym">XHTML</acronym> from <acronym class="acronym">HTML</acronym> input.
-               </p></dd></dl></div></div><div class="refsect1"><a name="shell"></a><h2>SHELL COMMANDS</h2><p>
-               <span class="command"><strong>xmllint</strong></span> offers an interactive shell mode invoked with
-               the <code class="option">--shell</code> command. Available commands in shell mode
-               include (in alphabetical order):
-       </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="command"><strong>base</strong></span></span></dt><dd><p>Display <acronym class="acronym">XML</acronym> base of the node.</p></dd><dt><span class="term"><span class="command"><strong>bye</strong></span></span></dt><dd><p>Leave the shell.</p></dd><dt><span class="term"><span class="command"><strong>cat <em class="replaceable"><code>NODE</code></em></strong></span></span></dt><dd><p>Display the given node or the current one.</p></dd><dt><span class="term"><span class="command"><strong>cd <em class="replaceable"><code>PATH</code></em></strong></span></span></dt><dd><p>
-                       Change the current node to the given path (if unique) or root if no
-                       argument is given.
-               </p></dd><dt><span class="term"><span class="command"><strong>dir <em class="replaceable"><code>PATH</code></em></strong></span></span></dt><dd><p>
-                       Dumps information about the node (namespace, attributes, content).
-               </p></dd><dt><span class="term"><span class="command"><strong>du <em class="replaceable"><code>PATH</code></em></strong></span></span></dt><dd><p>
-                       Show the structure of the subtree under the given path or the current node.
-               </p></dd><dt><span class="term"><span class="command"><strong>exit</strong></span></span></dt><dd><p>Leave the shell.</p></dd><dt><span class="term"><span class="command"><strong>help</strong></span></span></dt><dd><p>Show this help.</p></dd><dt><span class="term"><span class="command"><strong>free</strong></span></span></dt><dd><p>Display memory usage.</p></dd><dt><span class="term"><span class="command"><strong>load <em class="replaceable"><code>FILENAME</code></em></strong></span></span></dt><dd><p>Load a new document with the given filename.</p></dd><dt><span class="term"><span class="command"><strong>ls <em class="replaceable"><code>PATH</code></em></strong></span></span></dt><dd><p>List contents of the given path or the current directory.</p></dd><dt><span class="term"><span class="command"><strong>pwd</strong></span></span></dt><dd><p>Display the path to the current node.</p></dd><dt><span class="term"><span class="command"><strong>quit</strong></span></span></dt><dd><p>Leave the shell.</p></dd><dt><span class="term"><span class="command"><strong>save <em class="replaceable"><code>FILENAME</code></em></strong></span></span></dt><dd><p>
-                       Save the current document to the given filename or to the original name.
-               </p></dd><dt><span class="term"><code class="option">validate</code></span></dt><dd><p>Check the document for errors.</p></dd><dt><span class="term"><span class="command"><strong>write <em class="replaceable"><code>FILENAME</code></em></strong></span></span></dt><dd><p>Write the current node to the given filename.</p></dd></dl></div></div><div class="refsect1"><a name="environment"></a><h2>ENVIRONMENT</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">SGML_CATALOG_FILES</code></span></dt><dd><p><acronym class="acronym">SGML</acronym> catalog behavior can be changed by redirecting
-                       queries to the user's own set of catalogs. This can be done by setting
-                       the <code class="envar">SGML_CATALOG_FILES</code> environment variable to a list
-                       of catalogs. An empty one should deactivate loading the
-                       default <code class="filename">/etc/sgml/catalog</code> catalog.
-               </p></dd><dt><span class="term"><code class="envar">XML_CATALOG_FILES</code></span></dt><dd><p><acronym class="acronym">XML</acronym> catalog behavior can be changed by redirecting
-                       queries to the user's own set of catalogs. This can be done by setting
-                       the <code class="envar">XML_CATALOG_FILES</code> environment variable to a space-separated
-                       list of catalogs. Use percent-encoding to escape spaces or other characters.
-                       An empty variable should deactivate loading the default <code class="filename">/etc/xml/catalog</code> catalog.
-               </p></dd><dt><span class="term"><code class="envar">XML_DEBUG_CATALOG</code></span></dt><dd><p>Setting the environment variable <code class="envar">XML_DEBUG_CATALOG</code>
-                       to <em class="parameter"><code>non-zero</code></em> using the <span class="command"><strong>export</strong></span>
-                       command outputs debugging information related to catalog operations.
-               </p></dd><dt><span class="term"><code class="envar">XMLLINT_INDENT</code></span></dt><dd><p>Setting the environment variable <code class="envar">XMLLINT_INDENT</code>
-                       controls the indentation. The default value is two spaces "  ".
-               </p></dd></dl></div></div><div class="refsect1"><a name="diagnostics"></a><h2>DIAGNOSTICS</h2><p>
-               <span class="command"><strong>xmllint</strong></span> return codes provide information that can be used when
-               calling it from scripts.
-       </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="errorcode">0</span></span></dt><dd><p>No error</p></dd><dt><span class="term"><span class="errorcode">1</span></span></dt><dd><p>Unclassified</p></dd><dt><span class="term"><span class="errorcode">2</span></span></dt><dd><p>Error in <acronym class="acronym">DTD</acronym></p></dd><dt><span class="term"><span class="errorcode">3</span></span></dt><dd><p>Validation error</p></dd><dt><span class="term"><span class="errorcode">4</span></span></dt><dd><p>Validation error</p></dd><dt><span class="term"><span class="errorcode">5</span></span></dt><dd><p>Error in schema compilation</p></dd><dt><span class="term"><span class="errorcode">6</span></span></dt><dd><p>Error writing output</p></dd><dt><span class="term"><span class="errorcode">7</span></span></dt><dd><p>
-                       Error in pattern (generated when <code class="option">--pattern</code> option is used)
-               </p></dd><dt><span class="term"><span class="errorcode">8</span></span></dt><dd><p>
-                       Error in Reader registration (generated
-                       when <code class="option">--chkregister</code> option is used)
-               </p></dd><dt><span class="term"><span class="errorcode">9</span></span></dt><dd><p>Out of memory error</p></dd><dt><span class="term"><span class="errorcode">10</span></span></dt><dd><p>XPath evaluation error</p></dd></dl></div></div><div class="refsect1"><a name="seealso"></a><h2>SEE ALSO</h2><p><span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span>
-       </p><p>
-               More information can be found at
-               </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span> web page <a class="ulink" href="https://gitlab.gnome.org/GNOME/libxml2" target="_top">https://gitlab.gnome.org/GNOME/libxml2</a>
-                               </p></li></ul></div><p>
-       </p></div></div></body></html>
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>xmllint</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"><a name="idm1"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>xmllint &#8212; command line <acronym class="acronym">XML</acronym> tool</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">xmllint</code>  [ <code class="option">--version</code>  |   <code class="option">--debug</code>  |   <code class="option">--quiet</code>  |   <code class="option">--shell</code>  |   <code class="option">--xpath "<em class="replaceable"><code>XPath_expression</code></em>"</code>  |   <code class="option">--debugent</code>  |   <code class="option">--copy</code>  |   <code class="option">--recover</code>  |   <code class="option">--nodict</code>  |   <code class="option">--noent</code>  |   <code class="option">--noout</code>  |   <code class="option">--nonet</code>  |   <code class="option">--path "<em class="replaceable"><code>PATH(S)</code></em>"</code>  |   <code class="option">--load-trace</code>  |   <code class="option">--htmlout</code>  |   <code class="option">--nowrap</code>  |   <code class="option">--valid</code>  |   <code class="option">--postvalid</code>  |   <code class="option">--dtdvalid <em class="replaceable"><code>URL</code></em></code>  |   <code class="option">--dtdvalidfpi <em class="replaceable"><code>FPI</code></em></code>  |   <code class="option">--timing</code>  |   <code class="option">--output <em class="replaceable"><code>FILE</code></em></code>  |   <code class="option">--repeat</code>  |   <code class="option">--insert</code>  |   <code class="option">--compress</code>  |   <code class="option">--html</code>  |   <code class="option">--xmlout</code>  |   <code class="option">--push</code>  |   <code class="option">--memory</code>  |   <code class="option">--maxmem <em class="replaceable"><code>NBBYTES</code></em></code>  |   <code class="option">--nowarning</code>  |   <code class="option">--noblanks</code>  |   <code class="option">--nocdata</code>  |   <code class="option">--format</code>  |   <code class="option">--encode <em class="replaceable"><code>ENCODING</code></em></code>  |   <code class="option">--dropdtd</code>  |   <code class="option">--nsclean</code>  |   <code class="option">--testIO</code>  |   <code class="option">--catalogs</code>  |   <code class="option">--nocatalogs</code>  |   <code class="option">--auto</code>  |   <code class="option">--xinclude</code>  |   <code class="option">--noxincludenode</code>  |   <code class="option">--loaddtd</code>  |   <code class="option">--dtdattr</code>  |   <code class="option">--stream</code>  |   <code class="option">--walker</code>  |   <code class="option">--pattern <em class="replaceable"><code>PATTERNVALUE</code></em></code>  |   <code class="option">--chkregister</code>  |   <code class="option">--relaxng <em class="replaceable"><code>SCHEMA</code></em></code>  |   <code class="option">--schema <em class="replaceable"><code>SCHEMA</code></em></code>  |   <code class="option">--c14n</code>  |   <code class="option">--pedantic</code> ] { <em class="replaceable"><code>XML-FILE(S)</code></em>...  |   - }</p></div><div class="cmdsynopsis"><p><code class="command">xmllint</code>   <code class="option">--help</code> </p></div></div><div class="refsect1"><a name="description"></a><h2>DESCRIPTION</h2><p>
+        The <span class="command"><strong>xmllint</strong></span> program parses one or more <acronym class="acronym">XML</acronym> files,
+        specified on the command line as <em class="replaceable"><code>XML-FILE</code></em>
+        (or the standard input if the filename provided
+        is <span class="bold"><strong>-</strong></span> ). It prints various types of
+        output, depending upon the options selected. It is useful for detecting
+        errors both in <acronym class="acronym">XML</acronym> code and in
+        the <acronym class="acronym">XML</acronym> parser itself.
+    </p><p><span class="command"><strong>xmllint</strong></span> is included in <span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span>.</p></div><div class="refsect1"><a name="options"></a><h2>OPTIONS</h2><p>
+        <span class="command"><strong>xmllint</strong></span> accepts the following options (in alphabetical order):
+    </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">--auto</code></span></dt><dd><p>Generate a small document for testing purposes.</p></dd><dt><span class="term"><code class="option">--catalogs</code></span></dt><dd><p>
+                    Use the <acronym class="acronym">SGML</acronym> catalog(s) from <code class="envar">SGML_CATALOG_FILES</code>.
+                    Otherwise <acronym class="acronym">XML</acronym> catalogs starting
+                    from <code class="filename">/etc/xml/catalog</code> or, more specifically,
+                    <code class="filename">${sysconfdir}/xml/catalog</code> are used by default.
+                </p></dd><dt><span class="term"><code class="option">--chkregister</code></span></dt><dd><p>
+                    Turn on node registration. Useful for developers testing <span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span> node tracking code.
+                </p></dd><dt><span class="term"><code class="option">--compress</code></span></dt><dd><p>
+                    Turn on <span class="citerefentry"><span class="refentrytitle">gzip</span>(1)</span> compression of output.
+                </p></dd><dt><span class="term"><code class="option">--copy</code></span></dt><dd><p>Test the internal copy implementation.</p></dd><dt><span class="term"><code class="option">--c14n</code></span></dt><dd><p>
+                    Use the W3C <acronym class="acronym">XML</acronym> Canonicalisation (<acronym class="acronym">C14N</acronym>) to
+                    serialize the result of parsing to <code class="filename">stdout</code>.
+                    It keeps comments in the result.
+                </p></dd><dt><span class="term"><code class="option">--dtdvalid <em class="replaceable"><code>URL</code></em></code></span></dt><dd><p>
+                    Use the <acronym class="acronym">DTD</acronym> specified by
+                    an <em class="replaceable"><code>URL</code></em> for validation.
+                </p></dd><dt><span class="term"><code class="option">--dtdvalidfpi <em class="replaceable"><code>FPI</code></em></code></span></dt><dd><p>
+                    Use the <acronym class="acronym">DTD</acronym> specified by a Formal Public
+                    Identifier <em class="replaceable"><code>FPI</code></em> for validation, note that this
+                    will require a catalog exporting that Formal Public Identifier to work.
+                </p></dd><dt><span class="term"><code class="option">--debug</code></span></dt><dd><p>
+                    Parse a file and output an annotated tree of the
+                    in-memory version of the document.
+                </p></dd><dt><span class="term"><code class="option">--debugent</code></span></dt><dd><p>Debug the entities defined in the document.</p></dd><dt><span class="term"><code class="option">--dropdtd</code></span></dt><dd><p>Remove <acronym class="acronym">DTD</acronym> from output.</p></dd><dt><span class="term"><code class="option">--dtdattr</code></span></dt><dd><p>
+                    Fetch external <acronym class="acronym">DTD</acronym> and populate the tree with
+                    inherited attributes.
+                </p></dd><dt><span class="term"><code class="option">--encode <em class="replaceable"><code>ENCODING</code></em></code></span></dt><dd><p>Output in the given encoding. Note that this works for full document not fragments or result from XPath queries.</p></dd><dt><span class="term"><code class="option">--format</code></span></dt><dd><p>
+                    Reformat and reindent the output. The <code class="envar">XMLLINT_INDENT</code>
+                    environment variable controls the indentation. The default value is two
+                    spaces "  ").
+                </p></dd><dt><span class="term"><code class="option">--help</code></span></dt><dd><p>Print out a short usage summary for <span class="command"><strong>xmllint</strong></span>.</p></dd><dt><span class="term"><code class="option">--html</code></span></dt><dd><p>Use the <acronym class="acronym">HTML</acronym> parser.</p></dd><dt><span class="term"><code class="option">--htmlout</code></span></dt><dd><p>
+                    Output results as an <acronym class="acronym">HTML</acronym> file. This
+                    causes <span class="command"><strong>xmllint</strong></span> to output the necessary <acronym class="acronym">HTML</acronym>
+                    tags surrounding the result tree output so the results can be
+                    displayed/viewed in a browser.
+                </p></dd><dt><span class="term"><code class="option">--insert</code></span></dt><dd><p>Test for valid insertions.</p></dd><dt><span class="term"><code class="option">--loaddtd</code></span></dt><dd><p>Fetch an external <acronym class="acronym">DTD</acronym>.</p></dd><dt><span class="term"><code class="option">--load-trace</code></span></dt><dd><p>
+                    Display all the documents loaded during the processing
+                    to <code class="filename">stderr</code>.
+                </p></dd><dt><span class="term"><code class="option">--maxmem <em class="replaceable"><code>NNBYTES</code></em></code></span></dt><dd><p>
+                    Test the parser memory support. <em class="replaceable"><code>NNBYTES</code></em>
+                    is the maximum number of bytes the library is allowed to allocate.
+                    This can also be used to make sure batch processing
+                    of <acronym class="acronym">XML</acronym> files will not exhaust the virtual memory
+                    of the server running them.
+                </p></dd><dt><span class="term"><code class="option">--memory</code></span></dt><dd><p>Parse from memory.</p></dd><dt><span class="term"><code class="option">--noblanks</code></span></dt><dd><p>Drop ignorable blank spaces.</p></dd><dt><span class="term"><code class="option">--nocatalogs</code></span></dt><dd><p>Do not use any catalogs.</p></dd><dt><span class="term"><code class="option">--nocdata</code></span></dt><dd><p>Substitute CDATA section by equivalent text nodes.</p></dd><dt><span class="term"><code class="option">--nodict</code></span></dt><dd><p>
+                    Don't use dictionaries (parser option XML_PARSE_NODICT).
+                    Only for debugging.
+                </p></dd><dt><span class="term"><code class="option">--noent</code></span></dt><dd><p>
+                    Substitute entity values for entity references. By default, <span class="command"><strong>xmllint</strong></span>
+                    leaves entity references in place.
+                </p></dd><dt><span class="term"><code class="option">--nonet</code></span></dt><dd><p>
+                    Do not use the Internet to fetch <acronym class="acronym">DTD</acronym>s or entities.
+                </p></dd><dt><span class="term"><code class="option">--noout</code></span></dt><dd><p>
+                    Suppress output. By default, <span class="command"><strong>xmllint</strong></span> outputs the result tree.
+                </p></dd><dt><span class="term"><code class="option">--nowarning</code></span></dt><dd><p>Do not emit warnings from the parser and/or validator.</p></dd><dt><span class="term"><code class="option">--nowrap</code></span></dt><dd><p>Do not output <acronym class="acronym">HTML</acronym> doc wrapper.</p></dd><dt><span class="term"><code class="option">--noxincludenode</code></span></dt><dd><p>
+                    Do XInclude processing but do not generate XInclude start and end nodes.
+                </p></dd><dt><span class="term"><code class="option">--nsclean</code></span></dt><dd><p>Remove redundant namespace declarations.</p></dd><dt><span class="term"><code class="option">--output <em class="replaceable"><code>FILE</code></em></code></span></dt><dd><p>
+                    Define a file path where <span class="command"><strong>xmllint</strong></span> will save the result of parsing.
+                    Usually the programs build a tree and save it
+                    on <code class="filename">stdout</code>, with this option
+                    the result <acronym class="acronym">XML</acronym> instance will be saved onto a file.
+                </p></dd><dt><span class="term"><code class="option">--path "<em class="replaceable"><code>PATH(S)</code></em>"</code></span></dt><dd><p>
+                    Use the (space- or colon-separated) list of filesystem paths specified
+                    by <em class="replaceable"><code>PATHS</code></em> to load <acronym class="acronym">DTD</acronym>s or
+                    entities. Enclose space-separated lists by quotation marks.
+                </p></dd><dt><span class="term"><code class="option">--pattern <em class="replaceable"><code>PATTERNVALUE</code></em></code></span></dt><dd><p>
+                    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.
+                </p></dd><dt><span class="term"><code class="option">--pedantic</code></span></dt><dd><p>Enable additional warnings.</p></dd><dt><span class="term"><code class="option">--postvalid</code></span></dt><dd><p>Validate after parsing has completed.</p></dd><dt><span class="term"><code class="option">--push</code></span></dt><dd><p>Use the push mode of the parser.</p></dd><dt><span class="term"><code class="option">--quiet</code></span></dt><dd><p>Don't print informational messages to stderr.</p></dd><dt><span class="term"><code class="option">--recover</code></span></dt><dd><p>Output any parsable portions of an invalid document.</p></dd><dt><span class="term"><code class="option">--relaxng <em class="replaceable"><code>SCHEMA</code></em></code></span></dt><dd><p>
+                    Use RelaxNG file named <em class="replaceable"><code>SCHEMA</code></em>
+                    for validation.
+                </p></dd><dt><span class="term"><code class="option">--repeat</code></span></dt><dd><p>Repeat 100 times, for timing or profiling.</p></dd><dt><span class="term"><code class="option">--schema <em class="replaceable"><code>SCHEMA</code></em></code></span></dt><dd><p>
+                    Use a W3C <acronym class="acronym">XML</acronym> Schema file
+                    named <em class="replaceable"><code>SCHEMA</code></em> for validation.
+                </p></dd><dt><span class="term"><code class="option">--shell</code></span></dt><dd><p>
+                    Run a navigating shell. Details on available commands in shell mode
+                    are below (see <a class="xref" href="#shell" title="SHELL COMMANDS">the section called &#8220;SHELL COMMANDS&#8221;</a>).
+                </p></dd><dt><span class="term"><code class="option">--xpath "<em class="replaceable"><code>XPath_expression</code></em>"</code></span></dt><dd><p>
+                    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.
+                </p></dd><dt><span class="term"><code class="option">--stream</code></span></dt><dd><p>
+                    Use streaming <acronym class="acronym">API</acronym> - useful when used in combination
+                    with <code class="option">--relaxng</code> or <code class="option">--valid</code> options
+                    for validation of files that are too large to be held in memory.
+                </p></dd><dt><span class="term"><code class="option">--testIO</code></span></dt><dd><p>Test user input/output support.</p></dd><dt><span class="term"><code class="option">--timing</code></span></dt><dd><p>
+                    Output information about the time it takes <span class="command"><strong>xmllint</strong></span> to perform the
+                    various steps.
+                </p></dd><dt><span class="term"><code class="option">--valid</code></span></dt><dd><p>
+                    Determine if the document is a valid instance of the included
+                    Document Type Definition (<acronym class="acronym">DTD</acronym>).
+                    A <acronym class="acronym">DTD</acronym> to be validated against also can be
+                    specified at the command line using the <code class="option">--dtdvalid</code>
+                    option. By default, <span class="command"><strong>xmllint</strong></span> also checks to determine if the
+                    document is well-formed.
+                </p></dd><dt><span class="term"><code class="option">--version</code></span></dt><dd><p>
+                    Display the version of <span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span> used.
+                </p></dd><dt><span class="term"><code class="option">--walker</code></span></dt><dd><p>
+                    Test the walker module, which is a reader interface but for a
+                    document tree, instead of using the reader <acronym class="acronym">API</acronym> on
+                    an unparsed document it works on an existing in-memory tree. Used for
+                    debugging.
+                </p></dd><dt><span class="term"><code class="option">--xinclude</code></span></dt><dd><p>Do XInclude processing.</p></dd><dt><span class="term"><code class="option">--xmlout</code></span></dt><dd><p>
+                    Used in conjunction with <code class="option">--html</code>. Usually
+                    when <acronym class="acronym">HTML</acronym> is parsed the document is saved with
+                    the <acronym class="acronym">HTML</acronym> serializer. But with this option the
+                    resulting document is saved with the <acronym class="acronym">XML</acronym>
+                    serializer. This is primarily used to
+                    generate <acronym class="acronym">XHTML</acronym> from <acronym class="acronym">HTML</acronym> input.
+                </p></dd></dl></div></div><div class="refsect1"><a name="shell"></a><h2>SHELL COMMANDS</h2><p>
+        <span class="command"><strong>xmllint</strong></span> offers an interactive shell mode invoked with
+        the <code class="option">--shell</code> command. Available commands in shell mode
+        include (in alphabetical order):
+    </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="command"><strong>base</strong></span></span></dt><dd><p>Display <acronym class="acronym">XML</acronym> base of the node.</p></dd><dt><span class="term"><span class="command"><strong>bye</strong></span></span></dt><dd><p>Leave the shell.</p></dd><dt><span class="term"><span class="command"><strong>cat <em class="replaceable"><code>NODE</code></em></strong></span></span></dt><dd><p>Display the given node or the current one.</p></dd><dt><span class="term"><span class="command"><strong>cd <em class="replaceable"><code>PATH</code></em></strong></span></span></dt><dd><p>
+                    Change the current node to the given path (if unique) or root if no
+                    argument is given.
+                </p></dd><dt><span class="term"><span class="command"><strong>dir <em class="replaceable"><code>PATH</code></em></strong></span></span></dt><dd><p>
+                    Dumps information about the node (namespace, attributes, content).
+                </p></dd><dt><span class="term"><span class="command"><strong>du <em class="replaceable"><code>PATH</code></em></strong></span></span></dt><dd><p>
+                    Show the structure of the subtree under the given path or the current node.
+                </p></dd><dt><span class="term"><span class="command"><strong>exit</strong></span></span></dt><dd><p>Leave the shell.</p></dd><dt><span class="term"><span class="command"><strong>help</strong></span></span></dt><dd><p>Show this help.</p></dd><dt><span class="term"><span class="command"><strong>free</strong></span></span></dt><dd><p>Display memory usage.</p></dd><dt><span class="term"><span class="command"><strong>load <em class="replaceable"><code>FILENAME</code></em></strong></span></span></dt><dd><p>Load a new document with the given filename.</p></dd><dt><span class="term"><span class="command"><strong>ls <em class="replaceable"><code>PATH</code></em></strong></span></span></dt><dd><p>List contents of the given path or the current directory.</p></dd><dt><span class="term"><span class="command"><strong>pwd</strong></span></span></dt><dd><p>Display the path to the current node.</p></dd><dt><span class="term"><span class="command"><strong>quit</strong></span></span></dt><dd><p>Leave the shell.</p></dd><dt><span class="term"><span class="command"><strong>save <em class="replaceable"><code>FILENAME</code></em></strong></span></span></dt><dd><p>
+                    Save the current document to the given filename or to the original name.
+                </p></dd><dt><span class="term"><code class="option">validate</code></span></dt><dd><p>Check the document for errors.</p></dd><dt><span class="term"><span class="command"><strong>write <em class="replaceable"><code>FILENAME</code></em></strong></span></span></dt><dd><p>Write the current node to the given filename.</p></dd></dl></div></div><div class="refsect1"><a name="environment"></a><h2>ENVIRONMENT</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">SGML_CATALOG_FILES</code></span></dt><dd><p><acronym class="acronym">SGML</acronym> catalog behavior can be changed by redirecting
+                    queries to the user's own set of catalogs. This can be done by setting
+                    the <code class="envar">SGML_CATALOG_FILES</code> environment variable to a list
+                    of catalogs. An empty one should deactivate loading the
+                    default catalog.
+                </p></dd><dt><span class="term"><code class="envar">XML_CATALOG_FILES</code></span></dt><dd><p><acronym class="acronym">XML</acronym> catalog behavior can be changed by redirecting
+                    queries to the user's own set of catalogs. This can be done by setting
+                    the <code class="envar">XML_CATALOG_FILES</code> environment variable to a space-separated
+                    list of catalogs. Use percent-encoding to escape spaces or other characters.
+                    An empty variable should deactivate loading the default catalog.
+                </p></dd><dt><span class="term"><code class="envar">XML_DEBUG_CATALOG</code></span></dt><dd><p>Setting the environment variable <code class="envar">XML_DEBUG_CATALOG</code>
+                    to <em class="parameter"><code>non-zero</code></em> using the <span class="command"><strong>export</strong></span>
+                    command outputs debugging information related to catalog operations.
+                </p></dd><dt><span class="term"><code class="envar">XMLLINT_INDENT</code></span></dt><dd><p>Setting the environment variable <code class="envar">XMLLINT_INDENT</code>
+                    controls the indentation. The default value is two spaces "  ".
+                </p></dd></dl></div></div><div class="refsect1"><a name="diagnostics"></a><h2>DIAGNOSTICS</h2><p>
+        <span class="command"><strong>xmllint</strong></span> return codes provide information that can be used when
+        calling it from scripts.
+    </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="errorcode">0</span></span></dt><dd><p>No error</p></dd><dt><span class="term"><span class="errorcode">1</span></span></dt><dd><p>Unclassified</p></dd><dt><span class="term"><span class="errorcode">2</span></span></dt><dd><p>Error in <acronym class="acronym">DTD</acronym></p></dd><dt><span class="term"><span class="errorcode">3</span></span></dt><dd><p>Validation error</p></dd><dt><span class="term"><span class="errorcode">4</span></span></dt><dd><p>Validation error</p></dd><dt><span class="term"><span class="errorcode">5</span></span></dt><dd><p>Error in schema compilation</p></dd><dt><span class="term"><span class="errorcode">6</span></span></dt><dd><p>Error writing output</p></dd><dt><span class="term"><span class="errorcode">7</span></span></dt><dd><p>
+                    Error in pattern (generated when <code class="option">--pattern</code> option is used)
+                </p></dd><dt><span class="term"><span class="errorcode">8</span></span></dt><dd><p>
+                    Error in Reader registration (generated
+                    when <code class="option">--chkregister</code> option is used)
+                </p></dd><dt><span class="term"><span class="errorcode">9</span></span></dt><dd><p>Out of memory error</p></dd><dt><span class="term"><span class="errorcode">10</span></span></dt><dd><p>XPath evaluation error</p></dd></dl></div></div><div class="refsect1"><a name="seealso"></a><h2>SEE ALSO</h2><p><span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span>
+    </p><p>
+        More information can be found at
+        </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">libxml</span>(3)</span> web page <a class="ulink" href="https://gitlab.gnome.org/GNOME/libxml2" target="_top">https://gitlab.gnome.org/GNOME/libxml2</a>
+                </p></li></ul></div><p>
+    </p></div></div></body></html>
index 73b325a..7763a66 100644 (file)
    href="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"?>
 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
     "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
-    
+
     <!ENTITY xmllint "<command>xmllint</command>">
 ]>
 
 <refentry>
 
 <refentryinfo>
-       <title>xmllint Manual</title>
-       <productname>libxml2</productname>
-       <copyright>
-               <year>2001</year>
-               <year>2004</year>
-       </copyright>
-       <authorgroup>
-               <author>
-                       <firstname>John</firstname>
-                       <surname>Fleck</surname>
-                       <affiliation>
-                               <address>
-                                       <email>jfleck@inkstain.net</email>
-                               </address>
-                       </affiliation>
-               </author>
-               <author>
-                       <firstname>Ziying</firstname>
-                       <surname>Sherwin</surname>
-                       <affiliation>
-                               <address>
-                                       <email>sherwin@nlm.nih.gov</email>
-                               </address>
-                       </affiliation>
-               </author>
-               <author>
-                       <firstname>Heiko</firstname>
-                       <surname>Rupp</surname>
-                       <affiliation>
-                               <address>
-                                       <email>hwr@pilhuhn.de</email>
-                               </address>
-                       </affiliation>
-               </author>
-       </authorgroup>
-       <!-- still a bit buggy output, will talk to docbook-xsl upstream to fix this -->
-       <!-- <releaseinfo>This is release 0.5 of the xmllint Manual.</releaseinfo> -->
-       <!-- <edition>0.5</edition> -->
+    <title>xmllint Manual</title>
+    <productname>libxml2</productname>
+    <copyright>
+        <year>2001</year>
+        <year>2004</year>
+    </copyright>
+    <authorgroup>
+        <author>
+            <firstname>John</firstname>
+            <surname>Fleck</surname>
+            <affiliation>
+                <address>
+                    <email>jfleck@inkstain.net</email>
+                </address>
+            </affiliation>
+        </author>
+        <author>
+            <firstname>Ziying</firstname>
+            <surname>Sherwin</surname>
+            <affiliation>
+                <address>
+                    <email>sherwin@nlm.nih.gov</email>
+                </address>
+            </affiliation>
+        </author>
+        <author>
+            <firstname>Heiko</firstname>
+            <surname>Rupp</surname>
+            <affiliation>
+                <address>
+                    <email>hwr@pilhuhn.de</email>
+                </address>
+            </affiliation>
+        </author>
+    </authorgroup>
+    <!-- still a bit buggy output, will talk to docbook-xsl upstream to fix this -->
+    <!-- <releaseinfo>This is release 0.5 of the xmllint Manual.</releaseinfo> -->
+    <!-- <edition>0.5</edition> -->
 </refentryinfo>
 
 <refmeta>
-       <refentrytitle>xmllint</refentrytitle>
-       <manvolnum>1</manvolnum>
+    <refentrytitle>xmllint</refentrytitle>
+    <manvolnum>1</manvolnum>
 </refmeta>
 
 <refnamediv>
-       <refname>xmllint</refname>
-       <refpurpose>command line <acronym>XML</acronym> tool</refpurpose>
+    <refname>xmllint</refname>
+    <refpurpose>command line <acronym>XML</acronym> tool</refpurpose>
 </refnamediv>
 
 <refsynopsisdiv>
-       <cmdsynopsis>
-       <command>xmllint</command>
-               <group choice="opt">
-                       <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>
-                       <arg choice="plain"><option>--noent</option></arg>
-                       <arg choice="plain"><option>--noout</option></arg>
-                       <arg choice="plain"><option>--nonet</option></arg>
-                       <arg choice="plain"><option>--path "<replaceable class="option">PATH(S)</replaceable>"</option></arg>
-                       <arg choice="plain"><option>--load-trace</option></arg>
-                       <arg choice="plain"><option>--htmlout</option></arg>
-                       <arg choice="plain"><option>--nowrap</option></arg>
-                       <arg choice="plain"><option>--valid</option></arg>
-                       <arg choice="plain"><option>--postvalid</option></arg>
-                       <arg choice="plain"><option>--dtdvalid <replaceable class="option">URL</replaceable></option></arg>
-                       <arg choice="plain"><option>--dtdvalidfpi <replaceable class="option">FPI</replaceable></option></arg>
-                       <arg choice="plain"><option>--timing</option></arg>
-                       <arg choice="plain"><option>--output <replaceable class="option">FILE</replaceable></option></arg>
-                       <arg choice="plain"><option>--repeat</option></arg>
-                       <arg choice="plain"><option>--insert</option></arg>
-                       <arg choice="plain"><option>--compress</option></arg>
-                       <arg choice="plain"><option>--html</option></arg>
-                       <arg choice="plain"><option>--xmlout</option></arg>
-                       <arg choice="plain"><option>--push</option></arg>
-                       <arg choice="plain"><option>--memory</option></arg>
-                       <arg choice="plain"><option>--maxmem <replaceable class="option">NBBYTES</replaceable></option></arg>
-                       <arg choice="plain"><option>--nowarning</option></arg>
-                       <arg choice="plain"><option>--noblanks</option></arg>
-                       <arg choice="plain"><option>--nocdata</option></arg>
-                       <arg choice="plain"><option>--format</option></arg>
-                       <arg choice="plain"><option>--encode <replaceable class="option">ENCODING</replaceable></option></arg>
-                       <arg choice="plain"><option>--dropdtd</option></arg>
-                       <arg choice="plain"><option>--nsclean</option></arg>
-                       <arg choice="plain"><option>--testIO</option></arg>
-                       <arg choice="plain"><option>--catalogs</option></arg>
-                       <arg choice="plain"><option>--nocatalogs</option></arg>
-                       <arg choice="plain"><option>--auto</option></arg>
-                       <arg choice="plain"><option>--xinclude</option></arg>
-                       <arg choice="plain"><option>--noxincludenode</option></arg>
-                       <arg choice="plain"><option>--loaddtd</option></arg>
-                       <arg choice="plain"><option>--dtdattr</option></arg>
-                       <arg choice="plain"><option>--stream</option></arg>
-                       <arg choice="plain"><option>--walker</option></arg>
-                       <arg choice="plain"><option>--pattern <replaceable class="option">PATTERNVALUE</replaceable></option></arg>
-                       <arg choice="plain"><option>--chkregister</option></arg>
-                       <arg choice="plain"><option>--relaxng <replaceable class="option">SCHEMA</replaceable></option></arg>
-                       <arg choice="plain"><option>--schema <replaceable class="option">SCHEMA</replaceable></option></arg>
-                       <arg choice="plain"><option>--c14n</option></arg>
-               </group>
-               <group choice="req">
-                       <arg choice="plain" rep="repeat"><replaceable>XML-FILE(S)</replaceable></arg>
-                       <arg choice="plain" rep="norepeat">-</arg>
-               </group>
-       </cmdsynopsis>
-       <cmdsynopsis>
-               <command>xmllint</command>
-               <arg choice="plain"><option>--help</option></arg>
-       </cmdsynopsis>
+    <cmdsynopsis>
+    <command>xmllint</command>
+        <group choice="opt">
+            <arg choice="plain"><option>--version</option></arg>
+            <arg choice="plain"><option>--debug</option></arg>
+            <arg choice="plain"><option>--quiet</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>
+            <arg choice="plain"><option>--nodict</option></arg>
+            <arg choice="plain"><option>--noent</option></arg>
+            <arg choice="plain"><option>--noout</option></arg>
+            <arg choice="plain"><option>--nonet</option></arg>
+            <arg choice="plain"><option>--path "<replaceable class="option">PATH(S)</replaceable>"</option></arg>
+            <arg choice="plain"><option>--load-trace</option></arg>
+            <arg choice="plain"><option>--htmlout</option></arg>
+            <arg choice="plain"><option>--nowrap</option></arg>
+            <arg choice="plain"><option>--valid</option></arg>
+            <arg choice="plain"><option>--postvalid</option></arg>
+            <arg choice="plain"><option>--dtdvalid <replaceable class="option">URL</replaceable></option></arg>
+            <arg choice="plain"><option>--dtdvalidfpi <replaceable class="option">FPI</replaceable></option></arg>
+            <arg choice="plain"><option>--timing</option></arg>
+            <arg choice="plain"><option>--output <replaceable class="option">FILE</replaceable></option></arg>
+            <arg choice="plain"><option>--repeat</option></arg>
+            <arg choice="plain"><option>--insert</option></arg>
+            <arg choice="plain"><option>--compress</option></arg>
+            <arg choice="plain"><option>--html</option></arg>
+            <arg choice="plain"><option>--xmlout</option></arg>
+            <arg choice="plain"><option>--push</option></arg>
+            <arg choice="plain"><option>--memory</option></arg>
+            <arg choice="plain"><option>--maxmem <replaceable class="option">NBBYTES</replaceable></option></arg>
+            <arg choice="plain"><option>--nowarning</option></arg>
+            <arg choice="plain"><option>--noblanks</option></arg>
+            <arg choice="plain"><option>--nocdata</option></arg>
+            <arg choice="plain"><option>--format</option></arg>
+            <arg choice="plain"><option>--encode <replaceable class="option">ENCODING</replaceable></option></arg>
+            <arg choice="plain"><option>--dropdtd</option></arg>
+            <arg choice="plain"><option>--nsclean</option></arg>
+            <arg choice="plain"><option>--testIO</option></arg>
+            <arg choice="plain"><option>--catalogs</option></arg>
+            <arg choice="plain"><option>--nocatalogs</option></arg>
+            <arg choice="plain"><option>--auto</option></arg>
+            <arg choice="plain"><option>--xinclude</option></arg>
+            <arg choice="plain"><option>--noxincludenode</option></arg>
+            <arg choice="plain"><option>--loaddtd</option></arg>
+            <arg choice="plain"><option>--dtdattr</option></arg>
+            <arg choice="plain"><option>--stream</option></arg>
+            <arg choice="plain"><option>--walker</option></arg>
+            <arg choice="plain"><option>--pattern <replaceable class="option">PATTERNVALUE</replaceable></option></arg>
+            <arg choice="plain"><option>--chkregister</option></arg>
+            <arg choice="plain"><option>--relaxng <replaceable class="option">SCHEMA</replaceable></option></arg>
+            <arg choice="plain"><option>--schema <replaceable class="option">SCHEMA</replaceable></option></arg>
+            <arg choice="plain"><option>--c14n</option></arg>
+            <arg choice="plain"><option>--pedantic</option></arg>
+        </group>
+        <group choice="req">
+            <arg choice="plain" rep="repeat"><replaceable>XML-FILE(S)</replaceable></arg>
+            <arg choice="plain" rep="norepeat">-</arg>
+        </group>
+    </cmdsynopsis>
+    <cmdsynopsis>
+        <command>xmllint</command>
+        <arg choice="plain"><option>--help</option></arg>
+    </cmdsynopsis>
 </refsynopsisdiv>
 
 <refsect1 id="description">
-       <title>DESCRIPTION</title>
-       <para>
-               The &xmllint; program parses one or more <acronym>XML</acronym> files,
-               specified on the command line as <replaceable>XML-FILE</replaceable>
-               (or the standard input if the filename provided
-               is <emphasis role="bold">-</emphasis> ). It prints various types of
-               output, depending upon the options selected. It is useful for detecting
-               errors both in <acronym>XML</acronym> code and in
-               the <acronym>XML</acronym> parser itself.
-       </para>
-       <para>&xmllint; is included in <citerefentry>
-               <refentrytitle>libxml</refentrytitle>
-               <manvolnum>3</manvolnum>
-       </citerefentry>.</para>
+    <title>DESCRIPTION</title>
+    <para>
+        The &xmllint; program parses one or more <acronym>XML</acronym> files,
+        specified on the command line as <replaceable>XML-FILE</replaceable>
+        (or the standard input if the filename provided
+        is <emphasis role="bold">-</emphasis> ). It prints various types of
+        output, depending upon the options selected. It is useful for detecting
+        errors both in <acronym>XML</acronym> code and in
+        the <acronym>XML</acronym> parser itself.
+    </para>
+    <para>&xmllint; is included in <citerefentry>
+        <refentrytitle>libxml</refentrytitle>
+        <manvolnum>3</manvolnum>
+    </citerefentry>.</para>
 </refsect1>
 
 <refsect1 id="options">
-       <title>OPTIONS</title>
-       <para>
-               &xmllint; accepts the following options (in alphabetical order):
-       </para>
-
-       <variablelist>
-
-               <varlistentry>
-       <term><option>--auto</option></term>
-       <listitem>
-               <para>Generate a small document for testing purposes.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--catalogs</option></term>
-       <listitem>
-               <para>
-                       Use the <acronym>SGML</acronym> catalog(s) from <envar>SGML_CATALOG_FILES</envar>.
-                       Otherwise <acronym>XML</acronym> catalogs starting
-                       from <filename>/etc/xml/catalog</filename> are used by default.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--chkregister</option></term>
-       <listitem>
-               <para>
-                       Turn on node registration. Useful for developers testing <citerefentry>
-               <refentrytitle>libxml</refentrytitle>
-               <manvolnum>3</manvolnum>
-       </citerefentry> node tracking code.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--compress</option></term>
-       <listitem>
-               <para>
-                       Turn on <citerefentry>
-               <refentrytitle>gzip</refentrytitle>
-               <manvolnum>1</manvolnum>
-       </citerefentry> compression of output.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--copy</option></term>
-       <listitem>
-               <para>Test the internal copy implementation.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--c14n</option></term>
-       <listitem>
-               <para>
-                       Use the W3C <acronym>XML</acronym> Canonicalisation (<acronym>C14N</acronym>) to
-                       serialize the result of parsing to <filename class="devicefile">stdout</filename>.
-                       It keeps comments in the result.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--dtdvalid <replaceable class="option">URL</replaceable></option></term>
-       <listitem>
-               <para>
-                       Use the <acronym>DTD</acronym> specified by
-                       an <replaceable>URL</replaceable> for validation.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--dtdvalidfpi <replaceable class="option">FPI</replaceable></option></term>
-       <listitem>
-               <para>
-                       Use the <acronym>DTD</acronym> specified by a Formal Public
-                       Identifier <replaceable>FPI</replaceable> for validation, note that this
-                       will require a catalog exporting that Formal Public Identifier to work.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--debug</option></term>
-       <listitem>
-               <para>
-                       Parse a file and output an annotated tree of the
-                       in-memory version of the document.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--debugent</option></term>
-       <listitem>
-               <para>Debug the entities defined in the document.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--dropdtd</option></term>
-       <listitem>
-               <para>Remove <acronym>DTD</acronym> from output.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--dtdattr</option></term>
-       <listitem>
-               <para>
-                       Fetch external <acronym>DTD</acronym> and populate the tree with
-                       inherited attributes.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--encode <replaceable class="option">ENCODING</replaceable></option></term>
-       <listitem>
-               <para>Output in the given encoding. Note that this works for full document not fragments or result from XPath queries.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--format</option></term>
-       <listitem>
-               <para>
-                       Reformat and reindent the output. The <envar>XMLLINT_INDENT</envar>
-                       environment variable controls the indentation. The default value is two
-                       spaces &quot;  &quot;).
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--help</option></term>
-       <listitem>
-               <para>Print out a short usage summary for &xmllint;.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--html</option></term>
-       <listitem>
-               <para>Use the <acronym>HTML</acronym> parser.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--htmlout</option></term>
-       <listitem>
-               <para>
-                       Output results as an <acronym>HTML</acronym> file. This
-                       causes &xmllint; to output the necessary <acronym>HTML</acronym>
-                       tags surrounding the result tree output so the results can be
-                       displayed/viewed in a browser.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--insert</option></term>
-       <listitem>
-               <para>Test for valid insertions.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--loaddtd</option></term>
-       <listitem>
-               <para>Fetch an external <acronym>DTD</acronym>.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--load-trace</option></term>
-       <listitem>
-               <para>
-                       Display all the documents loaded during the processing
-                       to <filename class="devicefile">stderr</filename>.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--maxmem <replaceable class="option">NNBYTES</replaceable></option></term>
-       <listitem>
-               <para>
-                       Test the parser memory support. <replaceable>NNBYTES</replaceable>
-                       is the maximum number of bytes the library is allowed to allocate.
-                       This can also be used to make sure batch processing
-                       of <acronym>XML</acronym> files will not exhaust the virtual memory
-                       of the server running them.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--memory</option></term>
-       <listitem>
-               <para>Parse from memory.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--noblanks</option></term>
-       <listitem>
-               <para>Drop ignorable blank spaces.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--nocatalogs</option></term>
-       <listitem>
-               <para>Do not use any catalogs.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--nocdata</option></term>
-       <listitem>
-               <para>Substitute CDATA section by equivalent text nodes.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--noent</option></term>
-       <listitem>
-               <para>
-                       Substitute entity values for entity references. By default, &xmllint;
-                       leaves entity references in place.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--nonet</option></term>
-       <listitem>
-               <para>
-                       Do not use the Internet to fetch <acronym>DTD</acronym>s or entities.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--noout</option></term>
-       <listitem>
-               <para>
-                       Suppress output. By default, &xmllint; outputs the result tree.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--nowarning</option></term>
-       <listitem>
-               <para>Do not emit warnings from the parser and/or validator.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--nowrap</option></term>
-       <listitem>
-               <para>Do not output <acronym>HTML</acronym> doc wrapper.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--noxincludenode</option></term>
-       <listitem>
-               <para>
-                       Do XInclude processing but do not generate XInclude start and end nodes.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--nsclean</option></term>
-       <listitem>
-               <para>Remove redundant namespace declarations.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--output <replaceable class="option">FILE</replaceable></option></term>
-       <listitem>
-               <para>
-                       Define a file path where &xmllint; will save the result of parsing.
-                       Usually the programs build a tree and save it
-                       on <filename class="devicefile">stdout</filename>, with this option
-                       the result <acronym>XML</acronym> instance will be saved onto a file.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--path "<replaceable class="option">PATH(S)</replaceable>"</option></term>
-       <listitem>
-               <para>
-                       Use the (space- or colon-separated) list of filesystem paths specified
-                       by <replaceable>PATHS</replaceable> to load <acronym>DTD</acronym>s or
-                       entities. Enclose space-separated lists by quotation marks.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--pattern <replaceable class="option">PATTERNVALUE</replaceable></option></term>
-       <listitem>
-               <para>
-                       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.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--postvalid</option></term>
-       <listitem>
-               <para>Validate after parsing has completed.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--push</option></term>
-       <listitem>
-               <para>Use the push mode of the parser.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--recover</option></term>
-       <listitem>
-               <para>Output any parsable portions of an invalid document.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--relaxng <replaceable class="option">SCHEMA</replaceable></option></term>
-       <listitem>
-               <para>
-                       Use RelaxNG file named <replaceable class="option">SCHEMA</replaceable>
-                       for validation.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--repeat</option></term>
-       <listitem>
-               <para>Repeat 100 times, for timing or profiling.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--schema <replaceable>SCHEMA</replaceable></option></term>
-       <listitem>
-               <para>
-                       Use a W3C <acronym>XML</acronym> Schema file
-                       named <replaceable>SCHEMA</replaceable> for validation.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--shell</option></term>
-       <listitem>
-               <para>
-                       Run a navigating shell. Details on available commands in shell mode
-                       are below (see <xref linkend="shell"/>).
-               </para>
-       </listitem>
-               </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>
-                       Use streaming <acronym>API</acronym> - useful when used in combination
-                       with <option>--relaxng</option> or <option>--valid</option> options
-                       for validation of files that are too large to be held in memory.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--testIO</option></term>
-       <listitem>
-               <para>Test user input/output support.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--timing</option></term>
-       <listitem>
-               <para>
-                       Output information about the time it takes &xmllint; to perform the
-                       various steps.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--valid</option></term>
-       <listitem>
-               <para>
-                       Determine if the document is a valid instance of the included
-                       Document Type Definition (<acronym>DTD</acronym>).
-                       A <acronym>DTD</acronym> to be validated against also can be
-                       specified at the command line using the <option>--dtdvalid</option>
-                       option. By default, &xmllint; also checks to determine if the
-                       document is well-formed.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--version</option></term>
-       <listitem>
-               <para>
-                       Display the version of <citerefentry>
-               <refentrytitle>libxml</refentrytitle>
-               <manvolnum>3</manvolnum>
-       </citerefentry> used.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--walker</option></term>
-       <listitem>
-               <para>
-                       Test the walker module, which is a reader interface but for a
-                       document tree, instead of using the reader <acronym>API</acronym> on
-                       an unparsed document it works on an existing in-memory tree. Used for
-                       debugging.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--xinclude</option></term>
-       <listitem>
-               <para>Do XInclude processing.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>--xmlout</option></term>
-       <listitem>
-               <para>
-                       Used in conjunction with <option>--html</option>. Usually
-                       when <acronym>HTML</acronym> is parsed the document is saved with
-                       the <acronym>HTML</acronym> serializer. But with this option the
-                       resulting document is saved with the <acronym>XML</acronym>
-                       serializer. This is primarily used to
-                       generate <acronym>XHTML</acronym> from <acronym>HTML</acronym> input.
-               </para>
-       </listitem>
-               </varlistentry>
-
-       </variablelist>
+    <title>OPTIONS</title>
+    <para>
+        &xmllint; accepts the following options (in alphabetical order):
+    </para>
+
+    <variablelist>
+
+        <varlistentry>
+            <term><option>--auto</option></term>
+            <listitem>
+                <para>Generate a small document for testing purposes.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--catalogs</option></term>
+            <listitem>
+                <para>
+                    Use the <acronym>SGML</acronym> catalog(s) from <envar>SGML_CATALOG_FILES</envar>.
+                    Otherwise <acronym>XML</acronym> catalogs starting
+                    from <filename>/etc/xml/catalog</filename> or, more specifically,
+                    <filename>${sysconfdir}/xml/catalog</filename> are used by default.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--chkregister</option></term>
+            <listitem>
+                <para>
+                    Turn on node registration. Useful for developers testing <citerefentry>
+                <refentrytitle>libxml</refentrytitle>
+                <manvolnum>3</manvolnum>
+            </citerefentry> node tracking code.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--compress</option></term>
+            <listitem>
+                <para>
+                    Turn on <citerefentry>
+                <refentrytitle>gzip</refentrytitle>
+                <manvolnum>1</manvolnum>
+            </citerefentry> compression of output.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--copy</option></term>
+            <listitem>
+                <para>Test the internal copy implementation.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--c14n</option></term>
+            <listitem>
+                <para>
+                    Use the W3C <acronym>XML</acronym> Canonicalisation (<acronym>C14N</acronym>) to
+                    serialize the result of parsing to <filename class="devicefile">stdout</filename>.
+                    It keeps comments in the result.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--dtdvalid <replaceable class="option">URL</replaceable></option></term>
+            <listitem>
+                <para>
+                    Use the <acronym>DTD</acronym> specified by
+                    an <replaceable>URL</replaceable> for validation.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--dtdvalidfpi <replaceable class="option">FPI</replaceable></option></term>
+            <listitem>
+                <para>
+                    Use the <acronym>DTD</acronym> specified by a Formal Public
+                    Identifier <replaceable>FPI</replaceable> for validation, note that this
+                    will require a catalog exporting that Formal Public Identifier to work.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--debug</option></term>
+            <listitem>
+                <para>
+                    Parse a file and output an annotated tree of the
+                    in-memory version of the document.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--debugent</option></term>
+            <listitem>
+                <para>Debug the entities defined in the document.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--dropdtd</option></term>
+            <listitem>
+                <para>Remove <acronym>DTD</acronym> from output.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--dtdattr</option></term>
+            <listitem>
+                <para>
+                    Fetch external <acronym>DTD</acronym> and populate the tree with
+                    inherited attributes.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--encode <replaceable class="option">ENCODING</replaceable></option></term>
+            <listitem>
+                <para>Output in the given encoding. Note that this works for full document not fragments or result from XPath queries.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--format</option></term>
+            <listitem>
+                <para>
+                    Reformat and reindent the output. The <envar>XMLLINT_INDENT</envar>
+                    environment variable controls the indentation. The default value is two
+                    spaces &quot;  &quot;).
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--help</option></term>
+            <listitem>
+                <para>Print out a short usage summary for &xmllint;.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--html</option></term>
+            <listitem>
+                <para>Use the <acronym>HTML</acronym> parser.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--htmlout</option></term>
+            <listitem>
+                <para>
+                    Output results as an <acronym>HTML</acronym> file. This
+                    causes &xmllint; to output the necessary <acronym>HTML</acronym>
+                    tags surrounding the result tree output so the results can be
+                    displayed/viewed in a browser.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--insert</option></term>
+            <listitem>
+                <para>Test for valid insertions.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--loaddtd</option></term>
+            <listitem>
+                <para>Fetch an external <acronym>DTD</acronym>.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--load-trace</option></term>
+            <listitem>
+                <para>
+                    Display all the documents loaded during the processing
+                    to <filename class="devicefile">stderr</filename>.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--maxmem <replaceable class="option">NNBYTES</replaceable></option></term>
+            <listitem>
+                <para>
+                    Test the parser memory support. <replaceable>NNBYTES</replaceable>
+                    is the maximum number of bytes the library is allowed to allocate.
+                    This can also be used to make sure batch processing
+                    of <acronym>XML</acronym> files will not exhaust the virtual memory
+                    of the server running them.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--memory</option></term>
+            <listitem>
+                <para>Parse from memory.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--noblanks</option></term>
+            <listitem>
+                <para>Drop ignorable blank spaces.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--nocatalogs</option></term>
+            <listitem>
+                <para>Do not use any catalogs.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--nocdata</option></term>
+            <listitem>
+                <para>Substitute CDATA section by equivalent text nodes.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--nodict</option></term>
+            <listitem>
+                <para>
+                    Don't use dictionaries (parser option XML_PARSE_NODICT).
+                    Only for debugging.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--noent</option></term>
+            <listitem>
+                <para>
+                    Substitute entity values for entity references. By default, &xmllint;
+                    leaves entity references in place.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--nonet</option></term>
+            <listitem>
+                <para>
+                    Do not use the Internet to fetch <acronym>DTD</acronym>s or entities.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--noout</option></term>
+            <listitem>
+                <para>
+                    Suppress output. By default, &xmllint; outputs the result tree.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--nowarning</option></term>
+            <listitem>
+                <para>Do not emit warnings from the parser and/or validator.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--nowrap</option></term>
+            <listitem>
+                <para>Do not output <acronym>HTML</acronym> doc wrapper.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--noxincludenode</option></term>
+            <listitem>
+                <para>
+                    Do XInclude processing but do not generate XInclude start and end nodes.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--nsclean</option></term>
+            <listitem>
+                <para>Remove redundant namespace declarations.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--output <replaceable class="option">FILE</replaceable></option></term>
+            <listitem>
+                <para>
+                    Define a file path where &xmllint; will save the result of parsing.
+                    Usually the programs build a tree and save it
+                    on <filename class="devicefile">stdout</filename>, with this option
+                    the result <acronym>XML</acronym> instance will be saved onto a file.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--path "<replaceable class="option">PATH(S)</replaceable>"</option></term>
+            <listitem>
+                <para>
+                    Use the (space- or colon-separated) list of filesystem paths specified
+                    by <replaceable>PATHS</replaceable> to load <acronym>DTD</acronym>s or
+                    entities. Enclose space-separated lists by quotation marks.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--pattern <replaceable class="option">PATTERNVALUE</replaceable></option></term>
+            <listitem>
+                <para>
+                    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.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--pedantic</option></term>
+            <listitem>
+                <para>Enable additional warnings.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--postvalid</option></term>
+            <listitem>
+                <para>Validate after parsing has completed.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--push</option></term>
+            <listitem>
+                <para>Use the push mode of the parser.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--quiet</option></term>
+            <listitem>
+                <para>Don't print informational messages to stderr.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--recover</option></term>
+            <listitem>
+                <para>Output any parsable portions of an invalid document.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--relaxng <replaceable class="option">SCHEMA</replaceable></option></term>
+            <listitem>
+                <para>
+                    Use RelaxNG file named <replaceable class="option">SCHEMA</replaceable>
+                    for validation.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--repeat</option></term>
+            <listitem>
+                <para>Repeat 100 times, for timing or profiling.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--schema <replaceable>SCHEMA</replaceable></option></term>
+            <listitem>
+                <para>
+                    Use a W3C <acronym>XML</acronym> Schema file
+                    named <replaceable>SCHEMA</replaceable> for validation.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--shell</option></term>
+            <listitem>
+                <para>
+                    Run a navigating shell. Details on available commands in shell mode
+                    are below (see <xref linkend="shell"/>).
+                </para>
+            </listitem>
+        </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>
+                    Use streaming <acronym>API</acronym> - useful when used in combination
+                    with <option>--relaxng</option> or <option>--valid</option> options
+                    for validation of files that are too large to be held in memory.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--testIO</option></term>
+            <listitem>
+                <para>Test user input/output support.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--timing</option></term>
+            <listitem>
+                <para>
+                    Output information about the time it takes &xmllint; to perform the
+                    various steps.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--valid</option></term>
+            <listitem>
+                <para>
+                    Determine if the document is a valid instance of the included
+                    Document Type Definition (<acronym>DTD</acronym>).
+                    A <acronym>DTD</acronym> to be validated against also can be
+                    specified at the command line using the <option>--dtdvalid</option>
+                    option. By default, &xmllint; also checks to determine if the
+                    document is well-formed.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--version</option></term>
+            <listitem>
+                <para>
+                    Display the version of <citerefentry>
+                <refentrytitle>libxml</refentrytitle>
+                <manvolnum>3</manvolnum>
+            </citerefentry> used.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--walker</option></term>
+            <listitem>
+                <para>
+                    Test the walker module, which is a reader interface but for a
+                    document tree, instead of using the reader <acronym>API</acronym> on
+                    an unparsed document it works on an existing in-memory tree. Used for
+                    debugging.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--xinclude</option></term>
+            <listitem>
+                <para>Do XInclude processing.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>--xmlout</option></term>
+            <listitem>
+                <para>
+                    Used in conjunction with <option>--html</option>. Usually
+                    when <acronym>HTML</acronym> is parsed the document is saved with
+                    the <acronym>HTML</acronym> serializer. But with this option the
+                    resulting document is saved with the <acronym>XML</acronym>
+                    serializer. This is primarily used to
+                    generate <acronym>XHTML</acronym> from <acronym>HTML</acronym> input.
+                </para>
+            </listitem>
+        </varlistentry>
+
+    </variablelist>
 </refsect1>
 
 <refsect1 id="shell">
-       <title>SHELL COMMANDS</title>
-       <para>
-               &xmllint; offers an interactive shell mode invoked with
-               the <option>--shell</option> command. Available commands in shell mode
-               include (in alphabetical order):
-       </para>
-       <variablelist>
-
-               <varlistentry>
-       <term><command>base</command></term>
-       <listitem>
-               <para>Display <acronym>XML</acronym> base of the node.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><command>bye</command></term>
-       <listitem>
-               <para>Leave the shell.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><command>cat <replaceable>NODE</replaceable></command></term>
-       <listitem>
-               <para>Display the given node or the current one.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><command>cd <replaceable>PATH</replaceable></command></term>
-       <listitem>
-               <para>
-                       Change the current node to the given path (if unique) or root if no
-                       argument is given.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><command>dir <replaceable>PATH</replaceable></command></term>
-       <listitem>
-               <para>
-                       Dumps information about the node (namespace, attributes, content).
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><command>du <replaceable>PATH</replaceable></command></term>
-       <listitem>
-               <para>
-                       Show the structure of the subtree under the given path or the current node.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><command>exit</command></term>
-       <listitem>
-               <para>Leave the shell.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><command>help</command></term>
-       <listitem>
-               <para>Show this help.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><command>free</command></term>
-       <listitem>
-               <para>Display memory usage.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><command>load <replaceable>FILENAME</replaceable></command></term>
-       <listitem>
-               <para>Load a new document with the given filename.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><command>ls <replaceable>PATH</replaceable></command></term>
-       <listitem>
-               <para>List contents of the given path or the current directory.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><command>pwd</command></term>
-       <listitem>
-               <para>Display the path to the current node.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><command>quit</command></term>
-       <listitem>
-               <para>Leave the shell.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><command>save <replaceable>FILENAME</replaceable></command></term>
-       <listitem>
-               <para>
-                       Save the current document to the given filename or to the original name.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><option>validate</option></term>
-       <listitem>
-               <para>Check the document for errors.</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><command>write <replaceable>FILENAME</replaceable></command></term>
-       <listitem>
-               <para>Write the current node to the given filename.</para>
-       </listitem>
-               </varlistentry>
-
-       </variablelist>
+    <title>SHELL COMMANDS</title>
+    <para>
+        &xmllint; offers an interactive shell mode invoked with
+        the <option>--shell</option> command. Available commands in shell mode
+        include (in alphabetical order):
+    </para>
+    <variablelist>
+
+        <varlistentry>
+            <term><command>base</command></term>
+            <listitem>
+                <para>Display <acronym>XML</acronym> base of the node.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><command>bye</command></term>
+            <listitem>
+                <para>Leave the shell.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><command>cat <replaceable>NODE</replaceable></command></term>
+            <listitem>
+                <para>Display the given node or the current one.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><command>cd <replaceable>PATH</replaceable></command></term>
+            <listitem>
+                <para>
+                    Change the current node to the given path (if unique) or root if no
+                    argument is given.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><command>dir <replaceable>PATH</replaceable></command></term>
+            <listitem>
+                <para>
+                    Dumps information about the node (namespace, attributes, content).
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><command>du <replaceable>PATH</replaceable></command></term>
+            <listitem>
+                <para>
+                    Show the structure of the subtree under the given path or the current node.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><command>exit</command></term>
+            <listitem>
+                <para>Leave the shell.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><command>help</command></term>
+            <listitem>
+                <para>Show this help.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><command>free</command></term>
+            <listitem>
+                <para>Display memory usage.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><command>load <replaceable>FILENAME</replaceable></command></term>
+            <listitem>
+                <para>Load a new document with the given filename.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><command>ls <replaceable>PATH</replaceable></command></term>
+            <listitem>
+                <para>List contents of the given path or the current directory.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><command>pwd</command></term>
+            <listitem>
+                <para>Display the path to the current node.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><command>quit</command></term>
+            <listitem>
+                <para>Leave the shell.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><command>save <replaceable>FILENAME</replaceable></command></term>
+            <listitem>
+                <para>
+                    Save the current document to the given filename or to the original name.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><option>validate</option></term>
+            <listitem>
+                <para>Check the document for errors.</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><command>write <replaceable>FILENAME</replaceable></command></term>
+            <listitem>
+                <para>Write the current node to the given filename.</para>
+            </listitem>
+        </varlistentry>
+
+    </variablelist>
 </refsect1>
 
 <refsect1 id="environment">
-       <title>ENVIRONMENT</title>
-       <variablelist>
-
-               <varlistentry>
-       <term><envar>SGML_CATALOG_FILES</envar></term>
-       <listitem>
-               <para><acronym>SGML</acronym> catalog behavior can be changed by redirecting
-                       queries to the user's own set of catalogs. This can be done by setting
-                       the <envar>SGML_CATALOG_FILES</envar> environment variable to a list
-                       of catalogs. An empty one should deactivate loading the
-                       default <filename>/etc/sgml/catalog</filename> catalog.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><envar>XML_CATALOG_FILES</envar></term>
-       <listitem>
-               <para><acronym>XML</acronym> catalog behavior can be changed by redirecting
-                       queries to the user's own set of catalogs. This can be done by setting
-                       the <envar>XML_CATALOG_FILES</envar> environment variable to a space-separated
-                       list of catalogs. Use percent-encoding to escape spaces or other characters.
-                       An empty variable should deactivate loading the default <filename>/etc/xml/catalog</filename> catalog.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><envar>XML_DEBUG_CATALOG</envar></term>
-       <listitem>
-               <para>Setting the environment variable <envar>XML_DEBUG_CATALOG</envar>
-                       to <parameter>non-zero</parameter> using the <command>export</command>
-                       command outputs debugging information related to catalog operations.
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><envar>XMLLINT_INDENT</envar></term>
-       <listitem>
-               <para>Setting the environment variable <envar>XMLLINT_INDENT</envar>
-                       controls the indentation. The default value is two spaces &quot;  &quot;.
-               </para>
-       </listitem>
-               </varlistentry>
-               
-       </variablelist>
+    <title>ENVIRONMENT</title>
+    <variablelist>
+
+        <varlistentry>
+            <term><envar>SGML_CATALOG_FILES</envar></term>
+            <listitem>
+                <para><acronym>SGML</acronym> catalog behavior can be changed by redirecting
+                    queries to the user's own set of catalogs. This can be done by setting
+                    the <envar>SGML_CATALOG_FILES</envar> environment variable to a list
+                    of catalogs. An empty one should deactivate loading the
+                    default catalog.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><envar>XML_CATALOG_FILES</envar></term>
+            <listitem>
+                <para><acronym>XML</acronym> catalog behavior can be changed by redirecting
+                    queries to the user's own set of catalogs. This can be done by setting
+                    the <envar>XML_CATALOG_FILES</envar> environment variable to a space-separated
+                    list of catalogs. Use percent-encoding to escape spaces or other characters.
+                    An empty variable should deactivate loading the default catalog.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><envar>XML_DEBUG_CATALOG</envar></term>
+            <listitem>
+                <para>Setting the environment variable <envar>XML_DEBUG_CATALOG</envar>
+                    to <parameter>non-zero</parameter> using the <command>export</command>
+                    command outputs debugging information related to catalog operations.
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><envar>XMLLINT_INDENT</envar></term>
+            <listitem>
+                <para>Setting the environment variable <envar>XMLLINT_INDENT</envar>
+                    controls the indentation. The default value is two spaces &quot;  &quot;.
+                </para>
+            </listitem>
+        </varlistentry>
+
+    </variablelist>
 </refsect1>
 
 <refsect1 id="diagnostics">
-       <title>DIAGNOSTICS</title>
-       <para>
-               &xmllint; return codes provide information that can be used when
-               calling it from scripts.
-       </para>
-       <!-- better use segmentedlist element later,
-            which is currently only supported in snapshots -->
-       <variablelist>
-
-               <varlistentry>
-       <term><errorcode>0</errorcode></term>
-       <listitem>
-               <para>No error</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><errorcode>1</errorcode></term>
-       <listitem>
-               <para>Unclassified</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><errorcode>2</errorcode></term>
-       <listitem>
-               <para>Error in <acronym>DTD</acronym></para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><errorcode>3</errorcode></term>
-       <listitem>
-               <para>Validation error</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><errorcode>4</errorcode></term>
-       <listitem>
-               <para>Validation error</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><errorcode>5</errorcode></term>
-       <listitem>
-               <para>Error in schema compilation</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><errorcode>6</errorcode></term>
-       <listitem>
-               <para>Error writing output</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><errorcode>7</errorcode></term>
-       <listitem>
-               <para>
-                       Error in pattern (generated when <option>--pattern</option> option is used)
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><errorcode>8</errorcode></term>
-       <listitem>
-               <para>
-                       Error in Reader registration (generated
-                       when <option>--chkregister</option> option is used)
-               </para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><errorcode>9</errorcode></term>
-       <listitem>
-               <para>Out of memory error</para>
-       </listitem>
-               </varlistentry>
-
-               <varlistentry>
-       <term><errorcode>10</errorcode></term>
-       <listitem>
-               <para>XPath evaluation error</para>
-       </listitem>
-               </varlistentry>
-
-       </variablelist>
+    <title>DIAGNOSTICS</title>
+    <para>
+        &xmllint; return codes provide information that can be used when
+        calling it from scripts.
+    </para>
+    <!-- better use segmentedlist element later,
+         which is currently only supported in snapshots -->
+    <variablelist>
+
+        <varlistentry>
+            <term><errorcode>0</errorcode></term>
+            <listitem>
+                <para>No error</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><errorcode>1</errorcode></term>
+            <listitem>
+                <para>Unclassified</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><errorcode>2</errorcode></term>
+            <listitem>
+                <para>Error in <acronym>DTD</acronym></para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><errorcode>3</errorcode></term>
+            <listitem>
+                <para>Validation error</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><errorcode>4</errorcode></term>
+            <listitem>
+                <para>Validation error</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><errorcode>5</errorcode></term>
+            <listitem>
+                <para>Error in schema compilation</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><errorcode>6</errorcode></term>
+            <listitem>
+                <para>Error writing output</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><errorcode>7</errorcode></term>
+            <listitem>
+                <para>
+                    Error in pattern (generated when <option>--pattern</option> option is used)
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><errorcode>8</errorcode></term>
+            <listitem>
+                <para>
+                    Error in Reader registration (generated
+                    when <option>--chkregister</option> option is used)
+                </para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><errorcode>9</errorcode></term>
+            <listitem>
+                <para>Out of memory error</para>
+            </listitem>
+        </varlistentry>
+
+        <varlistentry>
+            <term><errorcode>10</errorcode></term>
+            <listitem>
+                <para>XPath evaluation error</para>
+            </listitem>
+        </varlistentry>
+
+    </variablelist>
 </refsect1>
 
 <refsect1 id="seealso">
-       <title>SEE ALSO</title>
-       <para><citerefentry>
-                       <refentrytitle>libxml</refentrytitle>
-                       <manvolnum>3</manvolnum>
-               </citerefentry>
-       </para>
-       <para>
-               More information can be found at
-               <itemizedlist>
-                       <listitem>
-                               <para><citerefentry>
-                                               <refentrytitle>libxml</refentrytitle>
-                                               <manvolnum>3</manvolnum>
-                                       </citerefentry> web page <ulink url="https://gitlab.gnome.org/GNOME/libxml2"/>
-                               </para>
-                       </listitem>
-               </itemizedlist>
-       </para>
+    <title>SEE ALSO</title>
+    <para><citerefentry>
+            <refentrytitle>libxml</refentrytitle>
+            <manvolnum>3</manvolnum>
+        </citerefentry>
+    </para>
+    <para>
+        More information can be found at
+        <itemizedlist>
+            <listitem>
+                <para><citerefentry>
+                        <refentrytitle>libxml</refentrytitle>
+                        <manvolnum>3</manvolnum>
+                    </citerefentry> web page <ulink url="https://gitlab.gnome.org/GNOME/libxml2"/>
+                </para>
+            </listitem>
+        </itemizedlist>
+    </para>
 </refsect1>
 
 </refentry>
diff --git a/enc.h b/enc.h
deleted file mode 100644 (file)
index a69a5d0..0000000
--- a/enc.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Summary: Internal Interfaces for encoding in libxml2
- * Description: this module describes a few interfaces which were
- *              added along with the API changes in 2.9.0
- *              those are private routines at this point
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_ENC_H__
-#define __XML_ENC_H__
-
-#include <libxml/tree.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out,
-                           xmlBufferPtr in, int len);
-int xmlCharEncFirstLineInput(xmlParserInputBufferPtr input, int len);
-int xmlCharEncInput(xmlParserInputBufferPtr input, int flush);
-int xmlCharEncOutput(xmlOutputBufferPtr output, int init);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __XML_ENC_H__ */
-
-
index 5465359..513db67 100644 (file)
@@ -40,8 +40,9 @@
 #include <libxml/globals.h>
 #include <libxml/xmlerror.h>
 
-#include "buf.h"
-#include "enc.h"
+#include "private/buf.h"
+#include "private/enc.h"
+#include "private/error.h"
 
 #ifdef LIBXML_ICU_ENABLED
 #include <unicode/ucnv.h>
@@ -57,9 +58,6 @@ struct _uconv_t {
 };
 #endif
 
-static xmlCharEncodingHandlerPtr xmlUTF16LEHandler = NULL;
-static xmlCharEncodingHandlerPtr xmlUTF16BEHandler = NULL;
-
 typedef struct _xmlCharEncodingAlias xmlCharEncodingAlias;
 typedef xmlCharEncodingAlias *xmlCharEncodingAliasPtr;
 struct _xmlCharEncodingAlias {
@@ -76,9 +74,6 @@ static int xmlCharEncodingAliasesMax = 0;
 #define DEBUG_ENCODING  /* Define this to get encoding traces */
 #endif
 #else
-#ifdef LIBXML_ISO8859X_ENABLED
-static void xmlRegisterCharEncodingHandlersISO8859x (void);
-#endif
 #endif
 
 static int xmlLittleEndian = 1;
@@ -202,7 +197,7 @@ asciiToUTF8(unsigned char* out, int *outlen,
        } else {
            *outlen = out - outstart;
            *inlen = processed - base;
-           return(-1);
+           return(-2);
        }
 
        processed = (const unsigned char*) in;
@@ -532,7 +527,7 @@ UTF16LEToUTF8(unsigned char* out, int *outlen,
        } else {
            tmp = (unsigned char *) in;
            c = *tmp++;
-           c = c | (((unsigned int)*tmp) << 8);
+           c = c | (*tmp << 8);
            in++;
        }
         if ((c & 0xFC00) == 0xD800) {    /* surrogates */
@@ -544,7 +539,7 @@ UTF16LEToUTF8(unsigned char* out, int *outlen,
            } else {
                tmp = (unsigned char *) in;
                d = *tmp++;
-               d = d | (((unsigned int)*tmp) << 8);
+               d = d | (*tmp << 8);
                in++;
            }
             if ((d & 0xFC00) == 0xDC00) {
@@ -655,7 +650,7 @@ UTF8ToUTF16LE(unsigned char* outb, int *outlen,
                *out++ = c;
            } else {
                tmp = (unsigned char *) out;
-               *tmp = c ;
+               *tmp = (unsigned char) c; /* Explicit truncation */
                *(tmp + 1) = c >> 8 ;
                out++;
            }
@@ -670,13 +665,13 @@ UTF8ToUTF16LE(unsigned char* outb, int *outlen,
            } else {
                tmp1 = 0xD800 | (c >> 10);
                tmp = (unsigned char *) out;
-               *tmp = (unsigned char) tmp1;
+               *tmp = (unsigned char) tmp1; /* Explicit truncation */
                *(tmp + 1) = tmp1 >> 8;
                out++;
 
                tmp2 = 0xDC00 | (c & 0x03FF);
                tmp = (unsigned char *) out;
-               *tmp  = (unsigned char) tmp2;
+               *tmp  = (unsigned char) tmp2; /* Explicit truncation */
                *(tmp + 1) = tmp2 >> 8;
                out++;
            }
@@ -773,7 +768,7 @@ UTF16BEToUTF8(unsigned char* out, int *outlen,
        if (xmlLittleEndian) {
            tmp = (unsigned char *) in;
            c = *tmp++;
-           c = (c << 8) | (unsigned int) *tmp;
+           c = (c << 8) | *tmp;
            in++;
        } else {
            c= *in++;
@@ -785,7 +780,7 @@ UTF16BEToUTF8(unsigned char* out, int *outlen,
            if (xmlLittleEndian) {
                tmp = (unsigned char *) in;
                d = *tmp++;
-               d = (d << 8) | (unsigned int) *tmp;
+               d = (d << 8) | *tmp;
                in++;
            } else {
                d= *in++;
@@ -895,7 +890,7 @@ UTF8ToUTF16BE(unsigned char* outb, int *outlen,
            if (xmlLittleEndian) {
                tmp = (unsigned char *) out;
                *tmp = c >> 8;
-               *(tmp + 1) = c;
+               *(tmp + 1) = (unsigned char) c; /* Explicit truncation */
                out++;
            } else {
                *out++ = c;
@@ -908,13 +903,13 @@ UTF8ToUTF16BE(unsigned char* outb, int *outlen,
                tmp1 = 0xD800 | (c >> 10);
                tmp = (unsigned char *) out;
                *tmp = tmp1 >> 8;
-               *(tmp + 1) = (unsigned char) tmp1;
+               *(tmp + 1) = (unsigned char) tmp1; /* Explicit truncation */
                out++;
 
                tmp2 = 0xDC00 | (c & 0x03FF);
                tmp = (unsigned char *) out;
                *tmp = tmp2 >> 8;
-               *(tmp + 1) = (unsigned char) tmp2;
+               *(tmp + 1) = (unsigned char) tmp2; /* Explicit truncation */
                out++;
            } else {
                *out++ = 0xD800 | (c >> 10);
@@ -1047,7 +1042,7 @@ xmlGetEncodingAlias(const char *alias) {
        return(NULL);
 
     for (i = 0;i < 99;i++) {
-        upper[i] = toupper(alias[i]);
+        upper[i] = (char) toupper((unsigned char) alias[i]);
        if (upper[i] == 0) break;
     }
     upper[i] = 0;
@@ -1082,7 +1077,7 @@ xmlAddEncodingAlias(const char *name, const char *alias) {
        return(-1);
 
     for (i = 0;i < 99;i++) {
-        upper[i] = toupper(alias[i]);
+        upper[i] = (char) toupper((unsigned char) alias[i]);
        if (upper[i] == 0) break;
     }
     upper[i] = 0;
@@ -1184,7 +1179,7 @@ xmlParseCharEncoding(const char* name)
        name = alias;
 
     for (i = 0;i < 499;i++) {
-        upper[i] = toupper(name[i]);
+        upper[i] = (char) toupper((unsigned char) name[i]);
        if (upper[i] == 0) break;
     }
     upper[i] = 0;
@@ -1311,19 +1306,100 @@ xmlGetCharEncodingName(xmlCharEncoding enc) {
  *                                                                     *
  ************************************************************************/
 
+#if !defined(LIBXML_ICONV_ENABLED) && !defined(LIBXML_ICU_ENABLED) && \
+    defined(LIBXML_ISO8859X_ENABLED)
+
+#define DECLARE_ISO_FUNCS(n) \
+    static int ISO8859_##n##ToUTF8(unsigned char* out, int *outlen, \
+                                   const unsigned char* in, int *inlen); \
+    static int UTF8ToISO8859_##n(unsigned char* out, int *outlen, \
+                                 const unsigned char* in, int *inlen);
+
+/** DOC_DISABLE */
+DECLARE_ISO_FUNCS(2)
+DECLARE_ISO_FUNCS(3)
+DECLARE_ISO_FUNCS(4)
+DECLARE_ISO_FUNCS(5)
+DECLARE_ISO_FUNCS(6)
+DECLARE_ISO_FUNCS(7)
+DECLARE_ISO_FUNCS(8)
+DECLARE_ISO_FUNCS(9)
+DECLARE_ISO_FUNCS(10)
+DECLARE_ISO_FUNCS(11)
+DECLARE_ISO_FUNCS(13)
+DECLARE_ISO_FUNCS(14)
+DECLARE_ISO_FUNCS(15)
+DECLARE_ISO_FUNCS(16)
+/** DOC_ENABLE */
+
+#endif /* LIBXML_ISO8859X_ENABLED */
+
+#ifdef LIBXML_ICONV_ENABLED
+  #define EMPTY_ICONV , (iconv_t) 0, (iconv_t) 0
+#else
+  #define EMPTY_ICONV
+#endif
+
+#ifdef LIBXML_ICU_ENABLED
+  #define EMPTY_UCONV , NULL, NULL
+#else
+  #define EMPTY_UCONV
+#endif
+
+#define MAKE_HANDLER(name, in, out) \
+    { (char *) name, in, out EMPTY_ICONV EMPTY_UCONV }
+
+static const xmlCharEncodingHandler defaultHandlers[] = {
+    MAKE_HANDLER("UTF-8", UTF8ToUTF8, UTF8ToUTF8)
+#ifdef LIBXML_OUTPUT_ENABLED
+    ,MAKE_HANDLER("UTF-16LE", UTF16LEToUTF8, UTF8ToUTF16LE)
+    ,MAKE_HANDLER("UTF-16BE", UTF16BEToUTF8, UTF8ToUTF16BE)
+    ,MAKE_HANDLER("UTF-16", UTF16LEToUTF8, UTF8ToUTF16)
+    ,MAKE_HANDLER("ISO-8859-1", isolat1ToUTF8, UTF8Toisolat1)
+    ,MAKE_HANDLER("ASCII", asciiToUTF8, UTF8Toascii)
+    ,MAKE_HANDLER("US-ASCII", asciiToUTF8, UTF8Toascii)
+#ifdef LIBXML_HTML_ENABLED
+    ,MAKE_HANDLER("HTML", NULL, UTF8ToHtml)
+#endif
+#else
+    ,MAKE_HANDLER("UTF-16LE", UTF16LEToUTF8, NULL)
+    ,MAKE_HANDLER("UTF-16BE", UTF16BEToUTF8, NULL)
+    ,MAKE_HANDLER("UTF-16", UTF16LEToUTF8, NULL)
+    ,MAKE_HANDLER("ISO-8859-1", isolat1ToUTF8, NULL)
+    ,MAKE_HANDLER("ASCII", asciiToUTF8, NULL)
+    ,MAKE_HANDLER("US-ASCII", asciiToUTF8, NULL)
+#endif /* LIBXML_OUTPUT_ENABLED */
+
+#if !defined(LIBXML_ICONV_ENABLED) && !defined(LIBXML_ICU_ENABLED) && \
+    defined(LIBXML_ISO8859X_ENABLED)
+    ,MAKE_HANDLER("ISO-8859-2", ISO8859_2ToUTF8, UTF8ToISO8859_2)
+    ,MAKE_HANDLER("ISO-8859-3", ISO8859_3ToUTF8, UTF8ToISO8859_3)
+    ,MAKE_HANDLER("ISO-8859-4", ISO8859_4ToUTF8, UTF8ToISO8859_4)
+    ,MAKE_HANDLER("ISO-8859-5", ISO8859_5ToUTF8, UTF8ToISO8859_5)
+    ,MAKE_HANDLER("ISO-8859-6", ISO8859_6ToUTF8, UTF8ToISO8859_6)
+    ,MAKE_HANDLER("ISO-8859-7", ISO8859_7ToUTF8, UTF8ToISO8859_7)
+    ,MAKE_HANDLER("ISO-8859-8", ISO8859_8ToUTF8, UTF8ToISO8859_8)
+    ,MAKE_HANDLER("ISO-8859-9", ISO8859_9ToUTF8, UTF8ToISO8859_9)
+    ,MAKE_HANDLER("ISO-8859-10", ISO8859_10ToUTF8, UTF8ToISO8859_10)
+    ,MAKE_HANDLER("ISO-8859-11", ISO8859_11ToUTF8, UTF8ToISO8859_11)
+    ,MAKE_HANDLER("ISO-8859-13", ISO8859_13ToUTF8, UTF8ToISO8859_13)
+    ,MAKE_HANDLER("ISO-8859-14", ISO8859_14ToUTF8, UTF8ToISO8859_14)
+    ,MAKE_HANDLER("ISO-8859-15", ISO8859_15ToUTF8, UTF8ToISO8859_15)
+    ,MAKE_HANDLER("ISO-8859-16", ISO8859_16ToUTF8, UTF8ToISO8859_16)
+#endif
+};
+
+#define NUM_DEFAULT_HANDLERS \
+    (sizeof(defaultHandlers) / sizeof(defaultHandlers[0]))
+
+static const xmlCharEncodingHandler *xmlUTF16LEHandler = &defaultHandlers[1];
+static const xmlCharEncodingHandler *xmlUTF16BEHandler = &defaultHandlers[2];
 
 /* the size should be growable, but it's not a big deal ... */
 #define MAX_ENCODING_HANDLERS 50
 static xmlCharEncodingHandlerPtr *handlers = NULL;
 static int nbCharEncodingHandler = 0;
 
-/*
- * The default is UTF-8 for XML, that's also the default used for the
- * parser internals, so the default encoding handler is NULL
- */
-
-static xmlCharEncodingHandlerPtr xmlDefaultCharEncodingHandler = NULL;
-
 /**
  * xmlNewCharEncodingHandler:
  * @name:  the encoding name, in UTF-8 format (ASCII actually)
@@ -1360,7 +1436,7 @@ xmlNewCharEncodingHandler(const char *name,
        return(NULL);
     }
     for (i = 0;i < 499;i++) {
-        upper[i] = toupper(name[i]);
+        upper[i] = (char) toupper((unsigned char) name[i]);
        if (upper[i] == 0) break;
     }
     upper[i] = 0;
@@ -1408,64 +1484,29 @@ xmlNewCharEncodingHandler(const char *name,
 /**
  * xmlInitCharEncodingHandlers:
  *
- * DEPRECATED: This function will be made private. Call xmlInitParser to
- * initialize the library.
- *
- * Initialize the char encoding support, it registers the default
- * encoding supported.
- * NOTE: while public, this function usually doesn't need to be called
- *       in normal processing.
+ * DEPRECATED: Alias for xmlInitParser.
  */
 void
 xmlInitCharEncodingHandlers(void) {
+    xmlInitParser();
+}
+
+/**
+ * xmlInitEncodingInternal:
+ *
+ * Initialize the char encoding support.
+ */
+void
+xmlInitEncodingInternal(void) {
     unsigned short int tst = 0x1234;
     unsigned char *ptr = (unsigned char *) &tst;
 
-    if (handlers != NULL) return;
-
-    handlers = (xmlCharEncodingHandlerPtr *)
-        xmlMalloc(MAX_ENCODING_HANDLERS * sizeof(xmlCharEncodingHandlerPtr));
-
     if (*ptr == 0x12) xmlLittleEndian = 0;
     else if (*ptr == 0x34) xmlLittleEndian = 1;
     else {
         xmlEncodingErr(XML_ERR_INTERNAL_ERROR,
                       "Odd problem at endianness detection\n", NULL);
     }
-
-    if (handlers == NULL) {
-        xmlEncodingErrMemory("xmlInitCharEncodingHandlers : out of memory !\n");
-       return;
-    }
-    xmlNewCharEncodingHandler("UTF-8", UTF8ToUTF8, UTF8ToUTF8);
-#ifdef LIBXML_OUTPUT_ENABLED
-    xmlUTF16LEHandler =
-          xmlNewCharEncodingHandler("UTF-16LE", UTF16LEToUTF8, UTF8ToUTF16LE);
-    xmlUTF16BEHandler =
-          xmlNewCharEncodingHandler("UTF-16BE", UTF16BEToUTF8, UTF8ToUTF16BE);
-    xmlNewCharEncodingHandler("UTF-16", UTF16LEToUTF8, UTF8ToUTF16);
-    xmlNewCharEncodingHandler("ISO-8859-1", isolat1ToUTF8, UTF8Toisolat1);
-    xmlNewCharEncodingHandler("ASCII", asciiToUTF8, UTF8Toascii);
-    xmlNewCharEncodingHandler("US-ASCII", asciiToUTF8, UTF8Toascii);
-#ifdef LIBXML_HTML_ENABLED
-    xmlNewCharEncodingHandler("HTML", NULL, UTF8ToHtml);
-#endif
-#else
-    xmlUTF16LEHandler =
-          xmlNewCharEncodingHandler("UTF-16LE", UTF16LEToUTF8, NULL);
-    xmlUTF16BEHandler =
-          xmlNewCharEncodingHandler("UTF-16BE", UTF16BEToUTF8, NULL);
-    xmlNewCharEncodingHandler("UTF-16", UTF16LEToUTF8, NULL);
-    xmlNewCharEncodingHandler("ISO-8859-1", isolat1ToUTF8, NULL);
-    xmlNewCharEncodingHandler("ASCII", asciiToUTF8, NULL);
-    xmlNewCharEncodingHandler("US-ASCII", asciiToUTF8, NULL);
-#endif /* LIBXML_OUTPUT_ENABLED */
-#if !defined(LIBXML_ICONV_ENABLED) && !defined(LIBXML_ICU_ENABLED)
-#ifdef LIBXML_ISO8859X_ENABLED
-    xmlRegisterCharEncodingHandlersISO8859x ();
-#endif
-#endif
-
 }
 
 /**
@@ -1496,7 +1537,6 @@ xmlCleanupCharEncodingHandlers(void) {
     xmlFree(handlers);
     handlers = NULL;
     nbCharEncodingHandler = 0;
-    xmlDefaultCharEncodingHandler = NULL;
 }
 
 /**
@@ -1507,11 +1547,17 @@ xmlCleanupCharEncodingHandlers(void) {
  */
 void
 xmlRegisterCharEncodingHandler(xmlCharEncodingHandlerPtr handler) {
-    if (handlers == NULL) xmlInitCharEncodingHandlers();
-    if ((handler == NULL) || (handlers == NULL)) {
+    if (handler == NULL) {
         xmlEncodingErr(XML_I18N_NO_HANDLER,
-               "xmlRegisterCharEncodingHandler: NULL handler !\n", NULL);
-        goto free_handler;
+               "xmlRegisterCharEncodingHandler: NULL handler\n", NULL);
+        return;
+    }
+    if (handlers == NULL) {
+        handlers = xmlMalloc(MAX_ENCODING_HANDLERS * sizeof(handlers[0]));
+        if (handlers == NULL) {
+            xmlEncodingErrMemory("allocating handler table");
+            goto free_handler;
+        }
     }
 
     if (nbCharEncodingHandler >= MAX_ENCODING_HANDLERS) {
@@ -1544,7 +1590,6 @@ xmlCharEncodingHandlerPtr
 xmlGetCharEncodingHandler(xmlCharEncoding enc) {
     xmlCharEncodingHandlerPtr handler;
 
-    if (handlers == NULL) xmlInitCharEncodingHandlers();
     switch (enc) {
         case XML_CHAR_ENCODING_ERROR:
            return(NULL);
@@ -1553,9 +1598,9 @@ xmlGetCharEncodingHandler(xmlCharEncoding enc) {
         case XML_CHAR_ENCODING_UTF8:
            return(NULL);
         case XML_CHAR_ENCODING_UTF16LE:
-           return(xmlUTF16LEHandler);
+           return((xmlCharEncodingHandlerPtr) xmlUTF16LEHandler);
         case XML_CHAR_ENCODING_UTF16BE:
-           return(xmlUTF16BEHandler);
+           return((xmlCharEncodingHandlerPtr) xmlUTF16BEHandler);
         case XML_CHAR_ENCODING_EBCDIC:
             handler = xmlFindCharEncodingHandler("EBCDIC");
             if (handler != NULL) return(handler);
@@ -1670,7 +1715,8 @@ xmlGetCharEncodingHandler(xmlCharEncoding enc) {
  * xmlFindCharEncodingHandler:
  * @name:  a string describing the char encoding.
  *
- * Search in the registered set the handler able to read/write that encoding.
+ * Search in the registered set the handler able to read/write that encoding
+ * or create a new one.
  *
  * Returns the handler or NULL if not found
  */
@@ -1690,9 +1736,8 @@ xmlFindCharEncodingHandler(const char *name) {
     char upper[100];
     int i;
 
-    if (handlers == NULL) xmlInitCharEncodingHandlers();
-    if (name == NULL) return(xmlDefaultCharEncodingHandler);
-    if (name[0] == 0) return(xmlDefaultCharEncodingHandler);
+    if (name == NULL) return(NULL);
+    if (name[0] == 0) return(NULL);
 
     /*
      * Do the alias resolution
@@ -1706,11 +1751,16 @@ xmlFindCharEncodingHandler(const char *name) {
      * Check first for directly registered encoding names
      */
     for (i = 0;i < 99;i++) {
-        upper[i] = toupper(name[i]);
+        upper[i] = (char) toupper((unsigned char) name[i]);
        if (upper[i] == 0) break;
     }
     upper[i] = 0;
 
+    for (i = 0; i < (int) NUM_DEFAULT_HANDLERS; i++) {
+        if (strcmp(upper, defaultHandlers[i].name) == 0)
+            return((xmlCharEncodingHandlerPtr) &defaultHandlers[i]);
+    }
+
     if (handlers != NULL) {
         for (i = 0;i < nbCharEncodingHandler; i++) {
             if (!strcmp(upper, handlers[i]->name)) {
@@ -1743,6 +1793,12 @@ xmlFindCharEncodingHandler(const char *name) {
            }
             memset(enc, 0, sizeof(xmlCharEncodingHandler));
            enc->name = xmlMemStrdup(name);
+            if (enc->name == NULL) {
+                xmlFree(enc);
+                iconv_close(icv_in);
+                iconv_close(icv_out);
+                return(NULL);
+            }
            enc->input = NULL;
            enc->output = NULL;
            enc->iconv_in = icv_in;
@@ -1775,6 +1831,12 @@ xmlFindCharEncodingHandler(const char *name) {
            }
             memset(encu, 0, sizeof(xmlCharEncodingHandler));
            encu->name = xmlMemStrdup(name);
+            if (encu->name == NULL) {
+                xmlFree(encu);
+                closeIcuConverter(ucv_in);
+                closeIcuConverter(ucv_out);
+                return(NULL);
+            }
            encu->input = NULL;
            encu->output = NULL;
            encu->uconv_in = ucv_in;
@@ -1926,22 +1988,18 @@ xmlUconvWrapper(uconv_t *cd, int toUnicode, unsigned char *out, int *outlen,
         ucnv_convertEx(cd->utf8, cd->uconv, &ucv_out, ucv_out + *outlen,
                        &ucv_in, ucv_in + *inlen, cd->pivot_buf,
                        &cd->pivot_source, &cd->pivot_target,
-                       cd->pivot_buf + ICU_PIVOT_BUF_SIZE, 0, flush, &err);
+                       cd->pivot_buf + ICU_PIVOT_BUF_SIZE, 0, 0, &err);
     } else {
         /* UTF-8 => UTF-16 => encoding */
         ucnv_convertEx(cd->uconv, cd->utf8, &ucv_out, ucv_out + *outlen,
                        &ucv_in, ucv_in + *inlen, cd->pivot_buf,
                        &cd->pivot_source, &cd->pivot_target,
-                       cd->pivot_buf + ICU_PIVOT_BUF_SIZE, 0, flush, &err);
+                       cd->pivot_buf + ICU_PIVOT_BUF_SIZE, 0, 0, &err);
     }
     *inlen = ucv_in - (const char*) in;
     *outlen = ucv_out - (char *) out;
-    if (U_SUCCESS(err)) {
-        /* reset pivot buf if this is the last call for input (flush==TRUE) */
-        if (flush)
-            cd->pivot_source = cd->pivot_target = cd->pivot_buf;
+    if (U_SUCCESS(err))
         return 0;
-    }
     if (err == U_BUFFER_OVERFLOW_ERROR)
         return -1;
     if (err == U_INVALID_CHAR_FOUND || err == U_ILLEGAL_CHAR_FOUND)
@@ -1975,7 +2033,7 @@ xmlUconvWrapper(uconv_t *cd, int toUnicode, unsigned char *out, int *outlen,
  *     as the return value is 0, else unpredictable.
  * The value of @outlen after return is the number of octets produced.
  */
-static int
+int
 xmlEncInputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
                  int *outlen, const unsigned char *in, int *inlen, int flush) {
     int ret;
@@ -2056,220 +2114,17 @@ xmlEncOutputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
 }
 
 /**
- * xmlCharEncFirstLineInt:
- * @handler:   char encoding transformation data structure
- * @out:  an xmlBuffer for the output.
- * @in:  an xmlBuffer for the input
- * @len:  number of bytes to convert for the first line, or -1
- *
- * Front-end for the encoding handler input function, but handle only
- * the very first line, i.e. limit itself to 45 chars.
- *
- * Returns the number of byte written if success, or
- *     -1 general error
- *     -2 if the transcoding fails (for *in is not valid utf8 string or
- *        the result of transformation can't fit into the encoding we want), or
- */
-int
-xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out,
-                       xmlBufferPtr in, int len) {
-    int ret;
-    int written;
-    int toconv;
-
-    if (handler == NULL) return(-1);
-    if (out == NULL) return(-1);
-    if (in == NULL) return(-1);
-
-    /* calculate space available */
-    written = out->size - out->use - 1; /* count '\0' */
-    toconv = in->use;
-    /*
-     * echo '<?xml version="1.0" encoding="UCS4"?>' | wc -c => 38
-     * 45 chars should be sufficient to reach the end of the encoding
-     * declaration without going too far inside the document content.
-     * on UTF-16 this means 90bytes, on UCS4 this means 180
-     * The actual value depending on guessed encoding is passed as @len
-     * if provided
-     */
-    if (len >= 0) {
-        if (toconv > len)
-            toconv = len;
-    } else {
-        if (toconv > 180)
-            toconv = 180;
-    }
-    if (toconv * 2 >= written) {
-        xmlBufferGrow(out, toconv * 2);
-       written = out->size - out->use - 1;
-    }
-
-    ret = xmlEncInputChunk(handler, &out->content[out->use], &written,
-                           in->content, &toconv, 0);
-    xmlBufferShrink(in, toconv);
-    out->use += written;
-    out->content[out->use] = 0;
-    if (ret == -1) ret = -3;
-
-#ifdef DEBUG_ENCODING
-    switch (ret) {
-        case 0:
-           xmlGenericError(xmlGenericErrorContext,
-                   "converted %d bytes to %d bytes of input\n",
-                   toconv, written);
-           break;
-        case -1:
-           xmlGenericError(xmlGenericErrorContext,"converted %d bytes to %d bytes of input, %d left\n",
-                   toconv, written, in->use);
-           break;
-        case -2:
-           xmlGenericError(xmlGenericErrorContext,
-                   "input conversion failed due to input error\n");
-           break;
-        case -3:
-           xmlGenericError(xmlGenericErrorContext,"converted %d bytes to %d bytes of input, %d left\n",
-                   toconv, written, in->use);
-           break;
-       default:
-           xmlGenericError(xmlGenericErrorContext,"Unknown input conversion failed %d\n", ret);
-    }
-#endif /* DEBUG_ENCODING */
-    /*
-     * Ignore when input buffer is not on a boundary
-     */
-    if (ret == -3) ret = 0;
-    if (ret == -1) ret = 0;
-    return(written ? written : ret);
-}
-
-/**
  * xmlCharEncFirstLine:
  * @handler:   char encoding transformation data structure
  * @out:  an xmlBuffer for the output.
  * @in:  an xmlBuffer for the input
  *
- * Front-end for the encoding handler input function, but handle only
- * the very first line, i.e. limit itself to 45 chars.
- *
- * Returns the number of byte written if success, or
- *     -1 general error
- *     -2 if the transcoding fails (for *in is not valid utf8 string or
- *        the result of transformation can't fit into the encoding we want), or
+ * DEPERECATED: Don't use.
  */
 int
 xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out,
-                 xmlBufferPtr in) {
-    return(xmlCharEncFirstLineInt(handler, out, in, -1));
-}
-
-/**
- * xmlCharEncFirstLineInput:
- * @input: a parser input buffer
- * @len:  number of bytes to convert for the first line, or -1
- *
- * Front-end for the encoding handler input function, but handle only
- * the very first line. Point is that this is based on autodetection
- * of the encoding and once that first line is converted we may find
- * out that a different decoder is needed to process the input.
- *
- * Returns the number of byte written if success, or
- *     -1 general error
- *     -2 if the transcoding fails (for *in is not valid utf8 string or
- *        the result of transformation can't fit into the encoding we want), or
- */
-int
-xmlCharEncFirstLineInput(xmlParserInputBufferPtr input, int len)
-{
-    int ret;
-    size_t written;
-    size_t toconv;
-    int c_in;
-    int c_out;
-    xmlBufPtr in;
-    xmlBufPtr out;
-
-    if ((input == NULL) || (input->encoder == NULL) ||
-        (input->buffer == NULL) || (input->raw == NULL))
-        return (-1);
-    out = input->buffer;
-    in = input->raw;
-
-    toconv = xmlBufUse(in);
-    if (toconv == 0)
-        return (0);
-    written = xmlBufAvail(out);
-    /*
-     * echo '<?xml version="1.0" encoding="UCS4"?>' | wc -c => 38
-     * 45 chars should be sufficient to reach the end of the encoding
-     * declaration without going too far inside the document content.
-     * on UTF-16 this means 90bytes, on UCS4 this means 180
-     * The actual value depending on guessed encoding is passed as @len
-     * if provided
-     */
-    if (len >= 0) {
-        if (toconv > (unsigned int) len)
-            toconv = len;
-    } else {
-        if (toconv > 180)
-            toconv = 180;
-    }
-    if (toconv * 2 >= written) {
-        xmlBufGrow(out, toconv * 2);
-        written = xmlBufAvail(out);
-    }
-    if (written > 360)
-        written = 360;
-
-    c_in = toconv;
-    c_out = written;
-    ret = xmlEncInputChunk(input->encoder, xmlBufEnd(out), &c_out,
-                           xmlBufContent(in), &c_in, 0);
-    xmlBufShrink(in, c_in);
-    xmlBufAddLen(out, c_out);
-    if (ret == -1)
-        ret = -3;
-
-    switch (ret) {
-        case 0:
-#ifdef DEBUG_ENCODING
-            xmlGenericError(xmlGenericErrorContext,
-                            "converted %d bytes to %d bytes of input\n",
-                            c_in, c_out);
-#endif
-            break;
-        case -1:
-#ifdef DEBUG_ENCODING
-            xmlGenericError(xmlGenericErrorContext,
-                         "converted %d bytes to %d bytes of input, %d left\n",
-                            c_in, c_out, (int)xmlBufUse(in));
-#endif
-            break;
-        case -3:
-#ifdef DEBUG_ENCODING
-            xmlGenericError(xmlGenericErrorContext,
-                        "converted %d bytes to %d bytes of input, %d left\n",
-                            c_in, c_out, (int)xmlBufUse(in));
-#endif
-            break;
-        case -2: {
-            char buf[50];
-            const xmlChar *content = xmlBufContent(in);
-
-           snprintf(&buf[0], 49, "0x%02X 0x%02X 0x%02X 0x%02X",
-                    content[0], content[1],
-                    content[2], content[3]);
-           buf[49] = 0;
-           xmlEncodingErr(XML_I18N_CONV_FAILED,
-                   "input conversion failed due to input error, bytes %s\n",
-                          buf);
-        }
-    }
-    /*
-     * Ignore when input buffer is not on a boundary
-     */
-    if (ret == -3) ret = 0;
-    if (ret == -1) ret = 0;
-    return(c_out ? c_out : ret);
+                    xmlBufferPtr in) {
+    return(xmlCharEncInFunc(handler, out, in));
 }
 
 /**
@@ -2308,7 +2163,8 @@ xmlCharEncInput(xmlParserInputBufferPtr input, int flush)
         toconv = 64 * 1024;
     written = xmlBufAvail(out);
     if (toconv * 2 >= written) {
-        xmlBufGrow(out, toconv * 2);
+        if (xmlBufGrow(out, toconv * 2) < 0)
+            return (-1);
         written = xmlBufAvail(out);
     }
     if ((written > 128 * 1024) && (flush == 0))
@@ -2569,7 +2425,7 @@ retry:
             break;
         case -2: {
            xmlChar charref[20];
-           int len = (int) xmlBufUse(in);
+           int len = xmlBufUse(in);
             xmlChar *content = xmlBufContent(in);
            int cur, charrefLen;
 
@@ -2609,8 +2465,7 @@ retry:
                xmlEncodingErr(XML_I18N_CONV_FAILED,
                    "output conversion failed due to conv error, bytes %s\n",
                               buf);
-               if (xmlBufGetAllocationScheme(in) != XML_BUFFER_ALLOC_IMMUTABLE)
-                   content[0] = ' ';
+               content[0] = ' ';
                 break;
            }
 
@@ -2770,8 +2625,7 @@ retry:
                xmlEncodingErr(XML_I18N_CONV_FAILED,
                    "output conversion failed due to conv error, bytes %s\n",
                               buf);
-               if (in->alloc != XML_BUFFER_ALLOC_IMMUTABLE)
-                   in->content[0] = ' ';
+               in->content[0] = ' ';
                break;
            }
 
@@ -2796,19 +2650,19 @@ int
 xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) {
     int ret = 0;
     int tofree = 0;
-    int i, handler_in_list = 0;
-
-    /* Avoid unused variable warning if features are disabled. */
-    (void) handler_in_list;
+    int i = 0;
 
     if (handler == NULL) return(-1);
-    if (handler->name == NULL) return(-1);
+
+    for (i = 0; i < (int) NUM_DEFAULT_HANDLERS; i++) {
+        if (handler == &defaultHandlers[i])
+            return(0);
+    }
+
     if (handlers != NULL) {
         for (i = 0;i < nbCharEncodingHandler; i++) {
-            if (handler == handlers[i]) {
-               handler_in_list = 1;
-               break;
-           }
+            if (handler == handlers[i])
+                return(0);
        }
     }
 #ifdef LIBXML_ICONV_ENABLED
@@ -2816,8 +2670,7 @@ xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) {
      * Iconv handlers can be used only once, free the whole block.
      * and the associated icon resources.
      */
-    if ((handler_in_list == 0) &&
-        ((handler->iconv_out != NULL) || (handler->iconv_in != NULL))) {
+    if ((handler->iconv_out != NULL) || (handler->iconv_in != NULL)) {
         tofree = 1;
        if (handler->iconv_out != NULL) {
            if (iconv_close(handler->iconv_out))
@@ -2832,8 +2685,7 @@ xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) {
     }
 #endif /* LIBXML_ICONV_ENABLED */
 #ifdef LIBXML_ICU_ENABLED
-    if ((handler_in_list == 0) &&
-        ((handler->uconv_out != NULL) || (handler->uconv_in != NULL))) {
+    if ((handler->uconv_out != NULL) || (handler->uconv_in != NULL)) {
         tofree = 1;
        if (handler->uconv_out != NULL) {
            closeIcuConverter(handler->uconv_out);
@@ -3972,24 +3824,6 @@ static int UTF8ToISO8859_16 (unsigned char* out, int *outlen,
     return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_16);
 }
 
-static void
-xmlRegisterCharEncodingHandlersISO8859x (void) {
-    xmlNewCharEncodingHandler ("ISO-8859-2", ISO8859_2ToUTF8, UTF8ToISO8859_2);
-    xmlNewCharEncodingHandler ("ISO-8859-3", ISO8859_3ToUTF8, UTF8ToISO8859_3);
-    xmlNewCharEncodingHandler ("ISO-8859-4", ISO8859_4ToUTF8, UTF8ToISO8859_4);
-    xmlNewCharEncodingHandler ("ISO-8859-5", ISO8859_5ToUTF8, UTF8ToISO8859_5);
-    xmlNewCharEncodingHandler ("ISO-8859-6", ISO8859_6ToUTF8, UTF8ToISO8859_6);
-    xmlNewCharEncodingHandler ("ISO-8859-7", ISO8859_7ToUTF8, UTF8ToISO8859_7);
-    xmlNewCharEncodingHandler ("ISO-8859-8", ISO8859_8ToUTF8, UTF8ToISO8859_8);
-    xmlNewCharEncodingHandler ("ISO-8859-9", ISO8859_9ToUTF8, UTF8ToISO8859_9);
-    xmlNewCharEncodingHandler ("ISO-8859-10", ISO8859_10ToUTF8, UTF8ToISO8859_10);
-    xmlNewCharEncodingHandler ("ISO-8859-11", ISO8859_11ToUTF8, UTF8ToISO8859_11);
-    xmlNewCharEncodingHandler ("ISO-8859-13", ISO8859_13ToUTF8, UTF8ToISO8859_13);
-    xmlNewCharEncodingHandler ("ISO-8859-14", ISO8859_14ToUTF8, UTF8ToISO8859_14);
-    xmlNewCharEncodingHandler ("ISO-8859-15", ISO8859_15ToUTF8, UTF8ToISO8859_15);
-    xmlNewCharEncodingHandler ("ISO-8859-16", ISO8859_16ToUTF8, UTF8ToISO8859_16);
-}
-
 #endif
 #endif
 
index 8443551..52eb9d5 100644 (file)
@@ -26,7 +26,8 @@
 #include <libxml/globals.h>
 #include <libxml/dict.h>
 
-#include "save.h"
+#include "private/entities.h"
+#include "private/error.h"
 
 /*
  * The XML predefined entities.
@@ -37,35 +38,35 @@ static xmlEntity xmlEntityLt = {
     NULL, NULL, NULL, NULL, NULL, NULL,
     BAD_CAST "<", BAD_CAST "<", 1,
     XML_INTERNAL_PREDEFINED_ENTITY,
-    NULL, NULL, NULL, NULL, 0, 1
+    NULL, NULL, NULL, NULL, 0, 0, 0
 };
 static xmlEntity xmlEntityGt = {
     NULL, XML_ENTITY_DECL, BAD_CAST "gt",
     NULL, NULL, NULL, NULL, NULL, NULL,
     BAD_CAST ">", BAD_CAST ">", 1,
     XML_INTERNAL_PREDEFINED_ENTITY,
-    NULL, NULL, NULL, NULL, 0, 1
+    NULL, NULL, NULL, NULL, 0, 0, 0
 };
 static xmlEntity xmlEntityAmp = {
     NULL, XML_ENTITY_DECL, BAD_CAST "amp",
     NULL, NULL, NULL, NULL, NULL, NULL,
     BAD_CAST "&", BAD_CAST "&", 1,
     XML_INTERNAL_PREDEFINED_ENTITY,
-    NULL, NULL, NULL, NULL, 0, 1
+    NULL, NULL, NULL, NULL, 0, 0, 0
 };
 static xmlEntity xmlEntityQuot = {
     NULL, XML_ENTITY_DECL, BAD_CAST "quot",
     NULL, NULL, NULL, NULL, NULL, NULL,
     BAD_CAST "\"", BAD_CAST "\"", 1,
     XML_INTERNAL_PREDEFINED_ENTITY,
-    NULL, NULL, NULL, NULL, 0, 1
+    NULL, NULL, NULL, NULL, 0, 0, 0
 };
 static xmlEntity xmlEntityApos = {
     NULL, XML_ENTITY_DECL, BAD_CAST "apos",
     NULL, NULL, NULL, NULL, NULL, NULL,
     BAD_CAST "'", BAD_CAST "'", 1,
     XML_INTERNAL_PREDEFINED_ENTITY,
-    NULL, NULL, NULL, NULL, 0, 1
+    NULL, NULL, NULL, NULL, 0, 0, 0
 };
 
 /**
@@ -128,36 +129,19 @@ xmlFreeEntity(xmlEntityPtr entity)
     if ((entity->children) && (entity->owner == 1) &&
         (entity == (xmlEntityPtr) entity->children->parent))
         xmlFreeNodeList(entity->children);
-    if (dict != NULL) {
-        if ((entity->name != NULL) && (!xmlDictOwns(dict, entity->name)))
-            xmlFree((char *) entity->name);
-        if ((entity->ExternalID != NULL) &&
-           (!xmlDictOwns(dict, entity->ExternalID)))
-            xmlFree((char *) entity->ExternalID);
-        if ((entity->SystemID != NULL) &&
-           (!xmlDictOwns(dict, entity->SystemID)))
-            xmlFree((char *) entity->SystemID);
-        if ((entity->URI != NULL) && (!xmlDictOwns(dict, entity->URI)))
-            xmlFree((char *) entity->URI);
-        if ((entity->content != NULL)
-            && (!xmlDictOwns(dict, entity->content)))
-            xmlFree((char *) entity->content);
-        if ((entity->orig != NULL) && (!xmlDictOwns(dict, entity->orig)))
-            xmlFree((char *) entity->orig);
-    } else {
-        if (entity->name != NULL)
-            xmlFree((char *) entity->name);
-        if (entity->ExternalID != NULL)
-            xmlFree((char *) entity->ExternalID);
-        if (entity->SystemID != NULL)
-            xmlFree((char *) entity->SystemID);
-        if (entity->URI != NULL)
-            xmlFree((char *) entity->URI);
-        if (entity->content != NULL)
-            xmlFree((char *) entity->content);
-        if (entity->orig != NULL)
-            xmlFree((char *) entity->orig);
-    }
+    if ((entity->name != NULL) &&
+        ((dict == NULL) || (!xmlDictOwns(dict, entity->name))))
+        xmlFree((char *) entity->name);
+    if (entity->ExternalID != NULL)
+        xmlFree((char *) entity->ExternalID);
+    if (entity->SystemID != NULL)
+        xmlFree((char *) entity->SystemID);
+    if (entity->URI != NULL)
+        xmlFree((char *) entity->URI);
+    if (entity->content != NULL)
+        xmlFree((char *) entity->content);
+    if (entity->orig != NULL)
+        xmlFree((char *) entity->orig);
     xmlFree(entity);
 }
 
@@ -179,7 +163,6 @@ xmlCreateEntity(xmlDictPtr dict, const xmlChar *name, int type,
     }
     memset(ret, 0, sizeof(xmlEntity));
     ret->type = XML_ENTITY_DECL;
-    ret->checked = 0;
 
     /*
      * fill the structure.
@@ -193,18 +176,12 @@ xmlCreateEntity(xmlDictPtr dict, const xmlChar *name, int type,
            ret->SystemID = xmlStrdup(SystemID);
     } else {
         ret->name = xmlDictLookup(dict, name, -1);
-       if (ExternalID != NULL)
-           ret->ExternalID = xmlDictLookup(dict, ExternalID, -1);
-       if (SystemID != NULL)
-           ret->SystemID = xmlDictLookup(dict, SystemID, -1);
+       ret->ExternalID = xmlStrdup(ExternalID);
+       ret->SystemID = xmlStrdup(SystemID);
     }
     if (content != NULL) {
         ret->length = xmlStrlen(content);
-       if ((dict != NULL) && (ret->length < 5))
-           ret->content = (xmlChar *)
-                          xmlDictLookup(dict, content, ret->length);
-       else
-           ret->content = xmlStrndup(content, ret->length);
+       ret->content = xmlStrndup(content, ret->length);
      } else {
         ret->length = 0;
         ret->content = NULL;
@@ -627,7 +604,7 @@ xmlEncodeEntitiesInternal(xmlDocPtr doc, const xmlChar *input, int attr) {
      * allocate an translation buffer.
      */
     buffer_size = 1000;
-    buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
+    buffer = (xmlChar *) xmlMalloc(buffer_size);
     if (buffer == NULL) {
         xmlEntitiesErrMemory("xmlEncodeEntities: malloc failed");
        return(NULL);
@@ -867,7 +844,7 @@ xmlEncodeSpecialChars(const xmlDoc *doc ATTRIBUTE_UNUSED, const xmlChar *input)
      * allocate an translation buffer.
      */
     buffer_size = 1000;
-    buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
+    buffer = (xmlChar *) xmlMalloc(buffer_size);
     if (buffer == NULL) {
         xmlEntitiesErrMemory("xmlEncodeSpecialChars: malloc failed");
        return(NULL);
@@ -1033,7 +1010,6 @@ xmlCopyEntitiesTable(xmlEntitiesTablePtr table) {
  */
 static void
 xmlDumpEntityContent(xmlBufferPtr buf, const xmlChar *content) {
-    if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return;
     if (xmlStrchr(content, '%')) {
         const xmlChar * base, *cur;
 
diff --git a/error.c b/error.c
index 5f42ead..4de1418 100644 (file)
--- a/error.c
+++ b/error.c
@@ -16,9 +16,9 @@
 #include <libxml/xmlmemory.h>
 #include <libxml/globals.h>
 
-void XMLCDECL xmlGenericErrorDefaultFunc       (void *ctx ATTRIBUTE_UNUSED,
-                                const char *msg,
-                                ...) LIBXML_ATTR_FORMAT(2,3);
+#include "private/error.h"
+
+#define XML_MAX_ERRORS 100
 
 #define XML_GET_VAR_STR(msg, str) {                            \
     int       size, prev_size = -1;                            \
@@ -67,7 +67,7 @@ void XMLCDECL xmlGenericErrorDefaultFunc      (void *ctx ATTRIBUTE_UNUSED,
  *
  * Default handler for out of context error messages.
  */
-void XMLCDECL
+void
 xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
     va_list args;
 
@@ -83,6 +83,8 @@ xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
  * initGenericErrorDefaultFunc:
  * @handler:  the handler
  *
+ * DEPRECATED: Use xmlSetGenericErrorFunc.
+ *
  * Set or reset (if NULL) the default handler for generic errors
  * to the builtin error function.
  */
@@ -163,7 +165,7 @@ xmlParserPrintFileInfo(xmlParserInputPtr input) {
 }
 
 /**
- * xmlParserPrintFileContext:
+ * xmlParserPrintFileContextInternal:
  * @input:  an xmlParserInputPtr input
  *
  * Displays current context within the input content for error tracking
@@ -172,7 +174,7 @@ xmlParserPrintFileInfo(xmlParserInputPtr input) {
 static void
 xmlParserPrintFileContextInternal(xmlParserInputPtr input ,
                xmlGenericErrorFunc channel, void *data ) {
-    const xmlChar *cur, *base;
+    const xmlChar *cur, *base, *start;
     unsigned int n, col;       /* GCC warns if signed, because compared with sizeof() */
     xmlChar  content[81]; /* space for 80 chars + line terminator */
     xmlChar *ctnt;
@@ -188,22 +190,35 @@ xmlParserPrintFileContextInternal(xmlParserInputPtr input ,
     }
     n = 0;
     /* search backwards for beginning-of-line (to max buff size) */
-    while ((n++ < (sizeof(content)-1)) && (cur > base) &&
-          (*(cur) != '\n') && (*(cur) != '\r'))
+    while ((n < sizeof(content) - 1) && (cur > base) &&
+          (*cur != '\n') && (*cur != '\r')) {
         cur--;
-    if ((*(cur) == '\n') || (*(cur) == '\r')) cur++;
+        n++;
+    }
+    if ((n > 0) && ((*cur == '\n') || (*cur == '\r'))) {
+        cur++;
+    } else {
+        /* skip over continuation bytes */
+        while ((cur < input->cur) && ((*cur & 0xC0) == 0x80))
+            cur++;
+    }
     /* calculate the error position in terms of the current position */
     col = input->cur - cur;
     /* search forward for end-of-line (to max buff size) */
     n = 0;
-    ctnt = content;
+    start = cur;
     /* copy selected text to our buffer */
-    while ((*cur != 0) && (*(cur) != '\n') &&
-          (*(cur) != '\r') && (n < sizeof(content)-1)) {
-               *ctnt++ = *cur++;
-       n++;
+    while ((*cur != 0) && (*(cur) != '\n') && (*(cur) != '\r')) {
+        int len = input->end - cur;
+        int c = xmlGetUTF8Char(cur, &len);
+
+        if ((c < 0) || (n + len > sizeof(content)-1))
+            break;
+        cur += len;
+       n += len;
     }
-    *ctnt = 0;
+    memcpy(content, start, n);
+    content[n] = 0;
     /* print out the selected text */
     channel(data ,"%s\n", content);
     /* create blank line with problem pointer */
@@ -451,7 +466,7 @@ xmlReportError(xmlErrorPtr err, xmlParserCtxtPtr ctxt, const char *str,
  * then forward the error message down the parser or generic
  * error callback handler
  */
-void XMLCDECL
+void
 __xmlRaiseError(xmlStructuredErrorFunc schannel,
               xmlGenericErrorFunc channel, void *data, void *ctx,
               void *nod, int domain, int code, xmlErrorLevel level,
@@ -474,12 +489,25 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel,
         (domain == XML_FROM_DTD) || (domain == XML_FROM_NAMESPACE) ||
        (domain == XML_FROM_IO) || (domain == XML_FROM_VALID)) {
        ctxt = (xmlParserCtxtPtr) ctx;
-       if ((schannel == NULL) && (ctxt != NULL) && (ctxt->sax != NULL) &&
-           (ctxt->sax->initialized == XML_SAX2_MAGIC) &&
-           (ctxt->sax->serror != NULL)) {
-           schannel = ctxt->sax->serror;
-           data = ctxt->userData;
-       }
+
+        if (ctxt != NULL) {
+            if (level == XML_ERR_WARNING) {
+                if (ctxt->nbWarnings >= XML_MAX_ERRORS)
+                    return;
+                ctxt->nbWarnings += 1;
+            } else {
+                if (ctxt->nbErrors >= XML_MAX_ERRORS)
+                    return;
+                ctxt->nbErrors += 1;
+            }
+
+            if ((schannel == NULL) && (ctxt->sax != NULL) &&
+                (ctxt->sax->initialized == XML_SAX2_MAGIC) &&
+                (ctxt->sax->serror != NULL)) {
+                schannel = ctxt->sax->serror;
+                data = ctxt->userData;
+            }
+        }
     }
     /*
      * Check if structured error handler set
@@ -677,7 +705,7 @@ __xmlSimpleError(int domain, int code, xmlNodePtr node,
  * Display and format an error messages, gives file, line, position and
  * extra parameters.
  */
-void XMLCDECL
+void
 xmlParserError(void *ctx, const char *msg, ...)
 {
     xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
@@ -720,7 +748,7 @@ xmlParserError(void *ctx, const char *msg, ...)
  * Display and format a warning messages, gives file, line, position and
  * extra parameters.
  */
-void XMLCDECL
+void
 xmlParserWarning(void *ctx, const char *msg, ...)
 {
     xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
@@ -769,7 +797,7 @@ xmlParserWarning(void *ctx, const char *msg, ...)
  * Display and format an validity error messages, gives file,
  * line, position and extra parameters.
  */
-void XMLCDECL
+void
 xmlParserValidityError(void *ctx, const char *msg, ...)
 {
     xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
@@ -813,7 +841,7 @@ xmlParserValidityError(void *ctx, const char *msg, ...)
  * Display and format a validity warning messages, gives file, line,
  * position and extra parameters.
  */
-void XMLCDECL
+void
 xmlParserValidityWarning(void *ctx, const char *msg, ...)
 {
     xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
index 9a5f72a..0406fc5 100644 (file)
@@ -6,5 +6,7 @@ schema
 seed/
 testFuzzer
 uri
+valid
+xinclude
 xml
 xpath
index 6d59816..8e24b59 100644 (file)
@@ -1,5 +1,5 @@
 AUTOMAKE_OPTIONS = -Wno-syntax
-EXTRA_PROGRAMS = genSeed html regexp schema uri xml xpath
+EXTRA_PROGRAMS = genSeed html regexp schema uri valid xinclude xml xpath
 check_PROGRAMS = testFuzzer
 EXTRA_DIST = html.dict regexp.dict schema.dict xml.dict xpath.dict \
             static_seed/uri static_seed/regexp fuzz.h
@@ -15,11 +15,11 @@ XML_SEED_CORPUS_SRC = \
     '$(top_srcdir)/test/errors/*.xml' \
     '$(top_srcdir)/test/errors10/*.xml' \
     '$(top_srcdir)/test/namespaces/*' \
+    '$(top_srcdir)/test/recurse/*.xml' \
     '$(top_srcdir)/test/SVG/*.xml' \
     '$(top_srcdir)/test/valid/*.xml' \
     '$(top_srcdir)/test/VC/*' \
     '$(top_srcdir)/test/VCM/*' \
-    '$(top_srcdir)/test/XInclude/docs/*' \
     '$(top_srcdir)/test/xmlid/*'
 
 testFuzzer_SOURCES = testFuzzer.c fuzz.c
@@ -27,7 +27,7 @@ testFuzzer_SOURCES = testFuzzer.c fuzz.c
 .PHONY: corpus clean-corpus
 
 corpus: seed/html.stamp seed/regexp.stamp seed/schema.stamp seed/uri.stamp \
-    seed/xml.stamp seed/xpath.stamp
+    seed/valid.stamp seed/xinclude.stamp seed/xml.stamp seed/xpath.stamp
 
 check-local: corpus
        ./testFuzzer$(EXEEXT)
@@ -49,7 +49,7 @@ seed/xml.stamp: genSeed$(EXEEXT)
        @touch seed/xml.stamp
 
 xml_SOURCES = xml.c fuzz.c
-xml_LDFLAGS = -fsanitize=fuzzer
+xml_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
 
 fuzz-xml: xml$(EXEEXT) seed/xml.stamp
        @mkdir -p corpus/xml
@@ -59,6 +59,44 @@ fuzz-xml: xml$(EXEEXT) seed/xml.stamp
            -timeout=20 \
            corpus/xml seed/xml
 
+# DTD validation fuzzer
+
+seed/valid.stamp: genSeed$(EXEEXT)
+       @mkdir -p seed/valid
+       ./genSeed$(EXEEXT) valid $(XML_SEED_CORPUS_SRC)
+       @touch seed/valid.stamp
+
+valid_SOURCES = valid.c fuzz.c
+valid_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
+
+fuzz-valid: valid$(EXEEXT) seed/valid.stamp
+       @mkdir -p corpus/valid
+       ./valid$(EXEEXT) \
+           -dict=xml.dict \
+           -max_len=$(XML_MAX_LEN) \
+           -timeout=20 \
+           corpus/valid seed/valid
+
+# XInclude fuzzer
+
+seed/xinclude.stamp: genSeed$(EXEEXT)
+       @mkdir -p seed/xinclude
+       ./genSeed$(EXEEXT) xinclude \
+           '$(top_srcdir)/test/XInclude/docs/*' \
+           '$(top_srcdir)/test/XInclude/without-reader/*'
+       @touch seed/xinclude.stamp
+
+xinclude_SOURCES = xinclude.c fuzz.c
+xinclude_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
+
+fuzz-xinclude: xinclude$(EXEEXT) seed/xinclude.stamp
+       @mkdir -p corpus/xinclude
+       ./xinclude$(EXEEXT) \
+           -dict=xml.dict \
+           -max_len=$(XML_MAX_LEN) \
+           -timeout=20 \
+           corpus/xinclude seed/xinclude
+
 # HTML fuzzer
 
 seed/html.stamp: genSeed$(EXEEXT)
@@ -67,7 +105,7 @@ seed/html.stamp: genSeed$(EXEEXT)
        @touch seed/html.stamp
 
 html_SOURCES = html.c fuzz.c
-html_LDFLAGS = -fsanitize=fuzzer
+html_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
 
 fuzz-html: html$(EXEEXT) seed/html.stamp
        @mkdir -p corpus/html
@@ -85,9 +123,9 @@ seed/regexp.stamp:
        @touch seed/regexp.stamp
 
 regexp_SOURCES = regexp.c fuzz.c
-regexp_LDFLAGS = -fsanitize=fuzzer
+regexp_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
 
-fuzz-regexp: regexp$(EXEEXT)
+fuzz-regexp: regexp$(EXEEXT) seed/regexp.stamp
        @mkdir -p corpus/regexp
        ./regexp$(EXEEXT) \
            -dict=regexp.dict \
@@ -103,9 +141,9 @@ seed/uri.stamp:
        @touch seed/uri.stamp
 
 uri_SOURCES = uri.c fuzz.c
-uri_LDFLAGS = -fsanitize=fuzzer
+uri_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
 
-fuzz-uri: uri$(EXEEXT)
+fuzz-uri: uri$(EXEEXT) seed/uri.stamp
        @mkdir -p corpus/uri
        ./uri$(EXEEXT) \
            -max_len=10000 \
@@ -120,7 +158,7 @@ seed/schema.stamp: genSeed$(EXEEXT)
        @touch seed/schema.stamp
 
 schema_SOURCES = schema.c fuzz.c
-schema_LDFLAGS = -fsanitize=fuzzer
+schema_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
 
 fuzz-schema: schema$(EXEEXT) seed/schema.stamp
        @mkdir -p corpus/schema
@@ -138,7 +176,7 @@ seed/xpath.stamp: genSeed$(EXEEXT)
        @touch seed/xpath.stamp
 
 xpath_SOURCES = xpath.c fuzz.c
-xpath_LDFLAGS = -fsanitize=fuzzer
+xpath_LDFLAGS = $(AM_LDFLAGS) -fsanitize=fuzzer
 
 fuzz-xpath: xpath$(EXEEXT) seed/xpath.stamp
        @mkdir -p corpus/xpath
index be2f065..7625131 100644 (file)
@@ -42,6 +42,9 @@ static struct {
     xmlFuzzEntityInfo *mainEntity;
 } fuzzData;
 
+size_t fuzzNumAllocs;
+size_t fuzzMaxAllocs;
+
 /**
  * xmlFuzzErrorFunc:
  *
@@ -52,6 +55,58 @@ xmlFuzzErrorFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg ATTRIBUTE_UNUSED,
                  ...) {
 }
 
+/*
+ * Malloc failure injection.
+ *
+ * Quick tip to debug complicated issues: Increase MALLOC_OFFSET until
+ * the crash disappears (or a different issue is triggered). Then set
+ * the offset to the highest value that produces a crash and set
+ * MALLOC_ABORT to 1 to see which failed memory allocation causes the
+ * issue.
+ */
+
+#define XML_FUZZ_MALLOC_OFFSET  0
+#define XML_FUZZ_MALLOC_ABORT   0
+
+static void *
+xmlFuzzMalloc(size_t size) {
+    if (fuzzMaxAllocs > 0) {
+        if (fuzzNumAllocs >= fuzzMaxAllocs - 1)
+#if XML_FUZZ_MALLOC_ABORT
+            abort();
+#else
+            return(NULL);
+#endif
+        fuzzNumAllocs += 1;
+    }
+    return malloc(size);
+}
+
+static void *
+xmlFuzzRealloc(void *ptr, size_t size) {
+    if (fuzzMaxAllocs > 0) {
+        if (fuzzNumAllocs >= fuzzMaxAllocs - 1)
+#if XML_FUZZ_MALLOC_ABORT
+            abort();
+#else
+            return(NULL);
+#endif
+        fuzzNumAllocs += 1;
+    }
+    return realloc(ptr, size);
+}
+
+void
+xmlFuzzMemSetup(void) {
+    xmlMemSetup(free, xmlFuzzMalloc, xmlFuzzRealloc, xmlMemStrdup);
+}
+
+void
+xmlFuzzMemSetLimit(size_t limit) {
+    fuzzNumAllocs = 0;
+    fuzzMaxAllocs = limit ? limit + XML_FUZZ_MALLOC_OFFSET : 0;
+}
+
 /**
  * xmlFuzzDataInit:
  *
@@ -84,20 +139,45 @@ xmlFuzzDataCleanup(void) {
 }
 
 /**
+ * xmlFuzzWriteInt:
+ * @out:  output file
+ * @v:  integer to write
+ * @size:  size of integer in bytes
+ *
+ * Write an integer to the fuzz data.
+ */
+void
+xmlFuzzWriteInt(FILE *out, size_t v, int size) {
+    int shift;
+
+    while (size > (int) sizeof(size_t)) {
+        putc(0, out);
+        size--;
+    }
+
+    shift = size * 8;
+    while (shift > 0) {
+        shift -= 8;
+        putc((v >> shift) & 255, out);
+    }
+}
+
+/**
  * xmlFuzzReadInt:
- * @size:  size of string in bytes
+ * @size:  size of integer in bytes
  *
  * Read an integer from the fuzz data.
  */
-int
-xmlFuzzReadInt() {
-    int ret;
+size_t
+xmlFuzzReadInt(int size) {
+    size_t ret = 0;
 
-    if (fuzzData.remaining < sizeof(int))
-        return(0);
-    memcpy(&ret, fuzzData.ptr, sizeof(int));
-    fuzzData.ptr += sizeof(int);
-    fuzzData.remaining -= sizeof(int);
+    while ((size > 0) && (fuzzData.remaining > 0)) {
+        unsigned char c = (unsigned char) *fuzzData.ptr++;
+        fuzzData.remaining--;
+        ret = (ret << 8) | c;
+        size--;
+    }
 
     return ret;
 }
@@ -166,7 +246,8 @@ xmlFuzzReadString(size_t *size) {
             if (c2 == '\n') {
                 fuzzData.ptr++;
                 fuzzData.remaining--;
-                *size = fuzzData.outPtr - out;
+                if (size != NULL)
+                    *size = fuzzData.outPtr - out;
                 *fuzzData.outPtr++ = '\0';
                 return(out);
             }
@@ -180,12 +261,14 @@ xmlFuzzReadString(size_t *size) {
     }
 
     if (fuzzData.outPtr > out) {
-        *size = fuzzData.outPtr - out;
+        if (size != NULL)
+            *size = fuzzData.outPtr - out;
         *fuzzData.outPtr++ = '\0';
         return(out);
     }
 
-    *size = 0;
+    if (size != NULL)
+        *size = 0;
     return(NULL);
 }
 
@@ -201,10 +284,10 @@ xmlFuzzReadEntities(void) {
 
     while (1) {
         const char *url, *entity;
-        size_t urlSize, entitySize;
+        size_t entitySize;
         xmlFuzzEntityInfo *entityInfo;
-        
-        url = xmlFuzzReadString(&urlSize);
+
+        url = xmlFuzzReadString(NULL);
         if (url == NULL) break;
 
         entity = xmlFuzzReadString(&entitySize);
@@ -271,7 +354,9 @@ xmlFuzzEntityLoader(const char *URL, const char *ID ATTRIBUTE_UNUSED,
         return(NULL);
 
     input = xmlNewInputStream(ctxt);
-    input->filename = NULL;
+    if (input == NULL)
+        return(NULL);
+    input->filename = (char *) xmlCharStrdup(URL);
     input->buf = xmlParserInputBufferCreateMem(entity->data, entity->size,
                                                XML_CHAR_ENCODING_NONE);
     if (input->buf == NULL) {
@@ -284,47 +369,6 @@ xmlFuzzEntityLoader(const char *URL, const char *ID ATTRIBUTE_UNUSED,
     return input;
 }
 
-/**
- * xmlFuzzExtractStrings:
- *
- * Extract C strings from input data. Use exact-size allocations to detect
- * potential memory errors.
- */
-size_t
-xmlFuzzExtractStrings(const char *data, size_t size, char **strings,
-                      size_t numStrings) {
-    const char *start = data;
-    const char *end = data + size;
-    size_t i = 0, ret;
-
-    while (i < numStrings) {
-        size_t strSize = end - start;
-        const char *zero = memchr(start, 0, strSize);
-
-        if (zero != NULL)
-            strSize = zero - start;
-
-        strings[i] = xmlMalloc(strSize + 1);
-        memcpy(strings[i], start, strSize);
-        strings[i][strSize] = '\0';
-
-        i++;
-        if (zero != NULL)
-            start = zero + 1;
-        else
-            break;
-    }
-
-    ret = i;
-
-    while (i < numStrings) {
-        strings[i] = NULL;
-        i++;
-    }
-
-    return(ret);
-}
-
 char *
 xmlSlurpFile(const char *path, size_t *sizeRet) {
     FILE *file;
index a51b398..0668b2f 100644 (file)
@@ -27,9 +27,16 @@ extern "C" {
 #if 1
   #define HAVE_URI_FUZZER
 #endif
+#if defined(LIBXML_VALID_ENABLED) && \
+    defined(LIBXML_READER_ENABLED)
+  #define HAVE_VALID_FUZZER
+#endif
+#if defined(LIBXML_XINCLUDE_ENABLED) && \
+    defined(LIBXML_READER_ENABLED)
+  #define HAVE_XINCLUDE_FUZZER
+#endif
 #if defined(LIBXML_OUTPUT_ENABLED) && \
-    defined(LIBXML_READER_ENABLED) && \
-    defined(LIBXML_XINCLUDE_ENABLED)
+    defined(LIBXML_READER_ENABLED)
   #define HAVE_XML_FUZZER
 #endif
 #if defined(LIBXML_XPATH_ENABLED)
@@ -47,13 +54,22 @@ xmlFuzzErrorFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg ATTRIBUTE_UNUSED,
                  ...);
 
 void
+xmlFuzzMemSetup(void);
+
+void
+xmlFuzzMemSetLimit(size_t limit);
+
+void
 xmlFuzzDataInit(const char *data, size_t size);
 
 void
 xmlFuzzDataCleanup(void);
 
-int
-xmlFuzzReadInt(void);
+void
+xmlFuzzWriteInt(FILE *out, size_t v, int size);
+
+size_t
+xmlFuzzReadInt(int size);
 
 const char *
 xmlFuzzReadRemaining(size_t *size);
@@ -76,10 +92,6 @@ xmlFuzzMainEntity(size_t *size);
 xmlParserInputPtr
 xmlFuzzEntityLoader(const char *URL, const char *ID, xmlParserCtxtPtr ctxt);
 
-size_t
-xmlFuzzExtractStrings(const char *data, size_t size, char **strings,
-                      size_t numStrings);
-
 char *
 xmlSlurpFile(const char *path, size_t *size);
 
index 01f0656..d08d135 100644 (file)
@@ -43,6 +43,8 @@ static struct {
     char cwd[PATH_SIZE];
 } globalData;
 
+#if defined(HAVE_SCHEMA_FUZZER) || \
+    defined(HAVE_XML_FUZZER)
 /*
  * A custom entity loader that writes all external DTDs or entities to a
  * single file in the format expected by xmlFuzzEntityLoader.
@@ -80,7 +82,8 @@ fuzzEntityRecorder(const char *URL, const char *ID,
 
     xmlFreeInputStream(in);
 
-    xmlHashAddEntry(globalData.entities, (const xmlChar *) URL, NULL);
+    xmlHashAddEntry(globalData.entities, (const xmlChar *) URL,
+                    globalData.entities);
 
     return(xmlNoNetExternalEntityLoader(URL, ID, ctxt));
 }
@@ -94,13 +97,14 @@ fuzzRecorderInit(FILE *out) {
 }
 
 static void
-fuzzRecorderCleanup() {
+fuzzRecorderCleanup(void) {
     xmlSetExternalEntityLoader(globalData.oldLoader);
-    xmlHashFree(globalData.entities, xmlHashDefaultDeallocator);
+    xmlHashFree(globalData.entities, NULL);
     globalData.out = NULL;
     globalData.entities = NULL;
     globalData.oldLoader = NULL;
 }
+#endif
 
 #ifdef HAVE_XML_FUZZER
 static int
@@ -108,7 +112,10 @@ processXml(const char *docFile, FILE *out) {
     int opts = XML_PARSE_NOENT | XML_PARSE_DTDLOAD;
     xmlDocPtr doc;
 
-    fwrite(&opts, sizeof(opts), 1, out);
+    /* Parser options. */
+    xmlFuzzWriteInt(out, opts, 4);
+    /* Max allocations. */
+    xmlFuzzWriteInt(out, 0, 4);
 
     fuzzRecorderInit(out);
 
@@ -128,9 +135,11 @@ processHtml(const char *docFile, FILE *out) {
     char buf[SEED_BUF_SIZE];
     FILE *file;
     size_t size;
-    int opts = 0;
 
-    fwrite(&opts, sizeof(opts), 1, out);
+    /* Parser options. */
+    xmlFuzzWriteInt(out, 0, 4);
+    /* Max allocations. */
+    xmlFuzzWriteInt(out, 0, 4);
 
     /* Copy file */
     file = fopen(docFile, "rb");
@@ -155,6 +164,9 @@ processSchema(const char *docFile, FILE *out) {
     xmlSchemaPtr schema;
     xmlSchemaParserCtxtPtr pctxt;
 
+    /* Max allocations. */
+    xmlFuzzWriteInt(out, 0, 4);
+
     fuzzRecorderInit(out);
 
     pctxt = xmlSchemaNewParserCtxt(docFile);
@@ -169,11 +181,15 @@ processSchema(const char *docFile, FILE *out) {
 }
 #endif
 
+#if defined(HAVE_HTML_FUZZER) || \
+    defined(HAVE_SCHEMA_FUZZER) || \
+    defined(HAVE_XML_FUZZER)
 static int
 processPattern(const char *pattern) {
     glob_t globbuf;
     int ret = 0;
-    int res, i;
+    int res;
+    size_t i;
 
     res = glob(pattern, 0, NULL, &globbuf);
     if (res == GLOB_NOMATCH)
@@ -245,6 +261,7 @@ error:
     globfree(&globbuf);
     return(ret);
 }
+#endif
 
 #ifdef HAVE_XPATH_FUZZER
 static int
@@ -282,7 +299,7 @@ processXPath(const char *testDir, const char *prefix, const char *name,
             continue;
         }
 
-        while (fgets(expr, EXPR_SIZE, in) > 0) {
+        while (fgets(expr, EXPR_SIZE, in) != NULL) {
             char outPath[PATH_SIZE];
             FILE *out;
             int j;
@@ -304,6 +321,9 @@ processXPath(const char *testDir, const char *prefix, const char *name,
                 continue;
             }
 
+            /* Max allocations. */
+            xmlFuzzWriteInt(out, 0, 4);
+
             if (xptr) {
                 xmlFuzzWriteString(out, expr);
             } else {
@@ -328,7 +348,7 @@ processXPath(const char *testDir, const char *prefix, const char *name,
     return(ret);
 }
 
-int
+static int
 processXPathDir(const char *testDir) {
     char pattern[PATH_SIZE];
     glob_t globbuf;
@@ -379,7 +399,6 @@ main(int argc, const char **argv) {
     mainFunc processArg = NULL;
     const char *fuzzer;
     int ret = 0;
-    int xpath = 0;
     int i;
 
     if (argc < 3) {
@@ -400,6 +419,16 @@ main(int argc, const char **argv) {
         processArg = processPattern;
         globalData.processFile = processSchema;
 #endif
+    } else if (strcmp(fuzzer, "valid") == 0) {
+#ifdef HAVE_XINCLUDE_FUZZER
+        processArg = processPattern;
+        globalData.processFile = processXml;
+#endif
+    } else if (strcmp(fuzzer, "xinclude") == 0) {
+#ifdef HAVE_XINCLUDE_FUZZER
+        processArg = processPattern;
+        globalData.processFile = processXml;
+#endif
     } else if (strcmp(fuzzer, "xml") == 0) {
 #ifdef HAVE_XML_FUZZER
         processArg = processPattern;
index 116b3df..a2bd97a 100644 (file)
@@ -12,6 +12,7 @@
 int
 LLVMFuzzerInitialize(int *argc ATTRIBUTE_UNUSED,
                      char ***argv ATTRIBUTE_UNUSED) {
+    xmlFuzzMemSetup();
     xmlInitParser();
 #ifdef LIBXML_CATALOG_ENABLED
     xmlInitializeCatalog();
@@ -28,11 +29,12 @@ LLVMFuzzerTestOneInput(const char *data, size_t size) {
     htmlParserCtxtPtr ctxt;
     xmlOutputBufferPtr out;
     const char *docBuffer;
-    size_t docSize, consumed, chunkSize;
-    int opts, outSize;
+    size_t maxAlloc, docSize, consumed, chunkSize;
+    int opts;
 
     xmlFuzzDataInit(data, size);
-    opts = xmlFuzzReadInt();
+    opts = (int) xmlFuzzReadInt(4);
+    maxAlloc = xmlFuzzReadInt(4) % (size + 1);
 
     docBuffer = xmlFuzzReadRemaining(&docSize);
     if (docBuffer == NULL) {
@@ -42,6 +44,7 @@ LLVMFuzzerTestOneInput(const char *data, size_t size) {
 
     /* Pull parser */
 
+    xmlFuzzMemSetLimit(maxAlloc);
     doc = htmlReadMemory(docBuffer, docSize, NULL, NULL, opts);
 
     /*
@@ -57,23 +60,28 @@ LLVMFuzzerTestOneInput(const char *data, size_t size) {
 
     /* Push parser */
 
+    xmlFuzzMemSetLimit(maxAlloc);
     ctxt = htmlCreatePushParserCtxt(NULL, NULL, NULL, 0, NULL,
                                     XML_CHAR_ENCODING_NONE);
-    htmlCtxtUseOptions(ctxt, opts);
 
-    for (consumed = 0; consumed < docSize; consumed += chunkSize) {
-        chunkSize = docSize - consumed;
-        if (chunkSize > maxChunkSize)
-            chunkSize = maxChunkSize;
-        htmlParseChunk(ctxt, docBuffer + consumed, chunkSize, 0);
-    }
+    if (ctxt != NULL) {
+        htmlCtxtUseOptions(ctxt, opts);
+
+        for (consumed = 0; consumed < docSize; consumed += chunkSize) {
+            chunkSize = docSize - consumed;
+            if (chunkSize > maxChunkSize)
+                chunkSize = maxChunkSize;
+            htmlParseChunk(ctxt, docBuffer + consumed, chunkSize, 0);
+        }
 
-    htmlParseChunk(ctxt, NULL, 0, 1);
-    xmlFreeDoc(ctxt->myDoc);
-    htmlFreeParserCtxt(ctxt);
+        htmlParseChunk(ctxt, NULL, 0, 1);
+        xmlFreeDoc(ctxt->myDoc);
+        htmlFreeParserCtxt(ctxt);
+    }
 
     /* Cleanup */
 
+    xmlFuzzMemSetLimit(0);
     xmlFuzzDataCleanup();
     xmlResetLastError();
 
index af1210a..0514059 100644 (file)
@@ -10,6 +10,7 @@
 int
 LLVMFuzzerInitialize(int *argc ATTRIBUTE_UNUSED,
                      char ***argv ATTRIBUTE_UNUSED) {
+    xmlFuzzMemSetup();
     xmlSetGenericErrorFunc(NULL, xmlFuzzErrorFunc);
 
     return 0;
@@ -18,28 +19,29 @@ LLVMFuzzerInitialize(int *argc ATTRIBUTE_UNUSED,
 int
 LLVMFuzzerTestOneInput(const char *data, size_t size) {
     xmlRegexpPtr regexp;
-    char *str[2] = { NULL, NULL };
-    size_t numStrings;
+    size_t maxAlloc;
+    const char *str1;
 
     if (size > 200)
         return(0);
 
-    numStrings = xmlFuzzExtractStrings(data, size, str, 2);
+    xmlFuzzDataInit(data, size);
+    maxAlloc = xmlFuzzReadInt(4) % (size * 8 + 1);
+    str1 = xmlFuzzReadString(NULL);
 
     /* CUR_SCHAR doesn't handle invalid UTF-8 and may cause infinite loops. */
-    if (xmlCheckUTF8(BAD_CAST str[0]) != 0) {
-        regexp = xmlRegexpCompile(BAD_CAST str[0]);
+    if (xmlCheckUTF8(BAD_CAST str1) != 0) {
+        xmlFuzzMemSetLimit(maxAlloc);
+        regexp = xmlRegexpCompile(BAD_CAST str1);
         /* xmlRegexpExec has pathological performance in too many cases. */
 #if 0
-        if ((regexp != NULL) && (numStrings >= 2)) {
-            xmlRegexpExec(regexp, BAD_CAST str[1]);
-        }
+        xmlRegexpExec(regexp, BAD_CAST str2);
 #endif
         xmlRegFreeRegexp(regexp);
     }
 
-    xmlFree(str[0]);
-    xmlFree(str[1]);
+    xmlFuzzMemSetLimit(0);
+    xmlFuzzDataCleanup();
     xmlResetLastError();
 
     return 0;
index 689bffe..04e92f9 100644 (file)
@@ -11,6 +11,7 @@
 int
 LLVMFuzzerInitialize(int *argc ATTRIBUTE_UNUSED,
                      char ***argv ATTRIBUTE_UNUSED) {
+    xmlFuzzMemSetup();
     xmlInitParser();
 #ifdef LIBXML_CATALOG_ENABLED
     xmlInitializeCatalog();
@@ -24,18 +25,23 @@ LLVMFuzzerInitialize(int *argc ATTRIBUTE_UNUSED,
 int
 LLVMFuzzerTestOneInput(const char *data, size_t size) {
     xmlSchemaParserCtxtPtr pctxt;
+    size_t maxAlloc;
 
     if (size > 50000)
         return(0);
 
+    maxAlloc = xmlFuzzReadInt(4) % (size + 1);
+
     xmlFuzzDataInit(data, size);
     xmlFuzzReadEntities();
 
+    xmlFuzzMemSetLimit(maxAlloc);
     pctxt = xmlSchemaNewParserCtxt(xmlFuzzMainUrl());
     xmlSchemaSetParserErrors(pctxt, xmlFuzzErrorFunc, xmlFuzzErrorFunc, NULL);
     xmlSchemaFree(xmlSchemaParse(pctxt));
     xmlSchemaFreeParserCtxt(pctxt);
 
+    xmlFuzzMemSetLimit(0);
     xmlFuzzDataCleanup();
     xmlResetLastError();
 
index ded775e..2a61d0d 100644 (file)
Binary files a/fuzz/static_seed/regexp/branch-1 and b/fuzz/static_seed/regexp/branch-1 differ
index 6700d77..a867afe 100644 (file)
Binary files a/fuzz/static_seed/regexp/branch-10 and b/fuzz/static_seed/regexp/branch-10 differ
index d83f918..cf22034 100644 (file)
Binary files a/fuzz/static_seed/regexp/branch-11 and b/fuzz/static_seed/regexp/branch-11 differ
index b44dba5..1dd06d5 100644 (file)
Binary files a/fuzz/static_seed/regexp/branch-12 and b/fuzz/static_seed/regexp/branch-12 differ
index 64e50a0..d3033d2 100644 (file)
Binary files a/fuzz/static_seed/regexp/branch-13 and b/fuzz/static_seed/regexp/branch-13 differ
index 8293d81..cd27911 100644 (file)
Binary files a/fuzz/static_seed/regexp/branch-2 and b/fuzz/static_seed/regexp/branch-2 differ
index 696af9b..64437c8 100644 (file)
Binary files a/fuzz/static_seed/regexp/branch-3 and b/fuzz/static_seed/regexp/branch-3 differ
index 8317998..556bba2 100644 (file)
Binary files a/fuzz/static_seed/regexp/branch-4 and b/fuzz/static_seed/regexp/branch-4 differ
index 6b6db8b..cdf9098 100644 (file)
Binary files a/fuzz/static_seed/regexp/branch-5 and b/fuzz/static_seed/regexp/branch-5 differ
index 4f47790..f68f552 100644 (file)
Binary files a/fuzz/static_seed/regexp/branch-6 and b/fuzz/static_seed/regexp/branch-6 differ
index 6334f72..a7e8e91 100644 (file)
Binary files a/fuzz/static_seed/regexp/branch-7 and b/fuzz/static_seed/regexp/branch-7 differ
index f77a8f4..0637a69 100644 (file)
Binary files a/fuzz/static_seed/regexp/branch-8 and b/fuzz/static_seed/regexp/branch-8 differ
index acd0eec..6cbd35e 100644 (file)
Binary files a/fuzz/static_seed/regexp/branch-9 and b/fuzz/static_seed/regexp/branch-9 differ
index 9f0a504..742782c 100644 (file)
Binary files a/fuzz/static_seed/regexp/bug316338-1 and b/fuzz/static_seed/regexp/bug316338-1 differ
index 60685bb..09eaccc 100644 (file)
Binary files a/fuzz/static_seed/regexp/bug316338-10 and b/fuzz/static_seed/regexp/bug316338-10 differ
index 72a7956..991d19a 100644 (file)
Binary files a/fuzz/static_seed/regexp/bug316338-11 and b/fuzz/static_seed/regexp/bug316338-11 differ
index 85416ee..dd43da8 100644 (file)
Binary files a/fuzz/static_seed/regexp/bug316338-12 and b/fuzz/static_seed/regexp/bug316338-12 differ
index c91d4fe..8b7bc0c 100644 (file)
Binary files a/fuzz/static_seed/regexp/bug316338-13 and b/fuzz/static_seed/regexp/bug316338-13 differ
index a164b42..4cd8318 100644 (file)
Binary files a/fuzz/static_seed/regexp/bug316338-14 and b/fuzz/static_seed/regexp/bug316338-14 differ
index 750c76d..456dda7 100644 (file)
Binary files a/fuzz/static_seed/regexp/bug316338-15 and b/fuzz/static_seed/regexp/bug316338-15 differ
index 23c5d23..94a4810 100644 (file)
Binary files a/fuzz/static_seed/regexp/bug316338-16 and b/fuzz/static_seed/regexp/bug316338-16 differ
index 5468d06..6dd04e3 100644 (file)
Binary files a/fuzz/static_seed/regexp/bug316338-2 and b/fuzz/static_seed/regexp/bug316338-2 differ
index 76e1e0b..5be0b2d 100644 (file)
Binary files a/fuzz/static_seed/regexp/bug316338-3 and b/fuzz/static_seed/regexp/bug316338-3 differ
index e0f65a4..e7d786c 100644 (file)
Binary files a/fuzz/static_seed/regexp/bug316338-4 and b/fuzz/static_seed/regexp/bug316338-4 differ
index fcfaa97..e06cf23 100644 (file)
Binary files a/fuzz/static_seed/regexp/bug316338-5 and b/fuzz/static_seed/regexp/bug316338-5 differ
index ce00a15..c65a26e 100644 (file)
Binary files a/fuzz/static_seed/regexp/bug316338-6 and b/fuzz/static_seed/regexp/bug316338-6 differ
index 127fe1f..8d0ec0f 100644 (file)
Binary files a/fuzz/static_seed/regexp/bug316338-7 and b/fuzz/static_seed/regexp/bug316338-7 differ
index fe8bb8b..a17aac4 100644 (file)
Binary files a/fuzz/static_seed/regexp/bug316338-8 and b/fuzz/static_seed/regexp/bug316338-8 differ
index 3d56e5d..3c37fb4 100644 (file)
Binary files a/fuzz/static_seed/regexp/bug316338-9 and b/fuzz/static_seed/regexp/bug316338-9 differ
index 4426933..9b6a838 100644 (file)
Binary files a/fuzz/static_seed/regexp/bug420596-1 and b/fuzz/static_seed/regexp/bug420596-1 differ
index 474d2b6..f3ee539 100644 (file)
Binary files a/fuzz/static_seed/regexp/bug420596-2 and b/fuzz/static_seed/regexp/bug420596-2 differ
index 09c75cb..590bad9 100644 (file)
Binary files a/fuzz/static_seed/regexp/bug420596-3 and b/fuzz/static_seed/regexp/bug420596-3 differ
index 65d561e..233a92b 100644 (file)
Binary files a/fuzz/static_seed/regexp/bug420596-4 and b/fuzz/static_seed/regexp/bug420596-4 differ
index b678580..ca35ec2 100644 (file)
Binary files a/fuzz/static_seed/regexp/bug420596-5 and b/fuzz/static_seed/regexp/bug420596-5 differ
index 3a05d82..d433d91 100644 (file)
Binary files a/fuzz/static_seed/regexp/bug420596-6 and b/fuzz/static_seed/regexp/bug420596-6 differ
index 88e1660..80d821e 100644 (file)
Binary files a/fuzz/static_seed/regexp/bug420596-7 and b/fuzz/static_seed/regexp/bug420596-7 differ
index 4575a92..17456c9 100644 (file)
Binary files a/fuzz/static_seed/regexp/bug420596-8 and b/fuzz/static_seed/regexp/bug420596-8 differ
index 5acbf86..edcb943 100644 (file)
Binary files a/fuzz/static_seed/regexp/content-1 and b/fuzz/static_seed/regexp/content-1 differ
index f131454..f0cd363 100644 (file)
Binary files a/fuzz/static_seed/regexp/content-10 and b/fuzz/static_seed/regexp/content-10 differ
index 4e6b663..d9f4a93 100644 (file)
Binary files a/fuzz/static_seed/regexp/content-2 and b/fuzz/static_seed/regexp/content-2 differ
index b13fc8d..309c920 100644 (file)
Binary files a/fuzz/static_seed/regexp/content-3 and b/fuzz/static_seed/regexp/content-3 differ
index 47c5d6d..20ffbb7 100644 (file)
Binary files a/fuzz/static_seed/regexp/content-4 and b/fuzz/static_seed/regexp/content-4 differ
index f93860e..faa7b53 100644 (file)
Binary files a/fuzz/static_seed/regexp/content-5 and b/fuzz/static_seed/regexp/content-5 differ
index e5c6e14..98ef3aa 100644 (file)
Binary files a/fuzz/static_seed/regexp/content-6 and b/fuzz/static_seed/regexp/content-6 differ
index 4868dd2..b0d17af 100644 (file)
Binary files a/fuzz/static_seed/regexp/content-7 and b/fuzz/static_seed/regexp/content-7 differ
index a3a87d0..51aeb7b 100644 (file)
Binary files a/fuzz/static_seed/regexp/content-8 and b/fuzz/static_seed/regexp/content-8 differ
index 91f0d9e..589d928 100644 (file)
Binary files a/fuzz/static_seed/regexp/content-9 and b/fuzz/static_seed/regexp/content-9 differ
index ba00382..9959fb4 100644 (file)
Binary files a/fuzz/static_seed/regexp/hard-1 and b/fuzz/static_seed/regexp/hard-1 differ
index 7db28fa..36db287 100644 (file)
Binary files a/fuzz/static_seed/regexp/hard-10 and b/fuzz/static_seed/regexp/hard-10 differ
index ed38b91..17016bd 100644 (file)
Binary files a/fuzz/static_seed/regexp/hard-2 and b/fuzz/static_seed/regexp/hard-2 differ
index 7b16da0..f3f1c0b 100644 (file)
Binary files a/fuzz/static_seed/regexp/hard-3 and b/fuzz/static_seed/regexp/hard-3 differ
index 2ece886..13bcd77 100644 (file)
Binary files a/fuzz/static_seed/regexp/hard-4 and b/fuzz/static_seed/regexp/hard-4 differ
index 870a3ec..41e5310 100644 (file)
Binary files a/fuzz/static_seed/regexp/hard-5 and b/fuzz/static_seed/regexp/hard-5 differ
index 06aa7d0..d55d808 100644 (file)
Binary files a/fuzz/static_seed/regexp/hard-6 and b/fuzz/static_seed/regexp/hard-6 differ
index 50a9ec3..0dfd684 100644 (file)
Binary files a/fuzz/static_seed/regexp/hard-7 and b/fuzz/static_seed/regexp/hard-7 differ
index 0991129..8159843 100644 (file)
Binary files a/fuzz/static_seed/regexp/hard-8 and b/fuzz/static_seed/regexp/hard-8 differ
index 5bd1d89..a4e9ece 100644 (file)
Binary files a/fuzz/static_seed/regexp/hard-9 and b/fuzz/static_seed/regexp/hard-9 differ
index 608eb9a..6d43f81 100644 (file)
Binary files a/fuzz/static_seed/regexp/ncname-1 and b/fuzz/static_seed/regexp/ncname-1 differ
index cfb9b96..bb9ff54 100644 (file)
Binary files a/fuzz/static_seed/regexp/ncname-2 and b/fuzz/static_seed/regexp/ncname-2 differ
index 07a6a08..605ccc5 100644 (file)
Binary files a/fuzz/static_seed/regexp/ncname-3 and b/fuzz/static_seed/regexp/ncname-3 differ
index 87e937f..facf97d 100644 (file)
Binary files a/fuzz/static_seed/regexp/ncname-4 and b/fuzz/static_seed/regexp/ncname-4 differ
index ad29456..ad22334 100644 (file)
Binary files a/fuzz/static_seed/regexp/ncname-5 and b/fuzz/static_seed/regexp/ncname-5 differ
index 71448f2..2c4bb3d 100644 (file)
Binary files a/fuzz/static_seed/regexp/ranges-1 and b/fuzz/static_seed/regexp/ranges-1 differ
index 91aed3c..61c3d3d 100644 (file)
Binary files a/fuzz/static_seed/regexp/ranges-10 and b/fuzz/static_seed/regexp/ranges-10 differ
index 76eb5de..6133262 100644 (file)
Binary files a/fuzz/static_seed/regexp/ranges-11 and b/fuzz/static_seed/regexp/ranges-11 differ
index 9c3bc66..4b6be37 100644 (file)
Binary files a/fuzz/static_seed/regexp/ranges-12 and b/fuzz/static_seed/regexp/ranges-12 differ
index 9369f7a..f766e22 100644 (file)
Binary files a/fuzz/static_seed/regexp/ranges-2 and b/fuzz/static_seed/regexp/ranges-2 differ
index 58a3a08..7c03f87 100644 (file)
Binary files a/fuzz/static_seed/regexp/ranges-3 and b/fuzz/static_seed/regexp/ranges-3 differ
index da7e9da..08a0a9a 100644 (file)
Binary files a/fuzz/static_seed/regexp/ranges-4 and b/fuzz/static_seed/regexp/ranges-4 differ
index 83ad4a8..ce3f25a 100644 (file)
Binary files a/fuzz/static_seed/regexp/ranges-5 and b/fuzz/static_seed/regexp/ranges-5 differ
index 3bc9758..523b637 100644 (file)
Binary files a/fuzz/static_seed/regexp/ranges-6 and b/fuzz/static_seed/regexp/ranges-6 differ
index fa89038..091ff05 100644 (file)
Binary files a/fuzz/static_seed/regexp/ranges-7 and b/fuzz/static_seed/regexp/ranges-7 differ
index 96f0bb6..210f709 100644 (file)
Binary files a/fuzz/static_seed/regexp/ranges-8 and b/fuzz/static_seed/regexp/ranges-8 differ
index 8e3fc43..7da8a2a 100644 (file)
Binary files a/fuzz/static_seed/regexp/ranges-9 and b/fuzz/static_seed/regexp/ranges-9 differ
index 044a8eb..003c2c5 100644 (file)
Binary files a/fuzz/static_seed/regexp/ranges2-1 and b/fuzz/static_seed/regexp/ranges2-1 differ
index 19e2aa2..261bf56 100644 (file)
Binary files a/fuzz/static_seed/regexp/ranges2-10 and b/fuzz/static_seed/regexp/ranges2-10 differ
index 89be181..c6c5bd0 100644 (file)
Binary files a/fuzz/static_seed/regexp/ranges2-11 and b/fuzz/static_seed/regexp/ranges2-11 differ
index 42ebdd3..0a729f2 100644 (file)
Binary files a/fuzz/static_seed/regexp/ranges2-12 and b/fuzz/static_seed/regexp/ranges2-12 differ
index 026f7b8..9fc2ce1 100644 (file)
Binary files a/fuzz/static_seed/regexp/ranges2-2 and b/fuzz/static_seed/regexp/ranges2-2 differ
index 83e78a9..08a3963 100644 (file)
Binary files a/fuzz/static_seed/regexp/ranges2-3 and b/fuzz/static_seed/regexp/ranges2-3 differ
index 847b4e8..c965555 100644 (file)
Binary files a/fuzz/static_seed/regexp/ranges2-4 and b/fuzz/static_seed/regexp/ranges2-4 differ
index 349168d..2e65f5d 100644 (file)
Binary files a/fuzz/static_seed/regexp/ranges2-5 and b/fuzz/static_seed/regexp/ranges2-5 differ
index 5d2a407..4990264 100644 (file)
Binary files a/fuzz/static_seed/regexp/ranges2-6 and b/fuzz/static_seed/regexp/ranges2-6 differ
index 74fbafb..5f3e2c3 100644 (file)
Binary files a/fuzz/static_seed/regexp/ranges2-7 and b/fuzz/static_seed/regexp/ranges2-7 differ
index 125bfa9..9b384e5 100644 (file)
Binary files a/fuzz/static_seed/regexp/ranges2-8 and b/fuzz/static_seed/regexp/ranges2-8 differ
index f2cf128..e08ad99 100644 (file)
Binary files a/fuzz/static_seed/regexp/ranges2-9 and b/fuzz/static_seed/regexp/ranges2-9 differ
index 3bc1792..20e37e0 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-1 and b/fuzz/static_seed/regexp/xpath-1 differ
index e4f4b0c..1bdb0a8 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-10 and b/fuzz/static_seed/regexp/xpath-10 differ
index 318e0cc..5e26ec2 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-11 and b/fuzz/static_seed/regexp/xpath-11 differ
index f204295..e044486 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-12 and b/fuzz/static_seed/regexp/xpath-12 differ
index 70fccd5..9cb2874 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-13 and b/fuzz/static_seed/regexp/xpath-13 differ
index 357ce2b..3b9003f 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-14 and b/fuzz/static_seed/regexp/xpath-14 differ
index 2a10a83..64b071e 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-15 and b/fuzz/static_seed/regexp/xpath-15 differ
index 1f3089f..44b612b 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-16 and b/fuzz/static_seed/regexp/xpath-16 differ
index a9d542f..0370668 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-17 and b/fuzz/static_seed/regexp/xpath-17 differ
index 651eb9d..0351911 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-18 and b/fuzz/static_seed/regexp/xpath-18 differ
index fefea8f..f4a153c 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-19 and b/fuzz/static_seed/regexp/xpath-19 differ
index 81e5fba..0a8bae7 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-2 and b/fuzz/static_seed/regexp/xpath-2 differ
index 1f3089f..44b612b 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-20 and b/fuzz/static_seed/regexp/xpath-20 differ
index 706a702..2d6c7df 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-21 and b/fuzz/static_seed/regexp/xpath-21 differ
index a246f84..1e8db88 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-22 and b/fuzz/static_seed/regexp/xpath-22 differ
index 02753be..233f27e 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-23 and b/fuzz/static_seed/regexp/xpath-23 differ
index 331105c..c970a5e 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-24 and b/fuzz/static_seed/regexp/xpath-24 differ
index ce3da44..649e8f4 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-25 and b/fuzz/static_seed/regexp/xpath-25 differ
index b3bf8c2..13f6f24 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-26 and b/fuzz/static_seed/regexp/xpath-26 differ
index 74bbe46..3fea5c9 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-27 and b/fuzz/static_seed/regexp/xpath-27 differ
index b38a709..8d28581 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-28 and b/fuzz/static_seed/regexp/xpath-28 differ
index 104d4e5..a62aafe 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-29 and b/fuzz/static_seed/regexp/xpath-29 differ
index 6d7be85..40bba5a 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-3 and b/fuzz/static_seed/regexp/xpath-3 differ
index b681ff1..60105af 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-30 and b/fuzz/static_seed/regexp/xpath-30 differ
index cd87b0e..f7d319d 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-31 and b/fuzz/static_seed/regexp/xpath-31 differ
index c5cac32..b3708da 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-32 and b/fuzz/static_seed/regexp/xpath-32 differ
index 89e3fcd..4ad749f 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-33 and b/fuzz/static_seed/regexp/xpath-33 differ
index b65a3d6..c3e184c 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-34 and b/fuzz/static_seed/regexp/xpath-34 differ
index 252a70c..41ec109 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-35 and b/fuzz/static_seed/regexp/xpath-35 differ
index 30718c5..d8c875e 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-4 and b/fuzz/static_seed/regexp/xpath-4 differ
index 06ad88e..1e282d0 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-5 and b/fuzz/static_seed/regexp/xpath-5 differ
index 6678772..52405e4 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-6 and b/fuzz/static_seed/regexp/xpath-6 differ
index e69ad85..81ebb61 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-7 and b/fuzz/static_seed/regexp/xpath-7 differ
index a8120cc..9132035 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-8 and b/fuzz/static_seed/regexp/xpath-8 differ
index c037ce7..fb88269 100644 (file)
Binary files a/fuzz/static_seed/regexp/xpath-9 and b/fuzz/static_seed/regexp/xpath-9 differ
index 945c9b4..6cac6b0 100644 (file)
Binary files a/fuzz/static_seed/uri/dot and b/fuzz/static_seed/uri/dot differ
index 808e58a..833329f 100644 (file)
Binary files a/fuzz/static_seed/uri/full and b/fuzz/static_seed/uri/full differ
index b0c7ffb..d7c775f 100644 (file)
 #include "fuzz.h"
 
 #ifdef HAVE_HTML_FUZZER
-  #define LLVMFuzzerInitialize fuzzHtmlInit
-  #define LLVMFuzzerTestOneInput fuzzHtml
-  #include "html.c"
-  #undef LLVMFuzzerInitialize
-  #undef LLVMFuzzerTestOneInput
+int fuzzHtmlInit(int *argc, char ***argv);
+int fuzzHtml(const char *data, size_t size);
+#define LLVMFuzzerInitialize fuzzHtmlInit
+#define LLVMFuzzerTestOneInput fuzzHtml
+#include "html.c"
+#undef LLVMFuzzerInitialize
+#undef LLVMFuzzerTestOneInput
 #endif
 
 #ifdef HAVE_REGEXP_FUZZER
-  #define LLVMFuzzerInitialize fuzzRegexpInit
-  #define LLVMFuzzerTestOneInput fuzzRegexp
-  #include "regexp.c"
-  #undef LLVMFuzzerInitialize
-  #undef LLVMFuzzerTestOneInput
+int fuzzRegexpInit(int *argc, char ***argv);
+int fuzzRegexp(const char *data, size_t size);
+#define LLVMFuzzerInitialize fuzzRegexpInit
+#define LLVMFuzzerTestOneInput fuzzRegexp
+#include "regexp.c"
+#undef LLVMFuzzerInitialize
+#undef LLVMFuzzerTestOneInput
 #endif
 
 #ifdef HAVE_SCHEMA_FUZZER
-  #define LLVMFuzzerInitialize fuzzSchemaInit
-  #define LLVMFuzzerTestOneInput fuzzSchema
-  #include "schema.c"
-  #undef LLVMFuzzerInitialize
-  #undef LLVMFuzzerTestOneInput
+int fuzzSchemaInit(int *argc, char ***argv);
+int fuzzSchema(const char *data, size_t size);
+#define LLVMFuzzerInitialize fuzzSchemaInit
+#define LLVMFuzzerTestOneInput fuzzSchema
+#include "schema.c"
+#undef LLVMFuzzerInitialize
+#undef LLVMFuzzerTestOneInput
 #endif
 
 #ifdef HAVE_URI_FUZZER
-  #define LLVMFuzzerInitialize fuzzUriInit
-  #define LLVMFuzzerTestOneInput fuzzUri
-  #include "uri.c"
-  #undef LLVMFuzzerInitialize
-  #undef LLVMFuzzerTestOneInput
+int fuzzUriInit(int *argc, char ***argv);
+int fuzzUri(const char *data, size_t size);
+#define LLVMFuzzerInitialize fuzzUriInit
+#define LLVMFuzzerTestOneInput fuzzUri
+#include "uri.c"
+#undef LLVMFuzzerInitialize
+#undef LLVMFuzzerTestOneInput
+#endif
+
+#ifdef HAVE_VALID_FUZZER
+int fuzzValidInit(int *argc, char ***argv);
+int fuzzValid(const char *data, size_t size);
+#define LLVMFuzzerInitialize fuzzValidInit
+#define LLVMFuzzerTestOneInput fuzzValid
+#include "valid.c"
+#undef LLVMFuzzerInitialize
+#undef LLVMFuzzerTestOneInput
+#endif
+
+#ifdef HAVE_XINCLUDE_FUZZER
+int fuzzXIncludeInit(int *argc, char ***argv);
+int fuzzXInclude(const char *data, size_t size);
+#define LLVMFuzzerInitialize fuzzXIncludeInit
+#define LLVMFuzzerTestOneInput fuzzXInclude
+#include "xinclude.c"
+#undef LLVMFuzzerInitialize
+#undef LLVMFuzzerTestOneInput
 #endif
 
 #ifdef HAVE_XML_FUZZER
-  #define LLVMFuzzerInitialize fuzzXmlInit
-  #define LLVMFuzzerTestOneInput fuzzXml
-  #include "xml.c"
-  #undef LLVMFuzzerInitialize
-  #undef LLVMFuzzerTestOneInput
+int fuzzXmlInit(int *argc, char ***argv);
+int fuzzXml(const char *data, size_t size);
+#define LLVMFuzzerInitialize fuzzXmlInit
+#define LLVMFuzzerTestOneInput fuzzXml
+#include "xml.c"
+#undef LLVMFuzzerInitialize
+#undef LLVMFuzzerTestOneInput
 #endif
 
 #ifdef HAVE_XPATH_FUZZER
-  #define LLVMFuzzerInitialize fuzzXPathInit
-  #define LLVMFuzzerTestOneInput fuzzXPath
-  #include "xpath.c"
-  #undef LLVMFuzzerInitialize
-  #undef LLVMFuzzerTestOneInput
+int fuzzXPathInit(int *argc, char ***argv);
+int fuzzXPath(const char *data, size_t size);
+#define LLVMFuzzerInitialize fuzzXPathInit
+#define LLVMFuzzerTestOneInput fuzzXPath
+#include "xpath.c"
+#undef LLVMFuzzerInitialize
+#undef LLVMFuzzerTestOneInput
 #endif
 
 typedef int
@@ -71,7 +103,7 @@ static int
 testFuzzer(initFunc init, fuzzFunc fuzz, const char *pattern) {
     glob_t globbuf;
     int ret = -1;
-    int i;
+    size_t i;
 
     if (glob(pattern, 0, NULL, &globbuf) != 0) {
         fprintf(stderr, "pattern %s matches no files\n", pattern);
@@ -105,7 +137,7 @@ error:
 
 #ifdef HAVE_XML_FUZZER
 static int
-testEntityLoader() {
+testEntityLoader(void) {
     static const char data[] =
         "doc.xml\\\n"
         "<!DOCTYPE doc SYSTEM \"doc.dtd\">\n"
@@ -148,7 +180,7 @@ testEntityLoader() {
 #endif
 
 int
-main() {
+main(void) {
     int ret = 0;
 
 #ifdef HAVE_XML_FUZZER
@@ -168,7 +200,15 @@ main() {
         ret = 1;
 #endif
 #ifdef HAVE_URI_FUZZER
-    if (testFuzzer(NULL, fuzzUri, "seed/uri/*") != 0)
+    if (testFuzzer(fuzzUriInit, fuzzUri, "seed/uri/*") != 0)
+        ret = 1;
+#endif
+#ifdef HAVE_VALID_FUZZER
+    if (testFuzzer(fuzzValidInit, fuzzValid, "seed/valid/*") != 0)
+        ret = 1;
+#endif
+#ifdef HAVE_XINCLUDE_FUZZER
+    if (testFuzzer(fuzzXIncludeInit, fuzzXInclude, "seed/xinclude/*") != 0)
         ret = 1;
 #endif
 #ifdef HAVE_XML_FUZZER
index 5e4c099..5bc279f 100644 (file)
@@ -8,40 +8,54 @@
 #include "fuzz.h"
 
 int
+LLVMFuzzerInitialize(int *argc ATTRIBUTE_UNUSED,
+                     char ***argv ATTRIBUTE_UNUSED) {
+    xmlFuzzMemSetup();
+    xmlSetGenericErrorFunc(NULL, xmlFuzzErrorFunc);
+
+    return 0;
+}
+
+int
 LLVMFuzzerTestOneInput(const char *data, size_t size) {
     xmlURIPtr uri;
-    char *str[2] = { NULL, NULL };
-    size_t numStrings;
+    size_t maxAlloc;
+    const char *str1, *str2;
+    char *copy;
 
     if (size > 10000)
         return(0);
 
-    numStrings = xmlFuzzExtractStrings(data, size, str, 2);
+    xmlFuzzDataInit(data, size);
+    maxAlloc = xmlFuzzReadInt(4) % (size * 8 + 1);
+    str1 = xmlFuzzReadString(NULL);
+    str2 = xmlFuzzReadString(NULL);
+
+    xmlFuzzMemSetLimit(maxAlloc);
 
-    uri = xmlParseURI(str[0]);
+    uri = xmlParseURI(str1);
     xmlFree(xmlSaveUri(uri));
     xmlFreeURI(uri);
 
-    uri = xmlParseURIRaw(str[0], 1);
+    uri = xmlParseURIRaw(str1, 1);
     xmlFree(xmlSaveUri(uri));
     xmlFreeURI(uri);
 
-    xmlFree(xmlURIUnescapeString(str[0], -1, NULL));
-    xmlFree(xmlURIEscape(BAD_CAST str[0]));
-    xmlFree(xmlCanonicPath(BAD_CAST str[0]));
-    xmlFree(xmlPathToURI(BAD_CAST str[0]));
+    xmlFree(xmlURIUnescapeString(str1, -1, NULL));
+    xmlFree(xmlURIEscape(BAD_CAST str1));
+    xmlFree(xmlCanonicPath(BAD_CAST str1));
+    xmlFree(xmlPathToURI(BAD_CAST str1));
 
-    if (numStrings >= 2) {
-        xmlFree(xmlBuildURI(BAD_CAST str[1], BAD_CAST str[0]));
-        xmlFree(xmlBuildRelativeURI(BAD_CAST str[1], BAD_CAST str[0]));
-        xmlFree(xmlURIEscapeStr(BAD_CAST str[0], BAD_CAST str[1]));
-    }
+    xmlFree(xmlBuildURI(BAD_CAST str2, BAD_CAST str1));
+    xmlFree(xmlBuildRelativeURI(BAD_CAST str2, BAD_CAST str1));
+    xmlFree(xmlURIEscapeStr(BAD_CAST str1, BAD_CAST str2));
 
-    /* Modifies string, so must come last. */
-    xmlNormalizeURIPath(str[0]);
+    copy = (char *) xmlCharStrdup(str1);
+    xmlNormalizeURIPath(copy);
+    xmlFree(copy);
 
-    xmlFree(str[0]);
-    xmlFree(str[1]);
+    xmlFuzzMemSetLimit(0);
+    xmlFuzzDataCleanup();
 
     return 0;
 }
diff --git a/fuzz/valid.c b/fuzz/valid.c
new file mode 100644 (file)
index 0000000..9d4a904
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * valid.c: a libFuzzer target to test DTD validation.
+ *
+ * See Copyright for the status of this software.
+ */
+
+#include <libxml/catalog.h>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include <libxml/xmlerror.h>
+#include <libxml/xmlreader.h>
+#include "fuzz.h"
+
+int
+LLVMFuzzerInitialize(int *argc ATTRIBUTE_UNUSED,
+                     char ***argv ATTRIBUTE_UNUSED) {
+    xmlFuzzMemSetup();
+    xmlInitParser();
+#ifdef LIBXML_CATALOG_ENABLED
+    xmlInitializeCatalog();
+#endif
+    xmlSetGenericErrorFunc(NULL, xmlFuzzErrorFunc);
+    xmlSetExternalEntityLoader(xmlFuzzEntityLoader);
+
+    return 0;
+}
+
+int
+LLVMFuzzerTestOneInput(const char *data, size_t size) {
+    static const size_t maxChunkSize = 128;
+    xmlDocPtr doc;
+    xmlParserCtxtPtr ctxt;
+    xmlValidCtxtPtr vctxt;
+    xmlTextReaderPtr reader;
+    const char *docBuffer, *docUrl;
+    size_t maxAlloc, docSize, consumed, chunkSize;
+    int opts;
+
+    xmlFuzzDataInit(data, size);
+    opts = (int) xmlFuzzReadInt(4);
+    opts &= ~XML_PARSE_XINCLUDE;
+    opts |= XML_PARSE_DTDVALID;
+    maxAlloc = xmlFuzzReadInt(4) % (size + 1);
+
+    xmlFuzzReadEntities();
+    docBuffer = xmlFuzzMainEntity(&docSize);
+    docUrl = xmlFuzzMainUrl();
+    if (docBuffer == NULL)
+        goto exit;
+
+    /* Pull parser */
+
+    xmlFuzzMemSetLimit(maxAlloc);
+    doc = xmlReadMemory(docBuffer, docSize, docUrl, NULL, opts);
+    xmlFreeDoc(doc);
+
+    /* Post validation */
+
+    xmlFuzzMemSetLimit(maxAlloc);
+    doc = xmlReadMemory(docBuffer, docSize, docUrl, NULL, opts & ~XML_PARSE_DTDVALID);
+    vctxt = xmlNewValidCtxt();
+    xmlValidateDocument(vctxt, doc);
+    xmlFreeValidCtxt(vctxt);
+    xmlFreeDoc(doc);
+
+    /* Push parser */
+
+    xmlFuzzMemSetLimit(maxAlloc);
+    ctxt = xmlCreatePushParserCtxt(NULL, NULL, NULL, 0, docUrl);
+    if (ctxt == NULL)
+        goto exit;
+    xmlCtxtUseOptions(ctxt, opts);
+
+    for (consumed = 0; consumed < docSize; consumed += chunkSize) {
+        chunkSize = docSize - consumed;
+        if (chunkSize > maxChunkSize)
+            chunkSize = maxChunkSize;
+        xmlParseChunk(ctxt, docBuffer + consumed, chunkSize, 0);
+    }
+
+    xmlParseChunk(ctxt, NULL, 0, 1);
+    xmlFreeDoc(ctxt->myDoc);
+    xmlFreeParserCtxt(ctxt);
+
+    /* Reader */
+
+    xmlFuzzMemSetLimit(maxAlloc);
+    reader = xmlReaderForMemory(docBuffer, docSize, NULL, NULL, opts);
+    if (reader == NULL)
+        goto exit;
+    while (xmlTextReaderRead(reader) == 1) {
+        if (xmlTextReaderNodeType(reader) == XML_ELEMENT_NODE) {
+            int i, n = xmlTextReaderAttributeCount(reader);
+            for (i=0; i<n; i++) {
+                xmlTextReaderMoveToAttributeNo(reader, i);
+                while (xmlTextReaderReadAttributeValue(reader) == 1);
+            }
+        }
+    }
+    xmlFreeTextReader(reader);
+
+exit:
+    xmlFuzzMemSetLimit(0);
+    xmlFuzzDataCleanup();
+    xmlResetLastError();
+    return(0);
+}
+
diff --git a/fuzz/valid.options b/fuzz/valid.options
new file mode 100644 (file)
index 0000000..dda14e0
--- /dev/null
@@ -0,0 +1,3 @@
+[libfuzzer]
+dict = xml.dict
+timeout = 20
diff --git a/fuzz/xinclude.c b/fuzz/xinclude.c
new file mode 100644 (file)
index 0000000..18de3f4
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * xinclude.c: a libFuzzer target to test the XInclude engine.
+ *
+ * See Copyright for the status of this software.
+ */
+
+#include <libxml/catalog.h>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include <libxml/xmlerror.h>
+#include <libxml/xinclude.h>
+#include <libxml/xmlreader.h>
+#include "fuzz.h"
+
+int
+LLVMFuzzerInitialize(int *argc ATTRIBUTE_UNUSED,
+                     char ***argv ATTRIBUTE_UNUSED) {
+    xmlFuzzMemSetup();
+    xmlInitParser();
+#ifdef LIBXML_CATALOG_ENABLED
+    xmlInitializeCatalog();
+#endif
+    xmlSetGenericErrorFunc(NULL, xmlFuzzErrorFunc);
+    xmlSetExternalEntityLoader(xmlFuzzEntityLoader);
+
+    return 0;
+}
+
+int
+LLVMFuzzerTestOneInput(const char *data, size_t size) {
+    xmlDocPtr doc;
+    xmlTextReaderPtr reader;
+    const char *docBuffer, *docUrl;
+    size_t maxAlloc, docSize;
+    int opts;
+
+    xmlFuzzDataInit(data, size);
+    opts = (int) xmlFuzzReadInt(4);
+    opts &= ~XML_PARSE_DTDVALID;
+    opts |= XML_PARSE_XINCLUDE;
+    maxAlloc = xmlFuzzReadInt(4) % (size + 1);
+
+    xmlFuzzReadEntities();
+    docBuffer = xmlFuzzMainEntity(&docSize);
+    docUrl = xmlFuzzMainUrl();
+    if (docBuffer == NULL)
+        goto exit;
+
+    /* Pull parser */
+
+    xmlFuzzMemSetLimit(maxAlloc);
+    doc = xmlReadMemory(docBuffer, docSize, docUrl, NULL, opts);
+    xmlXIncludeProcessFlags(doc, opts);
+    xmlFreeDoc(doc);
+
+    /* Reader */
+
+    xmlFuzzMemSetLimit(maxAlloc);
+    reader = xmlReaderForMemory(docBuffer, docSize, NULL, NULL, opts);
+    if (reader == NULL)
+        goto exit;
+    while (xmlTextReaderRead(reader) == 1) {
+        if (xmlTextReaderNodeType(reader) == XML_ELEMENT_NODE) {
+            int i, n = xmlTextReaderAttributeCount(reader);
+            for (i=0; i<n; i++) {
+                xmlTextReaderMoveToAttributeNo(reader, i);
+                while (xmlTextReaderReadAttributeValue(reader) == 1);
+            }
+        }
+    }
+    xmlFreeTextReader(reader);
+
+exit:
+    xmlFuzzMemSetLimit(0);
+    xmlFuzzDataCleanup();
+    xmlResetLastError();
+    return(0);
+}
+
diff --git a/fuzz/xinclude.options b/fuzz/xinclude.options
new file mode 100644 (file)
index 0000000..dda14e0
--- /dev/null
@@ -0,0 +1,3 @@
+[libfuzzer]
+dict = xml.dict
+timeout = 20
index 8b4c4ef..0ac765d 100644 (file)
@@ -8,13 +8,13 @@
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 #include <libxml/xmlerror.h>
-#include <libxml/xinclude.h>
 #include <libxml/xmlreader.h>
 #include "fuzz.h"
 
 int
 LLVMFuzzerInitialize(int *argc ATTRIBUTE_UNUSED,
                      char ***argv ATTRIBUTE_UNUSED) {
+    xmlFuzzMemSetup();
     xmlInitParser();
 #ifdef LIBXML_CATALOG_ENABLED
     xmlInitializeCatalog();
@@ -33,16 +33,13 @@ LLVMFuzzerTestOneInput(const char *data, size_t size) {
     xmlTextReaderPtr reader;
     xmlChar *out;
     const char *docBuffer, *docUrl;
-    size_t maxSize, docSize, consumed, chunkSize;
+    size_t maxAlloc, docSize, consumed, chunkSize;
     int opts, outSize;
 
     xmlFuzzDataInit(data, size);
-    opts = xmlFuzzReadInt();
-
-    /* Lower maximum size when processing entities for now. */
-    maxSize = opts & XML_PARSE_NOENT ? 50000 : 500000;
-    if (size > maxSize)
-        goto exit;
+    opts = (int) xmlFuzzReadInt(4);
+    opts &= ~XML_PARSE_XINCLUDE & ~XML_PARSE_DTDVALID;
+    maxAlloc = xmlFuzzReadInt(4) % (size + 1);
 
     xmlFuzzReadEntities();
     docBuffer = xmlFuzzMainEntity(&docSize);
@@ -52,9 +49,8 @@ LLVMFuzzerTestOneInput(const char *data, size_t size) {
 
     /* Pull parser */
 
+    xmlFuzzMemSetLimit(maxAlloc);
     doc = xmlReadMemory(docBuffer, docSize, docUrl, NULL, opts);
-    if (opts & XML_PARSE_XINCLUDE)
-        xmlXIncludeProcessFlags(doc, opts);
     /* Also test the serializer. */
     xmlDocDumpMemory(doc, &out, &outSize);
     xmlFree(out);
@@ -62,6 +58,7 @@ LLVMFuzzerTestOneInput(const char *data, size_t size) {
 
     /* Push parser */
 
+    xmlFuzzMemSetLimit(maxAlloc);
     ctxt = xmlCreatePushParserCtxt(NULL, NULL, NULL, 0, docUrl);
     if (ctxt == NULL)
         goto exit;
@@ -75,13 +72,12 @@ LLVMFuzzerTestOneInput(const char *data, size_t size) {
     }
 
     xmlParseChunk(ctxt, NULL, 0, 1);
-    if (opts & XML_PARSE_XINCLUDE)
-        xmlXIncludeProcessFlags(ctxt->myDoc, opts);
     xmlFreeDoc(ctxt->myDoc);
     xmlFreeParserCtxt(ctxt);
 
     /* Reader */
 
+    xmlFuzzMemSetLimit(maxAlloc);
     reader = xmlReaderForMemory(docBuffer, docSize, NULL, NULL, opts);
     if (reader == NULL)
         goto exit;
@@ -97,6 +93,7 @@ LLVMFuzzerTestOneInput(const char *data, size_t size) {
     xmlFreeTextReader(reader);
 
 exit:
+    xmlFuzzMemSetLimit(0);
     xmlFuzzDataCleanup();
     xmlResetLastError();
     return(0);
index 47652bd..a5eb70b 100644 (file)
@@ -11,6 +11,7 @@
 int
 LLVMFuzzerInitialize(int *argc ATTRIBUTE_UNUSED,
                      char ***argv ATTRIBUTE_UNUSED) {
+    xmlFuzzMemSetup();
     xmlInitParser();
     xmlSetGenericErrorFunc(NULL, xmlFuzzErrorFunc);
 
@@ -21,28 +22,36 @@ int
 LLVMFuzzerTestOneInput(const char *data, size_t size) {
     xmlDocPtr doc;
     const char *expr, *xml;
-    size_t exprSize, xmlSize;
+    size_t maxAlloc, exprSize, xmlSize;
 
     if (size > 10000)
         return(0);
 
     xmlFuzzDataInit(data, size);
 
+    maxAlloc = xmlFuzzReadInt(4) % (size + 1);
     expr = xmlFuzzReadString(&exprSize);
     xml = xmlFuzzReadString(&xmlSize);
 
     /* Recovery mode allows more input to be fuzzed. */
     doc = xmlReadMemory(xml, xmlSize, NULL, NULL, XML_PARSE_RECOVER);
     if (doc != NULL) {
-        xmlXPathContextPtr xpctxt = xmlXPathNewContext(doc);
+        xmlXPathContextPtr xpctxt;
 
-        /* Operation limit to avoid timeout */
-        xpctxt->opLimit = 500000;
+        xmlFuzzMemSetLimit(maxAlloc);
 
-        xmlXPathFreeObject(xmlXPtrEval(BAD_CAST expr, xpctxt));
-        xmlXPathFreeContext(xpctxt);
+        xpctxt = xmlXPathNewContext(doc);
+        if (xpctxt != NULL) {
+            /* Operation limit to avoid timeout */
+            xpctxt->opLimit = 500000;
+
+            xmlXPathFreeObject(xmlXPtrEval(BAD_CAST expr, xpctxt));
+            xmlXPathFreeContext(xpctxt);
+        }
+
+        xmlFuzzMemSetLimit(0);
+        xmlFreeDoc(doc);
     }
-    xmlFreeDoc(doc);
 
     xmlFuzzDataCleanup();
     xmlResetLastError();
index c6252fc..4e229d1 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # Portions of this script have been (shamelessly) stolen from the
 # prior work of Daniel Veillard (genUnicode.py)
@@ -16,7 +16,6 @@
 #
 
 import sys
-import string
 import time
 
 #
@@ -28,21 +27,21 @@ def makeRange(lst):
     ret = []
     pos = 0
     while pos < len(lst):
-       try:            # index generates exception if not present
-           s = lst[pos:].index(1)      # look for start of next range
-       except:
-           break                       # if no more, finished
-       pos += s                        # pointer to start of possible range
-       try:
-           e = lst[pos:].index(0)      # look for end of range
-           e += pos
-       except:                         # if no end, set to end of list
-           e = len(lst)
-       ret.append((pos, e-1))          # append range tuple to list
-       pos = e + 1                     # ready to check for next range
+        try:            # index generates exception if not present
+            s = lst[pos:].index(1)      # look for start of next range
+        except:
+            break                       # if no more, finished
+        pos += s                        # pointer to start of possible range
+        try:
+            e = lst[pos:].index(0)      # look for end of range
+            e += pos
+        except:                         # if no end, set to end of list
+            e = len(lst)
+        ret.append((pos, e-1))          # append range tuple to list
+        pos = e + 1                     # ready to check for next range
     return ret
 
-sources = "chvalid.def"                        # input filename
+sources = "chvalid.def"                 # input filename
 
 # minTableSize gives the minimum number of ranges which must be present
 # before a 256-byte lookup table is produced.  If there are less than this
@@ -57,13 +56,13 @@ state = 0
 try:
     defines = open("chvalid.def", "r")
 except:
-    print "Missing chvalid.def, aborting ..."
+    print("Missing chvalid.def, aborting ...")
     sys.exit(1)
 
 #
 # The lines in the .def file have three types:-
 #   name:   Defines a new function block
-#   ur:            Defines individual or ranges of unicode values
+#   ur:     Defines individual or ranges of unicode values
 #   end:    Indicates the end of the function block
 #
 # These lines are processed below.
@@ -72,111 +71,111 @@ for line in defines.readlines():
     # ignore blank lines, or lines beginning with '#'
     if line[0] == '#':
         continue
-    line = string.strip(line)
+    line = line.strip()
     if line == '':
         continue
     # split line into space-separated fields, then split on type
     try:
-        fields = string.split(line, ' ')
-       #
-       # name line:
-       #   validate any previous function block already ended
-       #   validate this function not already defined
-       #   initialize an entry in the function dicitonary
-       #       including a mask table with no values yet defined
-       #
-       if fields[0] == 'name':
-           name = fields[1]
-           if state != 0:
-               print "'name' %s found before previous name" \
-                     "completed" % (fields[1])
-               continue
-           state = 1
-           if Functs.has_key(name):
-               print "name '%s' already present - may give" \
-                     " wrong results" % (name)
-           else:
-               # dict entry with two list elements (chdata, rangedata)
-               Functs[name] = [ [], [] ]
-               for v in range(256):
-                   Functs[name][0].append(0)
-       #
-       # end line:
-       #   validate there was a preceding function name line
-       #   set state to show no current function active
-       #
-       elif fields[0] == 'end':
-           if state == 0:
-               print "'end' found outside of function block"
-               continue
-           state = 0
-
-       #
-       # ur line:
-       #   validate function has been defined
-       #   process remaining fields on the line, which may be either
-       #       individual unicode values or ranges of values
-       #
-       elif fields[0] == 'ur':
-           if state != 1:
-               raise ValidationError, "'ur' found outside of 'name' block"
-           for el in fields[1:]:
-               pos = string.find(el, '..')
-               # pos <=0 means not a range, so must be individual value
-               if pos <= 0:
-                   # cheap handling of hex or decimal values
-                   if el[0:2] == '0x':
-                       value = int(el[2:],16)
-                   elif el[0] == "'":
-                       value = ord(el[1])
-                   else:
-                       value = int(el)
-                   if ((value < 0) | (value > 0x1fffff)):
-                       raise ValidationError, 'Illegal value (%s) in ch for'\
-                               ' name %s' % (el,name)
-                   # for ur we have only ranges (makes things simpler),
-                   # so convert val to range
-                   currange = (value, value)
-               # pos > 0 means this is a range, so isolate/validate
-               # the interval
-               else:
-                   # split the range into it's first-val, last-val
-                   (first, last) = string.split(el, "..")
-                   # convert values from text into binary
-                   if first[0:2] == '0x':      
-                       start = int(first[2:],16)
-                   elif first[0] == "'":
-                       start = ord(first[1])
-                   else:
-                       start = int(first)
-                   if last[0:2] == '0x':
-                       end = int(last[2:],16)
-                   elif last[0] == "'":
-                       end = ord(last[1])
-                   else:
-                       end = int(last)
-                   if (start < 0) | (end > 0x1fffff) | (start > end):
-                       raise ValidationError, "Invalid range '%s'" % el
-                   currange = (start, end)
-               # common path - 'currange' has the range, now take care of it
-               # We split on single-byte values vs. multibyte
-               if currange[1] < 0x100: # single-byte
-                   for ch in range(currange[0],currange[1]+1):
-                       # validate that value not previously defined
-                       if Functs[name][0][ch]:
-                           msg = "Duplicate ch value '%s' for name '%s'" % (el, name)
-                           raise ValidationError, msg
-                       Functs[name][0][ch] = 1
-               else:                   # multi-byte
-                   if currange in Functs[name][1]:
-                       raise ValidationError, "range already defined in" \
-                               " function"
-                   else:
-                       Functs[name][1].append(currange)
+        fields = line.split(' ')
+        #
+        # name line:
+        #   validate any previous function block already ended
+        #   validate this function not already defined
+        #   initialize an entry in the function dicitonary
+        #       including a mask table with no values yet defined
+        #
+        if fields[0] == 'name':
+            name = fields[1]
+            if state != 0:
+                print("'name' %s found before previous name" \
+                      "completed" % (fields[1]))
+                continue
+            state = 1
+            if name in Functs:
+                print("name '%s' already present - may give" \
+                      " wrong results" % (name))
+            else:
+                # dict entry with two list elements (chdata, rangedata)
+                Functs[name] = [ [], [] ]
+                for v in range(256):
+                    Functs[name][0].append(0)
+        #
+        # end line:
+        #   validate there was a preceding function name line
+        #   set state to show no current function active
+        #
+        elif fields[0] == 'end':
+            if state == 0:
+                print("'end' found outside of function block")
+                continue
+            state = 0
+
+        #
+        # ur line:
+        #   validate function has been defined
+        #   process remaining fields on the line, which may be either
+        #       individual unicode values or ranges of values
+        #
+        elif fields[0] == 'ur':
+            if state != 1:
+                raise Exception("'ur' found outside of 'name' block")
+            for el in fields[1:]:
+                pos = el.find('..')
+                # pos <=0 means not a range, so must be individual value
+                if pos <= 0:
+                    # cheap handling of hex or decimal values
+                    if el[0:2] == '0x':
+                        value = int(el[2:],16)
+                    elif el[0] == "'":
+                        value = ord(el[1])
+                    else:
+                        value = int(el)
+                    if ((value < 0) | (value > 0x1fffff)):
+                        raise Exception('Illegal value (%s) in ch for'\
+                                ' name %s' % (el,name))
+                    # for ur we have only ranges (makes things simpler),
+                    # so convert val to range
+                    currange = (value, value)
+                # pos > 0 means this is a range, so isolate/validate
+                # the interval
+                else:
+                    # split the range into it's first-val, last-val
+                    (first, last) = el.split("..")
+                    # convert values from text into binary
+                    if first[0:2] == '0x':
+                        start = int(first[2:],16)
+                    elif first[0] == "'":
+                        start = ord(first[1])
+                    else:
+                        start = int(first)
+                    if last[0:2] == '0x':
+                        end = int(last[2:],16)
+                    elif last[0] == "'":
+                        end = ord(last[1])
+                    else:
+                        end = int(last)
+                    if (start < 0) | (end > 0x1fffff) | (start > end):
+                        raise Exception("Invalid range '%s'" % el)
+                    currange = (start, end)
+                # common path - 'currange' has the range, now take care of it
+                # We split on single-byte values vs. multibyte
+                if currange[1] < 0x100: # single-byte
+                    for ch in range(currange[0],currange[1]+1):
+                        # validate that value not previously defined
+                        if Functs[name][0][ch]:
+                            msg = "Duplicate ch value '%s' for name '%s'" % (el, name)
+                            raise Exception(msg)
+                        Functs[name][0][ch] = 1
+                else:                   # multi-byte
+                    if currange in Functs[name][1]:
+                        raise Exception("range already defined in" \
+                                " function")
+                    else:
+                        Functs[name][1].append(currange)
 
     except:
-       print "Failed to process line: %s" % (line)
-       raise
+        print("Failed to process line: %s" % (line))
+        raise
 #
 # At this point, the entire definition file has been processed.  Now we
 # enter the output phase, where we generate the two files chvalid.c and'
@@ -194,13 +193,13 @@ for line in defines.readlines():
 try:
     header = open("include/libxml/chvalid.h", "w")
 except:
-    print "Failed to open include/libxml/chvalid.h"
+    print("Failed to open include/libxml/chvalid.h")
     sys.exit(1)
 
 try:
     output = open("chvalid.c", "w")
 except:
-    print "Failed to open chvalid.c"
+    print("Failed to open chvalid.c")
     sys.exit(1)
 
 date = time.asctime(time.localtime(time.time()))
@@ -236,37 +235,37 @@ extern "C" {
 typedef struct _xmlChSRange xmlChSRange;
 typedef xmlChSRange *xmlChSRangePtr;
 struct _xmlChSRange {
-    unsigned short     low;
-    unsigned short     high;
+    unsigned short\tlow;
+    unsigned short\thigh;
 };
 
 typedef struct _xmlChLRange xmlChLRange;
 typedef xmlChLRange *xmlChLRangePtr;
 struct _xmlChLRange {
-    unsigned int       low;
-    unsigned int       high;
+    unsigned int\tlow;
+    unsigned int\thigh;
 };
 
 typedef struct _xmlChRangeGroup xmlChRangeGroup;
 typedef xmlChRangeGroup *xmlChRangeGroupPtr;
 struct _xmlChRangeGroup {
-    int                        nbShortRange;
-    int                        nbLongRange;
-    const xmlChSRange  *shortRange;    /* points to an array of ranges */
-    const xmlChLRange  *longRange;
+    int\t\t\tnbShortRange;
+    int\t\t\tnbLongRange;
+    const xmlChSRange\t*shortRange;\t/* points to an array of ranges */
+    const xmlChLRange\t*longRange;
 };
 
 /**
  * Range checking routine
  */
-XMLPUBFUN int XMLCALL
-               xmlCharInRange(unsigned int val, const xmlChRangeGroup *group);
+XMLPUBFUN int
+\t\txmlCharInRange(unsigned int val, const xmlChRangeGroup *group);
 
 """ % (date, sources));
 output.write(
 """/*
- * chvalid.c:  this module implements the character range
- *             validation APIs
+ * chvalid.c:\tthis module implements the character range
+ *\t\tvalidation APIs
  *
  * This file is automatically generated from the cvs source
  * definition files using the genChRanges.py Python script
@@ -280,6 +279,8 @@ output.write(
 #include "libxml.h"
 #include <libxml/chvalid.h>
 
+#include <stddef.h>
+
 /*
  * The initial tables ({func_name}_tab) are used to validate whether a
  * single-byte character is within the specified group.  Each table
@@ -299,8 +300,7 @@ output.write(
 # compares, otherwise we output a 256-byte table and a macro to use it.
 #
 
-fkeys = Functs.keys()  # Dictionary of all defined functions
-fkeys.sort()           # Put some order to our output
+fkeys = sorted(Functs.keys())
 
 for f in fkeys:
 
@@ -308,12 +308,12 @@ for f in fkeys:
 # If the total number of such ranges is less than minTableSize, we generate
 # an inline macro for direct comparisons; if greater, we generate a lookup
 # table.
-    if max(Functs[f][0]) > 0:  # only check if at least one entry
+    if max(Functs[f][0]) > 0:   # only check if at least one entry
         rangeTable = makeRange(Functs[f][0])
-       numRanges = len(rangeTable)
-       if numRanges >= minTableSize:   # table is worthwhile
-           header.write("XMLPUBVAR const unsigned char %s_tab[256];\n" % f)
-           header.write("""
+        numRanges = len(rangeTable)
+        if numRanges >= minTableSize:   # table is worthwhile
+            header.write("XMLPUBVAR const unsigned char %s_tab[256];\n" % f)
+            header.write("""
 /**
  * %s_ch:
  * @c: char to validate
@@ -321,29 +321,29 @@ for f in fkeys:
  * Automatically generated by genChRanges.py
  */
 """ % f)
-           header.write("#define %s_ch(c)\t(%s_tab[(c)])\n" % (f, f))
-
-           # write the constant data to the code file
-           output.write("const unsigned char %s_tab[256] = {\n" % f)
-           pline = "   "
-           for n in range(255):
-               pline += " 0x%02x," % Functs[f][0][n]
-               if len(pline) > 72:
-                   output.write(pline + "\n")
-                   pline = "   "
-           output.write(pline + " 0x%02x };\n\n" % Functs[f][0][255])
-
-       else:           # inline check is used
-           # first another little optimisation - if space is present,
-           # put it at the front of the list so it is checked first
-           try:
-               ix = rangeTable.remove((0x20, 0x20))
-               rangeTable.insert(0, (0x20, 0x20))
-           except:
-               pass
-           firstFlag = 1
-           
-           header.write("""
+            header.write("#define %s_ch(c)\t(%s_tab[(c)])\n" % (f, f))
+
+            # write the constant data to the code file
+            output.write("const unsigned char %s_tab[256] = {\n" % f)
+            pline = "   "
+            for n in range(255):
+                pline += " 0x%02x," % Functs[f][0][n]
+                if len(pline) > 72:
+                    output.write(pline + "\n")
+                    pline = "   "
+            output.write(pline + " 0x%02x };\n\n" % Functs[f][0][255])
+
+        else:           # inline check is used
+            # first another little optimisation - if space is present,
+            # put it at the front of the list so it is checked first
+            try:
+                ix = rangeTable.remove((0x20, 0x20))
+                rangeTable.insert(0, (0x20, 0x20))
+            except:
+                pass
+            firstFlag = 1
+
+            header.write("""
 /**
  * %s_ch:
  * @c: char to validate
@@ -351,32 +351,32 @@ for f in fkeys:
  * Automatically generated by genChRanges.py
  */
 """ % f)
-           # okay, I'm tired of the messy lineup - let's automate it!
-           pline = "#define %s_ch(c)" % f
-           # 'ntab' is number of tabs needed to position to col. 33 from name end
-           ntab = 4 - (len(pline)) / 8
-           if ntab < 0:
-               ntab = 0
-           just = ""
-           for i in range(ntab):
-               just += "\t"
-           pline = pline + just + "("
-           for rg in rangeTable:
-               if not firstFlag:
-                   pline += " || \\\n\t\t\t\t "
-               else:
-                   firstFlag = 0
-               if rg[0] == rg[1]:              # single value - check equal
-                   pline += "((c) == 0x%x)" % rg[0]
-               else:                           # value range
-               # since we are doing char, also change range ending in 0xff
-                   if rg[1] != 0xff:
-                       pline += "((0x%x <= (c)) &&" % rg[0]
-                       pline += " ((c) <= 0x%x))" % rg[1]
-                   else:
-                       pline += " (0x%x <= (c))" % rg[0]
-           pline += ")\n"
-           header.write(pline)
+            # okay, I'm tired of the messy lineup - let's automate it!
+            pline = "#define %s_ch(c)" % f
+            # 'ntab' is number of tabs needed to position to col. 33 from name end
+            ntab = 4 - (len(pline)) // 8
+            if ntab < 0:
+                ntab = 0
+            just = ""
+            for i in range(ntab):
+                just += "\t"
+            pline = pline + just + "("
+            for rg in rangeTable:
+                if not firstFlag:
+                    pline += " || \\\n\t\t\t\t "
+                else:
+                    firstFlag = 0
+                if rg[0] == rg[1]:              # single value - check equal
+                    pline += "((c) == 0x%x)" % rg[0]
+                else:                           # value range
+                # since we are doing char, also change range ending in 0xff
+                    if rg[1] != 0xff:
+                        pline += "((0x%x <= (c)) &&" % rg[0]
+                        pline += " ((c) <= 0x%x))" % rg[1]
+                    else:
+                        pline += " (0x%x <= (c))" % rg[0]
+            pline += ")\n"
+            header.write(pline)
 
     header.write("""
 /**
@@ -387,44 +387,44 @@ for f in fkeys:
  */
 """ % f)
     pline = "#define %sQ(c)" % f
-    ntab = 4 - (len(pline)) / 8
+    ntab = 4 - (len(pline)) // 8
     if ntab < 0:
-       ntab = 0
+        ntab = 0
     just = ""
     for i in range(ntab):
-       just += "\t"
+        just += "\t"
     header.write(pline + just + "(((c) < 0x100) ? \\\n\t\t\t\t ")
     if max(Functs[f][0]) > 0:
-       header.write("%s_ch((c)) :" % f)
+        header.write("%s_ch((c)) :" % f)
     else:
-       header.write("0 :")
+        header.write("0 :")
 
     # if no ranges defined, value invalid if >= 0x100
     numRanges = len(Functs[f][1])
     if numRanges == 0:
-       header.write(" 0)\n\n")
+        header.write(" 0)\n\n")
     else:
-       if numRanges >= minTableSize:
-           header.write(" \\\n\t\t\t\t xmlCharInRange((c), &%sGroup))\n\n"  % f)
-       else:           # if < minTableSize, generate inline code
-           firstFlag = 1
-           for rg in Functs[f][1]:
-               if not firstFlag:
-                   pline += " || \\\n\t\t\t\t "
-               else:
-                   firstFlag = 0
-                   pline = "\\\n\t\t\t\t("
-               if rg[0] == rg[1]:              # single value - check equal
-                   pline += "((c) == 0x%x)" % rg[0]
-               else:                           # value range
-                   pline += "((0x%x <= (c)) &&" % rg[0]
-                   pline += " ((c) <= 0x%x))" % rg[1]
-           pline += "))\n\n"
-           header.write(pline)
+        if numRanges >= minTableSize:
+            header.write(" \\\n\t\t\t\t xmlCharInRange((c), &%sGroup))\n\n"  % f)
+        else:           # if < minTableSize, generate inline code
+            firstFlag = 1
+            for rg in Functs[f][1]:
+                if not firstFlag:
+                    pline += " || \\\n\t\t\t\t "
+                else:
+                    firstFlag = 0
+                    pline = "\\\n\t\t\t\t("
+                if rg[0] == rg[1]:              # single value - check equal
+                    pline += "((c) == 0x%x)" % rg[0]
+                else:                           # value range
+                    pline += "((0x%x <= (c)) &&" % rg[0]
+                    pline += " ((c) <= 0x%x))" % rg[1]
+            pline += "))\n\n"
+            header.write(pline)
 
 
     if len(Functs[f][1]) > 0:
-       header.write("XMLPUBVAR const xmlChRangeGroup %sGroup;\n" % f)
+        header.write("XMLPUBVAR const xmlChRangeGroup %sGroup;\n" % f)
 
 
 #
@@ -432,49 +432,49 @@ for f in fkeys:
 #
 
 for f in fkeys:
-    if len(Functs[f][1]) > 0:  # only generate if unicode ranges present
-       rangeTable = Functs[f][1]
-       rangeTable.sort()       # ascending tuple sequence
-       numShort = 0
-       numLong  = 0
-       for rg in rangeTable:
-           if rg[1] < 0x10000: # if short value
-               if numShort == 0:       # first occurrence
-                   pline = "static const xmlChSRange %s_srng[] = {" % f
-               else:
-                   pline += ","
-               numShort += 1
-               if len(pline) > 60:
-                   output.write(pline + "\n")
-                   pline = "    "
+    if len(Functs[f][1]) > 0:   # only generate if unicode ranges present
+        rangeTable = Functs[f][1]
+        rangeTable.sort()       # ascending tuple sequence
+        numShort = 0
+        numLong  = 0
+        for rg in rangeTable:
+            if rg[1] < 0x10000: # if short value
+                if numShort == 0:       # first occurrence
+                    pline = "static const xmlChSRange %s_srng[] = {" % f
+                else:
+                    pline += ","
+                numShort += 1
+                if len(pline) > 60:
+                    output.write(pline + "\n")
+                    pline = "    "
                 else:
                     pline += " "
-               pline += "{0x%x, 0x%x}" % (rg[0], rg[1])
-           else:               # if long value
-               if numLong == 0:        # first occurrence
-                   if numShort > 0:    # if there were shorts, finish them off
-                       output.write(pline + "};\n")
-                   pline = "static const xmlChLRange %s_lrng[] = { " % f
-               else:
-                   pline += ", "
-               numLong += 1
-               if len(pline) > 60:
-                   output.write(pline + "\n")
-                   pline = "    "
-               pline += "{0x%x, 0x%x}" % (rg[0], rg[1])
-       output.write(pline + "};\n")    # finish off last group
-
-       pline = "const xmlChRangeGroup %sGroup =\n\t{%d, %d, " % (f, numShort, numLong)
-       if numShort > 0:
-           pline += "%s_srng" % f
-       else:
-           pline += "(xmlChSRangePtr)0"
-       if numLong > 0:
-           pline += ", %s_lrng" % f
-       else:
-           pline += ", (xmlChLRangePtr)0"
-       
-       output.write(pline + "};\n\n")
+                pline += "{0x%x, 0x%x}" % (rg[0], rg[1])
+            else:               # if long value
+                if numLong == 0:        # first occurrence
+                    if numShort > 0:    # if there were shorts, finish them off
+                        output.write(pline + "};\n")
+                    pline = "static const xmlChLRange %s_lrng[] = { " % f
+                else:
+                    pline += ", "
+                numLong += 1
+                if len(pline) > 60:
+                    output.write(pline + "\n")
+                    pline = "    "
+                pline += "{0x%x, 0x%x}" % (rg[0], rg[1])
+        output.write(pline + "};\n")    # finish off last group
+
+        pline = "const xmlChRangeGroup %sGroup =\n\t{%d, %d, " % (f, numShort, numLong)
+        if numShort > 0:
+            pline += "%s_srng" % f
+        else:
+            pline += "(xmlChSRangePtr)0"
+        if numLong > 0:
+            pline += ", %s_lrng" % f
+        else:
+            pline += ", (xmlChLRangePtr)0"
+
+        output.write(pline + "};\n\n")
 
 output.write(
 """
@@ -495,43 +495,43 @@ xmlCharInRange (unsigned int val, const xmlChRangeGroup *rptr) {
     const xmlChLRange *lptr;
 
     if (rptr == NULL) return(0);
-    if (val < 0x10000) {       /* is val in 'short' or 'long'  array? */
-       if (rptr->nbShortRange == 0)
-           return 0;
-       low = 0;
-       high = rptr->nbShortRange - 1;
-       sptr = rptr->shortRange;
-       while (low <= high) {
-           mid = (low + high) / 2;
-           if ((unsigned short) val < sptr[mid].low) {
-               high = mid - 1;
-           } else {
-               if ((unsigned short) val > sptr[mid].high) {
-                   low = mid + 1;
-               } else {
-                   return 1;
-               }
-           }
-       }
+    if (val < 0x10000) {\t/* is val in 'short' or 'long'  array? */
+\tif (rptr->nbShortRange == 0)
+\t    return 0;
+\tlow = 0;
+\thigh = rptr->nbShortRange - 1;
+\tsptr = rptr->shortRange;
+\twhile (low <= high) {
+\t    mid = (low + high) / 2;
+\t    if ((unsigned short) val < sptr[mid].low) {
+\t\thigh = mid - 1;
+\t    } else {
+\t\tif ((unsigned short) val > sptr[mid].high) {
+\t\t    low = mid + 1;
+\t\t} else {
+\t\t    return 1;
+\t\t}
+\t    }
+\t}
     } else {
-       if (rptr->nbLongRange == 0) {
-           return 0;
-       }
-       low = 0;
-       high = rptr->nbLongRange - 1;
-       lptr = rptr->longRange;
-       while (low <= high) {
-           mid = (low + high) / 2;
-           if (val < lptr[mid].low) {
-               high = mid - 1;
-           } else {
-               if (val > lptr[mid].high) {
-                   low = mid + 1;
-               } else {
-                   return 1;
-               }
-           }
-       }
+\tif (rptr->nbLongRange == 0) {
+\t    return 0;
+\t}
+\tlow = 0;
+\thigh = rptr->nbLongRange - 1;
+\tlptr = rptr->longRange;
+\twhile (low <= high) {
+\t    mid = (low + high) / 2;
+\t    if (val < lptr[mid].low) {
+\t\thigh = mid - 1;
+\t    } else {
+\t\tif (val > lptr[mid].high) {
+\t\t    low = mid + 1;
+\t\t} else {
+\t\t    return 1;
+\t\t}
+\t    }
+\t}
     }
     return 0;
 }
@@ -559,7 +559,7 @@ for f in fkeys:
  */
 """)
     output.write("int\n%s(unsigned int ch) {\n    return(%sQ(ch));\n}\n\n" % (f,f))
-    header.write("XMLPUBFUN int XMLCALL\n\t\t%s(unsigned int ch);\n" % f);
+    header.write("XMLPUBFUN int\n\t\t%s(unsigned int ch);\n" % f);
 #
 # Run complete - write trailers and close the output files
 #
index ebf48e6..c6e13a8 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # Original script modified in November 2003 to take advantage of
 # the character-validation range routines, and updated to the
@@ -373,7 +373,7 @@ static xmlIntFunc
 
 for block in bkeys:
     name = block.replace('-', '')
-    header.write("XMLPUBFUN int XMLCALL xmlUCSIs%s\t(int code);\n" % name)
+    header.write("XMLPUBFUN int xmlUCSIs%s\t(int code);\n" % name)
     output.write("/**\n * xmlUCSIs%s:\n * @code: UCS code point\n" % (name))
     output.write(" *\n * Check whether the character is part of %s UCS Block\n"%
                  (block))
@@ -388,7 +388,7 @@ for block in bkeys:
         output.write("((code >= %s) && (code <= %s))" % (start, end))
     output.write(");\n}\n\n")
 
-header.write("\nXMLPUBFUN int XMLCALL xmlUCSIsBlock\t(int code, const char *block);\n\n")
+header.write("\nXMLPUBFUN int xmlUCSIsBlock\t(int code, const char *block);\n\n")
 output.write(
 """/**
  * xmlUCSIsBlock:
@@ -413,7 +413,7 @@ xmlUCSIsBlock(int code, const char *block) {
 
 for name in ckeys:
     ranges = Categories[name]
-    header.write("XMLPUBFUN int XMLCALL xmlUCSIsCat%s\t(int code);\n" % name)
+    header.write("XMLPUBFUN int xmlUCSIsCat%s\t(int code);\n" % name)
     output.write("/**\n * xmlUCSIsCat%s:\n * @code: UCS code point\n" % (name))
     output.write(" *\n * Check whether the character is part of %s UCS Category\n"%
                  (name))
@@ -438,7 +438,7 @@ for name in ckeys:
                          hex(begin), hex(end)))
     output.write(");\n}\n\n")
 
-header.write("\nXMLPUBFUN int XMLCALL xmlUCSIsCat\t(int code, const char *cat);\n")
+header.write("\nXMLPUBFUN int xmlUCSIsCat\t(int code, const char *cat);\n")
 output.write(
 """/**
  * xmlUCSIsCat:
index 172ed7e..40d963b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # generate a tester program for the API
 #
@@ -261,7 +261,6 @@ extra_post_call = {
    "xmlParseChunk": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}",
    "xmlParseExtParsedEnt": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}",
    "xmlDOMWrapAdoptNode": "if ((node != NULL) && (node->parent == NULL)) {xmlUnlinkNode(node);xmlFreeNode(node);node = NULL;}",
-   "xmlBufferSetAllocationScheme": "if ((buf != NULL) && (scheme == XML_BUFFER_ALLOC_IMMUTABLE) && (buf->content != NULL) && (buf->content != static_buf_content)) { xmlFree(buf->content); buf->content = NULL;}"
 }
 
 modules = []
@@ -800,9 +799,9 @@ test_%s(void) {
                 if btype == "const_char_ptr" or btype == "const_xmlChar_ptr":
                     test.write(
                         "        if ((%s != NULL) &&\n"
-                        "            (%s > (int) strlen((const char *) %s) + 1))\n"
-                        "            continue;\n"
-                        % (bnam, nam, bnam))
+                        "            (%s > xmlStrlen(BAD_CAST %s)))\n"
+                        "            %s = 0;\n"
+                        % (bnam, nam, bnam, nam))
                     break
         i = i + 1;
 
index a15ac30..c3e10a7 100644 (file)
--- a/globals.c
+++ b/globals.c
 #include <libxml/xmlmemory.h>
 #include <libxml/threads.h>
 
+#include "private/error.h"
+#include "private/globals.h"
+#include "private/threads.h"
+#include "private/tree.h"
+
 /* #define DEBUG_GLOBALS */
 
 /*
 /*
  * Mutex to protect "ForNewThreads" variables
  */
-static xmlMutexPtr xmlThrDefMutex = NULL;
+static xmlMutex xmlThrDefMutex;
 
 /**
  * xmlInitGlobals:
  *
- * DEPRECATED: This function will be made private. Call xmlInitParser to
- * initialize the library.
+ * DEPRECATED: Alias for xmlInitParser.
+ */
+void xmlInitGlobals(void) {
+    xmlInitParser();
+}
+
+/**
+ * xmlInitGlobalsInternal:
  *
  * Additional initialisation for multi-threading
  */
-void xmlInitGlobals(void)
-{
-    if (xmlThrDefMutex == NULL)
-        xmlThrDefMutex = xmlNewMutex();
+void xmlInitGlobalsInternal(void) {
+    xmlInitMutex(&xmlThrDefMutex);
 }
 
 /************************************************************************
@@ -175,6 +184,8 @@ const char *xmlParserVersion = LIBXML_VERSION_STRING LIBXML_VERSION_EXTRA;
 /**
  * xmlBufferAllocScheme:
  *
+ * DEPRECATED: Don't use.
+ *
  * Global setting, default allocation policy for buffers, default is
  * XML_BUFFER_ALLOC_EXACT
  */
@@ -183,6 +194,8 @@ static xmlBufferAllocationScheme xmlBufferAllocSchemeThrDef = XML_BUFFER_ALLOC_E
 /**
  * xmlDefaultBufferSize:
  *
+ * DEPRECATED: Don't use.
+ *
  * Global setting, default buffer size. Default value is BASE_BUFFER_SIZE
  */
 int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
@@ -201,6 +214,8 @@ int oldXMLWDcompatibility = 0; /* DEPRECATED */
 /**
  * xmlParserDebugEntities:
  *
+ * DEPRECATED: Don't use
+ *
  * Global setting, asking the parser to print out debugging information.
  * while handling entities.
  * Disabled by default
@@ -210,6 +225,8 @@ static int xmlParserDebugEntitiesThrDef = 0;
 /**
  * xmlDoValidityCheckingDefaultValue:
  *
+ * DEPRECATED: Use the modern options API with XML_PARSE_DTDVALID.
+ *
  * Global setting, indicate that the parser should work in validating mode.
  * Disabled by default.
  */
@@ -218,7 +235,9 @@ static int xmlDoValidityCheckingDefaultValueThrDef = 0;
 /**
  * xmlGetWarningsDefaultValue:
  *
- * Global setting, indicate that the parser should provide warnings.
+ * DEPRECATED: Don't use
+ *
+ * Global setting, indicate that the DTD validation should provide warnings.
  * Activated by default.
  */
 int xmlGetWarningsDefaultValue = 1;
@@ -226,6 +245,8 @@ static int xmlGetWarningsDefaultValueThrDef = 1;
 /**
  * xmlLoadExtDtdDefaultValue:
  *
+ * DEPRECATED: Use the modern options API with XML_PARSE_DTDLOAD.
+ *
  * Global setting, indicate that the parser should load DTD while not
  * validating.
  * Disabled by default.
@@ -235,6 +256,8 @@ static int xmlLoadExtDtdDefaultValueThrDef = 0;
 /**
  * xmlPedanticParserDefaultValue:
  *
+ * DEPRECATED: Use the modern options API with XML_PARSE_PEDANTIC.
+ *
  * Global setting, indicate that the parser be pedantic
  * Disabled by default.
  */
@@ -243,6 +266,8 @@ static int xmlPedanticParserDefaultValueThrDef = 0;
 /**
  * xmlLineNumbersDefaultValue:
  *
+ * DEPRECATED: The modern options API always enables line numbers.
+ *
  * Global setting, indicate that the parser should store the line number
  * in the content field of elements in the DOM tree.
  * Disabled by default since this may not be safe for old classes of
@@ -253,6 +278,8 @@ static int xmlLineNumbersDefaultValueThrDef = 0;
 /**
  * xmlKeepBlanksDefaultValue:
  *
+ * DEPRECATED: Use the modern options API with XML_PARSE_NOBLANKS.
+ *
  * Global setting, indicate that the parser should keep all blanks
  * nodes found in the content
  * Activated by default, this is actually needed to have the parser
@@ -264,6 +291,8 @@ static int xmlKeepBlanksDefaultValueThrDef = 1;
 /**
  * xmlSubstituteEntitiesDefaultValue:
  *
+ * DEPRECATED: Use the modern options API with XML_PARSE_NOENT.
+ *
  * Global setting, indicate that the parser should not generate entity
  * references but replace them with the actual content of the entity
  * Disabled by default, this should be activated when using XPath since
@@ -273,26 +302,38 @@ static int xmlKeepBlanksDefaultValueThrDef = 1;
 int xmlSubstituteEntitiesDefaultValue = 0;
 static int xmlSubstituteEntitiesDefaultValueThrDef = 0;
 
+/**
+ * xmlRegisterNodeDefaultValue:
+ *
+ * DEPRECATED: Don't use
+ */
 xmlRegisterNodeFunc xmlRegisterNodeDefaultValue = NULL;
 static xmlRegisterNodeFunc xmlRegisterNodeDefaultValueThrDef = NULL;
+
+/**
+ * xmlDeregisterNodeDefaultValue:
+ *
+ * DEPRECATED: Don't use
+ */
 xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue = NULL;
 static xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValueThrDef = NULL;
 
+/**
+ * xmlParserInputBufferCreateFilenameValue:
+ *
+ * DEPRECATED: Don't use
+ */
 xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue = NULL;
 static xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValueThrDef = NULL;
 
+/**
+ * xmlOutputBufferCreateFilenameValue:
+ *
+ * DEPRECATED: Don't use
+ */
 xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue = NULL;
 static xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValueThrDef = NULL;
 
-/*
- * Error handling
- */
-
-/* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; */
-/* Must initialize xmlGenericError in xmlInitParser */
-void XMLCDECL xmlGenericErrorDefaultFunc       (void *ctx ATTRIBUTE_UNUSED,
-                                const char *msg,
-                                ...);
 /**
  * xmlGenericError:
  *
@@ -358,6 +399,9 @@ static int xmlSaveNoEmptyTagsThrDef = 0;
 /**
  * xmlDefaultSAXHandler:
  *
+ * DEPRECATED: This handler is unused and will be removed from future
+ * versions.
+ *
  * Default SAX version1 handler for XML, builds the DOM tree
  */
 xmlSAXHandlerV1 xmlDefaultSAXHandler = {
@@ -388,13 +432,15 @@ xmlSAXHandlerV1 xmlDefaultSAXHandler = {
     xmlSAX2GetParameterEntity,
     xmlSAX2CDataBlock,
     xmlSAX2ExternalSubset,
-    0,
+    1,
 };
 #endif /* LIBXML_SAX1_ENABLED */
 
 /**
  * xmlDefaultSAXLocator:
  *
+ * DEPRECATED: Don't use
+ *
  * The default SAX Locator
  * { getPublicId, getSystemId, getLineNumber, getColumnNumber}
  */
@@ -405,10 +451,13 @@ xmlSAXLocator xmlDefaultSAXLocator = {
     xmlSAX2GetColumnNumber
 };
 
-#ifdef LIBXML_HTML_ENABLED
+#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_SAX1_ENABLED)
 /**
  * htmlDefaultSAXHandler:
  *
+ * DEPRECATED: This handler is unused and will be removed from future
+ * versions.
+ *
  * Default old SAX v1 handler for HTML, builds the DOM tree
  */
 xmlSAXHandlerV1 htmlDefaultSAXHandler = {
@@ -436,10 +485,10 @@ xmlSAXHandlerV1 htmlDefaultSAXHandler = {
     xmlParserWarning,
     xmlParserError,
     xmlParserError,
-    xmlSAX2GetParameterEntity,
+    NULL,
     xmlSAX2CDataBlock,
     NULL,
-    0,
+    1,
 };
 #endif /* LIBXML_HTML_ENABLED */
 
@@ -454,17 +503,11 @@ void
 xmlInitializeGlobalState(xmlGlobalStatePtr gs)
 {
 #ifdef DEBUG_GLOBALS
-    fprintf(stderr, "Initializing globals at %lu for thread %d\n",
-           (unsigned long) gs, xmlGetThreadId());
+    fprintf(stderr, "Initializing globals at %p for thread %d\n",
+           (void *) gs, xmlGetThreadId());
 #endif
 
-    /*
-     * Perform initialization as required by libxml
-     */
-    if (xmlThrDefMutex == NULL)
-        xmlInitGlobals();
-
-    xmlMutexLock(xmlThrDefMutex);
+    xmlMutexLock(&xmlThrDefMutex);
 
 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED)
     inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
@@ -519,51 +562,49 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
        gs->xmlOutputBufferCreateFilenameValue = xmlOutputBufferCreateFilenameValueThrDef;
     memset(&gs->xmlLastError, 0, sizeof(xmlError));
 
-    xmlMutexUnlock(xmlThrDefMutex);
+    xmlMutexUnlock(&xmlThrDefMutex);
 }
 
 /**
  * xmlCleanupGlobals:
  *
- * DEPRECATED: This function will be made private. Call xmlCleanupParser
+ * DEPRECATED: This function is a no-op. Call xmlCleanupParser
  * to free global state but see the warnings there. xmlCleanupParser
  * should be only called once at program exit. In most cases, you don't
  * have call cleanup functions at all.
+ */
+void xmlCleanupGlobals(void) {
+}
+
+/**
+ * xmlCleanupGlobalsInternal:
  *
  * Additional cleanup for multi-threading
  */
-void xmlCleanupGlobals(void)
-{
+void xmlCleanupGlobalsInternal(void) {
     xmlResetError(&xmlLastError);
 
-    if (xmlThrDefMutex != NULL) {
-       xmlFreeMutex(xmlThrDefMutex);
-       xmlThrDefMutex = NULL;
-    }
+    xmlCleanupMutex(&xmlThrDefMutex);
     __xmlGlobalInitMutexDestroy();
 }
 
-/**
- * DOC_DISABLE : we ignore missing doc for the xmlThrDef functions,
- *               those are really internal work
- */
 void
 xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
-    xmlMutexLock(xmlThrDefMutex);
+    xmlMutexLock(&xmlThrDefMutex);
     xmlGenericErrorContextThrDef = ctx;
     if (handler != NULL)
        xmlGenericErrorThrDef = handler;
     else
        xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
-    xmlMutexUnlock(xmlThrDefMutex);
+    xmlMutexUnlock(&xmlThrDefMutex);
 }
 
 void
 xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) {
-    xmlMutexLock(xmlThrDefMutex);
+    xmlMutexLock(&xmlThrDefMutex);
     xmlStructuredErrorContextThrDef = ctx;
     xmlStructuredErrorThrDef = handler;
-    xmlMutexUnlock(xmlThrDefMutex);
+    xmlMutexUnlock(&xmlThrDefMutex);
 }
 
 /**
@@ -589,12 +630,12 @@ xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func)
 {
     xmlRegisterNodeFunc old;
 
-    xmlMutexLock(xmlThrDefMutex);
+    xmlMutexLock(&xmlThrDefMutex);
     old = xmlRegisterNodeDefaultValueThrDef;
 
     __xmlRegisterCallbacks = 1;
     xmlRegisterNodeDefaultValueThrDef = func;
-    xmlMutexUnlock(xmlThrDefMutex);
+    xmlMutexUnlock(&xmlThrDefMutex);
 
     return(old);
 }
@@ -622,12 +663,12 @@ xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func)
 {
     xmlDeregisterNodeFunc old;
 
-    xmlMutexLock(xmlThrDefMutex);
+    xmlMutexLock(&xmlThrDefMutex);
     old = xmlDeregisterNodeDefaultValueThrDef;
 
     __xmlRegisterCallbacks = 1;
     xmlDeregisterNodeDefaultValueThrDef = func;
-    xmlMutexUnlock(xmlThrDefMutex);
+    xmlMutexUnlock(&xmlThrDefMutex);
 
     return(old);
 }
@@ -637,14 +678,14 @@ xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilena
 {
     xmlParserInputBufferCreateFilenameFunc old;
 
-    xmlMutexLock(xmlThrDefMutex);
+    xmlMutexLock(&xmlThrDefMutex);
     old = xmlParserInputBufferCreateFilenameValueThrDef;
     if (old == NULL) {
                old = __xmlParserInputBufferCreateFilename;
        }
 
     xmlParserInputBufferCreateFilenameValueThrDef = func;
-    xmlMutexUnlock(xmlThrDefMutex);
+    xmlMutexUnlock(&xmlThrDefMutex);
 
     return(old);
 }
@@ -654,7 +695,7 @@ xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc fun
 {
     xmlOutputBufferCreateFilenameFunc old;
 
-    xmlMutexLock(xmlThrDefMutex);
+    xmlMutexLock(&xmlThrDefMutex);
     old = xmlOutputBufferCreateFilenameValueThrDef;
 #ifdef LIBXML_OUTPUT_ENABLED
     if (old == NULL) {
@@ -662,12 +703,12 @@ xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc fun
        }
 #endif
     xmlOutputBufferCreateFilenameValueThrDef = func;
-    xmlMutexUnlock(xmlThrDefMutex);
+    xmlMutexUnlock(&xmlThrDefMutex);
 
     return(old);
 }
 
-#ifdef LIBXML_HTML_ENABLED
+#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_SAX1_ENABLED)
 #undef htmlDefaultSAXHandler
 xmlSAXHandlerV1 *
 __htmlDefaultSAXHandler(void) {
@@ -765,10 +806,10 @@ __xmlBufferAllocScheme(void) {
 }
 xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) {
     xmlBufferAllocationScheme ret;
-    xmlMutexLock(xmlThrDefMutex);
+    xmlMutexLock(&xmlThrDefMutex);
     ret = xmlBufferAllocSchemeThrDef;
     xmlBufferAllocSchemeThrDef = v;
-    xmlMutexUnlock(xmlThrDefMutex);
+    xmlMutexUnlock(&xmlThrDefMutex);
     return ret;
 }
 
@@ -782,10 +823,10 @@ __xmlDefaultBufferSize(void) {
 }
 int xmlThrDefDefaultBufferSize(int v) {
     int ret;
-    xmlMutexLock(xmlThrDefMutex);
+    xmlMutexLock(&xmlThrDefMutex);
     ret = xmlDefaultBufferSizeThrDef;
     xmlDefaultBufferSizeThrDef = v;
-    xmlMutexUnlock(xmlThrDefMutex);
+    xmlMutexUnlock(&xmlThrDefMutex);
     return ret;
 }
 
@@ -819,10 +860,10 @@ __xmlDoValidityCheckingDefaultValue(void) {
 }
 int xmlThrDefDoValidityCheckingDefaultValue(int v) {
     int ret;
-    xmlMutexLock(xmlThrDefMutex);
+    xmlMutexLock(&xmlThrDefMutex);
     ret = xmlDoValidityCheckingDefaultValueThrDef;
     xmlDoValidityCheckingDefaultValueThrDef = v;
-    xmlMutexUnlock(xmlThrDefMutex);
+    xmlMutexUnlock(&xmlThrDefMutex);
     return ret;
 }
 
@@ -872,10 +913,10 @@ __xmlGetWarningsDefaultValue(void) {
 }
 int xmlThrDefGetWarningsDefaultValue(int v) {
     int ret;
-    xmlMutexLock(xmlThrDefMutex);
+    xmlMutexLock(&xmlThrDefMutex);
     ret = xmlGetWarningsDefaultValueThrDef;
     xmlGetWarningsDefaultValueThrDef = v;
-    xmlMutexUnlock(xmlThrDefMutex);
+    xmlMutexUnlock(&xmlThrDefMutex);
     return ret;
 }
 
@@ -889,10 +930,10 @@ __xmlIndentTreeOutput(void) {
 }
 int xmlThrDefIndentTreeOutput(int v) {
     int ret;
-    xmlMutexLock(xmlThrDefMutex);
+    xmlMutexLock(&xmlThrDefMutex);
     ret = xmlIndentTreeOutputThrDef;
     xmlIndentTreeOutputThrDef = v;
-    xmlMutexUnlock(xmlThrDefMutex);
+    xmlMutexUnlock(&xmlThrDefMutex);
     return ret;
 }
 
@@ -906,10 +947,10 @@ __xmlTreeIndentString(void) {
 }
 const char * xmlThrDefTreeIndentString(const char * v) {
     const char * ret;
-    xmlMutexLock(xmlThrDefMutex);
+    xmlMutexLock(&xmlThrDefMutex);
     ret = xmlTreeIndentStringThrDef;
     xmlTreeIndentStringThrDef = v;
-    xmlMutexUnlock(xmlThrDefMutex);
+    xmlMutexUnlock(&xmlThrDefMutex);
     return ret;
 }
 
@@ -923,10 +964,10 @@ __xmlKeepBlanksDefaultValue(void) {
 }
 int xmlThrDefKeepBlanksDefaultValue(int v) {
     int ret;
-    xmlMutexLock(xmlThrDefMutex);
+    xmlMutexLock(&xmlThrDefMutex);
     ret = xmlKeepBlanksDefaultValueThrDef;
     xmlKeepBlanksDefaultValueThrDef = v;
-    xmlMutexUnlock(xmlThrDefMutex);
+    xmlMutexUnlock(&xmlThrDefMutex);
     return ret;
 }
 
@@ -940,10 +981,10 @@ __xmlLineNumbersDefaultValue(void) {
 }
 int xmlThrDefLineNumbersDefaultValue(int v) {
     int ret;
-    xmlMutexLock(xmlThrDefMutex);
+    xmlMutexLock(&xmlThrDefMutex);
     ret = xmlLineNumbersDefaultValueThrDef;
     xmlLineNumbersDefaultValueThrDef = v;
-    xmlMutexUnlock(xmlThrDefMutex);
+    xmlMutexUnlock(&xmlThrDefMutex);
     return ret;
 }
 
@@ -957,10 +998,10 @@ __xmlLoadExtDtdDefaultValue(void) {
 }
 int xmlThrDefLoadExtDtdDefaultValue(int v) {
     int ret;
-    xmlMutexLock(xmlThrDefMutex);
+    xmlMutexLock(&xmlThrDefMutex);
     ret = xmlLoadExtDtdDefaultValueThrDef;
     xmlLoadExtDtdDefaultValueThrDef = v;
-    xmlMutexUnlock(xmlThrDefMutex);
+    xmlMutexUnlock(&xmlThrDefMutex);
     return ret;
 }
 
@@ -974,10 +1015,10 @@ __xmlParserDebugEntities(void) {
 }
 int xmlThrDefParserDebugEntities(int v) {
     int ret;
-    xmlMutexLock(xmlThrDefMutex);
+    xmlMutexLock(&xmlThrDefMutex);
     ret = xmlParserDebugEntitiesThrDef;
     xmlParserDebugEntitiesThrDef = v;
-    xmlMutexUnlock(xmlThrDefMutex);
+    xmlMutexUnlock(&xmlThrDefMutex);
     return ret;
 }
 
@@ -1000,10 +1041,10 @@ __xmlPedanticParserDefaultValue(void) {
 }
 int xmlThrDefPedanticParserDefaultValue(int v) {
     int ret;
-    xmlMutexLock(xmlThrDefMutex);
+    xmlMutexLock(&xmlThrDefMutex);
     ret = xmlPedanticParserDefaultValueThrDef;
     xmlPedanticParserDefaultValueThrDef = v;
-    xmlMutexUnlock(xmlThrDefMutex);
+    xmlMutexUnlock(&xmlThrDefMutex);
     return ret;
 }
 
@@ -1017,10 +1058,10 @@ __xmlSaveNoEmptyTags(void) {
 }
 int xmlThrDefSaveNoEmptyTags(int v) {
     int ret;
-    xmlMutexLock(xmlThrDefMutex);
+    xmlMutexLock(&xmlThrDefMutex);
     ret = xmlSaveNoEmptyTagsThrDef;
     xmlSaveNoEmptyTagsThrDef = v;
-    xmlMutexUnlock(xmlThrDefMutex);
+    xmlMutexUnlock(&xmlThrDefMutex);
     return ret;
 }
 
@@ -1034,10 +1075,10 @@ __xmlSubstituteEntitiesDefaultValue(void) {
 }
 int xmlThrDefSubstituteEntitiesDefaultValue(int v) {
     int ret;
-    xmlMutexLock(xmlThrDefMutex);
+    xmlMutexLock(&xmlThrDefMutex);
     ret = xmlSubstituteEntitiesDefaultValueThrDef;
     xmlSubstituteEntitiesDefaultValueThrDef = v;
-    xmlMutexUnlock(xmlThrDefMutex);
+    xmlMutexUnlock(&xmlThrDefMutex);
     return ret;
 }
 
diff --git a/hash.c b/hash.c
index 894174f..cbcc429 100644 (file)
--- a/hash.c
+++ b/hash.c
@@ -39,6 +39,8 @@
 #include <libxml/xmlerror.h>
 #include <libxml/globals.h>
 
+#include "private/dict.h"
+
 #define MAX_HASH_LEN 8
 
 /* #define DEBUG_GROW */
@@ -76,6 +78,7 @@ struct _xmlHashTable {
  */
 #ifdef __clang__
 ATTRIBUTE_NO_SANITIZE("unsigned-integer-overflow")
+ATTRIBUTE_NO_SANITIZE("unsigned-shift-base")
 #endif
 static unsigned long
 xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name,
@@ -109,6 +112,7 @@ xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name,
 
 #ifdef __clang__
 ATTRIBUTE_NO_SANITIZE("unsigned-integer-overflow")
+ATTRIBUTE_NO_SANITIZE("unsigned-shift-base")
 #endif
 static unsigned long
 xmlHashComputeQKey(xmlHashTablePtr table,
@@ -130,7 +134,7 @@ xmlHashComputeQKey(xmlHashTablePtr table,
        while ((ch = *prefix++) != 0) {
            value = value ^ ((value << 5) + (value >> 3) + ch);
        }
-       value = value ^ ((value << 5) + (value >> 3) + (unsigned long)':');
+       value = value ^ ((value << 5) + (value >> 3) + ':');
     }
     if (name != NULL) {
        while ((ch = *name++) != 0) {
@@ -142,7 +146,7 @@ xmlHashComputeQKey(xmlHashTablePtr table,
        while ((ch = *prefix2++) != 0) {
            value = value ^ ((value << 5) + (value >> 3) + ch);
        }
-       value = value ^ ((value << 5) + (value >> 3) + (unsigned long)':');
+       value = value ^ ((value << 5) + (value >> 3) + ':');
     }
     if (name2 != NULL) {
        while ((ch = *name2++) != 0) {
@@ -154,7 +158,7 @@ xmlHashComputeQKey(xmlHashTablePtr table,
        while ((ch = *prefix3++) != 0) {
            value = value ^ ((value << 5) + (value >> 3) + ch);
        }
-       value = value ^ ((value << 5) + (value >> 3) + (unsigned long)':');
+       value = value ^ ((value << 5) + (value >> 3) + ':');
     }
     if (name3 != NULL) {
        while ((ch = *name3++) != 0) {
@@ -176,6 +180,8 @@ xmlHashTablePtr
 xmlHashCreate(int size) {
     xmlHashTablePtr table;
 
+    xmlInitParser();
+
     if (size <= 0)
         size = 256;
 
@@ -609,8 +615,24 @@ xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name,
         entry->name3 = (xmlChar *) name3;
     } else {
        entry->name = xmlStrdup(name);
-       entry->name2 = xmlStrdup(name2);
-       entry->name3 = xmlStrdup(name3);
+        if (entry->name == NULL) {
+            entry->name2 = NULL;
+            goto error;
+        }
+        if (name2 == NULL) {
+            entry->name2 = NULL;
+        } else {
+           entry->name2 = xmlStrdup(name2);
+            if (entry->name2 == NULL)
+                goto error;
+        }
+        if (name3 == NULL) {
+            entry->name3 = NULL;
+        } else {
+           entry->name3 = xmlStrdup(name3);
+            if (entry->name3 == NULL)
+                goto error;
+        }
     }
     entry->payload = userdata;
     entry->next = NULL;
@@ -626,6 +648,13 @@ xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name,
        xmlHashGrow(table, MAX_HASH_LEN * table->size);
 
     return(0);
+
+error:
+    xmlFree(entry->name2);
+    xmlFree(entry->name);
+    if (insert != NULL)
+        xmlFree(entry);
+    return(-1);
 }
 
 /**
@@ -739,8 +768,24 @@ xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name,
         entry->name3 = (xmlChar *) name3;
     } else {
        entry->name = xmlStrdup(name);
-       entry->name2 = xmlStrdup(name2);
-       entry->name3 = xmlStrdup(name3);
+        if (entry->name == NULL) {
+            entry->name2 = NULL;
+            goto error;
+        }
+        if (name2 == NULL) {
+            entry->name2 = NULL;
+        } else {
+           entry->name2 = xmlStrdup(name2);
+            if (entry->name2 == NULL)
+                goto error;
+        }
+        if (name3 == NULL) {
+            entry->name3 = NULL;
+        } else {
+           entry->name3 = xmlStrdup(name3);
+            if (entry->name3 == NULL)
+                goto error;
+        }
     }
     entry->payload = userdata;
     entry->next = NULL;
@@ -752,6 +797,13 @@ xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name,
        insert->next = entry;
     }
     return(0);
+
+error:
+    xmlFree(entry->name2);
+    xmlFree(entry->name);
+    if (insert != NULL)
+        xmlFree(entry);
+    return(-1);
 }
 
 /**
index 7dbfaa5..2603acc 100644 (file)
@@ -1,5 +1,5 @@
 ## Process this file with automake to produce Makefile.in
-SUBDIRS=libxml
+SUBDIRS=libxml private
 
 EXTRA_DIST = win32config.h wsockcompat.h
 
index 1d4fec2..e43feee 100644 (file)
@@ -83,87 +83,101 @@ struct _htmlEntityDesc {
 /*
  * There is only few public functions.
  */
-XMLPUBFUN const htmlElemDesc * XMLCALL
+XML_DEPRECATED
+XMLPUBFUN void
+                       htmlInitAutoClose       (void);
+XMLPUBFUN const htmlElemDesc *
                        htmlTagLookup   (const xmlChar *tag);
-XMLPUBFUN const htmlEntityDesc * XMLCALL
+XMLPUBFUN const htmlEntityDesc *
                        htmlEntityLookup(const xmlChar *name);
-XMLPUBFUN const htmlEntityDesc * XMLCALL
+XMLPUBFUN const htmlEntityDesc *
                        htmlEntityValueLookup(unsigned int value);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        htmlIsAutoClosed(htmlDocPtr doc,
                                         htmlNodePtr elem);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        htmlAutoCloseTag(htmlDocPtr doc,
                                         const xmlChar *name,
                                         htmlNodePtr elem);
-XMLPUBFUN const htmlEntityDesc * XMLCALL
+XML_DEPRECATED
+XMLPUBFUN const htmlEntityDesc *
                        htmlParseEntityRef(htmlParserCtxtPtr ctxt,
                                         const xmlChar **str);
-XMLPUBFUN int XMLCALL
+XML_DEPRECATED
+XMLPUBFUN int
                        htmlParseCharRef(htmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
+XML_DEPRECATED
+XMLPUBFUN void
                        htmlParseElement(htmlParserCtxtPtr ctxt);
 
-XMLPUBFUN htmlParserCtxtPtr XMLCALL
+XMLPUBFUN htmlParserCtxtPtr
                        htmlNewParserCtxt(void);
+XMLPUBFUN htmlParserCtxtPtr
+                       htmlNewSAXParserCtxt(const htmlSAXHandler *sax,
+                                            void *userData);
 
-XMLPUBFUN htmlParserCtxtPtr XMLCALL
+XMLPUBFUN htmlParserCtxtPtr
                        htmlCreateMemoryParserCtxt(const char *buffer,
                                                   int size);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        htmlParseDocument(htmlParserCtxtPtr ctxt);
-XMLPUBFUN htmlDocPtr XMLCALL
+XML_DEPRECATED
+XMLPUBFUN htmlDocPtr
                        htmlSAXParseDoc (const xmlChar *cur,
                                         const char *encoding,
                                         htmlSAXHandlerPtr sax,
                                         void *userData);
-XMLPUBFUN htmlDocPtr XMLCALL
+XMLPUBFUN htmlDocPtr
                        htmlParseDoc    (const xmlChar *cur,
                                         const char *encoding);
-XMLPUBFUN htmlDocPtr XMLCALL
+XMLPUBFUN htmlParserCtxtPtr
+                       htmlCreateFileParserCtxt(const char *filename,
+                                                const char *encoding);
+XML_DEPRECATED
+XMLPUBFUN htmlDocPtr
                        htmlSAXParseFile(const char *filename,
                                         const char *encoding,
                                         htmlSAXHandlerPtr sax,
                                         void *userData);
-XMLPUBFUN htmlDocPtr XMLCALL
+XMLPUBFUN htmlDocPtr
                        htmlParseFile   (const char *filename,
                                         const char *encoding);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        UTF8ToHtml      (unsigned char *out,
                                         int *outlen,
                                         const unsigned char *in,
                                         int *inlen);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        htmlEncodeEntities(unsigned char *out,
                                         int *outlen,
                                         const unsigned char *in,
                                         int *inlen, int quoteChar);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        htmlIsScriptAttribute(const xmlChar *name);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        htmlHandleOmittedElem(int val);
 
 #ifdef LIBXML_PUSH_ENABLED
 /**
  * Interfaces for the Push mode.
  */
-XMLPUBFUN htmlParserCtxtPtr XMLCALL
+XMLPUBFUN htmlParserCtxtPtr
                        htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax,
                                                 void *user_data,
                                                 const char *chunk,
                                                 int size,
                                                 const char *filename,
                                                 xmlCharEncoding enc);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        htmlParseChunk          (htmlParserCtxtPtr ctxt,
                                                 const char *chunk,
                                                 int size,
                                                 int terminate);
 #endif /* LIBXML_PUSH_ENABLED */
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        htmlFreeParserCtxt      (htmlParserCtxtPtr ctxt);
 
 /*
@@ -188,63 +202,63 @@ typedef enum {
     HTML_PARSE_IGNORE_ENC=1<<21 /* ignore internal document encoding hint */
 } htmlParserOption;
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                htmlCtxtReset           (htmlParserCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                htmlCtxtUseOptions      (htmlParserCtxtPtr ctxt,
                                         int options);
-XMLPUBFUN htmlDocPtr XMLCALL
+XMLPUBFUN htmlDocPtr
                htmlReadDoc             (const xmlChar *cur,
                                         const char *URL,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN htmlDocPtr XMLCALL
+XMLPUBFUN htmlDocPtr
                htmlReadFile            (const char *URL,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN htmlDocPtr XMLCALL
+XMLPUBFUN htmlDocPtr
                htmlReadMemory          (const char *buffer,
                                         int size,
                                         const char *URL,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN htmlDocPtr XMLCALL
+XMLPUBFUN htmlDocPtr
                htmlReadFd              (int fd,
                                         const char *URL,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN htmlDocPtr XMLCALL
+XMLPUBFUN htmlDocPtr
                htmlReadIO              (xmlInputReadCallback ioread,
                                         xmlInputCloseCallback ioclose,
                                         void *ioctx,
                                         const char *URL,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN htmlDocPtr XMLCALL
+XMLPUBFUN htmlDocPtr
                htmlCtxtReadDoc         (xmlParserCtxtPtr ctxt,
                                         const xmlChar *cur,
                                         const char *URL,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN htmlDocPtr XMLCALL
+XMLPUBFUN htmlDocPtr
                htmlCtxtReadFile                (xmlParserCtxtPtr ctxt,
                                         const char *filename,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN htmlDocPtr XMLCALL
+XMLPUBFUN htmlDocPtr
                htmlCtxtReadMemory              (xmlParserCtxtPtr ctxt,
                                         const char *buffer,
                                         int size,
                                         const char *URL,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN htmlDocPtr XMLCALL
+XMLPUBFUN htmlDocPtr
                htmlCtxtReadFd          (xmlParserCtxtPtr ctxt,
                                         int fd,
                                         const char *URL,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN htmlDocPtr XMLCALL
+XMLPUBFUN htmlDocPtr
                htmlCtxtReadIO          (xmlParserCtxtPtr ctxt,
                                         xmlInputReadCallback ioread,
                                         xmlInputCloseCallback ioclose,
@@ -266,10 +280,10 @@ typedef enum {
 /* Using htmlElemDesc rather than name here, to emphasise the fact
    that otherwise there's a lookup overhead
 */
-XMLPUBFUN htmlStatus XMLCALL htmlAttrAllowed(const htmlElemDesc*, const xmlChar*, int) ;
-XMLPUBFUN int XMLCALL htmlElementAllowedHere(const htmlElemDesc*, const xmlChar*) ;
-XMLPUBFUN htmlStatus XMLCALL htmlElementStatusHere(const htmlElemDesc*, const htmlElemDesc*) ;
-XMLPUBFUN htmlStatus XMLCALL htmlNodeStatus(const htmlNodePtr, int) ;
+XMLPUBFUN htmlStatus htmlAttrAllowed(const htmlElemDesc*, const xmlChar*, int) ;
+XMLPUBFUN int htmlElementAllowedHere(const htmlElemDesc*, const xmlChar*) ;
+XMLPUBFUN htmlStatus htmlElementStatusHere(const htmlElemDesc*, const htmlElemDesc*) ;
+XMLPUBFUN htmlStatus htmlNodeStatus(const htmlNodePtr, int) ;
 /**
  * htmlDefaultSubelement:
  * @elt: HTML element
index c0e1103..8e1ba90 100644 (file)
@@ -59,73 +59,73 @@ extern "C" {
  */
 #define HTML_PI_NODE           XML_PI_NODE
 
-XMLPUBFUN htmlDocPtr XMLCALL
+XMLPUBFUN htmlDocPtr
                htmlNewDoc              (const xmlChar *URI,
                                         const xmlChar *ExternalID);
-XMLPUBFUN htmlDocPtr XMLCALL
+XMLPUBFUN htmlDocPtr
                htmlNewDocNoDtD         (const xmlChar *URI,
                                         const xmlChar *ExternalID);
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                htmlGetMetaEncoding     (htmlDocPtr doc);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                htmlSetMetaEncoding     (htmlDocPtr doc,
                                         const xmlChar *encoding);
 #ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                htmlDocDumpMemory       (xmlDocPtr cur,
                                         xmlChar **mem,
                                         int *size);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                htmlDocDumpMemoryFormat (xmlDocPtr cur,
                                         xmlChar **mem,
                                         int *size,
                                         int format);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                htmlDocDump             (FILE *f,
                                         xmlDocPtr cur);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                htmlSaveFile            (const char *filename,
                                         xmlDocPtr cur);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                htmlNodeDump            (xmlBufferPtr buf,
                                         xmlDocPtr doc,
                                         xmlNodePtr cur);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                htmlNodeDumpFile        (FILE *out,
                                         xmlDocPtr doc,
                                         xmlNodePtr cur);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                htmlNodeDumpFileFormat  (FILE *out,
                                         xmlDocPtr doc,
                                         xmlNodePtr cur,
                                         const char *encoding,
                                         int format);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                htmlSaveFileEnc         (const char *filename,
                                         xmlDocPtr cur,
                                         const char *encoding);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                htmlSaveFileFormat      (const char *filename,
                                         xmlDocPtr cur,
                                         const char *encoding,
                                         int format);
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf,
                                         xmlDocPtr doc,
                                         xmlNodePtr cur,
                                         const char *encoding,
                                         int format);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                htmlDocContentDumpOutput(xmlOutputBufferPtr buf,
                                         xmlDocPtr cur,
                                         const char *encoding);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf,
                                         xmlDocPtr cur,
                                         const char *encoding,
                                         int format);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                htmlNodeDumpOutput      (xmlOutputBufferPtr buf,
                                         xmlDocPtr doc,
                                         xmlNodePtr cur,
@@ -133,7 +133,7 @@ XMLPUBFUN void XMLCALL
 
 #endif /* LIBXML_OUTPUT_ENABLED */
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                htmlIsBooleanAttr       (const xmlChar *name);
 
 
index fa50568..ecd3211 100644 (file)
 extern "C" {
 #endif
 XML_DEPRECATED
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                getPublicId                     (void *ctx);
 XML_DEPRECATED
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                getSystemId                     (void *ctx);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                setDocumentLocator              (void *ctx,
                                                 xmlSAXLocatorPtr loc);
 
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                getLineNumber                   (void *ctx);
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                getColumnNumber                 (void *ctx);
 
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                isStandalone                    (void *ctx);
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                hasInternalSubset               (void *ctx);
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                hasExternalSubset               (void *ctx);
 
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                internalSubset                  (void *ctx,
                                                 const xmlChar *name,
                                                 const xmlChar *ExternalID,
                                                 const xmlChar *SystemID);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                externalSubset                  (void *ctx,
                                                 const xmlChar *name,
                                                 const xmlChar *ExternalID,
                                                 const xmlChar *SystemID);
 XML_DEPRECATED
-XMLPUBFUN xmlEntityPtr XMLCALL
+XMLPUBFUN xmlEntityPtr
                getEntity                       (void *ctx,
                                                 const xmlChar *name);
 XML_DEPRECATED
-XMLPUBFUN xmlEntityPtr XMLCALL
+XMLPUBFUN xmlEntityPtr
                getParameterEntity              (void *ctx,
                                                 const xmlChar *name);
 XML_DEPRECATED
-XMLPUBFUN xmlParserInputPtr XMLCALL
+XMLPUBFUN xmlParserInputPtr
                resolveEntity                   (void *ctx,
                                                 const xmlChar *publicId,
                                                 const xmlChar *systemId);
 
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                entityDecl                      (void *ctx,
                                                 const xmlChar *name,
                                                 int type,
@@ -85,7 +85,7 @@ XMLPUBFUN void XMLCALL
                                                 const xmlChar *systemId,
                                                 xmlChar *content);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                attributeDecl                   (void *ctx,
                                                 const xmlChar *elem,
                                                 const xmlChar *fullname,
@@ -94,19 +94,19 @@ XMLPUBFUN void XMLCALL
                                                 const xmlChar *defaultValue,
                                                 xmlEnumerationPtr tree);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                elementDecl                     (void *ctx,
                                                 const xmlChar *name,
                                                 int type,
                                                 xmlElementContentPtr content);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                notationDecl                    (void *ctx,
                                                 const xmlChar *name,
                                                 const xmlChar *publicId,
                                                 const xmlChar *systemId);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                unparsedEntityDecl              (void *ctx,
                                                 const xmlChar *name,
                                                 const xmlChar *publicId,
@@ -114,83 +114,83 @@ XMLPUBFUN void XMLCALL
                                                 const xmlChar *notationName);
 
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                startDocument                   (void *ctx);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                endDocument                     (void *ctx);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                attribute                       (void *ctx,
                                                 const xmlChar *fullname,
                                                 const xmlChar *value);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                startElement                    (void *ctx,
                                                 const xmlChar *fullname,
                                                 const xmlChar **atts);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                endElement                      (void *ctx,
                                                 const xmlChar *name);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                reference                       (void *ctx,
                                                 const xmlChar *name);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                characters                      (void *ctx,
                                                 const xmlChar *ch,
                                                 int len);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                ignorableWhitespace             (void *ctx,
                                                 const xmlChar *ch,
                                                 int len);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                processingInstruction           (void *ctx,
                                                 const xmlChar *target,
                                                 const xmlChar *data);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                globalNamespace                 (void *ctx,
                                                 const xmlChar *href,
                                                 const xmlChar *prefix);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                setNamespace                    (void *ctx,
                                                 const xmlChar *name);
 XML_DEPRECATED
-XMLPUBFUN xmlNsPtr XMLCALL
+XMLPUBFUN xmlNsPtr
                getNamespace                    (void *ctx);
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                checkNamespace                  (void *ctx,
                                                 xmlChar *nameSpace);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                namespaceDecl                   (void *ctx,
                                                 const xmlChar *href,
                                                 const xmlChar *prefix);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                comment                         (void *ctx,
                                                 const xmlChar *value);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                cdataBlock                      (void *ctx,
                                                 const xmlChar *value,
                                                 int len);
 
 #ifdef LIBXML_SAX1_ENABLED
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                initxmlDefaultSAXHandler        (xmlSAXHandlerV1 *hdlr,
                                                 int warning);
 #ifdef LIBXML_HTML_ENABLED
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                inithtmlDefaultSAXHandler       (xmlSAXHandlerV1 *hdlr);
 #endif
 #endif /* LIBXML_SAX1_ENABLED */
index 8e9b0b9..35e7a5f 100644 (file)
 #ifdef __cplusplus
 extern "C" {
 #endif
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                xmlSAX2GetPublicId              (void *ctx);
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                xmlSAX2GetSystemId              (void *ctx);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSAX2SetDocumentLocator       (void *ctx,
                                                 xmlSAXLocatorPtr loc);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSAX2GetLineNumber            (void *ctx);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSAX2GetColumnNumber          (void *ctx);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSAX2IsStandalone             (void *ctx);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSAX2HasInternalSubset        (void *ctx);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSAX2HasExternalSubset        (void *ctx);
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSAX2InternalSubset           (void *ctx,
                                                 const xmlChar *name,
                                                 const xmlChar *ExternalID,
                                                 const xmlChar *SystemID);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSAX2ExternalSubset           (void *ctx,
                                                 const xmlChar *name,
                                                 const xmlChar *ExternalID,
                                                 const xmlChar *SystemID);
-XMLPUBFUN xmlEntityPtr XMLCALL
+XMLPUBFUN xmlEntityPtr
                xmlSAX2GetEntity                (void *ctx,
                                                 const xmlChar *name);
-XMLPUBFUN xmlEntityPtr XMLCALL
+XMLPUBFUN xmlEntityPtr
                xmlSAX2GetParameterEntity       (void *ctx,
                                                 const xmlChar *name);
-XMLPUBFUN xmlParserInputPtr XMLCALL
+XMLPUBFUN xmlParserInputPtr
                xmlSAX2ResolveEntity            (void *ctx,
                                                 const xmlChar *publicId,
                                                 const xmlChar *systemId);
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSAX2EntityDecl               (void *ctx,
                                                 const xmlChar *name,
                                                 int type,
                                                 const xmlChar *publicId,
                                                 const xmlChar *systemId,
                                                 xmlChar *content);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSAX2AttributeDecl            (void *ctx,
                                                 const xmlChar *elem,
                                                 const xmlChar *fullname,
@@ -76,38 +76,38 @@ XMLPUBFUN void XMLCALL
                                                 int def,
                                                 const xmlChar *defaultValue,
                                                 xmlEnumerationPtr tree);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSAX2ElementDecl              (void *ctx,
                                                 const xmlChar *name,
                                                 int type,
                                                 xmlElementContentPtr content);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSAX2NotationDecl             (void *ctx,
                                                 const xmlChar *name,
                                                 const xmlChar *publicId,
                                                 const xmlChar *systemId);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSAX2UnparsedEntityDecl       (void *ctx,
                                                 const xmlChar *name,
                                                 const xmlChar *publicId,
                                                 const xmlChar *systemId,
                                                 const xmlChar *notationName);
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSAX2StartDocument            (void *ctx);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSAX2EndDocument              (void *ctx);
 #if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
     defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSAX2StartElement             (void *ctx,
                                                 const xmlChar *fullname,
                                                 const xmlChar **atts);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSAX2EndElement               (void *ctx,
                                                 const xmlChar *name);
 #endif /* LIBXML_SAX1_ENABLED or LIBXML_HTML_ENABLED or LIBXML_LEGACY_ENABLED */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSAX2StartElementNs           (void *ctx,
                                                 const xmlChar *localname,
                                                 const xmlChar *prefix,
@@ -117,54 +117,55 @@ XMLPUBFUN void XMLCALL
                                                 int nb_attributes,
                                                 int nb_defaulted,
                                                 const xmlChar **attributes);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSAX2EndElementNs             (void *ctx,
                                                 const xmlChar *localname,
                                                 const xmlChar *prefix,
                                                 const xmlChar *URI);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSAX2Reference                (void *ctx,
                                                 const xmlChar *name);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSAX2Characters               (void *ctx,
                                                 const xmlChar *ch,
                                                 int len);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSAX2IgnorableWhitespace      (void *ctx,
                                                 const xmlChar *ch,
                                                 int len);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSAX2ProcessingInstruction    (void *ctx,
                                                 const xmlChar *target,
                                                 const xmlChar *data);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSAX2Comment                  (void *ctx,
                                                 const xmlChar *value);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSAX2CDataBlock               (void *ctx,
                                                 const xmlChar *value,
                                                 int len);
 
 #ifdef LIBXML_SAX1_ENABLED
-XMLPUBFUN int XMLCALL
+XML_DEPRECATED
+XMLPUBFUN int
                xmlSAXDefaultVersion            (int version);
 #endif /* LIBXML_SAX1_ENABLED */
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSAXVersion                   (xmlSAXHandler *hdlr,
                                                 int version);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSAX2InitDefaultSAXHandler    (xmlSAXHandler *hdlr,
                                                 int warning);
 #ifdef LIBXML_HTML_ENABLED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                htmlDefaultSAXHandlerInit       (void);
 #endif
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlDefaultSAXHandlerInit        (void);
 #ifdef __cplusplus
 }
index af93de6..51e5419 100644 (file)
@@ -66,7 +66,7 @@ typedef enum {
     XML_C14N_1_1            = 2     /* C14N 1.1 spec */
 } xmlC14NMode;
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlC14NDocSaveTo        (xmlDocPtr doc,
                                         xmlNodeSetPtr nodes,
                                         int mode, /* a xmlC14NMode */
@@ -74,7 +74,7 @@ XMLPUBFUN int XMLCALL
                                         int with_comments,
                                         xmlOutputBufferPtr buf);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlC14NDocDumpMemory    (xmlDocPtr doc,
                                         xmlNodeSetPtr nodes,
                                         int mode, /* a xmlC14NMode */
@@ -82,7 +82,7 @@ XMLPUBFUN int XMLCALL
                                         int with_comments,
                                         xmlChar **doc_txt_ptr);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlC14NDocSave          (xmlDocPtr doc,
                                         xmlNodeSetPtr nodes,
                                         int mode, /* a xmlC14NMode */
@@ -109,7 +109,7 @@ typedef int (*xmlC14NIsVisibleCallback)     (void* user_data,
                                         xmlNodePtr node,
                                         xmlNodePtr parent);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlC14NExecute          (xmlDocPtr doc,
                                         xmlC14NIsVisibleCallback is_visible_callback,
                                         void* user_data,
index 26b178d..02fa7ab 100644 (file)
@@ -66,113 +66,113 @@ typedef xmlCatalog *xmlCatalogPtr;
 /*
  * Operations on a given catalog.
  */
-XMLPUBFUN xmlCatalogPtr XMLCALL
+XMLPUBFUN xmlCatalogPtr
                xmlNewCatalog           (int sgml);
-XMLPUBFUN xmlCatalogPtr XMLCALL
+XMLPUBFUN xmlCatalogPtr
                xmlLoadACatalog         (const char *filename);
-XMLPUBFUN xmlCatalogPtr XMLCALL
+XMLPUBFUN xmlCatalogPtr
                xmlLoadSGMLSuperCatalog (const char *filename);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlConvertSGMLCatalog   (xmlCatalogPtr catal);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlACatalogAdd          (xmlCatalogPtr catal,
                                         const xmlChar *type,
                                         const xmlChar *orig,
                                         const xmlChar *replace);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlACatalogRemove       (xmlCatalogPtr catal,
                                         const xmlChar *value);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlACatalogResolve      (xmlCatalogPtr catal,
                                         const xmlChar *pubID,
                                         const xmlChar *sysID);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlACatalogResolveSystem(xmlCatalogPtr catal,
                                         const xmlChar *sysID);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlACatalogResolvePublic(xmlCatalogPtr catal,
                                         const xmlChar *pubID);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlACatalogResolveURI   (xmlCatalogPtr catal,
                                         const xmlChar *URI);
 #ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlACatalogDump         (xmlCatalogPtr catal,
                                         FILE *out);
 #endif /* LIBXML_OUTPUT_ENABLED */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlFreeCatalog          (xmlCatalogPtr catal);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlCatalogIsEmpty       (xmlCatalogPtr catal);
 
 /*
  * Global operations.
  */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlInitializeCatalog    (void);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlLoadCatalog          (const char *filename);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlLoadCatalogs         (const char *paths);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlCatalogCleanup       (void);
 #ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlCatalogDump          (FILE *out);
 #endif /* LIBXML_OUTPUT_ENABLED */
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlCatalogResolve       (const xmlChar *pubID,
                                         const xmlChar *sysID);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlCatalogResolveSystem (const xmlChar *sysID);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlCatalogResolvePublic (const xmlChar *pubID);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlCatalogResolveURI    (const xmlChar *URI);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlCatalogAdd           (const xmlChar *type,
                                         const xmlChar *orig,
                                         const xmlChar *replace);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlCatalogRemove        (const xmlChar *value);
-XMLPUBFUN xmlDocPtr XMLCALL
+XMLPUBFUN xmlDocPtr
                xmlParseCatalogFile     (const char *filename);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlCatalogConvert       (void);
 
 /*
  * Strictly minimal interfaces for per-document catalogs used
  * by the parser.
  */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlCatalogFreeLocal     (void *catalogs);
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
                xmlCatalogAddLocal      (void *catalogs,
                                         const xmlChar *URL);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlCatalogLocalResolve  (void *catalogs,
                                         const xmlChar *pubID,
                                         const xmlChar *sysID);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlCatalogLocalResolveURI(void *catalogs,
                                         const xmlChar *URI);
 /*
  * Preference settings.
  */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlCatalogSetDebug      (int level);
-XMLPUBFUN xmlCatalogPrefer XMLCALL
+XMLPUBFUN xmlCatalogPrefer
                xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlCatalogSetDefaults   (xmlCatalogAllow allow);
-XMLPUBFUN xmlCatalogAllow XMLCALL
+XMLPUBFUN xmlCatalogAllow
                xmlCatalogGetDefaults   (void);
 
 
 /* DEPRECATED interfaces */
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                xmlCatalogGetSystem     (const xmlChar *sysID);
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                xmlCatalogGetPublic     (const xmlChar *pubID);
 
 #ifdef __cplusplus
index fb43016..8225c95 100644 (file)
@@ -51,7 +51,7 @@ struct _xmlChRangeGroup {
 /**
  * Range checking routine
  */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlCharInRange(unsigned int val, const xmlChRangeGroup *group);
 
 
@@ -207,21 +207,21 @@ XMLPUBVAR const unsigned char xmlIsPubidChar_tab[256];
 #define xmlIsPubidCharQ(c)     (((c) < 0x100) ? \
                                 xmlIsPubidChar_ch((c)) : 0)
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlIsBaseChar(unsigned int ch);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlIsBlank(unsigned int ch);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlIsChar(unsigned int ch);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlIsCombining(unsigned int ch);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlIsDigit(unsigned int ch);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlIsExtender(unsigned int ch);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlIsIdeographic(unsigned int ch);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlIsPubidChar(unsigned int ch);
 
 #ifdef __cplusplus
index 5b3be13..8274687 100644 (file)
@@ -25,39 +25,39 @@ extern "C" {
 /*
  * The standard Dump routines.
  */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlDebugDumpString      (FILE *output,
                                 const xmlChar *str);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlDebugDumpAttr        (FILE *output,
                                 xmlAttrPtr attr,
                                 int depth);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlDebugDumpAttrList    (FILE *output,
                                 xmlAttrPtr attr,
                                 int depth);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlDebugDumpOneNode     (FILE *output,
                                 xmlNodePtr node,
                                 int depth);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlDebugDumpNode        (FILE *output,
                                 xmlNodePtr node,
                                 int depth);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlDebugDumpNodeList    (FILE *output,
                                 xmlNodePtr node,
                                 int depth);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlDebugDumpDocumentHead(FILE *output,
                                 xmlDocPtr doc);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlDebugDumpDocument    (FILE *output,
                                 xmlDocPtr doc);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlDebugDumpDTD         (FILE *output,
                                 xmlDtdPtr dtd);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlDebugDumpEntities    (FILE *output,
                                 xmlDocPtr doc);
 
@@ -67,7 +67,7 @@ XMLPUBFUN void XMLCALL
  *                                                             *
  ****************************************************************/
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlDebugCheckDocument   (FILE * output,
                                 xmlDocPtr doc);
 
@@ -77,12 +77,12 @@ XMLPUBFUN int XMLCALL
  *                                                             *
  ****************************************************************/
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlLsOneNode            (FILE *output, xmlNodePtr node);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlLsCountNode          (xmlNodePtr node);
 
-XMLPUBFUN const char * XMLCALL
+XMLPUBFUN const char *
        xmlBoolToText           (int boolval);
 
 /****************************************************************
@@ -136,63 +136,63 @@ typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt,
                             xmlNodePtr node,
                             xmlNodePtr node2);
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlShellPrintXPathError (int errorType,
                                 const char *arg);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlShellPrintXPathResult(xmlXPathObjectPtr list);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlShellList            (xmlShellCtxtPtr ctxt,
                                 char *arg,
                                 xmlNodePtr node,
                                 xmlNodePtr node2);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlShellBase            (xmlShellCtxtPtr ctxt,
                                 char *arg,
                                 xmlNodePtr node,
                                 xmlNodePtr node2);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlShellDir             (xmlShellCtxtPtr ctxt,
                                 char *arg,
                                 xmlNodePtr node,
                                 xmlNodePtr node2);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlShellLoad            (xmlShellCtxtPtr ctxt,
                                 char *filename,
                                 xmlNodePtr node,
                                 xmlNodePtr node2);
 #ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlShellPrintNode       (xmlNodePtr node);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlShellCat             (xmlShellCtxtPtr ctxt,
                                 char *arg,
                                 xmlNodePtr node,
                                 xmlNodePtr node2);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlShellWrite           (xmlShellCtxtPtr ctxt,
                                 char *filename,
                                 xmlNodePtr node,
                                 xmlNodePtr node2);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlShellSave            (xmlShellCtxtPtr ctxt,
                                 char *filename,
                                 xmlNodePtr node,
                                 xmlNodePtr node2);
 #endif /* LIBXML_OUTPUT_ENABLED */
 #ifdef LIBXML_VALID_ENABLED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlShellValidate        (xmlShellCtxtPtr ctxt,
                                 char *dtd,
                                 xmlNodePtr node,
                                 xmlNodePtr node2);
 #endif /* LIBXML_VALID_ENABLED */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlShellDu              (xmlShellCtxtPtr ctxt,
                                 char *arg,
                                 xmlNodePtr tree,
                                 xmlNodePtr node2);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlShellPwd             (xmlShellCtxtPtr ctxt,
                                 char *buffer,
                                 xmlNodePtr node,
@@ -201,7 +201,7 @@ XMLPUBFUN int XMLCALL
 /*
  * The Shell interface.
  */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlShell                (xmlDocPtr doc,
                                 char *filename,
                                 xmlShellReadlineFunc input,
index 91f74d1..eb8f85d 100644 (file)
@@ -28,51 +28,51 @@ typedef xmlDict *xmlDictPtr;
  * Initializer
  */
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL  xmlInitializeDict(void);
+XMLPUBFUN int  xmlInitializeDict(void);
 
 /*
  * Constructor and destructor.
  */
-XMLPUBFUN xmlDictPtr XMLCALL
+XMLPUBFUN xmlDictPtr
                        xmlDictCreate   (void);
-XMLPUBFUN size_t XMLCALL
+XMLPUBFUN size_t
                        xmlDictSetLimit (xmlDictPtr dict,
                                          size_t limit);
-XMLPUBFUN size_t XMLCALL
+XMLPUBFUN size_t
                        xmlDictGetUsage (xmlDictPtr dict);
-XMLPUBFUN xmlDictPtr XMLCALL
+XMLPUBFUN xmlDictPtr
                        xmlDictCreateSub(xmlDictPtr sub);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlDictReference(xmlDictPtr dict);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlDictFree     (xmlDictPtr dict);
 
 /*
  * Lookup of entry in the dictionary.
  */
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                        xmlDictLookup   (xmlDictPtr dict,
                                         const xmlChar *name,
                                         int len);
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                        xmlDictExists   (xmlDictPtr dict,
                                         const xmlChar *name,
                                         int len);
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                        xmlDictQLookup  (xmlDictPtr dict,
                                         const xmlChar *prefix,
                                         const xmlChar *name);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlDictOwns     (xmlDictPtr dict,
                                         const xmlChar *str);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlDictSize     (xmlDictPtr dict);
 
 /*
  * Cleanup function
  */
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                         xmlDictCleanup  (void);
 
 #ifdef __cplusplus
index 381e188..67add3b 100644 (file)
@@ -154,18 +154,18 @@ extern "C" {
  * Interfaces for encoding handlers.
  */
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlInitCharEncodingHandlers     (void);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlCleanupCharEncodingHandlers  (void);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlRegisterCharEncodingHandler  (xmlCharEncodingHandlerPtr handler);
-XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
+XMLPUBFUN xmlCharEncodingHandlerPtr
        xmlGetCharEncodingHandler       (xmlCharEncoding enc);
-XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
+XMLPUBFUN xmlCharEncodingHandlerPtr
        xmlFindCharEncodingHandler      (const char *name);
-XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
+XMLPUBFUN xmlCharEncodingHandlerPtr
        xmlNewCharEncodingHandler       (const char *name,
                                         xmlCharEncodingInputFunc input,
                                         xmlCharEncodingOutputFunc output);
@@ -173,54 +173,55 @@ XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
 /*
  * Interfaces for encoding names and aliases.
  */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlAddEncodingAlias             (const char *name,
                                         const char *alias);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlDelEncodingAlias             (const char *alias);
-XMLPUBFUN const char * XMLCALL
+XMLPUBFUN const char *
        xmlGetEncodingAlias             (const char *alias);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlCleanupEncodingAliases       (void);
-XMLPUBFUN xmlCharEncoding XMLCALL
+XMLPUBFUN xmlCharEncoding
        xmlParseCharEncoding            (const char *name);
-XMLPUBFUN const char * XMLCALL
+XMLPUBFUN const char *
        xmlGetCharEncodingName          (xmlCharEncoding enc);
 
 /*
  * Interfaces directly used by the parsers.
  */
-XMLPUBFUN xmlCharEncoding XMLCALL
+XMLPUBFUN xmlCharEncoding
        xmlDetectCharEncoding           (const unsigned char *in,
                                         int len);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlCharEncOutFunc               (xmlCharEncodingHandler *handler,
                                         xmlBufferPtr out,
                                         xmlBufferPtr in);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlCharEncInFunc                (xmlCharEncodingHandler *handler,
                                         xmlBufferPtr out,
                                         xmlBufferPtr in);
-XMLPUBFUN int XMLCALL
+XML_DEPRECATED
+XMLPUBFUN int
        xmlCharEncFirstLine             (xmlCharEncodingHandler *handler,
                                         xmlBufferPtr out,
                                         xmlBufferPtr in);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlCharEncCloseFunc             (xmlCharEncodingHandler *handler);
 
 /*
  * Export a few useful functions
  */
 #ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        UTF8Toisolat1                   (unsigned char *out,
                                         int *outlen,
                                         const unsigned char *in,
                                         int *inlen);
 #endif /* LIBXML_OUTPUT_ENABLED */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        isolat1ToUTF8                   (unsigned char *out,
                                         int *outlen,
                                         const unsigned char *in,
index 2b60d9e..2c69514 100644 (file)
@@ -56,10 +56,8 @@ struct _xmlEntity {
     struct _xmlEntity     *nexte;      /* unused */
     const xmlChar           *URI;      /* the full URI as computed */
     int                    owner;      /* does the entity own the childrens */
-    int                         checked;       /* was the entity content checked */
-                                       /* this is also used to count entities
-                                        * references done from that entity
-                                        * and if it contains '<' */
+    int                    flags;       /* various flags */
+    unsigned long   expandedSize;       /* expanded size */
 };
 
 /*
@@ -76,72 +74,72 @@ typedef xmlEntitiesTable *xmlEntitiesTablePtr;
 
 #ifdef LIBXML_LEGACY_ENABLED
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlInitializePredefinedEntities (void);
 #endif /* LIBXML_LEGACY_ENABLED */
 
-XMLPUBFUN xmlEntityPtr XMLCALL
+XMLPUBFUN xmlEntityPtr
                        xmlNewEntity            (xmlDocPtr doc,
                                                 const xmlChar *name,
                                                 int type,
                                                 const xmlChar *ExternalID,
                                                 const xmlChar *SystemID,
                                                 const xmlChar *content);
-XMLPUBFUN xmlEntityPtr XMLCALL
+XMLPUBFUN xmlEntityPtr
                        xmlAddDocEntity         (xmlDocPtr doc,
                                                 const xmlChar *name,
                                                 int type,
                                                 const xmlChar *ExternalID,
                                                 const xmlChar *SystemID,
                                                 const xmlChar *content);
-XMLPUBFUN xmlEntityPtr XMLCALL
+XMLPUBFUN xmlEntityPtr
                        xmlAddDtdEntity         (xmlDocPtr doc,
                                                 const xmlChar *name,
                                                 int type,
                                                 const xmlChar *ExternalID,
                                                 const xmlChar *SystemID,
                                                 const xmlChar *content);
-XMLPUBFUN xmlEntityPtr XMLCALL
+XMLPUBFUN xmlEntityPtr
                        xmlGetPredefinedEntity  (const xmlChar *name);
-XMLPUBFUN xmlEntityPtr XMLCALL
+XMLPUBFUN xmlEntityPtr
                        xmlGetDocEntity         (const xmlDoc *doc,
                                                 const xmlChar *name);
-XMLPUBFUN xmlEntityPtr XMLCALL
+XMLPUBFUN xmlEntityPtr
                        xmlGetDtdEntity         (xmlDocPtr doc,
                                                 const xmlChar *name);
-XMLPUBFUN xmlEntityPtr XMLCALL
+XMLPUBFUN xmlEntityPtr
                        xmlGetParameterEntity   (xmlDocPtr doc,
                                                 const xmlChar *name);
 #ifdef LIBXML_LEGACY_ENABLED
 XML_DEPRECATED
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                        xmlEncodeEntities       (xmlDocPtr doc,
                                                 const xmlChar *input);
 #endif /* LIBXML_LEGACY_ENABLED */
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                        xmlEncodeEntitiesReentrant(xmlDocPtr doc,
                                                 const xmlChar *input);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                        xmlEncodeSpecialChars   (const xmlDoc *doc,
                                                 const xmlChar *input);
-XMLPUBFUN xmlEntitiesTablePtr XMLCALL
+XMLPUBFUN xmlEntitiesTablePtr
                        xmlCreateEntitiesTable  (void);
 #ifdef LIBXML_TREE_ENABLED
-XMLPUBFUN xmlEntitiesTablePtr XMLCALL
+XMLPUBFUN xmlEntitiesTablePtr
                        xmlCopyEntitiesTable    (xmlEntitiesTablePtr table);
 #endif /* LIBXML_TREE_ENABLED */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlFreeEntitiesTable    (xmlEntitiesTablePtr table);
 #ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlDumpEntitiesTable    (xmlBufferPtr buf,
                                                 xmlEntitiesTablePtr table);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlDumpEntityDecl       (xmlBufferPtr buf,
                                                 xmlEntityPtr ent);
 #endif /* LIBXML_OUTPUT_ENABLED */
 #ifdef LIBXML_LEGACY_ENABLED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlCleanupPredefinedEntities(void);
 #endif /* LIBXML_LEGACY_ENABLED */
 
index d57ccb0..5969729 100644 (file)
@@ -25,9 +25,9 @@ extern "C" {
 #endif
 
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL xmlInitGlobals(void);
+XMLPUBFUN void xmlInitGlobals(void);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL xmlCleanupGlobals(void);
+XMLPUBFUN void xmlCleanupGlobals(void);
 
 /**
  * xmlParserInputBufferCreateFilenameFunc:
@@ -60,9 +60,9 @@ typedef xmlOutputBufferPtr (*xmlOutputBufferCreateFilenameFunc) (const char *URI
                                                                 int compression);
 
 XMLPUBFUN xmlParserInputBufferCreateFilenameFunc
-XMLCALL xmlParserInputBufferCreateFilenameDefault (xmlParserInputBufferCreateFilenameFunc func);
+xmlParserInputBufferCreateFilenameDefault (xmlParserInputBufferCreateFilenameFunc func);
 XMLPUBFUN xmlOutputBufferCreateFilenameFunc
-XMLCALL xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc func);
+xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc func);
 
 /*
  * Externally global symbols which need to be protected for backwards
@@ -175,24 +175,23 @@ struct _xmlGlobalState
 extern "C" {
 #endif
 
-XMLPUBFUN void XMLCALL xmlInitializeGlobalState(xmlGlobalStatePtr gs);
+XMLPUBFUN void xmlInitializeGlobalState(xmlGlobalStatePtr gs);
 
-XMLPUBFUN void XMLCALL xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler);
+XMLPUBFUN void xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler);
 
-XMLPUBFUN void XMLCALL xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler);
+XMLPUBFUN void xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler);
 
-XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlRegisterNodeDefault(xmlRegisterNodeFunc func);
-XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func);
-XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func);
-XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func);
+XMLPUBFUN xmlRegisterNodeFunc xmlRegisterNodeDefault(xmlRegisterNodeFunc func);
+XMLPUBFUN xmlRegisterNodeFunc xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func);
+XMLPUBFUN xmlDeregisterNodeFunc xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func);
+XMLPUBFUN xmlDeregisterNodeFunc xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func);
 
-XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL
+XMLPUBFUN xmlOutputBufferCreateFilenameFunc
        xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func);
-XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL
+XMLPUBFUN xmlParserInputBufferCreateFilenameFunc
        xmlThrDefParserInputBufferCreateFilenameDefault(
                                xmlParserInputBufferCreateFilenameFunc func);
 
-/** DOC_DISABLE */
 /*
  * In general the memory allocation entry points are not kept
  * thread specific but this can be overridden by LIBXML_THREAD_ALLOC_ENABLED
@@ -204,8 +203,10 @@ XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL
  */
 
 #ifdef LIBXML_THREAD_ALLOC_ENABLED
+/** DOC_DISABLE */
+
 #ifdef LIBXML_THREAD_ENABLED
-XMLPUBFUN  xmlMallocFunc * XMLCALL __xmlMalloc(void);
+XMLPUBFUN  xmlMallocFunc * __xmlMalloc(void);
 #define xmlMalloc \
 (*(__xmlMalloc()))
 #else
@@ -213,7 +214,7 @@ XMLPUBVAR xmlMallocFunc xmlMalloc;
 #endif
 
 #ifdef LIBXML_THREAD_ENABLED
-XMLPUBFUN  xmlMallocFunc * XMLCALL __xmlMallocAtomic(void);
+XMLPUBFUN  xmlMallocFunc * __xmlMallocAtomic(void);
 #define xmlMallocAtomic \
 (*(__xmlMallocAtomic()))
 #else
@@ -221,7 +222,7 @@ XMLPUBVAR xmlMallocFunc xmlMallocAtomic;
 #endif
 
 #ifdef LIBXML_THREAD_ENABLED
-XMLPUBFUN  xmlReallocFunc * XMLCALL __xmlRealloc(void);
+XMLPUBFUN  xmlReallocFunc * __xmlRealloc(void);
 #define xmlRealloc \
 (*(__xmlRealloc()))
 #else
@@ -229,7 +230,7 @@ XMLPUBVAR xmlReallocFunc xmlRealloc;
 #endif
 
 #ifdef LIBXML_THREAD_ENABLED
-XMLPUBFUN  xmlFreeFunc * XMLCALL __xmlFree(void);
+XMLPUBFUN  xmlFreeFunc * __xmlFree(void);
 #define xmlFree \
 (*(__xmlFree()))
 #else
@@ -237,13 +238,14 @@ XMLPUBVAR xmlFreeFunc xmlFree;
 #endif
 
 #ifdef LIBXML_THREAD_ENABLED
-XMLPUBFUN  xmlStrdupFunc * XMLCALL __xmlMemStrdup(void);
+XMLPUBFUN  xmlStrdupFunc * __xmlMemStrdup(void);
 #define xmlMemStrdup \
 (*(__xmlMemStrdup()))
 #else
 XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
 #endif
 
+/** DOC_ENABLE */
 #else /* !LIBXML_THREAD_ALLOC_ENABLED */
 XMLPUBVAR xmlMallocFunc xmlMalloc;
 XMLPUBVAR xmlMallocFunc xmlMallocAtomic;
@@ -253,16 +255,18 @@ XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
 #endif /* LIBXML_THREAD_ALLOC_ENABLED */
 
 #ifdef LIBXML_HTML_ENABLED
-XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __htmlDefaultSAXHandler(void);
+XML_DEPRECATED
+XMLPUBFUN xmlSAXHandlerV1 * __htmlDefaultSAXHandler(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define htmlDefaultSAXHandler \
 (*(__htmlDefaultSAXHandler()))
 #else
+XML_DEPRECATED
 XMLPUBVAR xmlSAXHandlerV1 htmlDefaultSAXHandler;
 #endif
 #endif
 
-XMLPUBFUN xmlError * XMLCALL __xmlLastError(void);
+XMLPUBFUN xmlError * __xmlLastError(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlLastError \
 (*(__xmlLastError()))
@@ -277,59 +281,71 @@ XMLPUBVAR xmlError xmlLastError;
  */
 
 
-XMLPUBFUN int * XMLCALL __oldXMLWDcompatibility(void);
+XML_DEPRECATED
+XMLPUBFUN int * __oldXMLWDcompatibility(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define oldXMLWDcompatibility \
 (*(__oldXMLWDcompatibility()))
 #else
+XML_DEPRECATED
 XMLPUBVAR int oldXMLWDcompatibility;
 #endif
 
-XMLPUBFUN xmlBufferAllocationScheme * XMLCALL __xmlBufferAllocScheme(void);
+XML_DEPRECATED
+XMLPUBFUN xmlBufferAllocationScheme * __xmlBufferAllocScheme(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlBufferAllocScheme \
 (*(__xmlBufferAllocScheme()))
 #else
+XML_DEPRECATED
 XMLPUBVAR xmlBufferAllocationScheme xmlBufferAllocScheme;
 #endif
-XMLPUBFUN xmlBufferAllocationScheme XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlBufferAllocationScheme
        xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v);
 
-XMLPUBFUN int * XMLCALL __xmlDefaultBufferSize(void);
+XML_DEPRECATED
+XMLPUBFUN int * __xmlDefaultBufferSize(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlDefaultBufferSize \
 (*(__xmlDefaultBufferSize()))
 #else
+XML_DEPRECATED
 XMLPUBVAR int xmlDefaultBufferSize;
 #endif
-XMLPUBFUN int XMLCALL xmlThrDefDefaultBufferSize(int v);
+XML_DEPRECATED
+XMLPUBFUN int xmlThrDefDefaultBufferSize(int v);
 
-XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __xmlDefaultSAXHandler(void);
+XML_DEPRECATED
+XMLPUBFUN xmlSAXHandlerV1 * __xmlDefaultSAXHandler(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlDefaultSAXHandler \
 (*(__xmlDefaultSAXHandler()))
 #else
+XML_DEPRECATED
 XMLPUBVAR xmlSAXHandlerV1 xmlDefaultSAXHandler;
 #endif
 
-XMLPUBFUN xmlSAXLocator * XMLCALL __xmlDefaultSAXLocator(void);
+XML_DEPRECATED
+XMLPUBFUN xmlSAXLocator * __xmlDefaultSAXLocator(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlDefaultSAXLocator \
 (*(__xmlDefaultSAXLocator()))
 #else
+XML_DEPRECATED
 XMLPUBVAR xmlSAXLocator xmlDefaultSAXLocator;
 #endif
 
-XMLPUBFUN int * XMLCALL __xmlDoValidityCheckingDefaultValue(void);
+XMLPUBFUN int * __xmlDoValidityCheckingDefaultValue(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlDoValidityCheckingDefaultValue \
 (*(__xmlDoValidityCheckingDefaultValue()))
 #else
 XMLPUBVAR int xmlDoValidityCheckingDefaultValue;
 #endif
-XMLPUBFUN int XMLCALL xmlThrDefDoValidityCheckingDefaultValue(int v);
+XMLPUBFUN int xmlThrDefDoValidityCheckingDefaultValue(int v);
 
-XMLPUBFUN xmlGenericErrorFunc * XMLCALL __xmlGenericError(void);
+XMLPUBFUN xmlGenericErrorFunc * __xmlGenericError(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlGenericError \
 (*(__xmlGenericError()))
@@ -337,7 +353,7 @@ XMLPUBFUN xmlGenericErrorFunc * XMLCALL __xmlGenericError(void);
 XMLPUBVAR xmlGenericErrorFunc xmlGenericError;
 #endif
 
-XMLPUBFUN xmlStructuredErrorFunc * XMLCALL __xmlStructuredError(void);
+XMLPUBFUN xmlStructuredErrorFunc * __xmlStructuredError(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlStructuredError \
 (*(__xmlStructuredError()))
@@ -345,7 +361,7 @@ XMLPUBFUN xmlStructuredErrorFunc * XMLCALL __xmlStructuredError(void);
 XMLPUBVAR xmlStructuredErrorFunc xmlStructuredError;
 #endif
 
-XMLPUBFUN void * * XMLCALL __xmlGenericErrorContext(void);
+XMLPUBFUN void * * __xmlGenericErrorContext(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlGenericErrorContext \
 (*(__xmlGenericErrorContext()))
@@ -353,7 +369,7 @@ XMLPUBFUN void * * XMLCALL __xmlGenericErrorContext(void);
 XMLPUBVAR void * xmlGenericErrorContext;
 #endif
 
-XMLPUBFUN void * * XMLCALL __xmlStructuredErrorContext(void);
+XMLPUBFUN void * * __xmlStructuredErrorContext(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlStructuredErrorContext \
 (*(__xmlStructuredErrorContext()))
@@ -361,70 +377,73 @@ XMLPUBFUN void * * XMLCALL __xmlStructuredErrorContext(void);
 XMLPUBVAR void * xmlStructuredErrorContext;
 #endif
 
-XMLPUBFUN int * XMLCALL __xmlGetWarningsDefaultValue(void);
+XMLPUBFUN int * __xmlGetWarningsDefaultValue(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlGetWarningsDefaultValue \
 (*(__xmlGetWarningsDefaultValue()))
 #else
 XMLPUBVAR int xmlGetWarningsDefaultValue;
 #endif
-XMLPUBFUN int XMLCALL xmlThrDefGetWarningsDefaultValue(int v);
+XMLPUBFUN int xmlThrDefGetWarningsDefaultValue(int v);
 
-XMLPUBFUN int * XMLCALL __xmlIndentTreeOutput(void);
+XMLPUBFUN int * __xmlIndentTreeOutput(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlIndentTreeOutput \
 (*(__xmlIndentTreeOutput()))
 #else
 XMLPUBVAR int xmlIndentTreeOutput;
 #endif
-XMLPUBFUN int XMLCALL xmlThrDefIndentTreeOutput(int v);
+XMLPUBFUN int xmlThrDefIndentTreeOutput(int v);
 
-XMLPUBFUN const char * * XMLCALL __xmlTreeIndentString(void);
+XMLPUBFUN const char * * __xmlTreeIndentString(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlTreeIndentString \
 (*(__xmlTreeIndentString()))
 #else
 XMLPUBVAR const char * xmlTreeIndentString;
 #endif
-XMLPUBFUN const char * XMLCALL xmlThrDefTreeIndentString(const char * v);
+XMLPUBFUN const char * xmlThrDefTreeIndentString(const char * v);
 
-XMLPUBFUN int * XMLCALL __xmlKeepBlanksDefaultValue(void);
+XMLPUBFUN int * __xmlKeepBlanksDefaultValue(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlKeepBlanksDefaultValue \
 (*(__xmlKeepBlanksDefaultValue()))
 #else
 XMLPUBVAR int xmlKeepBlanksDefaultValue;
 #endif
-XMLPUBFUN int XMLCALL xmlThrDefKeepBlanksDefaultValue(int v);
+XMLPUBFUN int xmlThrDefKeepBlanksDefaultValue(int v);
 
-XMLPUBFUN int * XMLCALL __xmlLineNumbersDefaultValue(void);
+XML_DEPRECATED
+XMLPUBFUN int * __xmlLineNumbersDefaultValue(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlLineNumbersDefaultValue \
 (*(__xmlLineNumbersDefaultValue()))
 #else
+XML_DEPRECATED
 XMLPUBVAR int xmlLineNumbersDefaultValue;
 #endif
-XMLPUBFUN int XMLCALL xmlThrDefLineNumbersDefaultValue(int v);
+XML_DEPRECATED
+XMLPUBFUN int xmlThrDefLineNumbersDefaultValue(int v);
 
-XMLPUBFUN int * XMLCALL __xmlLoadExtDtdDefaultValue(void);
+XMLPUBFUN int * __xmlLoadExtDtdDefaultValue(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlLoadExtDtdDefaultValue \
 (*(__xmlLoadExtDtdDefaultValue()))
 #else
 XMLPUBVAR int xmlLoadExtDtdDefaultValue;
 #endif
-XMLPUBFUN int XMLCALL xmlThrDefLoadExtDtdDefaultValue(int v);
+XMLPUBFUN int xmlThrDefLoadExtDtdDefaultValue(int v);
 
-XMLPUBFUN int * XMLCALL __xmlParserDebugEntities(void);
+XMLPUBFUN int * __xmlParserDebugEntities(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlParserDebugEntities \
 (*(__xmlParserDebugEntities()))
 #else
 XMLPUBVAR int xmlParserDebugEntities;
 #endif
-XMLPUBFUN int XMLCALL xmlThrDefParserDebugEntities(int v);
+XMLPUBFUN int xmlThrDefParserDebugEntities(int v);
 
-XMLPUBFUN const char * * XMLCALL __xmlParserVersion(void);
+XMLPUBFUN const char * * __xmlParserVersion(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlParserVersion \
 (*(__xmlParserVersion()))
@@ -432,63 +451,74 @@ XMLPUBFUN const char * * XMLCALL __xmlParserVersion(void);
 XMLPUBVAR const char * xmlParserVersion;
 #endif
 
-XMLPUBFUN int * XMLCALL __xmlPedanticParserDefaultValue(void);
+XML_DEPRECATED
+XMLPUBFUN int * __xmlPedanticParserDefaultValue(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlPedanticParserDefaultValue \
 (*(__xmlPedanticParserDefaultValue()))
 #else
+XML_DEPRECATED
 XMLPUBVAR int xmlPedanticParserDefaultValue;
 #endif
-XMLPUBFUN int XMLCALL xmlThrDefPedanticParserDefaultValue(int v);
+XML_DEPRECATED
+XMLPUBFUN int xmlThrDefPedanticParserDefaultValue(int v);
 
-XMLPUBFUN int * XMLCALL __xmlSaveNoEmptyTags(void);
+XMLPUBFUN int * __xmlSaveNoEmptyTags(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlSaveNoEmptyTags \
 (*(__xmlSaveNoEmptyTags()))
 #else
 XMLPUBVAR int xmlSaveNoEmptyTags;
 #endif
-XMLPUBFUN int XMLCALL xmlThrDefSaveNoEmptyTags(int v);
+XMLPUBFUN int xmlThrDefSaveNoEmptyTags(int v);
 
-XMLPUBFUN int * XMLCALL __xmlSubstituteEntitiesDefaultValue(void);
+XMLPUBFUN int * __xmlSubstituteEntitiesDefaultValue(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlSubstituteEntitiesDefaultValue \
 (*(__xmlSubstituteEntitiesDefaultValue()))
 #else
 XMLPUBVAR int xmlSubstituteEntitiesDefaultValue;
 #endif
-XMLPUBFUN int XMLCALL xmlThrDefSubstituteEntitiesDefaultValue(int v);
+XMLPUBFUN int xmlThrDefSubstituteEntitiesDefaultValue(int v);
 
-XMLPUBFUN xmlRegisterNodeFunc * XMLCALL __xmlRegisterNodeDefaultValue(void);
+XML_DEPRECATED
+XMLPUBFUN xmlRegisterNodeFunc * __xmlRegisterNodeDefaultValue(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlRegisterNodeDefaultValue \
 (*(__xmlRegisterNodeDefaultValue()))
 #else
+XML_DEPRECATED
 XMLPUBVAR xmlRegisterNodeFunc xmlRegisterNodeDefaultValue;
 #endif
 
-XMLPUBFUN xmlDeregisterNodeFunc * XMLCALL __xmlDeregisterNodeDefaultValue(void);
+XML_DEPRECATED
+XMLPUBFUN xmlDeregisterNodeFunc * __xmlDeregisterNodeDefaultValue(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlDeregisterNodeDefaultValue \
 (*(__xmlDeregisterNodeDefaultValue()))
 #else
+XML_DEPRECATED
 XMLPUBVAR xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue;
 #endif
 
-XMLPUBFUN xmlParserInputBufferCreateFilenameFunc * XMLCALL \
+XML_DEPRECATED
+XMLPUBFUN xmlParserInputBufferCreateFilenameFunc * \
                                __xmlParserInputBufferCreateFilenameValue(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlParserInputBufferCreateFilenameValue \
 (*(__xmlParserInputBufferCreateFilenameValue()))
 #else
+XML_DEPRECATED
 XMLPUBVAR xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue;
 #endif
 
-XMLPUBFUN xmlOutputBufferCreateFilenameFunc * XMLCALL __xmlOutputBufferCreateFilenameValue(void);
+XML_DEPRECATED
+XMLPUBFUN xmlOutputBufferCreateFilenameFunc * __xmlOutputBufferCreateFilenameValue(void);
 #ifdef LIBXML_THREAD_ENABLED
 #define xmlOutputBufferCreateFilenameValue \
 (*(__xmlOutputBufferCreateFilenameValue()))
 #else
+XML_DEPRECATED
 XMLPUBVAR xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue;
 #endif
 
index b682b6b..1dac035 100644 (file)
@@ -103,48 +103,48 @@ typedef void (*xmlHashScannerFull)(void *payload, void *data,
 /*
  * Constructor and destructor.
  */
-XMLPUBFUN xmlHashTablePtr XMLCALL
+XMLPUBFUN xmlHashTablePtr
                        xmlHashCreate   (int size);
-XMLPUBFUN xmlHashTablePtr XMLCALL
+XMLPUBFUN xmlHashTablePtr
                        xmlHashCreateDict(int size,
                                         xmlDictPtr dict);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlHashFree     (xmlHashTablePtr table,
                                         xmlHashDeallocator f);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlHashDefaultDeallocator(void *entry,
                                         const xmlChar *name);
 
 /*
  * Add a new entry to the hash table.
  */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlHashAddEntry (xmlHashTablePtr table,
                                         const xmlChar *name,
                                         void *userdata);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlHashUpdateEntry(xmlHashTablePtr table,
                                         const xmlChar *name,
                                         void *userdata,
                                         xmlHashDeallocator f);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlHashAddEntry2(xmlHashTablePtr table,
                                         const xmlChar *name,
                                         const xmlChar *name2,
                                         void *userdata);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlHashUpdateEntry2(xmlHashTablePtr table,
                                         const xmlChar *name,
                                         const xmlChar *name2,
                                         void *userdata,
                                         xmlHashDeallocator f);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlHashAddEntry3(xmlHashTablePtr table,
                                         const xmlChar *name,
                                         const xmlChar *name2,
                                         const xmlChar *name3,
                                         void *userdata);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlHashUpdateEntry3(xmlHashTablePtr table,
                                         const xmlChar *name,
                                         const xmlChar *name2,
@@ -155,13 +155,13 @@ XMLPUBFUN int XMLCALL
 /*
  * Remove an entry from the hash table.
  */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name,
                            xmlHashDeallocator f);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name,
                             const xmlChar *name2, xmlHashDeallocator f);
-XMLPUBFUN int  XMLCALL
+XMLPUBFUN int 
                        xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name,
                             const xmlChar *name2, const xmlChar *name3,
                             xmlHashDeallocator f);
@@ -169,29 +169,29 @@ XMLPUBFUN int  XMLCALL
 /*
  * Retrieve the userdata.
  */
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
                        xmlHashLookup   (xmlHashTablePtr table,
                                         const xmlChar *name);
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
                        xmlHashLookup2  (xmlHashTablePtr table,
                                         const xmlChar *name,
                                         const xmlChar *name2);
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
                        xmlHashLookup3  (xmlHashTablePtr table,
                                         const xmlChar *name,
                                         const xmlChar *name2,
                                         const xmlChar *name3);
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
                        xmlHashQLookup  (xmlHashTablePtr table,
                                         const xmlChar *name,
                                         const xmlChar *prefix);
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
                        xmlHashQLookup2 (xmlHashTablePtr table,
                                         const xmlChar *name,
                                         const xmlChar *prefix,
                                         const xmlChar *name2,
                                         const xmlChar *prefix2);
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
                        xmlHashQLookup3 (xmlHashTablePtr table,
                                         const xmlChar *name,
                                         const xmlChar *prefix,
@@ -203,27 +203,27 @@ XMLPUBFUN void * XMLCALL
 /*
  * Helpers.
  */
-XMLPUBFUN xmlHashTablePtr XMLCALL
+XMLPUBFUN xmlHashTablePtr
                        xmlHashCopy     (xmlHashTablePtr table,
                                         xmlHashCopier f);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlHashSize     (xmlHashTablePtr table);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlHashScan     (xmlHashTablePtr table,
                                         xmlHashScanner f,
                                         void *data);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlHashScan3    (xmlHashTablePtr table,
                                         const xmlChar *name,
                                         const xmlChar *name2,
                                         const xmlChar *name3,
                                         xmlHashScanner f,
                                         void *data);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlHashScanFull (xmlHashTablePtr table,
                                         xmlHashScannerFull f,
                                         void *data);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlHashScanFull3(xmlHashTablePtr table,
                                         const xmlChar *name,
                                         const xmlChar *name2,
index 3211c75..5eab8f5 100644 (file)
@@ -52,79 +52,79 @@ typedef int  (*xmlListDataCompare) (const void *data0, const void *data1);
 typedef int (*xmlListWalker) (const void *data, void *user);
 
 /* Creation/Deletion */
-XMLPUBFUN xmlListPtr XMLCALL
+XMLPUBFUN xmlListPtr
                xmlListCreate           (xmlListDeallocator deallocator,
                                         xmlListDataCompare compare);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlListDelete           (xmlListPtr l);
 
 /* Basic Operators */
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
                xmlListSearch           (xmlListPtr l,
                                         void *data);
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
                xmlListReverseSearch    (xmlListPtr l,
                                         void *data);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlListInsert           (xmlListPtr l,
                                         void *data) ;
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlListAppend           (xmlListPtr l,
                                         void *data) ;
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlListRemoveFirst      (xmlListPtr l,
                                         void *data);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlListRemoveLast       (xmlListPtr l,
                                         void *data);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlListRemoveAll        (xmlListPtr l,
                                         void *data);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlListClear            (xmlListPtr l);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlListEmpty            (xmlListPtr l);
-XMLPUBFUN xmlLinkPtr XMLCALL
+XMLPUBFUN xmlLinkPtr
                xmlListFront            (xmlListPtr l);
-XMLPUBFUN xmlLinkPtr XMLCALL
+XMLPUBFUN xmlLinkPtr
                xmlListEnd              (xmlListPtr l);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlListSize             (xmlListPtr l);
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlListPopFront         (xmlListPtr l);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlListPopBack          (xmlListPtr l);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlListPushFront        (xmlListPtr l,
                                         void *data);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlListPushBack         (xmlListPtr l,
                                         void *data);
 
 /* Advanced Operators */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlListReverse          (xmlListPtr l);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlListSort             (xmlListPtr l);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlListWalk             (xmlListPtr l,
                                         xmlListWalker walker,
                                         void *user);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlListReverseWalk      (xmlListPtr l,
                                         xmlListWalker walker,
                                         void *user);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlListMerge            (xmlListPtr l1,
                                         xmlListPtr l2);
-XMLPUBFUN xmlListPtr XMLCALL
+XMLPUBFUN xmlListPtr
                xmlListDup              (const xmlListPtr old);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlListCopy             (xmlListPtr cur,
                                         const xmlListPtr old);
 /* Link operators */
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
                xmlLinkGetData          (xmlLinkPtr lk);
 
 /* xmlListUnique() */
index f39bde5..87a22aa 100644 (file)
@@ -80,52 +80,52 @@ typedef void (*ftpDataCallback) (void *userData,
  * Init
  */
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlNanoFTPInit          (void);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlNanoFTPCleanup       (void);
 
 /*
  * Creating/freeing contexts.
  */
 XML_DEPRECATED
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
        xmlNanoFTPNewCtxt       (const char *URL);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlNanoFTPFreeCtxt      (void * ctx);
 XML_DEPRECATED
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
        xmlNanoFTPConnectTo     (const char *server,
                                 int port);
 /*
  * Opening/closing session connections.
  */
 XML_DEPRECATED
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
        xmlNanoFTPOpen          (const char *URL);
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlNanoFTPConnect       (void *ctx);
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlNanoFTPClose         (void *ctx);
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlNanoFTPQuit          (void *ctx);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlNanoFTPScanProxy     (const char *URL);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlNanoFTPProxy         (const char *host,
                                 int port,
                                 const char *user,
                                 const char *passwd,
                                 int type);
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlNanoFTPUpdateURL     (void *ctx,
                                 const char *URL);
 
@@ -133,48 +133,48 @@ XMLPUBFUN int XMLCALL
  * Rather internal commands.
  */
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlNanoFTPGetResponse   (void *ctx);
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlNanoFTPCheckResponse (void *ctx);
 
 /*
  * CD/DIR/GET handlers.
  */
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlNanoFTPCwd           (void *ctx,
                                 const char *directory);
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlNanoFTPDele          (void *ctx,
                                 const char *file);
 
 XML_DEPRECATED
-XMLPUBFUN SOCKET XMLCALL
+XMLPUBFUN SOCKET
        xmlNanoFTPGetConnection (void *ctx);
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlNanoFTPCloseConnection(void *ctx);
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlNanoFTPList          (void *ctx,
                                 ftpListCallback callback,
                                 void *userData,
                                 const char *filename);
 XML_DEPRECATED
-XMLPUBFUN SOCKET XMLCALL
+XMLPUBFUN SOCKET
        xmlNanoFTPGetSocket     (void *ctx,
                                 const char *filename);
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlNanoFTPGet           (void *ctx,
                                 ftpDataCallback callback,
                                 void *userData,
                                 const char *filename);
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlNanoFTPRead          (void *ctx,
                                 void *dest,
                                 int len);
index 22b8fb4..3b5e037 100644 (file)
 #ifdef __cplusplus
 extern "C" {
 #endif
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlNanoHTTPInit         (void);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlNanoHTTPCleanup      (void);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlNanoHTTPScanProxy    (const char *URL);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlNanoHTTPFetch        (const char *URL,
                                 const char *filename,
                                 char **contentType);
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
        xmlNanoHTTPMethod       (const char *URL,
                                 const char *method,
                                 const char *input,
                                 char **contentType,
                                 const char *headers,
                                 int   ilen);
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
        xmlNanoHTTPMethodRedir  (const char *URL,
                                 const char *method,
                                 const char *input,
@@ -43,35 +43,35 @@ XMLPUBFUN void * XMLCALL
                                 char **redir,
                                 const char *headers,
                                 int   ilen);
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
        xmlNanoHTTPOpen         (const char *URL,
                                 char **contentType);
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
        xmlNanoHTTPOpenRedir    (const char *URL,
                                 char **contentType,
                                 char **redir);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlNanoHTTPReturnCode   (void *ctx);
-XMLPUBFUN const char * XMLCALL
+XMLPUBFUN const char *
        xmlNanoHTTPAuthHeader   (void *ctx);
-XMLPUBFUN const char * XMLCALL
+XMLPUBFUN const char *
        xmlNanoHTTPRedir        (void *ctx);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlNanoHTTPContentLength( void * ctx );
-XMLPUBFUN const char * XMLCALL
+XMLPUBFUN const char *
        xmlNanoHTTPEncoding     (void *ctx);
-XMLPUBFUN const char * XMLCALL
+XMLPUBFUN const char *
        xmlNanoHTTPMimeType     (void *ctx);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlNanoHTTPRead         (void *ctx,
                                 void *dest,
                                 int len);
 #ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlNanoHTTPSave         (void *ctxt,
                                 const char *filename);
 #endif /* LIBXML_OUTPUT_ENABLED */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlNanoHTTPClose        (void *ctx);
 #ifdef __cplusplus
 }
index 82c61d6..950ebe3 100644 (file)
@@ -61,17 +61,14 @@ struct _xmlParserInput {
     int length;                       /* length if known */
     int line;                         /* Current line */
     int col;                          /* Current column */
-    /*
-     * NOTE: consumed is only tested for equality in the parser code,
-     *       so even if there is an overflow this should not give troubles
-     *       for parsing very large instances.
-     */
     unsigned long consumed;           /* How many xmlChars already consumed */
     xmlParserInputDeallocate free;    /* function to deallocate the base */
     const xmlChar *encoding;          /* the encoding string for entity */
     const xmlChar *version;           /* the version string for entity */
     int standalone;                   /* Was that entity marked standalone */
     int id;                           /* an unique identifier for the entity */
+    unsigned long parentConsumed;     /* consumed bytes from parents */
+    xmlEntityPtr entity;              /* entity, if any */
 };
 
 /**
@@ -300,7 +297,7 @@ struct _xmlParserCtxt {
      */
     xmlError          lastError;
     xmlParserMode     parseMode;    /* the parser mode */
-    unsigned long    nbentities;    /* number of entities references */
+    unsigned long    nbentities;    /* unused */
     unsigned long  sizeentities;    /* size of parsed entities */
 
     /* for use by HTML non-recursive parser */
@@ -311,6 +308,10 @@ struct _xmlParserCtxt {
 
     int                input_id;      /* we need to label inputs */
     unsigned long      sizeentcopy;   /* volume of entity copy */
+
+    int           endCheckState;    /* quote state for push parser */
+    unsigned short     nbErrors;    /* number of errors */
+    unsigned short   nbWarnings;    /* number of warnings */
 };
 
 /**
@@ -605,7 +606,7 @@ typedef void (*cdataBlockSAXFunc) (
  *
  * Display and format a warning messages, callback.
  */
-typedef void (XMLCDECL *warningSAXFunc) (void *ctx,
+typedef void (*warningSAXFunc) (void *ctx,
                                const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
 /**
  * errorSAXFunc:
@@ -615,7 +616,7 @@ typedef void (XMLCDECL *warningSAXFunc) (void *ctx,
  *
  * Display and format an error messages, callback.
  */
-typedef void (XMLCDECL *errorSAXFunc) (void *ctx,
+typedef void (*errorSAXFunc) (void *ctx,
                                const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
 /**
  * fatalErrorSAXFunc:
@@ -627,7 +628,7 @@ typedef void (XMLCDECL *errorSAXFunc) (void *ctx,
  * Note: so far fatalError() SAX callbacks are not used, error()
  *       get all the callbacks for errors.
  */
-typedef void (XMLCDECL *fatalErrorSAXFunc) (void *ctx,
+typedef void (*fatalErrorSAXFunc) (void *ctx,
                                const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
 /**
  * isStandaloneSAXFunc:
@@ -819,18 +820,20 @@ extern "C" {
 /*
  * Init/Cleanup
  */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlInitParser           (void);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlCleanupParser        (void);
 
 /*
  * Input functions
  */
-XMLPUBFUN int XMLCALL
+XML_DEPRECATED
+XMLPUBFUN int
                xmlParserInputRead      (xmlParserInputPtr in,
                                         int len);
-XMLPUBFUN int XMLCALL
+XML_DEPRECATED
+XMLPUBFUN int
                xmlParserInputGrow      (xmlParserInputPtr in,
                                         int len);
 
@@ -838,101 +841,114 @@ XMLPUBFUN int XMLCALL
  * Basic parsing Interfaces
  */
 #ifdef LIBXML_SAX1_ENABLED
-XMLPUBFUN xmlDocPtr XMLCALL
+XMLPUBFUN xmlDocPtr
                xmlParseDoc             (const xmlChar *cur);
-XMLPUBFUN xmlDocPtr XMLCALL
+XMLPUBFUN xmlDocPtr
                xmlParseFile            (const char *filename);
-XMLPUBFUN xmlDocPtr XMLCALL
+XMLPUBFUN xmlDocPtr
                xmlParseMemory          (const char *buffer,
                                         int size);
 #endif /* LIBXML_SAX1_ENABLED */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSubstituteEntitiesDefault(int val);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlKeepBlanksDefault    (int val);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlStopParser           (xmlParserCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlPedanticParserDefault(int val);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlLineNumbersDefault   (int val);
 
 #ifdef LIBXML_SAX1_ENABLED
 /*
  * Recovery mode
  */
-XMLPUBFUN xmlDocPtr XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlDocPtr
                xmlRecoverDoc           (const xmlChar *cur);
-XMLPUBFUN xmlDocPtr XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlDocPtr
                xmlRecoverMemory        (const char *buffer,
                                         int size);
-XMLPUBFUN xmlDocPtr XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlDocPtr
                xmlRecoverFile          (const char *filename);
 #endif /* LIBXML_SAX1_ENABLED */
 
 /*
  * Less common routines and SAX interfaces
  */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlParseDocument        (xmlParserCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlParseExtParsedEnt    (xmlParserCtxtPtr ctxt);
 #ifdef LIBXML_SAX1_ENABLED
-XMLPUBFUN int XMLCALL
+XML_DEPRECATED
+XMLPUBFUN int
                xmlSAXUserParseFile     (xmlSAXHandlerPtr sax,
                                         void *user_data,
                                         const char *filename);
-XMLPUBFUN int XMLCALL
+XML_DEPRECATED
+XMLPUBFUN int
                xmlSAXUserParseMemory   (xmlSAXHandlerPtr sax,
                                         void *user_data,
                                         const char *buffer,
                                         int size);
-XMLPUBFUN xmlDocPtr XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlDocPtr
                xmlSAXParseDoc          (xmlSAXHandlerPtr sax,
                                         const xmlChar *cur,
                                         int recovery);
-XMLPUBFUN xmlDocPtr XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlDocPtr
                xmlSAXParseMemory       (xmlSAXHandlerPtr sax,
                                         const char *buffer,
                                         int size,
                                         int recovery);
-XMLPUBFUN xmlDocPtr XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlDocPtr
                xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax,
                                         const char *buffer,
                                         int size,
                                         int recovery,
                                         void *data);
-XMLPUBFUN xmlDocPtr XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlDocPtr
                xmlSAXParseFile         (xmlSAXHandlerPtr sax,
                                         const char *filename,
                                         int recovery);
-XMLPUBFUN xmlDocPtr XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlDocPtr
                xmlSAXParseFileWithData (xmlSAXHandlerPtr sax,
                                         const char *filename,
                                         int recovery,
                                         void *data);
-XMLPUBFUN xmlDocPtr XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlDocPtr
                xmlSAXParseEntity       (xmlSAXHandlerPtr sax,
                                         const char *filename);
-XMLPUBFUN xmlDocPtr XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlDocPtr
                xmlParseEntity          (const char *filename);
 #endif /* LIBXML_SAX1_ENABLED */
 
 #ifdef LIBXML_VALID_ENABLED
-XMLPUBFUN xmlDtdPtr XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlDtdPtr
                xmlSAXParseDTD          (xmlSAXHandlerPtr sax,
                                         const xmlChar *ExternalID,
                                         const xmlChar *SystemID);
-XMLPUBFUN xmlDtdPtr XMLCALL
+XMLPUBFUN xmlDtdPtr
                xmlParseDTD             (const xmlChar *ExternalID,
                                         const xmlChar *SystemID);
-XMLPUBFUN xmlDtdPtr XMLCALL
+XMLPUBFUN xmlDtdPtr
                xmlIOParseDTD           (xmlSAXHandlerPtr sax,
                                         xmlParserInputBufferPtr input,
                                         xmlCharEncoding enc);
 #endif /* LIBXML_VALID_ENABLE */
 #ifdef LIBXML_SAX1_ENABLED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlParseBalancedChunkMemory(xmlDocPtr doc,
                                         xmlSAXHandlerPtr sax,
                                         void *user_data,
@@ -940,14 +956,14 @@ XMLPUBFUN int XMLCALL
                                         const xmlChar *string,
                                         xmlNodePtr *lst);
 #endif /* LIBXML_SAX1_ENABLED */
-XMLPUBFUN xmlParserErrors XMLCALL
+XMLPUBFUN xmlParserErrors
                xmlParseInNodeContext   (xmlNodePtr node,
                                         const char *data,
                                         int datalen,
                                         int options,
                                         xmlNodePtr *lst);
 #ifdef LIBXML_SAX1_ENABLED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc,
                      xmlSAXHandlerPtr sax,
                      void *user_data,
@@ -955,7 +971,8 @@ XMLPUBFUN int XMLCALL
                      const xmlChar *string,
                      xmlNodePtr *lst,
                      int recover);
-XMLPUBFUN int XMLCALL
+XML_DEPRECATED
+XMLPUBFUN int
                xmlParseExternalEntity  (xmlDocPtr doc,
                                         xmlSAXHandlerPtr sax,
                                         void *user_data,
@@ -964,7 +981,7 @@ XMLPUBFUN int XMLCALL
                                         const xmlChar *ID,
                                         xmlNodePtr *lst);
 #endif /* LIBXML_SAX1_ENABLED */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx,
                                         const xmlChar *URL,
                                         const xmlChar *ID,
@@ -973,21 +990,25 @@ XMLPUBFUN int XMLCALL
 /*
  * Parser contexts handling.
  */
-XMLPUBFUN xmlParserCtxtPtr XMLCALL
+XMLPUBFUN xmlParserCtxtPtr
                xmlNewParserCtxt        (void);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN xmlParserCtxtPtr
+               xmlNewSAXParserCtxt     (const xmlSAXHandler *sax,
+                                        void *userData);
+XMLPUBFUN int
                xmlInitParserCtxt       (xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlClearParserCtxt      (xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlFreeParserCtxt       (xmlParserCtxtPtr ctxt);
 #ifdef LIBXML_SAX1_ENABLED
-XMLPUBFUN void XMLCALL
+XML_DEPRECATED
+XMLPUBFUN void
                xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
                                         const xmlChar* buffer,
                                         const char *filename);
 #endif /* LIBXML_SAX1_ENABLED */
-XMLPUBFUN xmlParserCtxtPtr XMLCALL
+XMLPUBFUN xmlParserCtxtPtr
                xmlCreateDocParserCtxt  (const xmlChar *cur);
 
 #ifdef LIBXML_LEGACY_ENABLED
@@ -995,16 +1016,16 @@ XMLPUBFUN xmlParserCtxtPtr XMLCALL
  * Reading/setting optional parsing features.
  */
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlGetFeaturesList      (int *len,
                                         const char **result);
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlGetFeature           (xmlParserCtxtPtr ctxt,
                                         const char *name,
                                         void *result);
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSetFeature           (xmlParserCtxtPtr ctxt,
                                         const char *name,
                                         void *value);
@@ -1014,13 +1035,13 @@ XMLPUBFUN int XMLCALL
 /*
  * Interfaces for the Push mode.
  */
-XMLPUBFUN xmlParserCtxtPtr XMLCALL
+XMLPUBFUN xmlParserCtxtPtr
                xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
                                         void *user_data,
                                         const char *chunk,
                                         int size,
                                         const char *filename);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlParseChunk           (xmlParserCtxtPtr ctxt,
                                         const char *chunk,
                                         int size,
@@ -1031,7 +1052,7 @@ XMLPUBFUN int XMLCALL
  * Special I/O mode.
  */
 
-XMLPUBFUN xmlParserCtxtPtr XMLCALL
+XMLPUBFUN xmlParserCtxtPtr
                xmlCreateIOParserCtxt   (xmlSAXHandlerPtr sax,
                                         void *user_data,
                                         xmlInputReadCallback   ioread,
@@ -1039,7 +1060,7 @@ XMLPUBFUN xmlParserCtxtPtr XMLCALL
                                         void *ioctx,
                                         xmlCharEncoding enc);
 
-XMLPUBFUN xmlParserInputPtr XMLCALL
+XMLPUBFUN xmlParserInputPtr
                xmlNewIOInputStream     (xmlParserCtxtPtr ctxt,
                                         xmlParserInputBufferPtr input,
                                         xmlCharEncoding enc);
@@ -1047,17 +1068,17 @@ XMLPUBFUN xmlParserInputPtr XMLCALL
 /*
  * Node infos.
  */
-XMLPUBFUN const xmlParserNodeInfo* XMLCALL
+XMLPUBFUN const xmlParserNodeInfo*
                xmlParserFindNodeInfo   (const xmlParserCtxtPtr ctxt,
                                         const xmlNodePtr node);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlInitNodeInfoSeq      (xmlParserNodeInfoSeqPtr seq);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlClearNodeInfoSeq     (xmlParserNodeInfoSeqPtr seq);
-XMLPUBFUN unsigned long XMLCALL
+XMLPUBFUN unsigned long
                xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
                                          const xmlNodePtr node);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlParserAddNodeInfo    (xmlParserCtxtPtr ctxt,
                                         const xmlParserNodeInfoPtr info);
 
@@ -1065,11 +1086,11 @@ XMLPUBFUN void XMLCALL
  * External entities handling actually implemented in xmlIO.
  */
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
-XMLPUBFUN xmlExternalEntityLoader XMLCALL
+XMLPUBFUN xmlExternalEntityLoader
                xmlGetExternalEntityLoader(void);
-XMLPUBFUN xmlParserInputPtr XMLCALL
+XMLPUBFUN xmlParserInputPtr
                xmlLoadExternalEntity   (const char *URL,
                                         const char *ID,
                                         xmlParserCtxtPtr ctxt);
@@ -1077,7 +1098,7 @@ XMLPUBFUN xmlParserInputPtr XMLCALL
 /*
  * Index lookup, actually implemented in the encoding module
  */
-XMLPUBFUN long XMLCALL
+XMLPUBFUN long
                xmlByteConsumed         (xmlParserCtxtPtr ctxt);
 
 /*
@@ -1117,69 +1138,69 @@ typedef enum {
     XML_PARSE_BIG_LINES = 1<<22 /* Store big lines numbers in text PSVI field */
 } xmlParserOption;
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlCtxtReset            (xmlParserCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlCtxtResetPush        (xmlParserCtxtPtr ctxt,
                                         const char *chunk,
                                         int size,
                                         const char *filename,
                                         const char *encoding);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlCtxtUseOptions       (xmlParserCtxtPtr ctxt,
                                         int options);
-XMLPUBFUN xmlDocPtr XMLCALL
+XMLPUBFUN xmlDocPtr
                xmlReadDoc              (const xmlChar *cur,
                                         const char *URL,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN xmlDocPtr XMLCALL
+XMLPUBFUN xmlDocPtr
                xmlReadFile             (const char *URL,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN xmlDocPtr XMLCALL
+XMLPUBFUN xmlDocPtr
                xmlReadMemory           (const char *buffer,
                                         int size,
                                         const char *URL,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN xmlDocPtr XMLCALL
+XMLPUBFUN xmlDocPtr
                xmlReadFd               (int fd,
                                         const char *URL,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN xmlDocPtr XMLCALL
+XMLPUBFUN xmlDocPtr
                xmlReadIO               (xmlInputReadCallback ioread,
                                         xmlInputCloseCallback ioclose,
                                         void *ioctx,
                                         const char *URL,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN xmlDocPtr XMLCALL
+XMLPUBFUN xmlDocPtr
                xmlCtxtReadDoc          (xmlParserCtxtPtr ctxt,
                                         const xmlChar *cur,
                                         const char *URL,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN xmlDocPtr XMLCALL
+XMLPUBFUN xmlDocPtr
                xmlCtxtReadFile         (xmlParserCtxtPtr ctxt,
                                         const char *filename,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN xmlDocPtr XMLCALL
+XMLPUBFUN xmlDocPtr
                xmlCtxtReadMemory               (xmlParserCtxtPtr ctxt,
                                         const char *buffer,
                                         int size,
                                         const char *URL,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN xmlDocPtr XMLCALL
+XMLPUBFUN xmlDocPtr
                xmlCtxtReadFd           (xmlParserCtxtPtr ctxt,
                                         int fd,
                                         const char *URL,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN xmlDocPtr XMLCALL
+XMLPUBFUN xmlDocPtr
                xmlCtxtReadIO           (xmlParserCtxtPtr ctxt,
                                         xmlInputReadCallback ioread,
                                         xmlInputCloseCallback ioclose,
@@ -1235,7 +1256,7 @@ typedef enum {
     XML_WITH_NONE = 99999 /* just to be sure of allocation size */
 } xmlFeature;
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlHasFeature           (xmlFeature feature);
 
 #ifdef __cplusplus
index 656ee46..513981e 100644 (file)
@@ -41,6 +41,13 @@ XMLPUBVAR unsigned int xmlParserMaxDepth;
 #define XML_MAX_TEXT_LENGTH 10000000
 
 /**
+ * XML_MAX_HUGE_LENGTH:
+ *
+ * Maximum size allowed when XML_PARSE_HUGE is set.
+ */
+#define XML_MAX_HUGE_LENGTH 1000000000
+
+/**
  * XML_MAX_NAME_LENGTH:
  *
  * Maximum size allowed for a markup identifier.
@@ -279,34 +286,6 @@ XMLPUBVAR unsigned int xmlParserMaxDepth;
 #define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c)
 
 /**
- * SKIP_EOL:
- * @p:  and UTF8 string pointer
- *
- * Skips the end of line chars.
- */
-#define SKIP_EOL(p)                                                    \
-    if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; }                 \
-    if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; }
-
-/**
- * MOVETO_ENDTAG:
- * @p:  and UTF8 string pointer
- *
- * Skips to the next '>' char.
- */
-#define MOVETO_ENDTAG(p)                                               \
-    while ((*p) && (*(p) != '>')) (p)++
-
-/**
- * MOVETO_STARTTAG:
- * @p:  and UTF8 string pointer
- *
- * Skips to the next '<' char.
- */
-#define MOVETO_STARTTAG(p)                                             \
-    while ((*p) && (*(p) != '<')) (p)++
-
-/**
  * Global variables used for predefined strings.
  */
 XMLPUBVAR const xmlChar xmlStringText[];
@@ -316,71 +295,62 @@ XMLPUBVAR const xmlChar xmlStringComment[];
 /*
  * Function to finish the work of the macros where needed.
  */
-XMLPUBFUN int XMLCALL                   xmlIsLetter     (int c);
+XMLPUBFUN int                   xmlIsLetter     (int c);
 
 /**
  * Parser context.
  */
-XMLPUBFUN xmlParserCtxtPtr XMLCALL
+XMLPUBFUN xmlParserCtxtPtr
                        xmlCreateFileParserCtxt (const char *filename);
-XMLPUBFUN xmlParserCtxtPtr XMLCALL
+XMLPUBFUN xmlParserCtxtPtr
                        xmlCreateURLParserCtxt  (const char *filename,
                                                 int options);
-XMLPUBFUN xmlParserCtxtPtr XMLCALL
+XMLPUBFUN xmlParserCtxtPtr
                        xmlCreateMemoryParserCtxt(const char *buffer,
                                                 int size);
-XMLPUBFUN xmlParserCtxtPtr XMLCALL
+XMLPUBFUN xmlParserCtxtPtr
                        xmlCreateEntityParserCtxt(const xmlChar *URL,
                                                 const xmlChar *ID,
                                                 const xmlChar *base);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlSwitchEncoding       (xmlParserCtxtPtr ctxt,
                                                 xmlCharEncoding enc);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlSwitchToEncoding     (xmlParserCtxtPtr ctxt,
                                         xmlCharEncodingHandlerPtr handler);
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlSwitchInputEncoding  (xmlParserCtxtPtr ctxt,
                                                 xmlParserInputPtr input,
                                         xmlCharEncodingHandlerPtr handler);
 
-#ifdef IN_LIBXML
-/* internal error reporting */
-XMLPUBFUN void XMLCALL
-                       __xmlErrEncoding        (xmlParserCtxtPtr ctxt,
-                                                xmlParserErrors xmlerr,
-                                                const char *msg,
-                                                const xmlChar * str1,
-                                                const xmlChar * str2) LIBXML_ATTR_FORMAT(3,0);
-#endif
-
 /**
  * Input Streams.
  */
-XMLPUBFUN xmlParserInputPtr XMLCALL
+XMLPUBFUN xmlParserInputPtr
                        xmlNewStringInputStream (xmlParserCtxtPtr ctxt,
                                                 const xmlChar *buffer);
-XMLPUBFUN xmlParserInputPtr XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlParserInputPtr
                        xmlNewEntityInputStream (xmlParserCtxtPtr ctxt,
                                                 xmlEntityPtr entity);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlPushInput            (xmlParserCtxtPtr ctxt,
                                                 xmlParserInputPtr input);
-XMLPUBFUN xmlChar XMLCALL
+XMLPUBFUN xmlChar
                        xmlPopInput             (xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlFreeInputStream      (xmlParserInputPtr input);
-XMLPUBFUN xmlParserInputPtr XMLCALL
+XMLPUBFUN xmlParserInputPtr
                        xmlNewInputFromFile     (xmlParserCtxtPtr ctxt,
                                                 const char *filename);
-XMLPUBFUN xmlParserInputPtr XMLCALL
+XMLPUBFUN xmlParserInputPtr
                        xmlNewInputStream       (xmlParserCtxtPtr ctxt);
 
 /**
  * Namespaces.
  */
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                        xmlSplitQName           (xmlParserCtxtPtr ctxt,
                                                 const xmlChar *name,
                                                 xmlChar **prefix);
@@ -388,109 +358,151 @@ XMLPUBFUN xmlChar * XMLCALL
 /**
  * Generic production rules.
  */
-XMLPUBFUN const xmlChar * XMLCALL
+XML_DEPRECATED
+XMLPUBFUN const xmlChar *
                        xmlParseName            (xmlParserCtxtPtr ctxt);
-XMLPUBFUN xmlChar * XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlChar *
                        xmlParseNmtoken         (xmlParserCtxtPtr ctxt);
-XMLPUBFUN xmlChar * XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlChar *
                        xmlParseEntityValue     (xmlParserCtxtPtr ctxt,
                                                 xmlChar **orig);
-XMLPUBFUN xmlChar * XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlChar *
                        xmlParseAttValue        (xmlParserCtxtPtr ctxt);
-XMLPUBFUN xmlChar * XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlChar *
                        xmlParseSystemLiteral   (xmlParserCtxtPtr ctxt);
-XMLPUBFUN xmlChar * XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlChar *
                        xmlParsePubidLiteral    (xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
+XML_DEPRECATED
+XMLPUBFUN void
                        xmlParseCharData        (xmlParserCtxtPtr ctxt,
                                                 int cdata);
-XMLPUBFUN xmlChar * XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlChar *
                        xmlParseExternalID      (xmlParserCtxtPtr ctxt,
                                                 xmlChar **publicID,
                                                 int strict);
-XMLPUBFUN void XMLCALL
+XML_DEPRECATED
+XMLPUBFUN void
                        xmlParseComment         (xmlParserCtxtPtr ctxt);
-XMLPUBFUN const xmlChar * XMLCALL
+XML_DEPRECATED
+XMLPUBFUN const xmlChar *
                        xmlParsePITarget        (xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
+XML_DEPRECATED
+XMLPUBFUN void
                        xmlParsePI              (xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
+XML_DEPRECATED
+XMLPUBFUN void
                        xmlParseNotationDecl    (xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
+XML_DEPRECATED
+XMLPUBFUN void
                        xmlParseEntityDecl      (xmlParserCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
+XML_DEPRECATED
+XMLPUBFUN int
                        xmlParseDefaultDecl     (xmlParserCtxtPtr ctxt,
                                                 xmlChar **value);
-XMLPUBFUN xmlEnumerationPtr XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlEnumerationPtr
                        xmlParseNotationType    (xmlParserCtxtPtr ctxt);
-XMLPUBFUN xmlEnumerationPtr XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlEnumerationPtr
                        xmlParseEnumerationType (xmlParserCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
+XML_DEPRECATED
+XMLPUBFUN int
                        xmlParseEnumeratedType  (xmlParserCtxtPtr ctxt,
                                                 xmlEnumerationPtr *tree);
-XMLPUBFUN int XMLCALL
+XML_DEPRECATED
+XMLPUBFUN int
                        xmlParseAttributeType   (xmlParserCtxtPtr ctxt,
                                                 xmlEnumerationPtr *tree);
-XMLPUBFUN void XMLCALL
+XML_DEPRECATED
+XMLPUBFUN void
                        xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt);
-XMLPUBFUN xmlElementContentPtr XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlElementContentPtr
                        xmlParseElementMixedContentDecl
                                                (xmlParserCtxtPtr ctxt,
                                                 int inputchk);
-XMLPUBFUN xmlElementContentPtr XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlElementContentPtr
                        xmlParseElementChildrenContentDecl
                                                (xmlParserCtxtPtr ctxt,
                                                 int inputchk);
-XMLPUBFUN int XMLCALL
+XML_DEPRECATED
+XMLPUBFUN int
                        xmlParseElementContentDecl(xmlParserCtxtPtr ctxt,
                                                 const xmlChar *name,
                                                 xmlElementContentPtr *result);
-XMLPUBFUN int XMLCALL
+XML_DEPRECATED
+XMLPUBFUN int
                        xmlParseElementDecl     (xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
+XML_DEPRECATED
+XMLPUBFUN void
                        xmlParseMarkupDecl      (xmlParserCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
+XML_DEPRECATED
+XMLPUBFUN int
                        xmlParseCharRef         (xmlParserCtxtPtr ctxt);
-XMLPUBFUN xmlEntityPtr XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlEntityPtr
                        xmlParseEntityRef       (xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
+XML_DEPRECATED
+XMLPUBFUN void
                        xmlParseReference       (xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
+XML_DEPRECATED
+XMLPUBFUN void
                        xmlParsePEReference     (xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
+XML_DEPRECATED
+XMLPUBFUN void
                        xmlParseDocTypeDecl     (xmlParserCtxtPtr ctxt);
 #ifdef LIBXML_SAX1_ENABLED
-XMLPUBFUN const xmlChar * XMLCALL
+XML_DEPRECATED
+XMLPUBFUN const xmlChar *
                        xmlParseAttribute       (xmlParserCtxtPtr ctxt,
                                                 xmlChar **value);
-XMLPUBFUN const xmlChar * XMLCALL
+XML_DEPRECATED
+XMLPUBFUN const xmlChar *
                        xmlParseStartTag        (xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
+XML_DEPRECATED
+XMLPUBFUN void
                        xmlParseEndTag          (xmlParserCtxtPtr ctxt);
 #endif /* LIBXML_SAX1_ENABLED */
-XMLPUBFUN void XMLCALL
+XML_DEPRECATED
+XMLPUBFUN void
                        xmlParseCDSect          (xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlParseContent         (xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
+XML_DEPRECATED
+XMLPUBFUN void
                        xmlParseElement         (xmlParserCtxtPtr ctxt);
-XMLPUBFUN xmlChar * XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlChar *
                        xmlParseVersionNum      (xmlParserCtxtPtr ctxt);
-XMLPUBFUN xmlChar * XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlChar *
                        xmlParseVersionInfo     (xmlParserCtxtPtr ctxt);
-XMLPUBFUN xmlChar * XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlChar *
                        xmlParseEncName         (xmlParserCtxtPtr ctxt);
-XMLPUBFUN const xmlChar * XMLCALL
+XML_DEPRECATED
+XMLPUBFUN const xmlChar *
                        xmlParseEncodingDecl    (xmlParserCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
+XML_DEPRECATED
+XMLPUBFUN int
                        xmlParseSDDecl          (xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
+XML_DEPRECATED
+XMLPUBFUN void
                        xmlParseXMLDecl         (xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
+XML_DEPRECATED
+XMLPUBFUN void
                        xmlParseTextDecl        (xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
+XML_DEPRECATED
+XMLPUBFUN void
                        xmlParseMisc            (xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlParseExternalSubset  (xmlParserCtxtPtr ctxt,
                                                 const xmlChar *ExternalID,
                                                 const xmlChar *SystemID);
@@ -519,14 +531,16 @@ XMLPUBFUN void XMLCALL
  */
 #define XML_SUBSTITUTE_BOTH    3
 
-XMLPUBFUN xmlChar * XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlChar *
                xmlStringDecodeEntities         (xmlParserCtxtPtr ctxt,
                                                 const xmlChar *str,
                                                 int what,
                                                 xmlChar end,
                                                 xmlChar  end2,
                                                 xmlChar end3);
-XMLPUBFUN xmlChar * XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlChar *
                xmlStringLenDecodeEntities      (xmlParserCtxtPtr ctxt,
                                                 const xmlChar *str,
                                                 int len,
@@ -538,48 +552,49 @@ XMLPUBFUN xmlChar * XMLCALL
 /*
  * Generated by MACROS on top of parser.c c.f. PUSH_AND_POP.
  */
-XMLPUBFUN int XMLCALL                  nodePush                (xmlParserCtxtPtr ctxt,
+XML_DEPRECATED
+XMLPUBFUN int                  nodePush                (xmlParserCtxtPtr ctxt,
                                                 xmlNodePtr value);
-XMLPUBFUN xmlNodePtr XMLCALL           nodePop                 (xmlParserCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL                  inputPush               (xmlParserCtxtPtr ctxt,
+XML_DEPRECATED
+XMLPUBFUN xmlNodePtr           nodePop                 (xmlParserCtxtPtr ctxt);
+XMLPUBFUN int                  inputPush               (xmlParserCtxtPtr ctxt,
                                                 xmlParserInputPtr value);
-XMLPUBFUN xmlParserInputPtr XMLCALL    inputPop                (xmlParserCtxtPtr ctxt);
-XMLPUBFUN const xmlChar * XMLCALL      namePop                 (xmlParserCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL                  namePush                (xmlParserCtxtPtr ctxt,
+XMLPUBFUN xmlParserInputPtr    inputPop                (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
+XMLPUBFUN const xmlChar *      namePop                 (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
+XMLPUBFUN int                  namePush                (xmlParserCtxtPtr ctxt,
                                                 const xmlChar *value);
 
 /*
  * other commodities shared between parser.c and parserInternals.
  */
-XMLPUBFUN int XMLCALL                  xmlSkipBlankChars       (xmlParserCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL                  xmlStringCurrentChar    (xmlParserCtxtPtr ctxt,
+XML_DEPRECATED
+XMLPUBFUN int                  xmlSkipBlankChars       (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
+XMLPUBFUN int                  xmlStringCurrentChar    (xmlParserCtxtPtr ctxt,
                                                 const xmlChar *cur,
                                                 int *len);
-XMLPUBFUN void XMLCALL                 xmlParserHandlePEReference(xmlParserCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL                  xmlCheckLanguageID      (const xmlChar *lang);
+XML_DEPRECATED
+XMLPUBFUN void                 xmlParserHandlePEReference(xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
+XMLPUBFUN int                  xmlCheckLanguageID      (const xmlChar *lang);
 
 /*
  * Really core function shared with HTML parser.
  */
-XMLPUBFUN int XMLCALL                  xmlCurrentChar          (xmlParserCtxtPtr ctxt,
+XML_DEPRECATED
+XMLPUBFUN int                  xmlCurrentChar          (xmlParserCtxtPtr ctxt,
                                                 int *len);
-XMLPUBFUN int XMLCALL          xmlCopyCharMultiByte    (xmlChar *out,
+XMLPUBFUN int          xmlCopyCharMultiByte    (xmlChar *out,
                                                 int val);
-XMLPUBFUN int XMLCALL                  xmlCopyChar             (int len,
+XMLPUBFUN int                  xmlCopyChar             (int len,
                                                 xmlChar *out,
                                                 int val);
-XMLPUBFUN void XMLCALL                 xmlNextChar             (xmlParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL                 xmlParserInputShrink    (xmlParserInputPtr in);
-
-#ifdef LIBXML_HTML_ENABLED
-/*
- * Actually comes from the HTML parser but launched from the init stuff.
- */
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL                 htmlInitAutoClose       (void);
-XMLPUBFUN htmlParserCtxtPtr XMLCALL    htmlCreateFileParserCtxt(const char *filename,
-                                                const char *encoding);
-#endif
+XMLPUBFUN void                 xmlNextChar             (xmlParserCtxtPtr ctxt);
+XML_DEPRECATED
+XMLPUBFUN void                 xmlParserInputShrink    (xmlParserInputPtr in);
 
 /*
  * Specific function to keep track of entities references
@@ -600,34 +615,34 @@ typedef   void    (*xmlEntityReferenceFunc)       (xmlEntityPtr ent,
                                                 xmlNodePtr lastNode);
 
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL         xmlSetEntityReferenceFunc       (xmlEntityReferenceFunc func);
+XMLPUBFUN void         xmlSetEntityReferenceFunc       (xmlEntityReferenceFunc func);
 
 XML_DEPRECATED
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                        xmlParseQuotedString    (xmlParserCtxtPtr ctxt);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                         xmlParseNamespace       (xmlParserCtxtPtr ctxt);
 XML_DEPRECATED
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                        xmlNamespaceParseNSDef  (xmlParserCtxtPtr ctxt);
 XML_DEPRECATED
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                        xmlScanName             (xmlParserCtxtPtr ctxt);
 XML_DEPRECATED
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                        xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL xmlParserHandleReference(xmlParserCtxtPtr ctxt);
+XMLPUBFUN void xmlParserHandleReference(xmlParserCtxtPtr ctxt);
 XML_DEPRECATED
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                        xmlNamespaceParseQName  (xmlParserCtxtPtr ctxt,
                                                 xmlChar **prefix);
 /**
  * Entities
  */
 XML_DEPRECATED
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlDecodeEntities               (xmlParserCtxtPtr ctxt,
                                                 int len,
                                                 int what,
@@ -635,21 +650,12 @@ XMLPUBFUN xmlChar * XMLCALL
                                                 xmlChar  end2,
                                                 xmlChar end3);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlHandleEntity         (xmlParserCtxtPtr ctxt,
                                                 xmlEntityPtr entity);
 
 #endif /* LIBXML_LEGACY_ENABLED */
 
-#ifdef IN_LIBXML
-/*
- * internal only
- */
-XMLPUBFUN void XMLCALL
-       xmlErrMemory            (xmlParserCtxtPtr ctxt,
-                                const char *extra);
-#endif
-
 #ifdef __cplusplus
 }
 #endif
index 97d2cd2..72bf239 100644 (file)
@@ -43,18 +43,18 @@ typedef enum {
     XML_PATTERN_XSFIELD                = 1<<2  /* XPath subset for schema field */
 } xmlPatternFlags;
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlFreePattern          (xmlPatternPtr comp);
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlFreePatternList      (xmlPatternPtr comp);
 
-XMLPUBFUN xmlPatternPtr XMLCALL
+XMLPUBFUN xmlPatternPtr
                        xmlPatterncompile       (const xmlChar *pattern,
                                                 xmlDict *dict,
                                                 int flags,
                                                 const xmlChar **namespaces);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlPatternMatch         (xmlPatternPtr comp,
                                                 xmlNodePtr node);
 
@@ -62,34 +62,34 @@ XMLPUBFUN int XMLCALL
 typedef struct _xmlStreamCtxt xmlStreamCtxt;
 typedef xmlStreamCtxt *xmlStreamCtxtPtr;
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlPatternStreamable    (xmlPatternPtr comp);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlPatternMaxDepth      (xmlPatternPtr comp);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlPatternMinDepth      (xmlPatternPtr comp);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlPatternFromRoot      (xmlPatternPtr comp);
-XMLPUBFUN xmlStreamCtxtPtr XMLCALL
+XMLPUBFUN xmlStreamCtxtPtr
                        xmlPatternGetStreamCtxt (xmlPatternPtr comp);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlFreeStreamCtxt       (xmlStreamCtxtPtr stream);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlStreamPushNode       (xmlStreamCtxtPtr stream,
                                                 const xmlChar *name,
                                                 const xmlChar *ns,
                                                 int nodeType);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlStreamPush           (xmlStreamCtxtPtr stream,
                                                 const xmlChar *name,
                                                 const xmlChar *ns);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlStreamPushAttr       (xmlStreamCtxtPtr stream,
                                                 const xmlChar *name,
                                                 const xmlChar *ns);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlStreamPop            (xmlStreamCtxtPtr stream);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlStreamWantsAnyNode   (xmlStreamCtxtPtr stream);
 #ifdef __cplusplus
 }
index 6369785..aecaea3 100644 (file)
@@ -32,7 +32,7 @@ typedef xmlRelaxNG *xmlRelaxNGPtr;
  *
  * Signature of an error callback from a Relax-NG validation
  */
-typedef void (XMLCDECL *xmlRelaxNGValidityErrorFunc) (void *ctx,
+typedef void (*xmlRelaxNGValidityErrorFunc) (void *ctx,
                                                      const char *msg,
                                                      ...) LIBXML_ATTR_FORMAT(2,3);
 
@@ -44,7 +44,7 @@ typedef void (XMLCDECL *xmlRelaxNGValidityErrorFunc) (void *ctx,
  *
  * Signature of a warning callback from a Relax-NG validation
  */
-typedef void (XMLCDECL *xmlRelaxNGValidityWarningFunc) (void *ctx,
+typedef void (*xmlRelaxNGValidityWarningFunc) (void *ctx,
                                                        const char *msg,
                                                        ...) LIBXML_ATTR_FORMAT(2,3);
 
@@ -116,95 +116,95 @@ typedef enum {
     XML_RELAXNGP_CRNG = 2
 } xmlRelaxNGParserFlag;
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlRelaxNGInitTypes         (void);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                    xmlRelaxNGCleanupTypes      (void);
 
 /*
  * Interfaces for parsing.
  */
-XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
+XMLPUBFUN xmlRelaxNGParserCtxtPtr
                    xmlRelaxNGNewParserCtxt     (const char *URL);
-XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
+XMLPUBFUN xmlRelaxNGParserCtxtPtr
                    xmlRelaxNGNewMemParserCtxt  (const char *buffer,
                                                 int size);
-XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
+XMLPUBFUN xmlRelaxNGParserCtxtPtr
                    xmlRelaxNGNewDocParserCtxt  (xmlDocPtr doc);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlRelaxParserSetFlag       (xmlRelaxNGParserCtxtPtr ctxt,
                                                 int flag);
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                    xmlRelaxNGFreeParserCtxt    (xmlRelaxNGParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                    xmlRelaxNGSetParserErrors(xmlRelaxNGParserCtxtPtr ctxt,
                                         xmlRelaxNGValidityErrorFunc err,
                                         xmlRelaxNGValidityWarningFunc warn,
                                         void *ctx);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlRelaxNGGetParserErrors(xmlRelaxNGParserCtxtPtr ctxt,
                                         xmlRelaxNGValidityErrorFunc *err,
                                         xmlRelaxNGValidityWarningFunc *warn,
                                         void **ctx);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                    xmlRelaxNGSetParserStructuredErrors(
                                         xmlRelaxNGParserCtxtPtr ctxt,
                                         xmlStructuredErrorFunc serror,
                                         void *ctx);
-XMLPUBFUN xmlRelaxNGPtr XMLCALL
+XMLPUBFUN xmlRelaxNGPtr
                    xmlRelaxNGParse             (xmlRelaxNGParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                    xmlRelaxNGFree              (xmlRelaxNGPtr schema);
 #ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                    xmlRelaxNGDump              (FILE *output,
                                         xmlRelaxNGPtr schema);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                    xmlRelaxNGDumpTree  (FILE * output,
                                         xmlRelaxNGPtr schema);
 #endif /* LIBXML_OUTPUT_ENABLED */
 /*
  * Interfaces for validating
  */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                    xmlRelaxNGSetValidErrors(xmlRelaxNGValidCtxtPtr ctxt,
                                         xmlRelaxNGValidityErrorFunc err,
                                         xmlRelaxNGValidityWarningFunc warn,
                                         void *ctx);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlRelaxNGGetValidErrors(xmlRelaxNGValidCtxtPtr ctxt,
                                         xmlRelaxNGValidityErrorFunc *err,
                                         xmlRelaxNGValidityWarningFunc *warn,
                                         void **ctx);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlRelaxNGSetValidStructuredErrors(xmlRelaxNGValidCtxtPtr ctxt,
                                          xmlStructuredErrorFunc serror, void *ctx);
-XMLPUBFUN xmlRelaxNGValidCtxtPtr XMLCALL
+XMLPUBFUN xmlRelaxNGValidCtxtPtr
                    xmlRelaxNGNewValidCtxt      (xmlRelaxNGPtr schema);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                    xmlRelaxNGFreeValidCtxt     (xmlRelaxNGValidCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlRelaxNGValidateDoc       (xmlRelaxNGValidCtxtPtr ctxt,
                                                 xmlDocPtr doc);
 /*
  * Interfaces for progressive validation when possible
  */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlRelaxNGValidatePushElement       (xmlRelaxNGValidCtxtPtr ctxt,
                                         xmlDocPtr doc,
                                         xmlNodePtr elem);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlRelaxNGValidatePushCData (xmlRelaxNGValidCtxtPtr ctxt,
                                         const xmlChar *data,
                                         int len);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlRelaxNGValidatePopElement        (xmlRelaxNGValidCtxtPtr ctxt,
                                         xmlDocPtr doc,
                                         xmlNodePtr elem);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlRelaxNGValidateFullElement       (xmlRelaxNGValidCtxtPtr ctxt,
                                         xmlDocPtr doc,
                                         xmlNodePtr elem);
index c521d1c..5806f01 100644 (file)
@@ -947,8 +947,8 @@ struct _xmlSchema {
     void *volatiles; /* Obsolete */
 };
 
-XMLPUBFUN void XMLCALL         xmlSchemaFreeType        (xmlSchemaTypePtr type);
-XMLPUBFUN void XMLCALL         xmlSchemaFreeWildcard(xmlSchemaWildcardPtr wildcard);
+XMLPUBFUN void         xmlSchemaFreeType        (xmlSchemaTypePtr type);
+XMLPUBFUN void         xmlSchemaFreeWildcard(xmlSchemaWildcardPtr wildcard);
 
 #ifdef __cplusplus
 }
index c61e61b..6e3d837 100644 (file)
@@ -69,68 +69,68 @@ typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr;
 /*
  * Interfaces for parsing.
  */
-XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
+XMLPUBFUN xmlSchematronParserCtxtPtr
            xmlSchematronNewParserCtxt  (const char *URL);
-XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
+XMLPUBFUN xmlSchematronParserCtxtPtr
            xmlSchematronNewMemParserCtxt(const char *buffer,
                                         int size);
-XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
+XMLPUBFUN xmlSchematronParserCtxtPtr
            xmlSchematronNewDocParserCtxt(xmlDocPtr doc);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
            xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt);
 /*****
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
            xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt,
                                         xmlSchematronValidityErrorFunc err,
                                         xmlSchematronValidityWarningFunc warn,
                                         void *ctx);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt,
                                        xmlSchematronValidityErrorFunc * err,
                                        xmlSchematronValidityWarningFunc * warn,
                                        void **ctx);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSchematronIsValid    (xmlSchematronValidCtxtPtr ctxt);
  *****/
-XMLPUBFUN xmlSchematronPtr XMLCALL
+XMLPUBFUN xmlSchematronPtr
            xmlSchematronParse          (xmlSchematronParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
            xmlSchematronFree           (xmlSchematronPtr schema);
 /*
  * Interfaces for validating
  */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
            xmlSchematronSetValidStructuredErrors(
                                          xmlSchematronValidCtxtPtr ctxt,
                                          xmlStructuredErrorFunc serror,
                                          void *ctx);
 /******
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
            xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt,
                                         xmlSchematronValidityErrorFunc err,
                                         xmlSchematronValidityWarningFunc warn,
                                         void *ctx);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
            xmlSchematronGetValidErrors (xmlSchematronValidCtxtPtr ctxt,
                                         xmlSchematronValidityErrorFunc *err,
                                         xmlSchematronValidityWarningFunc *warn,
                                         void **ctx);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
            xmlSchematronSetValidOptions(xmlSchematronValidCtxtPtr ctxt,
                                         int options);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
            xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
             xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt,
                                         xmlNodePtr elem);
  *******/
 
-XMLPUBFUN xmlSchematronValidCtxtPtr XMLCALL
+XMLPUBFUN xmlSchematronValidCtxtPtr
            xmlSchematronNewValidCtxt   (xmlSchematronPtr schema,
                                         int options);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
            xmlSchematronFreeValidCtxt  (xmlSchematronValidCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
            xmlSchematronValidateDoc    (xmlSchematronValidCtxtPtr ctxt,
                                         xmlDocPtr instance);
 
index 6eedac1..dd2304c 100644 (file)
@@ -36,52 +36,55 @@ typedef xmlRMutex *xmlRMutexPtr;
 #ifdef __cplusplus
 extern "C" {
 #endif
-XMLPUBFUN xmlMutexPtr XMLCALL
+XMLPUBFUN xmlMutexPtr
                        xmlNewMutex     (void);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlMutexLock    (xmlMutexPtr tok);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlMutexUnlock  (xmlMutexPtr tok);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlFreeMutex    (xmlMutexPtr tok);
 
-XMLPUBFUN xmlRMutexPtr XMLCALL
+XMLPUBFUN xmlRMutexPtr
                        xmlNewRMutex    (void);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlRMutexLock   (xmlRMutexPtr tok);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlRMutexUnlock (xmlRMutexPtr tok);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlFreeRMutex   (xmlRMutexPtr tok);
 
 /*
  * Library wide APIs.
  */
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlInitThreads  (void);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlLockLibrary  (void);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlUnlockLibrary(void);
-XMLPUBFUN int XMLCALL
+XML_DEPRECATED
+XMLPUBFUN int
                        xmlGetThreadId  (void);
-XMLPUBFUN int XMLCALL
+XML_DEPRECATED
+XMLPUBFUN int
                        xmlIsMainThread (void);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlCleanupThreads(void);
-XMLPUBFUN xmlGlobalStatePtr XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlGlobalStatePtr
                        xmlGetGlobalState(void);
 
-#ifdef HAVE_PTHREAD_H
-#elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
-#if defined(LIBXML_STATIC_FOR_DLL)
-int XMLCALL
+/** DOC_DISABLE */
+#if defined(LIBXML_THREAD_ENABLED) && defined(_WIN32) && \
+    !defined(HAVE_COMPILER_TLS) && defined(LIBXML_STATIC_FOR_DLL)
+int
 xmlDllMain(void *hinstDLL, unsigned long fdwReason,
            void *lpvReserved);
 #endif
-#endif
+/** DOC_ENABLE */
 
 #ifdef __cplusplus
 }
index 98e2087..b498966 100644 (file)
@@ -74,7 +74,7 @@ typedef xmlEntity *xmlEntityPtr;
 typedef enum {
     XML_BUFFER_ALLOC_DOUBLEIT, /* double each time one need to grow */
     XML_BUFFER_ALLOC_EXACT,    /* grow only to the minimal size */
-    XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer */
+    XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer, deprecated */
     XML_BUFFER_ALLOC_IO,       /* special allocation scheme used for I/O */
     XML_BUFFER_ALLOC_HYBRID,   /* exact up to a threshold, and doubleit thereafter */
     XML_BUFFER_ALLOC_BOUNDED   /* limit the upper size of the buffer */
@@ -117,10 +117,10 @@ typedef xmlBuf *xmlBufPtr;
  * A few public routines for xmlBuf. As those are expected to be used
  * mostly internally the bulk of the routines are internal in buf.h
  */
-XMLPUBFUN xmlChar* XMLCALL       xmlBufContent (const xmlBuf* buf);
-XMLPUBFUN xmlChar* XMLCALL       xmlBufEnd      (xmlBufPtr buf);
-XMLPUBFUN size_t XMLCALL         xmlBufUse      (const xmlBufPtr buf);
-XMLPUBFUN size_t XMLCALL         xmlBufShrink  (xmlBufPtr buf, size_t len);
+XMLPUBFUN xmlChar*       xmlBufContent (const xmlBuf* buf);
+XMLPUBFUN xmlChar*       xmlBufEnd      (xmlBufPtr buf);
+XMLPUBFUN size_t         xmlBufUse      (const xmlBufPtr buf);
+XMLPUBFUN size_t         xmlBufShrink  (xmlBufPtr buf, size_t len);
 
 /*
  * LIBXML2_NEW_BUFFER:
@@ -180,8 +180,10 @@ typedef enum {
     /* XML_DOCB_DOCUMENT_NODE= 21 */ /* removed */
 } xmlElementType;
 
+/** DOC_DISABLE */
 /* For backward compatibility */
 #define XML_DOCB_DOCUMENT_NODE 21
+/** DOC_ENABLE */
 
 /**
  * xmlNotation:
@@ -660,32 +662,32 @@ struct _xmlDOMWrapCtxt {
     defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || \
     defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || \
     defined(LIBXML_LEGACY_ENABLED)
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidateNCName       (const xmlChar *value,
                                         int space);
 #endif
 
 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidateQName        (const xmlChar *value,
                                         int space);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidateName         (const xmlChar *value,
                                         int space);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidateNMToken      (const xmlChar *value,
                                         int space);
 #endif
 
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlBuildQName           (const xmlChar *ncname,
                                         const xmlChar *prefix,
                                         xmlChar *memory,
                                         int len);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlSplitQName2          (const xmlChar *name,
                                         xmlChar **prefix);
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                xmlSplitQName3          (const xmlChar *name,
                                         int *len);
 
@@ -693,318 +695,318 @@ XMLPUBFUN const xmlChar * XMLCALL
  * Handling Buffers, the old ones see @xmlBuf for the new ones.
  */
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme);
-XMLPUBFUN xmlBufferAllocationScheme XMLCALL
+XMLPUBFUN xmlBufferAllocationScheme
                xmlGetBufferAllocationScheme(void);
 
-XMLPUBFUN xmlBufferPtr XMLCALL
+XMLPUBFUN xmlBufferPtr
                xmlBufferCreate         (void);
-XMLPUBFUN xmlBufferPtr XMLCALL
+XMLPUBFUN xmlBufferPtr
                xmlBufferCreateSize     (size_t size);
-XMLPUBFUN xmlBufferPtr XMLCALL
+XMLPUBFUN xmlBufferPtr
                xmlBufferCreateStatic   (void *mem,
                                         size_t size);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlBufferResize         (xmlBufferPtr buf,
                                         unsigned int size);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlBufferFree           (xmlBufferPtr buf);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlBufferDump           (FILE *file,
                                         xmlBufferPtr buf);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlBufferAdd            (xmlBufferPtr buf,
                                         const xmlChar *str,
                                         int len);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlBufferAddHead        (xmlBufferPtr buf,
                                         const xmlChar *str,
                                         int len);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlBufferCat            (xmlBufferPtr buf,
                                         const xmlChar *str);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlBufferCCat           (xmlBufferPtr buf,
                                         const char *str);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlBufferShrink         (xmlBufferPtr buf,
                                         unsigned int len);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlBufferGrow           (xmlBufferPtr buf,
                                         unsigned int len);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlBufferEmpty          (xmlBufferPtr buf);
-XMLPUBFUN const xmlChar* XMLCALL
+XMLPUBFUN const xmlChar*
                xmlBufferContent        (const xmlBuffer *buf);
-XMLPUBFUN xmlChar* XMLCALL
+XMLPUBFUN xmlChar*
                xmlBufferDetach         (xmlBufferPtr buf);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlBufferSetAllocationScheme(xmlBufferPtr buf,
                                         xmlBufferAllocationScheme scheme);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlBufferLength         (const xmlBuffer *buf);
 
 /*
  * Creating/freeing new structures.
  */
-XMLPUBFUN xmlDtdPtr XMLCALL
+XMLPUBFUN xmlDtdPtr
                xmlCreateIntSubset      (xmlDocPtr doc,
                                         const xmlChar *name,
                                         const xmlChar *ExternalID,
                                         const xmlChar *SystemID);
-XMLPUBFUN xmlDtdPtr XMLCALL
+XMLPUBFUN xmlDtdPtr
                xmlNewDtd               (xmlDocPtr doc,
                                         const xmlChar *name,
                                         const xmlChar *ExternalID,
                                         const xmlChar *SystemID);
-XMLPUBFUN xmlDtdPtr XMLCALL
+XMLPUBFUN xmlDtdPtr
                xmlGetIntSubset         (const xmlDoc *doc);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlFreeDtd              (xmlDtdPtr cur);
 #ifdef LIBXML_LEGACY_ENABLED
 XML_DEPRECATED
-XMLPUBFUN xmlNsPtr XMLCALL
+XMLPUBFUN xmlNsPtr
                xmlNewGlobalNs          (xmlDocPtr doc,
                                         const xmlChar *href,
                                         const xmlChar *prefix);
 #endif /* LIBXML_LEGACY_ENABLED */
-XMLPUBFUN xmlNsPtr XMLCALL
+XMLPUBFUN xmlNsPtr
                xmlNewNs                (xmlNodePtr node,
                                         const xmlChar *href,
                                         const xmlChar *prefix);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlFreeNs               (xmlNsPtr cur);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlFreeNsList           (xmlNsPtr cur);
-XMLPUBFUN xmlDocPtr XMLCALL
+XMLPUBFUN xmlDocPtr
                xmlNewDoc               (const xmlChar *version);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlFreeDoc              (xmlDocPtr cur);
-XMLPUBFUN xmlAttrPtr XMLCALL
+XMLPUBFUN xmlAttrPtr
                xmlNewDocProp           (xmlDocPtr doc,
                                         const xmlChar *name,
                                         const xmlChar *value);
 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
     defined(LIBXML_SCHEMAS_ENABLED)
-XMLPUBFUN xmlAttrPtr XMLCALL
+XMLPUBFUN xmlAttrPtr
                xmlNewProp              (xmlNodePtr node,
                                         const xmlChar *name,
                                         const xmlChar *value);
 #endif
-XMLPUBFUN xmlAttrPtr XMLCALL
+XMLPUBFUN xmlAttrPtr
                xmlNewNsProp            (xmlNodePtr node,
                                         xmlNsPtr ns,
                                         const xmlChar *name,
                                         const xmlChar *value);
-XMLPUBFUN xmlAttrPtr XMLCALL
+XMLPUBFUN xmlAttrPtr
                xmlNewNsPropEatName     (xmlNodePtr node,
                                         xmlNsPtr ns,
                                         xmlChar *name,
                                         const xmlChar *value);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlFreePropList         (xmlAttrPtr cur);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlFreeProp             (xmlAttrPtr cur);
-XMLPUBFUN xmlAttrPtr XMLCALL
+XMLPUBFUN xmlAttrPtr
                xmlCopyProp             (xmlNodePtr target,
                                         xmlAttrPtr cur);
-XMLPUBFUN xmlAttrPtr XMLCALL
+XMLPUBFUN xmlAttrPtr
                xmlCopyPropList         (xmlNodePtr target,
                                         xmlAttrPtr cur);
 #ifdef LIBXML_TREE_ENABLED
-XMLPUBFUN xmlDtdPtr XMLCALL
+XMLPUBFUN xmlDtdPtr
                xmlCopyDtd              (xmlDtdPtr dtd);
 #endif /* LIBXML_TREE_ENABLED */
 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
-XMLPUBFUN xmlDocPtr XMLCALL
+XMLPUBFUN xmlDocPtr
                xmlCopyDoc              (xmlDocPtr doc,
                                         int recursive);
 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
 /*
  * Creating new nodes.
  */
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlNewDocNode           (xmlDocPtr doc,
                                         xmlNsPtr ns,
                                         const xmlChar *name,
                                         const xmlChar *content);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlNewDocNodeEatName    (xmlDocPtr doc,
                                         xmlNsPtr ns,
                                         xmlChar *name,
                                         const xmlChar *content);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlNewNode              (xmlNsPtr ns,
                                         const xmlChar *name);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlNewNodeEatName       (xmlNsPtr ns,
                                         xmlChar *name);
 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlNewChild             (xmlNodePtr parent,
                                         xmlNsPtr ns,
                                         const xmlChar *name,
                                         const xmlChar *content);
 #endif
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlNewDocText           (const xmlDoc *doc,
                                         const xmlChar *content);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlNewText              (const xmlChar *content);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlNewDocPI             (xmlDocPtr doc,
                                         const xmlChar *name,
                                         const xmlChar *content);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlNewPI                (const xmlChar *name,
                                         const xmlChar *content);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlNewDocTextLen        (xmlDocPtr doc,
                                         const xmlChar *content,
                                         int len);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlNewTextLen           (const xmlChar *content,
                                         int len);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlNewDocComment        (xmlDocPtr doc,
                                         const xmlChar *content);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlNewComment           (const xmlChar *content);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlNewCDataBlock        (xmlDocPtr doc,
                                         const xmlChar *content,
                                         int len);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlNewCharRef           (xmlDocPtr doc,
                                         const xmlChar *name);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlNewReference         (const xmlDoc *doc,
                                         const xmlChar *name);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlCopyNode             (xmlNodePtr node,
                                         int recursive);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlDocCopyNode          (xmlNodePtr node,
                                         xmlDocPtr doc,
                                         int recursive);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlDocCopyNodeList      (xmlDocPtr doc,
                                         xmlNodePtr node);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlCopyNodeList         (xmlNodePtr node);
 #ifdef LIBXML_TREE_ENABLED
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlNewTextChild         (xmlNodePtr parent,
                                         xmlNsPtr ns,
                                         const xmlChar *name,
                                         const xmlChar *content);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlNewDocRawNode        (xmlDocPtr doc,
                                         xmlNsPtr ns,
                                         const xmlChar *name,
                                         const xmlChar *content);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlNewDocFragment       (xmlDocPtr doc);
 #endif /* LIBXML_TREE_ENABLED */
 
 /*
  * Navigating.
  */
-XMLPUBFUN long XMLCALL
+XMLPUBFUN long
                xmlGetLineNo            (const xmlNode *node);
 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlGetNodePath          (const xmlNode *node);
 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) */
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlDocGetRootElement    (const xmlDoc *doc);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlGetLastChild         (const xmlNode *parent);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlNodeIsText           (const xmlNode *node);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlIsBlankNode          (const xmlNode *node);
 
 /*
  * Changing the structure.
  */
 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlDocSetRootElement    (xmlDocPtr doc,
                                         xmlNodePtr root);
 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */
 #ifdef LIBXML_TREE_ENABLED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlNodeSetName          (xmlNodePtr cur,
                                         const xmlChar *name);
 #endif /* LIBXML_TREE_ENABLED */
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlAddChild             (xmlNodePtr parent,
                                         xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlAddChildList         (xmlNodePtr parent,
                                         xmlNodePtr cur);
 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlReplaceNode          (xmlNodePtr old,
                                         xmlNodePtr cur);
 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */
 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
     defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlAddPrevSibling       (xmlNodePtr cur,
                                         xmlNodePtr elem);
 #endif /* LIBXML_TREE_ENABLED || LIBXML_HTML_ENABLED || LIBXML_SCHEMAS_ENABLED */
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlAddSibling           (xmlNodePtr cur,
                                         xmlNodePtr elem);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlAddNextSibling       (xmlNodePtr cur,
                                         xmlNodePtr elem);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlUnlinkNode           (xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlTextMerge            (xmlNodePtr first,
                                         xmlNodePtr second);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlTextConcat           (xmlNodePtr node,
                                         const xmlChar *content,
                                         int len);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlFreeNodeList         (xmlNodePtr cur);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlFreeNode             (xmlNodePtr cur);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSetTreeDoc           (xmlNodePtr tree,
                                         xmlDocPtr doc);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSetListDoc           (xmlNodePtr list,
                                         xmlDocPtr doc);
 /*
  * Namespaces.
  */
-XMLPUBFUN xmlNsPtr XMLCALL
+XMLPUBFUN xmlNsPtr
                xmlSearchNs             (xmlDocPtr doc,
                                         xmlNodePtr node,
                                         const xmlChar *nameSpace);
-XMLPUBFUN xmlNsPtr XMLCALL
+XMLPUBFUN xmlNsPtr
                xmlSearchNsByHref       (xmlDocPtr doc,
                                         xmlNodePtr node,
                                         const xmlChar *href);
 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || \
     defined(LIBXML_SCHEMAS_ENABLED)
-XMLPUBFUN xmlNsPtr * XMLCALL
+XMLPUBFUN xmlNsPtr *
                xmlGetNsList            (const xmlDoc *doc,
                                         const xmlNode *node);
 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) */
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSetNs                (xmlNodePtr node,
                                         xmlNsPtr ns);
-XMLPUBFUN xmlNsPtr XMLCALL
+XMLPUBFUN xmlNsPtr
                xmlCopyNamespace        (xmlNsPtr cur);
-XMLPUBFUN xmlNsPtr XMLCALL
+XMLPUBFUN xmlNsPtr
                xmlCopyNamespaceList    (xmlNsPtr cur);
 
 /*
@@ -1012,94 +1014,94 @@ XMLPUBFUN xmlNsPtr XMLCALL
  */
 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || \
     defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
-XMLPUBFUN xmlAttrPtr XMLCALL
+XMLPUBFUN xmlAttrPtr
                xmlSetProp              (xmlNodePtr node,
                                         const xmlChar *name,
                                         const xmlChar *value);
-XMLPUBFUN xmlAttrPtr XMLCALL
+XMLPUBFUN xmlAttrPtr
                xmlSetNsProp            (xmlNodePtr node,
                                         xmlNsPtr ns,
                                         const xmlChar *name,
                                         const xmlChar *value);
 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || \
          defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlGetNoNsProp          (const xmlNode *node,
                                         const xmlChar *name);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlGetProp              (const xmlNode *node,
                                         const xmlChar *name);
-XMLPUBFUN xmlAttrPtr XMLCALL
+XMLPUBFUN xmlAttrPtr
                xmlHasProp              (const xmlNode *node,
                                         const xmlChar *name);
-XMLPUBFUN xmlAttrPtr XMLCALL
+XMLPUBFUN xmlAttrPtr
                xmlHasNsProp            (const xmlNode *node,
                                         const xmlChar *name,
                                         const xmlChar *nameSpace);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlGetNsProp            (const xmlNode *node,
                                         const xmlChar *name,
                                         const xmlChar *nameSpace);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlStringGetNodeList    (const xmlDoc *doc,
                                         const xmlChar *value);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                xmlStringLenGetNodeList (const xmlDoc *doc,
                                         const xmlChar *value,
                                         int len);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlNodeListGetString    (xmlDocPtr doc,
                                         const xmlNode *list,
                                         int inLine);
 #ifdef LIBXML_TREE_ENABLED
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlNodeListGetRawString (const xmlDoc *doc,
                                         const xmlNode *list,
                                         int inLine);
 #endif /* LIBXML_TREE_ENABLED */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlNodeSetContent       (xmlNodePtr cur,
                                         const xmlChar *content);
 #ifdef LIBXML_TREE_ENABLED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlNodeSetContentLen    (xmlNodePtr cur,
                                         const xmlChar *content,
                                         int len);
 #endif /* LIBXML_TREE_ENABLED */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlNodeAddContent       (xmlNodePtr cur,
                                         const xmlChar *content);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlNodeAddContentLen    (xmlNodePtr cur,
                                         const xmlChar *content,
                                         int len);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlNodeGetContent       (const xmlNode *cur);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlNodeBufGetContent    (xmlBufferPtr buffer,
                                         const xmlNode *cur);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlBufGetNodeContent    (xmlBufPtr buf,
                                         const xmlNode *cur);
 
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlNodeGetLang          (const xmlNode *cur);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlNodeGetSpacePreserve (const xmlNode *cur);
 #ifdef LIBXML_TREE_ENABLED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlNodeSetLang          (xmlNodePtr cur,
                                         const xmlChar *lang);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlNodeSetSpacePreserve (xmlNodePtr cur,
                                         int val);
 #endif /* LIBXML_TREE_ENABLED */
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlNodeGetBase          (const xmlDoc *doc,
                                         const xmlNode *cur);
 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlNodeSetBase          (xmlNodePtr cur,
                                         const xmlChar *uri);
 #endif
@@ -1107,14 +1109,14 @@ XMLPUBFUN void XMLCALL
 /*
  * Removing content.
  */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlRemoveProp           (xmlAttrPtr cur);
 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlUnsetNsProp          (xmlNodePtr node,
                                         xmlNsPtr ns,
                                         const xmlChar *name);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlUnsetProp            (xmlNodePtr node,
                                         const xmlChar *name);
 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
@@ -1122,13 +1124,13 @@ XMLPUBFUN int XMLCALL
 /*
  * Internal, don't use.
  */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlBufferWriteCHAR      (xmlBufferPtr buf,
                                         const xmlChar *string);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlBufferWriteChar      (xmlBufferPtr buf,
                                         const char *string);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlBufferWriteQuotedString(xmlBufferPtr buf,
                                         const xmlChar *string);
 
@@ -1143,7 +1145,7 @@ XMLPUBFUN void xmlAttrSerializeTxtContent(xmlBufferPtr buf,
 /*
  * Namespace handling.
  */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlReconciliateNs       (xmlDocPtr doc,
                                         xmlNodePtr tree);
 #endif
@@ -1152,67 +1154,67 @@ XMLPUBFUN int XMLCALL
 /*
  * Saving.
  */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlDocDumpFormatMemory  (xmlDocPtr cur,
                                         xmlChar **mem,
                                         int *size,
                                         int format);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlDocDumpMemory        (xmlDocPtr cur,
                                         xmlChar **mem,
                                         int *size);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlDocDumpMemoryEnc     (xmlDocPtr out_doc,
                                         xmlChar **doc_txt_ptr,
                                         int * doc_txt_len,
                                         const char *txt_encoding);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc,
                                         xmlChar **doc_txt_ptr,
                                         int * doc_txt_len,
                                         const char *txt_encoding,
                                         int format);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlDocFormatDump        (FILE *f,
                                         xmlDocPtr cur,
                                         int format);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlDocDump              (FILE *f,
                                         xmlDocPtr cur);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlElemDump             (FILE *f,
                                         xmlDocPtr doc,
                                         xmlNodePtr cur);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSaveFile             (const char *filename,
                                         xmlDocPtr cur);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSaveFormatFile       (const char *filename,
                                         xmlDocPtr cur,
                                         int format);
-XMLPUBFUN size_t XMLCALL
+XMLPUBFUN size_t
                xmlBufNodeDump          (xmlBufPtr buf,
                                         xmlDocPtr doc,
                                         xmlNodePtr cur,
                                         int level,
                                         int format);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlNodeDump             (xmlBufferPtr buf,
                                         xmlDocPtr doc,
                                         xmlNodePtr cur,
                                         int level,
                                         int format);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSaveFileTo           (xmlOutputBufferPtr buf,
                                         xmlDocPtr cur,
                                         const char *encoding);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSaveFormatFileTo     (xmlOutputBufferPtr buf,
                                         xmlDocPtr cur,
                                         const char *encoding,
                                         int format);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlNodeDumpOutput       (xmlOutputBufferPtr buf,
                                         xmlDocPtr doc,
                                         xmlNodePtr cur,
@@ -1220,13 +1222,13 @@ XMLPUBFUN void XMLCALL
                                         int format,
                                         const char *encoding);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSaveFormatFileEnc    (const char *filename,
                                         xmlDocPtr cur,
                                         const char *encoding,
                                         int format);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSaveFileEnc          (const char *filename,
                                         xmlDocPtr cur,
                                         const char *encoding);
@@ -1235,47 +1237,47 @@ XMLPUBFUN int XMLCALL
 /*
  * XHTML
  */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlIsXHTML              (const xmlChar *systemID,
                                         const xmlChar *publicID);
 
 /*
  * Compression.
  */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlGetDocCompressMode   (const xmlDoc *doc);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSetDocCompressMode   (xmlDocPtr doc,
                                         int mode);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlGetCompressMode      (void);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSetCompressMode      (int mode);
 
 /*
 * DOM-wrapper helper functions.
 */
-XMLPUBFUN xmlDOMWrapCtxtPtr XMLCALL
+XMLPUBFUN xmlDOMWrapCtxtPtr
                xmlDOMWrapNewCtxt       (void);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlDOMWrapFreeCtxt      (xmlDOMWrapCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
            xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt,
                                         xmlNodePtr elem,
                                         int options);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
            xmlDOMWrapAdoptNode         (xmlDOMWrapCtxtPtr ctxt,
                                         xmlDocPtr sourceDoc,
                                         xmlNodePtr node,
                                         xmlDocPtr destDoc,
                                         xmlNodePtr destParent,
                                         int options);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
            xmlDOMWrapRemoveNode        (xmlDOMWrapCtxtPtr ctxt,
                                         xmlDocPtr doc,
                                         xmlNodePtr node,
                                         int options);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
            xmlDOMWrapCloneNode         (xmlDOMWrapCtxtPtr ctxt,
                                         xmlDocPtr sourceDoc,
                                         xmlNodePtr node,
@@ -1290,15 +1292,15 @@ XMLPUBFUN int XMLCALL
  * 5 interfaces from DOM ElementTraversal, but different in entities
  * traversal.
  */
-XMLPUBFUN unsigned long XMLCALL
+XMLPUBFUN unsigned long
             xmlChildElementCount        (xmlNodePtr parent);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
             xmlNextElementSibling       (xmlNodePtr node);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
             xmlFirstElementChild        (xmlNodePtr parent);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
             xmlLastElementChild         (xmlNodePtr parent);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
             xmlPreviousElementSibling   (xmlNodePtr node);
 #endif
 #ifdef __cplusplus
index db48262..0470a5d 100644 (file)
@@ -49,43 +49,43 @@ struct _xmlURI {
  * xmlChar *   xmlNodeGetBase  (xmlDocPtr doc,
  *                               xmlNodePtr cur);
  */
-XMLPUBFUN xmlURIPtr XMLCALL
+XMLPUBFUN xmlURIPtr
                xmlCreateURI            (void);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlBuildURI             (const xmlChar *URI,
                                         const xmlChar *base);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlBuildRelativeURI     (const xmlChar *URI,
                                         const xmlChar *base);
-XMLPUBFUN xmlURIPtr XMLCALL
+XMLPUBFUN xmlURIPtr
                xmlParseURI             (const char *str);
-XMLPUBFUN xmlURIPtr XMLCALL
+XMLPUBFUN xmlURIPtr
                xmlParseURIRaw          (const char *str,
                                         int raw);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlParseURIReference    (xmlURIPtr uri,
                                         const char *str);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlSaveUri              (xmlURIPtr uri);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlPrintURI             (FILE *stream,
                                         xmlURIPtr uri);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlURIEscapeStr         (const xmlChar *str,
                                         const xmlChar *list);
-XMLPUBFUN char * XMLCALL
+XMLPUBFUN char *
                xmlURIUnescapeString    (const char *str,
                                         int len,
                                         char *target);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlNormalizeURIPath     (char *path);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlURIEscape            (const xmlChar *str);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlFreeURI              (xmlURIPtr uri);
-XMLPUBFUN xmlChar* XMLCALL
+XMLPUBFUN xmlChar*
                xmlCanonicPath          (const xmlChar *path);
-XMLPUBFUN xmlChar* XMLCALL
+XMLPUBFUN xmlChar*
                xmlPathToURI            (const xmlChar *path);
 
 #ifdef __cplusplus
index 3eaf84a..b19cbac 100644 (file)
@@ -39,7 +39,7 @@ typedef xmlValidState *xmlValidStatePtr;
  * Callback called when a validity error is found. This is a message
  * oriented function similar to an *printf function.
  */
-typedef void (XMLCDECL *xmlValidityErrorFunc) (void *ctx,
+typedef void (*xmlValidityErrorFunc) (void *ctx,
                             const char *msg,
                             ...) LIBXML_ATTR_FORMAT(2,3);
 
@@ -54,25 +54,10 @@ typedef void (XMLCDECL *xmlValidityErrorFunc) (void *ctx,
  * Callback called when a validity warning is found. This is a message
  * oriented function similar to an *printf function.
  */
-typedef void (XMLCDECL *xmlValidityWarningFunc) (void *ctx,
+typedef void (*xmlValidityWarningFunc) (void *ctx,
                               const char *msg,
                               ...) LIBXML_ATTR_FORMAT(2,3);
 
-#ifdef IN_LIBXML
-/**
- * XML_VCTXT_DTD_VALIDATED:
- *
- * Set after xmlValidateDtdFinal was called.
- */
-#define XML_VCTXT_DTD_VALIDATED (1u << 0)
-/**
- * XML_VCTXT_USE_PCTXT:
- *
- * Set if the validation context is part of a parser context.
- */
-#define XML_VCTXT_USE_PCTXT (1u << 1)
-#endif
-
 /*
  * xmlValidCtxt:
  * An xmlValidCtxt is used for error reporting when validating.
@@ -150,55 +135,55 @@ typedef struct _xmlHashTable xmlRefTable;
 typedef xmlRefTable *xmlRefTablePtr;
 
 /* Notation */
-XMLPUBFUN xmlNotationPtr XMLCALL
+XMLPUBFUN xmlNotationPtr
                xmlAddNotationDecl      (xmlValidCtxtPtr ctxt,
                                         xmlDtdPtr dtd,
                                         const xmlChar *name,
                                         const xmlChar *PublicID,
                                         const xmlChar *SystemID);
 #ifdef LIBXML_TREE_ENABLED
-XMLPUBFUN xmlNotationTablePtr XMLCALL
+XMLPUBFUN xmlNotationTablePtr
                xmlCopyNotationTable    (xmlNotationTablePtr table);
 #endif /* LIBXML_TREE_ENABLED */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlFreeNotationTable    (xmlNotationTablePtr table);
 #ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlDumpNotationDecl     (xmlBufferPtr buf,
                                         xmlNotationPtr nota);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlDumpNotationTable    (xmlBufferPtr buf,
                                         xmlNotationTablePtr table);
 #endif /* LIBXML_OUTPUT_ENABLED */
 
 /* Element Content */
 /* the non Doc version are being deprecated */
-XMLPUBFUN xmlElementContentPtr XMLCALL
+XMLPUBFUN xmlElementContentPtr
                xmlNewElementContent    (const xmlChar *name,
                                         xmlElementContentType type);
-XMLPUBFUN xmlElementContentPtr XMLCALL
+XMLPUBFUN xmlElementContentPtr
                xmlCopyElementContent   (xmlElementContentPtr content);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlFreeElementContent   (xmlElementContentPtr cur);
 /* the new versions with doc argument */
-XMLPUBFUN xmlElementContentPtr XMLCALL
+XMLPUBFUN xmlElementContentPtr
                xmlNewDocElementContent (xmlDocPtr doc,
                                         const xmlChar *name,
                                         xmlElementContentType type);
-XMLPUBFUN xmlElementContentPtr XMLCALL
+XMLPUBFUN xmlElementContentPtr
                xmlCopyDocElementContent(xmlDocPtr doc,
                                         xmlElementContentPtr content);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlFreeDocElementContent(xmlDocPtr doc,
                                         xmlElementContentPtr cur);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSnprintfElementContent(char *buf,
                                         int size,
                                         xmlElementContentPtr content,
                                         int englob);
 #ifdef LIBXML_OUTPUT_ENABLED
 /* DEPRECATED */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSprintfElementContent(char *buf,
                                         xmlElementContentPtr content,
                                         int englob);
@@ -206,39 +191,39 @@ XMLPUBFUN void XMLCALL
 /* DEPRECATED */
 
 /* Element */
-XMLPUBFUN xmlElementPtr XMLCALL
+XMLPUBFUN xmlElementPtr
                xmlAddElementDecl       (xmlValidCtxtPtr ctxt,
                                         xmlDtdPtr dtd,
                                         const xmlChar *name,
                                         xmlElementTypeVal type,
                                         xmlElementContentPtr content);
 #ifdef LIBXML_TREE_ENABLED
-XMLPUBFUN xmlElementTablePtr XMLCALL
+XMLPUBFUN xmlElementTablePtr
                xmlCopyElementTable     (xmlElementTablePtr table);
 #endif /* LIBXML_TREE_ENABLED */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlFreeElementTable     (xmlElementTablePtr table);
 #ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlDumpElementTable     (xmlBufferPtr buf,
                                         xmlElementTablePtr table);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlDumpElementDecl      (xmlBufferPtr buf,
                                         xmlElementPtr elem);
 #endif /* LIBXML_OUTPUT_ENABLED */
 
 /* Enumeration */
-XMLPUBFUN xmlEnumerationPtr XMLCALL
+XMLPUBFUN xmlEnumerationPtr
                xmlCreateEnumeration    (const xmlChar *name);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlFreeEnumeration      (xmlEnumerationPtr cur);
 #ifdef LIBXML_TREE_ENABLED
-XMLPUBFUN xmlEnumerationPtr XMLCALL
+XMLPUBFUN xmlEnumerationPtr
                xmlCopyEnumeration      (xmlEnumerationPtr cur);
 #endif /* LIBXML_TREE_ENABLED */
 
 /* Attribute */
-XMLPUBFUN xmlAttributePtr XMLCALL
+XMLPUBFUN xmlAttributePtr
                xmlAddAttributeDecl     (xmlValidCtxtPtr ctxt,
                                         xmlDtdPtr dtd,
                                         const xmlChar *elem,
@@ -249,60 +234,60 @@ XMLPUBFUN xmlAttributePtr XMLCALL
                                         const xmlChar *defaultValue,
                                         xmlEnumerationPtr tree);
 #ifdef LIBXML_TREE_ENABLED
-XMLPUBFUN xmlAttributeTablePtr XMLCALL
+XMLPUBFUN xmlAttributeTablePtr
                xmlCopyAttributeTable  (xmlAttributeTablePtr table);
 #endif /* LIBXML_TREE_ENABLED */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlFreeAttributeTable  (xmlAttributeTablePtr table);
 #ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlDumpAttributeTable  (xmlBufferPtr buf,
                                        xmlAttributeTablePtr table);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlDumpAttributeDecl   (xmlBufferPtr buf,
                                        xmlAttributePtr attr);
 #endif /* LIBXML_OUTPUT_ENABLED */
 
 /* IDs */
-XMLPUBFUN xmlIDPtr XMLCALL
+XMLPUBFUN xmlIDPtr
                xmlAddID               (xmlValidCtxtPtr ctxt,
                                        xmlDocPtr doc,
                                        const xmlChar *value,
                                        xmlAttrPtr attr);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlFreeIDTable         (xmlIDTablePtr table);
-XMLPUBFUN xmlAttrPtr XMLCALL
+XMLPUBFUN xmlAttrPtr
                xmlGetID               (xmlDocPtr doc,
                                        const xmlChar *ID);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlIsID                (xmlDocPtr doc,
                                        xmlNodePtr elem,
                                        xmlAttrPtr attr);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlRemoveID            (xmlDocPtr doc,
                                        xmlAttrPtr attr);
 
 /* IDREFs */
 XML_DEPRECATED
-XMLPUBFUN xmlRefPtr XMLCALL
+XMLPUBFUN xmlRefPtr
                xmlAddRef              (xmlValidCtxtPtr ctxt,
                                        xmlDocPtr doc,
                                        const xmlChar *value,
                                        xmlAttrPtr attr);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlFreeRefTable        (xmlRefTablePtr table);
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlIsRef               (xmlDocPtr doc,
                                        xmlNodePtr elem,
                                        xmlAttrPtr attr);
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlRemoveRef           (xmlDocPtr doc,
                                        xmlAttrPtr attr);
 XML_DEPRECATED
-XMLPUBFUN xmlListPtr XMLCALL
+XMLPUBFUN xmlListPtr
                xmlGetRefs             (xmlDocPtr doc,
                                        const xmlChar *ID);
 
@@ -311,146 +296,146 @@ XMLPUBFUN xmlListPtr XMLCALL
  */
 #ifdef LIBXML_VALID_ENABLED
 /* Allocate/Release Validation Contexts */
-XMLPUBFUN xmlValidCtxtPtr XMLCALL
+XMLPUBFUN xmlValidCtxtPtr
                xmlNewValidCtxt(void);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlFreeValidCtxt(xmlValidCtxtPtr);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidateRoot         (xmlValidCtxtPtr ctxt,
                                         xmlDocPtr doc);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidateElementDecl  (xmlValidCtxtPtr ctxt,
                                         xmlDocPtr doc,
                                         xmlElementPtr elem);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlValidNormalizeAttributeValue(xmlDocPtr doc,
                                         xmlNodePtr elem,
                                         const xmlChar *name,
                                         const xmlChar *value);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt,
                                         xmlDocPtr doc,
                                         xmlNodePtr elem,
                                         const xmlChar *name,
                                         const xmlChar *value);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt,
                                         xmlDocPtr doc,
                                         xmlAttributePtr attr);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidateAttributeValue(xmlAttributeType type,
                                         const xmlChar *value);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidateNotationDecl (xmlValidCtxtPtr ctxt,
                                         xmlDocPtr doc,
                                         xmlNotationPtr nota);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidateDtd          (xmlValidCtxtPtr ctxt,
                                         xmlDocPtr doc,
                                         xmlDtdPtr dtd);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidateDtdFinal     (xmlValidCtxtPtr ctxt,
                                         xmlDocPtr doc);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidateDocument     (xmlValidCtxtPtr ctxt,
                                         xmlDocPtr doc);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidateElement      (xmlValidCtxtPtr ctxt,
                                         xmlDocPtr doc,
                                         xmlNodePtr elem);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidateOneElement   (xmlValidCtxtPtr ctxt,
                                         xmlDocPtr doc,
                                         xmlNodePtr elem);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidateOneAttribute (xmlValidCtxtPtr ctxt,
                                         xmlDocPtr doc,
                                         xmlNodePtr     elem,
                                         xmlAttrPtr attr,
                                         const xmlChar *value);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidateOneNamespace (xmlValidCtxtPtr ctxt,
                                         xmlDocPtr doc,
                                         xmlNodePtr elem,
                                         const xmlChar *prefix,
                                         xmlNsPtr ns,
                                         const xmlChar *value);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt,
                                         xmlDocPtr doc);
 #endif /* LIBXML_VALID_ENABLED */
 
 #if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidateNotationUse  (xmlValidCtxtPtr ctxt,
                                         xmlDocPtr doc,
                                         const xmlChar *notationName);
 #endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlIsMixedElement       (xmlDocPtr doc,
                                         const xmlChar *name);
-XMLPUBFUN xmlAttributePtr XMLCALL
+XMLPUBFUN xmlAttributePtr
                xmlGetDtdAttrDesc       (xmlDtdPtr dtd,
                                         const xmlChar *elem,
                                         const xmlChar *name);
-XMLPUBFUN xmlAttributePtr XMLCALL
+XMLPUBFUN xmlAttributePtr
                xmlGetDtdQAttrDesc      (xmlDtdPtr dtd,
                                         const xmlChar *elem,
                                         const xmlChar *name,
                                         const xmlChar *prefix);
-XMLPUBFUN xmlNotationPtr XMLCALL
+XMLPUBFUN xmlNotationPtr
                xmlGetDtdNotationDesc   (xmlDtdPtr dtd,
                                         const xmlChar *name);
-XMLPUBFUN xmlElementPtr XMLCALL
+XMLPUBFUN xmlElementPtr
                xmlGetDtdQElementDesc   (xmlDtdPtr dtd,
                                         const xmlChar *name,
                                         const xmlChar *prefix);
-XMLPUBFUN xmlElementPtr XMLCALL
+XMLPUBFUN xmlElementPtr
                xmlGetDtdElementDesc    (xmlDtdPtr dtd,
                                         const xmlChar *name);
 
 #ifdef LIBXML_VALID_ENABLED
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidGetPotentialChildren(xmlElementContent *ctree,
                                         const xmlChar **names,
                                         int *len,
                                         int max);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidGetValidElements(xmlNode *prev,
                                         xmlNode *next,
                                         const xmlChar **names,
                                         int max);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidateNameValue    (const xmlChar *value);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidateNamesValue   (const xmlChar *value);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidateNmtokenValue (const xmlChar *value);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidateNmtokensValue(const xmlChar *value);
 
 #ifdef LIBXML_REGEXP_ENABLED
 /*
  * Validation based on the regexp support
  */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidBuildContentModel(xmlValidCtxtPtr ctxt,
                                         xmlElementPtr elem);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidatePushElement  (xmlValidCtxtPtr ctxt,
                                         xmlDocPtr doc,
                                         xmlNodePtr elem,
                                         const xmlChar *qname);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidatePushCData    (xmlValidCtxtPtr ctxt,
                                         const xmlChar *data,
                                         int len);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlValidatePopElement   (xmlValidCtxtPtr ctxt,
                                         xmlDocPtr doc,
                                         xmlNodePtr elem,
index 863ab25..e1d135b 100644 (file)
@@ -89,35 +89,35 @@ typedef xmlXIncludeCtxt *xmlXIncludeCtxtPtr;
 /*
  * standalone processing
  */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlXIncludeProcess      (xmlDocPtr doc);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlXIncludeProcessFlags (xmlDocPtr doc,
                                         int flags);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlXIncludeProcessFlagsData(xmlDocPtr doc,
                                         int flags,
                                         void *data);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                 xmlXIncludeProcessTreeFlagsData(xmlNodePtr tree,
                                          int flags,
                                          void *data);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlXIncludeProcessTree  (xmlNodePtr tree);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlXIncludeProcessTreeFlags(xmlNodePtr tree,
                                         int flags);
 /*
  * contextual processing
  */
-XMLPUBFUN xmlXIncludeCtxtPtr XMLCALL
+XMLPUBFUN xmlXIncludeCtxtPtr
                xmlXIncludeNewContext   (xmlDocPtr doc);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlXIncludeSetFlags     (xmlXIncludeCtxtPtr ctxt,
                                         int flags);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlXIncludeFreeContext  (xmlXIncludeCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlXIncludeProcessNode  (xmlXIncludeCtxtPtr ctxt,
                                         xmlNodePtr tree);
 #ifdef __cplusplus
index 04e4b32..1065736 100644 (file)
@@ -160,23 +160,23 @@ struct _xlinkHandler {
  * detection callbacks.
  */
 
-XMLPUBFUN xlinkNodeDetectFunc XMLCALL
+XMLPUBFUN xlinkNodeDetectFunc
                xlinkGetDefaultDetect   (void);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xlinkSetDefaultDetect   (xlinkNodeDetectFunc func);
 
 /*
  * Routines to set/get the default handlers.
  */
-XMLPUBFUN xlinkHandlerPtr XMLCALL
+XMLPUBFUN xlinkHandlerPtr
                xlinkGetDefaultHandler  (void);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xlinkSetDefaultHandler  (xlinkHandlerPtr handler);
 
 /*
  * Link detection module itself.
  */
-XMLPUBFUN xlinkType XMLCALL
+XMLPUBFUN xlinkType
                xlinkIsLink             (xmlDocPtr doc,
                                         xmlNodePtr node);
 
index 095b2f5..55d25ed 100644 (file)
@@ -31,7 +31,7 @@ extern "C" {
  *
  * Returns 1 if yes and 0 if another Input module should be used
  */
-typedef int (XMLCALL *xmlInputMatchCallback) (char const *filename);
+typedef int (*xmlInputMatchCallback) (char const *filename);
 /**
  * xmlInputOpenCallback:
  * @filename: the filename or URI
@@ -40,7 +40,7 @@ typedef int (XMLCALL *xmlInputMatchCallback) (char const *filename);
  *
  * Returns an Input context or NULL in case or error
  */
-typedef void * (XMLCALL *xmlInputOpenCallback) (char const *filename);
+typedef void * (*xmlInputOpenCallback) (char const *filename);
 /**
  * xmlInputReadCallback:
  * @context:  an Input context
@@ -51,7 +51,7 @@ typedef void * (XMLCALL *xmlInputOpenCallback) (char const *filename);
  *
  * Returns the number of bytes read or -1 in case of error
  */
-typedef int (XMLCALL *xmlInputReadCallback) (void * context, char * buffer, int len);
+typedef int (*xmlInputReadCallback) (void * context, char * buffer, int len);
 /**
  * xmlInputCloseCallback:
  * @context:  an Input context
@@ -60,7 +60,7 @@ typedef int (XMLCALL *xmlInputReadCallback) (void * context, char * buffer, int
  *
  * Returns 0 or -1 in case of error
  */
-typedef int (XMLCALL *xmlInputCloseCallback) (void * context);
+typedef int (*xmlInputCloseCallback) (void * context);
 
 #ifdef LIBXML_OUTPUT_ENABLED
 /*
@@ -77,7 +77,7 @@ typedef int (XMLCALL *xmlInputCloseCallback) (void * context);
  *
  * Returns 1 if yes and 0 if another Output module should be used
  */
-typedef int (XMLCALL *xmlOutputMatchCallback) (char const *filename);
+typedef int (*xmlOutputMatchCallback) (char const *filename);
 /**
  * xmlOutputOpenCallback:
  * @filename: the filename or URI
@@ -86,7 +86,7 @@ typedef int (XMLCALL *xmlOutputMatchCallback) (char const *filename);
  *
  * Returns an Output context or NULL in case or error
  */
-typedef void * (XMLCALL *xmlOutputOpenCallback) (char const *filename);
+typedef void * (*xmlOutputOpenCallback) (char const *filename);
 /**
  * xmlOutputWriteCallback:
  * @context:  an Output context
@@ -97,7 +97,7 @@ typedef void * (XMLCALL *xmlOutputOpenCallback) (char const *filename);
  *
  * Returns the number of bytes written or -1 in case of error
  */
-typedef int (XMLCALL *xmlOutputWriteCallback) (void * context, const char * buffer,
+typedef int (*xmlOutputWriteCallback) (void * context, const char * buffer,
                                        int len);
 /**
  * xmlOutputCloseCallback:
@@ -107,7 +107,7 @@ typedef int (XMLCALL *xmlOutputWriteCallback) (void * context, const char * buff
  *
  * Returns 0 or -1 in case of error
  */
-typedef int (XMLCALL *xmlOutputCloseCallback) (void * context);
+typedef int (*xmlOutputCloseCallback) (void * context);
 #endif /* LIBXML_OUTPUT_ENABLED */
 
 #ifdef __cplusplus
@@ -155,53 +155,54 @@ struct _xmlOutputBuffer {
 /*
  * Interfaces for input
  */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlCleanupInputCallbacks                (void);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlPopInputCallbacks                    (void);
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlRegisterDefaultInputCallbacks        (void);
-XMLPUBFUN xmlParserInputBufferPtr XMLCALL
+XMLPUBFUN xmlParserInputBufferPtr
        xmlAllocParserInputBuffer               (xmlCharEncoding enc);
 
-XMLPUBFUN xmlParserInputBufferPtr XMLCALL
+XMLPUBFUN xmlParserInputBufferPtr
        xmlParserInputBufferCreateFilename      (const char *URI,
                                                  xmlCharEncoding enc);
-XMLPUBFUN xmlParserInputBufferPtr XMLCALL
+XMLPUBFUN xmlParserInputBufferPtr
        xmlParserInputBufferCreateFile          (FILE *file,
                                                  xmlCharEncoding enc);
-XMLPUBFUN xmlParserInputBufferPtr XMLCALL
+XMLPUBFUN xmlParserInputBufferPtr
        xmlParserInputBufferCreateFd            (int fd,
                                                 xmlCharEncoding enc);
-XMLPUBFUN xmlParserInputBufferPtr XMLCALL
+XMLPUBFUN xmlParserInputBufferPtr
        xmlParserInputBufferCreateMem           (const char *mem, int size,
                                                 xmlCharEncoding enc);
-XMLPUBFUN xmlParserInputBufferPtr XMLCALL
+XML_DEPRECATED
+XMLPUBFUN xmlParserInputBufferPtr
        xmlParserInputBufferCreateStatic        (const char *mem, int size,
                                                 xmlCharEncoding enc);
-XMLPUBFUN xmlParserInputBufferPtr XMLCALL
+XMLPUBFUN xmlParserInputBufferPtr
        xmlParserInputBufferCreateIO            (xmlInputReadCallback   ioread,
                                                 xmlInputCloseCallback  ioclose,
                                                 void *ioctx,
                                                 xmlCharEncoding enc);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlParserInputBufferRead                (xmlParserInputBufferPtr in,
                                                 int len);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlParserInputBufferGrow                (xmlParserInputBufferPtr in,
                                                 int len);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlParserInputBufferPush                (xmlParserInputBufferPtr in,
                                                 int len,
                                                 const char *buf);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlFreeParserInputBuffer                (xmlParserInputBufferPtr in);
-XMLPUBFUN char * XMLCALL
+XMLPUBFUN char *
        xmlParserGetDirectory                   (const char *filename);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlRegisterInputCallbacks               (xmlInputMatchCallback matchFunc,
                                                 xmlInputOpenCallback openFunc,
                                                 xmlInputReadCallback readFunc,
@@ -215,62 +216,62 @@ xmlParserInputBufferPtr
 /*
  * Interfaces for output
  */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlCleanupOutputCallbacks               (void);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlPopOutputCallbacks                   (void);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlRegisterDefaultOutputCallbacks(void);
-XMLPUBFUN xmlOutputBufferPtr XMLCALL
+XMLPUBFUN xmlOutputBufferPtr
        xmlAllocOutputBuffer            (xmlCharEncodingHandlerPtr encoder);
 
-XMLPUBFUN xmlOutputBufferPtr XMLCALL
+XMLPUBFUN xmlOutputBufferPtr
        xmlOutputBufferCreateFilename   (const char *URI,
                                         xmlCharEncodingHandlerPtr encoder,
                                         int compression);
 
-XMLPUBFUN xmlOutputBufferPtr XMLCALL
+XMLPUBFUN xmlOutputBufferPtr
        xmlOutputBufferCreateFile       (FILE *file,
                                         xmlCharEncodingHandlerPtr encoder);
 
-XMLPUBFUN xmlOutputBufferPtr XMLCALL
+XMLPUBFUN xmlOutputBufferPtr
        xmlOutputBufferCreateBuffer     (xmlBufferPtr buffer,
                                         xmlCharEncodingHandlerPtr encoder);
 
-XMLPUBFUN xmlOutputBufferPtr XMLCALL
+XMLPUBFUN xmlOutputBufferPtr
        xmlOutputBufferCreateFd         (int fd,
                                         xmlCharEncodingHandlerPtr encoder);
 
-XMLPUBFUN xmlOutputBufferPtr XMLCALL
+XMLPUBFUN xmlOutputBufferPtr
        xmlOutputBufferCreateIO         (xmlOutputWriteCallback   iowrite,
                                         xmlOutputCloseCallback  ioclose,
                                         void *ioctx,
                                         xmlCharEncodingHandlerPtr encoder);
 
 /* Couple of APIs to get the output without digging into the buffers */
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
         xmlOutputBufferGetContent       (xmlOutputBufferPtr out);
-XMLPUBFUN size_t XMLCALL
+XMLPUBFUN size_t
         xmlOutputBufferGetSize          (xmlOutputBufferPtr out);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlOutputBufferWrite            (xmlOutputBufferPtr out,
                                         int len,
                                         const char *buf);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlOutputBufferWriteString      (xmlOutputBufferPtr out,
                                         const char *str);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlOutputBufferWriteEscape      (xmlOutputBufferPtr out,
                                         const xmlChar *str,
                                         xmlCharEncodingOutputFunc escaping);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlOutputBufferFlush            (xmlOutputBufferPtr out);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlOutputBufferClose            (xmlOutputBufferPtr out);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlRegisterOutputCallbacks      (xmlOutputMatchCallback matchFunc,
                                         xmlOutputOpenCallback openFunc,
                                         xmlOutputWriteCallback writeFunc,
@@ -283,20 +284,20 @@ xmlOutputBufferPtr
 
 #ifdef LIBXML_HTTP_ENABLED
 /*  This function only exists if HTTP support built into the library  */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlRegisterHTTPPostCallbacks    (void );
 #endif /* LIBXML_HTTP_ENABLED */
 
 #endif /* LIBXML_OUTPUT_ENABLED */
 
-XMLPUBFUN xmlParserInputPtr XMLCALL
+XMLPUBFUN xmlParserInputPtr
        xmlCheckHTTPInput               (xmlParserCtxtPtr ctxt,
                                         xmlParserInputPtr ret);
 
 /*
  * A predefined entity loader disabling network accesses
  */
-XMLPUBFUN xmlParserInputPtr XMLCALL
+XMLPUBFUN xmlParserInputPtr
        xmlNoNetExternalEntityLoader    (const char *URL,
                                         const char *ID,
                                         xmlParserCtxtPtr ctxt);
@@ -305,43 +306,43 @@ XMLPUBFUN xmlParserInputPtr XMLCALL
  * xmlNormalizeWindowsPath is obsolete, don't use it.
  * Check xmlCanonicPath in uri.h for a better alternative.
  */
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
        xmlNormalizeWindowsPath         (const xmlChar *path);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlCheckFilename                (const char *path);
 /**
  * Default 'file://' protocol callbacks
  */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlFileMatch                    (const char *filename);
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
        xmlFileOpen                     (const char *filename);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlFileRead                     (void * context,
                                         char * buffer,
                                         int len);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlFileClose                    (void * context);
 
 /**
  * Default 'http://' protocol callbacks
  */
 #ifdef LIBXML_HTTP_ENABLED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlIOHTTPMatch                  (const char *filename);
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
        xmlIOHTTPOpen                   (const char *filename);
 #ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
        xmlIOHTTPOpenW                  (const char * post_uri,
                                         int   compression );
 #endif /* LIBXML_OUTPUT_ENABLED */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlIOHTTPRead                   (void * context,
                                         char * buffer,
                                         int len);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlIOHTTPClose                  (void * context);
 #endif /* LIBXML_HTTP_ENABLED */
 
@@ -349,15 +350,15 @@ XMLPUBFUN int XMLCALL
  * Default 'ftp://' protocol callbacks
  */
 #ifdef LIBXML_FTP_ENABLED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlIOFTPMatch                   (const char *filename);
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
        xmlIOFTPOpen                    (const char *filename);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlIOFTPRead                    (void * context,
                                         char * buffer,
                                         int len);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlIOFTPClose                   (void * context);
 #endif /* LIBXML_FTP_ENABLED */
 
index bf1b131..ea38eb3 100644 (file)
 #define __XML_AUTOMATA_H__
 
 #include <libxml/xmlversion.h>
-#include <libxml/tree.h>
 
 #ifdef LIBXML_REGEXP_ENABLED
 #ifdef LIBXML_AUTOMATA_ENABLED
-#include <libxml/xmlregexp.h>
+
+#include <libxml/xmlstring.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -40,32 +40,32 @@ typedef xmlAutomataState *xmlAutomataStatePtr;
 /*
  * Building API
  */
-XMLPUBFUN xmlAutomataPtr XMLCALL
+XMLPUBFUN xmlAutomataPtr
                    xmlNewAutomata              (void);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                    xmlFreeAutomata             (xmlAutomataPtr am);
 
-XMLPUBFUN xmlAutomataStatePtr XMLCALL
+XMLPUBFUN xmlAutomataStatePtr
                    xmlAutomataGetInitState     (xmlAutomataPtr am);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlAutomataSetFinalState    (xmlAutomataPtr am,
                                                 xmlAutomataStatePtr state);
-XMLPUBFUN xmlAutomataStatePtr XMLCALL
+XMLPUBFUN xmlAutomataStatePtr
                    xmlAutomataNewState         (xmlAutomataPtr am);
-XMLPUBFUN xmlAutomataStatePtr XMLCALL
+XMLPUBFUN xmlAutomataStatePtr
                    xmlAutomataNewTransition    (xmlAutomataPtr am,
                                                 xmlAutomataStatePtr from,
                                                 xmlAutomataStatePtr to,
                                                 const xmlChar *token,
                                                 void *data);
-XMLPUBFUN xmlAutomataStatePtr XMLCALL
+XMLPUBFUN xmlAutomataStatePtr
                    xmlAutomataNewTransition2   (xmlAutomataPtr am,
                                                 xmlAutomataStatePtr from,
                                                 xmlAutomataStatePtr to,
                                                 const xmlChar *token,
                                                 const xmlChar *token2,
                                                 void *data);
-XMLPUBFUN xmlAutomataStatePtr XMLCALL
+XMLPUBFUN xmlAutomataStatePtr
                     xmlAutomataNewNegTrans     (xmlAutomataPtr am,
                                                 xmlAutomataStatePtr from,
                                                 xmlAutomataStatePtr to,
@@ -73,7 +73,7 @@ XMLPUBFUN xmlAutomataStatePtr XMLCALL
                                                 const xmlChar *token2,
                                                 void *data);
 
-XMLPUBFUN xmlAutomataStatePtr XMLCALL
+XMLPUBFUN xmlAutomataStatePtr
                    xmlAutomataNewCountTrans    (xmlAutomataPtr am,
                                                 xmlAutomataStatePtr from,
                                                 xmlAutomataStatePtr to,
@@ -81,7 +81,7 @@ XMLPUBFUN xmlAutomataStatePtr XMLCALL
                                                 int min,
                                                 int max,
                                                 void *data);
-XMLPUBFUN xmlAutomataStatePtr XMLCALL
+XMLPUBFUN xmlAutomataStatePtr
                    xmlAutomataNewCountTrans2   (xmlAutomataPtr am,
                                                 xmlAutomataStatePtr from,
                                                 xmlAutomataStatePtr to,
@@ -90,7 +90,7 @@ XMLPUBFUN xmlAutomataStatePtr XMLCALL
                                                 int min,
                                                 int max,
                                                 void *data);
-XMLPUBFUN xmlAutomataStatePtr XMLCALL
+XMLPUBFUN xmlAutomataStatePtr
                    xmlAutomataNewOnceTrans     (xmlAutomataPtr am,
                                                 xmlAutomataStatePtr from,
                                                 xmlAutomataStatePtr to,
@@ -98,7 +98,7 @@ XMLPUBFUN xmlAutomataStatePtr XMLCALL
                                                 int min,
                                                 int max,
                                                 void *data);
-XMLPUBFUN xmlAutomataStatePtr XMLCALL
+XMLPUBFUN xmlAutomataStatePtr
                    xmlAutomataNewOnceTrans2    (xmlAutomataPtr am,
                                                 xmlAutomataStatePtr from,
                                                 xmlAutomataStatePtr to,
@@ -107,33 +107,33 @@ XMLPUBFUN xmlAutomataStatePtr XMLCALL
                                                 int min,
                                                 int max,
                                                 void *data);
-XMLPUBFUN xmlAutomataStatePtr XMLCALL
+XMLPUBFUN xmlAutomataStatePtr
                    xmlAutomataNewAllTrans      (xmlAutomataPtr am,
                                                 xmlAutomataStatePtr from,
                                                 xmlAutomataStatePtr to,
                                                 int lax);
-XMLPUBFUN xmlAutomataStatePtr XMLCALL
+XMLPUBFUN xmlAutomataStatePtr
                    xmlAutomataNewEpsilon       (xmlAutomataPtr am,
                                                 xmlAutomataStatePtr from,
                                                 xmlAutomataStatePtr to);
-XMLPUBFUN xmlAutomataStatePtr XMLCALL
+XMLPUBFUN xmlAutomataStatePtr
                    xmlAutomataNewCountedTrans  (xmlAutomataPtr am,
                                                 xmlAutomataStatePtr from,
                                                 xmlAutomataStatePtr to,
                                                 int counter);
-XMLPUBFUN xmlAutomataStatePtr XMLCALL
+XMLPUBFUN xmlAutomataStatePtr
                    xmlAutomataNewCounterTrans  (xmlAutomataPtr am,
                                                 xmlAutomataStatePtr from,
                                                 xmlAutomataStatePtr to,
                                                 int counter);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlAutomataNewCounter       (xmlAutomataPtr am,
                                                 int min,
                                                 int max);
 
-XMLPUBFUN xmlRegexpPtr XMLCALL
+XMLPUBFUN struct _xmlRegexp *
                    xmlAutomataCompile          (xmlAutomataPtr am);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlAutomataIsDeterminist    (xmlAutomataPtr am);
 
 #ifdef __cplusplus
index ee95be9..830b4a6 100644 (file)
@@ -844,7 +844,7 @@ typedef enum {
  * Signature of the function to use when there is an error and
  * no parsing or validity context available .
  */
-typedef void (XMLCDECL *xmlGenericErrorFunc) (void *ctx,
+typedef void (*xmlGenericErrorFunc) (void *ctx,
                                 const char *msg,
                                 ...) LIBXML_ATTR_FORMAT(2,3);
 /**
@@ -855,92 +855,64 @@ typedef void (XMLCDECL *xmlGenericErrorFunc) (void *ctx,
  * Signature of the function to use when there is an error and
  * the module handles the new error reporting mechanism.
  */
-typedef void (XMLCALL *xmlStructuredErrorFunc) (void *userData, xmlErrorPtr error);
+typedef void (*xmlStructuredErrorFunc) (void *userData, xmlErrorPtr error);
 
 /*
  * Use the following function to reset the two global variables
  * xmlGenericError and xmlGenericErrorContext.
  */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
     xmlSetGenericErrorFunc     (void *ctx,
                                 xmlGenericErrorFunc handler);
-XMLPUBFUN void XMLCALL
+XML_DEPRECATED
+XMLPUBFUN void
     initGenericErrorDefaultFunc        (xmlGenericErrorFunc *handler);
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
     xmlSetStructuredErrorFunc  (void *ctx,
                                 xmlStructuredErrorFunc handler);
 /*
  * Default message routines used by SAX and Valid context for error
  * and warning reporting.
  */
-XMLPUBFUN void XMLCDECL
+XMLPUBFUN void
     xmlParserError             (void *ctx,
                                 const char *msg,
                                 ...) LIBXML_ATTR_FORMAT(2,3);
-XMLPUBFUN void XMLCDECL
+XMLPUBFUN void
     xmlParserWarning           (void *ctx,
                                 const char *msg,
                                 ...) LIBXML_ATTR_FORMAT(2,3);
-XMLPUBFUN void XMLCDECL
+XMLPUBFUN void
     xmlParserValidityError     (void *ctx,
                                 const char *msg,
                                 ...) LIBXML_ATTR_FORMAT(2,3);
-XMLPUBFUN void XMLCDECL
+XMLPUBFUN void
     xmlParserValidityWarning   (void *ctx,
                                 const char *msg,
                                 ...) LIBXML_ATTR_FORMAT(2,3);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
     xmlParserPrintFileInfo     (xmlParserInputPtr input);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
     xmlParserPrintFileContext  (xmlParserInputPtr input);
 
 /*
  * Extended error information routines
  */
-XMLPUBFUN xmlErrorPtr XMLCALL
+XMLPUBFUN xmlErrorPtr
     xmlGetLastError            (void);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
     xmlResetLastError          (void);
-XMLPUBFUN xmlErrorPtr XMLCALL
+XMLPUBFUN xmlErrorPtr
     xmlCtxtGetLastError                (void *ctx);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
     xmlCtxtResetLastError      (void *ctx);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
     xmlResetError              (xmlErrorPtr err);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
     xmlCopyError               (xmlErrorPtr from,
                                 xmlErrorPtr to);
 
-#ifdef IN_LIBXML
-/*
- * Internal callback reporting routine
- */
-XMLPUBFUN void XMLCALL
-    __xmlRaiseError            (xmlStructuredErrorFunc schannel,
-                                xmlGenericErrorFunc channel,
-                                void *data,
-                                 void *ctx,
-                                void *node,
-                                int domain,
-                                int code,
-                                xmlErrorLevel level,
-                                const char *file,
-                                int line,
-                                const char *str1,
-                                const char *str2,
-                                const char *str3,
-                                int int1,
-                                int col,
-                                const char *msg,
-                                ...) LIBXML_ATTR_FORMAT(16,17);
-XMLPUBFUN void XMLCALL
-    __xmlSimpleError           (int domain,
-                                int code,
-                                xmlNodePtr node,
-                                const char *msg,
-                                const char *extra) LIBXML_ATTR_FORMAT(4,0);
-#endif
 #ifdef __cplusplus
 }
 #endif
index aceede5..3b063e7 100644 (file)
@@ -8,50 +8,19 @@
 #ifndef __XML_EXPORTS_H__
 #define __XML_EXPORTS_H__
 
-#if defined(_WIN32) || defined(__CYGWIN__)
 /** DOC_DISABLE */
-
-#ifdef LIBXML_STATIC
-  #define XMLPUBLIC
-#elif defined(IN_LIBXML)
-  #define XMLPUBLIC __declspec(dllexport)
-#else
-  #define XMLPUBLIC __declspec(dllimport)
-#endif
-
-#if defined(LIBXML_FASTCALL)
-  #define XMLCALL __fastcall
-#else
-  #define XMLCALL __cdecl
-#endif
-#define XMLCDECL __cdecl
-
-/** DOC_ENABLE */
+#if defined(_WIN32) || defined(__CYGWIN__)
+  #ifdef LIBXML_STATIC
+    #define XMLPUBLIC
+  #elif defined(IN_LIBXML)
+    #define XMLPUBLIC __declspec(dllexport)
+  #else
+    #define XMLPUBLIC __declspec(dllimport)
+  #endif
 #else /* not Windows */
-
-/**
- * XMLPUBLIC:
- *
- * Macro which declares a public symbol
- */
-#define XMLPUBLIC
-
-/**
- * XMLCALL:
- *
- * Macro which declares the calling convention for exported functions
- */
-#define XMLCALL
-
-/**
- * XMLCDECL:
- *
- * Macro which declares the calling convention for exported functions that
- * use '...'.
- */
-#define XMLCDECL
-
+  #define XMLPUBLIC
 #endif /* platform switch */
+/** DOC_ENABLE */
 
 /*
  * XMLPUBFUN:
  */
 #define XMLPUBVAR XMLPUBLIC extern
 
+/** DOC_DISABLE */
 /* Compatibility */
+#define XMLCALL
+#define XMLCDECL
 #if !defined(LIBXML_DLL_IMPORT)
 #define LIBXML_DLL_IMPORT XMLPUBVAR
 #endif
+/** DOC_ENABLE */
 
 #endif /* __XML_EXPORTS_H__ */
 
index ae2a427..830933a 100644 (file)
@@ -54,7 +54,7 @@ extern "C" {
  *
  * Signature for a free() implementation.
  */
-typedef void (XMLCALL *xmlFreeFunc)(void *mem);
+typedef void (*xmlFreeFunc)(void *mem);
 /**
  * xmlMallocFunc:
  * @size:  the size requested in bytes
@@ -63,7 +63,7 @@ typedef void (XMLCALL *xmlFreeFunc)(void *mem);
  *
  * Returns a pointer to the newly allocated block or NULL in case of error.
  */
-typedef void *(LIBXML_ATTR_ALLOC_SIZE(1) XMLCALL *xmlMallocFunc)(size_t size);
+typedef void *(LIBXML_ATTR_ALLOC_SIZE(1) *xmlMallocFunc)(size_t size);
 
 /**
  * xmlReallocFunc:
@@ -74,7 +74,7 @@ typedef void *(LIBXML_ATTR_ALLOC_SIZE(1) XMLCALL *xmlMallocFunc)(size_t size);
  *
  * Returns a pointer to the newly reallocated block or NULL in case of error.
  */
-typedef void *(XMLCALL *xmlReallocFunc)(void *mem, size_t size);
+typedef void *(*xmlReallocFunc)(void *mem, size_t size);
 
 /**
  * xmlStrdupFunc:
@@ -84,7 +84,7 @@ typedef void *(XMLCALL *xmlReallocFunc)(void *mem, size_t size);
  *
  * Returns the copy of the string or NULL in case of error.
  */
-typedef char *(XMLCALL *xmlStrdupFunc)(const char *str);
+typedef char *(*xmlStrdupFunc)(const char *str);
 
 /*
  * The 4 interfaces used for all memory handling within libxml.
@@ -100,23 +100,23 @@ LIBXML_DLL_IMPORT xmlStrdupFunc xmlMemStrdup;
  * The xmlGc function have an extra entry for atomic block
  * allocations useful for garbage collected memory allocators
  */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlMemSetup     (xmlFreeFunc freeFunc,
                         xmlMallocFunc mallocFunc,
                         xmlReallocFunc reallocFunc,
                         xmlStrdupFunc strdupFunc);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlMemGet       (xmlFreeFunc *freeFunc,
                         xmlMallocFunc *mallocFunc,
                         xmlReallocFunc *reallocFunc,
                         xmlStrdupFunc *strdupFunc);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlGcMemSetup   (xmlFreeFunc freeFunc,
                         xmlMallocFunc mallocFunc,
                         xmlMallocFunc mallocAtomicFunc,
                         xmlReallocFunc reallocFunc,
                         xmlStrdupFunc strdupFunc);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlGcMemGet     (xmlFreeFunc *freeFunc,
                         xmlMallocFunc *mallocFunc,
                         xmlMallocFunc *mallocAtomicFunc,
@@ -127,45 +127,47 @@ XMLPUBFUN int XMLCALL
  * Initialization of the memory layer.
  */
 XML_DEPRECATED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlInitMemory   (void);
 
 /*
  * Cleanup of the memory layer.
  */
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                 xmlCleanupMemory        (void);
 /*
  * These are specific to the XML debug memory wrapper.
  */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN size_t
+       xmlMemSize      (void *ptr);
+XMLPUBFUN int
        xmlMemUsed      (void);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
        xmlMemBlocks    (void);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlMemDisplay   (FILE *fp);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlMemDisplayLast(FILE *fp, long nbBytes);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlMemShow      (FILE *fp, int nr);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlMemoryDump   (void);
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
        xmlMemMalloc    (size_t size) LIBXML_ATTR_ALLOC_SIZE(1);
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
        xmlMemRealloc   (void *ptr,size_t size);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlMemFree      (void *ptr);
-XMLPUBFUN char * XMLCALL
+XMLPUBFUN char *
        xmlMemoryStrdup (const char *str);
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
        xmlMallocLoc    (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1);
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
        xmlReallocLoc   (void *ptr, size_t size, const char *file, int line);
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
        xmlMallocAtomicLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1);
-XMLPUBFUN char * XMLCALL
+XMLPUBFUN char *
        xmlMemStrdupLoc (const char *str, const char *file, int line);
 
 
index 9667820..279986c 100644 (file)
@@ -37,16 +37,16 @@ typedef enum {
     XML_MODULE_LOCAL= 2                /* local binding */
 } xmlModuleOption;
 
-XMLPUBFUN xmlModulePtr XMLCALL xmlModuleOpen   (const char *filename,
+XMLPUBFUN xmlModulePtr xmlModuleOpen   (const char *filename,
                                                 int options);
 
-XMLPUBFUN int XMLCALL xmlModuleSymbol          (xmlModulePtr module,
+XMLPUBFUN int xmlModuleSymbol          (xmlModulePtr module,
                                                 const char* name,
                                                 void **result);
 
-XMLPUBFUN int XMLCALL xmlModuleClose           (xmlModulePtr module);
+XMLPUBFUN int xmlModuleClose           (xmlModulePtr module);
 
-XMLPUBFUN int XMLCALL xmlModuleFree            (xmlModulePtr module);
+XMLPUBFUN int xmlModuleFree            (xmlModulePtr module);
 
 #ifdef __cplusplus
 }
index e8a8bcc..1ac1510 100644 (file)
@@ -108,16 +108,16 @@ typedef xmlTextReader *xmlTextReaderPtr;
 /*
  * Constructors & Destructor
  */
-XMLPUBFUN xmlTextReaderPtr XMLCALL
+XMLPUBFUN xmlTextReaderPtr
                        xmlNewTextReader        (xmlParserInputBufferPtr input,
                                                 const char *URI);
-XMLPUBFUN xmlTextReaderPtr XMLCALL
+XMLPUBFUN xmlTextReaderPtr
                        xmlNewTextReaderFilename(const char *URI);
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlFreeTextReader       (xmlTextReaderPtr reader);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
             xmlTextReaderSetup(xmlTextReaderPtr reader,
                    xmlParserInputBufferPtr input, const char *URL,
                    const char *encoding, int options);
@@ -125,222 +125,222 @@ XMLPUBFUN int XMLCALL
 /*
  * Iterators
  */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlTextReaderRead       (xmlTextReaderPtr reader);
 
 #ifdef LIBXML_WRITER_ENABLED
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                        xmlTextReaderReadInnerXml(xmlTextReaderPtr reader);
 
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                        xmlTextReaderReadOuterXml(xmlTextReaderPtr reader);
 #endif
 
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                        xmlTextReaderReadString (xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlTextReaderReadAttributeValue(xmlTextReaderPtr reader);
 
 /*
  * Attributes of the node
  */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlTextReaderAttributeCount(xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlTextReaderDepth      (xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlTextReaderHasAttributes(xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlTextReaderHasValue(xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlTextReaderIsDefault  (xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlTextReaderNodeType   (xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlTextReaderQuoteChar  (xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlTextReaderReadState  (xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                         xmlTextReaderIsNamespaceDecl(xmlTextReaderPtr reader);
 
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                    xmlTextReaderConstBaseUri   (xmlTextReaderPtr reader);
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                    xmlTextReaderConstLocalName (xmlTextReaderPtr reader);
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                    xmlTextReaderConstName      (xmlTextReaderPtr reader);
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                    xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader);
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                    xmlTextReaderConstPrefix    (xmlTextReaderPtr reader);
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                    xmlTextReaderConstXmlLang   (xmlTextReaderPtr reader);
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                    xmlTextReaderConstString    (xmlTextReaderPtr reader,
                                                 const xmlChar *str);
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                    xmlTextReaderConstValue     (xmlTextReaderPtr reader);
 
 /*
  * use the Const version of the routine for
  * better performance and simpler code
  */
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                        xmlTextReaderBaseUri    (xmlTextReaderPtr reader);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                        xmlTextReaderLocalName  (xmlTextReaderPtr reader);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                        xmlTextReaderName       (xmlTextReaderPtr reader);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                        xmlTextReaderNamespaceUri(xmlTextReaderPtr reader);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                        xmlTextReaderPrefix     (xmlTextReaderPtr reader);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                        xmlTextReaderXmlLang    (xmlTextReaderPtr reader);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                        xmlTextReaderValue      (xmlTextReaderPtr reader);
 
 /*
  * Methods of the XmlTextReader
  */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlTextReaderClose          (xmlTextReaderPtr reader);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                    xmlTextReaderGetAttributeNo (xmlTextReaderPtr reader,
                                                 int no);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                    xmlTextReaderGetAttribute   (xmlTextReaderPtr reader,
                                                 const xmlChar *name);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                    xmlTextReaderGetAttributeNs (xmlTextReaderPtr reader,
                                                 const xmlChar *localName,
                                                 const xmlChar *namespaceURI);
-XMLPUBFUN xmlParserInputBufferPtr XMLCALL
+XMLPUBFUN xmlParserInputBufferPtr
                    xmlTextReaderGetRemainder   (xmlTextReaderPtr reader);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                    xmlTextReaderLookupNamespace(xmlTextReaderPtr reader,
                                                 const xmlChar *prefix);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlTextReaderMoveToAttributeNo(xmlTextReaderPtr reader,
                                                 int no);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlTextReaderMoveToAttribute(xmlTextReaderPtr reader,
                                                 const xmlChar *name);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlTextReaderMoveToAttributeNs(xmlTextReaderPtr reader,
                                                 const xmlChar *localName,
                                                 const xmlChar *namespaceURI);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlTextReaderMoveToFirstAttribute(xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlTextReaderMoveToNextAttribute(xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlTextReaderMoveToElement  (xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlTextReaderNormalization  (xmlTextReaderPtr reader);
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                    xmlTextReaderConstEncoding  (xmlTextReaderPtr reader);
 
 /*
  * Extensions
  */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlTextReaderSetParserProp  (xmlTextReaderPtr reader,
                                                 int prop,
                                                 int value);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlTextReaderGetParserProp  (xmlTextReaderPtr reader,
                                                 int prop);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                    xmlTextReaderCurrentNode    (xmlTextReaderPtr reader);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
             xmlTextReaderGetParserLineNumber(xmlTextReaderPtr reader);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
             xmlTextReaderGetParserColumnNumber(xmlTextReaderPtr reader);
 
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                    xmlTextReaderPreserve       (xmlTextReaderPtr reader);
 #ifdef LIBXML_PATTERN_ENABLED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlTextReaderPreservePattern(xmlTextReaderPtr reader,
                                                 const xmlChar *pattern,
                                                 const xmlChar **namespaces);
 #endif /* LIBXML_PATTERN_ENABLED */
-XMLPUBFUN xmlDocPtr XMLCALL
+XMLPUBFUN xmlDocPtr
                    xmlTextReaderCurrentDoc     (xmlTextReaderPtr reader);
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                    xmlTextReaderExpand         (xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlTextReaderNext           (xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlTextReaderNextSibling    (xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlTextReaderIsValid        (xmlTextReaderPtr reader);
 #ifdef LIBXML_SCHEMAS_ENABLED
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader,
                                                 const char *rng);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlTextReaderRelaxNGValidateCtxt(xmlTextReaderPtr reader,
                                                 xmlRelaxNGValidCtxtPtr ctxt,
                                                 int options);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader,
                                                 xmlRelaxNGPtr schema);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlTextReaderSchemaValidate (xmlTextReaderPtr reader,
                                                 const char *xsd);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlTextReaderSchemaValidateCtxt(xmlTextReaderPtr reader,
                                                 xmlSchemaValidCtxtPtr ctxt,
                                                 int options);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlTextReaderSetSchema      (xmlTextReaderPtr reader,
                                                 xmlSchemaPtr schema);
 #endif
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                    xmlTextReaderConstXmlVersion(xmlTextReaderPtr reader);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlTextReaderStandalone     (xmlTextReaderPtr reader);
 
 
 /*
  * Index lookup
  */
-XMLPUBFUN long XMLCALL
+XMLPUBFUN long
                xmlTextReaderByteConsumed       (xmlTextReaderPtr reader);
 
 /*
  * New more complete APIs for simpler creation and reuse of readers
  */
-XMLPUBFUN xmlTextReaderPtr XMLCALL
+XMLPUBFUN xmlTextReaderPtr
                xmlReaderWalker         (xmlDocPtr doc);
-XMLPUBFUN xmlTextReaderPtr XMLCALL
+XMLPUBFUN xmlTextReaderPtr
                xmlReaderForDoc         (const xmlChar * cur,
                                         const char *URL,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN xmlTextReaderPtr XMLCALL
+XMLPUBFUN xmlTextReaderPtr
                xmlReaderForFile        (const char *filename,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN xmlTextReaderPtr XMLCALL
+XMLPUBFUN xmlTextReaderPtr
                xmlReaderForMemory      (const char *buffer,
                                         int size,
                                         const char *URL,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN xmlTextReaderPtr XMLCALL
+XMLPUBFUN xmlTextReaderPtr
                xmlReaderForFd          (int fd,
                                         const char *URL,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN xmlTextReaderPtr XMLCALL
+XMLPUBFUN xmlTextReaderPtr
                xmlReaderForIO          (xmlInputReadCallback ioread,
                                         xmlInputCloseCallback ioclose,
                                         void *ioctx,
@@ -348,34 +348,34 @@ XMLPUBFUN xmlTextReaderPtr XMLCALL
                                         const char *encoding,
                                         int options);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlReaderNewWalker      (xmlTextReaderPtr reader,
                                         xmlDocPtr doc);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlReaderNewDoc         (xmlTextReaderPtr reader,
                                         const xmlChar * cur,
                                         const char *URL,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlReaderNewFile        (xmlTextReaderPtr reader,
                                         const char *filename,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlReaderNewMemory      (xmlTextReaderPtr reader,
                                         const char *buffer,
                                         int size,
                                         const char *URL,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlReaderNewFd          (xmlTextReaderPtr reader,
                                         int fd,
                                         const char *URL,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlReaderNewIO          (xmlTextReaderPtr reader,
                                         xmlInputReadCallback ioread,
                                         xmlInputCloseCallback ioclose,
@@ -397,23 +397,23 @@ typedef void *  xmlTextReaderLocatorPtr;
  *
  * Signature of an error callback from a reader parser
  */
-typedef void (XMLCALL *xmlTextReaderErrorFunc)(void *arg,
+typedef void (*xmlTextReaderErrorFunc)(void *arg,
                                               const char *msg,
                                               xmlParserSeverities severity,
                                               xmlTextReaderLocatorPtr locator);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
            xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
            xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
            xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader,
                                         xmlTextReaderErrorFunc f,
                                         void *arg);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
            xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader,
                                                   xmlStructuredErrorFunc f,
                                                   void *arg);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
            xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader,
                                         xmlTextReaderErrorFunc *f,
                                         void **arg);
index 7009645..39a72ab 100644 (file)
@@ -48,16 +48,16 @@ extern "C" {
 /*
  * The POSIX like API
  */
-XMLPUBFUN xmlRegexpPtr XMLCALL
+XMLPUBFUN xmlRegexpPtr
                    xmlRegexpCompile    (const xmlChar *regexp);
-XMLPUBFUN void XMLCALL                  xmlRegFreeRegexp(xmlRegexpPtr regexp);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN void                  xmlRegFreeRegexp(xmlRegexpPtr regexp);
+XMLPUBFUN int
                    xmlRegexpExec       (xmlRegexpPtr comp,
                                         const xmlChar *value);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                    xmlRegexpPrint      (FILE *output,
                                         xmlRegexpPtr regexp);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlRegexpIsDeterminist(xmlRegexpPtr comp);
 
 /**
@@ -77,29 +77,29 @@ typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec,
 /*
  * The progressive API
  */
-XMLPUBFUN xmlRegExecCtxtPtr XMLCALL
+XMLPUBFUN xmlRegExecCtxtPtr
                    xmlRegNewExecCtxt   (xmlRegexpPtr comp,
                                         xmlRegExecCallbacks callback,
                                         void *data);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                    xmlRegFreeExecCtxt  (xmlRegExecCtxtPtr exec);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlRegExecPushString(xmlRegExecCtxtPtr exec,
                                         const xmlChar *value,
                                         void *data);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlRegExecPushString2(xmlRegExecCtxtPtr exec,
                                         const xmlChar *value,
                                         const xmlChar *value2,
                                         void *data);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlRegExecNextValues(xmlRegExecCtxtPtr exec,
                                         int *nbval,
                                         int *nbneg,
                                         xmlChar **values,
                                         int *terminal);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlRegExecErrInfo   (xmlRegExecCtxtPtr exec,
                                         const xmlChar **string,
                                         int *nbval,
@@ -116,15 +116,15 @@ XMLPUBFUN int XMLCALL
 typedef struct _xmlExpCtxt xmlExpCtxt;
 typedef xmlExpCtxt *xmlExpCtxtPtr;
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlExpFreeCtxt  (xmlExpCtxtPtr ctxt);
-XMLPUBFUN xmlExpCtxtPtr XMLCALL
+XMLPUBFUN xmlExpCtxtPtr
                        xmlExpNewCtxt   (int maxNodes,
                                         xmlDictPtr dict);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlExpCtxtNbNodes(xmlExpCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlExpCtxtNbCons(xmlExpCtxtPtr ctxt);
 
 /* Expressions are trees but the tree is opaque */
@@ -150,31 +150,31 @@ XMLPUBVAR xmlExpNodePtr emptyExp;
 /*
  * Expressions are reference counted internally
  */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlExpFree      (xmlExpCtxtPtr ctxt,
                                         xmlExpNodePtr expr);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlExpRef       (xmlExpNodePtr expr);
 
 /*
  * constructors can be either manual or from a string
  */
-XMLPUBFUN xmlExpNodePtr XMLCALL
+XMLPUBFUN xmlExpNodePtr
                        xmlExpParse     (xmlExpCtxtPtr ctxt,
                                         const char *expr);
-XMLPUBFUN xmlExpNodePtr XMLCALL
+XMLPUBFUN xmlExpNodePtr
                        xmlExpNewAtom   (xmlExpCtxtPtr ctxt,
                                         const xmlChar *name,
                                         int len);
-XMLPUBFUN xmlExpNodePtr XMLCALL
+XMLPUBFUN xmlExpNodePtr
                        xmlExpNewOr     (xmlExpCtxtPtr ctxt,
                                         xmlExpNodePtr left,
                                         xmlExpNodePtr right);
-XMLPUBFUN xmlExpNodePtr XMLCALL
+XMLPUBFUN xmlExpNodePtr
                        xmlExpNewSeq    (xmlExpCtxtPtr ctxt,
                                         xmlExpNodePtr left,
                                         xmlExpNodePtr right);
-XMLPUBFUN xmlExpNodePtr XMLCALL
+XMLPUBFUN xmlExpNodePtr
                        xmlExpNewRange  (xmlExpCtxtPtr ctxt,
                                         xmlExpNodePtr subset,
                                         int min,
@@ -182,34 +182,34 @@ XMLPUBFUN xmlExpNodePtr XMLCALL
 /*
  * The really interesting APIs
  */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlExpIsNillable(xmlExpNodePtr expr);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlExpMaxToken  (xmlExpNodePtr expr);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlExpGetLanguage(xmlExpCtxtPtr ctxt,
                                         xmlExpNodePtr expr,
                                         const xmlChar**langList,
                                         int len);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlExpGetStart  (xmlExpCtxtPtr ctxt,
                                         xmlExpNodePtr expr,
                                         const xmlChar**tokList,
                                         int len);
-XMLPUBFUN xmlExpNodePtr XMLCALL
+XMLPUBFUN xmlExpNodePtr
                        xmlExpStringDerive(xmlExpCtxtPtr ctxt,
                                         xmlExpNodePtr expr,
                                         const xmlChar *str,
                                         int len);
-XMLPUBFUN xmlExpNodePtr XMLCALL
+XMLPUBFUN xmlExpNodePtr
                        xmlExpExpDerive (xmlExpCtxtPtr ctxt,
                                         xmlExpNodePtr expr,
                                         xmlExpNodePtr sub);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                        xmlExpSubsume   (xmlExpCtxtPtr ctxt,
                                         xmlExpNodePtr expr,
                                         xmlExpNodePtr sub);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                        xmlExpDump      (xmlBufferPtr buf,
                                         xmlExpNodePtr expr);
 #endif /* LIBXML_EXPR_ENABLED */
index fb329b2..a744b7a 100644 (file)
@@ -41,42 +41,42 @@ typedef enum {
 typedef struct _xmlSaveCtxt xmlSaveCtxt;
 typedef xmlSaveCtxt *xmlSaveCtxtPtr;
 
-XMLPUBFUN xmlSaveCtxtPtr XMLCALL
+XMLPUBFUN xmlSaveCtxtPtr
                xmlSaveToFd             (int fd,
                                         const char *encoding,
                                         int options);
-XMLPUBFUN xmlSaveCtxtPtr XMLCALL
+XMLPUBFUN xmlSaveCtxtPtr
                xmlSaveToFilename       (const char *filename,
                                         const char *encoding,
                                         int options);
 
-XMLPUBFUN xmlSaveCtxtPtr XMLCALL
+XMLPUBFUN xmlSaveCtxtPtr
                xmlSaveToBuffer         (xmlBufferPtr buffer,
                                         const char *encoding,
                                         int options);
 
-XMLPUBFUN xmlSaveCtxtPtr XMLCALL
+XMLPUBFUN xmlSaveCtxtPtr
                xmlSaveToIO             (xmlOutputWriteCallback iowrite,
                                         xmlOutputCloseCallback ioclose,
                                         void *ioctx,
                                         const char *encoding,
                                         int options);
 
-XMLPUBFUN long XMLCALL
+XMLPUBFUN long
                xmlSaveDoc              (xmlSaveCtxtPtr ctxt,
                                         xmlDocPtr doc);
-XMLPUBFUN long XMLCALL
+XMLPUBFUN long
                xmlSaveTree             (xmlSaveCtxtPtr ctxt,
                                         xmlNodePtr node);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSaveFlush            (xmlSaveCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSaveClose            (xmlSaveCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSaveSetEscape        (xmlSaveCtxtPtr ctxt,
                                         xmlCharEncodingOutputFunc escape);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSaveSetAttrEscape    (xmlSaveCtxtPtr ctxt,
                                         xmlCharEncodingOutputFunc escape);
 #ifdef __cplusplus
index b90e9d1..4d61ad0 100644 (file)
@@ -92,7 +92,7 @@ typedef xmlSchema *xmlSchemaPtr;
  *
  * Signature of an error callback from an XSD validation
  */
-typedef void (XMLCDECL *xmlSchemaValidityErrorFunc)
+typedef void (*xmlSchemaValidityErrorFunc)
                  (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
 
 /**
@@ -103,7 +103,7 @@ typedef void (XMLCDECL *xmlSchemaValidityErrorFunc)
  *
  * Signature of a warning callback from an XSD validation
  */
-typedef void (XMLCDECL *xmlSchemaValidityWarningFunc)
+typedef void (*xmlSchemaValidityWarningFunc)
                  (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
 
 /**
@@ -128,95 +128,95 @@ typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr;
  * Returns: 0 in case of success and -1 in case of error
  */
 
-typedef int (XMLCDECL *xmlSchemaValidityLocatorFunc) (void *ctx,
+typedef int (*xmlSchemaValidityLocatorFunc) (void *ctx,
                            const char **file, unsigned long *line);
 
 /*
  * Interfaces for parsing.
  */
-XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
+XMLPUBFUN xmlSchemaParserCtxtPtr
            xmlSchemaNewParserCtxt      (const char *URL);
-XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
+XMLPUBFUN xmlSchemaParserCtxtPtr
            xmlSchemaNewMemParserCtxt   (const char *buffer,
                                         int size);
-XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
+XMLPUBFUN xmlSchemaParserCtxtPtr
            xmlSchemaNewDocParserCtxt   (xmlDocPtr doc);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
            xmlSchemaFreeParserCtxt     (xmlSchemaParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
            xmlSchemaSetParserErrors    (xmlSchemaParserCtxtPtr ctxt,
                                         xmlSchemaValidityErrorFunc err,
                                         xmlSchemaValidityWarningFunc warn,
                                         void *ctx);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
            xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt,
                                         xmlStructuredErrorFunc serror,
                                         void *ctx);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt,
                                        xmlSchemaValidityErrorFunc * err,
                                        xmlSchemaValidityWarningFunc * warn,
                                        void **ctx);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSchemaIsValid        (xmlSchemaValidCtxtPtr ctxt);
 
-XMLPUBFUN xmlSchemaPtr XMLCALL
+XMLPUBFUN xmlSchemaPtr
            xmlSchemaParse              (xmlSchemaParserCtxtPtr ctxt);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
            xmlSchemaFree               (xmlSchemaPtr schema);
 #ifdef LIBXML_OUTPUT_ENABLED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
            xmlSchemaDump               (FILE *output,
                                         xmlSchemaPtr schema);
 #endif /* LIBXML_OUTPUT_ENABLED */
 /*
  * Interfaces for validating
  */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
            xmlSchemaSetValidErrors     (xmlSchemaValidCtxtPtr ctxt,
                                         xmlSchemaValidityErrorFunc err,
                                         xmlSchemaValidityWarningFunc warn,
                                         void *ctx);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
            xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt,
                                         xmlStructuredErrorFunc serror,
                                         void *ctx);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
            xmlSchemaGetValidErrors     (xmlSchemaValidCtxtPtr ctxt,
                                         xmlSchemaValidityErrorFunc *err,
                                         xmlSchemaValidityWarningFunc *warn,
                                         void **ctx);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
            xmlSchemaSetValidOptions    (xmlSchemaValidCtxtPtr ctxt,
                                         int options);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
             xmlSchemaValidateSetFilename(xmlSchemaValidCtxtPtr vctxt,
                                         const char *filename);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
            xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt);
 
-XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL
+XMLPUBFUN xmlSchemaValidCtxtPtr
            xmlSchemaNewValidCtxt       (xmlSchemaPtr schema);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
            xmlSchemaFreeValidCtxt      (xmlSchemaValidCtxtPtr ctxt);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
            xmlSchemaValidateDoc        (xmlSchemaValidCtxtPtr ctxt,
                                         xmlDocPtr instance);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
             xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt,
                                         xmlNodePtr elem);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
            xmlSchemaValidateStream     (xmlSchemaValidCtxtPtr ctxt,
                                         xmlParserInputBufferPtr input,
                                         xmlCharEncoding enc,
                                         xmlSAXHandlerPtr sax,
                                         void *user_data);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
            xmlSchemaValidateFile       (xmlSchemaValidCtxtPtr ctxt,
                                         const char * filename,
                                         int options);
 
-XMLPUBFUN xmlParserCtxtPtr XMLCALL
+XMLPUBFUN xmlParserCtxtPtr
            xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt);
 
 /*
@@ -225,15 +225,15 @@ XMLPUBFUN xmlParserCtxtPtr XMLCALL
 typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct;
 typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr;
 
-XMLPUBFUN xmlSchemaSAXPlugPtr XMLCALL
+XMLPUBFUN xmlSchemaSAXPlugPtr
             xmlSchemaSAXPlug           (xmlSchemaValidCtxtPtr ctxt,
                                         xmlSAXHandlerPtr *sax,
                                         void **user_data);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
             xmlSchemaSAXUnplug         (xmlSchemaSAXPlugPtr plug);
 
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
             xmlSchemaValidateSetLocator        (xmlSchemaValidCtxtPtr vctxt,
                                         xmlSchemaValidityLocatorFunc f,
                                         void *ctxt);
index 5d588f9..e2cde35 100644 (file)
@@ -30,118 +30,118 @@ typedef enum {
     XML_SCHEMA_WHITESPACE_COLLAPSE = 3
 } xmlSchemaWhitespaceValueType;
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN int
                xmlSchemaInitTypes              (void);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSchemaCleanupTypes           (void);
-XMLPUBFUN xmlSchemaTypePtr XMLCALL
+XMLPUBFUN xmlSchemaTypePtr
                xmlSchemaGetPredefinedType      (const xmlChar *name,
                                                 const xmlChar *ns);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSchemaValidatePredefinedType (xmlSchemaTypePtr type,
                                                 const xmlChar *value,
                                                 xmlSchemaValPtr *val);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSchemaValPredefTypeNode      (xmlSchemaTypePtr type,
                                                 const xmlChar *value,
                                                 xmlSchemaValPtr *val,
                                                 xmlNodePtr node);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSchemaValidateFacet          (xmlSchemaTypePtr base,
                                                 xmlSchemaFacetPtr facet,
                                                 const xmlChar *value,
                                                 xmlSchemaValPtr val);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSchemaValidateFacetWhtsp     (xmlSchemaFacetPtr facet,
                                                 xmlSchemaWhitespaceValueType fws,
                                                 xmlSchemaValType valType,
                                                 const xmlChar *value,
                                                 xmlSchemaValPtr val,
                                                 xmlSchemaWhitespaceValueType ws);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSchemaFreeValue              (xmlSchemaValPtr val);
-XMLPUBFUN xmlSchemaFacetPtr XMLCALL
+XMLPUBFUN xmlSchemaFacetPtr
                xmlSchemaNewFacet               (void);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSchemaCheckFacet             (xmlSchemaFacetPtr facet,
                                                 xmlSchemaTypePtr typeDecl,
                                                 xmlSchemaParserCtxtPtr ctxt,
                                                 const xmlChar *name);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlSchemaFreeFacet              (xmlSchemaFacetPtr facet);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSchemaCompareValues          (xmlSchemaValPtr x,
                                                 xmlSchemaValPtr y);
-XMLPUBFUN xmlSchemaTypePtr XMLCALL
+XMLPUBFUN xmlSchemaTypePtr
     xmlSchemaGetBuiltInListSimpleTypeItemType  (xmlSchemaTypePtr type);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
     xmlSchemaValidateListSimpleTypeFacet       (xmlSchemaFacetPtr facet,
                                                 const xmlChar *value,
                                                 unsigned long actualLen,
                                                 unsigned long *expectedLen);
-XMLPUBFUN xmlSchemaTypePtr XMLCALL
+XMLPUBFUN xmlSchemaTypePtr
                xmlSchemaGetBuiltInType         (xmlSchemaValType type);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSchemaIsBuiltInTypeFacet     (xmlSchemaTypePtr type,
                                                 int facetType);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlSchemaCollapseString         (const xmlChar *value);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlSchemaWhiteSpaceReplace      (const xmlChar *value);
-XMLPUBFUN unsigned long  XMLCALL
+XMLPUBFUN unsigned long 
                xmlSchemaGetFacetValueAsULong   (xmlSchemaFacetPtr facet);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSchemaValidateLengthFacet    (xmlSchemaTypePtr type,
                                                 xmlSchemaFacetPtr facet,
                                                 const xmlChar *value,
                                                 xmlSchemaValPtr val,
                                                 unsigned long *length);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSchemaValidateLengthFacetWhtsp(xmlSchemaFacetPtr facet,
                                                  xmlSchemaValType valType,
                                                  const xmlChar *value,
                                                  xmlSchemaValPtr val,
                                                  unsigned long *length,
                                                  xmlSchemaWhitespaceValueType ws);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaTypePtr type,
                                                 const xmlChar *value,
                                                 xmlSchemaValPtr *val,
                                                 xmlNodePtr node);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSchemaGetCanonValue          (xmlSchemaValPtr val,
                                                 const xmlChar **retValue);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSchemaGetCanonValueWhtsp     (xmlSchemaValPtr val,
                                                 const xmlChar **retValue,
                                                 xmlSchemaWhitespaceValueType ws);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSchemaValueAppend            (xmlSchemaValPtr prev,
                                                 xmlSchemaValPtr cur);
-XMLPUBFUN xmlSchemaValPtr XMLCALL
+XMLPUBFUN xmlSchemaValPtr
                xmlSchemaValueGetNext           (xmlSchemaValPtr cur);
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                xmlSchemaValueGetAsString       (xmlSchemaValPtr val);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSchemaValueGetAsBoolean      (xmlSchemaValPtr val);
-XMLPUBFUN xmlSchemaValPtr XMLCALL
+XMLPUBFUN xmlSchemaValPtr
                xmlSchemaNewStringValue         (xmlSchemaValType type,
                                                 const xmlChar *value);
-XMLPUBFUN xmlSchemaValPtr XMLCALL
+XMLPUBFUN xmlSchemaValPtr
                xmlSchemaNewNOTATIONValue       (const xmlChar *name,
                                                 const xmlChar *ns);
-XMLPUBFUN xmlSchemaValPtr XMLCALL
+XMLPUBFUN xmlSchemaValPtr
                xmlSchemaNewQNameValue          (const xmlChar *namespaceName,
                                                 const xmlChar *localName);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlSchemaCompareValuesWhtsp     (xmlSchemaValPtr x,
                                                 xmlSchemaWhitespaceValueType xws,
                                                 xmlSchemaValPtr y,
                                                 xmlSchemaWhitespaceValueType yws);
-XMLPUBFUN xmlSchemaValPtr XMLCALL
+XMLPUBFUN xmlSchemaValPtr
                xmlSchemaCopyValue              (xmlSchemaValPtr val);
-XMLPUBFUN xmlSchemaValType XMLCALL
+XMLPUBFUN xmlSchemaValType
                xmlSchemaGetValType             (xmlSchemaValPtr val);
 
 #ifdef __cplusplus
index 2d0b2d1..db11a0b 100644 (file)
@@ -37,100 +37,100 @@ typedef unsigned char xmlChar;
 /*
  * xmlChar handling
  */
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                 xmlStrdup                (const xmlChar *cur);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                 xmlStrndup               (const xmlChar *cur,
                                          int len);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                 xmlCharStrndup           (const char *cur,
                                          int len);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                 xmlCharStrdup            (const char *cur);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                 xmlStrsub                (const xmlChar *str,
                                          int start,
                                          int len);
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                 xmlStrchr                (const xmlChar *str,
                                          xmlChar val);
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                 xmlStrstr                (const xmlChar *str,
                                          const xmlChar *val);
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                 xmlStrcasestr            (const xmlChar *str,
                                          const xmlChar *val);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                 xmlStrcmp                (const xmlChar *str1,
                                          const xmlChar *str2);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                 xmlStrncmp               (const xmlChar *str1,
                                          const xmlChar *str2,
                                          int len);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                 xmlStrcasecmp            (const xmlChar *str1,
                                          const xmlChar *str2);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                 xmlStrncasecmp           (const xmlChar *str1,
                                          const xmlChar *str2,
                                          int len);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                 xmlStrEqual              (const xmlChar *str1,
                                          const xmlChar *str2);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                 xmlStrQEqual             (const xmlChar *pref,
                                          const xmlChar *name,
                                          const xmlChar *str);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                 xmlStrlen                (const xmlChar *str);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                 xmlStrcat                (xmlChar *cur,
                                          const xmlChar *add);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                 xmlStrncat               (xmlChar *cur,
                                          const xmlChar *add,
                                          int len);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                 xmlStrncatNew            (const xmlChar *str1,
                                          const xmlChar *str2,
                                          int len);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                 xmlStrPrintf             (xmlChar *buf,
                                          int len,
                                          const char *msg,
                                          ...) LIBXML_ATTR_FORMAT(3,4);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                 xmlStrVPrintf                (xmlChar *buf,
                                          int len,
                                          const char *msg,
                                          va_list ap) LIBXML_ATTR_FORMAT(3,0);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
         xmlGetUTF8Char                   (const unsigned char *utf,
                                          int *len);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
         xmlCheckUTF8                     (const unsigned char *utf);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
         xmlUTF8Strsize                   (const xmlChar *utf,
                                          int len);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
         xmlUTF8Strndup                   (const xmlChar *utf,
                                          int len);
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
         xmlUTF8Strpos                    (const xmlChar *utf,
                                          int pos);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
         xmlUTF8Strloc                    (const xmlChar *utf,
                                          const xmlChar *utfchar);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
         xmlUTF8Strsub                    (const xmlChar *utf,
                                          int start,
                                          int len);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
         xmlUTF8Strlen                    (const xmlChar *utf);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
         xmlUTF8Size                      (const xmlChar *utf);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
         xmlUTF8Charcmp                   (const xmlChar *utf1,
                                          const xmlChar *utf2);
 
index 01ac8b6..2e50a49 100644 (file)
 extern "C" {
 #endif
 
-XMLPUBFUN int XMLCALL xmlUCSIsAegeanNumbers    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsAlphabeticPresentationForms      (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsArabic   (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsArabicPresentationFormsA (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsArabicPresentationFormsB (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsArmenian (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsArrows   (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsBasicLatin       (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsBengali  (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsBlockElements    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsBopomofo (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsBopomofoExtended (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsBoxDrawing       (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsBraillePatterns  (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsBuhid    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsByzantineMusicalSymbols  (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibility (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityForms    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityIdeographs       (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityIdeographsSupplement     (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCJKRadicalsSupplement    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCJKSymbolsandPunctuation (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographs     (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographsExtensionA   (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographsExtensionB   (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCherokee (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCombiningDiacriticalMarks        (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCombiningDiacriticalMarksforSymbols      (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCombiningHalfMarks       (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCombiningMarksforSymbols (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsControlPictures  (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCurrencySymbols  (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCypriotSyllabary (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCyrillic (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCyrillicSupplement       (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsDeseret  (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsDevanagari       (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsDingbats (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsEnclosedAlphanumerics    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsEnclosedCJKLettersandMonths      (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsEthiopic (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsGeneralPunctuation       (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsGeometricShapes  (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsGeorgian (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsGothic   (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsGreek    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsGreekExtended    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsGreekandCoptic   (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsGujarati (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsGurmukhi (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsHalfwidthandFullwidthForms       (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsHangulCompatibilityJamo  (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsHangulJamo       (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsHangulSyllables  (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsHanunoo  (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsHebrew   (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsHighPrivateUseSurrogates (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsHighSurrogates   (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsHiragana (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsIPAExtensions    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsIdeographicDescriptionCharacters (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsKanbun   (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsKangxiRadicals   (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsKannada  (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsKatakana (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsKatakanaPhoneticExtensions       (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsKhmer    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsKhmerSymbols     (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsLao      (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsLatin1Supplement (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedA   (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedB   (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedAdditional  (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsLetterlikeSymbols        (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsLimbu    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsLinearBIdeograms (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsLinearBSyllabary (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsLowSurrogates    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsMalayalam        (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsMathematicalAlphanumericSymbols  (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsMathematicalOperators    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousMathematicalSymbolsA        (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousMathematicalSymbolsB        (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousSymbols     (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousSymbolsandArrows    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousTechnical   (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsMongolian        (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsMusicalSymbols   (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsMyanmar  (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsNumberForms      (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsOgham    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsOldItalic        (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsOpticalCharacterRecognition      (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsOriya    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsOsmanya  (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsPhoneticExtensions       (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsPrivateUse       (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsPrivateUseArea   (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsRunic    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsShavian  (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsSinhala  (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsSmallFormVariants        (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsSpacingModifierLetters   (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsSpecials (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsSuperscriptsandSubscripts        (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsSupplementalArrowsA      (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsSupplementalArrowsB      (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsSupplementalMathematicalOperators        (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsSupplementaryPrivateUseAreaA     (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsSupplementaryPrivateUseAreaB     (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsSyriac   (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsTagalog  (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsTagbanwa (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsTags     (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsTaiLe    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsTaiXuanJingSymbols       (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsTamil    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsTelugu   (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsThaana   (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsThai     (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsTibetan  (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsUgaritic (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsUnifiedCanadianAboriginalSyllabics       (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsVariationSelectors       (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsVariationSelectorsSupplement     (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsYiRadicals       (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsYiSyllables      (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsYijingHexagramSymbols    (int code);
+XMLPUBFUN int xmlUCSIsAegeanNumbers    (int code);
+XMLPUBFUN int xmlUCSIsAlphabeticPresentationForms      (int code);
+XMLPUBFUN int xmlUCSIsArabic   (int code);
+XMLPUBFUN int xmlUCSIsArabicPresentationFormsA (int code);
+XMLPUBFUN int xmlUCSIsArabicPresentationFormsB (int code);
+XMLPUBFUN int xmlUCSIsArmenian (int code);
+XMLPUBFUN int xmlUCSIsArrows   (int code);
+XMLPUBFUN int xmlUCSIsBasicLatin       (int code);
+XMLPUBFUN int xmlUCSIsBengali  (int code);
+XMLPUBFUN int xmlUCSIsBlockElements    (int code);
+XMLPUBFUN int xmlUCSIsBopomofo (int code);
+XMLPUBFUN int xmlUCSIsBopomofoExtended (int code);
+XMLPUBFUN int xmlUCSIsBoxDrawing       (int code);
+XMLPUBFUN int xmlUCSIsBraillePatterns  (int code);
+XMLPUBFUN int xmlUCSIsBuhid    (int code);
+XMLPUBFUN int xmlUCSIsByzantineMusicalSymbols  (int code);
+XMLPUBFUN int xmlUCSIsCJKCompatibility (int code);
+XMLPUBFUN int xmlUCSIsCJKCompatibilityForms    (int code);
+XMLPUBFUN int xmlUCSIsCJKCompatibilityIdeographs       (int code);
+XMLPUBFUN int xmlUCSIsCJKCompatibilityIdeographsSupplement     (int code);
+XMLPUBFUN int xmlUCSIsCJKRadicalsSupplement    (int code);
+XMLPUBFUN int xmlUCSIsCJKSymbolsandPunctuation (int code);
+XMLPUBFUN int xmlUCSIsCJKUnifiedIdeographs     (int code);
+XMLPUBFUN int xmlUCSIsCJKUnifiedIdeographsExtensionA   (int code);
+XMLPUBFUN int xmlUCSIsCJKUnifiedIdeographsExtensionB   (int code);
+XMLPUBFUN int xmlUCSIsCherokee (int code);
+XMLPUBFUN int xmlUCSIsCombiningDiacriticalMarks        (int code);
+XMLPUBFUN int xmlUCSIsCombiningDiacriticalMarksforSymbols      (int code);
+XMLPUBFUN int xmlUCSIsCombiningHalfMarks       (int code);
+XMLPUBFUN int xmlUCSIsCombiningMarksforSymbols (int code);
+XMLPUBFUN int xmlUCSIsControlPictures  (int code);
+XMLPUBFUN int xmlUCSIsCurrencySymbols  (int code);
+XMLPUBFUN int xmlUCSIsCypriotSyllabary (int code);
+XMLPUBFUN int xmlUCSIsCyrillic (int code);
+XMLPUBFUN int xmlUCSIsCyrillicSupplement       (int code);
+XMLPUBFUN int xmlUCSIsDeseret  (int code);
+XMLPUBFUN int xmlUCSIsDevanagari       (int code);
+XMLPUBFUN int xmlUCSIsDingbats (int code);
+XMLPUBFUN int xmlUCSIsEnclosedAlphanumerics    (int code);
+XMLPUBFUN int xmlUCSIsEnclosedCJKLettersandMonths      (int code);
+XMLPUBFUN int xmlUCSIsEthiopic (int code);
+XMLPUBFUN int xmlUCSIsGeneralPunctuation       (int code);
+XMLPUBFUN int xmlUCSIsGeometricShapes  (int code);
+XMLPUBFUN int xmlUCSIsGeorgian (int code);
+XMLPUBFUN int xmlUCSIsGothic   (int code);
+XMLPUBFUN int xmlUCSIsGreek    (int code);
+XMLPUBFUN int xmlUCSIsGreekExtended    (int code);
+XMLPUBFUN int xmlUCSIsGreekandCoptic   (int code);
+XMLPUBFUN int xmlUCSIsGujarati (int code);
+XMLPUBFUN int xmlUCSIsGurmukhi (int code);
+XMLPUBFUN int xmlUCSIsHalfwidthandFullwidthForms       (int code);
+XMLPUBFUN int xmlUCSIsHangulCompatibilityJamo  (int code);
+XMLPUBFUN int xmlUCSIsHangulJamo       (int code);
+XMLPUBFUN int xmlUCSIsHangulSyllables  (int code);
+XMLPUBFUN int xmlUCSIsHanunoo  (int code);
+XMLPUBFUN int xmlUCSIsHebrew   (int code);
+XMLPUBFUN int xmlUCSIsHighPrivateUseSurrogates (int code);
+XMLPUBFUN int xmlUCSIsHighSurrogates   (int code);
+XMLPUBFUN int xmlUCSIsHiragana (int code);
+XMLPUBFUN int xmlUCSIsIPAExtensions    (int code);
+XMLPUBFUN int xmlUCSIsIdeographicDescriptionCharacters (int code);
+XMLPUBFUN int xmlUCSIsKanbun   (int code);
+XMLPUBFUN int xmlUCSIsKangxiRadicals   (int code);
+XMLPUBFUN int xmlUCSIsKannada  (int code);
+XMLPUBFUN int xmlUCSIsKatakana (int code);
+XMLPUBFUN int xmlUCSIsKatakanaPhoneticExtensions       (int code);
+XMLPUBFUN int xmlUCSIsKhmer    (int code);
+XMLPUBFUN int xmlUCSIsKhmerSymbols     (int code);
+XMLPUBFUN int xmlUCSIsLao      (int code);
+XMLPUBFUN int xmlUCSIsLatin1Supplement (int code);
+XMLPUBFUN int xmlUCSIsLatinExtendedA   (int code);
+XMLPUBFUN int xmlUCSIsLatinExtendedB   (int code);
+XMLPUBFUN int xmlUCSIsLatinExtendedAdditional  (int code);
+XMLPUBFUN int xmlUCSIsLetterlikeSymbols        (int code);
+XMLPUBFUN int xmlUCSIsLimbu    (int code);
+XMLPUBFUN int xmlUCSIsLinearBIdeograms (int code);
+XMLPUBFUN int xmlUCSIsLinearBSyllabary (int code);
+XMLPUBFUN int xmlUCSIsLowSurrogates    (int code);
+XMLPUBFUN int xmlUCSIsMalayalam        (int code);
+XMLPUBFUN int xmlUCSIsMathematicalAlphanumericSymbols  (int code);
+XMLPUBFUN int xmlUCSIsMathematicalOperators    (int code);
+XMLPUBFUN int xmlUCSIsMiscellaneousMathematicalSymbolsA        (int code);
+XMLPUBFUN int xmlUCSIsMiscellaneousMathematicalSymbolsB        (int code);
+XMLPUBFUN int xmlUCSIsMiscellaneousSymbols     (int code);
+XMLPUBFUN int xmlUCSIsMiscellaneousSymbolsandArrows    (int code);
+XMLPUBFUN int xmlUCSIsMiscellaneousTechnical   (int code);
+XMLPUBFUN int xmlUCSIsMongolian        (int code);
+XMLPUBFUN int xmlUCSIsMusicalSymbols   (int code);
+XMLPUBFUN int xmlUCSIsMyanmar  (int code);
+XMLPUBFUN int xmlUCSIsNumberForms      (int code);
+XMLPUBFUN int xmlUCSIsOgham    (int code);
+XMLPUBFUN int xmlUCSIsOldItalic        (int code);
+XMLPUBFUN int xmlUCSIsOpticalCharacterRecognition      (int code);
+XMLPUBFUN int xmlUCSIsOriya    (int code);
+XMLPUBFUN int xmlUCSIsOsmanya  (int code);
+XMLPUBFUN int xmlUCSIsPhoneticExtensions       (int code);
+XMLPUBFUN int xmlUCSIsPrivateUse       (int code);
+XMLPUBFUN int xmlUCSIsPrivateUseArea   (int code);
+XMLPUBFUN int xmlUCSIsRunic    (int code);
+XMLPUBFUN int xmlUCSIsShavian  (int code);
+XMLPUBFUN int xmlUCSIsSinhala  (int code);
+XMLPUBFUN int xmlUCSIsSmallFormVariants        (int code);
+XMLPUBFUN int xmlUCSIsSpacingModifierLetters   (int code);
+XMLPUBFUN int xmlUCSIsSpecials (int code);
+XMLPUBFUN int xmlUCSIsSuperscriptsandSubscripts        (int code);
+XMLPUBFUN int xmlUCSIsSupplementalArrowsA      (int code);
+XMLPUBFUN int xmlUCSIsSupplementalArrowsB      (int code);
+XMLPUBFUN int xmlUCSIsSupplementalMathematicalOperators        (int code);
+XMLPUBFUN int xmlUCSIsSupplementaryPrivateUseAreaA     (int code);
+XMLPUBFUN int xmlUCSIsSupplementaryPrivateUseAreaB     (int code);
+XMLPUBFUN int xmlUCSIsSyriac   (int code);
+XMLPUBFUN int xmlUCSIsTagalog  (int code);
+XMLPUBFUN int xmlUCSIsTagbanwa (int code);
+XMLPUBFUN int xmlUCSIsTags     (int code);
+XMLPUBFUN int xmlUCSIsTaiLe    (int code);
+XMLPUBFUN int xmlUCSIsTaiXuanJingSymbols       (int code);
+XMLPUBFUN int xmlUCSIsTamil    (int code);
+XMLPUBFUN int xmlUCSIsTelugu   (int code);
+XMLPUBFUN int xmlUCSIsThaana   (int code);
+XMLPUBFUN int xmlUCSIsThai     (int code);
+XMLPUBFUN int xmlUCSIsTibetan  (int code);
+XMLPUBFUN int xmlUCSIsUgaritic (int code);
+XMLPUBFUN int xmlUCSIsUnifiedCanadianAboriginalSyllabics       (int code);
+XMLPUBFUN int xmlUCSIsVariationSelectors       (int code);
+XMLPUBFUN int xmlUCSIsVariationSelectorsSupplement     (int code);
+XMLPUBFUN int xmlUCSIsYiRadicals       (int code);
+XMLPUBFUN int xmlUCSIsYiSyllables      (int code);
+XMLPUBFUN int xmlUCSIsYijingHexagramSymbols    (int code);
 
-XMLPUBFUN int XMLCALL xmlUCSIsBlock    (int code, const char *block);
+XMLPUBFUN int xmlUCSIsBlock    (int code, const char *block);
 
-XMLPUBFUN int XMLCALL xmlUCSIsCatC     (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatCc    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatCf    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatCo    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatCs    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatL     (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatLl    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatLm    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatLo    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatLt    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatLu    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatM     (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatMc    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatMe    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatMn    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatN     (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatNd    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatNl    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatNo    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatP     (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatPc    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatPd    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatPe    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatPf    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatPi    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatPo    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatPs    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatS     (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatSc    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatSk    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatSm    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatSo    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatZ     (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatZl    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatZp    (int code);
-XMLPUBFUN int XMLCALL xmlUCSIsCatZs    (int code);
+XMLPUBFUN int xmlUCSIsCatC     (int code);
+XMLPUBFUN int xmlUCSIsCatCc    (int code);
+XMLPUBFUN int xmlUCSIsCatCf    (int code);
+XMLPUBFUN int xmlUCSIsCatCo    (int code);
+XMLPUBFUN int xmlUCSIsCatCs    (int code);
+XMLPUBFUN int xmlUCSIsCatL     (int code);
+XMLPUBFUN int xmlUCSIsCatLl    (int code);
+XMLPUBFUN int xmlUCSIsCatLm    (int code);
+XMLPUBFUN int xmlUCSIsCatLo    (int code);
+XMLPUBFUN int xmlUCSIsCatLt    (int code);
+XMLPUBFUN int xmlUCSIsCatLu    (int code);
+XMLPUBFUN int xmlUCSIsCatM     (int code);
+XMLPUBFUN int xmlUCSIsCatMc    (int code);
+XMLPUBFUN int xmlUCSIsCatMe    (int code);
+XMLPUBFUN int xmlUCSIsCatMn    (int code);
+XMLPUBFUN int xmlUCSIsCatN     (int code);
+XMLPUBFUN int xmlUCSIsCatNd    (int code);
+XMLPUBFUN int xmlUCSIsCatNl    (int code);
+XMLPUBFUN int xmlUCSIsCatNo    (int code);
+XMLPUBFUN int xmlUCSIsCatP     (int code);
+XMLPUBFUN int xmlUCSIsCatPc    (int code);
+XMLPUBFUN int xmlUCSIsCatPd    (int code);
+XMLPUBFUN int xmlUCSIsCatPe    (int code);
+XMLPUBFUN int xmlUCSIsCatPf    (int code);
+XMLPUBFUN int xmlUCSIsCatPi    (int code);
+XMLPUBFUN int xmlUCSIsCatPo    (int code);
+XMLPUBFUN int xmlUCSIsCatPs    (int code);
+XMLPUBFUN int xmlUCSIsCatS     (int code);
+XMLPUBFUN int xmlUCSIsCatSc    (int code);
+XMLPUBFUN int xmlUCSIsCatSk    (int code);
+XMLPUBFUN int xmlUCSIsCatSm    (int code);
+XMLPUBFUN int xmlUCSIsCatSo    (int code);
+XMLPUBFUN int xmlUCSIsCatZ     (int code);
+XMLPUBFUN int xmlUCSIsCatZl    (int code);
+XMLPUBFUN int xmlUCSIsCatZp    (int code);
+XMLPUBFUN int xmlUCSIsCatZs    (int code);
 
-XMLPUBFUN int XMLCALL xmlUCSIsCat      (int code, const char *cat);
+XMLPUBFUN int xmlUCSIsCat      (int code, const char *cat);
 
 #ifdef __cplusplus
 }
index bdebfe3..166269e 100644 (file)
@@ -21,7 +21,7 @@ extern "C" {
  * your library and includes mismatch
  */
 #ifndef LIBXML2_COMPILING_MSCCDEF
-XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
+XMLPUBFUN void xmlCheckVersion(int version);
 #endif /* LIBXML2_COMPILING_MSCCDEF */
 
 /**
@@ -313,9 +313,9 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
 /**
  * LIBXML_DEBUG_RUNTIME:
  *
- * Whether the runtime debugging is configured in
+ * Removed
  */
-#if @WITH_RUN_DEBUG@
+#if 0
 #define LIBXML_DEBUG_RUNTIME
 #endif
 
@@ -409,12 +409,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
 #endif
 
 #ifdef __GNUC__
-
-/**
- * ATTRIBUTE_UNUSED:
- *
- * Macro used to signal to GCC unused function parameters
- */
+/** DOC_DISABLE */
 
 #ifndef ATTRIBUTE_UNUSED
 # if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
@@ -424,12 +419,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
 # endif
 #endif
 
-/**
- * LIBXML_ATTR_ALLOC_SIZE:
- *
- * Macro used to indicate to GCC this is an allocator function
- */
-
 #ifndef LIBXML_ATTR_ALLOC_SIZE
 # if (!defined(__clang__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))))
 #  define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
@@ -440,12 +429,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
 # define LIBXML_ATTR_ALLOC_SIZE(x)
 #endif
 
-/**
- * LIBXML_ATTR_FORMAT:
- *
- * Macro used to indicate to GCC the parameter are printf like
- */
-
 #ifndef LIBXML_ATTR_FORMAT
 # if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
 #  define LIBXML_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args)))
@@ -457,14 +440,27 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
 #endif
 
 #ifndef XML_DEPRECATED
-#  ifdef IN_LIBXML
+#  if defined (IN_LIBXML) || (__GNUC__ * 100 + __GNUC_MINOR__ < 301)
 #    define XML_DEPRECATED
-#  else
 /* Available since at least GCC 3.1 */
+#  else
 #    define XML_DEPRECATED __attribute__((deprecated))
 #  endif
 #endif
 
+#if defined(__clang__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
+#define XML_IGNORE_FPTR_CAST_WARNINGS \
+    _Pragma("GCC diagnostic push") \
+    _Pragma("GCC diagnostic ignored \"-Wpedantic\"") \
+    _Pragma("GCC diagnostic ignored \"-Wcast-function-type\"")
+#define XML_POP_WARNINGS \
+    _Pragma("GCC diagnostic pop")
+#else
+#define XML_IGNORE_FPTR_CAST_WARNINGS
+#define XML_POP_WARNINGS
+#endif
+
+/** DOC_ENABLE */
 #else /* ! __GNUC__ */
 /**
  * ATTRIBUTE_UNUSED:
@@ -491,7 +487,34 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
  * is deprecated.
  */
 #ifndef XML_DEPRECATED
-#define XML_DEPRECATED
+#  if defined (IN_LIBXML) || !defined (_MSC_VER)
+#    define XML_DEPRECATED
+/* Available since Visual Studio 2005 */
+#  elif defined (_MSC_VER) && (_MSC_VER >= 1400)
+#    define XML_DEPRECATED __declspec(deprecated)
+#  endif
+#endif
+/**
+ * LIBXML_IGNORE_FPTR_CAST_WARNINGS:
+ *
+ * Macro used to ignore pointer cast warnings that can't be worked around.
+ */
+#if defined (_MSC_VER) && (_MSC_VER >= 1400)
+#  define XML_IGNORE_FPTR_CAST_WARNINGS __pragma(warning(push))
+#else
+#  define XML_IGNORE_FPTR_CAST_WARNINGS
+#endif
+/**
+ * XML_POP_WARNINGS:
+ *
+ * Macro used to restore warnings state.
+ */
+#ifndef XML_POP_WARNINGS
+#  if defined (_MSC_VER) && (_MSC_VER >= 1400)
+#    define XML_POP_WARNINGS __pragma(warning(pop))
+#  else
+#    define XML_POP_WARNINGS
+#  endif
 #endif
 #endif /* __GNUC__ */
 
index dd5add3..339f251 100644 (file)
@@ -29,20 +29,20 @@ extern "C" {
 /*
  * Constructors & Destructor
  */
-    XMLPUBFUN xmlTextWriterPtr XMLCALL
+    XMLPUBFUN xmlTextWriterPtr
         xmlNewTextWriter(xmlOutputBufferPtr out);
-    XMLPUBFUN xmlTextWriterPtr XMLCALL
+    XMLPUBFUN xmlTextWriterPtr
         xmlNewTextWriterFilename(const char *uri, int compression);
-    XMLPUBFUN xmlTextWriterPtr XMLCALL
+    XMLPUBFUN xmlTextWriterPtr
         xmlNewTextWriterMemory(xmlBufferPtr buf, int compression);
-    XMLPUBFUN xmlTextWriterPtr XMLCALL
+    XMLPUBFUN xmlTextWriterPtr
         xmlNewTextWriterPushParser(xmlParserCtxtPtr ctxt, int compression);
-    XMLPUBFUN xmlTextWriterPtr XMLCALL
+    XMLPUBFUN xmlTextWriterPtr
         xmlNewTextWriterDoc(xmlDocPtr * doc, int compression);
-    XMLPUBFUN xmlTextWriterPtr XMLCALL
+    XMLPUBFUN xmlTextWriterPtr
         xmlNewTextWriterTree(xmlDocPtr doc, xmlNodePtr node,
                              int compression);
-    XMLPUBFUN void XMLCALL xmlFreeTextWriter(xmlTextWriterPtr writer);
+    XMLPUBFUN void xmlFreeTextWriter(xmlTextWriterPtr writer);
 
 /*
  * Functions
@@ -52,30 +52,30 @@ extern "C" {
 /*
  * Document
  */
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterStartDocument(xmlTextWriterPtr writer,
                                    const char *version,
                                    const char *encoding,
                                    const char *standalone);
-    XMLPUBFUN int XMLCALL xmlTextWriterEndDocument(xmlTextWriterPtr
+    XMLPUBFUN int xmlTextWriterEndDocument(xmlTextWriterPtr
                                                    writer);
 
 /*
  * Comments
  */
-    XMLPUBFUN int XMLCALL xmlTextWriterStartComment(xmlTextWriterPtr
+    XMLPUBFUN int xmlTextWriterStartComment(xmlTextWriterPtr
                                                     writer);
-    XMLPUBFUN int XMLCALL xmlTextWriterEndComment(xmlTextWriterPtr writer);
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int xmlTextWriterEndComment(xmlTextWriterPtr writer);
+    XMLPUBFUN int
         xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer,
                                         const char *format, ...)
                                        LIBXML_ATTR_FORMAT(2,3);
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer,
                                          const char *format,
                                          va_list argptr)
                                         LIBXML_ATTR_FORMAT(2,0);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteComment(xmlTextWriterPtr
+    XMLPUBFUN int xmlTextWriterWriteComment(xmlTextWriterPtr
                                                     writer,
                                                     const xmlChar *
                                                     content);
@@ -83,47 +83,47 @@ extern "C" {
 /*
  * Elements
  */
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterStartElement(xmlTextWriterPtr writer,
                                   const xmlChar * name);
-    XMLPUBFUN int XMLCALL xmlTextWriterStartElementNS(xmlTextWriterPtr
+    XMLPUBFUN int xmlTextWriterStartElementNS(xmlTextWriterPtr
                                                       writer,
                                                       const xmlChar *
                                                       prefix,
                                                       const xmlChar * name,
                                                       const xmlChar *
                                                       namespaceURI);
-    XMLPUBFUN int XMLCALL xmlTextWriterEndElement(xmlTextWriterPtr writer);
-    XMLPUBFUN int XMLCALL xmlTextWriterFullEndElement(xmlTextWriterPtr
+    XMLPUBFUN int xmlTextWriterEndElement(xmlTextWriterPtr writer);
+    XMLPUBFUN int xmlTextWriterFullEndElement(xmlTextWriterPtr
                                                       writer);
 
 /*
  * Elements conveniency functions
  */
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer,
                                         const xmlChar * name,
                                         const char *format, ...)
                                        LIBXML_ATTR_FORMAT(3,4);
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer,
                                          const xmlChar * name,
                                          const char *format,
                                          va_list argptr)
                                         LIBXML_ATTR_FORMAT(3,0);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteElement(xmlTextWriterPtr
+    XMLPUBFUN int xmlTextWriterWriteElement(xmlTextWriterPtr
                                                     writer,
                                                     const xmlChar * name,
                                                     const xmlChar *
                                                     content);
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteFormatElementNS(xmlTextWriterPtr writer,
                                           const xmlChar * prefix,
                                           const xmlChar * name,
                                           const xmlChar * namespaceURI,
                                           const char *format, ...)
                                          LIBXML_ATTR_FORMAT(5,6);
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteVFormatElementNS(xmlTextWriterPtr writer,
                                            const xmlChar * prefix,
                                            const xmlChar * name,
@@ -131,7 +131,7 @@ extern "C" {
                                            const char *format,
                                            va_list argptr)
                                           LIBXML_ATTR_FORMAT(5,0);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteElementNS(xmlTextWriterPtr
+    XMLPUBFUN int xmlTextWriterWriteElementNS(xmlTextWriterPtr
                                                       writer,
                                                       const xmlChar *
                                                       prefix,
@@ -144,48 +144,48 @@ extern "C" {
 /*
  * Text
  */
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer,
                                     const char *format, ...)
                                    LIBXML_ATTR_FORMAT(2,3);
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer,
                                      const char *format, va_list argptr)
                                     LIBXML_ATTR_FORMAT(2,0);
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteRawLen(xmlTextWriterPtr writer,
                                  const xmlChar * content, int len);
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteRaw(xmlTextWriterPtr writer,
                               const xmlChar * content);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatString(xmlTextWriterPtr
+    XMLPUBFUN int xmlTextWriterWriteFormatString(xmlTextWriterPtr
                                                          writer,
                                                          const char
                                                          *format, ...)
                                                         LIBXML_ATTR_FORMAT(2,3);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatString(xmlTextWriterPtr
+    XMLPUBFUN int xmlTextWriterWriteVFormatString(xmlTextWriterPtr
                                                           writer,
                                                           const char
                                                           *format,
                                                           va_list argptr)
                                                          LIBXML_ATTR_FORMAT(2,0);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteString(xmlTextWriterPtr writer,
+    XMLPUBFUN int xmlTextWriterWriteString(xmlTextWriterPtr writer,
                                                    const xmlChar *
                                                    content);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteBase64(xmlTextWriterPtr writer,
+    XMLPUBFUN int xmlTextWriterWriteBase64(xmlTextWriterPtr writer,
                                                    const char *data,
                                                    int start, int len);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteBinHex(xmlTextWriterPtr writer,
+    XMLPUBFUN int xmlTextWriterWriteBinHex(xmlTextWriterPtr writer,
                                                    const char *data,
                                                    int start, int len);
 
 /*
  * Attributes
  */
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterStartAttribute(xmlTextWriterPtr writer,
                                     const xmlChar * name);
-    XMLPUBFUN int XMLCALL xmlTextWriterStartAttributeNS(xmlTextWriterPtr
+    XMLPUBFUN int xmlTextWriterStartAttributeNS(xmlTextWriterPtr
                                                         writer,
                                                         const xmlChar *
                                                         prefix,
@@ -193,36 +193,36 @@ extern "C" {
                                                         name,
                                                         const xmlChar *
                                                         namespaceURI);
-    XMLPUBFUN int XMLCALL xmlTextWriterEndAttribute(xmlTextWriterPtr
+    XMLPUBFUN int xmlTextWriterEndAttribute(xmlTextWriterPtr
                                                     writer);
 
 /*
  * Attributes conveniency functions
  */
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer,
                                           const xmlChar * name,
                                           const char *format, ...)
                                          LIBXML_ATTR_FORMAT(3,4);
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer,
                                            const xmlChar * name,
                                            const char *format,
                                            va_list argptr)
                                           LIBXML_ATTR_FORMAT(3,0);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteAttribute(xmlTextWriterPtr
+    XMLPUBFUN int xmlTextWriterWriteAttribute(xmlTextWriterPtr
                                                       writer,
                                                       const xmlChar * name,
                                                       const xmlChar *
                                                       content);
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteFormatAttributeNS(xmlTextWriterPtr writer,
                                             const xmlChar * prefix,
                                             const xmlChar * name,
                                             const xmlChar * namespaceURI,
                                             const char *format, ...)
                                            LIBXML_ATTR_FORMAT(5,6);
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteVFormatAttributeNS(xmlTextWriterPtr writer,
                                              const xmlChar * prefix,
                                              const xmlChar * name,
@@ -230,7 +230,7 @@ extern "C" {
                                              const char *format,
                                              va_list argptr)
                                             LIBXML_ATTR_FORMAT(5,0);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteAttributeNS(xmlTextWriterPtr
+    XMLPUBFUN int xmlTextWriterWriteAttributeNS(xmlTextWriterPtr
                                                         writer,
                                                         const xmlChar *
                                                         prefix,
@@ -244,25 +244,25 @@ extern "C" {
 /*
  * PI's
  */
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterStartPI(xmlTextWriterPtr writer,
                              const xmlChar * target);
-    XMLPUBFUN int XMLCALL xmlTextWriterEndPI(xmlTextWriterPtr writer);
+    XMLPUBFUN int xmlTextWriterEndPI(xmlTextWriterPtr writer);
 
 /*
  * PI conveniency functions
  */
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer,
                                    const xmlChar * target,
                                    const char *format, ...)
                                   LIBXML_ATTR_FORMAT(3,4);
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer,
                                     const xmlChar * target,
                                     const char *format, va_list argptr)
                                    LIBXML_ATTR_FORMAT(3,0);
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWritePI(xmlTextWriterPtr writer,
                              const xmlChar * target,
                              const xmlChar * content);
@@ -277,52 +277,52 @@ extern "C" {
 /*
  * CDATA
  */
-    XMLPUBFUN int XMLCALL xmlTextWriterStartCDATA(xmlTextWriterPtr writer);
-    XMLPUBFUN int XMLCALL xmlTextWriterEndCDATA(xmlTextWriterPtr writer);
+    XMLPUBFUN int xmlTextWriterStartCDATA(xmlTextWriterPtr writer);
+    XMLPUBFUN int xmlTextWriterEndCDATA(xmlTextWriterPtr writer);
 
 /*
  * CDATA conveniency functions
  */
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer,
                                       const char *format, ...)
                                      LIBXML_ATTR_FORMAT(2,3);
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer,
                                        const char *format, va_list argptr)
                                       LIBXML_ATTR_FORMAT(2,0);
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteCDATA(xmlTextWriterPtr writer,
                                 const xmlChar * content);
 
 /*
  * DTD
  */
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterStartDTD(xmlTextWriterPtr writer,
                               const xmlChar * name,
                               const xmlChar * pubid,
                               const xmlChar * sysid);
-    XMLPUBFUN int XMLCALL xmlTextWriterEndDTD(xmlTextWriterPtr writer);
+    XMLPUBFUN int xmlTextWriterEndDTD(xmlTextWriterPtr writer);
 
 /*
  * DTD conveniency functions
  */
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteFormatDTD(xmlTextWriterPtr writer,
                                     const xmlChar * name,
                                     const xmlChar * pubid,
                                     const xmlChar * sysid,
                                     const char *format, ...)
                                    LIBXML_ATTR_FORMAT(5,6);
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteVFormatDTD(xmlTextWriterPtr writer,
                                      const xmlChar * name,
                                      const xmlChar * pubid,
                                      const xmlChar * sysid,
                                      const char *format, va_list argptr)
                                     LIBXML_ATTR_FORMAT(5,0);
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteDTD(xmlTextWriterPtr writer,
                               const xmlChar * name,
                               const xmlChar * pubid,
@@ -339,27 +339,27 @@ extern "C" {
 /*
  * DTD element definition
  */
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterStartDTDElement(xmlTextWriterPtr writer,
                                      const xmlChar * name);
-    XMLPUBFUN int XMLCALL xmlTextWriterEndDTDElement(xmlTextWriterPtr
+    XMLPUBFUN int xmlTextWriterEndDTDElement(xmlTextWriterPtr
                                                      writer);
 
 /*
  * DTD element definition conveniency functions
  */
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer,
                                            const xmlChar * name,
                                            const char *format, ...)
                                           LIBXML_ATTR_FORMAT(3,4);
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer,
                                             const xmlChar * name,
                                             const char *format,
                                             va_list argptr)
                                            LIBXML_ATTR_FORMAT(3,0);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDElement(xmlTextWriterPtr
+    XMLPUBFUN int xmlTextWriterWriteDTDElement(xmlTextWriterPtr
                                                        writer,
                                                        const xmlChar *
                                                        name,
@@ -369,27 +369,27 @@ extern "C" {
 /*
  * DTD attribute list definition
  */
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterStartDTDAttlist(xmlTextWriterPtr writer,
                                      const xmlChar * name);
-    XMLPUBFUN int XMLCALL xmlTextWriterEndDTDAttlist(xmlTextWriterPtr
+    XMLPUBFUN int xmlTextWriterEndDTDAttlist(xmlTextWriterPtr
                                                      writer);
 
 /*
  * DTD attribute list definition conveniency functions
  */
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer,
                                            const xmlChar * name,
                                            const char *format, ...)
                                           LIBXML_ATTR_FORMAT(3,4);
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer,
                                             const xmlChar * name,
                                             const char *format,
                                             va_list argptr)
                                            LIBXML_ATTR_FORMAT(3,0);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr
+    XMLPUBFUN int xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr
                                                        writer,
                                                        const xmlChar *
                                                        name,
@@ -399,48 +399,48 @@ extern "C" {
 /*
  * DTD entity definition
  */
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterStartDTDEntity(xmlTextWriterPtr writer,
                                     int pe, const xmlChar * name);
-    XMLPUBFUN int XMLCALL xmlTextWriterEndDTDEntity(xmlTextWriterPtr
+    XMLPUBFUN int xmlTextWriterEndDTDEntity(xmlTextWriterPtr
                                                     writer);
 
 /*
  * DTD entity definition conveniency functions
  */
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriterPtr writer,
                                                   int pe,
                                                   const xmlChar * name,
                                                   const char *format, ...)
                                                  LIBXML_ATTR_FORMAT(4,5);
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer,
                                                    int pe,
                                                    const xmlChar * name,
                                                    const char *format,
                                                    va_list argptr)
                                                   LIBXML_ATTR_FORMAT(4,0);
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteDTDInternalEntity(xmlTextWriterPtr writer,
                                             int pe,
                                             const xmlChar * name,
                                             const xmlChar * content);
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteDTDExternalEntity(xmlTextWriterPtr writer,
                                             int pe,
                                             const xmlChar * name,
                                             const xmlChar * pubid,
                                             const xmlChar * sysid,
                                             const xmlChar * ndataid);
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr
                                                     writer,
                                                     const xmlChar * pubid,
                                                     const xmlChar * sysid,
                                                     const xmlChar *
                                                     ndataid);
-    XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDEntity(xmlTextWriterPtr
+    XMLPUBFUN int xmlTextWriterWriteDTDEntity(xmlTextWriterPtr
                                                       writer, int pe,
                                                       const xmlChar * name,
                                                       const xmlChar *
@@ -455,7 +455,7 @@ extern "C" {
 /*
  * DTD notation definition
  */
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterWriteDTDNotation(xmlTextWriterPtr writer,
                                       const xmlChar * name,
                                       const xmlChar * pubid,
@@ -464,20 +464,20 @@ extern "C" {
 /*
  * Indentation
  */
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterSetIndent(xmlTextWriterPtr writer, int indent);
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterSetIndentString(xmlTextWriterPtr writer,
                                      const xmlChar * str);
 
-    XMLPUBFUN int XMLCALL
+    XMLPUBFUN int
         xmlTextWriterSetQuoteChar(xmlTextWriterPtr writer, xmlChar quotechar);
 
 
 /*
  * misc
  */
-    XMLPUBFUN int XMLCALL xmlTextWriterFlush(xmlTextWriterPtr writer);
+    XMLPUBFUN int xmlTextWriterFlush(xmlTextWriterPtr writer);
 
 #ifdef __cplusplus
 }
index bfbc5d6..b57985a 100644 (file)
@@ -400,7 +400,7 @@ struct _xmlXPathParserContext {
     int xptr;                          /* it this an XPointer expression */
     xmlNodePtr         ancestor;       /* used for walking preceding axis */
 
-    int              valueFrame;        /* used to limit Pop on the stack */
+    int              valueFrame;        /* unused */
 };
 
 /************************************************************************
@@ -454,68 +454,68 @@ XMLPUBVAR double xmlXPathNINF;
     (((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL))
 
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                    xmlXPathFreeObject          (xmlXPathObjectPtr obj);
-XMLPUBFUN xmlNodeSetPtr XMLCALL
+XMLPUBFUN xmlNodeSetPtr
                    xmlXPathNodeSetCreate       (xmlNodePtr val);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                    xmlXPathFreeNodeSetList     (xmlXPathObjectPtr obj);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                    xmlXPathFreeNodeSet         (xmlNodeSetPtr obj);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                    xmlXPathObjectCopy          (xmlXPathObjectPtr val);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlXPathCmpNodes            (xmlNodePtr node1,
                                                 xmlNodePtr node2);
 /**
  * Conversion functions to basic types.
  */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlXPathCastNumberToBoolean (double val);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlXPathCastStringToBoolean (const xmlChar * val);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlXPathCastNodeSetToBoolean(xmlNodeSetPtr ns);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlXPathCastToBoolean       (xmlXPathObjectPtr val);
 
-XMLPUBFUN double XMLCALL
+XMLPUBFUN double
                    xmlXPathCastBooleanToNumber (int val);
-XMLPUBFUN double XMLCALL
+XMLPUBFUN double
                    xmlXPathCastStringToNumber  (const xmlChar * val);
-XMLPUBFUN double XMLCALL
+XMLPUBFUN double
                    xmlXPathCastNodeToNumber    (xmlNodePtr node);
-XMLPUBFUN double XMLCALL
+XMLPUBFUN double
                    xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns);
-XMLPUBFUN double XMLCALL
+XMLPUBFUN double
                    xmlXPathCastToNumber        (xmlXPathObjectPtr val);
 
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                    xmlXPathCastBooleanToString (int val);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                    xmlXPathCastNumberToString  (double val);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                    xmlXPathCastNodeToString    (xmlNodePtr node);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                    xmlXPathCastNodeSetToString (xmlNodeSetPtr ns);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                    xmlXPathCastToString        (xmlXPathObjectPtr val);
 
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                    xmlXPathConvertBoolean      (xmlXPathObjectPtr val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                    xmlXPathConvertNumber       (xmlXPathObjectPtr val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                    xmlXPathConvertString       (xmlXPathObjectPtr val);
 
 /**
  * Context handling.
  */
-XMLPUBFUN xmlXPathContextPtr XMLCALL
+XMLPUBFUN xmlXPathContextPtr
                    xmlXPathNewContext          (xmlDocPtr doc);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                    xmlXPathFreeContext         (xmlXPathContextPtr ctxt);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlXPathContextSetCache(xmlXPathContextPtr ctxt,
                                            int active,
                                            int value,
@@ -523,48 +523,48 @@ XMLPUBFUN int XMLCALL
 /**
  * Evaluation functions.
  */
-XMLPUBFUN long XMLCALL
+XMLPUBFUN long
                    xmlXPathOrderDocElems       (xmlDocPtr doc);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlXPathSetContextNode      (xmlNodePtr node,
                                                 xmlXPathContextPtr ctx);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                    xmlXPathNodeEval            (xmlNodePtr node,
                                                 const xmlChar *str,
                                                 xmlXPathContextPtr ctx);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                    xmlXPathEval                (const xmlChar *str,
                                                 xmlXPathContextPtr ctx);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                    xmlXPathEvalExpression      (const xmlChar *str,
                                                 xmlXPathContextPtr ctxt);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlXPathEvalPredicate       (xmlXPathContextPtr ctxt,
                                                 xmlXPathObjectPtr res);
 /**
  * Separate compilation/evaluation entry points.
  */
-XMLPUBFUN xmlXPathCompExprPtr XMLCALL
+XMLPUBFUN xmlXPathCompExprPtr
                    xmlXPathCompile             (const xmlChar *str);
-XMLPUBFUN xmlXPathCompExprPtr XMLCALL
+XMLPUBFUN xmlXPathCompExprPtr
                    xmlXPathCtxtCompile         (xmlXPathContextPtr ctxt,
                                                 const xmlChar *str);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                    xmlXPathCompiledEval        (xmlXPathCompExprPtr comp,
                                                 xmlXPathContextPtr ctx);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                    xmlXPathCompiledEvalToBoolean(xmlXPathCompExprPtr comp,
                                                 xmlXPathContextPtr ctxt);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                    xmlXPathFreeCompExpr        (xmlXPathCompExprPtr comp);
 #endif /* LIBXML_XPATH_ENABLED */
 #if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                    xmlXPathInit                (void);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlXPathIsNaN   (double val);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlXPathIsInf   (double val);
 
 #ifdef __cplusplus
index 76a6b48..cb0991d 100644 (file)
@@ -100,15 +100,15 @@ extern "C" {
  */
 #define xmlXPathGetContextNode(ctxt)   ((ctxt)->context->node)
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlXPathPopBoolean      (xmlXPathParserContextPtr ctxt);
-XMLPUBFUN double XMLCALL
+XMLPUBFUN double
                xmlXPathPopNumber       (xmlXPathParserContextPtr ctxt);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlXPathPopString       (xmlXPathParserContextPtr ctxt);
-XMLPUBFUN xmlNodeSetPtr XMLCALL
+XMLPUBFUN xmlNodeSetPtr
                xmlXPathPopNodeSet      (xmlXPathParserContextPtr ctxt);
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void *
                xmlXPathPopExternal     (xmlXPathParserContextPtr ctxt);
 
 /**
@@ -331,7 +331,7 @@ XMLPUBFUN void * XMLCALL
  * Variable Lookup forwarding.
  */
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
        xmlXPathRegisterVariableLookup  (xmlXPathContextPtr ctxt,
                                         xmlXPathVariableLookupFunc f,
                                         void *data);
@@ -340,7 +340,7 @@ XMLPUBFUN void XMLCALL
  * Function Lookup forwarding.
  */
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
            xmlXPathRegisterFuncLookup  (xmlXPathContextPtr ctxt,
                                         xmlXPathFuncLookupFunc f,
                                         void *funcCtxt);
@@ -348,22 +348,22 @@ XMLPUBFUN void XMLCALL
 /*
  * Error reporting.
  */
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlXPatherror   (xmlXPathParserContextPtr ctxt,
                                 const char *file,
                                 int line,
                                 int no);
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlXPathErr     (xmlXPathParserContextPtr ctxt,
                                 int error);
 
 #ifdef LIBXML_DEBUG_ENABLED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlXPathDebugDumpObject (FILE *output,
                                         xmlXPathObjectPtr cur,
                                         int depth);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
            xmlXPathDebugDumpCompExpr(FILE *output,
                                         xmlXPathCompExprPtr comp,
                                         int depth);
@@ -371,48 +371,48 @@ XMLPUBFUN void XMLCALL
 /**
  * NodeSet handling.
  */
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlXPathNodeSetContains         (xmlNodeSetPtr cur,
                                                 xmlNodePtr val);
-XMLPUBFUN xmlNodeSetPtr XMLCALL
+XMLPUBFUN xmlNodeSetPtr
                xmlXPathDifference              (xmlNodeSetPtr nodes1,
                                                 xmlNodeSetPtr nodes2);
-XMLPUBFUN xmlNodeSetPtr XMLCALL
+XMLPUBFUN xmlNodeSetPtr
                xmlXPathIntersection            (xmlNodeSetPtr nodes1,
                                                 xmlNodeSetPtr nodes2);
 
-XMLPUBFUN xmlNodeSetPtr XMLCALL
+XMLPUBFUN xmlNodeSetPtr
                xmlXPathDistinctSorted          (xmlNodeSetPtr nodes);
-XMLPUBFUN xmlNodeSetPtr XMLCALL
+XMLPUBFUN xmlNodeSetPtr
                xmlXPathDistinct                (xmlNodeSetPtr nodes);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlXPathHasSameNodes            (xmlNodeSetPtr nodes1,
                                                 xmlNodeSetPtr nodes2);
 
-XMLPUBFUN xmlNodeSetPtr XMLCALL
+XMLPUBFUN xmlNodeSetPtr
                xmlXPathNodeLeadingSorted       (xmlNodeSetPtr nodes,
                                                 xmlNodePtr node);
-XMLPUBFUN xmlNodeSetPtr XMLCALL
+XMLPUBFUN xmlNodeSetPtr
                xmlXPathLeadingSorted           (xmlNodeSetPtr nodes1,
                                                 xmlNodeSetPtr nodes2);
-XMLPUBFUN xmlNodeSetPtr XMLCALL
+XMLPUBFUN xmlNodeSetPtr
                xmlXPathNodeLeading             (xmlNodeSetPtr nodes,
                                                 xmlNodePtr node);
-XMLPUBFUN xmlNodeSetPtr XMLCALL
+XMLPUBFUN xmlNodeSetPtr
                xmlXPathLeading                 (xmlNodeSetPtr nodes1,
                                                 xmlNodeSetPtr nodes2);
 
-XMLPUBFUN xmlNodeSetPtr XMLCALL
+XMLPUBFUN xmlNodeSetPtr
                xmlXPathNodeTrailingSorted      (xmlNodeSetPtr nodes,
                                                 xmlNodePtr node);
-XMLPUBFUN xmlNodeSetPtr XMLCALL
+XMLPUBFUN xmlNodeSetPtr
                xmlXPathTrailingSorted          (xmlNodeSetPtr nodes1,
                                                 xmlNodeSetPtr nodes2);
-XMLPUBFUN xmlNodeSetPtr XMLCALL
+XMLPUBFUN xmlNodeSetPtr
                xmlXPathNodeTrailing            (xmlNodeSetPtr nodes,
                                                 xmlNodePtr node);
-XMLPUBFUN xmlNodeSetPtr XMLCALL
+XMLPUBFUN xmlNodeSetPtr
                xmlXPathTrailing                (xmlNodeSetPtr nodes1,
                                                 xmlNodeSetPtr nodes2);
 
@@ -421,208 +421,208 @@ XMLPUBFUN xmlNodeSetPtr XMLCALL
  * Extending a context.
  */
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlXPathRegisterNs              (xmlXPathContextPtr ctxt,
                                                 const xmlChar *prefix,
                                                 const xmlChar *ns_uri);
-XMLPUBFUN const xmlChar * XMLCALL
+XMLPUBFUN const xmlChar *
                xmlXPathNsLookup                (xmlXPathContextPtr ctxt,
                                                 const xmlChar *prefix);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlXPathRegisteredNsCleanup     (xmlXPathContextPtr ctxt);
 
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlXPathRegisterFunc            (xmlXPathContextPtr ctxt,
                                                 const xmlChar *name,
                                                 xmlXPathFunction f);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlXPathRegisterFuncNS          (xmlXPathContextPtr ctxt,
                                                 const xmlChar *name,
                                                 const xmlChar *ns_uri,
                                                 xmlXPathFunction f);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlXPathRegisterVariable        (xmlXPathContextPtr ctxt,
                                                 const xmlChar *name,
                                                 xmlXPathObjectPtr value);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlXPathRegisterVariableNS      (xmlXPathContextPtr ctxt,
                                                 const xmlChar *name,
                                                 const xmlChar *ns_uri,
                                                 xmlXPathObjectPtr value);
-XMLPUBFUN xmlXPathFunction XMLCALL
+XMLPUBFUN xmlXPathFunction
                xmlXPathFunctionLookup          (xmlXPathContextPtr ctxt,
                                                 const xmlChar *name);
-XMLPUBFUN xmlXPathFunction XMLCALL
+XMLPUBFUN xmlXPathFunction
                xmlXPathFunctionLookupNS        (xmlXPathContextPtr ctxt,
                                                 const xmlChar *name,
                                                 const xmlChar *ns_uri);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlXPathRegisteredFuncsCleanup  (xmlXPathContextPtr ctxt);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                xmlXPathVariableLookup          (xmlXPathContextPtr ctxt,
                                                 const xmlChar *name);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                xmlXPathVariableLookupNS        (xmlXPathContextPtr ctxt,
                                                 const xmlChar *name,
                                                 const xmlChar *ns_uri);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt);
 
 /**
  * Utilities to extend XPath.
  */
-XMLPUBFUN xmlXPathParserContextPtr XMLCALL
+XMLPUBFUN xmlXPathParserContextPtr
                  xmlXPathNewParserContext      (const xmlChar *str,
                                                 xmlXPathContextPtr ctxt);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlXPathFreeParserContext       (xmlXPathParserContextPtr ctxt);
 
 /* TODO: remap to xmlXPathValuePop and Push. */
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                valuePop                        (xmlXPathParserContextPtr ctxt);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                valuePush                       (xmlXPathParserContextPtr ctxt,
                                                 xmlXPathObjectPtr value);
 
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                xmlXPathNewString               (const xmlChar *val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                xmlXPathNewCString              (const char *val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                xmlXPathWrapString              (xmlChar *val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                xmlXPathWrapCString             (char * val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                xmlXPathNewFloat                (double val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                xmlXPathNewBoolean              (int val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                xmlXPathNewNodeSet              (xmlNodePtr val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                xmlXPathNewValueTree            (xmlNodePtr val);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlXPathNodeSetAdd              (xmlNodeSetPtr cur,
                                                 xmlNodePtr val);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlXPathNodeSetAddUnique        (xmlNodeSetPtr cur,
                                                 xmlNodePtr val);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlXPathNodeSetAddNs            (xmlNodeSetPtr cur,
                                                 xmlNodePtr node,
                                                 xmlNsPtr ns);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlXPathNodeSetSort             (xmlNodeSetPtr set);
 
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlXPathRoot                    (xmlXPathParserContextPtr ctxt);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlXPathEvalExpr                (xmlXPathParserContextPtr ctxt);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlXPathParseName               (xmlXPathParserContextPtr ctxt);
-XMLPUBFUN xmlChar * XMLCALL
+XMLPUBFUN xmlChar *
                xmlXPathParseNCName             (xmlXPathParserContextPtr ctxt);
 
 /*
  * Existing functions.
  */
-XMLPUBFUN double XMLCALL
+XMLPUBFUN double
                xmlXPathStringEvalNumber        (const xmlChar *str);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int
                xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ctxt,
                                                 xmlXPathObjectPtr res);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlXPathRegisterAllFunctions    (xmlXPathContextPtr ctxt);
-XMLPUBFUN xmlNodeSetPtr XMLCALL
+XMLPUBFUN xmlNodeSetPtr
                xmlXPathNodeSetMerge            (xmlNodeSetPtr val1,
                                                 xmlNodeSetPtr val2);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlXPathNodeSetDel              (xmlNodeSetPtr cur,
                                                 xmlNodePtr val);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                xmlXPathNodeSetRemove           (xmlNodeSetPtr cur,
                                                 int val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                xmlXPathNewNodeSetList          (xmlNodeSetPtr val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                xmlXPathWrapNodeSet             (xmlNodeSetPtr val);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                xmlXPathWrapExternal            (void *val);
 
-XMLPUBFUN int XMLCALL xmlXPathEqualValues(xmlXPathParserContextPtr ctxt);
-XMLPUBFUN int XMLCALL xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt);
-XMLPUBFUN int XMLCALL xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict);
-XMLPUBFUN void XMLCALL xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt);
-XMLPUBFUN void XMLCALL xmlXPathAddValues(xmlXPathParserContextPtr ctxt);
-XMLPUBFUN void XMLCALL xmlXPathSubValues(xmlXPathParserContextPtr ctxt);
-XMLPUBFUN void XMLCALL xmlXPathMultValues(xmlXPathParserContextPtr ctxt);
-XMLPUBFUN void XMLCALL xmlXPathDivValues(xmlXPathParserContextPtr ctxt);
-XMLPUBFUN void XMLCALL xmlXPathModValues(xmlXPathParserContextPtr ctxt);
+XMLPUBFUN int xmlXPathEqualValues(xmlXPathParserContextPtr ctxt);
+XMLPUBFUN int xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt);
+XMLPUBFUN int xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict);
+XMLPUBFUN void xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt);
+XMLPUBFUN void xmlXPathAddValues(xmlXPathParserContextPtr ctxt);
+XMLPUBFUN void xmlXPathSubValues(xmlXPathParserContextPtr ctxt);
+XMLPUBFUN void xmlXPathMultValues(xmlXPathParserContextPtr ctxt);
+XMLPUBFUN void xmlXPathDivValues(xmlXPathParserContextPtr ctxt);
+XMLPUBFUN void xmlXPathModValues(xmlXPathParserContextPtr ctxt);
 
-XMLPUBFUN int XMLCALL xmlXPathIsNodeType(const xmlChar *name);
+XMLPUBFUN int xmlXPathIsNodeType(const xmlChar *name);
 
 /*
  * Some of the axis navigation routines.
  */
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextSelf(xmlXPathParserContextPtr ctxt,
+XMLPUBFUN xmlNodePtr xmlXPathNextSelf(xmlXPathParserContextPtr ctxt,
                        xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextChild(xmlXPathParserContextPtr ctxt,
+XMLPUBFUN xmlNodePtr xmlXPathNextChild(xmlXPathParserContextPtr ctxt,
                        xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt,
+XMLPUBFUN xmlNodePtr xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt,
                        xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt,
+XMLPUBFUN xmlNodePtr xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt,
                        xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextParent(xmlXPathParserContextPtr ctxt,
+XMLPUBFUN xmlNodePtr xmlXPathNextParent(xmlXPathParserContextPtr ctxt,
                        xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt,
+XMLPUBFUN xmlNodePtr xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt,
                        xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt,
+XMLPUBFUN xmlNodePtr xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt,
                        xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt,
+XMLPUBFUN xmlNodePtr xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt,
                        xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt,
+XMLPUBFUN xmlNodePtr xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt,
                        xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt,
+XMLPUBFUN xmlNodePtr xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt,
                        xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt,
+XMLPUBFUN xmlNodePtr xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt,
                        xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt,
+XMLPUBFUN xmlNodePtr xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt,
                        xmlNodePtr cur);
-XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt,
+XMLPUBFUN xmlNodePtr xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt,
                        xmlNodePtr cur);
 /*
  * The official core of XPath functions.
  */
-XMLPUBFUN void XMLCALL xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs);
-XMLPUBFUN void XMLCALL xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs);
+XMLPUBFUN void xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs);
 
 /**
  * Really internal functions
  */
-XMLPUBFUN void XMLCALL xmlXPathNodeSetFreeNs(xmlNsPtr ns);
+XMLPUBFUN void xmlXPathNodeSetFreeNs(xmlNsPtr ns);
 
 #ifdef __cplusplus
 }
index ca7bdbe..12ce9ed 100644 (file)
@@ -45,64 +45,64 @@ struct _xmlLocationSet {
  */
 
 XML_DEPRECATED
-XMLPUBFUN xmlLocationSetPtr XMLCALL
+XMLPUBFUN xmlLocationSetPtr
                    xmlXPtrLocationSetCreate    (xmlXPathObjectPtr val);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                    xmlXPtrFreeLocationSet      (xmlLocationSetPtr obj);
 XML_DEPRECATED
-XMLPUBFUN xmlLocationSetPtr XMLCALL
+XMLPUBFUN xmlLocationSetPtr
                    xmlXPtrLocationSetMerge     (xmlLocationSetPtr val1,
                                                 xmlLocationSetPtr val2);
 XML_DEPRECATED
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                    xmlXPtrNewRange             (xmlNodePtr start,
                                                 int startindex,
                                                 xmlNodePtr end,
                                                 int endindex);
 XML_DEPRECATED
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                    xmlXPtrNewRangePoints       (xmlXPathObjectPtr start,
                                                 xmlXPathObjectPtr end);
 XML_DEPRECATED
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                    xmlXPtrNewRangeNodePoint    (xmlNodePtr start,
                                                 xmlXPathObjectPtr end);
 XML_DEPRECATED
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                    xmlXPtrNewRangePointNode    (xmlXPathObjectPtr start,
                                                 xmlNodePtr end);
 XML_DEPRECATED
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                    xmlXPtrNewRangeNodes        (xmlNodePtr start,
                                                 xmlNodePtr end);
 XML_DEPRECATED
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                    xmlXPtrNewLocationSetNodes  (xmlNodePtr start,
                                                 xmlNodePtr end);
 XML_DEPRECATED
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                    xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set);
 XML_DEPRECATED
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                    xmlXPtrNewRangeNodeObject   (xmlNodePtr start,
                                                 xmlXPathObjectPtr end);
 XML_DEPRECATED
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                    xmlXPtrNewCollapsedRange    (xmlNodePtr start);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                    xmlXPtrLocationSetAdd       (xmlLocationSetPtr cur,
                                                 xmlXPathObjectPtr val);
 XML_DEPRECATED
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                    xmlXPtrWrapLocationSet      (xmlLocationSetPtr val);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                    xmlXPtrLocationSetDel       (xmlLocationSetPtr cur,
                                                 xmlXPathObjectPtr val);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                    xmlXPtrLocationSetRemove    (xmlLocationSetPtr cur,
                                                 int val);
 #endif /* LIBXML_XPTR_LOCS_ENABLED */
@@ -110,23 +110,23 @@ XMLPUBFUN void XMLCALL
 /*
  * Functions.
  */
-XMLPUBFUN xmlXPathContextPtr XMLCALL
+XMLPUBFUN xmlXPathContextPtr
                    xmlXPtrNewContext           (xmlDocPtr doc,
                                                 xmlNodePtr here,
                                                 xmlNodePtr origin);
-XMLPUBFUN xmlXPathObjectPtr XMLCALL
+XMLPUBFUN xmlXPathObjectPtr
                    xmlXPtrEval                 (const xmlChar *str,
                                                 xmlXPathContextPtr ctx);
 #ifdef LIBXML_XPTR_LOCS_ENABLED
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                    xmlXPtrRangeToFunction      (xmlXPathParserContextPtr ctxt,
                                                 int nargs);
 XML_DEPRECATED
-XMLPUBFUN xmlNodePtr XMLCALL
+XMLPUBFUN xmlNodePtr
                    xmlXPtrBuildNodeList        (xmlXPathObjectPtr obj);
 XML_DEPRECATED
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void
                    xmlXPtrEvalRangePredicate   (xmlXPathParserContextPtr ctxt);
 #endif /* LIBXML_XPTR_LOCS_ENABLED */
 #ifdef __cplusplus
diff --git a/include/private/Makefile.am b/include/private/Makefile.am
new file mode 100644 (file)
index 0000000..29c0bdd
--- /dev/null
@@ -0,0 +1,19 @@
+EXTRA_DIST = \
+       buf.h \
+       dict.h \
+       enc.h \
+       entities.h \
+       error.h \
+       globals.h \
+       html.h \
+       io.h \
+       memory.h \
+       parser.h \
+       regexp.h \
+       save.h \
+       string.h \
+       threads.h \
+       tree.h \
+       xinclude.h \
+       xpath.h \
+       xzlib.h
diff --git a/include/private/buf.h b/include/private/buf.h
new file mode 100644 (file)
index 0000000..c18eed4
--- /dev/null
@@ -0,0 +1,70 @@
+#ifndef XML_BUF_H_PRIVATE__
+#define XML_BUF_H_PRIVATE__
+
+#include <libxml/tree.h>
+
+XML_HIDDEN xmlBufPtr
+xmlBufCreate(void);
+XML_HIDDEN xmlBufPtr
+xmlBufCreateSize(size_t size);
+
+XML_HIDDEN int
+xmlBufSetAllocationScheme(xmlBufPtr buf, xmlBufferAllocationScheme scheme);
+XML_HIDDEN int
+xmlBufGetAllocationScheme(xmlBufPtr buf);
+
+XML_HIDDEN void
+xmlBufFree(xmlBufPtr buf);
+XML_HIDDEN void
+xmlBufEmpty(xmlBufPtr buf);
+
+/* size_t xmlBufShrink(xmlBufPtr buf, size_t len); */
+XML_HIDDEN int
+xmlBufGrow(xmlBufPtr buf, int len);
+XML_HIDDEN int
+xmlBufResize(xmlBufPtr buf, size_t len);
+
+XML_HIDDEN int
+xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len);
+XML_HIDDEN int
+xmlBufCat(xmlBufPtr buf, const xmlChar *str);
+XML_HIDDEN int
+xmlBufCCat(xmlBufPtr buf, const char *str);
+XML_HIDDEN int
+xmlBufWriteQuotedString(xmlBufPtr buf, const xmlChar *string);
+
+XML_HIDDEN size_t
+xmlBufAvail(const xmlBufPtr buf);
+XML_HIDDEN size_t
+xmlBufLength(const xmlBufPtr buf);
+/* size_t xmlBufUse(const xmlBufPtr buf); */
+XML_HIDDEN int
+xmlBufIsEmpty(const xmlBufPtr buf);
+XML_HIDDEN int
+xmlBufAddLen(xmlBufPtr buf, size_t len);
+
+/* const xmlChar * xmlBufContent(const xmlBuf *buf); */
+/* const xmlChar * xmlBufEnd(xmlBufPtr buf); */
+
+XML_HIDDEN xmlChar *
+xmlBufDetach(xmlBufPtr buf);
+
+XML_HIDDEN size_t
+xmlBufDump(FILE *file, xmlBufPtr buf);
+
+XML_HIDDEN xmlBufPtr
+xmlBufFromBuffer(xmlBufferPtr buffer);
+XML_HIDDEN xmlBufferPtr
+xmlBufBackToBuffer(xmlBufPtr buf);
+XML_HIDDEN int
+xmlBufMergeBuffer(xmlBufPtr buf, xmlBufferPtr buffer);
+
+XML_HIDDEN int
+xmlBufResetInput(xmlBufPtr buf, xmlParserInputPtr input);
+XML_HIDDEN size_t
+xmlBufGetInputBase(xmlBufPtr buf, xmlParserInputPtr input);
+XML_HIDDEN int
+xmlBufSetInputBaseCur(xmlBufPtr buf, xmlParserInputPtr input,
+                      size_t base, size_t cur);
+
+#endif /* XML_BUF_H_PRIVATE__ */
diff --git a/include/private/dict.h b/include/private/dict.h
new file mode 100644 (file)
index 0000000..fcc10ba
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef XML_DICT_H_PRIVATE__
+#define XML_DICT_H_PRIVATE__
+
+XML_HIDDEN int
+__xmlInitializeDict(void);
+XML_HIDDEN void
+xmlCleanupDictInternal(void);
+XML_HIDDEN int
+__xmlRandom(void);
+
+#endif /* XML_DICT_H_PRIVATE__ */
diff --git a/include/private/enc.h b/include/private/enc.h
new file mode 100644 (file)
index 0000000..cbdc2b3
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef XML_ENC_H_PRIVATE__
+#define XML_ENC_H_PRIVATE__
+
+#include <libxml/encoding.h>
+#include <libxml/tree.h>
+
+XML_HIDDEN void
+xmlInitEncodingInternal(void);
+
+XML_HIDDEN int
+xmlEncInputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
+                 int *outlen, const unsigned char *in, int *inlen, int flush);
+XML_HIDDEN int
+xmlCharEncInput(xmlParserInputBufferPtr input, int flush);
+XML_HIDDEN int
+xmlCharEncOutput(xmlOutputBufferPtr output, int init);
+
+#endif /* XML_ENC_H_PRIVATE__ */
diff --git a/include/private/entities.h b/include/private/entities.h
new file mode 100644 (file)
index 0000000..c3f15e6
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef XML_ENTITIES_H_PRIVATE__
+#define XML_ENTITIES_H_PRIVATE__
+
+#include <libxml/tree.h>
+#include <libxml/xmlstring.h>
+
+/*
+ * Entity flags
+ *
+ * XML_ENT_PARSED: The entity was parsed and `children` points to the
+ * content.
+ * XML_ENT_CHECKED: The entity was checked for loops.
+ */
+#define XML_ENT_PARSED      (1<<0)
+#define XML_ENT_CHECKED     (1<<1)
+#define XML_ENT_EXPANDING   (1<<2)
+#define XML_ENT_CHECKED_LT  (1<<3)
+#define XML_ENT_CONTAINS_LT (1<<4)
+
+XML_HIDDEN xmlChar *
+xmlEncodeAttributeEntities(xmlDocPtr doc, const xmlChar *input);
+
+#endif /* XML_ENTITIES_H_PRIVATE__ */
diff --git a/include/private/error.h b/include/private/error.h
new file mode 100644 (file)
index 0000000..7f284f9
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef XML_ERROR_H_PRIVATE__
+#define XML_ERROR_H_PRIVATE__
+
+#include <libxml/xmlerror.h>
+#include <libxml/xmlversion.h>
+
+XML_HIDDEN void
+__xmlRaiseError(xmlStructuredErrorFunc schannel,
+                xmlGenericErrorFunc channel, void *data, void *ctx,
+                void *nod, int domain, int code, xmlErrorLevel level,
+                const char *file, int line, const char *str1,
+                const char *str2, const char *str3, int int1, int col,
+               const char *msg, ...) LIBXML_ATTR_FORMAT(16,17);
+XML_HIDDEN void
+__xmlSimpleError(int domain, int code, xmlNodePtr node,
+                 const char *msg, const char *extra) LIBXML_ATTR_FORMAT(4,0);
+XML_HIDDEN void
+xmlGenericErrorDefaultFunc(void *ctx, const char *msg,
+                           ...) LIBXML_ATTR_FORMAT(2,3);
+
+#endif /* XML_ERROR_H_PRIVATE__ */
diff --git a/include/private/globals.h b/include/private/globals.h
new file mode 100644 (file)
index 0000000..5f3f112
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef XML_GLOBALS_H_PRIVATE__
+#define XML_GLOBALS_H_PRIVATE__
+
+XML_HIDDEN void
+xmlInitGlobalsInternal(void);
+XML_HIDDEN void
+xmlCleanupGlobalsInternal(void);
+
+#endif /* XML_GLOBALS_H_PRIVATE__ */
diff --git a/include/private/html.h b/include/private/html.h
new file mode 100644 (file)
index 0000000..6b49929
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef XML_HTML_H_PRIVATE__
+#define XML_HTML_H_PRIVATE__
+
+#include <libxml/xmlversion.h>
+
+#ifdef LIBXML_HTML_ENABLED
+
+XML_HIDDEN void
+__htmlParseContent(void *ctx);
+
+#endif /* LIBXML_HTML_ENABLED */
+
+#endif /* XML_HTML_H_PRIVATE__ */
+
diff --git a/include/private/io.h b/include/private/io.h
new file mode 100644 (file)
index 0000000..86a72e1
--- /dev/null
@@ -0,0 +1,19 @@
+#ifndef XML_IO_H_PRIVATE__
+#define XML_IO_H_PRIVATE__
+
+#include <libxml/encoding.h>
+#include <libxml/tree.h>
+#include <libxml/xmlversion.h>
+
+XML_HIDDEN void
+__xmlIOErr(int domain, int code, const char *extra);
+XML_HIDDEN void
+__xmlLoaderErr(void *ctx, const char *msg,
+               const char *filename) LIBXML_ATTR_FORMAT(2,0);
+
+#ifdef LIBXML_OUTPUT_ENABLED
+XML_HIDDEN xmlOutputBufferPtr
+xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder);
+#endif
+
+#endif /* XML_IO_H_PRIVATE__ */
diff --git a/include/private/memory.h b/include/private/memory.h
new file mode 100644 (file)
index 0000000..ef0497c
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef XML_MEMORY_H_PRIVATE__
+#define XML_MEMORY_H_PRIVATE__
+
+XML_HIDDEN void
+xmlInitMemoryInternal(void);
+XML_HIDDEN void
+xmlCleanupMemoryInternal(void);
+
+#endif /* XML_MEMORY_H_PRIVATE__ */
diff --git a/include/private/parser.h b/include/private/parser.h
new file mode 100644 (file)
index 0000000..820bb58
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef XML_PARSER_H_PRIVATE__
+#define XML_PARSER_H_PRIVATE__
+
+#include <libxml/parser.h>
+#include <libxml/xmlversion.h>
+
+/**
+ * XML_VCTXT_DTD_VALIDATED:
+ *
+ * Set after xmlValidateDtdFinal was called.
+ */
+#define XML_VCTXT_DTD_VALIDATED (1u << 0)
+/**
+ * XML_VCTXT_USE_PCTXT:
+ *
+ * Set if the validation context is part of a parser context.
+ */
+#define XML_VCTXT_USE_PCTXT (1u << 1)
+
+XML_HIDDEN void
+xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra);
+XML_HIDDEN void
+__xmlErrEncoding(xmlParserCtxtPtr ctxt, xmlParserErrors xmlerr,
+                 const char *msg, const xmlChar *str1,
+                 const xmlChar *str2) LIBXML_ATTR_FORMAT(3,0);
+XML_HIDDEN void
+xmlHaltParser(xmlParserCtxtPtr ctxt);
+XML_HIDDEN int
+xmlParserGrow(xmlParserCtxtPtr ctxt);
+XML_HIDDEN void
+xmlParserShrink(xmlParserCtxtPtr ctxt);
+
+#endif /* XML_PARSER_H_PRIVATE__ */
diff --git a/include/private/regexp.h b/include/private/regexp.h
new file mode 100644 (file)
index 0000000..f202493
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef XML_REGEXP_H_PRIVATE__
+#define XML_REGEXP_H_PRIVATE__
+
+#include <libxml/xmlautomata.h>
+
+XML_HIDDEN void
+xmlAutomataSetFlags(xmlAutomataPtr am, int flags);
+
+#endif /* XML_REGEXP_H_PRIVATE__ */
diff --git a/include/private/save.h b/include/private/save.h
new file mode 100644 (file)
index 0000000..873aad7
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef XML_SAVE_H_PRIVATE__
+#define XML_SAVE_H_PRIVATE__
+
+#include <libxml/tree.h>
+#include <libxml/xmlversion.h>
+
+#ifdef LIBXML_OUTPUT_ENABLED
+
+XML_HIDDEN void
+xmlBufAttrSerializeTxtContent(xmlBufPtr buf, xmlDocPtr doc,
+                              xmlAttrPtr attr, const xmlChar * string);
+XML_HIDDEN void
+xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur);
+
+#endif /* LIBXML_OUTPUT_ENABLED */
+
+#endif /* XML_SAVE_H_PRIVATE__ */
+
diff --git a/include/private/string.h b/include/private/string.h
new file mode 100644 (file)
index 0000000..9665fc4
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef XML_STRING_H_PRIVATE__
+#define XML_STRING_H_PRIVATE__
+
+#include <libxml/xmlstring.h>
+
+XML_HIDDEN xmlChar *
+xmlEscapeFormatString(xmlChar **msg);
+
+#endif /* XML_STRING_H_PRIVATE__ */
diff --git a/include/private/threads.h b/include/private/threads.h
new file mode 100644 (file)
index 0000000..b337bfa
--- /dev/null
@@ -0,0 +1,50 @@
+#ifndef XML_THREADS_H_PRIVATE__
+#define XML_THREADS_H_PRIVATE__
+
+#include <libxml/threads.h>
+
+#ifdef LIBXML_THREAD_ENABLED
+  #ifdef HAVE_PTHREAD_H
+    #include <pthread.h>
+    #define HAVE_POSIX_THREADS
+  #elif defined(_WIN32)
+    #define WIN32_LEAN_AND_MEAN
+    #include <windows.h>
+    #ifndef HAVE_COMPILER_TLS
+      #include <process.h>
+    #endif
+    #define HAVE_WIN32_THREADS
+  #endif
+#endif
+
+/*
+ * xmlMutex are a simple mutual exception locks
+ */
+struct _xmlMutex {
+#ifdef HAVE_POSIX_THREADS
+    pthread_mutex_t lock;
+#elif defined HAVE_WIN32_THREADS
+    CRITICAL_SECTION cs;
+#else
+    int empty;
+#endif
+};
+
+XML_HIDDEN void
+__xmlGlobalInitMutexLock(void);
+XML_HIDDEN void
+__xmlGlobalInitMutexUnlock(void);
+XML_HIDDEN void
+__xmlGlobalInitMutexDestroy(void);
+
+XML_HIDDEN void
+xmlInitThreadsInternal(void);
+XML_HIDDEN void
+xmlCleanupThreadsInternal(void);
+
+XML_HIDDEN void
+xmlInitMutex(xmlMutexPtr mutex);
+XML_HIDDEN void
+xmlCleanupMutex(xmlMutexPtr mutex);
+
+#endif /* XML_THREADS_H_PRIVATE__ */
diff --git a/include/private/tree.h b/include/private/tree.h
new file mode 100644 (file)
index 0000000..fb5e162
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef XML_TREE_H_PRIVATE__
+#define XML_TREE_H_PRIVATE__
+
+/*
+ * Internal variable indicating if a callback has been registered for
+ * node creation/destruction. It avoids spending a lot of time in locking
+ * function while checking if the callback exists.
+ */
+XML_HIDDEN extern int
+__xmlRegisterCallbacks;
+
+XML_HIDDEN xmlNodePtr
+xmlStaticCopyNode(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
+                  int extended);
+XML_HIDDEN xmlNodePtr
+xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent);
+
+#endif /* XML_TREE_H_PRIVATE__ */
diff --git a/include/private/xinclude.h b/include/private/xinclude.h
new file mode 100644 (file)
index 0000000..43c77e5
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef XML_INCLUDE_H_PRIVATE__
+#define XML_INCLUDE_H_PRIVATE__
+
+#include <libxml/xinclude.h>
+
+XML_HIDDEN int
+xmlXIncludeSetStreamingMode(xmlXIncludeCtxtPtr ctxt, int mode);
+
+#endif /* XML_INCLUDE_H_PRIVATE__ */
diff --git a/include/private/xpath.h b/include/private/xpath.h
new file mode 100644 (file)
index 0000000..0e8d752
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef XML_XPATH_H_PRIVATE__
+#define XML_XPATH_H_PRIVATE__
+
+XML_HIDDEN void
+xmlInitXPathInternal(void);
+
+#endif /* XML_XPATH_H_PRIVATE__ */
diff --git a/include/private/xzlib.h b/include/private/xzlib.h
new file mode 100644 (file)
index 0000000..b332698
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ * xzlib.h: header for the front end for the transparent support of lzma
+ *          compression at the I/O layer
+ *
+ * See Copyright for the status of this software.
+ *
+ * Anders F Bjorklund <afb@users.sourceforge.net>
+ */
+
+#ifndef LIBXML2_XZLIB_H
+#define LIBXML2_XZLIB_H
+
+#include <libxml/xmlversion.h>
+
+#ifdef LIBXML_LZMA_ENABLED
+
+typedef void *xzFile;           /* opaque lzma file descriptor */
+
+XML_HIDDEN xzFile
+__libxml2_xzopen(const char *path, const char *mode);
+XML_HIDDEN xzFile
+__libxml2_xzdopen(int fd, const char *mode);
+XML_HIDDEN int
+__libxml2_xzread(xzFile file, void *buf, unsigned len);
+XML_HIDDEN int
+__libxml2_xzclose(xzFile file);
+XML_HIDDEN int
+__libxml2_xzcompressed(xzFile f);
+
+#endif /* LIBXML_LZMA_ENABLED */
+
+#endif /* LIBXML2_XZLIB_H */
index 4f99ae0..a25e038 100644 (file)
@@ -1,20 +1,21 @@
 #ifndef __LIBXML_WIN32_CONFIG__
 #define __LIBXML_WIN32_CONFIG__
 
-#define SEND_ARG2_CAST
-#define GETHOSTBYNAME_ARG_CAST
-
 #define HAVE_SYS_STAT_H
 #define HAVE_STAT
 #define HAVE_FCNTL_H
 
 #if defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER >= 1600)
-#define HAVE_STDINT_H
+  #define HAVE_STDINT_H
 #endif
 
-#if defined(_MSC_VER) && _MSC_VER < 1900
-#define snprintf _snprintf
-#define vsnprintf _vsnprintf
+#if defined(_MSC_VER)
+  #if _MSC_VER < 1900
+    #define snprintf _snprintf
+  #endif
+  #if _MSC_VER < 1500
+    #define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
+  #endif
 #endif
 
 #endif /* __LIBXML_WIN32_CONFIG__ */
index 85b9e7d..141de0c 100644 (file)
 /* Check if ws2tcpip.h is a recent version which provides getaddrinfo() */
 #if defined(GetAddrInfo)
 #include <wspiapi.h>
-#define HAVE_GETADDRINFO
+#ifndef SUPPORT_IP6
+  #define SUPPORT_IP6
+#endif
 #endif
 
-#undef XML_SOCKLEN_T
+#ifndef XML_SOCKLEN_T
 #define XML_SOCKLEN_T int
+#endif
 
 #ifndef ECONNRESET
 #define ECONNRESET WSAECONNRESET
index 66f164d..c3d04bc 100644 (file)
--- a/libxml.h
+++ b/libxml.h
  * Do not add any #include directives above this block.
  */
 #ifndef NO_LARGEFILE_SOURCE
-#ifndef _LARGEFILE_SOURCE
-#define _LARGEFILE_SOURCE
-#endif
-#ifndef _FILE_OFFSET_BITS
-#define _FILE_OFFSET_BITS 64
-#endif
+  #ifndef _LARGEFILE_SOURCE
+    #define _LARGEFILE_SOURCE
+  #endif
+  #ifndef _FILE_OFFSET_BITS
+    #define _FILE_OFFSET_BITS 64
+  #endif
 #endif
 
 /*
- * Currently supported platforms use either autoconf or
- * copy to config.h own "preset" configuration file.
- * As result ifdef HAVE_CONFIG_H is omitted here.
+ * These files are generated by the build system and contain private
+ * and public build configuration.
  */
 #include "config.h"
 #include <libxml/xmlversion.h>
-#include <libxml/xmlstring.h>
 
+/*
+ * Due to some Autotools limitations, this variable must be passed as
+ * compiler flag. Define a default value if the macro wasn't set by the
+ * build system.
+ */
 #ifndef SYSCONFDIR
   #define SYSCONFDIR "/etc"
 #endif
 
-#if defined(__Lynx__)
-#include <stdio.h> /* pull definition of size_t */
-#include <varargs.h>
-int snprintf(char *, size_t, const char *, ...);
-int vfprintf(FILE *, const char *, va_list);
-#endif
-
-#ifndef WITH_TRIO
-#include <stdio.h>
-#else
-/**
- * TRIO_REPLACE_STDIO:
- *
- * This macro is defined if the trio string formatting functions are to
- * be used instead of the default stdio ones.
- */
-#define TRIO_REPLACE_STDIO
-#include "trio.h"
+#ifdef WITH_TRIO
+  #define TRIO_REPLACE_STDIO
+  #include "trio.h"
 #endif
 
-#if defined(__clang__) || \
-    (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406))
-#define XML_IGNORE_PEDANTIC_WARNINGS \
-    _Pragma("GCC diagnostic push") \
-    _Pragma("GCC diagnostic ignored \"-Wpedantic\"")
-#define XML_POP_WARNINGS \
-    _Pragma("GCC diagnostic pop")
+#if !defined(_WIN32) && \
+    !defined(__CYGWIN__) && \
+    (defined(__clang__) || \
+     (defined(__GNUC__) && (__GNUC__ >= 4)))
+  #define XML_HIDDEN __attribute__((visibility("hidden")))
 #else
-#define XML_IGNORE_PEDANTIC_WARNINGS
-#define XML_POP_WARNINGS
+  #define XML_HIDDEN
 #endif
 
 #if defined(__clang__) || \
     (defined(__GNUC__) && (__GNUC__ >= 8))
-#define ATTRIBUTE_NO_SANITIZE(arg) __attribute__((no_sanitize(arg)))
+  #define ATTRIBUTE_NO_SANITIZE(arg) __attribute__((no_sanitize(arg)))
 #else
-#define ATTRIBUTE_NO_SANITIZE(arg)
+  #define ATTRIBUTE_NO_SANITIZE(arg)
 #endif
 
-/*
- * Internal variable indicating if a callback has been registered for
- * node creation/destruction. It avoids spending a lot of time in locking
- * function while checking if the callback exists.
- */
-extern int __xmlRegisterCallbacks;
-/*
- * internal error reporting routines, shared but not part of the API.
- */
-void __xmlIOErr(int domain, int code, const char *extra);
-void __xmlLoaderErr(void *ctx, const char *msg, const char *filename) LIBXML_ATTR_FORMAT(2,0);
-#ifdef LIBXML_HTML_ENABLED
-/*
- * internal function of HTML parser needed for xmlParseInNodeContext
- * but not part of the API
- */
-void __htmlParseContent(void *ctx);
-#endif
-
-/*
- * internal global initialization critical section routines.
- */
-void __xmlGlobalInitMutexLock(void);
-void __xmlGlobalInitMutexUnlock(void);
-void __xmlGlobalInitMutexDestroy(void);
-
-int __xmlInitializeDict(void);
-
-/*
- * internal thread safe random function
- */
-int __xmlRandom(void);
-
-XMLPUBFUN xmlChar * XMLCALL xmlEscapeFormatString(xmlChar **msg);
-int xmlInputReadCallbackNop(void *context, char *buffer, int len);
-
-#if !defined(PIC) && !defined(NOLIBTOOL) && !defined(LIBXML_STATIC)
-#  define LIBXML_STATIC
-#endif
 #endif /* ! __XML_LIBXML_H__ */
index fc7790c..27ad84d 100644 (file)
--- a/libxml.m4
+++ b/libxml.m4
-# Configure paths for LIBXML2
-# Simon Josefsson 2020-02-12
-# Fix autoconf 2.70+ warnings
-# Mike Hommey 2004-06-19
-# use CPPFLAGS instead of CFLAGS
-# Toshio Kuratomi 2001-04-21
-# Adapted from:
-# Configure paths for GLIB
-# Owen Taylor     97-11-3
-
 dnl AM_PATH_XML2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
 dnl Test for XML, and define XML_CPPFLAGS and XML_LIBS
 dnl
-AC_DEFUN([AM_PATH_XML2],[ 
-AC_ARG_WITH(xml-prefix,
-            [  --with-xml-prefix=PFX   Prefix where libxml is installed (optional)],
-            xml_config_prefix="$withval", xml_config_prefix="")
-AC_ARG_WITH(xml-exec-prefix,
-            [  --with-xml-exec-prefix=PFX Exec prefix where libxml is installed (optional)],
-            xml_config_exec_prefix="$withval", xml_config_exec_prefix="")
-AC_ARG_ENABLE(xmltest,
-              [  --disable-xmltest       Do not try to compile and run a test LIBXML program],,
-              enable_xmltest=yes)
-
-  if test x$xml_config_exec_prefix != x ; then
-     xml_config_args="$xml_config_args"
-     if test x${XML2_CONFIG+set} != xset ; then
-        XML2_CONFIG=$xml_config_exec_prefix/bin/xml2-config
-     fi
-  fi
-  if test x$xml_config_prefix != x ; then
-     xml_config_args="$xml_config_args --prefix=$xml_config_prefix"
-     if test x${XML2_CONFIG+set} != xset ; then
-        XML2_CONFIG=$xml_config_prefix/bin/xml2-config
-     fi
-  fi
-
-  AC_PATH_PROG(XML2_CONFIG, xml2-config, no)
-  min_xml_version=ifelse([$1], ,2.0.0,[$1])
-  AC_MSG_CHECKING(for libxml - version >= $min_xml_version)
-  no_xml=""
-  if test "$XML2_CONFIG" = "no" ; then
-    no_xml=yes
-  else
-    XML_CPPFLAGS=`$XML2_CONFIG $xml_config_args --cflags`
-    XML_LIBS=`$XML2_CONFIG $xml_config_args --libs`
-    xml_config_major_version=`$XML2_CONFIG $xml_config_args --version | \
-           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
-    xml_config_minor_version=`$XML2_CONFIG $xml_config_args --version | \
-           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
-    xml_config_micro_version=`$XML2_CONFIG $xml_config_args --version | \
-           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
-    if test "x$enable_xmltest" = "xyes" ; then
-      ac_save_CPPFLAGS="$CPPFLAGS"
-      ac_save_LIBS="$LIBS"
-      CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS"
-      LIBS="$XML_LIBS $LIBS"
-dnl
-dnl Now check if the installed libxml is sufficiently new.
-dnl (Also sanity checks the results of xml2-config to some extent)
-dnl
-      rm -f conf.xmltest
-      AC_RUN_IFELSE(
-            [AC_LANG_SOURCE([[
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <libxml/xmlversion.h>
-
-int 
-main()
-{
-  int xml_major_version, xml_minor_version, xml_micro_version;
-  int major, minor, micro;
-  char *tmp_version;
-
-  system("touch conf.xmltest");
-
-  /* Capture xml2-config output via autoconf/configure variables */
-  /* HP/UX 9 (%@#!) writes to sscanf strings */
-  tmp_version = (char *)strdup("$min_xml_version");
-  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
-     printf("%s, bad version string from xml2-config\n", "$min_xml_version");
-     exit(1);
-   }
-   free(tmp_version);
-
-   /* Capture the version information from the header files */
-   tmp_version = (char *)strdup(LIBXML_DOTTED_VERSION);
-   if (sscanf(tmp_version, "%d.%d.%d", &xml_major_version, &xml_minor_version, &xml_micro_version) != 3) {
-     printf("%s, bad version string from libxml includes\n", "LIBXML_DOTTED_VERSION");
-     exit(1);
-   }
-   free(tmp_version);
-
- /* Compare xml2-config output to the libxml headers */
-  if ((xml_major_version != $xml_config_major_version) ||
-      (xml_minor_version != $xml_config_minor_version) ||
-      (xml_micro_version != $xml_config_micro_version))
-    {
-      printf("*** libxml header files (version %d.%d.%d) do not match\n",
-         xml_major_version, xml_minor_version, xml_micro_version);
-      printf("*** xml2-config (version %d.%d.%d)\n",
-         $xml_config_major_version, $xml_config_minor_version, $xml_config_micro_version);
-      return 1;
-    } 
-/* Compare the headers to the library to make sure we match */
-  /* Less than ideal -- doesn't provide us with return value feedback, 
-   * only exits if there's a serious mismatch between header and library.
-   */
-    LIBXML_TEST_VERSION;
-
-    /* Test that the library is greater than our minimum version */
-    if ((xml_major_version > major) ||
-        ((xml_major_version == major) && (xml_minor_version > minor)) ||
-        ((xml_major_version == major) && (xml_minor_version == minor) &&
-        (xml_micro_version >= micro)))
-      {
-        return 0;
-       }
-     else
-      {
-        printf("\n*** An old version of libxml (%d.%d.%d) was found.\n",
-               xml_major_version, xml_minor_version, xml_micro_version);
-        printf("*** You need a version of libxml newer than %d.%d.%d.\n",
-           major, minor, micro);
-        printf("***\n");
-        printf("*** If you have already installed a sufficiently new version, this error\n");
-        printf("*** probably means that the wrong copy of the xml2-config shell script is\n");
-        printf("*** being found. The easiest way to fix this is to remove the old version\n");
-        printf("*** of LIBXML, but you can also set the XML2_CONFIG environment to point to the\n");
-        printf("*** correct copy of xml2-config. (In this case, you will have to\n");
-        printf("*** modify your LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf\n");
-        printf("*** so that the correct libraries are found at run-time))\n");
-    }
-  return 1;
-}
-]])],, no_xml=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
-       CPPFLAGS="$ac_save_CPPFLAGS"
-       LIBS="$ac_save_LIBS"
-     fi
-  fi
+AC_DEFUN([AM_PATH_XML2],[
+  m4_warn([obsolete], [AM_PATH_XML2 is deprecated, use PKG_CHECK_MODULES instead])
+  AC_REQUIRE([PKG_PROG_PKG_CONFIG])
 
-  if test "x$no_xml" = x ; then
-     AC_MSG_RESULT(yes (version $xml_config_major_version.$xml_config_minor_version.$xml_config_micro_version))
-     ifelse([$2], , :, [$2])     
-  else
-     AC_MSG_RESULT(no)
-     if test "$XML2_CONFIG" = "no" ; then
-       echo "*** The xml2-config script installed by LIBXML could not be found"
-       echo "*** If libxml was installed in PREFIX, make sure PREFIX/bin is in"
-       echo "*** your path, or set the XML2_CONFIG environment variable to the"
-       echo "*** full path to xml2-config."
-     else
-       if test -f conf.xmltest ; then
-        :
-       else
-          echo "*** Could not run libxml test program, checking why..."
-          CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS"
-          LIBS="$LIBS $XML_LIBS"
-         AC_LINK_IFELSE(
-            [AC_LANG_PROGRAM([[
-#include <libxml/xmlversion.h>
-#include <stdio.h>
-]],    [[ LIBXML_TEST_VERSION; return 0;]])],
-        [ echo "*** The test program compiled, but did not run. This usually means"
-          echo "*** that the run-time linker is not finding LIBXML or finding the wrong"
-          echo "*** version of LIBXML. If it is not finding LIBXML, you'll need to set your"
-          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
-          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
-          echo "*** is required on your system"
-          echo "***"
-          echo "*** If you have an old version installed, it is best to remove it, although"
-          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
-        [ echo "*** The test program failed to compile or link. See the file config.log for the"
-          echo "*** exact error that occurred. This usually means LIBXML was incorrectly installed"
-          echo "*** or that you have moved LIBXML since it was installed. In the latter case, you"
-          echo "*** may want to edit the xml2-config script: $XML2_CONFIG" ])
-          CPPFLAGS="$ac_save_CPPFLAGS"
-          LIBS="$ac_save_LIBS"
-       fi
-     fi
+  verdep=ifelse([$1], [], [], [">= $1"])
+  PKG_CHECK_MODULES(XML, [libxml-2.0 $verdep], [$2], [$3])
 
-     XML_CPPFLAGS=""
-     XML_LIBS=""
-     ifelse([$3], , :, [$3])
-  fi
+  XML_CPPFLAGS=$XML_CFLAGS
   AC_SUBST(XML_CPPFLAGS)
   AC_SUBST(XML_LIBS)
-  rm -f conf.xmltest
 ])
diff --git a/libxml.spec.in b/libxml.spec.in
deleted file mode 100644 (file)
index 45083de..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-%global with_python3 1
-
-Summary: Library providing XML and HTML support
-Name: libxml2
-Version: @VERSION@
-Release: 1%{?dist}%{?extra_release}
-License: MIT
-Group: Development/Libraries
-Source: https://download.gnome.org/sources/libxml2/@LIBXML_MAJOR_VERSION@.@LIBXML_MINOR_VERSION@/libxml2-%{version}.tar.xz
-BuildRoot: %{_tmppath}/%{name}-%{version}-root
-BuildRequires: python-devel
-%if 0%{?with_python3}
-BuildRequires: python3-devel
-%endif # with_python3
-BuildRequires: zlib-devel
-BuildRequires: pkgconfig
-BuildRequires: xz-devel
-URL: https://gitlab.gnome.org/GNOME/libxml2
-
-%description
-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 sub nodes or ranges. A flexible Input/Output mechanism is
-available, with existing HTTP and FTP modules and combined to an
-URI library.
-
-%package devel
-Summary: Libraries, includes, etc. to develop XML and HTML applications
-Group: Development/Libraries
-Requires: libxml2 = %{version}-%{release}
-Requires: zlib-devel
-Requires: xz-devel
-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
-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 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 -n python-%{name}
-%{?python_provide:%python_provide python-%{name}}
-Summary: Python bindings for the libxml2 library
-Group: Development/Libraries
-Requires: libxml2 = %{version}-%{release}
-Obsoletes: %{name}-python < %{version}-%{release}
-Provides: %{name}-python = %{version}-%{release}
-
-%description -n python-%{name}
-The libxml2-python package contains a Python 2 module that permits applications
-written in the Python programming language, version 2, to use the interface
-supplied by the libxml2 library to manipulate XML files.
-
-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.
-
-%if 0%{?with_python3}
-%package -n python3-%{name}
-Summary: Python 3 bindings for the libxml2 library
-Group: Development/Libraries
-Requires: libxml2 = %{version}-%{release}
-Obsoletes: %{name}-python3 < %{version}-%{release}
-Provides: %{name}-python3 = %{version}-%{release}
-
-%description -n python3-%{name}
-The libxml2-python3 package contains a Python 3 module that permits
-applications written in the Python programming language, version 3, to use the
-interface supplied by the libxml2 library to manipulate XML files.
-
-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.
-%endif # with_python3
-
-%prep
-%setup -q
-
-mkdir py3doc
-cp doc/*.py py3doc
-sed -i 's|#!/usr/bin/env python|#!/usr/bin/env %{__python3}|' py3doc/*.py
-
-%build
-%configure
-make %{_smp_mflags}
-
-find doc -type f -exec chmod 0644 \{\} \;
-
-%install
-rm -fr %{buildroot}
-
-make install DESTDIR=%{buildroot}
-
-%if 0%{?with_python3}
-make clean
-%configure --with-python=%{__python3}
-make install DESTDIR=%{buildroot}
-%endif # with_python3
-
-
-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
-#disabling python tests from rpm build as broken in Fedora 30
-make PYTHON_SUBDIR="" runtests
-
-%clean
-rm -fr %{buildroot}
-
-%post -p /sbin/ldconfig
-
-%postun -p /sbin/ldconfig
-
-%files
-%defattr(-, root, root)
-
-%doc NEWS README.md Copyright TODO
-%doc %{_mandir}/man1/xmllint.1*
-%doc %{_mandir}/man1/xmlcatalog.1*
-
-%{_libdir}/lib*.so.*
-%{_bindir}/xmllint
-%{_bindir}/xmlcatalog
-
-%files devel
-%defattr(-, root, root)
-
-%doc %{_mandir}/man1/xml2-config.1*
-%doc NEWS README.md Copyright
-%doc doc/*.html doc/html doc/*.gif doc/*.png
-%doc doc/tutorial doc/libxml2-api.xml.gz
-%doc doc/examples
-%doc %dir %{_datadir}/gtk-doc/html/libxml2
-%doc %{_datadir}/gtk-doc/html/libxml2/*.devhelp
-%doc %{_datadir}/gtk-doc/html/libxml2/*.html
-%doc %{_datadir}/gtk-doc/html/libxml2/*.png
-%doc %{_datadir}/gtk-doc/html/libxml2/*.css
-
-%{_libdir}/lib*.so
-%{_libdir}/*.sh
-%{_includedir}/*
-%{_bindir}/xml2-config
-%{_datadir}/aclocal/libxml.m4
-%{_libdir}/pkgconfig/libxml-2.0.pc
-%{_libdir}/cmake/libxml2/libxml2-config.cmake
-
-%files static
-%defattr(-, root, root)
-
-%{_libdir}/*a
-
-%files -n python-%{name}
-%defattr(-, root, root)
-
-%{_libdir}/python2*/site-packages/libxml2.py*
-%{_libdir}/python2*/site-packages/drv_libxml2.py*
-%{_libdir}/python2*/site-packages/libxml2mod*
-%doc python/TODO
-%doc python/libxml2class.txt
-%doc python/tests/*.py
-%doc doc/*.py
-%doc doc/python.html
-
-%if 0%{?with_python3}
-%files -n python3-%{name}
-%defattr(-, root, root)
-
-%{_libdir}/python3*/site-packages/libxml2.py*
-%{_libdir}/python3*/site-packages/drv_libxml2.py*
-%{_libdir}/python3*/site-packages/__pycache__/*py*
-%{_libdir}/python3*/site-packages/libxml2mod*
-%doc python/TODO
-%doc python/libxml2class.txt
-%doc py3doc/*.py
-%doc doc/python.html
-%endif # with_python3
-
-%changelog
-* @RELDATE@ Daniel Veillard <veillard@redhat.com>
-- upstream release @VERSION@
-
index f692a1c..24b8f9f 100644 (file)
@@ -1,15 +1,5 @@
 #
-# Officially exported symbols, for which header
-# file definitions are installed in /usr/include/libxml2
-#
-# Automatically generated from symbols.xml and syms.xsl
-#
-# Versions here are *fixed* to match the libxml2 version
-# at which the symbol was introduced. This ensures that
-# a new client app requiring symbol foo() can't accidentally
-# run with old libxml2.so not providing foo() - the global
-# soname version info can't enforce this since we never
-# change the soname
+# Retained for backward compatibility. Don't add new symbols.
 #
 
 LIBXML2_2.4.30 {
diff --git a/m4/ax_append_flag.m4 b/m4/ax_append_flag.m4
new file mode 100644 (file)
index 0000000..dd6d8b6
--- /dev/null
@@ -0,0 +1,50 @@
+# ===========================================================================
+#      https://www.gnu.org/software/autoconf-archive/ax_append_flag.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE])
+#
+# DESCRIPTION
+#
+#   FLAG is appended to the FLAGS-VARIABLE shell variable, with a space
+#   added in between.
+#
+#   If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
+#   CFLAGS) is used.  FLAGS-VARIABLE is not changed if it already contains
+#   FLAG.  If FLAGS-VARIABLE is unset in the shell, it is set to exactly
+#   FLAG.
+#
+#   NOTE: Implementation based on AX_CFLAGS_GCC_OPTION.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
+#   Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.  This file is offered as-is, without any
+#   warranty.
+
+#serial 8
+
+AC_DEFUN([AX_APPEND_FLAG],
+[dnl
+AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF
+AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])
+AS_VAR_SET_IF(FLAGS,[
+  AS_CASE([" AS_VAR_GET(FLAGS) "],
+    [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])],
+    [
+     AS_VAR_APPEND(FLAGS,[" $1"])
+     AC_RUN_LOG([: FLAGS="$FLAGS"])
+    ])
+  ],
+  [
+  AS_VAR_SET(FLAGS,[$1])
+  AC_RUN_LOG([: FLAGS="$FLAGS"])
+  ])
+AS_VAR_POPDEF([FLAGS])dnl
+])dnl AX_APPEND_FLAG
diff --git a/m4/ax_append_link_flags.m4 b/m4/ax_append_link_flags.m4
new file mode 100644 (file)
index 0000000..99b9fa5
--- /dev/null
@@ -0,0 +1,44 @@
+# ===========================================================================
+#   https://www.gnu.org/software/autoconf-archive/ax_append_link_flags.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_APPEND_LINK_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT])
+#
+# DESCRIPTION
+#
+#   For every FLAG1, FLAG2 it is checked whether the linker works with the
+#   flag.  If it does, the flag is added FLAGS-VARIABLE
+#
+#   If FLAGS-VARIABLE is not specified, the linker's flags (LDFLAGS) is
+#   used. During the check the flag is always added to the linker's flags.
+#
+#   If EXTRA-FLAGS is defined, it is added to the linker's default flags
+#   when the check is done.  The check is thus made with the flags: "LDFLAGS
+#   EXTRA-FLAGS FLAG".  This can for example be used to force the linker to
+#   issue an error when a bad flag is given.
+#
+#   INPUT gives an alternative input source to AC_COMPILE_IFELSE.
+#
+#   NOTE: This macro depends on the AX_APPEND_FLAG and AX_CHECK_LINK_FLAG.
+#   Please keep this macro in sync with AX_APPEND_COMPILE_FLAGS.
+#
+# LICENSE
+#
+#   Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.  This file is offered as-is, without any
+#   warranty.
+
+#serial 7
+
+AC_DEFUN([AX_APPEND_LINK_FLAGS],
+[AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
+AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
+for flag in $1; do
+  AX_CHECK_LINK_FLAG([$flag], [AX_APPEND_FLAG([$flag], [m4_default([$2], [LDFLAGS])])], [], [$3], [$4])
+done
+])dnl AX_APPEND_LINK_FLAGS
diff --git a/m4/ax_check_link_flag.m4 b/m4/ax_check_link_flag.m4
new file mode 100644 (file)
index 0000000..03a30ce
--- /dev/null
@@ -0,0 +1,53 @@
+# ===========================================================================
+#    https://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
+#
+# DESCRIPTION
+#
+#   Check whether the given FLAG works with the linker or gives an error.
+#   (Warnings, however, are ignored)
+#
+#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
+#   success/failure.
+#
+#   If EXTRA-FLAGS is defined, it is added to the linker's default flags
+#   when the check is done.  The check is thus made with the flags: "LDFLAGS
+#   EXTRA-FLAGS FLAG".  This can for example be used to force the linker to
+#   issue an error when a bad flag is given.
+#
+#   INPUT gives an alternative input source to AC_LINK_IFELSE.
+#
+#   NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
+#   macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
+#   Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.  This file is offered as-is, without any
+#   warranty.
+
+#serial 6
+
+AC_DEFUN([AX_CHECK_LINK_FLAG],
+[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
+AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl
+AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [
+  ax_check_save_flags=$LDFLAGS
+  LDFLAGS="$LDFLAGS $4 $1"
+  AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
+    [AS_VAR_SET(CACHEVAR,[yes])],
+    [AS_VAR_SET(CACHEVAR,[no])])
+  LDFLAGS=$ax_check_save_flags])
+AS_VAR_IF(CACHEVAR,yes,
+  [m4_default([$2], :)],
+  [m4_default([$3], :)])
+AS_VAR_POPDEF([CACHEVAR])dnl
+])dnl AX_CHECK_LINK_FLAGS
diff --git a/m4/ax_require_defined.m4 b/m4/ax_require_defined.m4
new file mode 100644 (file)
index 0000000..17c3eab
--- /dev/null
@@ -0,0 +1,37 @@
+# ===========================================================================
+#    https://www.gnu.org/software/autoconf-archive/ax_require_defined.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_REQUIRE_DEFINED(MACRO)
+#
+# DESCRIPTION
+#
+#   AX_REQUIRE_DEFINED is a simple helper for making sure other macros have
+#   been defined and thus are available for use.  This avoids random issues
+#   where a macro isn't expanded.  Instead the configure script emits a
+#   non-fatal:
+#
+#     ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found
+#
+#   It's like AC_REQUIRE except it doesn't expand the required macro.
+#
+#   Here's an example:
+#
+#     AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
+#
+# LICENSE
+#
+#   Copyright (c) 2014 Mike Frysinger <vapier@gentoo.org>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 2
+
+AC_DEFUN([AX_REQUIRE_DEFINED], [dnl
+  m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])])
+])dnl AX_REQUIRE_DEFINED
index 6de7d30..2bfba85 100644 (file)
--- a/nanoftp.c
+++ b/nanoftp.c
@@ -23,6 +23,8 @@
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#elif defined (_WIN32)
+#include <io.h>
 #endif
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
@@ -48,9 +50,6 @@
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
 
 #include <libxml/xmlmemory.h>
 #include <libxml/parser.h>
@@ -59,6 +58,9 @@
 #include <libxml/nanoftp.h>
 #include <libxml/globals.h>
 
+#include "private/error.h"
+#include "private/io.h"
+
 /* #define DEBUG_FTP 1  */
 #ifdef STANDALONE
 #ifndef DEBUG_FTP
  * A couple portability macros
  */
 #ifndef _WINSOCKAPI_
-#if !defined(__BEOS__) || defined(__HAIKU__)
 #define closesocket(s) close(s)
 #endif
-#endif
-
-#ifdef __BEOS__
-#ifndef PF_INET
-#define PF_INET AF_INET
-#endif
-#endif
-
-#ifdef _AIX
-#ifdef HAVE_BROKEN_SS_FAMILY
-#define ss_family __ss_family
-#endif
-#endif
 
 #ifndef XML_SOCKLEN_T
 #define XML_SOCKLEN_T unsigned int
 #endif
 
+#define GETHOSTBYNAME_ARG_CAST (char *)
+#define SEND_ARG2_CAST (char *)
+
 #define FTP_COMMAND_OK         200
 #define FTP_SYNTAX_ERROR       500
 #define FTP_GET_PASSWD         331
index 2eafd3f..e014fe4 100644 (file)
 
 #ifdef LIBXML_HTTP_ENABLED
 #include <string.h>
+#include <ctype.h>
 #include <stdlib.h>
 #include <errno.h>
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
+#elif defined (_WIN32)
+#include <io.h>
 #endif
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #ifdef HAVE_NETDB_H
 #include <netdb.h>
 #endif
-#ifdef HAVE_RESOLV_H
-#ifdef HAVE_ARPA_NAMESER_H
-#include <arpa/nameser.h>
-#endif
-#include <resolv.h>
-#endif
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
 #include <libxml/globals.h>
 #include <libxml/uri.h>
 
+#include "private/error.h"
+#include "private/io.h"
+
 /**
  * A couple portability macros
  */
 #ifndef _WINSOCKAPI_
-#if !defined(__BEOS__) || defined(__HAIKU__)
 #define closesocket(s) close(s)
-#endif
 #define SOCKET int
 #define INVALID_SOCKET (-1)
 #endif
 
-#ifdef __BEOS__
-#ifndef PF_INET
-#define PF_INET AF_INET
-#endif
-#endif
-
 #ifndef XML_SOCKLEN_T
 #define XML_SOCKLEN_T unsigned int
 #endif
 
+#define GETHOSTBYNAME_ARG_CAST (char *)
+#define SEND_ARG2_CAST (char *)
+
 #ifdef STANDALONE
 #define DEBUG_HTTP
 #define xmlStrncasecmp(a, b, n) strncasecmp((char *)a, (char *)b, n)
@@ -188,20 +180,6 @@ static int socket_errno(void) {
 #endif
 }
 
-#ifdef SUPPORT_IP6
-static
-int have_ipv6(void) {
-    SOCKET s;
-
-    s = socket (AF_INET6, SOCK_STREAM, 0);
-    if (s != INVALID_SOCKET) {
-       close (s);
-       return (1);
-    }
-    return (0);
-}
-#endif
-
 /**
  * xmlNanoHTTPInit:
  *
@@ -535,7 +513,7 @@ xmlNanoHTTPRecv(xmlNanoHTTPCtxtPtr ctxt)
 
     while (ctxt->state & XML_NANO_HTTP_READ) {
         if (ctxt->in == NULL) {
-            ctxt->in = (char *) xmlMallocAtomic(65000 * sizeof(char));
+            ctxt->in = (char *) xmlMallocAtomic(65000);
             if (ctxt->in == NULL) {
                 xmlHTTPErrMemory("allocating input");
                 ctxt->last = -1;
@@ -896,15 +874,6 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
         status = ioctl(s, FIONBIO, &enable);
     }
 #else /* VMS */
-#if defined(__BEOS__) && !defined(__HAIKU__)
-    {
-        bool noblock = true;
-
-        status =
-            setsockopt(s, SOL_SOCKET, SO_NONBLOCK, &noblock,
-                       sizeof(noblock));
-    }
-#else /* __BEOS__ */
     if ((status = fcntl(s, F_GETFL, 0)) != -1) {
 #ifdef O_NONBLOCK
         status |= O_NONBLOCK;
@@ -923,7 +892,6 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
         closesocket(s);
         return INVALID_SOCKET;
     }
-#endif /* !__BEOS__ */
 #endif /* !VMS */
 #endif /* !_WINSOCKAPI_ */
 
@@ -1042,33 +1010,19 @@ xmlNanoHTTPConnectHost(const char *host, int port)
     struct sockaddr_in sockin;
 
 #ifdef SUPPORT_IP6
-    struct in6_addr ia6;
     struct sockaddr_in6 sockin6;
 #endif
     SOCKET s;
 
     memset (&sockin, 0, sizeof(sockin));
-#ifdef SUPPORT_IP6
-    memset (&sockin6, 0, sizeof(sockin6));
-#endif
-
-#if !defined(HAVE_GETADDRINFO) && defined(SUPPORT_IP6) && defined(RES_USE_INET6)
-    if (have_ipv6 ())
-    {
-       if (!(_res.options & RES_INIT))
-           res_init();
-       _res.options |= RES_USE_INET6;
-    }
-#endif
 
-#if defined(HAVE_GETADDRINFO) && defined(SUPPORT_IP6) && !defined(_WIN32)
-    if (have_ipv6 ())
-#endif
-#if defined(HAVE_GETADDRINFO) && (defined(SUPPORT_IP6) || defined(_WIN32))
+#if defined(SUPPORT_IP6)
     {
        int status;
        struct addrinfo hints, *res, *result;
 
+        memset (&sockin6, 0, sizeof(sockin6));
+
        result = NULL;
        memset (&hints, 0,sizeof(hints));
        hints.ai_socktype = SOCK_STREAM;
@@ -1089,8 +1043,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
                memcpy (&sockin, res->ai_addr, res->ai_addrlen);
                sockin.sin_port = htons (port);
                addr = (struct sockaddr *)&sockin;
-#ifdef SUPPORT_IP6
-           } else if (have_ipv6 () && (res->ai_family == AF_INET6)) {
+           } else if (res->ai_family == AF_INET6) {
                if ((size_t)res->ai_addrlen > sizeof(sockin6)) {
                    __xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n");
                    freeaddrinfo (result);
@@ -1099,7 +1052,6 @@ xmlNanoHTTPConnectHost(const char *host, int port)
                memcpy (&sockin6, res->ai_addr, res->ai_addrlen);
                sockin6.sin6_port = htons (port);
                addr = (struct sockaddr *)&sockin6;
-#endif
            } else
                continue;              /* for */
 
@@ -1113,11 +1065,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
        if (result)
            freeaddrinfo (result);
     }
-#endif
-#if defined(HAVE_GETADDRINFO) && defined(SUPPORT_IP6) && !defined(_WIN32)
-    else
-#endif
-#if !defined(HAVE_GETADDRINFO) || !defined(_WIN32)
+#else
     {
         struct hostent *h;
         struct in_addr ia;
@@ -1179,19 +1127,6 @@ xmlNanoHTTPConnectHost(const char *host, int port)
                sockin.sin_addr = ia;
                sockin.sin_port = (unsigned short)htons ((unsigned short)port);
                addr = (struct sockaddr *) &sockin;
-#ifdef SUPPORT_IP6
-           } else if (have_ipv6 () && (h->h_addrtype == AF_INET6)) {
-               /* AAAA records (IPv6) */
-               if ((unsigned int) h->h_length > sizeof(ia6)) {
-                   __xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n");
-                   return INVALID_SOCKET;
-               }
-               memcpy (&ia6, h->h_addr_list[i], h->h_length);
-               sockin6.sin6_family = h->h_addrtype;
-               sockin6.sin6_addr = ia6;
-               sockin6.sin6_port = htons (port);
-               addr = (struct sockaddr *) &sockin6;
-#endif
            } else
                break;              /* for */
 
@@ -1327,6 +1262,107 @@ xmlNanoHTTPClose(void *ctx) {
     xmlNanoHTTPFreeCtxt(ctxt);
 }
 
+
+/**
+ * xmlNanoHTTPHostnameMatch:
+ * @pattern: The pattern as it appears in no_proxy environment variable
+ * @hostname: The hostname to test as it appears in the URL
+ *
+ * This function tests whether a given hostname matches a pattern. The pattern
+ * usually is a token from the no_proxy environment variable. Wildcards in the
+ * pattern are not supported.
+ *
+ * Returns true, iff hostname matches the pattern.
+ */
+
+static int 
+xmlNanoHTTPHostnameMatch(const char *pattern, const char *hostname) {
+    int idx_pattern, idx_hostname;
+    const char * pattern_start;
+
+    if (!pattern || *pattern == '\0' || !hostname)
+       return 0;
+
+    /* Ignore trailing '.' */
+    if (*pattern == '.') {
+        idx_pattern = strlen(pattern) -1;
+        pattern_start = pattern + 1;
+    }
+    else {
+        idx_pattern = strlen(pattern);
+        pattern_start = pattern;
+    }
+    idx_hostname = strlen(hostname);
+
+    for (; idx_pattern >= 0 && idx_hostname >= 0; 
+           --idx_pattern, --idx_hostname) {
+       if (tolower(pattern_start[idx_pattern]) != tolower(hostname[idx_hostname]))
+           break;
+    }
+
+    return idx_pattern == -1 && (idx_hostname == -1|| hostname[idx_hostname] == '.');
+}
+
+
+/**
+ * xmlNanoHTTPBypassProxy:
+ * @hostname: The hostname as it appears in the URL
+ *
+ * This function evaluates the no_proxy environment variable and returns
+ * whether the proxy server should be bypassed for a given host.
+ *
+ * Returns true, iff a proxy server should be bypassed for the given hostname.
+ */
+
+static int
+xmlNanoHTTPBypassProxy(const char *hostname) {
+    size_t envlen;
+    char *env = getenv("no_proxy"), *cpy=NULL, *p=NULL;
+    if (!env)
+       return 0;
+
+    /* (Avoid strdup because it's not portable.) */
+    envlen = strlen(env) + 1;
+    cpy = xmlMalloc(envlen);
+    memcpy(cpy, env, envlen);
+    env = cpy;
+
+    /* The remainder of the function is basically a tokenizing: */
+    while (isspace(*env))
+       ++env;
+    if (*env == '\0') {
+       xmlFree(cpy);
+       return 0;
+    }
+
+    p = env;
+    while (*env) {
+
+       if (*env != ',') {
+           ++env;
+           continue;
+       }
+
+       *(env++) = '\0';
+       if (xmlNanoHTTPHostnameMatch(p, hostname)) {
+           xmlFree(cpy);
+           return 1;
+       }
+
+       while (isspace(*env))
+           ++env;
+       p = env;
+    }
+    if (xmlNanoHTTPHostnameMatch(p, hostname)) {
+       xmlFree(cpy);
+       return 1;
+    }
+
+    xmlFree(cpy);
+    return 0;
+}
+
+
 /**
  * xmlNanoHTTPMethodRedir:
  * @URL:  The URL to load
@@ -1354,6 +1390,7 @@ xmlNanoHTTPMethodRedir(const char *URL, const char *method, const char *input,
     int blen;
     SOCKET ret;
     int nbRedirects = 0;
+    int use_proxy;
     char *redirURL = NULL;
 #ifdef DEBUG_HTTP
     int xmt_bytes;
@@ -1388,7 +1425,8 @@ retry:
        if (redirURL != NULL) xmlFree(redirURL);
         return(NULL);
     }
-    if (proxy) {
+    use_proxy = proxy && !xmlNanoHTTPBypassProxy(ctxt->hostname);
+    if (use_proxy) {
        blen = strlen(ctxt->hostname) * 2 + 16;
        ret = xmlNanoHTTPConnectHost(proxy, proxyPort);
     }
@@ -1423,7 +1461,7 @@ retry:
 #endif
     if (ctxt->port != 80) {
        /* reserve space for ':xxxxx', incl. potential proxy */
-       if (proxy)
+       if (use_proxy)
            blen += 17;
        else
            blen += 11;
@@ -1437,7 +1475,7 @@ retry:
 
     p = bp;
 
-    if (proxy) {
+    if (use_proxy) {
        if (ctxt->port != 80) {
            p += snprintf( p, blen - (p - bp), "%s http://%s:%d%s",
                        method, ctxt->hostname,
@@ -1478,7 +1516,7 @@ retry:
 
 #ifdef DEBUG_HTTP
     xmlGenericError(xmlGenericErrorContext,
-           "-> %s%s", proxy? "(Proxy) " : "", bp);
+           "-> %s%s", use_proxy ? "(Proxy) " : "", bp);
     if ((blen -= strlen(bp)+1) < 0)
        xmlGenericError(xmlGenericErrorContext,
                "ERROR: overflowed buffer by %d bytes\n", -blen);
diff --git a/optim/TOTRY b/optim/TOTRY
deleted file mode 100644 (file)
index 5b37b0b..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-XML:
-====
-  - I/O avoid copies when parsing mmap'ed files, need to use
-    unmutable buffers except for the last 4K to make it 0 terminated
-    (or get rid of 0 termination check in the whole parser, hard !)
-  - recheck > 4Gb instances for parsing, and RNG validation.
-    
-
-XSLT:
-=====
-  - global variable access
-     for each expr in stylesheet : allocate index
-     for each transformation context
-       create an index table
-         cache values in the transformation
-          - context evaluation
-            - cache
-            - constants at the XPAth level
-          - provide more info on compiled expressions
-            - dependances w.r.t. variables (which ones)
-            - dependency on the current node
-            - dependency on the current document
-  - do not use _private but other fields in the node structures.
diff --git a/optim/hash_dict.patch b/optim/hash_dict.patch
deleted file mode 100644 (file)
index 6c50abc..0000000
+++ /dev/null
@@ -1,257 +0,0 @@
-Index: hash.c
-===================================================================
-RCS file: /cvs/gnome/gnome-xml/hash.c,v
-retrieving revision 1.30
-diff -u -r1.30 hash.c
---- hash.c     29 Oct 2003 11:18:37 -0000      1.30
-+++ hash.c     24 Feb 2004 17:18:42 -0000
-@@ -26,6 +26,7 @@
- #include <libxml/xmlmemory.h>
- #include <libxml/xmlerror.h>
- #include <libxml/globals.h>
-+#include <libxml/dict.h>
- #define MAX_HASH_LEN 8
-@@ -38,9 +39,9 @@
- typedef xmlHashEntry *xmlHashEntryPtr;
- struct _xmlHashEntry {
-     struct _xmlHashEntry *next;
--    xmlChar *name;
--    xmlChar *name2;
--    xmlChar *name3;
-+    const xmlChar *name;
-+    const xmlChar *name2;
-+    const xmlChar *name3;
-     void *payload;
-     int valid;
- };
-@@ -52,6 +53,7 @@
-     struct _xmlHashEntry *table;
-     int size;
-     int nbElems;
-+    xmlDictPtr dict;
- };
- /*
-@@ -143,12 +145,16 @@
- xmlHashTablePtr
- xmlHashCreate(int size) {
-     xmlHashTablePtr table;
-+    xmlDictPtr dict;
-   
-     if (size <= 0)
-         size = 256;
-   
-+    dict = xmlDictCreate();
-+    if (dict == NULL) return(NULL);
-     table = xmlMalloc(sizeof(xmlHashTable));
-     if (table) {
-+        table->dict = dict;
-         table->size = size;
-       table->nbElems = 0;
-         table->table = xmlMalloc(size * sizeof(xmlHashEntry));
-@@ -158,6 +164,7 @@
-         }
-         xmlFree(table);
-     }
-+    xmlDictFree(dict);
-     return(NULL);
- }
-@@ -282,12 +289,6 @@
-               next = iter->next;
-               if ((f != NULL) && (iter->payload != NULL))
-                   f(iter->payload, iter->name);
--              if (iter->name)
--                  xmlFree(iter->name);
--              if (iter->name2)
--                  xmlFree(iter->name2);
--              if (iter->name3)
--                  xmlFree(iter->name3);
-               iter->payload = NULL;
-               if (!inside_table)
-                   xmlFree(iter);
-@@ -299,6 +300,7 @@
-       }
-       xmlFree(table->table);
-     }
-+    xmlDictFree(table->dict);
-     xmlFree(table);
- }
-@@ -465,6 +467,9 @@
-     if ((table == NULL) || name == NULL)
-       return(-1);
-+    if (name) name = xmlDictLookup(table->dict, name, -1);
-+    if (name2) name2 = xmlDictLookup(table->dict, name2, -1);
-+    if (name3) name3 = xmlDictLookup(table->dict, name3, -1);
-     /*
-      * Check for duplicate and insertion location.
-@@ -475,15 +480,15 @@
-     } else {
-       for (insert = &(table->table[key]); insert->next != NULL;
-            insert = insert->next) {
--          if ((xmlStrEqual(insert->name, name)) &&
--              (xmlStrEqual(insert->name2, name2)) &&
--              (xmlStrEqual(insert->name3, name3)))
-+          if ((insert->name == name) &&
-+              (insert->name2 == name2) &&
-+              (insert->name3 == name3))
-               return(-1);
-           len++;
-       }
--      if ((xmlStrEqual(insert->name, name)) &&
--          (xmlStrEqual(insert->name2, name2)) &&
--          (xmlStrEqual(insert->name3, name3)))
-+      if ((insert->name == name) &&
-+          (insert->name2 == name2) &&
-+          (insert->name3 == name3))
-           return(-1);
-     }
-@@ -495,9 +500,9 @@
-            return(-1);
-     }
--    entry->name = xmlStrdup(name);
--    entry->name2 = xmlStrdup(name2);
--    entry->name3 = xmlStrdup(name3);
-+    entry->name = name;
-+    entry->name2 = name2;
-+    entry->name3 = name3;
-     entry->payload = userdata;
-     entry->next = NULL;
-     entry->valid = 1;
-@@ -539,6 +544,9 @@
-     if ((table == NULL) || name == NULL)
-       return(-1);
-+    if (name) name = xmlDictLookup(table->dict, name, -1);
-+    if (name2) name2 = xmlDictLookup(table->dict, name2, -1);
-+    if (name3) name3 = xmlDictLookup(table->dict, name3, -1);
-     /*
-      * Check for duplicate and insertion location.
-@@ -549,18 +557,18 @@
-     } else {
-       for (insert = &(table->table[key]); insert->next != NULL;
-            insert = insert->next) {
--          if ((xmlStrEqual(insert->name, name)) &&
--              (xmlStrEqual(insert->name2, name2)) &&
--              (xmlStrEqual(insert->name3, name3))) {
-+          if ((insert->name == name) &&
-+              (insert->name2 == name2) &&
-+              (insert->name3 == name3)) {
-               if (f)
-                   f(insert->payload, insert->name);
-               insert->payload = userdata;
-               return(0);
-           }
-       }
--      if ((xmlStrEqual(insert->name, name)) &&
--          (xmlStrEqual(insert->name2, name2)) &&
--          (xmlStrEqual(insert->name3, name3))) {
-+      if ((insert->name == name) &&
-+          (insert->name2 == name2) &&
-+          (insert->name3 == name3)) {
-           if (f)
-               f(insert->payload, insert->name);
-           insert->payload = userdata;
-@@ -576,9 +584,9 @@
-            return(-1);
-     }
--    entry->name = xmlStrdup(name);
--    entry->name2 = xmlStrdup(name2);
--    entry->name3 = xmlStrdup(name3);
-+    entry->name = name;
-+    entry->name2 = name2;
-+    entry->name3 = name3;
-     entry->payload = userdata;
-     entry->next = NULL;
-     entry->valid = 1;
-@@ -615,10 +623,13 @@
-     key = xmlHashComputeKey(table, name, name2, name3);
-     if (table->table[key].valid == 0)
-       return(NULL);
-+    if (name) name = xmlDictLookup(table->dict, name, -1);
-+    if (name2) name2 = xmlDictLookup(table->dict, name2, -1);
-+    if (name3) name3 = xmlDictLookup(table->dict, name3, -1);
-     for (entry = &(table->table[key]); entry != NULL; entry = entry->next) {
--      if ((xmlStrEqual(entry->name, name)) &&
--          (xmlStrEqual(entry->name2, name2)) &&
--          (xmlStrEqual(entry->name3, name3)))
-+      if ((entry->name == name) &&
-+          (entry->name2 == name2) &&
-+          (entry->name3 == name3))
-           return(entry->payload);
-     }
-     return(NULL);
-@@ -774,6 +785,9 @@
-     if (f == NULL)
-       return;
-+    if (name) name = xmlDictLookup(table->dict, name, -1);
-+    if (name2) name2 = xmlDictLookup(table->dict, name2, -1);
-+    if (name3) name3 = xmlDictLookup(table->dict, name3, -1);
-     if (table->table) {
-       for(i = 0; i < table->size; i++) {
-           if (table->table[i].valid == 0)
-@@ -781,9 +795,9 @@
-           iter = &(table->table[i]);
-           while (iter) {
-               next = iter->next;
--              if (((name == NULL) || (xmlStrEqual(name, iter->name))) &&
--                  ((name2 == NULL) || (xmlStrEqual(name2, iter->name2))) &&
--                  ((name3 == NULL) || (xmlStrEqual(name3, iter->name3))) &&
-+              if (((name == NULL) || (name == iter->name)) &&
-+                  ((name2 == NULL) || (name2 == iter->name2)) &&
-+                  ((name3 == NULL) || (name3 == iter->name3)) &&
-                   (iter->payload != NULL)) {
-                   f(iter->payload, data, iter->name,
-                     iter->name2, iter->name3);
-@@ -913,19 +927,16 @@
-     if (table->table[key].valid == 0) {
-         return(-1);
-     } else {
-+      if (name) name = xmlDictLookup(table->dict, name, -1);
-+      if (name2) name2 = xmlDictLookup(table->dict, name2, -1);
-+      if (name3) name3 = xmlDictLookup(table->dict, name3, -1);
-         for (entry = &(table->table[key]); entry != NULL; entry = entry->next) {
--            if (xmlStrEqual(entry->name, name) &&
--                    xmlStrEqual(entry->name2, name2) &&
--                    xmlStrEqual(entry->name3, name3)) {
-+            if ((entry->name == name) &&
-+              (entry->name2 == name2) &&
-+              (entry->name3 == name3)) {
-                 if ((f != NULL) && (entry->payload != NULL))
-                     f(entry->payload, entry->name);
-                 entry->payload = NULL;
--                if(entry->name)
--                    xmlFree(entry->name);
--                if(entry->name2)
--                    xmlFree(entry->name2);
--                if(entry->name3)
--                    xmlFree(entry->name3);
-                 if(prev) {
-                     prev->next = entry->next;
-                   xmlFree(entry);
-Index: include/libxml/hash.h
-===================================================================
-RCS file: /cvs/gnome/gnome-xml/include/libxml/hash.h,v
-retrieving revision 1.15
-diff -u -r1.15 hash.h
---- include/libxml/hash.h      20 Nov 2003 11:59:07 -0000      1.15
-+++ include/libxml/hash.h      24 Feb 2004 17:18:42 -0000
-@@ -42,7 +42,7 @@
-  *
-  * Callback to free data from a hash.
-  */
--typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name);
-+typedef void (*xmlHashDeallocator)(void *payload, const xmlChar *name);
- /**
-  * xmlHashCopier:
-  * @payload:  the data in the hash
diff --git a/optim/hash_dict.txt b/optim/hash_dict.txt
deleted file mode 100644 (file)
index a447b7e..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-Reuses a dictionary for the hash table to reduce the string compare
-costs. Not worth it unless validating big DTDs
-
-               without         with
-db10000  tree  175/79          179/81
-db100000 stream        1222            1217
-dba100000stream        593             601
-REC validation 1986            2098
-Docbook valid  10808           10649
-
-Tue Feb 24 19:09:49 CET 2004
index 93f031b..d3f30b2 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -57,6 +57,7 @@
 #include <libxml/tree.h>
 #include <libxml/parser.h>
 #include <libxml/parserInternals.h>
+#include <libxml/HTMLparser.h>
 #include <libxml/valid.h>
 #include <libxml/entities.h>
 #include <libxml/xmlerror.h>
 #include <libxml/xmlschemastypes.h>
 #include <libxml/relaxng.h>
 #endif
+#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
+#include <libxml/xpath.h>
+#endif
 
-#include "buf.h"
-#include "enc.h"
+#include "private/buf.h"
+#include "private/dict.h"
+#include "private/enc.h"
+#include "private/entities.h"
+#include "private/error.h"
+#include "private/globals.h"
+#include "private/html.h"
+#include "private/io.h"
+#include "private/memory.h"
+#include "private/parser.h"
+#include "private/threads.h"
+#include "private/xpath.h"
 
 struct _xmlStartTag {
     const xmlChar *prefix;
@@ -81,14 +95,10 @@ struct _xmlStartTag {
     int nsNr;
 };
 
-static void
-xmlFatalErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *info);
-
 static xmlParserCtxtPtr
-xmlCreateEntityParserCtxtInternal(const xmlChar *URL, const xmlChar *ID,
-                         const xmlChar *base, xmlParserCtxtPtr pctx);
-
-static void xmlHaltParser(xmlParserCtxtPtr ctxt);
+xmlCreateEntityParserCtxtInternal(xmlSAXHandlerPtr sax, void *userData,
+        const xmlChar *URL, const xmlChar *ID, const xmlChar *base,
+        xmlParserCtxtPtr pctx);
 
 static int
 xmlParseElementStart(xmlParserCtxtPtr ctxt);
@@ -106,156 +116,27 @@ xmlParseElementEnd(xmlParserCtxtPtr ctxt);
 #define XML_PARSER_LOT_ENTITY 5000
 
 /*
- * XML_PARSER_NON_LINEAR is the threshold where the ratio of parsed entity
- *    replacement over the size in byte of the input indicates that you have
- *    and exponential behaviour. A value of 10 correspond to at least 3 entity
- *    replacement per byte of input.
+ * Constants for protection against abusive entity expansion
+ * ("billion laughs").
  */
-#define XML_PARSER_NON_LINEAR 10
 
 /*
- * xmlParserEntityCheck
- *
- * Function to check non-linear entity expansion behaviour
- * This is here to detect and stop exponential linear entity expansion
- * This is not a limitation of the parser but a safety
- * boundary feature. It can be disabled with the XML_PARSE_HUGE
- * parser option.
+ * XML_PARSER_NON_LINEAR is roughly the maximum allowed amplification factor
+ * of serialized output after entity expansion.
  */
-static int
-xmlParserEntityCheck(xmlParserCtxtPtr ctxt, size_t size,
-                     xmlEntityPtr ent, size_t replacement)
-{
-    size_t consumed = 0;
-    int i;
-
-    if ((ctxt == NULL) || (ctxt->options & XML_PARSE_HUGE))
-        return (0);
-    if (ctxt->lastError.code == XML_ERR_ENTITY_LOOP)
-        return (1);
-
-    /*
-     * This may look absurd but is needed to detect
-     * entities problems
-     */
-    if ((ent != NULL) && (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) &&
-       (ent->content != NULL) && (ent->checked == 0) &&
-       (ctxt->errNo != XML_ERR_ENTITY_LOOP)) {
-       unsigned long oldnbent = ctxt->nbentities, diff;
-       xmlChar *rep;
-
-       ent->checked = 1;
-
-        ++ctxt->depth;
-       rep = xmlStringDecodeEntities(ctxt, ent->content,
-                                 XML_SUBSTITUTE_REF, 0, 0, 0);
-        --ctxt->depth;
-       if ((rep == NULL) || (ctxt->errNo == XML_ERR_ENTITY_LOOP)) {
-           ent->content[0] = 0;
-       }
-
-        diff = ctxt->nbentities - oldnbent + 1;
-        if (diff > INT_MAX / 2)
-            diff = INT_MAX / 2;
-       ent->checked = diff * 2;
-       if (rep != NULL) {
-           if (xmlStrchr(rep, '<'))
-               ent->checked |= 1;
-           xmlFree(rep);
-           rep = NULL;
-       }
-    }
-
-    /*
-     * Prevent entity exponential check, not just replacement while
-     * parsing the DTD
-     * The check is potentially costly so do that only once in a thousand
-     */
-    if ((ctxt->instate == XML_PARSER_DTD) && (ctxt->nbentities > 10000) &&
-        (ctxt->nbentities % 1024 == 0)) {
-       for (i = 0;i < ctxt->inputNr;i++) {
-           consumed += ctxt->inputTab[i]->consumed +
-                      (ctxt->inputTab[i]->cur - ctxt->inputTab[i]->base);
-       }
-       if (ctxt->nbentities > consumed * XML_PARSER_NON_LINEAR) {
-           xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
-           ctxt->instate = XML_PARSER_EOF;
-           return (1);
-       }
-       consumed = 0;
-    }
-
-
-
-    if (replacement != 0) {
-       if (replacement < XML_MAX_TEXT_LENGTH)
-           return(0);
+#define XML_PARSER_NON_LINEAR 5
 
-        /*
-        * 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
-         */
-        if (size < XML_PARSER_BIG_ENTITY)
-           return(0);
-
-        /*
-         * A limit on the amount of text data reasonably used
-         */
-        if (ctxt->input != NULL) {
-            consumed = ctxt->input->consumed +
-                (ctxt->input->cur - ctxt->input->base);
-        }
-        consumed += ctxt->sizeentities;
-
-        if ((size < XML_PARSER_NON_LINEAR * consumed) &&
-           (ctxt->nbentities * 3 < XML_PARSER_NON_LINEAR * consumed))
-            return (0);
-    } else if (ent != NULL) {
-        /*
-         * use the number of parsed entities in the replacement
-         */
-        size = ent->checked / 2;
-
-        /*
-         * The amount of data parsed counting entities size only once
-         */
-        if (ctxt->input != NULL) {
-            consumed = ctxt->input->consumed +
-                (ctxt->input->cur - ctxt->input->base);
-        }
-        consumed += ctxt->sizeentities;
+/*
+ * A certain amount is always allowed.
+ */
+#define XML_PARSER_ALLOWED_EXPANSION 1000000
 
-        /*
-         * Check the density of entities for the amount of data
-        * knowing an entity reference will take at least 3 bytes
-         */
-        if (size * 3 < consumed * XML_PARSER_NON_LINEAR)
-            return (0);
-    } else {
-        /*
-         * strange we got no data for checking
-         */
-       if (((ctxt->lastError.code != XML_ERR_UNDECLARED_ENTITY) &&
-            (ctxt->lastError.code != XML_WAR_UNDECLARED_ENTITY)) ||
-           (ctxt->nbentities <= 10000))
-           return (0);
-    }
-    xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
-    return (1);
-}
+/*
+ * Fixed cost for each entity reference. This crudely models processing time
+ * as well to protect, for example, against exponential expansion of empty
+ * or very short entities.
+ */
+#define XML_ENT_FIXED_COST 20
 
 /**
  * xmlParserMaxDepth:
@@ -552,7 +433,7 @@ xmlFatalErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *info)
             errmsg = "Malformed declaration expecting version";
             break;
         case XML_ERR_NAME_TOO_LONG:
-            errmsg = "Name too long use XML_PARSE_HUGE option";
+            errmsg = "Name too long";
             break;
 #if 0
         case:
@@ -852,6 +733,89 @@ xmlNsWarn(xmlParserCtxtPtr ctxt, xmlParserErrors error,
                     info1, info2, info3);
 }
 
+static void
+xmlSaturatedAdd(unsigned long *dst, unsigned long val) {
+    if (val > ULONG_MAX - *dst)
+        *dst = ULONG_MAX;
+    else
+        *dst += val;
+}
+
+static void
+xmlSaturatedAddSizeT(unsigned long *dst, unsigned long val) {
+    if (val > ULONG_MAX - *dst)
+        *dst = ULONG_MAX;
+    else
+        *dst += val;
+}
+
+/**
+ * xmlParserEntityCheck:
+ * @ctxt:  parser context
+ * @extra:  sum of unexpanded entity sizes
+ *
+ * Check for non-linear entity expansion behaviour.
+ *
+ * In some cases like xmlStringDecodeEntities, this function is called
+ * for each, possibly nested entity and its unexpanded content length.
+ *
+ * In other cases like xmlParseReference, it's only called for each
+ * top-level entity with its unexpanded content length plus the sum of
+ * the unexpanded content lengths (plus fixed cost) of all nested
+ * entities.
+ *
+ * Summing the unexpanded lengths also adds the length of the reference.
+ * This is by design. Taking the length of the entity name into account
+ * discourages attacks that try to waste CPU time with abusively long
+ * entity names. See test/recurse/lol6.xml for example. Each call also
+ * adds some fixed cost XML_ENT_FIXED_COST to discourage attacks with
+ * short entities.
+ *
+ * Returns 1 on error, 0 on success.
+ */
+static int
+xmlParserEntityCheck(xmlParserCtxtPtr ctxt, unsigned long extra)
+{
+    unsigned long consumed;
+    xmlParserInputPtr input = ctxt->input;
+    xmlEntityPtr entity = input->entity;
+
+    /*
+     * Compute total consumed bytes so far, including input streams of
+     * external entities.
+     */
+    consumed = input->parentConsumed;
+    if ((entity == NULL) ||
+        ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) &&
+         ((entity->flags & XML_ENT_PARSED) == 0))) {
+        xmlSaturatedAdd(&consumed, input->consumed);
+        xmlSaturatedAddSizeT(&consumed, input->cur - input->base);
+    }
+    xmlSaturatedAdd(&consumed, ctxt->sizeentities);
+
+    /*
+     * Add extra cost and some fixed cost.
+     */
+    xmlSaturatedAdd(&ctxt->sizeentcopy, extra);
+    xmlSaturatedAdd(&ctxt->sizeentcopy, XML_ENT_FIXED_COST);
+
+    /*
+     * It's important to always use saturation arithmetic when tracking
+     * entity sizes to make the size checks reliable. If "sizeentcopy"
+     * overflows, we have to abort.
+     */
+    if ((ctxt->sizeentcopy > XML_PARSER_ALLOWED_EXPANSION) &&
+        ((ctxt->sizeentcopy >= ULONG_MAX) ||
+         (ctxt->sizeentcopy / XML_PARSER_NON_LINEAR > consumed))) {
+        xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_LOOP,
+                       "Maximum entity amplification factor exceeded");
+        xmlHaltParser(ctxt);
+        return(1);
+    }
+
+    return(0);
+}
+
 /************************************************************************
  *                                                                     *
  *             Library wide options                                    *
@@ -1047,11 +1011,7 @@ xmlHasFeature(xmlFeature feature)
             return(0);
 #endif
         case XML_WITH_DEBUG_RUN:
-#ifdef LIBXML_DEBUG_RUNTIME
-            return(1);
-#else
             return(0);
-#endif
         case XML_WITH_ZLIB:
 #ifdef LIBXML_ZLIB_ENABLED
             return(1);
@@ -1217,7 +1177,7 @@ xmlAttrNormalizeSpace2(xmlParserCtxtPtr ctxt, xmlChar *src, int *len)
            return(NULL);
        }
        xmlAttrNormalizeSpace(ret, ret);
-       *len = (int) strlen((const char *)ret);
+       *len = strlen((const char *)ret);
         return(ret);
     } else if (remove_head) {
         *len -= remove_head;
@@ -1323,6 +1283,8 @@ xmlAddDefAttrs(xmlParserCtxtPtr ctxt,
     /* intern the string and precompute the end */
     len = xmlStrlen(value);
     value = xmlDictLookup(ctxt->dict, value, len);
+    if (value == NULL)
+        goto mem_error;
     defaults->values[5 * defaults->nbAttrs + 2] = value;
     defaults->values[5 * defaults->nbAttrs + 3] = value + len;
     if (ctxt->external)
@@ -1414,6 +1376,8 @@ xmlCleanSpecialAttr(xmlParserCtxtPtr ctxt)
  * xmlCheckLanguageID:
  * @lang:  pointer to the string value
  *
+ * DEPRECATED: Internal function, do not use.
+ *
  * Checks that the value conforms to the LanguageID production:
  *
  * NOTE: this is somewhat deprecated, those productions were removed from
@@ -1702,25 +1666,21 @@ xmlCtxtGrowAttrs(xmlParserCtxtPtr ctxt, int nr) {
     int *attallocs;
     int maxatts;
 
-    if (ctxt->atts == NULL) {
-       maxatts = 55; /* allow for 10 attrs by default */
-       atts = (const xmlChar **)
-              xmlMalloc(maxatts * sizeof(xmlChar *));
-       if (atts == NULL) goto mem_error;
-       ctxt->atts = atts;
-       attallocs = (int *) xmlMalloc((maxatts / 5) * sizeof(int));
-       if (attallocs == NULL) goto mem_error;
-       ctxt->attallocs = attallocs;
-       ctxt->maxatts = maxatts;
-    } else if (nr + 5 > ctxt->maxatts) {
-       maxatts = (nr + 5) * 2;
-       atts = (const xmlChar **) xmlRealloc((void *) ctxt->atts,
+    if (nr + 5 > ctxt->maxatts) {
+       maxatts = ctxt->maxatts == 0 ? 55 : (nr + 5) * 2;
+       atts = (const xmlChar **) xmlMalloc(
                                     maxatts * sizeof(const xmlChar *));
        if (atts == NULL) goto mem_error;
-       ctxt->atts = atts;
        attallocs = (int *) xmlRealloc((void *) ctxt->attallocs,
                                     (maxatts / 5) * sizeof(int));
-       if (attallocs == NULL) goto mem_error;
+       if (attallocs == NULL) {
+            xmlFree(atts);
+            goto mem_error;
+        }
+        if (ctxt->maxatts > 0)
+            memcpy(atts, ctxt->atts, ctxt->maxatts * sizeof(const xmlChar *));
+        xmlFree(ctxt->atts);
+       ctxt->atts = atts;
        ctxt->attallocs = attallocs;
        ctxt->maxatts = maxatts;
     }
@@ -1745,16 +1705,17 @@ inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
     if ((ctxt == NULL) || (value == NULL))
         return(-1);
     if (ctxt->inputNr >= ctxt->inputMax) {
-        ctxt->inputMax *= 2;
-        ctxt->inputTab =
-            (xmlParserInputPtr *) xmlRealloc(ctxt->inputTab,
-                                             ctxt->inputMax *
-                                             sizeof(ctxt->inputTab[0]));
-        if (ctxt->inputTab == NULL) {
+        size_t newSize = ctxt->inputMax * 2;
+        xmlParserInputPtr *tmp;
+
+        tmp = (xmlParserInputPtr *) xmlRealloc(ctxt->inputTab,
+                                               newSize * sizeof(*tmp));
+        if (tmp == NULL) {
             xmlErrMemory(ctxt, NULL);
-           ctxt->inputMax /= 2;
             return (-1);
         }
+        ctxt->inputTab = tmp;
+        ctxt->inputMax = newSize;
     }
     ctxt->inputTab[ctxt->inputNr] = value;
     ctxt->input = value;
@@ -1791,6 +1752,8 @@ inputPop(xmlParserCtxtPtr ctxt)
  * @ctxt:  an XML parser context
  * @value:  the element node
  *
+ * DEPRECATED: Internal function, do not use.
+ *
  * Pushes a new element node on top of the node stack
  *
  * Returns -1 in case of error, the index in the stack otherwise
@@ -1829,6 +1792,8 @@ nodePush(xmlParserCtxtPtr ctxt, xmlNodePtr value)
  * nodePop:
  * @ctxt: an XML parser context
  *
+ * DEPRECATED: Internal function, do not use.
+ *
  * Pops the top element node from the node stack
  *
  * Returns the node just removed
@@ -1940,6 +1905,8 @@ nameNsPop(xmlParserCtxtPtr ctxt)
  * @ctxt:  an XML parser context
  * @value:  the element name
  *
+ * DEPRECATED: Internal function, do not use.
+ *
  * Pushes a new element name on top of the name stack
  *
  * Returns -1 in case of error, the index in the stack otherwise
@@ -1967,10 +1934,13 @@ mem_error:
     xmlErrMemory(ctxt, NULL);
     return (-1);
 }
+
 /**
  * namePop:
  * @ctxt: an XML parser context
  *
+ * DEPRECATED: Internal function, do not use.
+ *
  * Pops the top element name from the name stack
  *
  * Returns the name just removed
@@ -2086,7 +2056,7 @@ static int spacePop(xmlParserCtxtPtr ctxt) {
 #define SKIP(val) do {                                                 \
     ctxt->input->cur += (val),ctxt->input->col+=(val);                 \
     if (*ctxt->input->cur == 0)                                                \
-        xmlParserInputGrow(ctxt->input, INPUT_CHUNK);                  \
+        xmlParserGrow(ctxt);                                           \
   } while (0)
 
 #define SKIPL(val) do {                                                        \
@@ -2098,47 +2068,17 @@ static int spacePop(xmlParserCtxtPtr ctxt) {
        ctxt->input->cur++;                                             \
     }                                                                  \
     if (*ctxt->input->cur == 0)                                                \
-        xmlParserInputGrow(ctxt->input, INPUT_CHUNK);                  \
+        xmlParserGrow(ctxt);                                           \
   } while (0)
 
 #define SHRINK if ((ctxt->progressive == 0) &&                         \
                   (ctxt->input->cur - ctxt->input->base > 2 * INPUT_CHUNK) && \
                   (ctxt->input->end - ctxt->input->cur < 2 * INPUT_CHUNK)) \
-       xmlSHRINK (ctxt);
-
-static void xmlSHRINK (xmlParserCtxtPtr ctxt) {
-    xmlParserInputShrink(ctxt->input);
-    if (*ctxt->input->cur == 0)
-        xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
-}
+       xmlParserShrink(ctxt);
 
 #define GROW if ((ctxt->progressive == 0) &&                           \
                 (ctxt->input->end - ctxt->input->cur < INPUT_CHUNK))   \
-       xmlGROW (ctxt);
-
-static void xmlGROW (xmlParserCtxtPtr ctxt) {
-    ptrdiff_t curEnd = ctxt->input->end - ctxt->input->cur;
-    ptrdiff_t curBase = ctxt->input->cur - ctxt->input->base;
-
-    if (((curEnd > XML_MAX_LOOKUP_LIMIT) ||
-         (curBase > XML_MAX_LOOKUP_LIMIT)) &&
-         ((ctxt->input->buf) &&
-          (ctxt->input->buf->readcallback != xmlInputReadCallbackNop)) &&
-        ((ctxt->options & XML_PARSE_HUGE) == 0)) {
-        xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, "Huge input lookup");
-        xmlHaltParser(ctxt);
-       return;
-    }
-    xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
-    if ((ctxt->input->cur > ctxt->input->end) ||
-        (ctxt->input->cur < ctxt->input->base)) {
-        xmlHaltParser(ctxt);
-        xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, "cur index out of bound");
-       return;
-    }
-    if ((ctxt->input->cur != NULL) && (*ctxt->input->cur == 0))
-        xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
-}
+       xmlParserGrow(ctxt);
 
 #define SKIP_BLANKS xmlSkipBlankChars(ctxt)
 
@@ -2148,7 +2088,7 @@ static void xmlGROW (xmlParserCtxtPtr ctxt) {
        ctxt->input->col++;                                             \
        ctxt->input->cur++;                                             \
        if (*ctxt->input->cur == 0)                                     \
-           xmlParserInputGrow(ctxt->input, INPUT_CHUNK);               \
+           xmlParserGrow(ctxt);                                                \
     }
 
 #define NEXTL(l) do {                                                  \
@@ -2162,16 +2102,15 @@ static void xmlGROW (xmlParserCtxtPtr ctxt) {
 #define CUR_SCHAR(s, l) xmlStringCurrentChar(ctxt, s, &l)
 
 #define COPY_BUF(l,b,i,v)                                              \
-    if (l == 1) b[i++] = (xmlChar) v;                                  \
+    if (l == 1) b[i++] = v;                                            \
     else i += xmlCopyCharMultiByte(&b[i],v)
 
-#define CUR_CONSUMED \
-    (ctxt->input->consumed + (ctxt->input->cur - ctxt->input->base))
-
 /**
  * xmlSkipBlankChars:
  * @ctxt:  the XML parser context
  *
+ * DEPRECATED: Internal function, do not use.
+ *
  * skip all blanks character found at that point in the input streams.
  * It pops up finished entities in the process if allowable at that point.
  *
@@ -2204,7 +2143,7 @@ xmlSkipBlankChars(xmlParserCtxtPtr ctxt) {
                res++;
            if (*cur == 0) {
                ctxt->input->cur = cur;
-               xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
+               xmlParserGrow(ctxt);
                cur = ctxt->input->cur;
            }
        }
@@ -2212,7 +2151,7 @@ xmlSkipBlankChars(xmlParserCtxtPtr ctxt) {
     } else {
         int expandPE = ((ctxt->external != 0) || (ctxt->inputNr != 1));
 
-       while (1) {
+       while (ctxt->instate != XML_PARSER_EOF) {
             if (IS_BLANK_CH(CUR)) { /* CHECKED tstblanks.xml */
                NEXT;
            } else if (CUR == '%') {
@@ -2223,8 +2162,30 @@ xmlSkipBlankChars(xmlParserCtxtPtr ctxt) {
                     break;
                xmlParsePEReference(ctxt);
             } else if (CUR == 0) {
+                unsigned long consumed;
+                xmlEntityPtr ent;
+
                 if (ctxt->inputNr <= 1)
                     break;
+
+                consumed = ctxt->input->consumed;
+                xmlSaturatedAddSizeT(&consumed,
+                                     ctxt->input->cur - ctxt->input->base);
+
+                /*
+                 * Add to sizeentities when parsing an external entity
+                 * for the first time.
+                 */
+                ent = ctxt->input->entity;
+                if ((ent->etype == XML_EXTERNAL_PARAMETER_ENTITY) &&
+                    ((ent->flags & XML_ENT_PARSED) == 0)) {
+                    ent->flags |= XML_ENT_PARSED;
+
+                    xmlSaturatedAdd(&ctxt->sizeentities, consumed);
+                }
+
+                xmlParserEntityCheck(ctxt, consumed);
+
                 xmlPopInput(ctxt);
             } else {
                 break;
@@ -2261,6 +2222,8 @@ xmlSkipBlankChars(xmlParserCtxtPtr ctxt) {
  */
 xmlChar
 xmlPopInput(xmlParserCtxtPtr ctxt) {
+    xmlParserInputPtr input;
+
     if ((ctxt == NULL) || (ctxt->inputNr <= 1)) return(0);
     if (xmlParserDebugEntities)
        xmlGenericError(xmlGenericErrorContext,
@@ -2269,9 +2232,12 @@ xmlPopInput(xmlParserCtxtPtr ctxt) {
         (ctxt->instate != XML_PARSER_EOF))
         xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
                     "Unfinished entity outside the DTD");
-    xmlFreeInputStream(inputPop(ctxt));
+    input = inputPop(ctxt);
+    if (input->entity != NULL)
+        input->entity->flags &= ~XML_ENT_EXPANDING;
+    xmlFreeInputStream(input);
     if (*ctxt->input->cur == 0)
-        xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
+        xmlParserGrow(ctxt);
     return(CUR);
 }
 
@@ -2298,7 +2264,7 @@ xmlPushInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr input) {
                "Pushing input %d : %.30s\n", ctxt->inputNr+1, input->cur);
     }
     if (((ctxt->inputNr > 40) && ((ctxt->options & XML_PARSE_HUGE) == 0)) ||
-        (ctxt->inputNr > 1024)) {
+        (ctxt->inputNr > 100)) {
         xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
         while (ctxt->inputNr > 1)
             xmlFreeInputStream(inputPop(ctxt));
@@ -2315,7 +2281,9 @@ xmlPushInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr input) {
  * xmlParseCharRef:
  * @ctxt:  an XML parser context
  *
- * parse Reference declarations
+ * DEPRECATED: Internal function, don't use.
+ *
+ * Parse a numeric character reference. Always consumes '&'.
  *
  * [66] CharRef ::= '&#' [0-9]+ ';' |
  *                  '&#x' [0-9a-fA-F]+ ';'
@@ -2396,6 +2364,8 @@ xmlParseCharRef(xmlParserCtxtPtr ctxt) {
            ctxt->input->cur++;
        }
     } else {
+        if (RAW == '&')
+            SKIP(1);
         xmlFatalErr(ctxt, XML_ERR_INVALID_CHARREF, NULL);
     }
 
@@ -2516,6 +2486,8 @@ xmlParseStringCharRef(xmlParserCtxtPtr ctxt, const xmlChar **str) {
  * xmlParserHandlePEReference:
  * @ctxt:  the parser context
  *
+ * DEPRECATED: Internal function, do not use.
+ *
  * [69] PEReference ::= '%' Name ';'
  *
  * [ WFC: No Recursion ]
@@ -2619,7 +2591,7 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) {
 }
 
 /**
- * xmlStringLenDecodeEntities:
+ * xmlStringDecodeEntitiesInt:
  * @ctxt:  the parser context
  * @str:  the input string
  * @len: the string length
@@ -2627,19 +2599,12 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) {
  * @end:  an end marker xmlChar, 0 if none
  * @end2:  an end marker xmlChar, 0 if none
  * @end3:  an end marker xmlChar, 0 if none
- *
- * Takes a entity string content and process to do the adequate substitutions.
- *
- * [67] Reference ::= EntityRef | CharRef
- *
- * [69] PEReference ::= '%' Name ';'
- *
- * Returns A newly allocated string with the substitution done. The caller
- *      must deallocate it !
+ * @check:  whether to perform entity checks
  */
-xmlChar *
-xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
-                     int what, xmlChar end, xmlChar  end2, xmlChar end3) {
+static xmlChar *
+xmlStringDecodeEntitiesInt(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
+                          int what, xmlChar end, xmlChar  end2, xmlChar end3,
+                           int check) {
     xmlChar *buffer = NULL;
     size_t buffer_size = 0;
     size_t nbchars = 0;
@@ -2650,14 +2615,15 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
     xmlEntityPtr ent;
     int c,l;
 
-    if ((ctxt == NULL) || (str == NULL) || (len < 0))
-       return(NULL);
+    if (str == NULL)
+        return(NULL);
     last = str + len;
 
     if (((ctxt->depth > 40) &&
          ((ctxt->options & XML_PARSE_HUGE) == 0)) ||
-       (ctxt->depth > 1024)) {
-       xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
+       (ctxt->depth > 100)) {
+       xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_LOOP,
+                       "Maximum entity nesting depth exceeded");
        return(NULL);
     }
 
@@ -2695,9 +2661,6 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
                        "String decoding Entity Reference: %.30s\n",
                        str);
            ent = xmlParseStringEntityRef(ctxt, &str);
-           xmlParserEntityCheck(ctxt, 0, ent, 0);
-           if (ent != NULL)
-               ctxt->nbentities += ent->checked / 2;
            if ((ent != NULL) &&
                (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) {
                if (ent->content != NULL) {
@@ -2711,10 +2674,23 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
                     goto int_error;
                }
            } else if ((ent != NULL) && (ent->content != NULL)) {
+               if ((check) && (xmlParserEntityCheck(ctxt, ent->length)))
+                    goto int_error;
+
+                if (ent->flags & XML_ENT_EXPANDING) {
+                   xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
+                    xmlHaltParser(ctxt);
+                    ent->content[0] = 0;
+                    goto int_error;
+                }
+
+                ent->flags |= XML_ENT_EXPANDING;
                ctxt->depth++;
-               rep = xmlStringDecodeEntities(ctxt, ent->content, what,
-                                             0, 0, 0);
+               rep = xmlStringDecodeEntitiesInt(ctxt, ent->content,
+                        ent->length, what, 0, 0, 0, check);
                ctxt->depth--;
+                ent->flags &= ~XML_ENT_EXPANDING;
+
                if (rep == NULL) {
                     ent->content[0] = 0;
                     goto int_error;
@@ -2724,8 +2700,6 @@ 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, 0))
-                            goto int_error;
                         growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
                     }
                 }
@@ -2748,9 +2722,6 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
                xmlGenericError(xmlGenericErrorContext,
                        "String decoding PE Reference: %.30s\n", str);
            ent = xmlParseStringPEReference(ctxt, &str);
-           xmlParserEntityCheck(ctxt, 0, ent, 0);
-           if (ent != NULL)
-               ctxt->nbentities += ent->checked / 2;
            if (ent != NULL) {
                 if (ent->content == NULL) {
                    /*
@@ -2769,10 +2740,25 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
                                      ent->name, NULL);
                    }
                }
+
+               if ((check) && (xmlParserEntityCheck(ctxt, ent->length)))
+                    goto int_error;
+
+                if (ent->flags & XML_ENT_EXPANDING) {
+                   xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
+                    xmlHaltParser(ctxt);
+                    if (ent->content != NULL)
+                        ent->content[0] = 0;
+                    goto int_error;
+                }
+
+                ent->flags |= XML_ENT_EXPANDING;
                ctxt->depth++;
-               rep = xmlStringDecodeEntities(ctxt, ent->content, what,
-                                             0, 0, 0);
+               rep = xmlStringDecodeEntitiesInt(ctxt, ent->content,
+                        ent->length, what, 0, 0, 0, check);
                ctxt->depth--;
+                ent->flags &= ~XML_ENT_EXPANDING;
+
                if (rep == NULL) {
                     if (ent->content != NULL)
                         ent->content[0] = 0;
@@ -2782,8 +2768,6 @@ 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, 0))
-                            goto int_error;
                         growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
                     }
                 }
@@ -2816,6 +2800,37 @@ int_error:
 }
 
 /**
+ * xmlStringLenDecodeEntities:
+ * @ctxt:  the parser context
+ * @str:  the input string
+ * @len: the string length
+ * @what:  combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF
+ * @end:  an end marker xmlChar, 0 if none
+ * @end2:  an end marker xmlChar, 0 if none
+ * @end3:  an end marker xmlChar, 0 if none
+ *
+ * DEPRECATED: Internal function, don't use.
+ *
+ * Takes a entity string content and process to do the adequate substitutions.
+ *
+ * [67] Reference ::= EntityRef | CharRef
+ *
+ * [69] PEReference ::= '%' Name ';'
+ *
+ * Returns A newly allocated string with the substitution done. The caller
+ *      must deallocate it !
+ */
+xmlChar *
+xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
+                           int what, xmlChar end, xmlChar  end2,
+                           xmlChar end3) {
+    if ((ctxt == NULL) || (str == NULL) || (len < 0))
+        return(NULL);
+    return(xmlStringDecodeEntitiesInt(ctxt, str, len, what,
+                                      end, end2, end3, 0));
+}
+
+/**
  * xmlStringDecodeEntities:
  * @ctxt:  the parser context
  * @str:  the input string
@@ -2824,6 +2839,8 @@ int_error:
  * @end2:  an end marker xmlChar, 0 if none
  * @end3:  an end marker xmlChar, 0 if none
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * Takes a entity string content and process to do the adequate substitutions.
  *
  * [67] Reference ::= EntityRef | CharRef
@@ -2837,8 +2854,8 @@ xmlChar *
 xmlStringDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int what,
                        xmlChar end, xmlChar  end2, xmlChar end3) {
     if ((ctxt == NULL) || (str == NULL)) return(NULL);
-    return(xmlStringLenDecodeEntities(ctxt, str, xmlStrlen(str), what,
-           end, end2, end3));
+    return(xmlStringDecodeEntitiesInt(ctxt, str, xmlStrlen(str), what,
+                                      end, end2, end3, 0));
 }
 
 /************************************************************************
@@ -2978,7 +2995,7 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) {
         */
        max = len * 2;
 
-       buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar));
+       buffer = (xmlChar *) xmlMallocAtomic(max);
        if (buffer == NULL) {
            xmlErrMemory(ctxt, NULL);
            return(NULL);
@@ -2989,8 +3006,7 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) {
                xmlChar *tmp;
 
                max *= 2;
-               tmp = (xmlChar *) xmlRealloc(buffer,
-                                               max * sizeof(xmlChar));
+               tmp = (xmlChar *) xmlRealloc(buffer, max);
                if (tmp == NULL) {
                    xmlFree(buffer);
                    xmlErrMemory(ctxt, NULL);
@@ -3057,7 +3073,7 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) {
             */
            max = len * 2;
 
-           buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar));
+           buffer = (xmlChar *) xmlMallocAtomic(max);
            if (buffer == NULL) {
                xmlErrMemory(ctxt, NULL);
                return(NULL);
@@ -3068,8 +3084,7 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) {
                    xmlChar *tmp;
 
                    max *= 2;
-                   tmp = (xmlChar *) xmlRealloc(buffer,
-                                                   max * sizeof(xmlChar));
+                   tmp = (xmlChar *) xmlRealloc(buffer, max);
                    if (tmp == NULL) {
                        xmlErrMemory(ctxt, NULL);
                        xmlFree(buffer);
@@ -3201,7 +3216,9 @@ static const xmlChar *
 xmlParseNameComplex(xmlParserCtxtPtr ctxt) {
     int len = 0, l;
     int c;
-    int count = 0;
+    int maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+                    XML_MAX_TEXT_LENGTH :
+                    XML_MAX_NAME_LENGTH;
 
 #ifdef DEBUG
     nbParseNameComplex++;
@@ -3210,9 +3227,6 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) {
     /*
      * Handler for more complex cases
      */
-    GROW;
-    if (ctxt->instate == XML_PARSER_EOF)
-        return(NULL);
     c = CUR_CHAR(l);
     if ((ctxt->options & XML_PARSE_OLD10) == 0) {
         /*
@@ -3261,13 +3275,8 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) {
                ((c >= 0xFDF0) && (c <= 0xFFFD)) ||
                ((c >= 0x10000) && (c <= 0xEFFFF))
                )) {
-           if (count++ > XML_PARSER_CHUNK_SIZE) {
-               count = 0;
-               GROW;
-                if (ctxt->instate == XML_PARSER_EOF)
-                    return(NULL);
-           }
-           len += l;
+            if (len <= INT_MAX - l)
+               len += l;
            NEXTL(l);
            c = CUR_CHAR(l);
        }
@@ -3287,19 +3296,15 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) {
                (c == '_') || (c == ':') ||
                (IS_COMBINING(c)) ||
                (IS_EXTENDER(c)))) {
-           if (count++ > XML_PARSER_CHUNK_SIZE) {
-               count = 0;
-               GROW;
-                if (ctxt->instate == XML_PARSER_EOF)
-                    return(NULL);
-           }
-           len += l;
+            if (len <= INT_MAX - l)
+               len += l;
            NEXTL(l);
            c = CUR_CHAR(l);
        }
     }
-    if ((len > XML_MAX_NAME_LENGTH) &&
-        ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+    if (ctxt->instate == XML_PARSER_EOF)
+        return(NULL);
+    if (len > maxLength) {
         xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "Name");
         return(NULL);
     }
@@ -3322,6 +3327,8 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) {
  * xmlParseName:
  * @ctxt:  an XML parser context
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse an XML name.
  *
  * [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' |
@@ -3338,9 +3345,14 @@ const xmlChar *
 xmlParseName(xmlParserCtxtPtr ctxt) {
     const xmlChar *in;
     const xmlChar *ret;
-    int count = 0;
+    size_t count = 0;
+    size_t maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+                       XML_MAX_TEXT_LENGTH :
+                       XML_MAX_NAME_LENGTH;
 
     GROW;
+    if (ctxt->instate == XML_PARSER_EOF)
+        return(NULL);
 
 #ifdef DEBUG
     nbParseName++;
@@ -3362,8 +3374,7 @@ xmlParseName(xmlParserCtxtPtr ctxt) {
            in++;
        if ((*in > 0) && (*in < 0x80)) {
            count = in - ctxt->input->cur;
-            if ((count > XML_MAX_NAME_LENGTH) &&
-                ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+            if (count > maxLength) {
                 xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "Name");
                 return(NULL);
             }
@@ -3383,7 +3394,9 @@ static const xmlChar *
 xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
     int len = 0, l;
     int c;
-    int count = 0;
+    int maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+                    XML_MAX_TEXT_LENGTH :
+                    XML_MAX_NAME_LENGTH;
     size_t startPosition = 0;
 
 #ifdef DEBUG
@@ -3393,7 +3406,6 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
     /*
      * Handler for more complex cases
      */
-    GROW;
     startPosition = CUR_PTR - BASE_PTR;
     c = CUR_CHAR(l);
     if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */
@@ -3403,37 +3415,14 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) {
 
     while ((c != ' ') && (c != '>') && (c != '/') && /* test bigname.xml */
           (xmlIsNameChar(ctxt, c) && (c != ':'))) {
-       if (count++ > XML_PARSER_CHUNK_SIZE) {
-            if ((len > XML_MAX_NAME_LENGTH) &&
-                ((ctxt->options & XML_PARSE_HUGE) == 0)) {
-                xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName");
-                return(NULL);
-            }
-           count = 0;
-           GROW;
-            if (ctxt->instate == XML_PARSER_EOF)
-                return(NULL);
-       }
-       len += l;
+        if (len <= INT_MAX - l)
+           len += l;
        NEXTL(l);
        c = CUR_CHAR(l);
-       if (c == 0) {
-           count = 0;
-           /*
-            * when shrinking to extend the buffer we really need to preserve
-            * the part of the name we already parsed. Hence rolling back
-            * by current length.
-            */
-           ctxt->input->cur -= l;
-           GROW;
-            if (ctxt->instate == XML_PARSER_EOF)
-                return(NULL);
-           ctxt->input->cur += l;
-           c = CUR_CHAR(l);
-       }
     }
-    if ((len > XML_MAX_NAME_LENGTH) &&
-        ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+    if (ctxt->instate == XML_PARSER_EOF)
+        return(NULL);
+    if (len > maxLength) {
         xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName");
         return(NULL);
     }
@@ -3459,7 +3448,10 @@ static const xmlChar *
 xmlParseNCName(xmlParserCtxtPtr ctxt) {
     const xmlChar *in, *e;
     const xmlChar *ret;
-    int count = 0;
+    size_t count = 0;
+    size_t maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+                       XML_MAX_TEXT_LENGTH :
+                       XML_MAX_NAME_LENGTH;
 
 #ifdef DEBUG
     nbParseNCName++;
@@ -3484,8 +3476,7 @@ xmlParseNCName(xmlParserCtxtPtr ctxt) {
            goto complex;
        if ((*in > 0) && (*in < 0x80)) {
            count = in - ctxt->input->cur;
-            if ((count > XML_MAX_NAME_LENGTH) &&
-                ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+            if (count > maxLength) {
                 xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName");
                 return(NULL);
             }
@@ -3567,6 +3558,9 @@ xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) {
     const xmlChar *cur = *str;
     int len = 0, l;
     int c;
+    int maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+                    XML_MAX_TEXT_LENGTH :
+                    XML_MAX_NAME_LENGTH;
 
 #ifdef DEBUG
     nbParseStringName++;
@@ -3592,7 +3586,7 @@ xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) {
            xmlChar *buffer;
            int max = len * 2;
 
-           buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar));
+           buffer = (xmlChar *) xmlMallocAtomic(max);
            if (buffer == NULL) {
                xmlErrMemory(ctxt, NULL);
                return(NULL);
@@ -3602,15 +3596,8 @@ xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) {
                if (len + 10 > max) {
                    xmlChar *tmp;
 
-                    if ((len > XML_MAX_NAME_LENGTH) &&
-                        ((ctxt->options & XML_PARSE_HUGE) == 0)) {
-                        xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName");
-                       xmlFree(buffer);
-                        return(NULL);
-                    }
                    max *= 2;
-                   tmp = (xmlChar *) xmlRealloc(buffer,
-                                                   max * sizeof(xmlChar));
+                   tmp = (xmlChar *) xmlRealloc(buffer, max);
                    if (tmp == NULL) {
                        xmlErrMemory(ctxt, NULL);
                        xmlFree(buffer);
@@ -3621,14 +3608,18 @@ xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) {
                COPY_BUF(l,buffer,len,c);
                cur += l;
                c = CUR_SCHAR(cur, l);
+                if (len > maxLength) {
+                    xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName");
+                    xmlFree(buffer);
+                    return(NULL);
+                }
            }
            buffer[len] = 0;
            *str = cur;
            return(buffer);
        }
     }
-    if ((len > XML_MAX_NAME_LENGTH) &&
-        ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+    if (len > maxLength) {
         xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName");
         return(NULL);
     }
@@ -3640,6 +3631,8 @@ xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) {
  * xmlParseNmtoken:
  * @ctxt:  an XML parser context
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse an XML Nmtoken.
  *
  * [7] Nmtoken ::= (NameChar)+
@@ -3654,32 +3647,20 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) {
     xmlChar buf[XML_MAX_NAMELEN + 5];
     int len = 0, l;
     int c;
-    int count = 0;
+    int maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+                    XML_MAX_TEXT_LENGTH :
+                    XML_MAX_NAME_LENGTH;
 
 #ifdef DEBUG
     nbParseNmToken++;
 #endif
 
-    GROW;
-    if (ctxt->instate == XML_PARSER_EOF)
-        return(NULL);
     c = CUR_CHAR(l);
 
     while (xmlIsNameChar(ctxt, c)) {
-       if (count++ > XML_PARSER_CHUNK_SIZE) {
-           count = 0;
-           GROW;
-       }
        COPY_BUF(l,buf,len,c);
        NEXTL(l);
        c = CUR_CHAR(l);
-       if (c == 0) {
-           count = 0;
-           GROW;
-           if (ctxt->instate == XML_PARSER_EOF)
-               return(NULL);
-            c = CUR_CHAR(l);
-       }
        if (len >= XML_MAX_NAMELEN) {
            /*
             * Okay someone managed to make a huge token, so he's ready to pay
@@ -3688,33 +3669,18 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) {
            xmlChar *buffer;
            int max = len * 2;
 
-           buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar));
+           buffer = (xmlChar *) xmlMallocAtomic(max);
            if (buffer == NULL) {
                xmlErrMemory(ctxt, NULL);
                return(NULL);
            }
            memcpy(buffer, buf, len);
            while (xmlIsNameChar(ctxt, c)) {
-               if (count++ > XML_PARSER_CHUNK_SIZE) {
-                   count = 0;
-                   GROW;
-                    if (ctxt->instate == XML_PARSER_EOF) {
-                        xmlFree(buffer);
-                        return(NULL);
-                    }
-               }
                if (len + 10 > max) {
                    xmlChar *tmp;
 
-                    if ((max > XML_MAX_NAME_LENGTH) &&
-                        ((ctxt->options & XML_PARSE_HUGE) == 0)) {
-                        xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NmToken");
-                        xmlFree(buffer);
-                        return(NULL);
-                    }
                    max *= 2;
-                   tmp = (xmlChar *) xmlRealloc(buffer,
-                                                   max * sizeof(xmlChar));
+                   tmp = (xmlChar *) xmlRealloc(buffer, max);
                    if (tmp == NULL) {
                        xmlErrMemory(ctxt, NULL);
                        xmlFree(buffer);
@@ -3723,17 +3689,27 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) {
                    buffer = tmp;
                }
                COPY_BUF(l,buffer,len,c);
+                if (len > maxLength) {
+                    xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NmToken");
+                    xmlFree(buffer);
+                    return(NULL);
+                }
                NEXTL(l);
                c = CUR_CHAR(l);
            }
            buffer[len] = 0;
+            if (ctxt->instate == XML_PARSER_EOF) {
+                xmlFree(buffer);
+                return(NULL);
+            }
            return(buffer);
        }
     }
+    if (ctxt->instate == XML_PARSER_EOF)
+        return(NULL);
     if (len == 0)
         return(NULL);
-    if ((len > XML_MAX_NAME_LENGTH) &&
-        ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+    if (len > maxLength) {
         xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NmToken");
         return(NULL);
     }
@@ -3745,6 +3721,8 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) {
  * @ctxt:  an XML parser context
  * @orig:  if non-NULL store a copy of the original entity value
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse a value for ENTITY declarations
  *
  * [9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"' |
@@ -3759,6 +3737,9 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) {
     int len = 0;
     int size = XML_PARSER_BUFFER_SIZE;
     int c, l;
+    int maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+                    XML_MAX_HUGE_LENGTH :
+                    XML_MAX_TEXT_LENGTH;
     xmlChar stop;
     xmlChar *ret = NULL;
     const xmlChar *cur = NULL;
@@ -3770,7 +3751,7 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) {
        xmlFatalErr(ctxt, XML_ERR_ENTITY_NOT_STARTED, NULL);
        return(NULL);
     }
-    buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
+    buf = (xmlChar *) xmlMallocAtomic(size);
     if (buf == NULL) {
        xmlErrMemory(ctxt, NULL);
        return(NULL);
@@ -3802,7 +3783,7 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) {
            xmlChar *tmp;
 
            size *= 2;
-           tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
+           tmp = (xmlChar *) xmlRealloc(buf, size);
            if (tmp == NULL) {
                xmlErrMemory(ctxt, NULL);
                 goto error;
@@ -3818,6 +3799,12 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) {
            GROW;
            c = CUR_CHAR(l);
        }
+
+        if (len > maxLength) {
+            xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_NOT_FINISHED,
+                           "entity value too long\n");
+            goto error;
+        }
     }
     buf[len] = 0;
     if (ctxt->instate == XML_PARSER_EOF)
@@ -3872,9 +3859,10 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) {
      * so XML_SUBSTITUTE_REF is not set here.
      */
     ++ctxt->depth;
-    ret = xmlStringDecodeEntities(ctxt, buf, XML_SUBSTITUTE_PEREF,
-                                  0, 0, 0);
+    ret = xmlStringDecodeEntitiesInt(ctxt, buf, len, XML_SUBSTITUTE_PEREF,
+                                     0, 0, 0, /* check */ 1);
     --ctxt->depth;
+
     if (orig != NULL) {
         *orig = buf;
         buf = NULL;
@@ -3905,6 +3893,9 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
     xmlChar *rep = NULL;
     size_t len = 0;
     size_t buf_size = 0;
+    size_t maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+                       XML_MAX_HUGE_LENGTH :
+                       XML_MAX_TEXT_LENGTH;
     int c, l, in_space = 0;
     xmlChar *current = NULL;
     xmlEntityPtr ent;
@@ -3936,16 +3927,6 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
     while (((NXT(0) != limit) && /* checked */
             (IS_CHAR(c)) && (c != '<')) &&
             (ctxt->instate != XML_PARSER_EOF)) {
-        /*
-         * Impose a reasonable limit on attribute size, unless XML_PARSE_HUGE
-         * special option is given
-         */
-        if ((len > XML_MAX_TEXT_LENGTH) &&
-            ((ctxt->options & XML_PARSE_HUGE) == 0)) {
-            xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
-                           "AttValue length too long\n");
-            goto mem_error;
-        }
        if (c == '&') {
            in_space = 0;
            if (NXT(1) == '#') {
@@ -3979,9 +3960,6 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
                }
            } else {
                ent = xmlParseEntityRef(ctxt);
-               ctxt->nbentities++;
-               if (ent != NULL)
-                   ctxt->nbentities += ent->owner;
                if ((ent != NULL) &&
                    (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) {
                    if (len + 10 > buf_size) {
@@ -4000,10 +3978,13 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
                } else if ((ent != NULL) &&
                           (ctxt->replaceEntities != 0)) {
                    if (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) {
+                        if (xmlParserEntityCheck(ctxt, ent->length))
+                            goto error;
+
                        ++ctxt->depth;
-                       rep = xmlStringDecodeEntities(ctxt, ent->content,
-                                                     XML_SUBSTITUTE_REF,
-                                                     0, 0, 0);
+                       rep = xmlStringDecodeEntitiesInt(ctxt, ent->content,
+                                ent->length, XML_SUBSTITUTE_REF, 0, 0, 0,
+                                /* check */ 1);
                        --ctxt->depth;
                        if (rep != NULL) {
                            current = rep;
@@ -4033,29 +4014,47 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
                    const xmlChar *cur = ent->name;
 
                    /*
-                    * This may look absurd but is needed to detect
-                    * entities problems
+                     * We also check for recursion and amplification
+                     * when entities are not substituted. They're
+                     * often expanded later.
                     */
                    if ((ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) &&
-                       (ent->content != NULL) && (ent->checked == 0)) {
-                       unsigned long oldnbent = ctxt->nbentities, diff;
-
-                       ++ctxt->depth;
-                       rep = xmlStringDecodeEntities(ctxt, ent->content,
-                                                 XML_SUBSTITUTE_REF, 0, 0, 0);
-                       --ctxt->depth;
-
-                        diff = ctxt->nbentities - oldnbent + 1;
-                        if (diff > INT_MAX / 2)
-                            diff = INT_MAX / 2;
-                        ent->checked = diff * 2;
-                       if (rep != NULL) {
-                           if (xmlStrchr(rep, '<'))
-                               ent->checked |= 1;
-                           xmlFree(rep);
-                           rep = NULL;
-                       } else {
-                            ent->content[0] = 0;
+                       (ent->content != NULL)) {
+                        if ((ent->flags & XML_ENT_CHECKED) == 0) {
+                            unsigned long oldCopy = ctxt->sizeentcopy;
+
+                            ctxt->sizeentcopy = ent->length;
+
+                            ++ctxt->depth;
+                            rep = xmlStringDecodeEntitiesInt(ctxt,
+                                    ent->content, ent->length,
+                                    XML_SUBSTITUTE_REF, 0, 0, 0,
+                                    /* check */ 1);
+                            --ctxt->depth;
+
+                            /*
+                             * If we're parsing DTD content, the entity
+                             * might reference other entities which
+                             * weren't defined yet, so the check isn't
+                             * reliable.
+                             */
+                            if (ctxt->inSubset == 0) {
+                                ent->flags |= XML_ENT_CHECKED;
+                                ent->expandedSize = ctxt->sizeentcopy;
+                            }
+
+                            if (rep != NULL) {
+                                xmlFree(rep);
+                                rep = NULL;
+                            } else {
+                                ent->content[0] = 0;
+                            }
+
+                            if (xmlParserEntityCheck(ctxt, oldCopy))
+                                goto error;
+                        } else {
+                            if (xmlParserEntityCheck(ctxt, ent->expandedSize))
+                                goto error;
                         }
                    }
 
@@ -4093,6 +4092,11 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
        }
        GROW;
        c = CUR_CHAR(l);
+        if (len > maxLength) {
+            xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
+                           "AttValue length too long\n");
+            goto mem_error;
+        }
     }
     if (ctxt->instate == XML_PARSER_EOF)
         goto error;
@@ -4114,17 +4118,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
     } else
        NEXT;
 
-    /*
-     * There we potentially risk an overflow, don't allow attribute value of
-     * length more than INT_MAX it is a very reasonable assumption !
-     */
-    if (len >= INT_MAX) {
-        xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
-                       "AttValue length too long\n");
-        goto mem_error;
-    }
-
-    if (attlen != NULL) *attlen = (int) len;
+    if (attlen != NULL) *attlen = len;
     return(buf);
 
 mem_error:
@@ -4141,6 +4135,8 @@ error:
  * xmlParseAttValue:
  * @ctxt:  an XML parser context
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse a value for an attribute
  * Note: the parser won't do substitution of entities here, this
  * will be handled later in xmlStringGetNodeList
@@ -4181,6 +4177,8 @@ xmlParseAttValue(xmlParserCtxtPtr ctxt) {
  * xmlParseSystemLiteral:
  * @ctxt:  an XML parser context
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse an XML Literal
  *
  * [11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'")
@@ -4194,11 +4192,12 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) {
     int len = 0;
     int size = XML_PARSER_BUFFER_SIZE;
     int cur, l;
+    int maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+                    XML_MAX_TEXT_LENGTH :
+                    XML_MAX_NAME_LENGTH;
     xmlChar stop;
     int state = ctxt->instate;
-    int count = 0;
 
-    SHRINK;
     if (RAW == '"') {
         NEXT;
        stop = '"';
@@ -4210,7 +4209,7 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) {
        return(NULL);
     }
 
-    buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
+    buf = (xmlChar *) xmlMallocAtomic(size);
     if (buf == NULL) {
         xmlErrMemory(ctxt, NULL);
        return(NULL);
@@ -4221,15 +4220,8 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) {
        if (len + 5 >= size) {
            xmlChar *tmp;
 
-            if ((size > XML_MAX_NAME_LENGTH) &&
-                ((ctxt->options & XML_PARSE_HUGE) == 0)) {
-                xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "SystemLiteral");
-                xmlFree(buf);
-               ctxt->instate = (xmlParserInputState) state;
-                return(NULL);
-            }
            size *= 2;
-           tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
+           tmp = (xmlChar *) xmlRealloc(buf, size);
            if (tmp == NULL) {
                xmlFree(buf);
                xmlErrMemory(ctxt, NULL);
@@ -4238,26 +4230,21 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) {
            }
            buf = tmp;
        }
-       count++;
-       if (count > 50) {
-           SHRINK;
-           GROW;
-           count = 0;
-            if (ctxt->instate == XML_PARSER_EOF) {
-               xmlFree(buf);
-               return(NULL);
-            }
-       }
        COPY_BUF(l,buf,len,cur);
+        if (len > maxLength) {
+            xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "SystemLiteral");
+            xmlFree(buf);
+            ctxt->instate = (xmlParserInputState) state;
+            return(NULL);
+        }
        NEXTL(l);
        cur = CUR_CHAR(l);
-       if (cur == 0) {
-           GROW;
-           SHRINK;
-           cur = CUR_CHAR(l);
-       }
     }
     buf[len] = 0;
+    if (ctxt->instate == XML_PARSER_EOF) {
+        xmlFree(buf);
+        return(NULL);
+    }
     ctxt->instate = (xmlParserInputState) state;
     if (!IS_CHAR(cur)) {
        xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, NULL);
@@ -4271,6 +4258,8 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) {
  * xmlParsePubidLiteral:
  * @ctxt:  an XML parser context
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse an XML public literal
  *
  * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
@@ -4283,12 +4272,13 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) {
     xmlChar *buf = NULL;
     int len = 0;
     int size = XML_PARSER_BUFFER_SIZE;
+    int maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+                    XML_MAX_TEXT_LENGTH :
+                    XML_MAX_NAME_LENGTH;
     xmlChar cur;
     xmlChar stop;
-    int count = 0;
     xmlParserInputState oldstate = ctxt->instate;
 
-    SHRINK;
     if (RAW == '"') {
         NEXT;
        stop = '"';
@@ -4299,7 +4289,7 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) {
        xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_STARTED, NULL);
        return(NULL);
     }
-    buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
+    buf = (xmlChar *) xmlMallocAtomic(size);
     if (buf == NULL) {
        xmlErrMemory(ctxt, NULL);
        return(NULL);
@@ -4310,14 +4300,8 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) {
        if (len + 1 >= size) {
            xmlChar *tmp;
 
-            if ((size > XML_MAX_NAME_LENGTH) &&
-                ((ctxt->options & XML_PARSE_HUGE) == 0)) {
-                xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "Public ID");
-                xmlFree(buf);
-                return(NULL);
-            }
            size *= 2;
-           tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
+           tmp = (xmlChar *) xmlRealloc(buf, size);
            if (tmp == NULL) {
                xmlErrMemory(ctxt, NULL);
                xmlFree(buf);
@@ -4326,35 +4310,29 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) {
            buf = tmp;
        }
        buf[len++] = cur;
-       count++;
-       if (count > 50) {
-           SHRINK;
-           GROW;
-           count = 0;
-            if (ctxt->instate == XML_PARSER_EOF) {
-               xmlFree(buf);
-               return(NULL);
-            }
-       }
+        if (len > maxLength) {
+            xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "Public ID");
+            xmlFree(buf);
+            return(NULL);
+        }
        NEXT;
        cur = CUR;
-       if (cur == 0) {
-           GROW;
-           SHRINK;
-           cur = CUR;
-       }
     }
     buf[len] = 0;
+    if (ctxt->instate == XML_PARSER_EOF) {
+        xmlFree(buf);
+        return(NULL);
+    }
     if (cur != stop) {
        xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, NULL);
     } else {
-       NEXT;
+       NEXTL(1);
     }
     ctxt->instate = oldstate;
     return(buf);
 }
 
-static void xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata);
+static void xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int partial);
 
 /*
  * used for the test in the inner loop of the char data testing
@@ -4395,12 +4373,12 @@ static const unsigned char test_char_data[256] = {
 };
 
 /**
- * xmlParseCharData:
+ * xmlParseCharDataInternal:
  * @ctxt:  an XML parser context
- * @cdata:  int indicating whether we are within a CDATA section
+ * @partial:  buffer may contain partial UTF-8 sequences
  *
- * parse a CharData section.
- * if we are within a CDATA section ']]>' marks an end of section.
+ * Parse character data. Always makes progress if the first char isn't
+ * '<' or '&'.
  *
  * The right angle bracket (>) may be represented using the string "&gt;",
  * and must, for compatibility, be escaped using "&gt;" or a character
@@ -4409,147 +4387,141 @@ static const unsigned char test_char_data[256] = {
  *
  * [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*)
  */
-
-void
-xmlParseCharData(xmlParserCtxtPtr ctxt, int cdata) {
+static void
+xmlParseCharDataInternal(xmlParserCtxtPtr ctxt, int partial) {
     const xmlChar *in;
     int nbchar = 0;
     int line = ctxt->input->line;
     int col = ctxt->input->col;
     int ccol;
 
-    SHRINK;
     GROW;
     /*
      * Accelerated common case where input don't need to be
      * modified before passing it to the handler.
      */
-    if (!cdata) {
-       in = ctxt->input->cur;
-       do {
+    in = ctxt->input->cur;
+    do {
 get_more_space:
-           while (*in == 0x20) { in++; ctxt->input->col++; }
-           if (*in == 0xA) {
-               do {
-                   ctxt->input->line++; ctxt->input->col = 1;
-                   in++;
-               } while (*in == 0xA);
-               goto get_more_space;
-           }
-           if (*in == '<') {
-               nbchar = in - ctxt->input->cur;
-               if (nbchar > 0) {
-                   const xmlChar *tmp = ctxt->input->cur;
-                   ctxt->input->cur = in;
-
-                   if ((ctxt->sax != NULL) &&
-                       (ctxt->sax->ignorableWhitespace !=
-                        ctxt->sax->characters)) {
-                       if (areBlanks(ctxt, tmp, nbchar, 1)) {
-                           if (ctxt->sax->ignorableWhitespace != NULL)
-                               ctxt->sax->ignorableWhitespace(ctxt->userData,
-                                                      tmp, nbchar);
-                       } else {
-                           if (ctxt->sax->characters != NULL)
-                               ctxt->sax->characters(ctxt->userData,
-                                                     tmp, nbchar);
-                           if (*ctxt->space == -1)
-                               *ctxt->space = -2;
-                       }
-                   } else if ((ctxt->sax != NULL) &&
-                              (ctxt->sax->characters != NULL)) {
-                       ctxt->sax->characters(ctxt->userData,
-                                             tmp, nbchar);
-                   }
-               }
-               return;
-           }
+        while (*in == 0x20) { in++; ctxt->input->col++; }
+        if (*in == 0xA) {
+            do {
+                ctxt->input->line++; ctxt->input->col = 1;
+                in++;
+            } while (*in == 0xA);
+            goto get_more_space;
+        }
+        if (*in == '<') {
+            nbchar = in - ctxt->input->cur;
+            if (nbchar > 0) {
+                const xmlChar *tmp = ctxt->input->cur;
+                ctxt->input->cur = in;
+
+                if ((ctxt->sax != NULL) &&
+                    (ctxt->sax->ignorableWhitespace !=
+                     ctxt->sax->characters)) {
+                    if (areBlanks(ctxt, tmp, nbchar, 1)) {
+                        if (ctxt->sax->ignorableWhitespace != NULL)
+                            ctxt->sax->ignorableWhitespace(ctxt->userData,
+                                                   tmp, nbchar);
+                    } else {
+                        if (ctxt->sax->characters != NULL)
+                            ctxt->sax->characters(ctxt->userData,
+                                                  tmp, nbchar);
+                        if (*ctxt->space == -1)
+                            *ctxt->space = -2;
+                    }
+                } else if ((ctxt->sax != NULL) &&
+                           (ctxt->sax->characters != NULL)) {
+                    ctxt->sax->characters(ctxt->userData,
+                                          tmp, nbchar);
+                }
+            }
+            return;
+        }
 
 get_more:
-            ccol = ctxt->input->col;
-           while (test_char_data[*in]) {
-               in++;
-               ccol++;
-           }
-           ctxt->input->col = ccol;
-           if (*in == 0xA) {
-               do {
-                   ctxt->input->line++; ctxt->input->col = 1;
-                   in++;
-               } while (*in == 0xA);
-               goto get_more;
-           }
-           if (*in == ']') {
-               if ((in[1] == ']') && (in[2] == '>')) {
-                   xmlFatalErr(ctxt, XML_ERR_MISPLACED_CDATA_END, NULL);
-                   ctxt->input->cur = in + 1;
-                   return;
-               }
-               in++;
-               ctxt->input->col++;
-               goto get_more;
-           }
-           nbchar = in - ctxt->input->cur;
-           if (nbchar > 0) {
-               if ((ctxt->sax != NULL) &&
-                   (ctxt->sax->ignorableWhitespace !=
-                    ctxt->sax->characters) &&
-                   (IS_BLANK_CH(*ctxt->input->cur))) {
-                   const xmlChar *tmp = ctxt->input->cur;
-                   ctxt->input->cur = in;
-
-                   if (areBlanks(ctxt, tmp, nbchar, 0)) {
-                       if (ctxt->sax->ignorableWhitespace != NULL)
-                           ctxt->sax->ignorableWhitespace(ctxt->userData,
-                                                          tmp, nbchar);
-                   } else {
-                       if (ctxt->sax->characters != NULL)
-                           ctxt->sax->characters(ctxt->userData,
-                                                 tmp, nbchar);
-                       if (*ctxt->space == -1)
-                           *ctxt->space = -2;
-                   }
-                    line = ctxt->input->line;
-                    col = ctxt->input->col;
-               } else if (ctxt->sax != NULL) {
-                   if (ctxt->sax->characters != NULL)
-                       ctxt->sax->characters(ctxt->userData,
-                                             ctxt->input->cur, nbchar);
-                    line = ctxt->input->line;
-                    col = ctxt->input->col;
-               }
-                /* something really bad happened in the SAX callback */
-                if (ctxt->instate != XML_PARSER_CONTENT)
-                    return;
-           }
-           ctxt->input->cur = in;
-           if (*in == 0xD) {
-               in++;
-               if (*in == 0xA) {
-                   ctxt->input->cur = in;
-                   in++;
-                   ctxt->input->line++; ctxt->input->col = 1;
-                   continue; /* while */
-               }
-               in--;
-           }
-           if (*in == '<') {
-               return;
-           }
-           if (*in == '&') {
-               return;
-           }
-           SHRINK;
-           GROW;
-            if (ctxt->instate == XML_PARSER_EOF)
-               return;
-           in = ctxt->input->cur;
-       } while (((*in >= 0x20) && (*in <= 0x7F)) || (*in == 0x09) || (*in == 0x0a));
-       nbchar = 0;
-    }
+        ccol = ctxt->input->col;
+        while (test_char_data[*in]) {
+            in++;
+            ccol++;
+        }
+        ctxt->input->col = ccol;
+        if (*in == 0xA) {
+            do {
+                ctxt->input->line++; ctxt->input->col = 1;
+                in++;
+            } while (*in == 0xA);
+            goto get_more;
+        }
+        if (*in == ']') {
+            if ((in[1] == ']') && (in[2] == '>')) {
+                xmlFatalErr(ctxt, XML_ERR_MISPLACED_CDATA_END, NULL);
+                if (ctxt->instate != XML_PARSER_EOF)
+                    ctxt->input->cur = in + 1;
+                return;
+            }
+            in++;
+            ctxt->input->col++;
+            goto get_more;
+        }
+        nbchar = in - ctxt->input->cur;
+        if (nbchar > 0) {
+            if ((ctxt->sax != NULL) &&
+                (ctxt->sax->ignorableWhitespace !=
+                 ctxt->sax->characters) &&
+                (IS_BLANK_CH(*ctxt->input->cur))) {
+                const xmlChar *tmp = ctxt->input->cur;
+                ctxt->input->cur = in;
+
+                if (areBlanks(ctxt, tmp, nbchar, 0)) {
+                    if (ctxt->sax->ignorableWhitespace != NULL)
+                        ctxt->sax->ignorableWhitespace(ctxt->userData,
+                                                       tmp, nbchar);
+                } else {
+                    if (ctxt->sax->characters != NULL)
+                        ctxt->sax->characters(ctxt->userData,
+                                              tmp, nbchar);
+                    if (*ctxt->space == -1)
+                        *ctxt->space = -2;
+                }
+                line = ctxt->input->line;
+                col = ctxt->input->col;
+            } else if (ctxt->sax != NULL) {
+                if (ctxt->sax->characters != NULL)
+                    ctxt->sax->characters(ctxt->userData,
+                                          ctxt->input->cur, nbchar);
+                line = ctxt->input->line;
+                col = ctxt->input->col;
+            }
+        }
+        ctxt->input->cur = in;
+        if (*in == 0xD) {
+            in++;
+            if (*in == 0xA) {
+                ctxt->input->cur = in;
+                in++;
+                ctxt->input->line++; ctxt->input->col = 1;
+                continue; /* while */
+            }
+            in--;
+        }
+        if (*in == '<') {
+            return;
+        }
+        if (*in == '&') {
+            return;
+        }
+        SHRINK;
+        GROW;
+        if (ctxt->instate == XML_PARSER_EOF)
+            return;
+        in = ctxt->input->cur;
+    } while (((*in >= 0x20) && (*in <= 0x7F)) ||
+             (*in == 0x09) || (*in == 0x0a));
     ctxt->input->line = line;
     ctxt->input->col = col;
-    xmlParseCharDataComplex(ctxt, cdata);
+    xmlParseCharDataComplex(ctxt, partial);
 }
 
 /**
@@ -4557,34 +4529,28 @@ get_more:
  * @ctxt:  an XML parser context
  * @cdata:  int indicating whether we are within a CDATA section
  *
+ * Always makes progress if the first char isn't '<' or '&'.
+ *
  * parse a CharData section.this is the fallback function
  * of xmlParseCharData() when the parsing requires handling
  * of non-ASCII characters.
  */
 static void
-xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata) {
+xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int partial) {
     xmlChar buf[XML_PARSER_BIG_BUFFER_SIZE + 5];
     int nbchar = 0;
     int cur, l;
-    int count = 0;
 
-    SHRINK;
-    GROW;
     cur = CUR_CHAR(l);
     while ((cur != '<') && /* checked */
            (cur != '&') &&
           (IS_CHAR(cur))) /* test also done in xmlCurrentChar() */ {
-       if ((cur == ']') && (NXT(1) == ']') &&
-           (NXT(2) == '>')) {
-           if (cdata) break;
-           else {
-               xmlFatalErr(ctxt, XML_ERR_MISPLACED_CDATA_END, NULL);
-           }
+       if ((cur == ']') && (NXT(1) == ']') && (NXT(2) == '>')) {
+           xmlFatalErr(ctxt, XML_ERR_MISPLACED_CDATA_END, NULL);
        }
        COPY_BUF(l,buf,nbchar,cur);
        /* move current position before possible calling of ctxt->sax->characters */
        NEXTL(l);
-       cur = CUR_CHAR(l);
        if (nbchar >= XML_PARSER_BIG_BUFFER_SIZE) {
            buf[nbchar] = 0;
 
@@ -4609,16 +4575,12 @@ xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata) {
             /* something really bad happened in the SAX callback */
             if (ctxt->instate != XML_PARSER_CONTENT)
                 return;
+            SHRINK;
        }
-       count++;
-       if (count > 50) {
-           SHRINK;
-           GROW;
-           count = 0;
-            if (ctxt->instate == XML_PARSER_EOF)
-               return;
-       }
+       cur = CUR_CHAR(l);
     }
+    if (ctxt->instate == XML_PARSER_EOF)
+        return;
     if (nbchar != 0) {
         buf[nbchar] = 0;
        /*
@@ -4637,22 +4599,51 @@ xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata) {
            }
        }
     }
-    if ((cur != 0) && (!IS_CHAR(cur))) {
-       /* Generate the error and skip the offending character */
-        xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR,
-                          "PCDATA invalid Char value %d\n",
-                         cur);
-       NEXTL(l);
+    /*
+     * cur == 0 can mean
+     *
+     * - XML_PARSER_EOF or memory error. This is checked above.
+     * - An actual 0 character.
+     * - End of buffer.
+     * - An incomplete UTF-8 sequence. This is allowed if partial is set.
+     */
+    if (ctxt->input->cur < ctxt->input->end) {
+        if ((cur == 0) && (CUR != 0)) {
+            if (partial == 0) {
+                xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR,
+                        "Incomplete UTF-8 sequence starting with %02X\n", CUR);
+                NEXTL(1);
+            }
+        } else if ((cur != '<') && (cur != '&')) {
+            /* Generate the error and skip the offending character */
+            xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR,
+                              "PCDATA invalid Char value %d\n", cur);
+            NEXTL(l);
+        }
     }
 }
 
 /**
+ * xmlParseCharData:
+ * @ctxt:  an XML parser context
+ * @cdata:  unused
+ *
+ * DEPRECATED: Internal function, don't use.
+ */
+void
+xmlParseCharData(xmlParserCtxtPtr ctxt, ATTRIBUTE_UNUSED int cdata) {
+    xmlParseCharDataInternal(ctxt, 0);
+}
+
+/**
  * xmlParseExternalID:
  * @ctxt:  an XML parser context
  * @publicID:  a xmlChar** receiving PubidLiteral
  * @strict: indicate whether we should restrict parsing to only
  *          production [75], see NOTE below
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * Parse an External ID or a Public ID
  *
  * NOTE: Productions [75] and [83] interact badly since [75] can generate
@@ -4672,8 +4663,6 @@ xmlChar *
 xmlParseExternalID(xmlParserCtxtPtr ctxt, xmlChar **publicID, int strict) {
     xmlChar *URI = NULL;
 
-    SHRINK;
-
     *publicID = NULL;
     if (CMP6(CUR_PTR, 'S', 'Y', 'S', 'T', 'E', 'M')) {
         SKIP(6);
@@ -4741,7 +4730,9 @@ xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf,
     int q, ql;
     int r, rl;
     int cur, l;
-    size_t count = 0;
+    size_t maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+                       XML_MAX_HUGE_LENGTH :
+                       XML_MAX_TEXT_LENGTH;
     int inputid;
 
     inputid = ctxt->input->id;
@@ -4749,13 +4740,12 @@ xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf,
     if (buf == NULL) {
         len = 0;
        size = XML_PARSER_BUFFER_SIZE;
-       buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
+       buf = (xmlChar *) xmlMallocAtomic(size);
        if (buf == NULL) {
            xmlErrMemory(ctxt, NULL);
            return;
        }
     }
-    GROW;      /* Assure there's enough input data */
     q = CUR_CHAR(ql);
     if (q == 0)
         goto not_terminated;
@@ -4773,7 +4763,7 @@ xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf,
     if (!IS_CHAR(r)) {
         xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR,
                           "xmlParseComment: invalid xmlChar value %d\n",
-                         q);
+                         r);
        xmlFree (buf);
        return;
     }
@@ -4787,13 +4777,6 @@ xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf,
        if ((r == '-') && (q == '-')) {
            xmlFatalErr(ctxt, XML_ERR_HYPHEN_IN_COMMENT, NULL);
        }
-        if ((len > XML_MAX_TEXT_LENGTH) &&
-            ((ctxt->options & XML_PARSE_HUGE) == 0)) {
-            xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED,
-                         "Comment too big found", NULL);
-            xmlFree (buf);
-            return;
-        }
        if (len + 5 >= size) {
            xmlChar *new_buf;
             size_t new_size;
@@ -4809,30 +4792,27 @@ xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf,
             size = new_size;
        }
        COPY_BUF(ql,buf,len,q);
+        if (len > maxLength) {
+            xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED,
+                         "Comment too big found", NULL);
+            xmlFree (buf);
+            return;
+        }
+
        q = r;
        ql = rl;
        r = cur;
        rl = l;
 
-       count++;
-       if (count > 50) {
-           SHRINK;
-           GROW;
-           count = 0;
-            if (ctxt->instate == XML_PARSER_EOF) {
-               xmlFree(buf);
-               return;
-            }
-       }
        NEXTL(l);
        cur = CUR_CHAR(l);
-       if (cur == 0) {
-           SHRINK;
-           GROW;
-           cur = CUR_CHAR(l);
-       }
+
     }
     buf[len] = 0;
+    if (ctxt->instate == XML_PARSER_EOF) {
+        xmlFree(buf);
+        return;
+    }
     if (cur == 0) {
        xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED,
                             "Comment not terminated \n<!--%.50s\n", buf);
@@ -4864,7 +4844,10 @@ not_terminated:
  * xmlParseComment:
  * @ctxt:  an XML parser context
  *
- * Skip an XML (SGML) comment <!-- .... -->
+ * DEPRECATED: Internal function, don't use.
+ *
+ * Parse an XML (SGML) comment. Always consumes '<!'.
+ *
  *  The spec says that "For compatibility, the string "--" (double-hyphen)
  *  must not occur within comments. "
  *
@@ -4875,6 +4858,9 @@ xmlParseComment(xmlParserCtxtPtr ctxt) {
     xmlChar *buf = NULL;
     size_t size = XML_PARSER_BUFFER_SIZE;
     size_t len = 0;
+    size_t maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+                       XML_MAX_HUGE_LENGTH :
+                       XML_MAX_TEXT_LENGTH;
     xmlParserInputState state;
     const xmlChar *in;
     size_t nbchar = 0;
@@ -4884,13 +4870,15 @@ xmlParseComment(xmlParserCtxtPtr ctxt) {
     /*
      * Check that there is a comment right here.
      */
-    if ((RAW != '<') || (NXT(1) != '!') ||
-        (NXT(2) != '-') || (NXT(3) != '-')) return;
+    if ((RAW != '<') || (NXT(1) != '!'))
+        return;
+    SKIP(2);
+    if ((RAW != '-') || (NXT(1) != '-'))
+        return;
     state = ctxt->instate;
     ctxt->instate = XML_PARSER_COMMENT;
     inputid = ctxt->input->id;
-    SKIP(4);
-    SHRINK;
+    SKIP(2);
     GROW;
 
     /*
@@ -4933,7 +4921,7 @@ get_more:
                        size = nbchar + 1;
                    else
                        size = XML_PARSER_BUFFER_SIZE + nbchar;
-                   buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
+                   buf = (xmlChar *) xmlMallocAtomic(size);
                    if (buf == NULL) {
                        xmlErrMemory(ctxt, NULL);
                        ctxt->instate = state;
@@ -4943,8 +4931,7 @@ get_more:
                } else if (len + nbchar + 1 >= size) {
                    xmlChar *new_buf;
                    size  += len + nbchar + XML_PARSER_BUFFER_SIZE;
-                   new_buf = (xmlChar *) xmlRealloc(buf,
-                                                    size * sizeof(xmlChar));
+                   new_buf = (xmlChar *) xmlRealloc(buf, size);
                    if (new_buf == NULL) {
                        xmlFree (buf);
                        xmlErrMemory(ctxt, NULL);
@@ -4958,8 +4945,7 @@ get_more:
                buf[len] = 0;
            }
        }
-        if ((len > XML_MAX_TEXT_LENGTH) &&
-            ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+        if (len > maxLength) {
             xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED,
                          "Comment too big found", NULL);
             xmlFree (buf);
@@ -5039,6 +5025,8 @@ get_more:
  * xmlParsePITarget:
  * @ctxt:  an XML parser context
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse the name of a PI
  *
  * [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))
@@ -5147,6 +5135,8 @@ error:
  * xmlParsePI:
  * @ctxt:  an XML parser context
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse an XML Processing Instruction.
  *
  * [16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'
@@ -5159,10 +5149,12 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
     xmlChar *buf = NULL;
     size_t len = 0;
     size_t size = XML_PARSER_BUFFER_SIZE;
+    size_t maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+                       XML_MAX_HUGE_LENGTH :
+                       XML_MAX_TEXT_LENGTH;
     int cur, l;
     const xmlChar *target;
     xmlParserInputState state;
-    int count = 0;
 
     if ((RAW == '<') && (NXT(1) == '?')) {
        int inputid = ctxt->input->id;
@@ -5172,7 +5164,6 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
         * this is a Processing Instruction.
         */
        SKIP(2);
-       SHRINK;
 
        /*
         * Parse the target name and check for special support like
@@ -5199,7 +5190,7 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
                    ctxt->instate = state;
                return;
            }
-           buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
+           buf = (xmlChar *) xmlMallocAtomic(size);
            if (buf == NULL) {
                xmlErrMemory(ctxt, NULL);
                ctxt->instate = state;
@@ -5225,42 +5216,22 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
                    buf = tmp;
                     size = new_size;
                }
-               count++;
-               if (count > 50) {
-                   SHRINK;
-                   GROW;
-                    if (ctxt->instate == XML_PARSER_EOF) {
-                        xmlFree(buf);
-                        return;
-                    }
-                   count = 0;
-                    if ((len > XML_MAX_TEXT_LENGTH) &&
-                        ((ctxt->options & XML_PARSE_HUGE) == 0)) {
-                        xmlFatalErrMsgStr(ctxt, XML_ERR_PI_NOT_FINISHED,
-                                          "PI %s too big found", target);
-                        xmlFree(buf);
-                        ctxt->instate = state;
-                        return;
-                    }
-               }
                COPY_BUF(l,buf,len,cur);
+                if (len > maxLength) {
+                    xmlFatalErrMsgStr(ctxt, XML_ERR_PI_NOT_FINISHED,
+                                      "PI %s too big found", target);
+                    xmlFree(buf);
+                    ctxt->instate = state;
+                    return;
+                }
                NEXTL(l);
                cur = CUR_CHAR(l);
-               if (cur == 0) {
-                   SHRINK;
-                   GROW;
-                   cur = CUR_CHAR(l);
-               }
            }
-            if ((len > XML_MAX_TEXT_LENGTH) &&
-                ((ctxt->options & XML_PARSE_HUGE) == 0)) {
-                xmlFatalErrMsgStr(ctxt, XML_ERR_PI_NOT_FINISHED,
-                                  "PI %s too big found", target);
-                xmlFree(buf);
-                ctxt->instate = state;
+           buf[len] = 0;
+            if (ctxt->instate == XML_PARSER_EOF) {
+                xmlFree(buf);
                 return;
             }
-           buf[len] = 0;
            if (cur != '?') {
                xmlFatalErrMsgStr(ctxt, XML_ERR_PI_NOT_FINISHED,
                      "ParsePI: PI %s never end ...\n", target);
@@ -5305,7 +5276,9 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
  * xmlParseNotationDecl:
  * @ctxt:  an XML parser context
  *
- * parse a notation declaration
+ * DEPRECATED: Internal function, don't use.
+ *
+ * Parse a notation declaration. Always consumes '<!'.
  *
  * [82] NotationDecl ::= '<!NOTATION' S Name S (ExternalID |  PublicID) S? '>'
  *
@@ -5323,10 +5296,13 @@ xmlParseNotationDecl(xmlParserCtxtPtr ctxt) {
     xmlChar *Pubid;
     xmlChar *Systemid;
 
-    if (CMP10(CUR_PTR, '<', '!', 'N', 'O', 'T', 'A', 'T', 'I', 'O', 'N')) {
+    if ((CUR != '<') || (NXT(1) != '!'))
+        return;
+    SKIP(2);
+
+    if (CMP8(CUR_PTR, 'N', 'O', 'T', 'A', 'T', 'I', 'O', 'N')) {
        int inputid = ctxt->input->id;
-       SHRINK;
-       SKIP(10);
+       SKIP(8);
        if (SKIP_BLANKS == 0) {
            xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
                           "Space required after '<!NOTATION'\n");
@@ -5377,7 +5353,9 @@ xmlParseNotationDecl(xmlParserCtxtPtr ctxt) {
  * xmlParseEntityDecl:
  * @ctxt:  an XML parser context
  *
- * parse <!ENTITY declarations
+ * DEPRECATED: Internal function, don't use.
+ *
+ * Parse an entity declaration. Always consumes '<!'.
  *
  * [70] EntityDecl ::= GEDecl | PEDecl
  *
@@ -5404,11 +5382,14 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) {
     int isParameter = 0;
     xmlChar *orig = NULL;
 
+    if ((CUR != '<') || (NXT(1) != '!'))
+        return;
+    SKIP(2);
+
     /* GROW; done in the caller */
-    if (CMP8(CUR_PTR, '<', '!', 'E', 'N', 'T', 'I', 'T', 'Y')) {
+    if (CMP6(CUR_PTR, 'E', 'N', 'T', 'I', 'T', 'Y')) {
        int inputid = ctxt->input->id;
-       SHRINK;
-       SKIP(8);
+       SKIP(6);
        if (SKIP_BLANKS == 0) {
            xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
                           "Space required after '<!ENTITY'\n");
@@ -5506,7 +5487,7 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) {
                        ctxt->myDoc = xmlNewDoc(SAX_COMPAT_MODE);
                        if (ctxt->myDoc == NULL) {
                            xmlErrMemory(ctxt, "New Doc failed");
-                           return;
+                           goto done;
                        }
                        ctxt->myDoc->properties = XML_DOC_INTERNAL;
                    }
@@ -5577,7 +5558,7 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) {
                            ctxt->myDoc = xmlNewDoc(SAX_COMPAT_MODE);
                            if (ctxt->myDoc == NULL) {
                                xmlErrMemory(ctxt, "New Doc failed");
-                               return;
+                               goto done;
                            }
                            ctxt->myDoc->properties = XML_DOC_INTERNAL;
                        }
@@ -5644,6 +5625,8 @@ done:
  * @ctxt:  an XML parser context
  * @value:  Receive a possible fixed default value for the attribute
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * Parse an attribute default declaration
  *
  * [60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue)
@@ -5705,6 +5688,8 @@ xmlParseDefaultDecl(xmlParserCtxtPtr ctxt, xmlChar **value) {
  * xmlParseNotationType:
  * @ctxt:  an XML parser context
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse an Notation attribute type.
  *
  * Note: the leading 'NOTATION' S part has already being parsed...
@@ -5727,7 +5712,6 @@ xmlParseNotationType(xmlParserCtxtPtr ctxt) {
        xmlFatalErr(ctxt, XML_ERR_NOTATION_NOT_STARTED, NULL);
        return(NULL);
     }
-    SHRINK;
     do {
         NEXT;
        SKIP_BLANKS;
@@ -5777,6 +5761,8 @@ xmlParseNotationType(xmlParserCtxtPtr ctxt) {
  * xmlParseEnumerationType:
  * @ctxt:  an XML parser context
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse an Enumeration attribute type.
  *
  * [59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')'
@@ -5797,7 +5783,6 @@ xmlParseEnumerationType(xmlParserCtxtPtr ctxt) {
        xmlFatalErr(ctxt, XML_ERR_ATTLIST_NOT_STARTED, NULL);
        return(NULL);
     }
-    SHRINK;
     do {
         NEXT;
        SKIP_BLANKS;
@@ -5847,6 +5832,8 @@ xmlParseEnumerationType(xmlParserCtxtPtr ctxt) {
  * @ctxt:  an XML parser context
  * @tree:  the enumeration tree built while parsing
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse an Enumerated attribute type.
  *
  * [57] EnumeratedType ::= NotationType | Enumeration
@@ -5880,6 +5867,8 @@ xmlParseEnumeratedType(xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree) {
  * @ctxt:  an XML parser context
  * @tree:  the enumeration tree built while parsing
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse the Attribute list def for an element
  *
  * [54] AttType ::= StringType | TokenizedType | EnumeratedType
@@ -5922,7 +5911,6 @@ xmlParseEnumeratedType(xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree) {
  */
 int
 xmlParseAttributeType(xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree) {
-    SHRINK;
     if (CMP5(CUR_PTR, 'C', 'D', 'A', 'T', 'A')) {
        SKIP(5);
        return(XML_ATTRIBUTE_CDATA);
@@ -5955,7 +5943,9 @@ xmlParseAttributeType(xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree) {
  * xmlParseAttributeListDecl:
  * @ctxt:  an XML parser context
  *
- * : parse the Attribute list def for an element
+ * DEPRECATED: Internal function, don't use.
+ *
+ * Parse an attribute list declaration for an element. Always consumes '<!'.
  *
  * [52] AttlistDecl ::= '<!ATTLIST' S Name AttDef* S? '>'
  *
@@ -5968,10 +5958,14 @@ xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt) {
     const xmlChar *attrName;
     xmlEnumerationPtr tree;
 
-    if (CMP9(CUR_PTR, '<', '!', 'A', 'T', 'T', 'L', 'I', 'S', 'T')) {
+    if ((CUR != '<') || (NXT(1) != '!'))
+        return;
+    SKIP(2);
+
+    if (CMP7(CUR_PTR, 'A', 'T', 'T', 'L', 'I', 'S', 'T')) {
        int inputid = ctxt->input->id;
 
-       SKIP(9);
+       SKIP(7);
        if (SKIP_BLANKS == 0) {
            xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
                                 "Space required after '<!ATTLIST'\n");
@@ -6076,6 +6070,8 @@ xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt) {
  * @ctxt:  an XML parser context
  * @inputchk:  the input used for the current entity, needed for boundary checks
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse the declaration for a Mixed Element content
  * The leading '(' and spaces have been skipped in xmlParseElementContentDecl
  *
@@ -6099,7 +6095,6 @@ xmlParseElementMixedContentDecl(xmlParserCtxtPtr ctxt, int inputchk) {
     if (CMP7(CUR_PTR, '#', 'P', 'C', 'D', 'A', 'T', 'A')) {
        SKIP(7);
        SKIP_BLANKS;
-       SHRINK;
        if (RAW == ')') {
            if (ctxt->input->id != inputchk) {
                xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
@@ -6271,7 +6266,6 @@ xmlParseElementChildrenContentDeclPriv(xmlParserCtxtPtr ctxt, int inputchk,
        GROW;
     }
     SKIP_BLANKS;
-    SHRINK;
     while ((RAW != ')') && (ctxt->instate != XML_PARSER_EOF)) {
         /*
         * Each loop we parse one separator and one element.
@@ -6494,6 +6488,8 @@ xmlParseElementChildrenContentDeclPriv(xmlParserCtxtPtr ctxt, int inputchk,
  * @ctxt:  an XML parser context
  * @inputchk:  the input used for the current entity, needed for boundary checks
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse the declaration for a Mixed Element content
  * The leading '(' and spaces have been skipped in xmlParseElementContentDecl
  *
@@ -6531,6 +6527,8 @@ xmlParseElementChildrenContentDecl(xmlParserCtxtPtr ctxt, int inputchk) {
  * @name:  the name of the element being defined.
  * @result:  the Element Content pointer will be stored here if any
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse the declaration for an Element content either Mixed or Children,
  * the cases EMPTY and ANY are handled directly in xmlParseElementDecl
  *
@@ -6575,7 +6573,9 @@ xmlParseElementContentDecl(xmlParserCtxtPtr ctxt, const xmlChar *name,
  * xmlParseElementDecl:
  * @ctxt:  an XML parser context
  *
- * parse an Element declaration.
+ * DEPRECATED: Internal function, don't use.
+ *
+ * Parse an element declaration. Always consumes '<!'.
  *
  * [45] elementdecl ::= '<!ELEMENT' S Name S contentspec S? '>'
  *
@@ -6590,11 +6590,15 @@ xmlParseElementDecl(xmlParserCtxtPtr ctxt) {
     int ret = -1;
     xmlElementContentPtr content  = NULL;
 
+    if ((CUR != '<') || (NXT(1) != '!'))
+        return(ret);
+    SKIP(2);
+
     /* GROW; done in the caller */
-    if (CMP9(CUR_PTR, '<', '!', 'E', 'L', 'E', 'M', 'E', 'N', 'T')) {
+    if (CMP7(CUR_PTR, 'E', 'L', 'E', 'M', 'E', 'N', 'T')) {
        int inputid = ctxt->input->id;
 
-       SKIP(9);
+       SKIP(7);
        if (SKIP_BLANKS == 0) {
            xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
                           "Space required after 'ELEMENT'\n");
@@ -6682,6 +6686,8 @@ xmlParseElementDecl(xmlParserCtxtPtr ctxt) {
  * xmlParseConditionalSections
  * @ctxt:  an XML parser context
  *
+ * Parse a conditional section. Always consumes '<!['.
+ *
  * [61] conditionalSect ::= includeSect | ignoreSect
  * [62] includeSect ::= '<![' S? 'INCLUDE' S? '[' extSubsetDecl ']]>'
  * [63] ignoreSect ::= '<![' S? 'IGNORE' S? '[' ignoreSectContents* ']]>'
@@ -6732,8 +6738,6 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
                 inputIds[depth] = id;
                 depth++;
             } else if (CMP6(CUR_PTR, 'I', 'G', 'N', 'O', 'R', 'E')) {
-                int state;
-                xmlParserInputState instate;
                 size_t ignoreDepth = 0;
 
                 SKIP(6);
@@ -6750,15 +6754,6 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
                 }
                 NEXT;
 
-                /*
-                 * Parse up to the end of the conditional section but disable
-                 * SAX event generating DTD building in the meantime
-                 */
-                state = ctxt->disableSAX;
-                instate = ctxt->instate;
-                if (ctxt->recovery == 0) ctxt->disableSAX = 1;
-                ctxt->instate = XML_PARSER_IGNORE;
-
                 while (RAW != 0) {
                     if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {
                         SKIP(3);
@@ -6779,9 +6774,6 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
                     }
                 }
 
-                ctxt->disableSAX = state;
-                ctxt->instate = instate;
-
                if (RAW == 0) {
                    xmlFatalErr(ctxt, XML_ERR_CONDSEC_NOT_FINISHED, NULL);
                     goto error;
@@ -6806,23 +6798,19 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
                                " in the same entity\n");
             }
             SKIP(3);
-        } else {
-            int id = ctxt->input->id;
-            unsigned long cons = CUR_CONSUMED;
-
+        } else if ((RAW == '<') && ((NXT(1) == '!') || (NXT(1) == '?'))) {
             xmlParseMarkupDecl(ctxt);
-
-            if ((id == ctxt->input->id) && (cons == CUR_CONSUMED)) {
-                xmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL);
-                xmlHaltParser(ctxt);
-                goto error;
-            }
+        } else {
+            xmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL);
+            xmlHaltParser(ctxt);
+            goto error;
         }
 
         if (depth == 0)
             break;
 
         SKIP_BLANKS;
+        SHRINK;
         GROW;
     }
 
@@ -6834,7 +6822,9 @@ error:
  * xmlParseMarkupDecl:
  * @ctxt:  an XML parser context
  *
- * parse Markup declarations
+ * DEPRECATED: Internal function, don't use.
+ *
+ * Parse markup declarations. Always consumes '<!' or '<?'.
  *
  * [29] markupdecl ::= elementdecl | AttlistDecl | EntityDecl |
  *                     NotationDecl | PI | Comment
@@ -6863,6 +6853,8 @@ xmlParseMarkupDecl(xmlParserCtxtPtr ctxt) {
                        xmlParseElementDecl(ctxt);
                    else if (NXT(3) == 'N')
                        xmlParseEntityDecl(ctxt);
+                    else
+                        SKIP(2);
                    break;
                case 'A':
                    xmlParseAttributeListDecl(ctxt);
@@ -6875,6 +6867,7 @@ xmlParseMarkupDecl(xmlParserCtxtPtr ctxt) {
                    break;
                default:
                    /* there is an error but it will be detected later */
+                    SKIP(2);
                    break;
            }
        } else if (NXT(1) == '?') {
@@ -6896,6 +6889,8 @@ xmlParseMarkupDecl(xmlParserCtxtPtr ctxt) {
  * xmlParseTextDecl:
  * @ctxt:  an XML parser context
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse an XML declaration header for external entities
  *
  * [77] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>'
@@ -6944,6 +6939,8 @@ xmlParseTextDecl(xmlParserCtxtPtr ctxt) {
      * We must have the encoding declaration
      */
     encoding = xmlParseEncodingDecl(ctxt);
+    if (ctxt->instate == XML_PARSER_EOF)
+        return;
     if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
        /*
         * The XML REC instructs us to stop parsing right here
@@ -6964,9 +6961,14 @@ xmlParseTextDecl(xmlParserCtxtPtr ctxt) {
        xmlFatalErr(ctxt, XML_ERR_XMLDECL_NOT_FINISHED, NULL);
        NEXT;
     } else {
+        int c;
+
        xmlFatalErr(ctxt, XML_ERR_XMLDECL_NOT_FINISHED, NULL);
-       MOVETO_ENDTAG(CUR_PTR);
-       NEXT;
+        while ((c = CUR) != 0) {
+            NEXT;
+            if (c == '>')
+                break;
+        }
     }
 
     ctxt->instate = oldstate;
@@ -7028,23 +7030,19 @@ xmlParseExternalSubset(xmlParserCtxtPtr ctxt, const xmlChar *ExternalID,
     ctxt->instate = XML_PARSER_DTD;
     ctxt->external = 1;
     SKIP_BLANKS;
-    while (((RAW == '<') && (NXT(1) == '?')) ||
-           ((RAW == '<') && (NXT(1) == '!')) ||
-          (RAW == '%')) {
-       int id = ctxt->input->id;
-       unsigned long cons = CUR_CONSUMED;
-
+    while ((ctxt->instate != XML_PARSER_EOF) && (RAW != 0)) {
        GROW;
         if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {
-           xmlParseConditionalSections(ctxt);
-       } else
-           xmlParseMarkupDecl(ctxt);
+            xmlParseConditionalSections(ctxt);
+        } else if ((RAW == '<') && ((NXT(1) == '!') || (NXT(1) == '?'))) {
+            xmlParseMarkupDecl(ctxt);
+        } else {
+            xmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL);
+            xmlHaltParser(ctxt);
+            return;
+        }
         SKIP_BLANKS;
-
-       if ((id == ctxt->input->id) && (cons == CUR_CONSUMED)) {
-           xmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL);
-           break;
-       }
+        SHRINK;
     }
 
     if (RAW != 0) {
@@ -7057,11 +7055,15 @@ xmlParseExternalSubset(xmlParserCtxtPtr ctxt, const xmlChar *ExternalID,
  * xmlParseReference:
  * @ctxt:  an XML parser context
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse and handle entity references in content, depending on the SAX
  * interface, this may end-up in a call to character() if this is a
  * CharRef, a predefined entity, if there is no reference() callback.
  * or if the parser was asked to switch to that mode.
  *
+ * Always consumes '&'.
+ *
  * [67] Reference ::= EntityRef | CharRef
  */
 void
@@ -7128,7 +7130,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
     if (ent == NULL) return;
     if (!ctxt->wellFormed)
        return;
-    was_checked = ent->checked;
+    was_checked = ent->flags & XML_ENT_PARSED;
 
     /* special case of predefined entities */
     if ((ent->name == NULL) ||
@@ -7154,11 +7156,10 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
      * far more secure as the parser will only process data coming from
      * the document entity by default.
      */
-    if (((ent->checked == 0) ||
-         ((ent->children == NULL) && (ctxt->options & XML_PARSE_NOENT))) &&
+    if (((ent->flags & XML_ENT_PARSED) == 0) &&
         ((ent->etype != XML_EXTERNAL_GENERAL_PARSED_ENTITY) ||
          (ctxt->options & (XML_PARSE_NOENT | XML_PARSE_DTDVALID)))) {
-       unsigned long oldnbent = ctxt->nbentities, diff;
+       unsigned long oldsizeentcopy = ctxt->sizeentcopy;
 
        /*
         * This is a bit hackish but this seems the best
@@ -7171,6 +7172,17 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
        else
            user_data = ctxt->userData;
 
+        /* Avoid overflow as much as possible */
+        ctxt->sizeentcopy = 0;
+
+        if (ent->flags & XML_ENT_EXPANDING) {
+            xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
+            xmlHaltParser(ctxt);
+            return;
+        }
+
+        ent->flags |= XML_ENT_EXPANDING;
+
        /*
         * Check that this entity is well formed
         * 4.3.2: An internal general parsed entity is well-formed
@@ -7195,87 +7207,67 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
                         "invalid entity type found\n", NULL);
        }
 
-       /*
-        * Store the number of entities needing parsing for this entity
-        * content and do checkings
-        */
-        diff = ctxt->nbentities - oldnbent + 1;
-        if (diff > INT_MAX / 2)
-            diff = INT_MAX / 2;
-        ent->checked = diff * 2;
-       if ((ent->content != NULL) && (xmlStrchr(ent->content, '<')))
-           ent->checked |= 1;
+        ent->flags &= ~XML_ENT_EXPANDING;
+        ent->flags |= XML_ENT_PARSED | XML_ENT_CHECKED;
+        ent->expandedSize = ctxt->sizeentcopy;
        if (ret == XML_ERR_ENTITY_LOOP) {
-           xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
             xmlHaltParser(ctxt);
            xmlFreeNodeList(list);
            return;
        }
-       if (xmlParserEntityCheck(ctxt, 0, ent, 0)) {
+       if (xmlParserEntityCheck(ctxt, oldsizeentcopy)) {
            xmlFreeNodeList(list);
            return;
        }
 
        if ((ret == XML_ERR_OK) && (list != NULL)) {
-           if (((ent->etype == XML_INTERNAL_GENERAL_ENTITY) ||
-            (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY))&&
-               (ent->children == NULL)) {
-               ent->children = list;
-                /*
-                 * Prune it directly in the generated document
-                 * except for single text nodes.
-                 */
-                if ((ctxt->replaceEntities == 0) ||
-                    (ctxt->parseMode == XML_PARSE_READER) ||
-                    ((list->type == XML_TEXT_NODE) &&
-                     (list->next == NULL))) {
-                    ent->owner = 1;
-                    while (list != NULL) {
-                        list->parent = (xmlNodePtr) ent;
-                        if (list->doc != ent->doc)
-                            xmlSetTreeDoc(list, ent->doc);
-                        if (list->next == NULL)
-                            ent->last = list;
-                        list = list->next;
-                    }
-                    list = NULL;
-                } else {
-                    ent->owner = 0;
-                    while (list != NULL) {
-                        list->parent = (xmlNodePtr) ctxt->node;
-                        list->doc = ctxt->myDoc;
-                        if (list->next == NULL)
-                            ent->last = list;
-                        list = list->next;
-                    }
-                    list = ent->children;
+            ent->children = list;
+            /*
+             * Prune it directly in the generated document
+             * except for single text nodes.
+             */
+            if ((ctxt->replaceEntities == 0) ||
+                (ctxt->parseMode == XML_PARSE_READER) ||
+                ((list->type == XML_TEXT_NODE) &&
+                 (list->next == NULL))) {
+                ent->owner = 1;
+                while (list != NULL) {
+                    list->parent = (xmlNodePtr) ent;
+                    if (list->doc != ent->doc)
+                        xmlSetTreeDoc(list, ent->doc);
+                    if (list->next == NULL)
+                        ent->last = list;
+                    list = list->next;
+                }
+                list = NULL;
+            } else {
+                ent->owner = 0;
+                while (list != NULL) {
+                    list->parent = (xmlNodePtr) ctxt->node;
+                    list->doc = ctxt->myDoc;
+                    if (list->next == NULL)
+                        ent->last = list;
+                    list = list->next;
+                }
+                list = ent->children;
 #ifdef LIBXML_LEGACY_ENABLED
-                    if (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY)
-                        xmlAddEntityReference(ent, list, NULL);
+                if (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY)
+                    xmlAddEntityReference(ent, list, NULL);
 #endif /* LIBXML_LEGACY_ENABLED */
-                }
-           } else {
-               xmlFreeNodeList(list);
-               list = NULL;
-           }
+            }
        } else if ((ret != XML_ERR_OK) &&
                   (ret != XML_WAR_UNDECLARED_ENTITY)) {
            xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY,
                     "Entity '%s' failed to parse\n", ent->name);
             if (ent->content != NULL)
                 ent->content[0] = 0;
-           xmlParserEntityCheck(ctxt, 0, ent, 0);
        } else if (list != NULL) {
            xmlFreeNodeList(list);
            list = NULL;
        }
-       if (ent->checked == 0)
-           ent->checked = 2;
 
         /* Prevent entity from being parsed and expanded twice (Bug 760367). */
         was_checked = 0;
-    } else if (ent->checked != 1) {
-       ctxt->nbentities += ent->checked / 2;
     }
 
     /*
@@ -7309,11 +7301,16 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
                ctxt->depth--;
            } else if (ent->etype ==
                       XML_EXTERNAL_GENERAL_PARSED_ENTITY) {
+               unsigned long oldsizeentities = ctxt->sizeentities;
+
                ctxt->depth++;
                ret = xmlParseExternalEntityPrivate(ctxt->myDoc, ctxt,
                           ctxt->sax, user_data, ctxt->depth,
                           ent->URI, ent->ExternalID, NULL);
                ctxt->depth--;
+
+                /* Undo the change to sizeentities */
+                ctxt->sizeentities = oldsizeentities;
            } else {
                ret = XML_ERR_ENTITY_PE_INTERNAL;
                xmlErrMsgStr(ctxt, XML_ERR_INTERNAL_ERROR,
@@ -7323,6 +7320,8 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
                xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
                return;
            }
+            if (xmlParserEntityCheck(ctxt, 0))
+                return;
        }
        if ((ctxt->sax != NULL) && (ctxt->sax->reference != NULL) &&
            (ctxt->replaceEntities == 0) && (!ctxt->disableSAX)) {
@@ -7336,6 +7335,14 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
     }
 
     /*
+     * We also check for amplification if entities aren't substituted.
+     * They might be expanded later.
+     */
+    if ((was_checked != 0) &&
+        (xmlParserEntityCheck(ctxt, ent->expandedSize)))
+        return;
+
+    /*
      * If we didn't get any children for the entity being built
      */
     if ((ctxt->sax != NULL) && (ctxt->sax->reference != NULL) &&
@@ -7347,7 +7354,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
        return;
     }
 
-    if ((ctxt->replaceEntities) || (ent->children == NULL))  {
+    if (ctxt->replaceEntities)  {
        /*
         * There is a problem on the handling of _private for entities
         * (bug 155816): Should we copy the content of the field from
@@ -7361,7 +7368,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
         * hack - maybe we should have further tests to determine
         * what to do.
         */
-       if ((ctxt->node != NULL) && (ent->children != NULL)) {
+       if (ctxt->node != NULL) {
            /*
             * Seems we are generating the DOM content, do
             * a simple tree copy for all references except the first
@@ -7372,13 +7379,6 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
                xmlNodePtr nw = NULL, cur, firstChild = NULL;
 
                /*
-                * We are copying here, make sure there is no abuse
-                */
-               ctxt->sizeentcopy += ent->length + 5;
-               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)
@@ -7420,13 +7420,6 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
                           firstChild = NULL;
 
                /*
-                * We are copying here, make sure there is no abuse
-                */
-               ctxt->sizeentcopy += ent->length + 5;
-               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
                 * ID or REF referenced will be the one from the
@@ -7448,8 +7441,8 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
                            firstChild = cur;
                        }
                        xmlAddChild((xmlNodePtr) ent, nw);
-                       xmlAddChild(ctxt->node, cur);
                    }
+                   xmlAddChild(ctxt->node, cur);
                    if (cur == last)
                        break;
                    cur = next;
@@ -7493,7 +7486,9 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
  * xmlParseEntityRef:
  * @ctxt:  an XML parser context
  *
- * parse ENTITY references declarations
+ * DEPRECATED: Internal function, don't use.
+ *
+ * Parse an entitiy reference. Always consumes '&'.
  *
  * [68] EntityRef ::= '&' Name ';'
  *
@@ -7551,11 +7546,6 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) {
     }
 
     /*
-     * Increase the number of entity references parsed
-     */
-    ctxt->nbentities++;
-
-    /*
      * Ask first SAX for entity resolution, otherwise try the
      * entities which may have stored in the parser context.
      */
@@ -7608,7 +7598,6 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) {
                ctxt->sax->reference(ctxt->userData, name);
            }
        }
-       xmlParserEntityCheck(ctxt, 0, ent, 0);
        ctxt->valid = 0;
     }
 
@@ -7639,13 +7628,16 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) {
      * not contain a <.
      */
     else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) &&
-            (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);
+       if ((ent->flags & XML_ENT_CHECKED_LT) == 0) {
+            if ((ent->content != NULL) && (xmlStrchr(ent->content, '<')))
+                ent->flags |= XML_ENT_CONTAINS_LT;
+            ent->flags |= XML_ENT_CHECKED_LT;
         }
+        if (ent->flags & XML_ENT_CONTAINS_LT)
+            xmlFatalErrMsgStr(ctxt, XML_ERR_LT_IN_ATTRIBUTE,
+                    "'<' in entity '%s' is not allowed in attributes "
+                    "values\n", name);
     }
 
     /*
@@ -7748,11 +7740,6 @@ xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) {
     }
 
     /*
-     * Increase the number of entity references parsed
-     */
-    ctxt->nbentities++;
-
-    /*
      * Ask first SAX for entity resolution, otherwise try the
      * entities which may have stored in the parser context.
      */
@@ -7802,7 +7789,6 @@ xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) {
                          "Entity '%s' not defined\n",
                          name);
        }
-       xmlParserEntityCheck(ctxt, 0, ent, 0);
        /* TODO ? check regressions ctxt->valid = 0; */
     }
 
@@ -7833,12 +7819,16 @@ xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) {
      * 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->etype != XML_INTERNAL_PREDEFINED_ENTITY)) {
+       if ((ent->flags & XML_ENT_CHECKED_LT) == 0) {
+            if ((ent->content != NULL) && (xmlStrchr(ent->content, '<')))
+                ent->flags |= XML_ENT_CONTAINS_LT;
+            ent->flags |= XML_ENT_CHECKED_LT;
+        }
+        if (ent->flags & XML_ENT_CONTAINS_LT)
+            xmlFatalErrMsgStr(ctxt, XML_ERR_LT_IN_ATTRIBUTE,
+                    "'<' in entity '%s' is not allowed in attributes "
+                    "values\n", name);
     }
 
     /*
@@ -7873,7 +7863,10 @@ xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) {
  * xmlParsePEReference:
  * @ctxt:  an XML parser context
  *
- * parse PEReference declarations
+ * DEPRECATED: Internal function, don't use.
+ *
+ * Parse a parameter entity reference. Always consumes '%'.
+ *
  * The entity content is handled directly by pushing it's content as
  * a new input stream.
  *
@@ -7924,11 +7917,6 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt)
     NEXT;
 
     /*
-     * Increase the number of entity references parsed
-     */
-    ctxt->nbentities++;
-
-    /*
      * Request the entity from SAX
      */
     if ((ctxt->sax != NULL) &&
@@ -7969,7 +7957,6 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt)
                               name, NULL);
             ctxt->valid = 0;
        }
-       xmlParserEntityCheck(ctxt, 0, NULL, 0);
     } else {
        /*
         * Internal checking in case the entity quest barfed
@@ -7982,9 +7969,8 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt)
        } else {
             xmlChar start[4];
             xmlCharEncoding enc;
-
-           if (xmlParserEntityCheck(ctxt, 0, entity, 0))
-               return;
+            unsigned long parentConsumed;
+            xmlEntityPtr oldEnt;
 
            if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) &&
                ((ctxt->options & XML_PARSE_NOENT) == 0) &&
@@ -7995,12 +7981,33 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt)
                (ctxt->validate == 0))
                return;
 
+            if (entity->flags & XML_ENT_EXPANDING) {
+                xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
+                xmlHaltParser(ctxt);
+                return;
+            }
+
+            /* Must be computed from old input before pushing new input. */
+            parentConsumed = ctxt->input->parentConsumed;
+            oldEnt = ctxt->input->entity;
+            if ((oldEnt == NULL) ||
+                ((oldEnt->etype == XML_EXTERNAL_PARAMETER_ENTITY) &&
+                 ((oldEnt->flags & XML_ENT_PARSED) == 0))) {
+                xmlSaturatedAdd(&parentConsumed, ctxt->input->consumed);
+                xmlSaturatedAddSizeT(&parentConsumed,
+                                     ctxt->input->cur - ctxt->input->base);
+            }
+
            input = xmlNewEntityInputStream(ctxt, entity);
            if (xmlPushInput(ctxt, input) < 0) {
                 xmlFreeInputStream(input);
                return;
             }
 
+            entity->flags |= XML_ENT_EXPANDING;
+
+            input->parentConsumed = parentConsumed;
+
            if (entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) {
                 /*
                  * Get the 4 first bytes and decode the charset
@@ -8051,7 +8058,6 @@ xmlLoadEntityContent(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) {
     xmlParserInputPtr input;
     xmlBufferPtr buf;
     int l, c;
-    int count = 0;
 
     if ((ctxt == NULL) || (entity == NULL) ||
         ((entity->etype != XML_EXTERNAL_PARAMETER_ENTITY) &&
@@ -8097,28 +8103,16 @@ xmlLoadEntityContent(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) {
     while ((ctxt->input == input) && (ctxt->input->cur < ctxt->input->end) &&
            (IS_CHAR(c))) {
         xmlBufferAdd(buf, ctxt->input->cur, l);
-       if (count++ > XML_PARSER_CHUNK_SIZE) {
-           count = 0;
-           GROW;
-            if (ctxt->instate == XML_PARSER_EOF) {
-                xmlBufferFree(buf);
-                return(-1);
-            }
-       }
        NEXTL(l);
        c = CUR_CHAR(l);
-       if (c == 0) {
-           count = 0;
-           GROW;
-            if (ctxt->instate == XML_PARSER_EOF) {
-                xmlBufferFree(buf);
-                return(-1);
-            }
-           c = CUR_CHAR(l);
-       }
+    }
+    if (ctxt->instate == XML_PARSER_EOF) {
+       xmlBufferFree(buf);
+       return(-1);
     }
 
     if ((ctxt->input == input) && (ctxt->input->cur >= ctxt->input->end)) {
+        xmlSaturatedAdd(&ctxt->sizeentities, ctxt->input->consumed);
         xmlPopInput(ctxt);
     } else if (!IS_CHAR(c)) {
         xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR,
@@ -8128,6 +8122,7 @@ xmlLoadEntityContent(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) {
        return(-1);
     }
     entity->content = buf->content;
+    entity->length = buf->use;
     buf->content = NULL;
     xmlBufferFree(buf);
 
@@ -8195,11 +8190,6 @@ xmlParseStringPEReference(xmlParserCtxtPtr ctxt, const xmlChar **str) {
     ptr++;
 
     /*
-     * Increase the number of entity references parsed
-     */
-    ctxt->nbentities++;
-
-    /*
      * Request the entity from SAX
      */
     if ((ctxt->sax != NULL) &&
@@ -8236,7 +8226,6 @@ xmlParseStringPEReference(xmlParserCtxtPtr ctxt, const xmlChar **str) {
                          name, NULL);
            ctxt->valid = 0;
        }
-       xmlParserEntityCheck(ctxt, 0, NULL, 0);
     } else {
        /*
         * Internal checking in case the entity quest barfed
@@ -8258,6 +8247,8 @@ xmlParseStringPEReference(xmlParserCtxtPtr ctxt, const xmlChar **str) {
  * xmlParseDocTypeDecl:
  * @ctxt:  an XML parser context
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse a DOCTYPE declaration
  *
  * [28] doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S?
@@ -8354,14 +8345,9 @@ xmlParseInternalSubset(xmlParserCtxtPtr ctxt) {
         * PEReferences.
         * Subsequence (markupdecl | PEReference | S)*
         */
+       SKIP_BLANKS;
        while (((RAW != ']') || (ctxt->inputNr > baseInputNr)) &&
                (ctxt->instate != XML_PARSER_EOF)) {
-           int id = ctxt->input->id;
-           unsigned long cons = CUR_CONSUMED;
-
-           SKIP_BLANKS;
-           xmlParseMarkupDecl(ctxt);
-           xmlParsePEReference(ctxt);
 
             /*
              * Conditional sections are allowed from external entities included
@@ -8370,16 +8356,20 @@ xmlParseInternalSubset(xmlParserCtxtPtr ctxt) {
             if ((ctxt->inputNr > 1) && (ctxt->input->filename != NULL) &&
                 (RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {
                 xmlParseConditionalSections(ctxt);
-            }
-
-           if ((id == ctxt->input->id) && (cons == CUR_CONSUMED)) {
+            } else if ((RAW == '<') && ((NXT(1) == '!') || (NXT(1) == '?'))) {
+               xmlParseMarkupDecl(ctxt);
+            } else if (RAW == '%') {
+               xmlParsePEReference(ctxt);
+            } else {
                xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
-            "xmlParseInternalSubset: error detected in Markup declaration\n");
-                if (ctxt->inputNr > baseInputNr)
-                    xmlPopInput(ctxt);
-                else
-                   break;
-           }
+                        "xmlParseInternalSubset: error detected in"
+                        " Markup declaration\n");
+                xmlHaltParser(ctxt);
+                return;
+            }
+           SKIP_BLANKS;
+            SHRINK;
+            GROW;
        }
        if (RAW == ']') {
            NEXT;
@@ -8403,6 +8393,8 @@ xmlParseInternalSubset(xmlParserCtxtPtr ctxt) {
  * @ctxt:  an XML parser context
  * @value:  a xmlChar ** used to store the value of the attribute
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse an attribute
  *
  * [41] Attribute ::= Name Eq AttValue
@@ -8457,7 +8449,7 @@ xmlParseAttribute(xmlParserCtxtPtr ctxt, xmlChar **value) {
     } else {
        xmlFatalErrMsgStr(ctxt, XML_ERR_ATTRIBUTE_WITHOUT_VALUE,
               "Specification mandates value for attribute %s\n", name);
-       return(NULL);
+       return(name);
     }
 
     /*
@@ -8496,8 +8488,9 @@ xmlParseAttribute(xmlParserCtxtPtr ctxt, xmlChar **value) {
  * xmlParseStartTag:
  * @ctxt:  an XML parser context
  *
- * parse a start of tag either for rule element or
- * EmptyElement. In both case we don't parse the tag closing chars.
+ * DEPRECATED: Internal function, don't use.
+ *
+ * Parse a start tag. Always consumes '<'.
  *
  * [40] STag ::= '<' Name (S Attribute)* S? '>'
  *
@@ -8551,11 +8544,13 @@ xmlParseStartTag(xmlParserCtxtPtr ctxt) {
     while (((RAW != '>') &&
           ((RAW != '/') || (NXT(1) != '>')) &&
           (IS_BYTE_CHAR(RAW))) && (ctxt->instate != XML_PARSER_EOF)) {
-        int id = ctxt->input->id;
-       unsigned long cons = CUR_CONSUMED;
-
        attname = xmlParseAttribute(ctxt, &attvalue);
-        if ((attname != NULL) && (attvalue != NULL)) {
+        if (attname == NULL) {
+           xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR,
+                          "xmlParseStartTag: problem parsing attributes\n");
+           break;
+       }
+        if (attvalue != NULL) {
            /*
             * [ WFC: Unique Att Spec ]
             * No attribute name may appear more than once in the same
@@ -8617,12 +8612,6 @@ failed:
            xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
                           "attributes construct error\n");
        }
-        if ((cons == CUR_CONSUMED) && (id == ctxt->input->id) &&
-            (attname == NULL) && (attvalue == NULL)) {
-           xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR,
-                          "xmlParseStartTag: problem parsing attributes\n");
-           break;
-       }
        SHRINK;
         GROW;
     }
@@ -8653,7 +8642,7 @@ failed:
  * @line:  line of the start tag
  * @nsNr:  number of namespaces on the start tag
  *
- * parse an end of tag
+ * Parse an end tag. Always consumes '</'.
  *
  * [42] ETag ::= '</' Name S? '>'
  *
@@ -8715,6 +8704,8 @@ xmlParseEndTag1(xmlParserCtxtPtr ctxt, int line) {
  * xmlParseEndTag:
  * @ctxt:  an XML parser context
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse an end of tag
  *
  * [42] ETag ::= '</' Name S? '>'
@@ -8779,6 +8770,8 @@ xmlParseQName(xmlParserCtxtPtr ctxt, const xmlChar **prefix) {
     const xmlChar *l, *p;
 
     GROW;
+    if (ctxt->instate == XML_PARSER_EOF)
+        return(NULL);
 
     l = xmlParseNCName(ctxt);
     if (l == NULL) {
@@ -8954,6 +8947,9 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
     const xmlChar *in = NULL, *start, *end, *last;
     xmlChar *ret = NULL;
     int line, col;
+    int maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+                    XML_MAX_HUGE_LENGTH :
+                    XML_MAX_TEXT_LENGTH;
 
     GROW;
     in = (xmlChar *) CUR_PTR;
@@ -8993,8 +8989,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
            start = in;
            if (in >= end) {
                 GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end)
-                if (((in - start) > XML_MAX_TEXT_LENGTH) &&
-                    ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+                if ((in - start) > maxLength) {
                     xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
                                    "AttValue length too long\n");
                     return(NULL);
@@ -9007,8 +9002,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
            if ((*in++ == 0x20) && (*in == 0x20)) break;
            if (in >= end) {
                 GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end)
-                if (((in - start) > XML_MAX_TEXT_LENGTH) &&
-                    ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+                if ((in - start) > maxLength) {
                     xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
                                    "AttValue length too long\n");
                     return(NULL);
@@ -9041,16 +9035,14 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
                    last = last + delta;
                }
                end = ctxt->input->end;
-                if (((in - start) > XML_MAX_TEXT_LENGTH) &&
-                    ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+                if ((in - start) > maxLength) {
                     xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
                                    "AttValue length too long\n");
                     return(NULL);
                 }
            }
        }
-        if (((in - start) > XML_MAX_TEXT_LENGTH) &&
-            ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+        if ((in - start) > maxLength) {
             xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
                            "AttValue length too long\n");
             return(NULL);
@@ -9063,8 +9055,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
            col++;
            if (in >= end) {
                 GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end)
-                if (((in - start) > XML_MAX_TEXT_LENGTH) &&
-                    ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+                if ((in - start) > maxLength) {
                     xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
                                    "AttValue length too long\n");
                     return(NULL);
@@ -9072,8 +9063,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
            }
        }
        last = in;
-        if (((in - start) > XML_MAX_TEXT_LENGTH) &&
-            ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+        if ((in - start) > maxLength) {
             xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
                            "AttValue length too long\n");
             return(NULL);
@@ -9083,6 +9073,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
     in++;
     col++;
     if (len != NULL) {
+        if (alloc) *alloc = 0;
         *len = last - start;
         ret = (xmlChar *) start;
     } else {
@@ -9092,7 +9083,6 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
     CUR_PTR = in;
     ctxt->input->line = line;
     ctxt->input->col = col;
-    if (alloc) *alloc = 0;
     return ret;
 need_complex:
     if (alloc) *alloc = 1;
@@ -9153,6 +9143,8 @@ xmlParseAttribute2(xmlParserCtxtPtr ctxt,
         NEXT;
         SKIP_BLANKS;
         val = xmlParseAttValueInternal(ctxt, len, alloc, normalize);
+        if (val == NULL)
+            return (NULL);
        if (normalize) {
            /*
             * Sometimes a second normalisation pass for spaces is needed
@@ -9175,7 +9167,7 @@ xmlParseAttribute2(xmlParserCtxtPtr ctxt,
         xmlFatalErrMsgStr(ctxt, XML_ERR_ATTRIBUTE_WITHOUT_VALUE,
                           "Specification mandates value for attribute %s\n",
                           name);
-        return (NULL);
+        return (name);
     }
 
     if (*prefix == ctxt->str_xml) {
@@ -9220,8 +9212,8 @@ xmlParseAttribute2(xmlParserCtxtPtr ctxt,
  * xmlParseStartTag2:
  * @ctxt:  an XML parser context
  *
- * parse a start of tag either for rule element or
- * EmptyElement. In both case we don't parse the tag closing chars.
+ * Parse a start tag. Always consumes '<'.
+ *
  * This routine is called when running SAX2 parsing
  *
  * [40] STag ::= '<' Name (S Attribute)* S? '>'
@@ -9258,20 +9250,12 @@ xmlParseStartTag2(xmlParserCtxtPtr ctxt, const xmlChar **pref,
     int maxatts = ctxt->maxatts;
     int nratts, nbatts, nbdef, inputid;
     int i, j, nbNs, attval;
-    unsigned long cur;
+    size_t cur;
     int nsNr = ctxt->nsNr;
 
     if (RAW != '<') return(NULL);
     NEXT1;
 
-    /*
-     * NOTE: it is crucial with the SAX2 API to never call SHRINK beyond that
-     *       point since the attribute values may be stored as pointers to
-     *       the buffer and calling SHRINK would destroy them !
-     *       The Shrinking is only possible once the full set of attribute
-     *       callbacks have been done.
-     */
-    SHRINK;
     cur = ctxt->input->cur - ctxt->input->base;
     inputid = ctxt->input->id;
     nbatts = 0;
@@ -9301,13 +9285,16 @@ xmlParseStartTag2(xmlParserCtxtPtr ctxt, const xmlChar **pref,
     while (((RAW != '>') &&
           ((RAW != '/') || (NXT(1) != '>')) &&
           (IS_BYTE_CHAR(RAW))) && (ctxt->instate != XML_PARSER_EOF)) {
-       int id = ctxt->input->id;
-       unsigned long cons = CUR_CONSUMED;
        int len = -1, alloc = 0;
 
        attname = xmlParseAttribute2(ctxt, prefix, localname,
                                     &aprefix, &attvalue, &len, &alloc);
-        if ((attname == NULL) || (attvalue == NULL))
+        if (attname == NULL) {
+           xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
+                "xmlParseStartTag: problem parsing attributes\n");
+           break;
+       }
+        if (attvalue == NULL)
             goto next_attr;
        if (len < 0) len = xmlStrlen(attvalue);
 
@@ -9483,12 +9470,6 @@ next_attr:
                           "attributes construct error\n");
            break;
        }
-        if ((cons == CUR_CONSUMED) && (id == ctxt->input->id) &&
-            (attname == NULL) && (attvalue == NULL)) {
-           xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
-                "xmlParseStartTag: problem parsing attributes\n");
-           break;
-       }
         GROW;
     }
 
@@ -9506,10 +9487,10 @@ next_attr:
              * Arithmetic on dangling pointers is technically undefined
              * behavior, but well...
              */
-            ptrdiff_t offset = ctxt->input->base - atts[i+2];
+            const xmlChar *old = atts[i+2];
             atts[i+2]  = NULL;    /* Reset repurposed namespace URI */
-            atts[i+3] += offset;  /* value */
-            atts[i+4] += offset;  /* valuend */
+            atts[i+3] = ctxt->input->base + (atts[i+3] - old);  /* value */
+            atts[i+4] = ctxt->input->base + (atts[i+4] - old);  /* valuend */
         }
     }
 
@@ -9553,7 +9534,7 @@ next_attr:
                    if (j <= nbNs) continue;
 
                    nsname = xmlGetNamespace(ctxt, attname);
-                   if (nsname != defaults->values[2]) {
+                   if (nsname != defaults->values[5 * i + 2]) {
                        if (nsPush(ctxt, attname,
                                   defaults->values[5 * i + 2]) > 0)
                            nbNs++;
@@ -9677,7 +9658,7 @@ done:
  * @line:  line of the start tag
  * @nsNr:  number of namespaces on the start tag
  *
- * parse an end of tag
+ * Parse an end tag. Always consumes '</'.
  *
  * [42] ETag ::= '</' Name S? '>'
  *
@@ -9744,7 +9725,9 @@ xmlParseEndTag2(xmlParserCtxtPtr ctxt, const xmlStartTag *tag) {
  * xmlParseCDSect:
  * @ctxt:  an XML parser context
  *
- * Parse escaped pure raw content.
+ * DEPRECATED: Internal function, don't use.
+ *
+ * Parse escaped pure raw content. Always consumes '<!['.
  *
  * [18] CDSect ::= CDStart CData CDEnd
  *
@@ -9762,81 +9745,72 @@ xmlParseCDSect(xmlParserCtxtPtr ctxt) {
     int r, rl;
     int        s, sl;
     int cur, l;
-    int count = 0;
+    int maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+                    XML_MAX_HUGE_LENGTH :
+                    XML_MAX_TEXT_LENGTH;
 
-    /* Check 2.6.0 was NXT(0) not RAW */
-    if (CMP9(CUR_PTR, '<', '!', '[', 'C', 'D', 'A', 'T', 'A', '[')) {
-       SKIP(9);
-    } else
+    if ((CUR != '<') || (NXT(1) != '!') || (NXT(2) != '['))
         return;
+    SKIP(3);
+
+    if (!CMP6(CUR_PTR, 'C', 'D', 'A', 'T', 'A', '['))
+        return;
+    SKIP(6);
 
     ctxt->instate = XML_PARSER_CDATA_SECTION;
     r = CUR_CHAR(rl);
     if (!IS_CHAR(r)) {
        xmlFatalErr(ctxt, XML_ERR_CDATA_NOT_FINISHED, NULL);
-       ctxt->instate = XML_PARSER_CONTENT;
-        return;
+        goto out;
     }
     NEXTL(rl);
     s = CUR_CHAR(sl);
     if (!IS_CHAR(s)) {
        xmlFatalErr(ctxt, XML_ERR_CDATA_NOT_FINISHED, NULL);
-       ctxt->instate = XML_PARSER_CONTENT;
-        return;
+        goto out;
     }
     NEXTL(sl);
     cur = CUR_CHAR(l);
-    buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
+    buf = (xmlChar *) xmlMallocAtomic(size);
     if (buf == NULL) {
        xmlErrMemory(ctxt, NULL);
-       return;
+        goto out;
     }
     while (IS_CHAR(cur) &&
            ((r != ']') || (s != ']') || (cur != '>'))) {
        if (len + 5 >= size) {
            xmlChar *tmp;
 
-            if ((size > XML_MAX_TEXT_LENGTH) &&
-                ((ctxt->options & XML_PARSE_HUGE) == 0)) {
-                xmlFatalErrMsgStr(ctxt, XML_ERR_CDATA_NOT_FINISHED,
-                             "CData section too big found", NULL);
-                xmlFree (buf);
-                return;
-            }
-           tmp = (xmlChar *) xmlRealloc(buf, size * 2 * sizeof(xmlChar));
+           tmp = (xmlChar *) xmlRealloc(buf, size * 2);
            if (tmp == NULL) {
-               xmlFree(buf);
                xmlErrMemory(ctxt, NULL);
-               return;
+                goto out;
            }
            buf = tmp;
            size *= 2;
        }
        COPY_BUF(rl,buf,len,r);
+        if (len > maxLength) {
+            xmlFatalErrMsg(ctxt, XML_ERR_CDATA_NOT_FINISHED,
+                           "CData section too big found\n");
+            goto out;
+        }
        r = s;
        rl = sl;
        s = cur;
        sl = l;
-       count++;
-       if (count > 50) {
-           SHRINK;
-           GROW;
-            if (ctxt->instate == XML_PARSER_EOF) {
-               xmlFree(buf);
-               return;
-            }
-           count = 0;
-       }
        NEXTL(l);
        cur = CUR_CHAR(l);
     }
     buf[len] = 0;
-    ctxt->instate = XML_PARSER_CONTENT;
+    if (ctxt->instate == XML_PARSER_EOF) {
+        xmlFree(buf);
+        return;
+    }
     if (cur != '>') {
        xmlFatalErrMsgStr(ctxt, XML_ERR_CDATA_NOT_FINISHED,
                             "CData section not finished\n%.50s\n", buf);
-       xmlFree(buf);
-        return;
+        goto out;
     }
     NEXTL(l);
 
@@ -9849,6 +9823,10 @@ xmlParseCDSect(xmlParserCtxtPtr ctxt) {
        else if (ctxt->sax->characters != NULL)
            ctxt->sax->characters(ctxt->userData, buf, len);
     }
+
+out:
+    if (ctxt->instate != XML_PARSER_EOF)
+        ctxt->instate = XML_PARSER_CONTENT;
     xmlFree(buf);
 }
 
@@ -9867,8 +9845,6 @@ xmlParseContentInternal(xmlParserCtxtPtr ctxt) {
     GROW;
     while ((RAW != 0) &&
           (ctxt->instate != XML_PARSER_EOF)) {
-        int id = ctxt->input->id;
-       unsigned long cons = CUR_CONSUMED;
        const xmlChar *cur = ctxt->input->cur;
 
        /*
@@ -9921,18 +9897,11 @@ xmlParseContentInternal(xmlParserCtxtPtr ctxt) {
         * Last case, text. Note that References are handled directly.
         */
        else {
-           xmlParseCharData(ctxt, 0);
+           xmlParseCharDataInternal(ctxt, 0);
        }
 
-       GROW;
        SHRINK;
-
-       if ((cons == CUR_CONSUMED) && (id == ctxt->input->id)) {
-           xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
-                       "detected an error in element content\n");
-           xmlHaltParser(ctxt);
-            break;
-       }
+       GROW;
     }
 }
 
@@ -9964,6 +9933,8 @@ xmlParseContent(xmlParserCtxtPtr ctxt) {
  * xmlParseElement:
  * @ctxt:  an XML parser context
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse an XML element
  *
  * [39] element ::= EmptyElemTag | STag content ETag
@@ -10001,6 +9972,8 @@ xmlParseElement(xmlParserCtxtPtr ctxt) {
  *
  * Parse the start of an XML element. Returns -1 in case of error, 0 if an
  * opening tag was parsed, 1 if an empty element was parsed.
+ *
+ * Always consumes '<'.
  */
 static int
 xmlParseElementStart(xmlParserCtxtPtr ctxt) {
@@ -10009,7 +9982,7 @@ xmlParseElementStart(xmlParserCtxtPtr ctxt) {
     const xmlChar *URI = NULL;
     xmlParserNodeInfo node_info;
     int line, tlen = 0;
-    xmlNodePtr ret;
+    xmlNodePtr cur;
     int nsNr = ctxt->nsNr;
 
     if (((unsigned int) ctxt->nameNr > xmlParserMaxDepth) &&
@@ -10051,7 +10024,7 @@ xmlParseElementStart(xmlParserCtxtPtr ctxt) {
         return(-1);
     }
     nameNsPush(ctxt, name, prefix, URI, line, ctxt->nsNr - nsNr);
-    ret = ctxt->node;
+    cur = ctxt->node;
 
 #ifdef LIBXML_VALID_ENABLED
     /*
@@ -10084,17 +10057,23 @@ xmlParseElementStart(xmlParserCtxtPtr ctxt) {
        spacePop(ctxt);
        if (nsNr != ctxt->nsNr)
            nsPop(ctxt, ctxt->nsNr - nsNr);
-       if ( ret != NULL && ctxt->record_info ) {
-          node_info.end_pos = ctxt->input->consumed +
-                             (CUR_PTR - ctxt->input->base);
-          node_info.end_line = ctxt->input->line;
-          node_info.node = ret;
-          xmlParserAddNodeInfo(ctxt, &node_info);
+       if (cur != NULL && ctxt->record_info) {
+            node_info.node = cur;
+            node_info.end_pos = ctxt->input->consumed +
+                                (CUR_PTR - ctxt->input->base);
+            node_info.end_line = ctxt->input->line;
+            xmlParserAddNodeInfo(ctxt, &node_info);
        }
        return(1);
     }
     if (RAW == '>') {
         NEXT1;
+        if (cur != NULL && ctxt->record_info) {
+            node_info.node = cur;
+            node_info.end_pos = 0;
+            node_info.end_line = 0;
+            xmlParserAddNodeInfo(ctxt, &node_info);
+        }
     } else {
         xmlFatalErrMsgStrIntStr(ctxt, XML_ERR_GT_REQUIRED,
                     "Couldn't find end of Start Tag %s line %d\n",
@@ -10108,17 +10087,6 @@ xmlParseElementStart(xmlParserCtxtPtr ctxt) {
        spacePop(ctxt);
        if (nsNr != ctxt->nsNr)
            nsPop(ctxt, ctxt->nsNr - nsNr);
-
-       /*
-        * Capture end position and add node
-        */
-       if ( ret != NULL && ctxt->record_info ) {
-          node_info.end_pos = ctxt->input->consumed +
-                             (CUR_PTR - ctxt->input->base);
-          node_info.end_line = ctxt->input->line;
-          node_info.node = ret;
-          xmlParserAddNodeInfo(ctxt, &node_info);
-       }
        return(-1);
     }
 
@@ -10129,15 +10097,17 @@ xmlParseElementStart(xmlParserCtxtPtr ctxt) {
  * xmlParseElementEnd:
  * @ctxt:  an XML parser context
  *
- * Parse the end of an XML element.
+ * Parse the end of an XML element. Always consumes '</'.
  */
 static void
 xmlParseElementEnd(xmlParserCtxtPtr ctxt) {
-    xmlParserNodeInfo node_info;
-    xmlNodePtr ret = ctxt->node;
+    xmlNodePtr cur = ctxt->node;
 
-    if (ctxt->nameNr <= 0)
+    if (ctxt->nameNr <= 0) {
+        if ((RAW == '<') && (NXT(1) == '/'))
+            SKIP(2);
         return;
+    }
 
     /*
      * parse the end of tag: '</' should be here.
@@ -10152,14 +10122,17 @@ xmlParseElementEnd(xmlParserCtxtPtr ctxt) {
 #endif /* LIBXML_SAX1_ENABLED */
 
     /*
-     * Capture end position and add node
+     * Capture end position
      */
-    if ( ret != NULL && ctxt->record_info ) {
-       node_info.end_pos = ctxt->input->consumed +
-                          (CUR_PTR - ctxt->input->base);
-       node_info.end_line = ctxt->input->line;
-       node_info.node = ret;
-       xmlParserAddNodeInfo(ctxt, &node_info);
+    if (cur != NULL && ctxt->record_info) {
+        xmlParserNodeInfoPtr node_info;
+
+        node_info = (xmlParserNodeInfoPtr) xmlParserFindNodeInfo(ctxt, cur);
+        if (node_info != NULL) {
+            node_info->end_pos = ctxt->input->consumed +
+                                 (CUR_PTR - ctxt->input->base);
+            node_info->end_line = ctxt->input->line;
+        }
     }
 }
 
@@ -10167,6 +10140,8 @@ xmlParseElementEnd(xmlParserCtxtPtr ctxt) {
  * xmlParseVersionNum:
  * @ctxt:  an XML parser context
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse the XML version value.
  *
  * [26] VersionNum ::= '1.' [0-9]+
@@ -10182,7 +10157,7 @@ xmlParseVersionNum(xmlParserCtxtPtr ctxt) {
     int size = 10;
     xmlChar cur;
 
-    buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
+    buf = (xmlChar *) xmlMallocAtomic(size);
     if (buf == NULL) {
        xmlErrMemory(ctxt, NULL);
        return(NULL);
@@ -10207,7 +10182,7 @@ xmlParseVersionNum(xmlParserCtxtPtr ctxt) {
            xmlChar *tmp;
 
            size *= 2;
-           tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
+           tmp = (xmlChar *) xmlRealloc(buf, size);
            if (tmp == NULL) {
                xmlFree(buf);
                xmlErrMemory(ctxt, NULL);
@@ -10227,6 +10202,8 @@ xmlParseVersionNum(xmlParserCtxtPtr ctxt) {
  * xmlParseVersionInfo:
  * @ctxt:  an XML parser context
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse the XML version.
  *
  * [24] VersionInfo ::= S 'version' Eq (' VersionNum ' | " VersionNum ")
@@ -10274,6 +10251,8 @@ xmlParseVersionInfo(xmlParserCtxtPtr ctxt) {
  * xmlParseEncName:
  * @ctxt:  an XML parser context
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse the XML encoding name
  *
  * [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
@@ -10285,12 +10264,15 @@ xmlParseEncName(xmlParserCtxtPtr ctxt) {
     xmlChar *buf = NULL;
     int len = 0;
     int size = 10;
+    int maxLength = (ctxt->options & XML_PARSE_HUGE) ?
+                    XML_MAX_TEXT_LENGTH :
+                    XML_MAX_NAME_LENGTH;
     xmlChar cur;
 
     cur = CUR;
     if (((cur >= 'a') && (cur <= 'z')) ||
         ((cur >= 'A') && (cur <= 'Z'))) {
-       buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
+       buf = (xmlChar *) xmlMallocAtomic(size);
        if (buf == NULL) {
            xmlErrMemory(ctxt, NULL);
            return(NULL);
@@ -10308,7 +10290,7 @@ xmlParseEncName(xmlParserCtxtPtr ctxt) {
                xmlChar *tmp;
 
                size *= 2;
-               tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
+               tmp = (xmlChar *) xmlRealloc(buf, size);
                if (tmp == NULL) {
                    xmlErrMemory(ctxt, NULL);
                    xmlFree(buf);
@@ -10317,13 +10299,13 @@ xmlParseEncName(xmlParserCtxtPtr ctxt) {
                buf = tmp;
            }
            buf[len++] = cur;
-           NEXT;
+            if (len > maxLength) {
+                xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "EncName");
+                xmlFree(buf);
+                return(NULL);
+            }
+           NEXT;
            cur = CUR;
-           if (cur == 0) {
-               SHRINK;
-               GROW;
-               cur = CUR;
-           }
         }
        buf[len] = 0;
     } else {
@@ -10336,6 +10318,8 @@ xmlParseEncName(xmlParserCtxtPtr ctxt) {
  * xmlParseEncodingDecl:
  * @ctxt:  an XML parser context
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse the XML encoding declaration
  *
  * [80] EncodingDecl ::= S 'encoding' Eq ('"' EncName '"' |  "'" EncName "'")
@@ -10418,6 +10402,7 @@ xmlParseEncodingDecl(xmlParserCtxtPtr ctxt) {
         else if ((encoding != NULL) &&
            ((!xmlStrcasecmp(encoding, BAD_CAST "UTF-8")) ||
             (!xmlStrcasecmp(encoding, BAD_CAST "UTF8")))) {
+            /* TODO: Check for encoding mismatch. */
            if (ctxt->encoding != NULL)
                xmlFree((xmlChar *) ctxt->encoding);
            ctxt->encoding = encoding;
@@ -10450,6 +10435,8 @@ xmlParseEncodingDecl(xmlParserCtxtPtr ctxt) {
  * xmlParseSDDecl:
  * @ctxt:  an XML parser context
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse the XML standalone declaration
  *
  * [32] SDDecl ::= S 'standalone' Eq
@@ -10534,6 +10521,8 @@ xmlParseSDDecl(xmlParserCtxtPtr ctxt) {
  * xmlParseXMLDecl:
  * @ctxt:  an XML parser context
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse an XML declaration header
  *
  * [23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
@@ -10639,9 +10628,14 @@ xmlParseXMLDecl(xmlParserCtxtPtr ctxt) {
        xmlFatalErr(ctxt, XML_ERR_XMLDECL_NOT_FINISHED, NULL);
        NEXT;
     } else {
+        int c;
+
        xmlFatalErr(ctxt, XML_ERR_XMLDECL_NOT_FINISHED, NULL);
-       MOVETO_ENDTAG(CUR_PTR);
-       NEXT;
+        while ((c = CUR) != 0) {
+            NEXT;
+            if (c == '>')
+                break;
+        }
     }
 }
 
@@ -10649,6 +10643,8 @@ xmlParseXMLDecl(xmlParserCtxtPtr ctxt) {
  * xmlParseMisc:
  * @ctxt:  an XML parser context
  *
+ * DEPRECATED: Internal function, don't use.
+ *
  * parse an XML Misc* optional field.
  *
  * [27] Misc ::= Comment | PI |  S
@@ -10732,15 +10728,7 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) {
        return(-1);
     }
 
-    /*
-     * Check for the XMLDecl in the Prolog.
-     * do not GROW here to avoid the detected encoder to decode more
-     * than just the first line, unless the amount of data is really
-     * too small to hold "<?xml version="1.0" encoding="foo"
-     */
-    if ((ctxt->input->end - ctxt->input->cur) < 35) {
-       GROW;
-    }
+    GROW;
     if ((CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) && (IS_BLANK_CH(NXT(5)))) {
 
        /*
@@ -10976,142 +10964,263 @@ xmlParseExtParsedEnt(xmlParserCtxtPtr ctxt) {
  ************************************************************************/
 
 /**
- * xmlParseLookupSequence:
+ * xmlParseLookupChar:
  * @ctxt:  an XML parser context
- * @first:  the first char to lookup
- * @next:  the next char to lookup or zero
- * @third:  the next char to lookup or zero
+ * @c:  character
  *
- * Try to find if a sequence (first, next, third) or  just (first next) or
- * (first) is available in the input stream.
- * This function has a side effect of (possibly) incrementing ctxt->checkIndex
- * to avoid rescanning sequences of bytes, it DOES change the state of the
- * parser, do not use liberally.
- *
- * Returns the index to the current parsing point if the full sequence
- *      is available, -1 otherwise.
+ * Check whether the input buffer contains a character.
  */
 static int
-xmlParseLookupSequence(xmlParserCtxtPtr ctxt, xmlChar first,
-                       xmlChar next, xmlChar third) {
-    int base, len;
-    xmlParserInputPtr in;
-    const xmlChar *buf;
-
-    in = ctxt->input;
-    if (in == NULL) return(-1);
-    base = in->cur - in->base;
-    if (base < 0) return(-1);
-    if (ctxt->checkIndex > base)
-        base = ctxt->checkIndex;
-    if (in->buf == NULL) {
-       buf = in->base;
-       len = in->length;
+xmlParseLookupChar(xmlParserCtxtPtr ctxt, int c) {
+    const xmlChar *cur;
+
+    if (ctxt->checkIndex == 0) {
+        cur = ctxt->input->cur + 1;
     } else {
-       buf = xmlBufContent(in->buf->buffer);
-       len = xmlBufUse(in->buf->buffer);
-    }
-    /* take into account the sequence length */
-    if (third) len -= 2;
-    else if (next) len --;
-    for (;base < len;base++) {
-        if (buf[base] == first) {
-           if (third != 0) {
-               if ((buf[base + 1] != next) ||
-                   (buf[base + 2] != third)) continue;
-           } else if (next != 0) {
-               if (buf[base + 1] != next) continue;
-           }
-           ctxt->checkIndex = 0;
-#ifdef DEBUG_PUSH
-           if (next == 0)
-               xmlGenericError(xmlGenericErrorContext,
-                       "PP: lookup '%c' found at %d\n",
-                       first, base);
-           else if (third == 0)
-               xmlGenericError(xmlGenericErrorContext,
-                       "PP: lookup '%c%c' found at %d\n",
-                       first, next, base);
-           else
-               xmlGenericError(xmlGenericErrorContext,
-                       "PP: lookup '%c%c%c' found at %d\n",
-                       first, next, third, base);
-#endif
-           return(base - (in->cur - in->base));
-       }
+        cur = ctxt->input->cur + ctxt->checkIndex;
+    }
+
+    if (memchr(cur, c, ctxt->input->end - cur) == NULL) {
+        size_t index = ctxt->input->end - ctxt->input->cur;
+
+        if (index > LONG_MAX) {
+            ctxt->checkIndex = 0;
+            return(1);
+        }
+        ctxt->checkIndex = index;
+        return(0);
+    } else {
+        ctxt->checkIndex = 0;
+        return(1);
     }
-    ctxt->checkIndex = base;
-#ifdef DEBUG_PUSH
-    if (next == 0)
-       xmlGenericError(xmlGenericErrorContext,
-               "PP: lookup '%c' failed\n", first);
-    else if (third == 0)
-       xmlGenericError(xmlGenericErrorContext,
-               "PP: lookup '%c%c' failed\n", first, next);
-    else
-       xmlGenericError(xmlGenericErrorContext,
-               "PP: lookup '%c%c%c' failed\n", first, next, third);
-#endif
-    return(-1);
 }
 
 /**
- * xmlParseGetLasts:
+ * xmlParseLookupString:
  * @ctxt:  an XML parser context
- * @lastlt:  pointer to store the last '<' from the input
- * @lastgt:  pointer to store the last '>' from the input
+ * @startDelta: delta to apply at the start
+ * @str:  string
+ * @strLen:  length of string
  *
- * Lookup the last < and > in the current chunk
+ * Check whether the input buffer contains a string.
  */
-static void
-xmlParseGetLasts(xmlParserCtxtPtr ctxt, const xmlChar **lastlt,
-                 const xmlChar **lastgt) {
-    const xmlChar *tmp;
+static const xmlChar *
+xmlParseLookupString(xmlParserCtxtPtr ctxt, size_t startDelta,
+                     const char *str, size_t strLen) {
+    const xmlChar *cur, *term;
 
-    if ((ctxt == NULL) || (lastlt == NULL) || (lastgt == NULL)) {
-       xmlGenericError(xmlGenericErrorContext,
-                   "Internal error: xmlParseGetLasts\n");
-       return;
+    if (ctxt->checkIndex == 0) {
+        cur = ctxt->input->cur + startDelta;
+    } else {
+        cur = ctxt->input->cur + ctxt->checkIndex;
+    }
+
+    term = BAD_CAST strstr((const char *) cur, str);
+    if (term == NULL) {
+        const xmlChar *end = ctxt->input->end;
+        size_t index;
+
+        /* Rescan (strLen - 1) characters. */
+        if ((size_t) (end - cur) < strLen)
+            end = cur;
+        else
+            end -= strLen - 1;
+        index = end - ctxt->input->cur;
+        if (index > LONG_MAX) {
+            ctxt->checkIndex = 0;
+            return(ctxt->input->end - strLen);
+        }
+        ctxt->checkIndex = index;
+    } else {
+        ctxt->checkIndex = 0;
     }
-    if ((ctxt->progressive != 0) && (ctxt->inputNr == 1)) {
-        tmp = ctxt->input->end;
-       tmp--;
-       while ((tmp >= ctxt->input->base) && (*tmp != '<')) tmp--;
-       if (tmp < ctxt->input->base) {
-           *lastlt = NULL;
-           *lastgt = NULL;
-       } else {
-           *lastlt = tmp;
-           tmp++;
-           while ((tmp < ctxt->input->end) && (*tmp != '>')) {
-               if (*tmp == '\'') {
-                   tmp++;
-                   while ((tmp < ctxt->input->end) && (*tmp != '\'')) tmp++;
-                   if (tmp < ctxt->input->end) tmp++;
-               } else if (*tmp == '"') {
-                   tmp++;
-                   while ((tmp < ctxt->input->end) && (*tmp != '"')) tmp++;
-                   if (tmp < ctxt->input->end) tmp++;
-               } else
-                   tmp++;
-           }
-           if (tmp < ctxt->input->end)
-               *lastgt = tmp;
-           else {
-               tmp = *lastlt;
-               tmp--;
-               while ((tmp >= ctxt->input->base) && (*tmp != '>')) tmp--;
-               if (tmp >= ctxt->input->base)
-                   *lastgt = tmp;
-               else
-                   *lastgt = NULL;
-           }
-       }
+
+    return(term);
+}
+
+/**
+ * xmlParseLookupCharData:
+ * @ctxt:  an XML parser context
+ *
+ * Check whether the input buffer contains terminated char data.
+ */
+static int
+xmlParseLookupCharData(xmlParserCtxtPtr ctxt) {
+    const xmlChar *cur = ctxt->input->cur + ctxt->checkIndex;
+    const xmlChar *end = ctxt->input->end;
+    size_t index;
+
+    while (cur < end) {
+        if ((*cur == '<') || (*cur == '&')) {
+            ctxt->checkIndex = 0;
+            return(1);
+        }
+        cur++;
+    }
+
+    index = cur - ctxt->input->cur;
+    if (index > LONG_MAX) {
+        ctxt->checkIndex = 0;
+        return(1);
+    }
+    ctxt->checkIndex = index;
+    return(0);
+}
+
+/**
+ * xmlParseLookupGt:
+ * @ctxt:  an XML parser context
+ *
+ * Check whether there's enough data in the input buffer to finish parsing
+ * a start tag. This has to take quotes into account.
+ */
+static int
+xmlParseLookupGt(xmlParserCtxtPtr ctxt) {
+    const xmlChar *cur;
+    const xmlChar *end = ctxt->input->end;
+    int state = ctxt->endCheckState;
+    size_t index;
+
+    if (ctxt->checkIndex == 0)
+        cur = ctxt->input->cur + 1;
+    else
+        cur = ctxt->input->cur + ctxt->checkIndex;
+
+    while (cur < end) {
+        if (state) {
+            if (*cur == state)
+                state = 0;
+        } else if (*cur == '\'' || *cur == '"') {
+            state = *cur;
+        } else if (*cur == '>') {
+            ctxt->checkIndex = 0;
+            ctxt->endCheckState = 0;
+            return(1);
+        }
+        cur++;
+    }
+
+    index = cur - ctxt->input->cur;
+    if (index > LONG_MAX) {
+        ctxt->checkIndex = 0;
+        ctxt->endCheckState = 0;
+        return(1);
+    }
+    ctxt->checkIndex = index;
+    ctxt->endCheckState = state;
+    return(0);
+}
+
+/**
+ * xmlParseLookupInternalSubset:
+ * @ctxt:  an XML parser context
+ *
+ * Check whether there's enough data in the input buffer to finish parsing
+ * the internal subset.
+ */
+static int
+xmlParseLookupInternalSubset(xmlParserCtxtPtr ctxt) {
+    /*
+     * Sorry, but progressive parsing of the internal subset is not
+     * supported. We first check that the full content of the internal
+     * subset is available and parsing is launched only at that point.
+     * Internal subset ends with "']' S? '>'" in an unescaped section and
+     * not in a ']]>' sequence which are conditional sections.
+     */
+    const xmlChar *cur, *start;
+    const xmlChar *end = ctxt->input->end;
+    int state = ctxt->endCheckState;
+    size_t index;
+
+    if (ctxt->checkIndex == 0) {
+        cur = ctxt->input->cur + 1;
     } else {
-        *lastlt = NULL;
-       *lastgt = NULL;
+        cur = ctxt->input->cur + ctxt->checkIndex;
+    }
+    start = cur;
+
+    while (cur < end) {
+        if (state == '-') {
+            if ((*cur == '-') &&
+                (cur[1] == '-') &&
+                (cur[2] == '>')) {
+                state = 0;
+                cur += 3;
+                start = cur;
+                continue;
+            }
+        }
+        else if (state == ']') {
+            if (*cur == '>') {
+                ctxt->checkIndex = 0;
+                ctxt->endCheckState = 0;
+                return(1);
+            }
+            if (IS_BLANK_CH(*cur)) {
+                state = ' ';
+            } else if (*cur != ']') {
+                state = 0;
+                start = cur;
+                continue;
+            }
+        }
+        else if (state == ' ') {
+            if (*cur == '>') {
+                ctxt->checkIndex = 0;
+                ctxt->endCheckState = 0;
+                return(1);
+            }
+            if (!IS_BLANK_CH(*cur)) {
+                state = 0;
+                start = cur;
+                continue;
+            }
+        }
+        else if (state != 0) {
+            if (*cur == state) {
+                state = 0;
+                start = cur + 1;
+            }
+        }
+        else if (*cur == '<') {
+            if ((cur[1] == '!') &&
+                (cur[2] == '-') &&
+                (cur[3] == '-')) {
+                state = '-';
+                cur += 4;
+                /* Don't treat <!--> as comment */
+                start = cur;
+                continue;
+            }
+        }
+        else if ((*cur == '"') || (*cur == '\'') || (*cur == ']')) {
+            state = *cur;
+        }
+
+        cur++;
+    }
+
+    /*
+     * Rescan the three last characters to detect "<!--" and "-->"
+     * split across chunks.
+     */
+    if ((state == 0) || (state == '-')) {
+        if (cur - start < 3)
+            cur = start;
+        else
+            cur -= 3;
+    }
+    index = cur - ctxt->input->cur;
+    if (index > LONG_MAX) {
+        ctxt->checkIndex = 0;
+        ctxt->endCheckState = 0;
+        return(1);
     }
+    ctxt->checkIndex = index;
+    ctxt->endCheckState = state;
+    return(0);
 }
+
 /**
  * xmlCheckCdataPush:
  * @cur: pointer to the block of characters
@@ -11192,9 +11301,9 @@ xmlCheckCdataPush(const xmlChar *utf, int len, int complete) {
 static int
 xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
     int ret = 0;
-    int avail, tlen;
+    int tlen;
+    size_t avail;
     xmlChar cur, next;
-    const xmlChar *lastlt, *lastgt;
 
     if (ctxt->input == NULL)
         return(0);
@@ -11254,29 +11363,21 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
 
     if ((ctxt->input != NULL) &&
         (ctxt->input->cur - ctxt->input->base > 4096)) {
-       xmlSHRINK(ctxt);
-       ctxt->checkIndex = 0;
+        xmlParserShrink(ctxt);
     }
-    xmlParseGetLasts(ctxt, &lastlt, &lastgt);
 
     while (ctxt->instate != XML_PARSER_EOF) {
        if ((ctxt->errNo != XML_ERR_OK) && (ctxt->disableSAX == 1))
            return(0);
 
        if (ctxt->input == NULL) break;
-       if (ctxt->input->buf == NULL)
-           avail = ctxt->input->length -
-                   (ctxt->input->cur - ctxt->input->base);
-       else {
+       if (ctxt->input->buf != NULL) {
            /*
             * If we are operating on converted input, try to flush
             * remaining chars to avoid them stalling in the non-converted
-            * buffer. But do not do this in document start where
-            * encoding="..." may not have been read and we work on a
-            * guessed encoding.
+            * buffer.
             */
-           if ((ctxt->instate != XML_PARSER_START) &&
-               (ctxt->input->buf->raw != NULL) &&
+           if ((ctxt->input->buf->raw != NULL) &&
                (xmlBufIsEmpty(ctxt->input->buf->raw) == 0)) {
                 size_t base = xmlBufGetInputBase(ctxt->input->buf->buffer,
                                                  ctxt->input);
@@ -11286,9 +11387,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
                 xmlBufSetInputBaseCur(ctxt->input->buf->buffer, ctxt->input,
                                       base, current);
            }
-           avail = xmlBufUse(ctxt->input->buf->buffer) -
-                   (ctxt->input->cur - ctxt->input->base);
        }
+        avail = ctxt->input->end - ctxt->input->cur;
         if (avail < 1)
            goto done;
         switch (ctxt->instate) {
@@ -11320,6 +11420,13 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
                    start[2] = NXT(2);
                    start[3] = NXT(3);
                    enc = xmlDetectCharEncoding(start, 4);
+                    /*
+                     * We need more bytes to detect EBCDIC code pages.
+                     * See xmlDetectEBCDIC.
+                     */
+                    if ((enc == XML_CHAR_ENCODING_EBCDIC) &&
+                        (!terminate) && (avail < 200))
+                        goto done;
                    xmlSwitchEncoding(ctxt, enc);
                    break;
                }
@@ -11344,10 +11451,10 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
                }
                if ((cur == '<') && (next == '?')) {
                    /* PI or XML decl */
-                   if (avail < 5) return(ret);
+                   if (avail < 5) goto done;
                    if ((!terminate) &&
-                       (xmlParseLookupSequence(ctxt, '?', '>', 0) < 0))
-                       return(ret);
+                        (!xmlParseLookupString(ctxt, 2, "?>", 2)))
+                       goto done;
                    if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
                        ctxt->sax->setDocumentLocator(ctxt->userData,
                                                      &xmlDefaultSAXLocator);
@@ -11428,15 +11535,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
                        ctxt->sax->endDocument(ctxt->userData);
                    goto done;
                }
-               if (!terminate) {
-                   if (ctxt->progressive) {
-                       /* > can be found unescaped in attribute values */
-                       if ((lastgt == NULL) || (ctxt->input->cur >= lastgt))
-                           goto done;
-                   } else if (xmlParseLookupSequence(ctxt, '>', 0, 0) < 0) {
-                       goto done;
-                   }
-               }
+               if ((!terminate) && (!xmlParseLookupGt(ctxt)))
+                    goto done;
                if (ctxt->spaceNr == 0)
                    spacePush(ctxt, -1);
                else if (*ctxt->space == -2)
@@ -11501,7 +11601,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
                    } else {
                        ctxt->instate = XML_PARSER_CONTENT;
                    }
-                    ctxt->progressive = 1;
                    break;
                }
                if (RAW == '>') {
@@ -11516,51 +11615,34 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
                 nameNsPush(ctxt, name, prefix, URI, line, ctxt->nsNr - nsNr);
 
                ctxt->instate = XML_PARSER_CONTENT;
-                ctxt->progressive = 1;
                 break;
            }
             case XML_PARSER_CONTENT: {
-               int id;
-               unsigned long cons;
                if ((avail < 2) && (ctxt->inputNr == 1))
                    goto done;
                cur = ctxt->input->cur[0];
                next = ctxt->input->cur[1];
 
-               id = ctxt->input->id;
-               cons = CUR_CONSUMED;
                if ((cur == '<') && (next == '/')) {
                    ctxt->instate = XML_PARSER_END_TAG;
                    break;
                } else if ((cur == '<') && (next == '?')) {
                    if ((!terminate) &&
-                       (xmlParseLookupSequence(ctxt, '?', '>', 0) < 0)) {
-                        ctxt->progressive = XML_PARSER_PI;
+                       (!xmlParseLookupString(ctxt, 2, "?>", 2)))
                        goto done;
-                    }
                    xmlParsePI(ctxt);
                    ctxt->instate = XML_PARSER_CONTENT;
-                    ctxt->progressive = 1;
                } else if ((cur == '<') && (next != '!')) {
                    ctxt->instate = XML_PARSER_START_TAG;
                    break;
                } else if ((cur == '<') && (next == '!') &&
                           (ctxt->input->cur[2] == '-') &&
                           (ctxt->input->cur[3] == '-')) {
-                   int term;
-
-                   if (avail < 4)
-                       goto done;
-                   ctxt->input->cur += 4;
-                   term = xmlParseLookupSequence(ctxt, '-', '-', '>');
-                   ctxt->input->cur -= 4;
-                   if ((!terminate) && (term < 0)) {
-                        ctxt->progressive = XML_PARSER_COMMENT;
+                   if ((!terminate) &&
+                       (!xmlParseLookupString(ctxt, 4, "-->", 3)))
                        goto done;
-                    }
                    xmlParseComment(ctxt);
                    ctxt->instate = XML_PARSER_CONTENT;
-                    ctxt->progressive = 1;
                } else if ((cur == '<') && (ctxt->input->cur[1] == '!') &&
                    (ctxt->input->cur[2] == '[') &&
                    (ctxt->input->cur[3] == 'C') &&
@@ -11575,9 +11657,12 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
                } else if ((cur == '<') && (next == '!') &&
                           (avail < 9)) {
                    goto done;
+               } else if (cur == '<') {
+                   xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
+                               "detected an error in element content\n");
+                    SKIP(1);
                } else if (cur == '&') {
-                   if ((!terminate) &&
-                       (xmlParseLookupSequence(ctxt, ';', 0, 0) < 0))
+                   if ((!terminate) && (!xmlParseLookupChar(ctxt, ';')))
                        goto done;
                    xmlParseReference(ctxt);
                } else {
@@ -11595,40 +11680,19 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
                     */
                    if ((ctxt->inputNr == 1) &&
                        (avail < XML_PARSER_BIG_BUFFER_SIZE)) {
-                       if (!terminate) {
-                           if (ctxt->progressive) {
-                               if ((lastlt == NULL) ||
-                                   (ctxt->input->cur > lastlt))
-                                   goto done;
-                           } else if (xmlParseLookupSequence(ctxt,
-                                                             '<', 0, 0) < 0) {
-                               goto done;
-                           }
-                       }
+                       if ((!terminate) && (!xmlParseLookupCharData(ctxt)))
+                           goto done;
                     }
-                   ctxt->checkIndex = 0;
-                   xmlParseCharData(ctxt, 0);
-               }
-               if ((cons == CUR_CONSUMED) && (id == ctxt->input->id)) {
-                   xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
-                               "detected an error in element content\n");
-                   xmlHaltParser(ctxt);
-                   break;
+                    ctxt->checkIndex = 0;
+                   xmlParseCharDataInternal(ctxt, !terminate);
                }
                break;
            }
             case XML_PARSER_END_TAG:
                if (avail < 2)
                    goto done;
-               if (!terminate) {
-                   if (ctxt->progressive) {
-                       /* > can be found unescaped in attribute values */
-                       if ((lastgt == NULL) || (ctxt->input->cur >= lastgt))
-                           goto done;
-                   } else if (xmlParseLookupSequence(ctxt, '>', 0, 0) < 0) {
-                       goto done;
-                   }
-               }
+               if ((!terminate) && (!xmlParseLookupChar(ctxt, '>')))
+                   goto done;
                if (ctxt->sax2) {
                    xmlParseEndTag2(ctxt, &ctxt->pushTab[ctxt->nameNr - 1]);
                    nameNsPop(ctxt);
@@ -11650,35 +11714,51 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
                 * The Push mode need to have the SAX callback for
                 * cdataBlock merge back contiguous callbacks.
                 */
-               int base;
-
-               base = xmlParseLookupSequence(ctxt, ']', ']', '>');
-               if (base < 0) {
-                   if (avail >= XML_PARSER_BIG_BUFFER_SIZE + 2) {
-                       int tmp;
-
-                       tmp = xmlCheckCdataPush(ctxt->input->cur,
-                                               XML_PARSER_BIG_BUFFER_SIZE, 0);
-                       if (tmp < 0) {
-                           tmp = -tmp;
-                           ctxt->input->cur += tmp;
-                           goto encoding_error;
-                       }
-                       if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) {
-                           if (ctxt->sax->cdataBlock != NULL)
-                               ctxt->sax->cdataBlock(ctxt->userData,
-                                                     ctxt->input->cur, tmp);
-                           else if (ctxt->sax->characters != NULL)
-                               ctxt->sax->characters(ctxt->userData,
-                                                     ctxt->input->cur, tmp);
-                       }
-                       if (ctxt->instate == XML_PARSER_EOF)
-                           goto done;
-                       SKIPL(tmp);
-                       ctxt->checkIndex = 0;
-                   }
-                   goto done;
+               const xmlChar *term;
+
+                if (terminate) {
+                    /*
+                     * Don't call xmlParseLookupString. If 'terminate'
+                     * is set, checkIndex is invalid.
+                     */
+                    term = BAD_CAST strstr((const char *) ctxt->input->cur,
+                                           "]]>");
+                } else {
+                   term = xmlParseLookupString(ctxt, 0, "]]>", 3);
+                }
+
+               if (term == NULL) {
+                   int tmp, size;
+
+                    if (terminate) {
+                        /* Unfinished CDATA section */
+                        size = ctxt->input->end - ctxt->input->cur;
+                    } else {
+                        if (avail < XML_PARSER_BIG_BUFFER_SIZE + 2)
+                            goto done;
+                        ctxt->checkIndex = 0;
+                        /* XXX: Why don't we pass the full buffer? */
+                        size = XML_PARSER_BIG_BUFFER_SIZE;
+                    }
+                    tmp = xmlCheckCdataPush(ctxt->input->cur, size, 0);
+                    if (tmp <= 0) {
+                        tmp = -tmp;
+                        ctxt->input->cur += tmp;
+                        goto encoding_error;
+                    }
+                    if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) {
+                        if (ctxt->sax->cdataBlock != NULL)
+                            ctxt->sax->cdataBlock(ctxt->userData,
+                                                  ctxt->input->cur, tmp);
+                        else if (ctxt->sax->characters != NULL)
+                            ctxt->sax->characters(ctxt->userData,
+                                                  ctxt->input->cur, tmp);
+                    }
+                    if (ctxt->instate == XML_PARSER_EOF)
+                        goto done;
+                    SKIPL(tmp);
                } else {
+                    int base = term - CUR_PTR;
                    int tmp;
 
                    tmp = xmlCheckCdataPush(ctxt->input->cur, base, 1);
@@ -11712,7 +11792,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
                    if (ctxt->instate == XML_PARSER_EOF)
                        goto done;
                    SKIPL(base + 3);
-                   ctxt->checkIndex = 0;
                    ctxt->instate = XML_PARSER_CONTENT;
 #ifdef DEBUG_PUSH
                    xmlGenericError(xmlGenericErrorContext,
@@ -11722,23 +11801,18 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
                break;
            }
             case XML_PARSER_MISC:
+            case XML_PARSER_PROLOG:
+            case XML_PARSER_EPILOG:
                SKIP_BLANKS;
-               if (ctxt->input->buf == NULL)
-                   avail = ctxt->input->length -
-                           (ctxt->input->cur - ctxt->input->base);
-               else
-                   avail = xmlBufUse(ctxt->input->buf->buffer) -
-                           (ctxt->input->cur - ctxt->input->base);
+                avail = ctxt->input->end - ctxt->input->cur;
                if (avail < 2)
                    goto done;
                cur = ctxt->input->cur[0];
                next = ctxt->input->cur[1];
                if ((cur == '<') && (next == '?')) {
                    if ((!terminate) &&
-                       (xmlParseLookupSequence(ctxt, '?', '>', 0) < 0)) {
-                        ctxt->progressive = XML_PARSER_PI;
+                        (!xmlParseLookupString(ctxt, 2, "?>", 2)))
                        goto done;
-                    }
 #ifdef DEBUG_PUSH
                    xmlGenericError(xmlGenericErrorContext,
                            "PP: Parsing PI\n");
@@ -11746,17 +11820,12 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
                    xmlParsePI(ctxt);
                    if (ctxt->instate == XML_PARSER_EOF)
                        goto done;
-                   ctxt->instate = XML_PARSER_MISC;
-                    ctxt->progressive = 1;
-                   ctxt->checkIndex = 0;
                } else if ((cur == '<') && (next == '!') &&
                    (ctxt->input->cur[2] == '-') &&
                    (ctxt->input->cur[3] == '-')) {
                    if ((!terminate) &&
-                       (xmlParseLookupSequence(ctxt, '-', '-', '>') < 0)) {
-                        ctxt->progressive = XML_PARSER_COMMENT;
+                        (!xmlParseLookupString(ctxt, 4, "-->", 3)))
                        goto done;
-                    }
 #ifdef DEBUG_PUSH
                    xmlGenericError(xmlGenericErrorContext,
                            "PP: Parsing Comment\n");
@@ -11764,10 +11833,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
                    xmlParseComment(ctxt);
                    if (ctxt->instate == XML_PARSER_EOF)
                        goto done;
-                   ctxt->instate = XML_PARSER_MISC;
-                    ctxt->progressive = 1;
-                   ctxt->checkIndex = 0;
-               } else if ((cur == '<') && (next == '!') &&
+               } else if ((ctxt->instate == XML_PARSER_MISC) &&
+                    (cur == '<') && (next == '!') &&
                    (ctxt->input->cur[2] == 'D') &&
                    (ctxt->input->cur[3] == 'O') &&
                    (ctxt->input->cur[4] == 'C') &&
@@ -11775,18 +11842,13 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
                    (ctxt->input->cur[6] == 'Y') &&
                    (ctxt->input->cur[7] == 'P') &&
                    (ctxt->input->cur[8] == 'E')) {
-                   if ((!terminate) &&
-                       (xmlParseLookupSequence(ctxt, '>', 0, 0) < 0)) {
-                        ctxt->progressive = XML_PARSER_DTD;
-                       goto done;
-                    }
+                   if ((!terminate) && (!xmlParseLookupGt(ctxt)))
+                        goto done;
 #ifdef DEBUG_PUSH
                    xmlGenericError(xmlGenericErrorContext,
                            "PP: Parsing internal subset\n");
 #endif
                    ctxt->inSubset = 1;
-                    ctxt->progressive = 0;
-                   ctxt->checkIndex = 0;
                    xmlParseDocTypeDecl(ctxt);
                    if (ctxt->instate == XML_PARSER_EOF)
                        goto done;
@@ -11805,130 +11867,20 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
                            (ctxt->sax->externalSubset != NULL))
                            ctxt->sax->externalSubset(ctxt->userData,
                                    ctxt->intSubName, ctxt->extSubSystem,
-                                   ctxt->extSubURI);
-                       ctxt->inSubset = 0;
-                       xmlCleanSpecialAttr(ctxt);
-                       ctxt->instate = XML_PARSER_PROLOG;
-#ifdef DEBUG_PUSH
-                       xmlGenericError(xmlGenericErrorContext,
-                               "PP: entering PROLOG\n");
-#endif
-                   }
-               } else if ((cur == '<') && (next == '!') &&
-                          (avail < 9)) {
-                   goto done;
-               } else {
-                   ctxt->instate = XML_PARSER_START_TAG;
-                   ctxt->progressive = XML_PARSER_START_TAG;
-                   xmlParseGetLasts(ctxt, &lastlt, &lastgt);
-#ifdef DEBUG_PUSH
-                   xmlGenericError(xmlGenericErrorContext,
-                           "PP: entering START_TAG\n");
-#endif
-               }
-               break;
-            case XML_PARSER_PROLOG:
-               SKIP_BLANKS;
-               if (ctxt->input->buf == NULL)
-                   avail = ctxt->input->length - (ctxt->input->cur - ctxt->input->base);
-               else
-                   avail = xmlBufUse(ctxt->input->buf->buffer) -
-                            (ctxt->input->cur - ctxt->input->base);
-               if (avail < 2)
-                   goto done;
-               cur = ctxt->input->cur[0];
-               next = ctxt->input->cur[1];
-               if ((cur == '<') && (next == '?')) {
-                   if ((!terminate) &&
-                       (xmlParseLookupSequence(ctxt, '?', '>', 0) < 0)) {
-                        ctxt->progressive = XML_PARSER_PI;
-                       goto done;
-                    }
-#ifdef DEBUG_PUSH
-                   xmlGenericError(xmlGenericErrorContext,
-                           "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 == '!') &&
-                   (ctxt->input->cur[2] == '-') && (ctxt->input->cur[3] == '-')) {
-                   if ((!terminate) &&
-                       (xmlParseLookupSequence(ctxt, '-', '-', '>') < 0)) {
-                        ctxt->progressive = XML_PARSER_COMMENT;
-                       goto done;
-                    }
-#ifdef DEBUG_PUSH
-                   xmlGenericError(xmlGenericErrorContext,
-                           "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 == '!') &&
-                          (avail < 4)) {
-                   goto done;
-               } else {
-                   ctxt->instate = XML_PARSER_START_TAG;
-                   if (ctxt->progressive == 0)
-                       ctxt->progressive = XML_PARSER_START_TAG;
-                   xmlParseGetLasts(ctxt, &lastlt, &lastgt);
-#ifdef DEBUG_PUSH
-                   xmlGenericError(xmlGenericErrorContext,
-                           "PP: entering START_TAG\n");
-#endif
-               }
-               break;
-            case XML_PARSER_EPILOG:
-               SKIP_BLANKS;
-               if (ctxt->input->buf == NULL)
-                   avail = ctxt->input->length - (ctxt->input->cur - ctxt->input->base);
-               else
-                   avail = xmlBufUse(ctxt->input->buf->buffer) -
-                            (ctxt->input->cur - ctxt->input->base);
-               if (avail < 2)
-                   goto done;
-               cur = ctxt->input->cur[0];
-               next = ctxt->input->cur[1];
-               if ((cur == '<') && (next == '?')) {
-                   if ((!terminate) &&
-                       (xmlParseLookupSequence(ctxt, '?', '>', 0) < 0)) {
-                        ctxt->progressive = XML_PARSER_PI;
-                       goto done;
-                    }
-#ifdef DEBUG_PUSH
-                   xmlGenericError(xmlGenericErrorContext,
-                           "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 == '!') &&
-                   (ctxt->input->cur[2] == '-') && (ctxt->input->cur[3] == '-')) {
-                   if ((!terminate) &&
-                       (xmlParseLookupSequence(ctxt, '-', '-', '>') < 0)) {
-                        ctxt->progressive = XML_PARSER_COMMENT;
-                       goto done;
-                    }
+                                   ctxt->extSubURI);
+                       ctxt->inSubset = 0;
+                       xmlCleanSpecialAttr(ctxt);
+                       ctxt->instate = XML_PARSER_PROLOG;
 #ifdef DEBUG_PUSH
-                   xmlGenericError(xmlGenericErrorContext,
-                           "PP: Parsing Comment\n");
+                       xmlGenericError(xmlGenericErrorContext,
+                               "PP: entering PROLOG\n");
 #endif
-                   xmlParseComment(ctxt);
-                   if (ctxt->instate == XML_PARSER_EOF)
-                       goto done;
-                   ctxt->instate = XML_PARSER_EPILOG;
-                    ctxt->progressive = 1;
+                   }
                } else if ((cur == '<') && (next == '!') &&
-                          (avail < 4)) {
+                          (avail <
+                            (ctxt->instate == XML_PARSER_MISC ? 9 : 4))) {
                    goto done;
-               } else {
+               } else if (ctxt->instate == XML_PARSER_EPILOG) {
                    xmlFatalErr(ctxt, XML_ERR_DOCUMENT_END, NULL);
                    xmlHaltParser(ctxt);
 #ifdef DEBUG_PUSH
@@ -11938,120 +11890,17 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
                    if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
                        ctxt->sax->endDocument(ctxt->userData);
                    goto done;
-               }
-               break;
-            case XML_PARSER_DTD: {
-               /*
-                * Sorry but progressive parsing of the internal subset
-                * is not expected to be supported. We first check that
-                * the full content of the internal subset is available and
-                * the parsing is launched only at that point.
-                * Internal subset ends up with "']' S? '>'" in an unescaped
-                * section and not in a ']]>' sequence which are conditional
-                * sections (whoever argued to keep that crap in XML deserve
-                * a place in hell !).
-                */
-               int base, i;
-               xmlChar *buf;
-               xmlChar quote = 0;
-                size_t use;
-
-               base = ctxt->input->cur - ctxt->input->base;
-               if (base < 0) return(0);
-               if (ctxt->checkIndex > base)
-                   base = ctxt->checkIndex;
-               buf = xmlBufContent(ctxt->input->buf->buffer);
-                use = xmlBufUse(ctxt->input->buf->buffer);
-               for (;(unsigned int) base < use; base++) {
-                   if (quote != 0) {
-                       if (buf[base] == quote)
-                           quote = 0;
-                       continue;
-                   }
-                   if ((quote == 0) && (buf[base] == '<')) {
-                       int found  = 0;
-                       /* special handling of comments */
-                       if (((unsigned int) base + 4 < use) &&
-                           (buf[base + 1] == '!') &&
-                           (buf[base + 2] == '-') &&
-                           (buf[base + 3] == '-')) {
-                           for (;(unsigned int) base + 3 < use; base++) {
-                               if ((buf[base] == '-') &&
-                                   (buf[base + 1] == '-') &&
-                                   (buf[base + 2] == '>')) {
-                                   found = 1;
-                                   base += 2;
-                                   break;
-                               }
-                           }
-                           if (!found) {
-#if 0
-                               fprintf(stderr, "unfinished comment\n");
-#endif
-                               break; /* for */
-                           }
-                           continue;
-                       }
-                   }
-                   if (buf[base] == '"') {
-                       quote = '"';
-                       continue;
-                   }
-                   if (buf[base] == '\'') {
-                       quote = '\'';
-                       continue;
-                   }
-                   if (buf[base] == ']') {
-#if 0
-                       fprintf(stderr, "%c%c%c%c: ", buf[base],
-                               buf[base + 1], buf[base + 2], buf[base + 3]);
-#endif
-                       if ((unsigned int) base +1 >= use)
-                           break;
-                       if (buf[base + 1] == ']') {
-                           /* conditional crap, skip both ']' ! */
-                           base++;
-                           continue;
-                       }
-                       for (i = 1; (unsigned int) base + i < use; i++) {
-                           if (buf[base + i] == '>') {
-#if 0
-                               fprintf(stderr, "found\n");
-#endif
-                               goto found_end_int_subset;
-                           }
-                           if (!IS_BLANK_CH(buf[base + i])) {
-#if 0
-                               fprintf(stderr, "not found\n");
-#endif
-                               goto not_end_of_int_subset;
-                           }
-                       }
-#if 0
-                       fprintf(stderr, "end of stream\n");
-#endif
-                       break;
-
-                   }
-not_end_of_int_subset:
-                    continue; /* for */
-               }
-               /*
-                * We didn't found the end of the Internal subset
-                */
-                if (quote == 0)
-                    ctxt->checkIndex = base;
-                else
-                    ctxt->checkIndex = 0;
+                } else {
+                   ctxt->instate = XML_PARSER_START_TAG;
 #ifdef DEBUG_PUSH
-               if (next == 0)
                    xmlGenericError(xmlGenericErrorContext,
-                           "PP: lookup of int subset end filed\n");
+                           "PP: entering START_TAG\n");
 #endif
-               goto done;
-
-found_end_int_subset:
-                ctxt->checkIndex = 0;
+               }
+               break;
+            case XML_PARSER_DTD: {
+                if ((!terminate) && (!xmlParseLookupInternalSubset(ctxt)))
+                    goto done;
                xmlParseInternalSubset(ctxt);
                if (ctxt->instate == XML_PARSER_EOF)
                    goto done;
@@ -12065,7 +11914,6 @@ found_end_int_subset:
                if (ctxt->instate == XML_PARSER_EOF)
                    goto done;
                ctxt->instate = XML_PARSER_PROLOG;
-               ctxt->checkIndex = 0;
 #ifdef DEBUG_PUSH
                xmlGenericError(xmlGenericErrorContext,
                        "PP: entering PROLOG\n");
@@ -12152,7 +12000,11 @@ done:
 #endif
     return(ret);
 encoding_error:
-    {
+    if (ctxt->input->end - ctxt->input->cur < 4) {
+       __xmlErrEncoding(ctxt, XML_ERR_INVALID_CHAR,
+                    "Input is not proper UTF-8, indicate encoding !\n",
+                    NULL, NULL);
+    } else {
         char buffer[150];
 
        snprintf(buffer, 149, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
@@ -12166,55 +12018,6 @@ encoding_error:
 }
 
 /**
- * xmlParseCheckTransition:
- * @ctxt:  an XML parser context
- * @chunk:  a char array
- * @size:  the size in byte of the chunk
- *
- * Check depending on the current parser state if the chunk given must be
- * processed immediately or one need more data to advance on parsing.
- *
- * Returns -1 in case of error, 0 if the push is not needed and 1 if needed
- */
-static int
-xmlParseCheckTransition(xmlParserCtxtPtr ctxt, const char *chunk, int size) {
-    if ((ctxt == NULL) || (chunk == NULL) || (size < 0))
-        return(-1);
-    if (ctxt->instate == XML_PARSER_START_TAG) {
-        if (memchr(chunk, '>', size) != NULL)
-            return(1);
-        return(0);
-    }
-    if (ctxt->progressive == XML_PARSER_COMMENT) {
-        if (memchr(chunk, '>', size) != NULL)
-            return(1);
-        return(0);
-    }
-    if (ctxt->instate == XML_PARSER_CDATA_SECTION) {
-        if (memchr(chunk, '>', size) != NULL)
-            return(1);
-        return(0);
-    }
-    if (ctxt->progressive == XML_PARSER_PI) {
-        if (memchr(chunk, '>', size) != NULL)
-            return(1);
-        return(0);
-    }
-    if (ctxt->instate == XML_PARSER_END_TAG) {
-        if (memchr(chunk, '>', size) != NULL)
-            return(1);
-        return(0);
-    }
-    if ((ctxt->progressive == XML_PARSER_DTD) ||
-        (ctxt->instate == XML_PARSER_DTD)) {
-        if (memchr(chunk, '>', size) != NULL)
-            return(1);
-        return(0);
-    }
-    return(1);
-}
-
-/**
  * xmlParseChunk:
  * @ctxt:  an XML parser context
  * @chunk:  an char array
@@ -12229,9 +12032,6 @@ int
 xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size,
               int terminate) {
     int end_in_lf = 0;
-    int remain = 0;
-    size_t old_avail = 0;
-    size_t avail = 0;
 
     if (ctxt == NULL)
         return(XML_ERR_INTERNAL_ERROR);
@@ -12239,6 +12039,10 @@ xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size,
         return(ctxt->errNo);
     if (ctxt->instate == XML_PARSER_EOF)
         return(-1);
+    if (ctxt->input == NULL)
+        return(-1);
+
+    ctxt->progressive = 1;
     if (ctxt->instate == XML_PARSER_START)
         xmlDetectSAX2(ctxt);
     if ((size > 0) && (chunk != NULL) && (!terminate) &&
@@ -12247,50 +12051,12 @@ xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size,
        size--;
     }
 
-xmldecl_done:
-
     if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) &&
         (ctxt->input->buf != NULL) && (ctxt->instate != XML_PARSER_EOF))  {
        size_t base = xmlBufGetInputBase(ctxt->input->buf->buffer, ctxt->input);
        size_t cur = ctxt->input->cur - ctxt->input->base;
        int res;
 
-        old_avail = xmlBufUse(ctxt->input->buf->buffer);
-        /*
-         * Specific handling if we autodetected an encoding, we should not
-         * push more than the first line ... which depend on the encoding
-         * And only push the rest once the final encoding was detected
-         */
-        if ((ctxt->instate == XML_PARSER_START) && (ctxt->input != NULL) &&
-            (ctxt->input->buf != NULL) && (ctxt->input->buf->encoder != NULL)) {
-            unsigned int len = 45;
-
-            if ((xmlStrcasestr(BAD_CAST ctxt->input->buf->encoder->name,
-                               BAD_CAST "UTF-16")) ||
-                (xmlStrcasestr(BAD_CAST ctxt->input->buf->encoder->name,
-                               BAD_CAST "UTF16")))
-                len = 90;
-            else if ((xmlStrcasestr(BAD_CAST ctxt->input->buf->encoder->name,
-                                    BAD_CAST "UCS-4")) ||
-                     (xmlStrcasestr(BAD_CAST ctxt->input->buf->encoder->name,
-                                    BAD_CAST "UCS4")))
-                len = 180;
-
-            if (ctxt->input->buf->rawconsumed < len)
-                len -= ctxt->input->buf->rawconsumed;
-
-            /*
-             * Change size for reading the initial declaration only
-             * if size is greater than len. Otherwise, memmove in xmlBufferAdd
-             * will blindly copy extra bytes from memory.
-             */
-            if ((unsigned int) size > len) {
-                remain = size - len;
-                size = len;
-            } else {
-                remain = 0;
-            }
-        }
        res = xmlParserInputBufferPush(ctxt->input->buf, size, chunk);
         xmlBufSetInputBaseCur(ctxt->input->buf->buffer, ctxt->input, base, cur);
        if (res < 0) {
@@ -12323,24 +12089,8 @@ xmldecl_done:
            }
        }
     }
-    if (remain != 0) {
-        xmlParseTryOrFinish(ctxt, 0);
-    } else {
-        if ((ctxt->input != NULL) && (ctxt->input->buf != NULL))
-            avail = xmlBufUse(ctxt->input->buf->buffer);
-        /*
-         * Depending on the current state it may not be such
-         * a good idea to try parsing if there is nothing in the chunk
-         * which would be worth doing a parser state transition and we
-         * need to wait for more data
-         */
-        if ((terminate) || (avail > XML_MAX_TEXT_LENGTH) ||
-            (old_avail == 0) || (avail == 0) ||
-            (xmlParseCheckTransition(ctxt,
-                       (const char *)&ctxt->input->base[old_avail],
-                                     avail - old_avail)))
-            xmlParseTryOrFinish(ctxt, terminate);
-    }
+
+    xmlParseTryOrFinish(ctxt, terminate);
     if (ctxt->instate == XML_PARSER_EOF)
         return(ctxt->errNo);
 
@@ -12354,12 +12104,6 @@ xmldecl_done:
     if ((ctxt->errNo != XML_ERR_OK) && (ctxt->disableSAX == 1))
         return(ctxt->errNo);
 
-    if (remain != 0) {
-        chunk += size;
-        size = remain;
-        remain = 0;
-        goto xmldecl_done;
-    }
     if ((end_in_lf == 1) && (ctxt->input != NULL) &&
         (ctxt->input->buf != NULL)) {
        size_t base = xmlBufGetInputBase(ctxt->input->buf->buffer,
@@ -12375,22 +12119,12 @@ xmldecl_done:
        /*
         * Check for termination
         */
-       int cur_avail = 0;
-
-       if (ctxt->input != NULL) {
-           if (ctxt->input->buf == NULL)
-               cur_avail = ctxt->input->length -
-                           (ctxt->input->cur - ctxt->input->base);
-           else
-               cur_avail = xmlBufUse(ctxt->input->buf->buffer) -
-                                     (ctxt->input->cur - ctxt->input->base);
-       }
-
        if ((ctxt->instate != XML_PARSER_EOF) &&
            (ctxt->instate != XML_PARSER_EPILOG)) {
            xmlFatalErr(ctxt, XML_ERR_DOCUMENT_END, NULL);
        }
-       if ((ctxt->instate == XML_PARSER_EPILOG) && (cur_avail > 0)) {
+       if ((ctxt->instate == XML_PARSER_EPILOG) &&
+            (ctxt->input->cur < ctxt->input->end)) {
            xmlFatalErr(ctxt, XML_ERR_DOCUMENT_END, NULL);
        }
        if (ctxt->instate != XML_PARSER_EOF) {
@@ -12436,44 +12170,17 @@ xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, void *user_data,
     xmlParserCtxtPtr ctxt;
     xmlParserInputPtr inputStream;
     xmlParserInputBufferPtr buf;
-    xmlCharEncoding enc = XML_CHAR_ENCODING_NONE;
-
-    /*
-     * plug some encoding conversion routines
-     */
-    if ((chunk != NULL) && (size >= 4))
-       enc = xmlDetectCharEncoding((const xmlChar *) chunk, size);
 
-    buf = xmlAllocParserInputBuffer(enc);
+    buf = xmlAllocParserInputBuffer(XML_CHAR_ENCODING_NONE);
     if (buf == NULL) return(NULL);
 
-    ctxt = xmlNewParserCtxt();
+    ctxt = xmlNewSAXParserCtxt(sax, user_data);
     if (ctxt == NULL) {
         xmlErrMemory(NULL, "creating parser: out of memory\n");
        xmlFreeParserInputBuffer(buf);
        return(NULL);
     }
     ctxt->dictNames = 1;
-    if (sax != NULL) {
-#ifdef LIBXML_SAX1_ENABLED
-       if (ctxt->sax != (xmlSAXHandlerPtr) &xmlDefaultSAXHandler)
-#endif /* LIBXML_SAX1_ENABLED */
-           xmlFree(ctxt->sax);
-       ctxt->sax = (xmlSAXHandlerPtr) xmlMalloc(sizeof(xmlSAXHandler));
-       if (ctxt->sax == NULL) {
-           xmlErrMemory(ctxt, NULL);
-           xmlFreeParserInputBuffer(buf);
-           xmlFreeParserCtxt(ctxt);
-           return(NULL);
-       }
-       memset(ctxt->sax, 0, sizeof(xmlSAXHandler));
-       if (sax->initialized == XML_SAX2_MAGIC)
-           memcpy(ctxt->sax, sax, sizeof(xmlSAXHandler));
-       else
-           memcpy(ctxt->sax, sax, sizeof(xmlSAXHandlerV1));
-       if (user_data != NULL)
-           ctxt->userData = user_data;
-    }
     if (filename == NULL) {
        ctxt->directory = NULL;
     } else {
@@ -12493,6 +12200,7 @@ xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, void *user_data,
        inputStream->filename = (char *)
            xmlCanonicPath((const xmlChar *) filename);
        if (inputStream->filename == NULL) {
+            xmlFreeInputStream(inputStream);
            xmlFreeParserCtxt(ctxt);
            xmlFreeParserInputBuffer(buf);
            return(NULL);
@@ -12507,9 +12215,10 @@ xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, void *user_data,
      * the encoding, we set the context to XML_CHAR_ENCODING_NONE so
      * that it can be automatically determined later
      */
-    if ((size == 0) || (chunk == NULL)) {
-       ctxt->charset = XML_CHAR_ENCODING_NONE;
-    } else if ((ctxt->input != NULL) && (ctxt->input->buf != NULL)) {
+    ctxt->charset = XML_CHAR_ENCODING_NONE;
+
+    if ((size != 0) && (chunk != NULL) &&
+        (ctxt->input != NULL) && (ctxt->input->buf != NULL)) {
        size_t base = xmlBufGetInputBase(ctxt->input->buf->buffer, ctxt->input);
        size_t cur = ctxt->input->cur - ctxt->input->base;
 
@@ -12521,50 +12230,11 @@ xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, void *user_data,
 #endif
     }
 
-    if (enc != XML_CHAR_ENCODING_NONE) {
-        xmlSwitchEncoding(ctxt, enc);
-    }
-
     return(ctxt);
 }
 #endif /* LIBXML_PUSH_ENABLED */
 
 /**
- * xmlHaltParser:
- * @ctxt:  an XML parser context
- *
- * Blocks further parser processing don't override error
- * for internal use
- */
-static void
-xmlHaltParser(xmlParserCtxtPtr ctxt) {
-    if (ctxt == NULL)
-        return;
-    ctxt->instate = XML_PARSER_EOF;
-    ctxt->disableSAX = 1;
-    while (ctxt->inputNr > 1)
-        xmlFreeInputStream(inputPop(ctxt));
-    if (ctxt->input != NULL) {
-        /*
-        * in case there was a specific allocation deallocate before
-        * overriding base
-        */
-        if (ctxt->input->free != NULL) {
-           ctxt->input->free((xmlChar *) ctxt->input->base);
-           ctxt->input->free = NULL;
-       }
-        if (ctxt->input->buf != NULL) {
-            xmlFreeParserInputBuffer(ctxt->input->buf);
-            ctxt->input->buf = NULL;
-        }
-       ctxt->input->cur = BAD_CAST"";
-        ctxt->input->length = 0;
-       ctxt->input->base = ctxt->input->cur;
-        ctxt->input->end = ctxt->input->cur;
-    }
-}
-
-/**
  * xmlStopParser:
  * @ctxt:  an XML parser context
  *
@@ -12609,31 +12279,11 @@ xmlCreateIOParserCtxt(xmlSAXHandlerPtr sax, void *user_data,
         return (NULL);
     }
 
-    ctxt = xmlNewParserCtxt();
+    ctxt = xmlNewSAXParserCtxt(sax, user_data);
     if (ctxt == NULL) {
        xmlFreeParserInputBuffer(buf);
        return(NULL);
     }
-    if (sax != NULL) {
-#ifdef LIBXML_SAX1_ENABLED
-       if (ctxt->sax != (xmlSAXHandlerPtr) &xmlDefaultSAXHandler)
-#endif /* LIBXML_SAX1_ENABLED */
-           xmlFree(ctxt->sax);
-       ctxt->sax = (xmlSAXHandlerPtr) xmlMalloc(sizeof(xmlSAXHandler));
-       if (ctxt->sax == NULL) {
-           xmlFreeParserInputBuffer(buf);
-           xmlErrMemory(ctxt, NULL);
-           xmlFreeParserCtxt(ctxt);
-           return(NULL);
-       }
-       memset(ctxt->sax, 0, sizeof(xmlSAXHandler));
-       if (sax->initialized == XML_SAX2_MAGIC)
-           memcpy(ctxt->sax, sax, sizeof(xmlSAXHandler));
-       else
-           memcpy(ctxt->sax, sax, sizeof(xmlSAXHandlerV1));
-       if (user_data != NULL)
-           ctxt->userData = user_data;
-    }
 
     inputStream = xmlNewIOInputStream(ctxt, buf, enc);
     if (inputStream == NULL) {
@@ -12675,7 +12325,7 @@ xmlIOParseDTD(xmlSAXHandlerPtr sax, xmlParserInputBufferPtr input,
     if (input == NULL)
        return(NULL);
 
-    ctxt = xmlNewParserCtxt();
+    ctxt = xmlNewSAXParserCtxt(sax, NULL);
     if (ctxt == NULL) {
         xmlFreeParserInputBuffer(input);
        return(NULL);
@@ -12684,15 +12334,6 @@ xmlIOParseDTD(xmlSAXHandlerPtr sax, xmlParserInputBufferPtr input,
     /* We are loading a DTD */
     ctxt->options |= XML_PARSE_DTDLOAD;
 
-    /*
-     * Set-up the SAX context
-     */
-    if (sax != NULL) {
-       if (ctxt->sax != NULL)
-           xmlFree(ctxt->sax);
-        ctxt->sax = sax;
-        ctxt->userData = ctxt;
-    }
     xmlDetectSAX2(ctxt);
 
     /*
@@ -12701,7 +12342,6 @@ xmlIOParseDTD(xmlSAXHandlerPtr sax, xmlParserInputBufferPtr input,
 
     pinput = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE);
     if (pinput == NULL) {
-        if (sax != NULL) ctxt->sax = NULL;
         xmlFreeParserInputBuffer(input);
        xmlFreeParserCtxt(ctxt);
        return(NULL);
@@ -12711,7 +12351,6 @@ xmlIOParseDTD(xmlSAXHandlerPtr sax, xmlParserInputBufferPtr input,
      * plug some encoding conversion routines here.
      */
     if (xmlPushInput(ctxt, pinput) < 0) {
-        if (sax != NULL) ctxt->sax = NULL;
        xmlFreeParserCtxt(ctxt);
        return(NULL);
     }
@@ -12778,7 +12417,6 @@ xmlIOParseDTD(xmlSAXHandlerPtr sax, xmlParserInputBufferPtr input,
         xmlFreeDoc(ctxt->myDoc);
         ctxt->myDoc = NULL;
     }
-    if (sax != NULL) ctxt->sax = NULL;
     xmlFreeParserCtxt(ctxt);
 
     return(ret);
@@ -12790,6 +12428,8 @@ xmlIOParseDTD(xmlSAXHandlerPtr sax, xmlParserInputBufferPtr input,
  * @ExternalID:  a NAME* containing the External ID of the DTD
  * @SystemID:  a NAME* containing the URL to the DTD
  *
+ * DEPRECATED: Don't use.
+ *
  * Load and parse an external subset.
  *
  * Returns the resulting xmlDtdPtr or NULL in case of error.
@@ -12806,7 +12446,7 @@ xmlSAXParseDTD(xmlSAXHandlerPtr sax, const xmlChar *ExternalID,
 
     if ((ExternalID == NULL) && (SystemID == NULL)) return(NULL);
 
-    ctxt = xmlNewParserCtxt();
+    ctxt = xmlNewSAXParserCtxt(sax, NULL);
     if (ctxt == NULL) {
        return(NULL);
     }
@@ -12815,16 +12455,6 @@ xmlSAXParseDTD(xmlSAXHandlerPtr sax, const xmlChar *ExternalID,
     ctxt->options |= XML_PARSE_DTDLOAD;
 
     /*
-     * Set-up the SAX context
-     */
-    if (sax != NULL) {
-       if (ctxt->sax != NULL)
-           xmlFree(ctxt->sax);
-        ctxt->sax = sax;
-        ctxt->userData = ctxt;
-    }
-
-    /*
      * Canonicalise the system ID
      */
     systemIdCanonic = xmlCanonicPath(SystemID);
@@ -12841,7 +12471,6 @@ xmlSAXParseDTD(xmlSAXHandlerPtr sax, const xmlChar *ExternalID,
        input = ctxt->sax->resolveEntity(ctxt->userData, ExternalID,
                                         systemIdCanonic);
     if (input == NULL) {
-        if (sax != NULL) ctxt->sax = NULL;
        xmlFreeParserCtxt(ctxt);
        if (systemIdCanonic != NULL)
            xmlFree(systemIdCanonic);
@@ -12852,7 +12481,6 @@ xmlSAXParseDTD(xmlSAXHandlerPtr sax, const xmlChar *ExternalID,
      * plug some encoding conversion routines here.
      */
     if (xmlPushInput(ctxt, input) < 0) {
-        if (sax != NULL) ctxt->sax = NULL;
        xmlFreeParserCtxt(ctxt);
        if (systemIdCanonic != NULL)
            xmlFree(systemIdCanonic);
@@ -12880,7 +12508,6 @@ xmlSAXParseDTD(xmlSAXHandlerPtr sax, const xmlChar *ExternalID,
     ctxt->myDoc = xmlNewDoc(BAD_CAST "1.0");
     if (ctxt->myDoc == NULL) {
        xmlErrMemory(ctxt, "New Doc failed");
-        if (sax != NULL) ctxt->sax = NULL;
        xmlFreeParserCtxt(ctxt);
        return(NULL);
     }
@@ -12909,7 +12536,6 @@ xmlSAXParseDTD(xmlSAXHandlerPtr sax, const xmlChar *ExternalID,
         xmlFreeDoc(ctxt->myDoc);
         ctxt->myDoc = NULL;
     }
-    if (sax != NULL) ctxt->sax = NULL;
     xmlFreeParserCtxt(ctxt);
 
     return(ret);
@@ -13000,15 +12626,16 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt,
     xmlParserCtxtPtr ctxt;
     xmlDocPtr newDoc;
     xmlNodePtr newRoot;
-    xmlSAXHandlerPtr oldsax = NULL;
     xmlParserErrors ret = XML_ERR_OK;
     xmlChar start[4];
     xmlCharEncoding enc;
 
     if (((depth > 40) &&
        ((oldctxt == NULL) || (oldctxt->options & XML_PARSE_HUGE) == 0)) ||
-       (depth > 1024)) {
-       return(XML_ERR_ENTITY_LOOP);
+       (depth > 100)) {
+       xmlFatalErrMsg(oldctxt, XML_ERR_ENTITY_LOOP,
+                       "Maximum entity nesting depth exceeded");
+        return(XML_ERR_ENTITY_LOOP);
     }
 
     if (list != NULL)
@@ -13018,17 +12645,15 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt,
     if (doc == NULL)
        return(XML_ERR_INTERNAL_ERROR);
 
-
-    ctxt = xmlCreateEntityParserCtxtInternal(URL, ID, NULL, oldctxt);
+    ctxt = xmlCreateEntityParserCtxtInternal(sax, user_data, URL, ID, NULL,
+                                             oldctxt);
     if (ctxt == NULL) return(XML_WAR_UNDECLARED_ENTITY);
-    ctxt->userData = ctxt;
-    if (sax != NULL) {
-       oldsax = ctxt->sax;
-        ctxt->sax = sax;
-       if (user_data != NULL)
-           ctxt->userData = user_data;
+    if (oldctxt != NULL) {
+        ctxt->nbErrors = oldctxt->nbErrors;
+        ctxt->nbWarnings = oldctxt->nbWarnings;
     }
     xmlDetectSAX2(ctxt);
+
     newDoc = xmlNewDoc(BAD_CAST "1.0");
     if (newDoc == NULL) {
        xmlFreeParserCtxt(ctxt);
@@ -13049,7 +12674,6 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt,
     newRoot = xmlNewDocNode(newDoc, NULL, BAD_CAST "pseudoroot", NULL);
     if (newRoot == NULL) {
        if (sax != NULL)
-           ctxt->sax = oldsax;
        xmlFreeParserCtxt(ctxt);
        newDoc->intSubset = NULL;
        newDoc->extSubset = NULL;
@@ -13109,6 +12733,7 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt,
             ctxt->vctxt.error = oldctxt->vctxt.error;
             ctxt->vctxt.warning = oldctxt->vctxt.warning;
             ctxt->vctxt.userData = oldctxt->vctxt.userData;
+            ctxt->vctxt.flags = oldctxt->vctxt.flags;
         }
        ctxt->external = oldctxt->external;
         if (ctxt->dict) xmlDictFree(ctxt->dict);
@@ -13147,10 +12772,12 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt,
     }
 
     if (!ctxt->wellFormed) {
-        if (ctxt->errNo == 0)
-           ret = XML_ERR_INTERNAL_ERROR;
-       else
-           ret = (xmlParserErrors)ctxt->errNo;
+       ret = (xmlParserErrors)ctxt->errNo;
+        if (oldctxt != NULL) {
+            oldctxt->errNo = ctxt->errNo;
+            oldctxt->wellFormed = 0;
+            xmlCopyError(&ctxt->lastError, &oldctxt->lastError);
+        }
     } else {
        if (list != NULL) {
            xmlNodePtr cur;
@@ -13171,31 +12798,26 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt,
     }
 
     /*
-     * Record in the parent context the number of entities replacement
-     * done when parsing that reference.
-     */
-    if (oldctxt != NULL)
-        oldctxt->nbentities += ctxt->nbentities;
-
-    /*
      * Also record the size of the entity parsed
      */
     if (ctxt->input != NULL && oldctxt != NULL) {
-       oldctxt->sizeentities += ctxt->input->consumed;
-       oldctxt->sizeentities += (ctxt->input->cur - ctxt->input->base);
+        unsigned long consumed = ctxt->input->consumed;
+
+        xmlSaturatedAddSizeT(&consumed, ctxt->input->cur - ctxt->input->base);
+
+        xmlSaturatedAdd(&oldctxt->sizeentities, consumed);
+        xmlSaturatedAdd(&oldctxt->sizeentities, ctxt->sizeentities);
+
+        xmlSaturatedAdd(&oldctxt->sizeentcopy, consumed);
+        xmlSaturatedAdd(&oldctxt->sizeentcopy, ctxt->sizeentcopy);
     }
-    /*
-     * And record the last error if any
-     */
-    if ((oldctxt != NULL) && (ctxt->lastError.code != XML_ERR_OK))
-        xmlCopyError(&ctxt->lastError, &oldctxt->lastError);
 
-    if (sax != NULL)
-       ctxt->sax = oldsax;
     if (oldctxt != NULL) {
         ctxt->dict = NULL;
         ctxt->attsDefault = NULL;
         ctxt->attsSpecial = NULL;
+        oldctxt->nbErrors = ctxt->nbErrors;
+        oldctxt->nbWarnings = ctxt->nbWarnings;
         oldctxt->validate = ctxt->validate;
         oldctxt->valid = ctxt->valid;
         oldctxt->node_seq.maximum = ctxt->node_seq.maximum;
@@ -13306,7 +12928,9 @@ xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt,
 #endif
 
     if (((oldctxt->depth > 40) && ((oldctxt->options & XML_PARSE_HUGE) == 0)) ||
-        (oldctxt->depth >  1024)) {
+        (oldctxt->depth >  100)) {
+       xmlFatalErrMsg(oldctxt, XML_ERR_ENTITY_LOOP,
+                       "Maximum entity nesting depth exceeded");
        return(XML_ERR_ENTITY_LOOP);
     }
 
@@ -13320,13 +12944,15 @@ xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt,
 
     ctxt = xmlCreateMemoryParserCtxt((char *) string, size);
     if (ctxt == NULL) return(XML_WAR_UNDECLARED_ENTITY);
+    ctxt->nbErrors = oldctxt->nbErrors;
+    ctxt->nbWarnings = oldctxt->nbWarnings;
     if (user_data != NULL)
        ctxt->userData = user_data;
     else
        ctxt->userData = ctxt;
     if (ctxt->dict != NULL) xmlDictFree(ctxt->dict);
     ctxt->dict = oldctxt->dict;
-    ctxt->input_id = oldctxt->input_id + 1;
+    ctxt->input_id = oldctxt->input_id;
     ctxt->str_xml = xmlDictLookup(ctxt->dict, BAD_CAST "xml", 3);
     ctxt->str_xmlns = xmlDictLookup(ctxt->dict, BAD_CAST "xmlns", 5);
     ctxt->str_xml_ns = xmlDictLookup(ctxt->dict, XML_XML_NAMESPACE, 36);
@@ -13377,7 +13003,7 @@ xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt,
     xmlAddChild((xmlNodePtr) ctxt->myDoc, newRoot);
     nodePush(ctxt, ctxt->myDoc->children);
     ctxt->instate = XML_PARSER_CONTENT;
-    ctxt->depth = oldctxt->depth + 1;
+    ctxt->depth = oldctxt->depth;
 
     ctxt->validate = 0;
     ctxt->loadsubset = oldctxt->loadsubset;
@@ -13402,12 +13028,12 @@ xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt,
     }
 
     if (!ctxt->wellFormed) {
-        if (ctxt->errNo == 0)
-           ret = XML_ERR_INTERNAL_ERROR;
-       else
-           ret = (xmlParserErrors)ctxt->errNo;
+       ret = (xmlParserErrors)ctxt->errNo;
+        oldctxt->errNo = ctxt->errNo;
+        oldctxt->wellFormed = 0;
+        xmlCopyError(&ctxt->lastError, &oldctxt->lastError);
     } else {
-      ret = XML_ERR_OK;
+        ret = XML_ERR_OK;
     }
 
     if ((lst != NULL) && (ret == XML_ERR_OK)) {
@@ -13440,18 +13066,19 @@ xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt,
     }
 
     /*
-     * Record in the parent context the number of entities replacement
-     * done when parsing that reference.
+     * Also record the size of the entity parsed
      */
-    if (oldctxt != NULL)
-        oldctxt->nbentities += ctxt->nbentities;
+    if (ctxt->input != NULL && oldctxt != NULL) {
+        unsigned long consumed = ctxt->input->consumed;
 
-    /*
-     * Also record the last error if any
-     */
-    if (ctxt->lastError.code != XML_ERR_OK)
-        xmlCopyError(&ctxt->lastError, &oldctxt->lastError);
+        xmlSaturatedAddSizeT(&consumed, ctxt->input->cur - ctxt->input->base);
+
+        xmlSaturatedAdd(&oldctxt->sizeentcopy, consumed);
+        xmlSaturatedAdd(&oldctxt->sizeentcopy, ctxt->sizeentcopy);
+    }
 
+    oldctxt->nbErrors = ctxt->nbErrors;
+    oldctxt->nbWarnings = ctxt->nbWarnings;
     ctxt->sax = oldsax;
     ctxt->dict = NULL;
     ctxt->attsDefault = NULL;
@@ -13866,6 +13493,8 @@ xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax,
  * @sax:  the SAX handler block
  * @filename:  the filename
  *
+ * DEPRECATED: Don't use.
+ *
  * parse an XML external entity out of context and build a tree.
  * It use the given SAX function block to handle the parsing callback.
  * If sax is NULL, fallback to the default DOM tree building routines.
@@ -13942,14 +13571,15 @@ xmlParseEntity(const char *filename) {
  * Returns the new parser context or NULL
  */
 static xmlParserCtxtPtr
-xmlCreateEntityParserCtxtInternal(const xmlChar *URL, const xmlChar *ID,
-                         const xmlChar *base, xmlParserCtxtPtr pctx) {
+xmlCreateEntityParserCtxtInternal(xmlSAXHandlerPtr sax, void *userData,
+        const xmlChar *URL, const xmlChar *ID, const xmlChar *base,
+        xmlParserCtxtPtr pctx) {
     xmlParserCtxtPtr ctxt;
     xmlParserInputPtr inputStream;
     char *directory = NULL;
     xmlChar *uri;
 
-    ctxt = xmlNewParserCtxt();
+    ctxt = xmlNewSAXParserCtxt(sax, userData);
     if (ctxt == NULL) {
        return(NULL);
     }
@@ -13957,11 +13587,7 @@ xmlCreateEntityParserCtxtInternal(const xmlChar *URL, const xmlChar *ID,
     if (pctx != NULL) {
         ctxt->options = pctx->options;
         ctxt->_private = pctx->_private;
-       /*
-        * this is a subparser of pctx, so the input_id should be
-        * incremented to distinguish from main entity
-        */
-       ctxt->input_id = pctx->input_id + 1;
+       ctxt->input_id = pctx->input_id;
     }
 
     /* Don't read from stdin. */
@@ -14017,7 +13643,7 @@ xmlCreateEntityParserCtxtInternal(const xmlChar *URL, const xmlChar *ID,
 xmlParserCtxtPtr
 xmlCreateEntityParserCtxt(const xmlChar *URL, const xmlChar *ID,
                          const xmlChar *base) {
-    return xmlCreateEntityParserCtxtInternal(URL, ID, base, NULL);
+    return xmlCreateEntityParserCtxtInternal(NULL, NULL, URL, ID, base, NULL);
 
 }
 
@@ -14095,6 +13721,8 @@ xmlCreateFileParserCtxt(const char *filename)
  *             documents
  * @data:  the userdata
  *
+ * DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadFile.
+ *
  * parse an XML file and build a tree. Automatic support for ZLIB/Compress
  * compressed document is provided by default if found at compile-time.
  * It use the given SAX function block to handle the parsing callback.
@@ -14163,6 +13791,8 @@ xmlSAXParseFileWithData(xmlSAXHandlerPtr sax, const char *filename,
  * @recovery:  work in recovery mode, i.e. tries to read no Well Formed
  *             documents
  *
+ * DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadFile.
+ *
  * parse an XML file and build a tree. Automatic support for ZLIB/Compress
  * compressed document is provided by default if found at compile-time.
  * It use the given SAX function block to handle the parsing callback.
@@ -14181,6 +13811,8 @@ xmlSAXParseFile(xmlSAXHandlerPtr sax, const char *filename,
  * xmlRecoverDoc:
  * @cur:  a pointer to an array of xmlChar
  *
+ * DEPRECATED: Use xmlReadDoc with XML_PARSE_RECOVER.
+ *
  * parse an XML in-memory document and build a tree.
  * In the case the document is not Well Formed, a attempt to build a
  * tree is tried anyway
@@ -14197,6 +13829,8 @@ xmlRecoverDoc(const xmlChar *cur) {
  * xmlParseFile:
  * @filename:  the filename
  *
+ * DEPRECATED: Use xmlReadFile.
+ *
  * parse an XML file and build a tree. Automatic support for ZLIB/Compress
  * compressed document is provided by default if found at compile-time.
  *
@@ -14213,6 +13847,8 @@ xmlParseFile(const char *filename) {
  * xmlRecoverFile:
  * @filename:  the filename
  *
+ * DEPRECATED: Use xmlReadFile with XML_PARSE_RECOVER.
+ *
  * parse an XML file and build a tree. Automatic support for ZLIB/Compress
  * compressed document is provided by default if found at compile-time.
  * In the case the document is not Well Formed, it attempts to build
@@ -14233,6 +13869,8 @@ xmlRecoverFile(const char *filename) {
  * @buffer:  a xmlChar * buffer
  * @filename:  a file name
  *
+ * DEPRECATED: Don't use.
+ *
  * Setup the parser context to parse a new buffer; Clears any prior
  * contents from the parser context. The buffer parameter must not be
  * NULL, but the filename parameter can be
@@ -14268,6 +13906,8 @@ xmlSetupParserForBuffer(xmlParserCtxtPtr ctxt, const xmlChar* buffer,
  * @user_data:  The user data returned on SAX callbacks
  * @filename:  a file name
  *
+ * DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadFile.
+ *
  * parse an XML file and call the given SAX handler routines.
  * Automatic support for ZLIB/Compress compressed document is provided
  *
@@ -14341,7 +13981,6 @@ xmlCreateMemoryParserCtxt(const char *buffer, int size) {
     if (ctxt == NULL)
        return(NULL);
 
-    /* TODO: xmlParserInputBufferCreateStatic, requires some serious changes */
     buf = xmlParserInputBufferCreateMem(buffer, size, XML_CHAR_ENCODING_NONE);
     if (buf == NULL) {
        xmlFreeParserCtxt(ctxt);
@@ -14373,6 +14012,8 @@ xmlCreateMemoryParserCtxt(const char *buffer, int size) {
  *             documents
  * @data:  the userdata
  *
+ * DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadMemory.
+ *
  * parse an XML in-memory block and use the given SAX function block
  * to handle the parsing callback. If sax is NULL, fallback to the default
  * DOM tree building routines.
@@ -14428,6 +14069,8 @@ xmlSAXParseMemoryWithData(xmlSAXHandlerPtr sax, const char *buffer,
  * @recovery:  work in recovery mode, i.e. tries to read not Well Formed
  *             documents
  *
+ * DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadMemory.
+ *
  * parse an XML in-memory block and use the given SAX function block
  * to handle the parsing callback. If sax is NULL, fallback to the default
  * DOM tree building routines.
@@ -14445,6 +14088,8 @@ xmlSAXParseMemory(xmlSAXHandlerPtr sax, const char *buffer,
  * @buffer:  an pointer to a char array
  * @size:  the size of the array
  *
+ * DEPRECATED: Use xmlReadMemory.
+ *
  * parse an XML in-memory block and build a tree.
  *
  * Returns the resulting document tree
@@ -14459,6 +14104,8 @@ xmlDocPtr xmlParseMemory(const char *buffer, int size) {
  * @buffer:  an pointer to a char array
  * @size:  the size of the array
  *
+ * DEPRECATED: Use xmlReadMemory with XML_PARSE_RECOVER.
+ *
  * parse an XML in-memory block and build a tree.
  * In the case the document is not Well Formed, an attempt to
  * build a tree is tried anyway
@@ -14477,7 +14124,8 @@ xmlDocPtr xmlRecoverMemory(const char *buffer, int size) {
  * @buffer:  an in-memory XML document input
  * @size:  the length of the XML document in bytes
  *
- * A better SAX parsing routine.
+ * DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadMemory.
+ *
  * parse an XML in-memory buffer and call the given SAX handler routines.
  *
  * Returns 0 in case of success or a error number otherwise
@@ -14547,6 +14195,8 @@ xmlCreateDocParserCtxt(const xmlChar *cur) {
  * @recovery:  work in recovery mode, i.e. tries to read no Well Formed
  *             documents
  *
+ * DEPRECATED: Use xmlNewSAXParserCtxt and xmlCtxtReadDoc.
+ *
  * parse an XML in-memory document and build a tree.
  * It use the given SAX function block to handle the parsing callback.
  * If sax is NULL, fallback to the default DOM tree building routines.
@@ -14590,6 +14240,8 @@ xmlSAXParseDoc(xmlSAXHandlerPtr sax, const xmlChar *cur, int recovery) {
  * xmlParseDoc:
  * @cur:  a pointer to an array of xmlChar
  *
+ * DEPRECATED: Use xmlReadDoc.
+ *
  * parse an XML in-memory document and build a tree.
  *
  * Returns the resulting document tree
@@ -14648,11 +14300,6 @@ xmlSetEntityReferenceFunc(xmlEntityReferenceFunc func)
  *                                                                     *
  ************************************************************************/
 
-#ifdef LIBXML_XPATH_ENABLED
-#include <libxml/xpath.h>
-#endif
-
-extern void XMLCDECL xmlGenericErrorDefaultFunc(void *ctx, const char *msg, ...);
 static int xmlParserInitialized = 0;
 
 /**
@@ -14665,37 +14312,32 @@ static int xmlParserInitialized = 0;
 
 void
 xmlInitParser(void) {
+    /*
+     * Note that the initialization code must not make memory allocations.
+     */
     if (xmlParserInitialized != 0)
        return;
 
-#if defined(_WIN32) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
-    if (xmlFree == free)
-        atexit(xmlCleanupParser);
-#endif
-
 #ifdef LIBXML_THREAD_ENABLED
     __xmlGlobalInitMutexLock();
     if (xmlParserInitialized == 0) {
 #endif
-       xmlInitThreads();
-       xmlInitGlobals();
-       if ((xmlGenericError == xmlGenericErrorDefaultFunc) ||
-           (xmlGenericError == NULL))
-           initGenericErrorDefaultFunc(NULL);
-       xmlInitMemory();
-        xmlInitializeDict();
-       xmlInitCharEncodingHandlers();
-       xmlDefaultSAXHandlerInit();
+#if defined(_WIN32) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
+        if (xmlFree == free)
+            atexit(xmlCleanupParser);
+#endif
+
+       xmlInitThreadsInternal();
+       xmlInitGlobalsInternal();
+       xmlInitMemoryInternal();
+        __xmlInitializeDict();
+       xmlInitEncodingInternal();
        xmlRegisterDefaultInputCallbacks();
 #ifdef LIBXML_OUTPUT_ENABLED
        xmlRegisterDefaultOutputCallbacks();
 #endif /* LIBXML_OUTPUT_ENABLED */
-#ifdef LIBXML_HTML_ENABLED
-       htmlInitAutoClose();
-       htmlDefaultSAXHandlerInit();
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-       xmlXPathInit();
+#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
+       xmlInitXPathInternal();
 #endif
        xmlParserInitialized = 1;
 #ifdef LIBXML_THREAD_ENABLED
@@ -14735,7 +14377,7 @@ xmlCleanupParser(void) {
 #ifdef LIBXML_CATALOG_ENABLED
     xmlCatalogCleanup();
 #endif
-    xmlDictCleanup();
+    xmlCleanupDictInternal();
     xmlCleanupInputCallbacks();
 #ifdef LIBXML_OUTPUT_ENABLED
     xmlCleanupOutputCallbacks();
@@ -14744,9 +14386,9 @@ xmlCleanupParser(void) {
     xmlSchemaCleanupTypes();
     xmlRelaxNGCleanupTypes();
 #endif
-    xmlCleanupGlobals();
-    xmlCleanupThreads(); /* must be last if called not from the main thread */
-    xmlCleanupMemory();
+    xmlCleanupGlobalsInternal();
+    xmlCleanupThreadsInternal();
+    xmlCleanupMemoryInternal();
     xmlParserInitialized = 0;
 }
 
@@ -14855,12 +14497,12 @@ xmlCtxtReset(xmlParserCtxtPtr ctxt)
 #endif
     ctxt->record_info = 0;
     ctxt->checkIndex = 0;
+    ctxt->endCheckState = 0;
     ctxt->inSubset = 0;
     ctxt->errNo = XML_ERR_OK;
     ctxt->depth = 0;
     ctxt->charset = XML_CHAR_ENCODING_UTF8;
     ctxt->catalogs = NULL;
-    ctxt->nbentities = 0;
     ctxt->sizeentities = 0;
     ctxt->sizeentcopy = 0;
     xmlInitNodeInfoSeq(&ctxt->node_seq);
@@ -14878,6 +14520,8 @@ xmlCtxtReset(xmlParserCtxtPtr ctxt)
     if (ctxt->catalogs != NULL)
        xmlCatalogFreeLocal(ctxt->catalogs);
 #endif
+    ctxt->nbErrors = 0;
+    ctxt->nbWarnings = 0;
     if (ctxt->lastError.code != XML_ERR_OK)
         xmlResetError(&ctxt->lastError);
 }
@@ -15156,6 +14800,12 @@ xmlDoRead(xmlParserCtxtPtr ctxt, const char *URL, const char *encoding,
     if (encoding != NULL) {
         xmlCharEncodingHandlerPtr hdlr;
 
+        /*
+         * TODO: We should consider to set XML_PARSE_IGNORE_ENC if the
+         * caller provided an encoding. Otherwise, we might switch to
+         * the encoding from the XML declaration which is likely to
+         * break things. Also see xmlSwitchInputEncoding.
+         */
        hdlr = xmlFindCharEncodingHandler(encoding);
        if (hdlr != NULL)
            xmlSwitchToEncoding(ctxt, hdlr);
index 31d9468..7233d18 100644 (file)
 #define END(ctxt) ctxt->input->end
 #define VALID_CTXT(ctxt) (CUR(ctxt) <= END(ctxt))
 
-#include "buf.h"
-#include "enc.h"
+#include "private/buf.h"
+#include "private/enc.h"
+#include "private/error.h"
+#include "private/io.h"
+#include "private/parser.h"
 
 /*
  * Various global defaults for parsing
@@ -59,7 +62,7 @@
  */
 void
 xmlCheckVersion(int version) {
-    int myversion = (int) LIBXML_VERSION;
+    int myversion = LIBXML_VERSION;
 
     xmlInitParser();
 
@@ -245,9 +248,9 @@ void check_buffer(xmlParserInputPtr in) {
         xmlGenericError(xmlGenericErrorContext,
                "xmlParserInput: cur > base + use problem\n");
     }
-    xmlGenericError(xmlGenericErrorContext,"buffer %x : content %x, cur %d, use %d\n",
-            (int) in, (int) xmlBufContent(in->buf->buffer), in->cur - in->base,
-           xmlBufUse(in->buf->buffer));
+    xmlGenericError(xmlGenericErrorContext,"buffer %p : content %x, cur %d, use %d\n",
+            (void *) in, (int) xmlBufContent(in->buf->buffer),
+            in->cur - in->base, xmlBufUse(in->buf->buffer));
 }
 
 #else
@@ -256,11 +259,46 @@ void check_buffer(xmlParserInputPtr in) {
 
 
 /**
+ * xmlHaltParser:
+ * @ctxt:  an XML parser context
+ *
+ * Blocks further parser processing don't override error
+ * for internal use
+ */
+void
+xmlHaltParser(xmlParserCtxtPtr ctxt) {
+    if (ctxt == NULL)
+        return;
+    ctxt->instate = XML_PARSER_EOF;
+    ctxt->disableSAX = 1;
+    while (ctxt->inputNr > 1)
+        xmlFreeInputStream(inputPop(ctxt));
+    if (ctxt->input != NULL) {
+        /*
+        * in case there was a specific allocation deallocate before
+        * overriding base
+        */
+        if (ctxt->input->free != NULL) {
+           ctxt->input->free((xmlChar *) ctxt->input->base);
+           ctxt->input->free = NULL;
+       }
+        if (ctxt->input->buf != NULL) {
+            xmlFreeParserInputBuffer(ctxt->input->buf);
+            ctxt->input->buf = NULL;
+        }
+       ctxt->input->cur = BAD_CAST"";
+        ctxt->input->length = 0;
+       ctxt->input->base = ctxt->input->cur;
+        ctxt->input->end = ctxt->input->cur;
+    }
+}
+
+/**
  * xmlParserInputRead:
  * @in:  an XML parser input
  * @len:  an indicative size for the lookahead
  *
- * This function was internal and is deprecated.
+ * DEPRECATED: This function was internal and is deprecated.
  *
  * Returns -1 as this is an error to use it.
  */
@@ -270,10 +308,56 @@ xmlParserInputRead(xmlParserInputPtr in ATTRIBUTE_UNUSED, int len ATTRIBUTE_UNUS
 }
 
 /**
+ * xmlParserGrow:
+ * @ctxt:  an XML parser context
+ */
+int
+xmlParserGrow(xmlParserCtxtPtr ctxt) {
+    xmlParserInputPtr in = ctxt->input;
+    xmlParserInputBufferPtr buf = in->buf;
+    ptrdiff_t curEnd = in->end - in->cur;
+    ptrdiff_t curBase = in->cur - in->base;
+    int ret;
+
+    if (buf == NULL)
+        return(0);
+    /* Don't grow push parser buffer. */
+    if (ctxt->progressive)
+        return(0);
+    /* Don't grow memory buffers. */
+    if ((buf->encoder == NULL) && (buf->readcallback == NULL))
+        return(0);
+
+    if (((curEnd > XML_MAX_LOOKUP_LIMIT) ||
+         (curBase > XML_MAX_LOOKUP_LIMIT)) &&
+        ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+        xmlErrInternal(ctxt, "Huge input lookup", NULL);
+        xmlHaltParser(ctxt);
+       return(-1);
+    }
+
+    if (curEnd >= INPUT_CHUNK)
+        return(0);
+
+    ret = xmlParserInputBufferGrow(buf, INPUT_CHUNK);
+    xmlBufSetInputBaseCur(buf->buffer, in, 0, curBase);
+
+    /* TODO: Get error code from xmlParserInputBufferGrow */
+    if (ret < 0) {
+        xmlErrInternal(ctxt, "Growing input buffer", NULL);
+        xmlHaltParser(ctxt);
+    }
+
+    return(ret);
+}
+
+/**
  * xmlParserInputGrow:
  * @in:  an XML parser input
  * @len:  an indicative size for the lookahead
  *
+ * DEPRECATED: Don't use.
+ *
  * This function increase the input for the parser. It tries to
  * preserve pointers to the input buffer, and keep already read data
  *
@@ -294,6 +378,10 @@ xmlParserInputGrow(xmlParserInputPtr in, int len) {
     if (in->cur == NULL) return(-1);
     if (in->buf->buffer == NULL) return(-1);
 
+    /* Don't grow memory buffers. */
+    if ((in->buf->encoder == NULL) && (in->buf->readcallback == NULL))
+        return(0);
+
     CHECK_BUFFER(in);
 
     indx = in->cur - in->base;
@@ -303,12 +391,15 @@ xmlParserInputGrow(xmlParserInputPtr in, int len) {
 
         return(0);
     }
-    if (in->buf->readcallback != NULL) {
-       ret = xmlParserInputBufferGrow(in->buf, len);
-    } else
-        return(0);
+    ret = xmlParserInputBufferGrow(in->buf, len);
 
     in->base = xmlBufContent(in->buf->buffer);
+    if (in->base == NULL) {
+        in->base = BAD_CAST "";
+        in->cur = in->base;
+        in->end = in->base;
+        return(-1);
+    }
     in->cur = in->base + indx;
     in->end = xmlBufEnd(in->buf->buffer);
 
@@ -318,9 +409,48 @@ xmlParserInputGrow(xmlParserInputPtr in, int len) {
 }
 
 /**
+ * xmlParserShrink:
+ * @ctxt:  an XML parser context
+ */
+void
+xmlParserShrink(xmlParserCtxtPtr ctxt) {
+    xmlParserInputPtr in = ctxt->input;
+    xmlParserInputBufferPtr buf = in->buf;
+    size_t used;
+
+    /* Don't shrink pull parser memory buffers. */
+    if ((buf == NULL) ||
+        ((ctxt->progressive == 0) &&
+         (buf->encoder == NULL) && (buf->readcallback == NULL)))
+        return;
+
+    used = in->cur - in->base;
+    /*
+     * Do not shrink on large buffers whose only a tiny fraction
+     * was consumed
+     */
+    if (used > INPUT_CHUNK) {
+       size_t res = xmlBufShrink(buf->buffer, used - LINE_LEN);
+
+       if (res > 0) {
+            used -= res;
+            if ((res > ULONG_MAX) ||
+                (in->consumed > ULONG_MAX - (unsigned long)res))
+                in->consumed = ULONG_MAX;
+            else
+                in->consumed += res;
+       }
+    }
+
+    xmlBufSetInputBaseCur(buf->buffer, in, 0, used);
+}
+
+/**
  * xmlParserInputShrink:
  * @in:  an XML parser input
  *
+ * DEPRECATED: Don't use.
+ *
  * This function removes used input for the parser.
  */
 void
@@ -348,7 +478,11 @@ xmlParserInputShrink(xmlParserInputPtr in) {
        ret = xmlBufShrink(in->buf->buffer, used - LINE_LEN);
        if (ret > 0) {
             used -= ret;
-           in->consumed += ret;
+            if ((ret > ULONG_MAX) ||
+                (in->consumed > ULONG_MAX - (unsigned long)ret))
+                in->consumed = ULONG_MAX;
+            else
+                in->consumed += ret;
        }
     }
 
@@ -357,6 +491,13 @@ xmlParserInputShrink(xmlParserInputPtr in) {
     }
 
     in->base = xmlBufContent(in->buf->buffer);
+    if (in->base == NULL) {
+        /* TODO: raise error */
+        in->base = BAD_CAST "";
+        in->cur = in->base;
+        in->end = in->base;
+        return;
+    }
     in->cur = in->base + used;
     in->end = xmlBufEnd(in->buf->buffer);
 
@@ -373,6 +514,8 @@ xmlParserInputShrink(xmlParserInputPtr in) {
  * xmlNextChar:
  * @ctxt:  the XML parser context
  *
+ * DEPRECATED: Internal function, do not use.
+ *
  * Skip to the next char input char.
  */
 
@@ -390,9 +533,11 @@ xmlNextChar(xmlParserCtxtPtr ctxt)
        return;
     }
 
-    if ((*ctxt->input->cur == 0) &&
-        (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) {
-        return;
+    if (ctxt->input->end - ctxt->input->cur < INPUT_CHUNK) {
+        if (xmlParserGrow(ctxt) < 0)
+            return;
+        if (ctxt->input->cur >= ctxt->input->end)
+            return;
     }
 
     if (ctxt->charset == XML_CHAR_ENCODING_UTF8) {
@@ -425,30 +570,23 @@ xmlNextChar(xmlParserCtxtPtr ctxt)
 
         c = *cur;
         if (c & 0x80) {
+            size_t avail;
+
             if (c == 0xC0)
                goto encoding_error;
-            if (cur[1] == 0) {
-                xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
-                cur = ctxt->input->cur;
-            }
-            if ((cur[1] & 0xc0) != 0x80)
+
+            avail = ctxt->input->end - ctxt->input->cur;
+
+            if ((avail < 2) || (cur[1] & 0xc0) != 0x80)
                 goto encoding_error;
             if ((c & 0xe0) == 0xe0) {
                 unsigned int val;
 
-                if (cur[2] == 0) {
-                    xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
-                    cur = ctxt->input->cur;
-                }
-                if ((cur[2] & 0xc0) != 0x80)
+                if ((avail < 3) || (cur[2] & 0xc0) != 0x80)
                     goto encoding_error;
                 if ((c & 0xf0) == 0xf0) {
-                    if (cur[3] == 0) {
-                        xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
-                        cur = ctxt->input->cur;
-                    }
                     if (((c & 0xf8) != 0xf0) ||
-                        ((cur[3] & 0xc0) != 0x80))
+                        (avail < 4) || ((cur[3] & 0xc0) != 0x80))
                         goto encoding_error;
                     /* 4-byte code */
                     ctxt->input->cur += 4;
@@ -489,8 +627,6 @@ xmlNextChar(xmlParserCtxtPtr ctxt)
             ctxt->input->col++;
         ctxt->input->cur++;
     }
-    if (*ctxt->input->cur == 0)
-        xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
     return;
 encoding_error:
     /*
@@ -525,6 +661,8 @@ encoding_error:
  * @ctxt:  the XML parser context
  * @len:  pointer to the length of the char read
  *
+ * DEPRECATED: Internal function, do not use.
+ *
  * The current char value, if using UTF-8 this may actually span multiple
  * bytes in the input buffer. Implement the end of line normalization:
  * 2.11 End-of-Line Handling
@@ -544,9 +682,13 @@ xmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
     if (ctxt->instate == XML_PARSER_EOF)
        return(0);
 
+    if ((ctxt->input->end - ctxt->input->cur < INPUT_CHUNK) &&
+        (xmlParserGrow(ctxt) < 0))
+        return(0);
+
     if ((*ctxt->input->cur >= 0x20) && (*ctxt->input->cur <= 0x7F)) {
            *len = 1;
-           return((int) *ctxt->input->cur);
+           return(*ctxt->input->cur);
     }
     if (ctxt->charset == XML_CHAR_ENCODING_UTF8) {
        /*
@@ -566,26 +708,25 @@ xmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
 
        c = *cur;
        if (c & 0x80) {
+            size_t avail;
+
            if (((c & 0x40) == 0) || (c == 0xC0))
                goto encoding_error;
-           if (cur[1] == 0) {
-               xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
-                cur = ctxt->input->cur;
-            }
+
+            avail = ctxt->input->end - ctxt->input->cur;
+
+            if (avail < 2)
+                goto incomplete_sequence;
            if ((cur[1] & 0xc0) != 0x80)
                goto encoding_error;
            if ((c & 0xe0) == 0xe0) {
-               if (cur[2] == 0) {
-                   xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
-                    cur = ctxt->input->cur;
-                }
+                if (avail < 3)
+                    goto incomplete_sequence;
                if ((cur[2] & 0xc0) != 0x80)
                    goto encoding_error;
                if ((c & 0xf0) == 0xf0) {
-                   if (cur[3] == 0) {
-                       xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
-                        cur = ctxt->input->cur;
-                    }
+                    if (avail < 4)
+                        goto incomplete_sequence;
                    if (((c & 0xf8) != 0xf0) ||
                        ((cur[3] & 0xc0) != 0x80))
                        goto encoding_error;
@@ -622,8 +763,6 @@ xmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
        } else {
            /* 1-byte code */
            *len = 1;
-           if (*ctxt->input->cur == 0)
-               xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
            if ((*ctxt->input->cur == 0) &&
                (ctxt->input->end > ctxt->input->cur)) {
                xmlErrEncodingInt(ctxt, XML_ERR_INVALID_CHAR,
@@ -635,7 +774,7 @@ xmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
                }
                return(0xA);
            }
-           return((int) *ctxt->input->cur);
+           return(*ctxt->input->cur);
        }
     }
     /*
@@ -650,18 +789,9 @@ xmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
        }
        return(0xA);
     }
-    return((int) *ctxt->input->cur);
-encoding_error:
-    /*
-     * An encoding problem may arise from a truncated input buffer
-     * splitting a character in the middle. In that case do not raise
-     * an error but return 0 to indicate an end of stream problem
-     */
-    if (ctxt->input->end - ctxt->input->cur < 4) {
-       *len = 0;
-       return(0);
-    }
+    return(*ctxt->input->cur);
 
+encoding_error:
     /*
      * If we detect an UTF8 error that probably mean that the
      * input encoding didn't get properly advertised in the
@@ -669,7 +799,11 @@ encoding_error:
      * to ISO-Latin-1 (if you don't like this policy, just declare the
      * encoding !)
      */
-    {
+    if (ctxt->input->end - ctxt->input->cur < 4) {
+       __xmlErrEncoding(ctxt, XML_ERR_INVALID_CHAR,
+                    "Input is not proper UTF-8, indicate encoding !\n",
+                    NULL, NULL);
+    } else {
         char buffer[150];
 
        snprintf(&buffer[0], 149, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
@@ -681,7 +815,17 @@ encoding_error:
     }
     ctxt->charset = XML_CHAR_ENCODING_8859_1;
     *len = 1;
-    return((int) *ctxt->input->cur);
+    return(*ctxt->input->cur);
+
+incomplete_sequence:
+    /*
+     * An encoding problem may arise from a truncated input buffer
+     * splitting a character in the middle. In that case do not raise
+     * an error but return 0. This should only happen when push parsing
+     * char data.
+     */
+    *len = 0;
+    return(0);
 }
 
 /**
@@ -690,6 +834,8 @@ encoding_error:
  * @cur:  pointer to the beginning of the char
  * @len:  pointer to the length of the char read
  *
+ * DEPRECATED: Internal function, do not use.
+ *
  * The current char value, if using UTF-8 this may actually span multiple
  * bytes in the input buffer.
  *
@@ -753,7 +899,7 @@ xmlStringCurrentChar(xmlParserCtxtPtr ctxt, const xmlChar * cur, int *len)
         } else {
             /* 1-byte code */
             *len = 1;
-            return ((int) *cur);
+            return (*cur);
         }
     }
     /*
@@ -762,7 +908,7 @@ xmlStringCurrentChar(xmlParserCtxtPtr ctxt, const xmlChar * cur, int *len)
      * XML constructs only use < 128 chars
      */
     *len = 1;
-    return ((int) *cur);
+    return (*cur);
 encoding_error:
 
     /*
@@ -793,7 +939,7 @@ encoding_error:
                     BAD_CAST buffer, NULL);
     }
     *len = 1;
-    return ((int) *cur);
+    return (*cur);
 }
 
 /**
@@ -807,7 +953,7 @@ encoding_error:
  */
 int
 xmlCopyCharMultiByte(xmlChar *out, int val) {
-    if (out == NULL) return(0);
+    if ((out == NULL) || (val < 0)) return(0);
     /*
      * We are supposed to handle UTF8, check it's valid
      * From rfc2044: encoding of the Unicode values on UTF-8:
@@ -833,7 +979,7 @@ xmlCopyCharMultiByte(xmlChar *out, int val) {
            *out++= ((val >> bits) & 0x3F) | 0x80 ;
        return (out - savedout);
     }
-    *out = (xmlChar) val;
+    *out = val;
     return 1;
 }
 
@@ -850,12 +996,12 @@ xmlCopyCharMultiByte(xmlChar *out, int val) {
 
 int
 xmlCopyChar(int len ATTRIBUTE_UNUSED, xmlChar *out, int val) {
-    if (out == NULL) return(0);
+    if ((out == NULL) || (val < 0)) return(0);
     /* the len parameter is ignored */
     if  (val >= 0x80) {
        return(xmlCopyCharMultiByte (out, val));
     }
-    *out = (xmlChar) val;
+    *out = val;
     return 1;
 }
 
@@ -865,9 +1011,63 @@ xmlCopyChar(int len ATTRIBUTE_UNUSED, xmlChar *out, int val) {
  *                                                                     *
  ************************************************************************/
 
-static int
-xmlSwitchInputEncodingInt(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
-                          xmlCharEncodingHandlerPtr handler, int len);
+static xmlCharEncodingHandlerPtr
+xmlDetectEBCDIC(xmlParserInputPtr input) {
+    xmlChar out[200];
+    xmlCharEncodingHandlerPtr handler;
+    int inlen, outlen, res, i;
+
+    /*
+     * To detect the EBCDIC code page, we convert the first 200 bytes
+     * to EBCDIC-US and try to find the encoding declaration.
+     */
+    handler = xmlGetCharEncodingHandler(XML_CHAR_ENCODING_EBCDIC);
+    if (handler == NULL)
+        return(NULL);
+    outlen = sizeof(out) - 1;
+    inlen = input->end - input->cur;
+    res = xmlEncInputChunk(handler, out, &outlen, input->cur, &inlen, 0);
+    if (res < 0)
+        return(handler);
+    out[outlen] = 0;
+
+    for (i = 0; i < outlen; i++) {
+        if (out[i] == '>')
+            break;
+        if ((out[i] == 'e') &&
+            (xmlStrncmp(out + i, BAD_CAST "encoding", 8) == 0)) {
+            int start, cur, quote;
+
+            i += 8;
+            while (IS_BLANK_CH(out[i]))
+                i += 1;
+            if (out[i++] != '=')
+                break;
+            while (IS_BLANK_CH(out[i]))
+                i += 1;
+            quote = out[i++];
+            if ((quote != '\'') && (quote != '"'))
+                break;
+            start = i;
+            cur = out[i];
+            while (((cur >= 'a') && (cur <= 'z')) ||
+                   ((cur >= 'A') && (cur <= 'Z')) ||
+                   ((cur >= '0') && (cur <= '9')) ||
+                   (cur == '.') || (cur == '_') ||
+                   (cur == '-'))
+                cur = out[++i];
+            if (cur != quote)
+                break;
+            out[i] = 0;
+            xmlCharEncCloseFunc(handler);
+            handler = xmlFindCharEncodingHandler((char *) out + start);
+            break;
+        }
+    }
+
+    return(handler);
+}
+
 /**
  * xmlSwitchEncoding:
  * @ctxt:  the parser context
@@ -882,10 +1082,36 @@ int
 xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
 {
     xmlCharEncodingHandlerPtr handler;
-    int len = -1;
     int ret;
 
     if (ctxt == NULL) return(-1);
+
+    /*
+     * FIXME: The BOM shouldn't be skipped here, but in the parsing code.
+     *
+     * Note that we look for a decoded UTF-8 BOM when switching to UTF-16.
+     * This is mostly useless but Webkit/Chromium relies on this behavior.
+     * See https://bugs.chromium.org/p/chromium/issues/detail?id=1451026
+     */
+    if ((ctxt->input != NULL) &&
+        (ctxt->input->consumed == 0) &&
+        (ctxt->input->cur != NULL) &&
+        (ctxt->input->cur == ctxt->input->base) &&
+        ((enc == XML_CHAR_ENCODING_UTF8) ||
+         (enc == XML_CHAR_ENCODING_UTF16LE) ||
+         (enc == XML_CHAR_ENCODING_UTF16BE))) {
+        /*
+         * Errata on XML-1.0 June 20 2001
+         * Specific handling of the Byte Order Mark for
+         * UTF-8
+         */
+        if ((ctxt->input->cur[0] == 0xEF) &&
+            (ctxt->input->cur[1] == 0xBB) &&
+            (ctxt->input->cur[2] == 0xBF)) {
+            ctxt->input->cur += 3;
+        }
+    }
+
     switch (enc) {
        case XML_CHAR_ENCODING_ERROR:
            __xmlErrEncoding(ctxt, XML_ERR_UNKNOWN_ENCODING,
@@ -898,64 +1124,14 @@ xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
        case XML_CHAR_ENCODING_UTF8:
            /* default encoding, no conversion should be needed */
            ctxt->charset = XML_CHAR_ENCODING_UTF8;
-
-           /*
-            * Errata on XML-1.0 June 20 2001
-            * Specific handling of the Byte Order Mark for
-            * UTF-8
-            */
-           if ((ctxt->input != NULL) &&
-               (ctxt->input->cur[0] == 0xEF) &&
-               (ctxt->input->cur[1] == 0xBB) &&
-               (ctxt->input->cur[2] == 0xBF)) {
-               ctxt->input->cur += 3;
-           }
            return(0);
-    case XML_CHAR_ENCODING_UTF16LE:
-    case XML_CHAR_ENCODING_UTF16BE:
-        /*The raw input characters are encoded
-         *in UTF-16. As we expect this function
-         *to be called after xmlCharEncInFunc, we expect
-         *ctxt->input->cur to contain UTF-8 encoded characters.
-         *So the raw UTF16 Byte Order Mark
-         *has also been converted into
-         *an UTF-8 BOM. Let's skip that BOM.
-         */
-        if ((ctxt->input != NULL) && (ctxt->input->cur != NULL) &&
-            (ctxt->input->cur[0] == 0xEF) &&
-            (ctxt->input->cur[1] == 0xBB) &&
-            (ctxt->input->cur[2] == 0xBF)) {
-            ctxt->input->cur += 3;
-        }
-        len = 90;
-       break;
-    case XML_CHAR_ENCODING_UCS2:
-        len = 90;
-       break;
-    case XML_CHAR_ENCODING_UCS4BE:
-    case XML_CHAR_ENCODING_UCS4LE:
-    case XML_CHAR_ENCODING_UCS4_2143:
-    case XML_CHAR_ENCODING_UCS4_3412:
-        len = 180;
-       break;
-    case XML_CHAR_ENCODING_EBCDIC:
-    case XML_CHAR_ENCODING_8859_1:
-    case XML_CHAR_ENCODING_8859_2:
-    case XML_CHAR_ENCODING_8859_3:
-    case XML_CHAR_ENCODING_8859_4:
-    case XML_CHAR_ENCODING_8859_5:
-    case XML_CHAR_ENCODING_8859_6:
-    case XML_CHAR_ENCODING_8859_7:
-    case XML_CHAR_ENCODING_8859_8:
-    case XML_CHAR_ENCODING_8859_9:
-    case XML_CHAR_ENCODING_ASCII:
-    case XML_CHAR_ENCODING_2022_JP:
-    case XML_CHAR_ENCODING_SHIFT_JIS:
-    case XML_CHAR_ENCODING_EUC_JP:
-        len = 45;
-       break;
-    }
-    handler = xmlGetCharEncodingHandler(enc);
+        case XML_CHAR_ENCODING_EBCDIC:
+            handler = xmlDetectEBCDIC(ctxt->input);
+            break;
+        default:
+            handler = xmlGetCharEncodingHandler(enc);
+            break;
+    }
     if (handler == NULL) {
        /*
         * Default handlers.
@@ -987,7 +1163,7 @@ xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
                 return(-1);
         }
     }
-    ret = xmlSwitchInputEncodingInt(ctxt, ctxt->input, handler, len);
+    ret = xmlSwitchInputEncoding(ctxt, ctxt->input, handler);
     if ((ret < 0) || (ctxt->errNo == XML_I18N_CONV_FAILED)) {
         /*
         * on encoding conversion errors, stop the parser
@@ -999,134 +1175,29 @@ xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
 }
 
 /**
- * xmlSwitchInputEncodingInt:
+ * xmlSwitchInputEncoding:
  * @ctxt:  the parser context
  * @input:  the input stream
  * @handler:  the encoding handler
- * @len:  the number of bytes to convert for the first line or -1
  *
  * change the input functions when discovering the character encoding
  * of a given entity.
  *
  * Returns 0 in case of success, -1 otherwise
  */
-static int
-xmlSwitchInputEncodingInt(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
-                          xmlCharEncodingHandlerPtr handler, int len)
+int
+xmlSwitchInputEncoding(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
+                       xmlCharEncodingHandlerPtr handler)
 {
     int nbchars;
+    xmlParserInputBufferPtr in;
 
     if (handler == NULL)
         return (-1);
     if (input == NULL)
         return (-1);
-    if (input->buf != NULL) {
-       ctxt->charset = XML_CHAR_ENCODING_UTF8;
-
-        if (input->buf->encoder != NULL) {
-            /*
-             * Check in case the auto encoding detection triggered
-             * in already.
-             */
-            if (input->buf->encoder == handler)
-                return (0);
-
-            /*
-             * "UTF-16" can be used for both LE and BE
-             if ((!xmlStrncmp(BAD_CAST input->buf->encoder->name,
-             BAD_CAST "UTF-16", 6)) &&
-             (!xmlStrncmp(BAD_CAST handler->name,
-             BAD_CAST "UTF-16", 6))) {
-             return(0);
-             }
-             */
-
-            /*
-             * Note: this is a bit dangerous, but that's what it
-             * takes to use nearly compatible signature for different
-             * encodings.
-             *
-             * FIXME: Encoders might buffer partial byte sequences, so
-             * this probably can't work. We should return an error and
-             * make sure that callers never try to switch the encoding
-             * twice.
-             */
-            xmlCharEncCloseFunc(input->buf->encoder);
-            input->buf->encoder = handler;
-            return (0);
-        }
-        input->buf->encoder = handler;
-
-        /*
-         * Is there already some content down the pipe to convert ?
-         */
-        if (xmlBufIsEmpty(input->buf->buffer) == 0) {
-            int processed;
-           unsigned int use;
-
-            /*
-             * Specific handling of the Byte Order Mark for
-             * UTF-16
-             */
-            if ((handler->name != NULL) &&
-                (!strcmp(handler->name, "UTF-16LE") ||
-                 !strcmp(handler->name, "UTF-16")) &&
-                (input->cur[0] == 0xFF) && (input->cur[1] == 0xFE)) {
-                input->cur += 2;
-            }
-            if ((handler->name != NULL) &&
-                (!strcmp(handler->name, "UTF-16BE")) &&
-                (input->cur[0] == 0xFE) && (input->cur[1] == 0xFF)) {
-                input->cur += 2;
-            }
-            /*
-             * Errata on XML-1.0 June 20 2001
-             * Specific handling of the Byte Order Mark for
-             * UTF-8
-             */
-            if ((handler->name != NULL) &&
-                (!strcmp(handler->name, "UTF-8")) &&
-                (input->cur[0] == 0xEF) &&
-                (input->cur[1] == 0xBB) && (input->cur[2] == 0xBF)) {
-                input->cur += 3;
-            }
-
-            /*
-             * Shrink the current input buffer.
-             * Move it as the raw buffer and create a new input buffer
-             */
-            processed = input->cur - input->base;
-            xmlBufShrink(input->buf->buffer, processed);
-            input->buf->raw = input->buf->buffer;
-            input->buf->buffer = xmlBufCreate();
-           input->buf->rawconsumed = processed;
-           use = xmlBufUse(input->buf->raw);
-
-            if (ctxt->html) {
-                /*
-                 * convert as much as possible of the buffer
-                 */
-                nbchars = xmlCharEncInput(input->buf, 1);
-            } else {
-                /*
-                 * convert just enough to get
-                 * '<?xml version="1.0" encoding="xxx"?>'
-                 * parsed with the autodetected encoding
-                 * into the parser reading buffer.
-                 */
-                nbchars = xmlCharEncFirstLineInput(input->buf, len);
-            }
-            xmlBufResetInput(input->buf->buffer, input);
-            if (nbchars < 0) {
-                xmlErrInternal(ctxt,
-                               "switching encoding: encoder error\n",
-                               NULL);
-                return (-1);
-            }
-           input->buf->rawconsumed += use - xmlBufUse(input->buf->raw);
-        }
-        return (0);
-    } else {
+    in = input->buf;
+    if (in == NULL) {
        xmlErrInternal(ctxt,
                 "static memory buffer doesn't support encoding\n", NULL);
         /*
@@ -1137,25 +1208,105 @@ xmlSwitchInputEncodingInt(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
         xmlCharEncCloseFunc(handler);
        return (-1);
     }
-}
 
-/**
- * xmlSwitchInputEncoding:
- * @ctxt:  the parser context
- * @input:  the input stream
- * @handler:  the encoding handler
- *
- * DEPRECATED: Use xmlSwitchToEncoding
- *
- * change the input functions when discovering the character encoding
- * of a given entity.
- *
- * Returns 0 in case of success, -1 otherwise
- */
-int
-xmlSwitchInputEncoding(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
-                          xmlCharEncodingHandlerPtr handler) {
-    return(xmlSwitchInputEncodingInt(ctxt, input, handler, -1));
+    if (in->encoder != NULL) {
+        if (in->encoder == handler)
+            return (0);
+
+        /*
+         * Switching encodings during parsing is a really bad idea,
+         * but Chromium can switch between ISO-8859-1 and UTF-16 before
+         * separate calls to xmlParseChunk.
+         *
+         * TODO: We should check whether the "raw" input buffer is empty and
+         * convert the old content using the old encoder.
+         */
+
+        xmlCharEncCloseFunc(in->encoder);
+        in->encoder = handler;
+        return (0);
+    }
+
+    ctxt->charset = XML_CHAR_ENCODING_UTF8;
+    in->encoder = handler;
+
+    /*
+     * Is there already some content down the pipe to convert ?
+     */
+    if (xmlBufIsEmpty(in->buffer) == 0) {
+        size_t processed, use, consumed;
+
+        /*
+         * FIXME: The BOM shouldn't be skipped here, but in the parsing code.
+         */
+
+        /*
+         * Specific handling of the Byte Order Mark for
+         * UTF-16
+         */
+        if ((handler->name != NULL) &&
+            (!strcmp(handler->name, "UTF-16LE") ||
+             !strcmp(handler->name, "UTF-16")) &&
+            (input->cur[0] == 0xFF) && (input->cur[1] == 0xFE)) {
+            input->cur += 2;
+        }
+        if ((handler->name != NULL) &&
+            (!strcmp(handler->name, "UTF-16BE")) &&
+            (input->cur[0] == 0xFE) && (input->cur[1] == 0xFF)) {
+            input->cur += 2;
+        }
+        /*
+         * Errata on XML-1.0 June 20 2001
+         * Specific handling of the Byte Order Mark for
+         * UTF-8
+         */
+        if ((handler->name != NULL) &&
+            (!strcmp(handler->name, "UTF-8")) &&
+            (input->cur[0] == 0xEF) &&
+            (input->cur[1] == 0xBB) && (input->cur[2] == 0xBF)) {
+            input->cur += 3;
+        }
+
+        /*
+         * Shrink the current input buffer.
+         * Move it as the raw buffer and create a new input buffer
+         */
+        processed = input->cur - input->base;
+        xmlBufShrink(in->buffer, processed);
+        input->consumed += processed;
+        in->raw = in->buffer;
+        in->buffer = xmlBufCreate();
+        in->rawconsumed = processed;
+        use = xmlBufUse(in->raw);
+
+        /*
+         * TODO: We must flush and decode the whole buffer to make functions
+         * like xmlReadMemory work with a user-provided encoding. If the
+         * encoding is specified directly, we should probably set
+         * XML_PARSE_IGNORE_ENC in xmlDoRead to avoid switching encodings
+         * twice. Then we could set "flush" to false which should save
+         * a considerable amount of memory when parsing from memory.
+         * It's probably even possible to remove this whole if-block
+         * completely.
+         */
+        nbchars = xmlCharEncInput(in, 1);
+        xmlBufResetInput(in->buffer, input);
+        if (nbchars < 0) {
+            /* TODO: This could be an out of memory or an encoding error. */
+            xmlErrInternal(ctxt,
+                           "switching encoding: encoder error\n",
+                           NULL);
+            xmlHaltParser(ctxt);
+            return (-1);
+        }
+        consumed = use - xmlBufUse(in->raw);
+        if ((consumed > ULONG_MAX) ||
+            (in->rawconsumed > ULONG_MAX - (unsigned long)consumed))
+            in->rawconsumed = ULONG_MAX;
+        else
+           in->rawconsumed += consumed;
+    }
+    return (0);
 }
 
 /**
@@ -1173,7 +1324,7 @@ xmlSwitchToEncoding(xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr handler)
 {
     if (ctxt == NULL)
         return(-1);
-    return(xmlSwitchInputEncodingInt(ctxt, ctxt->input, handler, -1));
+    return(xmlSwitchInputEncoding(ctxt, ctxt->input, handler));
 }
 
 /************************************************************************
@@ -1230,8 +1381,13 @@ xmlNewInputStream(xmlParserCtxtPtr ctxt) {
      * should not happen while parsing which is the situation where
      * the id is actually needed.
      */
-    if (ctxt != NULL)
+    if (ctxt != NULL) {
+        if (input->id >= INT_MAX) {
+            xmlErrMemory(ctxt, "Input ID overflow\n");
+            return(NULL);
+        }
         input->id = ctxt->input_id++;
+    }
 
     return(input);
 }
@@ -1275,6 +1431,8 @@ xmlNewIOInputStream(xmlParserCtxtPtr ctxt, xmlParserInputBufferPtr input,
  * @ctxt:  an XML parser context
  * @entity:  an Entity pointer
  *
+ * DEPRECATED: Internal function, do not use.
+ *
  * Create a new input stream based on an xmlEntityPtr
  *
  * Returns the new input stream or NULL
@@ -1299,8 +1457,11 @@ xmlNewEntityInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) {
                 break;
             case XML_EXTERNAL_GENERAL_PARSED_ENTITY:
             case XML_EXTERNAL_PARAMETER_ENTITY:
-               return(xmlLoadExternalEntity((char *) entity->URI,
-                      (char *) entity->ExternalID, ctxt));
+               input = xmlLoadExternalEntity((char *) entity->URI,
+                      (char *) entity->ExternalID, ctxt);
+                if (input != NULL)
+                    input->entity = entity;
+                return(input);
             case XML_INTERNAL_GENERAL_ENTITY:
                xmlErrInternal(ctxt,
                      "Internal entity %s without content !\n",
@@ -1331,6 +1492,7 @@ xmlNewEntityInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) {
     input->cur = entity->content;
     input->length = entity->length;
     input->end = &entity->content[input->length];
+    input->entity = entity;
     return(input);
 }
 
@@ -1345,6 +1507,7 @@ xmlNewEntityInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) {
 xmlParserInputPtr
 xmlNewStringInputStream(xmlParserCtxtPtr ctxt, const xmlChar *buffer) {
     xmlParserInputPtr input;
+    xmlParserInputBufferPtr buf;
 
     if (buffer == NULL) {
         xmlErrInternal(ctxt, "xmlNewStringInputStream string = NULL\n",
@@ -1354,15 +1517,21 @@ xmlNewStringInputStream(xmlParserCtxtPtr ctxt, const xmlChar *buffer) {
     if (xmlParserDebugEntities)
        xmlGenericError(xmlGenericErrorContext,
                "new fixed input: %.30s\n", buffer);
+    buf = xmlParserInputBufferCreateMem((const char *) buffer,
+                                        xmlStrlen(buffer),
+                                        XML_CHAR_ENCODING_NONE);
+    if (buf == NULL) {
+       xmlErrMemory(ctxt, NULL);
+        return(NULL);
+    }
     input = xmlNewInputStream(ctxt);
     if (input == NULL) {
         xmlErrMemory(ctxt,  "couldn't allocate a new input stream\n");
+       xmlFreeParserInputBuffer(buf);
        return(NULL);
     }
-    input->base = buffer;
-    input->cur = buffer;
-    input->length = xmlStrlen(buffer);
-    input->end = &buffer[input->length];
+    input->buf = buf;
+    xmlBufResetInput(input->buf->buffer, input);
     return(input);
 }
 
@@ -1432,16 +1601,19 @@ xmlNewInputFromFile(xmlParserCtxtPtr ctxt, const char *filename) {
  ************************************************************************/
 
 /**
- * xmlInitParserCtxt:
- * @ctxt:  an XML parser context
+ * xmlInitSAXParserCtxt:
+ * @ctxt:  XML parser context
+ * @sax:  SAX handlert
+ * @userData:  user data
  *
- * Initialize a parser context
+ * Initialize a SAX parser context
  *
  * Returns 0 in case of success and -1 in case of error
  */
 
-int
-xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
+static int
+xmlInitSAXParserCtxt(xmlParserCtxtPtr ctxt, const xmlSAXHandler *sax,
+                     void *userData)
 {
     xmlParserInputPtr input;
 
@@ -1466,8 +1638,19 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
         xmlErrMemory(NULL, "cannot initialize parser context\n");
        return(-1);
     }
-    else
+    if (sax == NULL) {
+       memset(ctxt->sax, 0, sizeof(xmlSAXHandler));
         xmlSAXVersion(ctxt->sax, 2);
+        ctxt->userData = ctxt;
+    } else {
+       if (sax->initialized == XML_SAX2_MAGIC) {
+           memcpy(ctxt->sax, sax, sizeof(xmlSAXHandler));
+        } else {
+           memset(ctxt->sax, 0, sizeof(xmlSAXHandler));
+           memcpy(ctxt->sax, sax, sizeof(xmlSAXHandlerV1));
+        }
+        ctxt->userData = userData ? userData : ctxt;
+    }
 
     ctxt->maxatts = 0;
     ctxt->atts = NULL;
@@ -1565,7 +1748,6 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
     ctxt->spaceMax = 10;
     ctxt->spaceTab[0] = -1;
     ctxt->space = &ctxt->spaceTab[0];
-    ctxt->userData = ctxt;
     ctxt->myDoc = NULL;
     ctxt->wellFormed = 1;
     ctxt->nsWellFormed = 1;
@@ -1609,7 +1791,6 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
     ctxt->depth = 0;
     ctxt->charset = XML_CHAR_ENCODING_UTF8;
     ctxt->catalogs = NULL;
-    ctxt->nbentities = 0;
     ctxt->sizeentities = 0;
     ctxt->sizeentcopy = 0;
     ctxt->input_id = 1;
@@ -1618,6 +1799,24 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
 }
 
 /**
+ * xmlInitParserCtxt:
+ * @ctxt:  an XML parser context
+ *
+ * DEPRECATED: Internal function which will be made private in a future
+ * version.
+ *
+ * Initialize a parser context
+ *
+ * Returns 0 in case of success and -1 in case of error
+ */
+
+int
+xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
+{
+    return(xmlInitSAXParserCtxt(ctxt, NULL, NULL));
+}
+
+/**
  * xmlFreeParserCtxt:
  * @ctxt:  an XML parser context
  *
@@ -1714,6 +1913,23 @@ xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
 xmlParserCtxtPtr
 xmlNewParserCtxt(void)
 {
+    return(xmlNewSAXParserCtxt(NULL, NULL));
+}
+
+/**
+ * xmlNewSAXParserCtxt:
+ * @sax:  SAX handler
+ * @userData:  user data
+ *
+ * Allocate and initialize a new SAX parser context. If userData is NULL,
+ * the parser context will be passed as user data.
+ *
+ * Returns the xmlParserCtxtPtr or NULL if memory allocation failed.
+ */
+
+xmlParserCtxtPtr
+xmlNewSAXParserCtxt(const xmlSAXHandler *sax, void *userData)
+{
     xmlParserCtxtPtr ctxt;
 
     ctxt = (xmlParserCtxtPtr) xmlMalloc(sizeof(xmlParserCtxt));
@@ -1722,7 +1938,7 @@ xmlNewParserCtxt(void)
        return(NULL);
     }
     memset(ctxt, 0, sizeof(xmlParserCtxt));
-    if (xmlInitParserCtxt(ctxt) < 0) {
+    if (xmlInitSAXParserCtxt(ctxt, sax, userData) < 0) {
         xmlFreeParserCtxt(ctxt);
        return(NULL);
     }
@@ -1757,6 +1973,8 @@ xmlClearParserCtxt(xmlParserCtxtPtr ctxt)
  * @ctx:  an XML parser context
  * @node:  an XML node within the tree
  *
+ * DEPRECATED: Don't use.
+ *
  * Find the parser node info struct for a given node
  *
  * Returns an xmlParserNodeInfo block pointer or NULL
@@ -1782,6 +2000,8 @@ xmlParserFindNodeInfo(const xmlParserCtxtPtr ctx, const xmlNodePtr node)
  * xmlInitNodeInfoSeq:
  * @seq:  a node info sequence pointer
  *
+ * DEPRECATED: Don't use.
+ *
  * -- Initialize (set to initial state) node info sequence
  */
 void
@@ -1798,6 +2018,8 @@ xmlInitNodeInfoSeq(xmlParserNodeInfoSeqPtr seq)
  * xmlClearNodeInfoSeq:
  * @seq:  a node info sequence pointer
  *
+ * DEPRECATED: Don't use.
+ *
  * -- Clear (release memory and reinitialize) node
  *   info sequence
  */
@@ -1816,6 +2038,7 @@ xmlClearNodeInfoSeq(xmlParserNodeInfoSeqPtr seq)
  * @seq:  a node info sequence pointer
  * @node:  an XML node pointer
  *
+ * DEPRECATED: Don't use.
  *
  * xmlParserFindNodeInfoIndex : Find the index that the info record for
  *   the given node is or should be at in a sorted sequence
@@ -1859,6 +2082,8 @@ xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
  * @ctxt:  an XML parser context
  * @info:  a node info sequence pointer
  *
+ * DEPRECATED: Don't use.
+ *
  * Insert node info record into the sorted sequence
  */
 void
@@ -1929,6 +2154,8 @@ xmlParserAddNodeInfo(xmlParserCtxtPtr ctxt,
  * xmlPedanticParserDefault:
  * @val:  int 0 or 1
  *
+ * DEPRECATED: Use the modern options API with XML_PARSE_PEDANTIC.
+ *
  * Set and return the previous value for enabling pedantic warnings.
  *
  * Returns the last value for 0 for no substitution, 1 for substitution.
@@ -1946,6 +2173,8 @@ xmlPedanticParserDefault(int val) {
  * xmlLineNumbersDefault:
  * @val:  int 0 or 1
  *
+ * DEPRECATED: The modern options API always enables line numbers.
+ *
  * Set and return the previous value for enabling line numbers in elements
  * contents. This may break on old application and is turned off by default.
  *
@@ -1964,6 +2193,8 @@ xmlLineNumbersDefault(int val) {
  * xmlSubstituteEntitiesDefault:
  * @val:  int 0 or 1
  *
+ * DEPRECATED: Use the modern options API with XML_PARSE_NOENT.
+ *
  * Set and return the previous value for default entity support.
  * Initially the parser always keep entity references instead of substituting
  * entity values in the output. This function has to be used to change the
@@ -1986,6 +2217,8 @@ xmlSubstituteEntitiesDefault(int val) {
  * xmlKeepBlanksDefault:
  * @val:  int 0 or 1
  *
+ * DEPRECATED: Use the modern options API with XML_PARSE_NOBLANKS.
+ *
  * Set and return the previous value for default blanks text nodes support.
  * The 1.x version of the parser used an heuristic to try to detect
  * ignorable white spaces. As a result the SAX callback was generating
index cff4469..04a4eb7 100644 (file)
--- a/pattern.c
+++ b/pattern.c
@@ -2039,22 +2039,12 @@ xmlStreamPushInternal(xmlStreamCtxtPtr stream,
 #endif /* if 0 ------------------------------------------------------- */
            if (match) {
                final = step.flags & XML_STREAM_STEP_FINAL;
-               if (desc) {
-                   if (final) {
-                       ret = 1;
-                   } else {
-                       /* descending match create a new state */
-                       xmlStreamCtxtAddState(stream, stepNr + 1,
-                                             stream->level + 1);
-                   }
-               } else {
-                   if (final) {
-                       ret = 1;
-                   } else {
-                       xmlStreamCtxtAddState(stream, stepNr + 1,
-                                             stream->level + 1);
-                   }
-               }
+                if (final) {
+                    ret = 1;
+                } else {
+                    xmlStreamCtxtAddState(stream, stepNr + 1,
+                                          stream->level + 1);
+                }
                if ((ret != 1) && (step.flags & XML_STREAM_STEP_IN_SET)) {
                    /*
                    * Check if we have a special case like "foo/bar//.", where
@@ -2207,7 +2197,7 @@ stream_next:
 int
 xmlStreamPush(xmlStreamCtxtPtr stream,
               const xmlChar *name, const xmlChar *ns) {
-    return (xmlStreamPushInternal(stream, name, ns, (int) XML_ELEMENT_NODE));
+    return (xmlStreamPushInternal(stream, name, ns, XML_ELEMENT_NODE));
 }
 
 /**
@@ -2257,7 +2247,7 @@ xmlStreamPushNode(xmlStreamCtxtPtr stream,
 int
 xmlStreamPushAttr(xmlStreamCtxtPtr stream,
                  const xmlChar *name, const xmlChar *ns) {
-    return (xmlStreamPushInternal(stream, name, ns, (int) XML_ATTRIBUTE_NODE));
+    return (xmlStreamPushInternal(stream, name, ns, XML_ATTRIBUTE_NODE));
 }
 
 /**
index cc1419a..1773fd3 100644 (file)
@@ -1,9 +1,10 @@
 # Makefile for libxml2 python library
 
-SUBDIRS = . tests
+# We use a rule with multiple output files which creates problems with
+# parallel builds.
+.NOTPARALLEL:
 
-docsdir = $(docdir)/python
-dist_docs_DATA = TODO
+SUBDIRS = . tests
 
 EXTRA_DIST =                   \
        generator.py            \
@@ -20,8 +21,8 @@ pyexec_LTLIBRARIES = libxml2mod.la
 
 libxml2mod_la_SOURCES = libxml.c libxml_wrap.h types.c
 nodist_libxml2mod_la_SOURCES = libxml2-py.h libxml2-py.c
-libxml2mod_la_LDFLAGS = $(CYGWIN_EXTRA_LDFLAGS) $(WIN32_EXTRA_LDFLAGS) -module -avoid-version
-libxml2mod_la_LIBADD = $(top_builddir)/libxml2.la $(CYGWIN_EXTRA_PYTHON_LIBADD) $(WIN32_EXTRA_PYTHON_LIBADD) $(PYTHON_LIBS)
+libxml2mod_la_LDFLAGS = $(AM_LDFLAGS) $(PYTHON_LDFLAGS) -module -avoid-version
+libxml2mod_la_LIBADD = $(top_builddir)/libxml2.la $(PYTHON_LIBS)
 
 BUILT_SOURCES = libxml2-export.c libxml2-py.h libxml2-py.c
 
@@ -44,6 +45,6 @@ libxml2.py: $(srcdir)/libxml.py libxml2class.py
        cat $(srcdir)/libxml.py `test -f libxml2class.py || echo $(srcdir)/`libxml2class.py > $@
 
 clean-local:
-       rm -rf __pycache__
+       rm -rf __pycache__ *.pyc
 
 endif
diff --git a/python/TODO b/python/TODO
deleted file mode 100644 (file)
index 4ea1eb1..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-             TODO for the libxml2 Python wrappers
-
-Things to do:
--------------
-
-- SAX interfaces
-  - push is done but no generic interface
-  - elementDecl need some work
-  - need more testing and check full callbacks for xmllib/sgmlop replacement
-- enums -> libxml.py
-- access to XPath variables
-- xmlBuffer exposure
-- xpathContext, being able to set/get info and clean it up
-- more work needed on context handling for function lookup
-  and use of an hash table.
-- add regression tests
-   - SAX flow
-- DTD element and attributes content accesses
-   - attribute handled in SAX
-   - element needed in both
-
-
-Done:
------
-- class hierarchy:
-  + make specific node type inherit from xmlNode
-    done, had to sort the classes in the output
-  + get the generator to output a classes.txt description
-    done libxml2class.txt
-- add regression tests
-   - tests/Makefile.am: export the Python class path
-   - xpath queries
-   - xpath extension
-   - check memory
-   - build tree
-   - saving
-- extensions based on a python.xml description of the new specific
-  interfaces
-   file libxml2-python-api.xml , first entry is xmlRegisterXPathFunction
-- spec file: automatically generate for pythonX.Y if found
-  Done, a bit ugly by running new makes in %install for each level
-  found.
-- error redirections and preformat
-- handling of node.content
-- access to xmlParserCtxt and push mode
-   - needed for SAX too
-   - entry points
-   - wrappers
-   - decent interface for setting/getting behaviour
-- memory debug interfaces
-- SAX interfaces
-   - basic stuff with push is available
-   - basic xmllib replacement
-
-Daniel Veillard
index 09474fc..3a5db22 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # generate python wrappers from the XML API description
 #
@@ -291,6 +291,13 @@ skip_impl = (
 deprecated_funcs = {
     'htmlDefaultSAXHandlerInit': True,
     'htmlInitAutoClose': True,
+    'htmlParseCharRef': True,
+    'htmlParseElement': True,
+    'namePop': True,
+    'namePush': True,
+    'nodePop': True,
+    'nodePush': True,
+    'xmlCheckLanguageID': True,
     'xmlCleanupCharEncodingHandlers': True,
     'xmlCleanupGlobals': True,
     'xmlDefaultSAXHandlerInit': True,
@@ -310,15 +317,60 @@ deprecated_funcs = {
     'xmlNanoFTPProxy': True,
     'xmlNanoFTPScanProxy': True,
     'xmlNewGlobalNs': True,
+    'xmlNextChar': True,
+    'xmlParseAttValue': True,
+    'xmlParseAttributeListDecl': True,
+    'xmlParseCDSect': True,
+    'xmlParseCharData': True,
+    'xmlParseCharRef': True,
+    'xmlParseComment': True,
+    'xmlParseDocTypeDecl': True,
+    'xmlParseElement': True,
+    'xmlParseElementDecl': True,
+    'xmlParseEncName': True,
+    'xmlParseEncodingDecl': True,
+    'xmlParseEndTag': True,
+    'xmlParseEntity': True,
+    'xmlParseEntityDecl': True,
+    'xmlParseEntityRef': True,
+    'xmlParseMarkupDecl': True,
+    'xmlParseMisc': True,
+    'xmlParseName': True,
     'xmlParseNamespace': True,
+    'xmlParseNmtoken': True,
+    'xmlParseNotationDecl': True,
+    'xmlParsePEReference': True,
+    'xmlParsePI': True,
+    'xmlParsePITarget': True,
+    'xmlParsePubidLiteral': True,
     'xmlParseQuotedString': True,
+    'xmlParseReference': True,
+    'xmlParseSDDecl': True,
+    'xmlParseStartTag': True,
+    'xmlParseSystemLiteral': True,
+    'xmlParseTextDecl': True,
+    'xmlParseVersionInfo': True,
+    'xmlParseVersionNum': True,
+    'xmlParseXMLDecl': True,
+    'xmlParserHandlePEReference': True,
     'xmlParserHandleReference': True,
+    'xmlRecoverDoc': True,
+    'xmlRecoverFile': True,
+    'xmlRecoverMemory': True,
     'xmlRelaxNGCleanupTypes': True,
     'xmlRelaxNGInitTypes': True,
     'xmlRemoveRef': True,
+    'xmlSAXDefaultVersion': True,
     'xmlScanName': True,
     'xmlSchemaCleanupTypes': True,
     'xmlSchemaInitTypes': True,
+    'xmlSetupParserForBuffer': True,
+    'xmlSkipBlankChars': True,
+    'xmlStringDecodeEntities': True,
+    'xmlStringLenDecodeEntities': True,
+    'xmlThrDefDefaultBufferSize': True,
+    'xmlThrDefLineNumbersDefaultValue': True,
+    'xmlThrDefPedanticParserDefaultValue': True,
     'xmlXPathInit': True,
     'xmlXPtrEvalRangePredicate': True,
     'xmlXPtrNewCollapsedRange': True,
@@ -627,12 +679,12 @@ def buildStubs():
     export.close()
     wrapper.close()
 
-    print("Generated %d wrapper functions, %d failed, %d skipped\n" % (nb_wrap,
+    print("Generated %d wrapper functions, %d failed, %d skipped" % (nb_wrap,
                                                               failed, skipped))
-    print("Missing type converters: ")
-    for type in list(unknown_types.keys()):
-        print("%s:%d " % (type, len(unknown_types[type])))
-    print()
+#    print("Missing type converters: ")
+#    for type in list(unknown_types.keys()):
+#        print("%s:%d " % (type, len(unknown_types[type])))
+#    print()
 
 #######################################################################
 #
index e071e82..fb14c7a 100644 (file)
@@ -145,23 +145,13 @@ libxml_xmlDebugMemory(PyObject * self ATTRIBUTE_UNUSED, PyObject * args)
             if ((freeFunc == xmlMemFree) && (mallocFunc == xmlMemMalloc) &&
                 (reallocFunc == xmlMemRealloc) &&
                 (strdupFunc == xmlMemoryStrdup)) {
-                libxmlMemoryAllocatedBase = xmlMemUsed();
             } else {
-                /* 
-                 * cleanup first, because some memory has been
-                 * allocated with the non-debug malloc in xmlInitParser
-                 * when the python module was imported
-                 */
-                xmlCleanupParser();
                 ret = (long) xmlMemSetup(xmlMemFree, xmlMemMalloc,
                                          xmlMemRealloc, xmlMemoryStrdup);
                 if (ret < 0)
                     goto error;
-                libxmlMemoryAllocatedBase = xmlMemUsed();
-                /* reinitialize */
-                xmlInitParser();
-                libxml_xmlErrorInitialize();
             }
+            libxmlMemoryAllocatedBase = xmlMemUsed();
             ret = 0;
         } else if (libxmlMemoryDebugActivated == 0) {
             libxmlMemoryAllocatedBase = xmlMemUsed();
@@ -188,13 +178,7 @@ libxml_xmlPythonCleanupParser(PyObject *self ATTRIBUTE_UNUSED,
                               PyObject *args ATTRIBUTE_UNUSED) {
 
     int ix;
-    long freed = -1;
-
-    if (libxmlMemoryDebug) {
-        freed = xmlMemUsed();
-    }
 
-    xmlCleanupParser();
     /*
      * Need to confirm whether we really want to do this (required for
      * memcheck) in all cases...
@@ -212,12 +196,7 @@ libxml_xmlPythonCleanupParser(PyObject *self ATTRIBUTE_UNUSED,
        libxml_xpathCallbacks = NULL;
     }
 
-    if (libxmlMemoryDebug) {
-        freed -= xmlMemUsed();
-       libxmlMemoryAllocatedBase -= freed;
-       if (libxmlMemoryAllocatedBase < 0)
-           libxmlMemoryAllocatedBase = 0;
-    }
+    xmlCleanupParser();
 
     Py_INCREF(Py_None);
     return(Py_None);
@@ -257,7 +236,7 @@ xmlPythonFileCloseRaw (void * context) {
 #endif
     file = (PyObject *) context;
     if (file == NULL) return(-1);
-    ret = PyEval_CallMethod(file, (char *) "close", (char *) "()");
+    ret = PyObject_CallMethod(file, (char *) "close", (char *) "()");
     if (ret != NULL) {
        Py_DECREF(ret);
     }
@@ -287,7 +266,7 @@ xmlPythonFileReadRaw (void * context, char * buffer, int len) {
 #endif
     file = (PyObject *) context;
     if (file == NULL) return(-1);
-    ret = PyEval_CallMethod(file, (char *) "read", (char *) "(i)", len);
+    ret = PyObject_CallMethod(file, (char *) "read", (char *) "(i)", len);
     if (ret == NULL) {
        printf("xmlPythonFileReadRaw: result is NULL\n");
        return(-1);
@@ -352,7 +331,7 @@ xmlPythonFileRead (void * context, char * buffer, int len) {
 #endif
     file = (PyObject *) context;
     if (file == NULL) return(-1);
-    ret = PyEval_CallMethod(file, (char *) "io_read", (char *) "(i)", len);
+    ret = PyObject_CallMethod(file, (char *) "io_read", (char *) "(i)", len);
     if (ret == NULL) {
        printf("xmlPythonFileRead: result is NULL\n");
        return(-1);
@@ -420,10 +399,10 @@ xmlPythonFileWrite (void * context, const char * buffer, int 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)",
+        ret = PyObject_CallMethod(file, (char *) "io_write", (char *) "(O)",
                                string);
     } else if (PyObject_HasAttrString(file, (char *) "write")) {
-        ret = PyEval_CallMethod(file, (char *) "write", (char *) "(O)",
+        ret = PyObject_CallMethod(file, (char *) "write", (char *) "(O)",
                                string);
     }
     Py_DECREF(string);
@@ -459,9 +438,9 @@ xmlPythonFileClose (void * context) {
     file = (PyObject *) context;
     if (file == NULL) return(-1);
     if (PyObject_HasAttrString(file, (char *) "io_close")) {
-        ret = PyEval_CallMethod(file, (char *) "io_close", (char *) "()");
+        ret = PyObject_CallMethod(file, (char *) "io_close", (char *) "()");
     } else if (PyObject_HasAttrString(file, (char *) "flush")) {
-        ret = PyEval_CallMethod(file, (char *) "flush", (char *) "()");
+        ret = PyObject_CallMethod(file, (char *) "flush", (char *) "()");
     }
     if (ret != NULL) {
        Py_DECREF(ret);
@@ -1524,6 +1503,7 @@ libxml_xmlSAXParseFile(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
     const char *URI;
     PyObject *pyobj_SAX = NULL;
     xmlSAXHandlerPtr SAX = NULL;
+    xmlParserCtxtPtr ctxt;
 
     if (!PyArg_ParseTuple(args, (char *) "Osi:xmlSAXParseFile", &pyobj_SAX,
                           &URI, &recover))
@@ -1540,7 +1520,9 @@ libxml_xmlSAXParseFile(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
     SAX = &pythonSaxHandler;
     Py_INCREF(pyobj_SAX);
     /* The reference is released in pythonEndDocument() */
-    xmlSAXUserParseFile(SAX, pyobj_SAX, URI);
+    ctxt = xmlNewSAXParserCtxt(SAX, pyobj_SAX);
+    xmlCtxtReadFile(ctxt, URI, NULL, 0);
+    xmlFreeParserCtxt(ctxt);
 #endif /* LIBXML_SAX1_ENABLED */
     Py_INCREF(Py_None);
     return (Py_None);
@@ -1554,6 +1536,7 @@ libxml_htmlSAXParseFile(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
     const char *encoding;
     PyObject *pyobj_SAX = NULL;
     xmlSAXHandlerPtr SAX = NULL;
+    htmlParserCtxtPtr ctxt;
 
     if (!PyArg_ParseTuple
         (args, (char *) "Osz:htmlSAXParseFile", &pyobj_SAX, &URI,
@@ -1571,7 +1554,9 @@ libxml_htmlSAXParseFile(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
     SAX = &pythonSaxHandler;
     Py_INCREF(pyobj_SAX);
     /* The reference is released in pythonEndDocument() */
-    htmlSAXParseFile(URI, encoding, SAX, pyobj_SAX);
+    ctxt = htmlNewSAXParserCtxt(SAX, pyobj_SAX);
+    htmlCtxtReadFile(ctxt, URI, encoding, 0);
+    htmlFreeParserCtxt(ctxt);
     Py_INCREF(Py_None);
     return (Py_None);
 #else
@@ -1642,7 +1627,7 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNUSED void *ctx, const char *msg,
         Py_XINCREF(libxml_xmlPythonErrorFuncCtxt);
         message = libxml_charPtrConstWrap(str);
         PyTuple_SetItem(list, 1, message);
-        result = PyEval_CallObject(libxml_xmlPythonErrorFuncHandler, list);
+        result = PyObject_CallObject(libxml_xmlPythonErrorFuncHandler, list);
         Py_XDECREF(list);
         Py_XDECREF(result);
     }
@@ -1730,7 +1715,7 @@ libxml_xmlParserCtxtGenericErrorFuncHandler(void *ctx, int severity, char *str)
     PyTuple_SetItem(list, 2, libxml_intWrap(severity));
     PyTuple_SetItem(list, 3, Py_None);
     Py_INCREF(Py_None);
-    result = PyEval_CallObject(pyCtxt->f, list);
+    result = PyObject_CallObject(pyCtxt->f, list);
     if (result == NULL) 
     {
        /* TODO: manage for the exception to be propagated... */
@@ -1916,7 +1901,7 @@ libxml_xmlValidCtxtGenericErrorFuncHandler(void *ctx, ATTRIBUTE_UNUSED int sever
     PyTuple_SetItem(list, 0, libxml_charPtrWrap(str));
     PyTuple_SetItem(list, 1, pyCtxt->arg);
     Py_XINCREF(pyCtxt->arg);
-    result = PyEval_CallObject(pyCtxt->error, list);
+    result = PyObject_CallObject(pyCtxt->error, list);
     if (result == NULL) 
     {
        /* TODO: manage for the exception to be propagated... */
@@ -1943,7 +1928,7 @@ libxml_xmlValidCtxtGenericWarningFuncHandler(void *ctx, ATTRIBUTE_UNUSED int sev
     PyTuple_SetItem(list, 0, libxml_charPtrWrap(str));
     PyTuple_SetItem(list, 1, pyCtxt->arg);
     Py_XINCREF(pyCtxt->arg);
-    result = PyEval_CallObject(pyCtxt->warn, list);
+    result = PyObject_CallObject(pyCtxt->warn, list);
     if (result == NULL) 
     {
        /* TODO: manage for the exception to be propagated... */
@@ -2078,7 +2063,7 @@ libxml_xmlTextReaderErrorCallback(void *arg,
     PyTuple_SetItem(list, 1, libxml_charPtrConstWrap(msg));
     PyTuple_SetItem(list, 2, libxml_intWrap(severity));
     PyTuple_SetItem(list, 3, libxml_xmlTextReaderLocatorPtrWrap(locator));
-    result = PyEval_CallObject(pyCtxt->f, list);
+    result = PyObject_CallObject(pyCtxt->f, list);
     if (result == NULL)
     {
        /* TODO: manage for the exception to be propagated... */
@@ -2273,7 +2258,7 @@ libxml_xmlXPathFuncCallback(xmlXPathParserContextPtr ctxt, int nargs)
         cur = libxml_xmlXPathObjectPtrWrap(obj);
         PyTuple_SetItem(list, i + 1, cur);
     }
-    result = PyEval_CallObject(current_function, list);
+    result = PyObject_CallObject(current_function, list);
     Py_DECREF(list);
 
     obj = libxml_xmlXPathObjectPtrConvert(result);
@@ -3150,7 +3135,7 @@ libxml_xmlRelaxNGValidityGenericErrorFuncHandler(void *ctx, char *str)
     PyTuple_SetItem(list, 0, libxml_charPtrWrap(str));
     PyTuple_SetItem(list, 1, pyCtxt->arg);
     Py_XINCREF(pyCtxt->arg);
-    result = PyEval_CallObject(pyCtxt->error, list);
+    result = PyObject_CallObject(pyCtxt->error, list);
     if (result == NULL) 
     {
         /* TODO: manage for the exception to be propagated... */
@@ -3177,7 +3162,7 @@ libxml_xmlRelaxNGValidityGenericWarningFuncHandler(void *ctx, char *str)
     PyTuple_SetItem(list, 0, libxml_charPtrWrap(str));
     PyTuple_SetItem(list, 1, pyCtxt->arg);
     Py_XINCREF(pyCtxt->arg);
-    result = PyEval_CallObject(pyCtxt->warn, list);
+    result = PyObject_CallObject(pyCtxt->warn, list);
     if (result == NULL) 
     {
         /* TODO: manage for the exception to be propagated... */
@@ -3314,7 +3299,7 @@ libxml_xmlSchemaValidityGenericErrorFuncHandler(void *ctx, char *str)
        PyTuple_SetItem(list, 0, libxml_charPtrWrap(str));
        PyTuple_SetItem(list, 1, pyCtxt->arg);
        Py_XINCREF(pyCtxt->arg);
-       result = PyEval_CallObject(pyCtxt->error, list);
+       result = PyObject_CallObject(pyCtxt->error, list);
        if (result == NULL) 
        {
                /* TODO: manage for the exception to be propagated... */
@@ -3341,7 +3326,7 @@ libxml_xmlSchemaValidityGenericWarningFuncHandler(void *ctx, char *str)
        PyTuple_SetItem(list, 0, libxml_charPtrWrap(str));
        PyTuple_SetItem(list, 1, pyCtxt->arg);
        Py_XINCREF(pyCtxt->arg);
-       result = PyEval_CallObject(pyCtxt->warn, list);
+       result = PyObject_CallObject(pyCtxt->warn, list);
        if (result == NULL)
        {
                /* TODO: manage for the exception to be propagated... */
index 478a20d..f4c3aee 100644 (file)
 #define XML_IGNORE_DEPRECATION_WARNINGS \
     _Pragma("GCC diagnostic push") \
     _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
-#define XML_POP_WARNINGS \
-    _Pragma("GCC diagnostic pop")
+#elif defined (_MSC_VER) && (_MSC_VER >= 1400)
+#define XML_IGNORE_DEPRECATION_WARNINGS \
+    __pragma(warning(push)) \
+    __pragma(warning(disable : 4996))
 #else
-#define XML_IGNORE_PEDANTIC_WARNINGS
-#define XML_POP_WARNINGS
+#define XML_IGNORE_DEPRECATION_WARNINGS
 #endif
 
 #define PyxmlNode_Get(v) (((v) == Py_None) ? NULL : \
index 57505eb..bcc4da4 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # Setup script for libxml2 and libxslt if found
 #
@@ -45,6 +45,11 @@ icu_dlls = ['icuuc%s.dll' % icu_series_s, 'icudt%s.dll' % icu_series_s]
 # dlls must be found somewhere in the PATH at runtime.
 WITHDLLS = 1 and sys.platform.startswith('win')
 
+if WITHDLLS:
+    def altImport(s):
+        s = s.replace("import libxml2mod","from libxmlmods import libxml2mod")
+        return s
+
 def missing(file):
     if os.access(file, os.R_OK) == 0:
         return 1
@@ -182,11 +187,6 @@ if WITHDLLS:
         os.mkdir("libxmlmods")
         open("libxmlmods/__init__.py","w").close()
 
-    def altImport(s):
-        s = s.replace("import libxml2mod","from libxmlmods import libxml2mod")
-        s = s.replace("import libxsltmod","from libxmlmods import libxsltmod")
-        return s
-
     packaged_dlls = [os.path.join(ROOT,'bin',dll) for dll in dlls]
 
 descr = "libxml2 package"
index 23def61..9170cb7 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import sys
 import libxml2
 
index 05e4917..1ff4a5b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import libxml2
 import sys
 
index a11855b..322754d 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import sys
 import libxml2
 
index 0aa0150..4823194 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # This test exercise the redirection of error messages with a
 # functions defined in Python.
index b672ae0..6134d88 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import sys
 import libxml2
 
index 129b57a..dc3af12 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import libxml2
 import sys
 
index e41c27e..09102ad 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # This test exercise the redirection of error messages with a
 # functions defined in Python.
index 16ca9bc..10a9cf0 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import sys
 import libxml2
 try:
index 4922b5e..d64dfb8 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: ISO-8859-1 -*-
 import sys
 import libxml2
index 2cb85de..9151e76 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # This tests custom input callbacks
 #
index b7f8b75..7d4aa96 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # this test exercise the XPath basic engine, parser, etc, and
 # allows to detect memory leaks
index 8e8ef24..2bafcc8 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import sys
 import libxml2
 try:
index 56864c3..0b6ae1d 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import sys
 import libxml2
 
index 850ae7e..a2df0a8 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import sys
 import libxml2
 
index 47cd8a5..eabbfca 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import sys
 import libxml2
 
index 5a46146..d8e6fff 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: ISO-8859-1 -*-
 #
 # this tests the basic APIs of the XmlTextReader interface
index 65cecd4..9d3b706 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #
 # this tests the DTD validation with the XmlTextReader interface
@@ -6,7 +6,6 @@
 import sys
 import glob
 import os
-import string
 import libxml2
 try:
     import StringIO
@@ -20,103 +19,76 @@ libxml2.debugMemory(1)
 
 err = ""
 basedir = os.path.dirname(os.path.realpath(__file__))
-dir_prefix = os.path.join(basedir, "../../test/valid/")
+dir_prefix = os.path.realpath(os.path.join(basedir, "..", "..", "test", "valid"))
+
 # This dictionary reflects the contents of the files
 # ../../test/valid/*.xml.err that are not empty, except that
 # the file paths in the messages start with ../../test/
 
 expect = {
     '766956':
-"""../../test/valid/dtds/766956.dtd:2: parser error : PEReference: expecting ';'
+"""{0}/dtds/766956.dtd:2: parser error : PEReference: expecting ';'
 %ä%ent;
    ^
-../../test/valid/dtds/766956.dtd:2: parser error : Content error in the external subset
+{0}/dtds/766956.dtd:2: parser error : Content error in the external subset
 %ä%ent;
         ^
 Entity: line 1: 
 value
 ^
-""",
+""".format(dir_prefix),
     '781333':
-"""../../test/valid/781333.xml:4: element a: validity error : Element a content does not follow the DTD, expecting ( ..., got 
+"""{0}/781333.xml:4: element a: validity error : Element a content does not follow the DTD, expecting ( ..., got 
 <a/>
     ^
-../../test/valid/781333.xml:5: element a: validity error : Element a content does not follow the DTD, Expecting more child
+{0}/781333.xml:5: element a: validity error : Element a content does not follow the DTD, Expecting more children
 
 ^
-""",
+""".format(dir_prefix),
     'cond_sect2':
-"""../../test/valid/dtds/cond_sect2.dtd:15: parser error : All markup of the conditional section is not in the same entity
+"""{0}/dtds/cond_sect2.dtd:15: parser error : All markup of the conditional section is not in the same entity
     %ent;
          ^
 Entity: line 1: 
 ]]>
 ^
-../../test/valid/dtds/cond_sect2.dtd:17: parser error : Content error in the external subset
+{0}/dtds/cond_sect2.dtd:17: parser error : Content error in the external subset
 
 ^
-""",
+""".format(dir_prefix),
     'rss':
-"""../../test/valid/rss.xml:177: element rss: validity error : Element rss does not carry attribute version
+"""{0}/rss.xml:177: element rss: validity error : Element rss does not carry attribute version
 </rss>
       ^
-""",
+""".format(dir_prefix),
     't8':
-"""../../test/valid/t8.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
+"""{0}/t8.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
 
 %defroot; %defmiddle; %deftest;
          ^
 Entity: line 1: 
 &lt;!ELEMENT root (middle) >
 ^
-../../test/valid/t8.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
-
-%defroot; %defmiddle; %deftest;
-                     ^
-Entity: line 1: 
-&lt;!ELEMENT middle (test) >
-^
-../../test/valid/t8.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
-
-%defroot; %defmiddle; %deftest;
-                               ^
-Entity: line 1: 
-&lt;!ELEMENT test (#PCDATA) >
-^
-""",
+""".format(dir_prefix),
     't8a':
-"""../../test/valid/t8a.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
+"""{0}/t8a.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
 
 %defroot;%defmiddle;%deftest;
          ^
 Entity: line 1: 
 &lt;!ELEMENT root (middle) >
 ^
-../../test/valid/t8a.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
-
-%defroot;%defmiddle;%deftest;
-                    ^
-Entity: line 1: 
-&lt;!ELEMENT middle (test) >
-^
-../../test/valid/t8a.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
-
-%defroot;%defmiddle;%deftest;
-                             ^
-Entity: line 1: 
-&lt;!ELEMENT test (#PCDATA) >
-^
-""",
+""".format(dir_prefix),
     'xlink':
-"""../../test/valid/xlink.xml:450: element termdef: validity error : ID dt-arc already defined
+"""{0}/xlink.xml:450: element termdef: validity error : ID dt-arc already defined
        <p><termdef id="dt-arc" term="Arc">An <ter
                                          ^
 validity error : attribute def line 199 references an unknown ID "dt-xlg"
-""",
+""".format(dir_prefix),
 }
 
 # Add prefix_dir and extension to the keys
-expect = {"{}{}.xml".format(dir_prefix, key): val for key, val in expect.items()}
+expect = {os.path.join(dir_prefix, key + ".xml"): val for key, val in expect.items()}
 
 def callback(ctx, str):
     global err
@@ -124,11 +96,12 @@ def callback(ctx, str):
 libxml2.registerErrorHandler(callback, "")
 
 parsing_error_files = ["766956", "cond_sect2", "t8", "t8a"]
-expect_parsing_error = ["{}{}.xml".format(dir_prefix, f) for f in parsing_error_files]
+expect_parsing_error = [os.path.join(dir_prefix, f + ".xml") for f in parsing_error_files]
 
-valid_files = glob.glob(dir_prefix + "*.x*")
+valid_files = glob.glob(os.path.join(dir_prefix, "*.x*"))
 assert valid_files, "found no valid files in '{}'".format(dir_prefix)
 valid_files.sort()
+failures = 0
 for file in valid_files:
     err = ""
     reader = libxml2.newTextReaderFilename(file)
@@ -142,9 +115,15 @@ for file in valid_files:
         #sys.exit(1)
     if (err):
         if not(file in expect and err == expect[file]):
+            failures += 1
             print("Error: ", err)
             if file in expect:
                 print("Expected: ", expect[file])
+
+if failures:
+    print("Failed %d tests" % failures)
+    sys.exit(1)
+
 #
 # another separate test based on Stephane Bidoul one
 #
@@ -337,9 +316,11 @@ while reader.Read() == 1:
 if res != expect:
     print("test5 failed: unexpected output")
     print(res)
+    sys.exit(1)
 if err != "":
     print("test5 failed: validation error found")
     print(err)
+    sys.exit(1)
 
 #
 # cleanup
index 39a7f73..6507a7b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # this tests the entities substitutions with the XmlTextReader interface
 #
index f5fbaa1..5aeed28 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # this tests the basic APIs of the XmlTextReader interface
 #
index f564e9b..19d1c3b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # this tests the Expand() API of the xmlTextReader interface
 # this extract the Dragon bibliography entries from the XML specification
index 0b2e68d..7d293c6 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # this tests the entities substitutions with the XmlTextReader interface
 #
index 2b1fb6d..8cb7a73 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # this tests the entities substitutions with the XmlTextReader interface
 #
index 8636b8d..1e4b7c0 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # this tests the entities substitutions with the XmlTextReader interface
 #
index 86baa3a..6c9f85e 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # this tests the basic APIs of the XmlTextReader interface
 #
index b77acbc..112283e 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: ISO-8859-1 -*-
 #
 # this tests the next API of the XmlTextReader interface
index 2790132..ccef3f6 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import libxml2
 
 # Memory debug specific
index a8a6a70..277ac5f 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import libxml2
 import sys
 
index f506a74..c39edc9 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import sys
 import libxml2
 try:
index 7426c60..28501f8 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import libxml2
 import sys
 
index 9f36a10..6c8a94e 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import sys
 import libxml2
 
index b2a9131..a9a89c7 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import sys
 import libxml2
 
index fd34951..9a171e9 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import string, sys, time
 try:
     from _thread import get_ident
index 5178336..d528bf0 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import sys
 import libxml2
 
index ffa3806..ea57e39 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import sys, unittest
 
 import libxml2
index 8c22ee7..b3ac87b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import sys
 import libxml2
 
index 858f227..a9dbdea 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import libxml2
 
 try:
index e8ba082..ea49012 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import sys
 import libxml2
 
index 17c7b3d..1afb93f 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import libxml2
 import sys
 
index 22ebe31..0b3d60e 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import libxml2
 import sys
 
index b123e01..b68747d 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import libxml2
 import sys
 
index 08c30ff..afdf0e9 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import sys
 import libxml2
 
index 00bb4c9..62b48dc 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # this tests the entities substitutions with the XmlTextReader interface
 #
index de9c2fd..816de8a 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # this test exercise the XPath basic engine, parser, etc, and
 # allows to detect memory leaks
index ab7b3bb..69e1fc9 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import sys
 import libxml2
 
index 0445fce..438c13f 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import sys, libxml2
 
 libxml2.debugMemory(True)
index 3aae6c7..a450905 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 import libxml2
 
@@ -11,6 +11,7 @@ d = libxml2.parseDoc("<a:a xmlns:a='urn:whatevar'/>")
 res=""
 for n in d.xpathEval("//namespace::*"):
     res = res + n.serialize()
+del n
 d.freeDoc()
 
 if res != expect:
@@ -18,7 +19,6 @@ if res != expect:
     print(res)
 del res
 del d
-del n
 # Memory debug specific
 libxml2.cleanupParser()
 
index 254bd94..8517c42 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import sys
 import libxml2
 
index 27ad500..5efeef9 100644 (file)
@@ -78,14 +78,12 @@ myInvalidParameterHandler(const wchar_t *expression,
 
 FILE *
 libxml_PyFileGet(PyObject *f) {
-    int flags;
     FILE *res;
     const char *mode;
-
     int fd = PyObject_AsFileDescriptor(f);
-    intptr_t w_fh = -1;
 
 #ifdef _WIN32
+    intptr_t w_fh = -1;
     HMODULE hntdll = NULL;
     IO_STATUS_BLOCK status_block;
     FILE_ACCESS_INFORMATION ai;
@@ -113,8 +111,9 @@ libxml_PyFileGet(PyObject *f) {
 
     if (hntdll == NULL)
         return(NULL);
-
+XML_IGNORE_FPTR_CAST_WARNINGS
     NtQueryInformationFile = (t_NtQueryInformationFile)GetProcAddress(hntdll, "NtQueryInformationFile");
+XML_POP_WARNINGS
 
     if (NtQueryInformationFile != NULL &&
         (NtQueryInformationFile((HANDLE)w_fh,
@@ -130,23 +129,24 @@ libxml_PyFileGet(PyObject *f) {
             if (ai.AccessFlags & FILE_APPEND_DATA)
                 is_append = TRUE;
 
-            if (is_write && is_read)
-                if (is_append)
-                    mode = "a+";
-                else
-                    mode = "rw";
-
-            if (!is_write && is_read)
+            if (is_write) {
+                if (is_read) {
+                    if (is_append)
+                        mode = "a+";
+                    else
+                        mode = "rw";
+                } else {
+                    if (is_append)
+                        mode = "a";
+                    else
+                        mode = "w";
+                }
+            } else {
                 if (is_append)
                     mode = "r+";
                 else
                     mode = "r";
-
-            if (is_write && !is_read)
-                if (is_append)
-                    mode = "a";
-                else
-                    mode = "w";
+            }
         }
 
     FreeLibrary(hntdll);
@@ -154,31 +154,47 @@ libxml_PyFileGet(PyObject *f) {
     if (!is_write && !is_read) /* also happens if we did not load or run NtQueryInformationFile() successfully */
         return(NULL);
 #else
+    int flags;
+
     /*
-     * Get the flags on the fd to understand how it was opened
+     * macOS returns O_RDWR for standard streams, but fails to write to
+     * stdout or stderr when opened with fdopen(dup_fd, "rw").
      */
-    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);
+    switch (fd) {
+        case STDIN_FILENO:
+            mode = "r";
+            break;
+        case STDOUT_FILENO:
+        case STDERR_FILENO:
+            mode = "w";
+            break;
+        default:
+            /*
+             * 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);
+            }
     }
 #endif
 
index 7f0f2e7..acf536a 100644 (file)
--- a/relaxng.c
+++ b/relaxng.c
 #include <libxml/xmlregexp.h>
 #include <libxml/xmlschemastypes.h>
 
+#include "private/error.h"
+#include "private/regexp.h"
+#include "private/string.h"
+
 /*
  * The Relax-NG namespace
  */
@@ -2875,10 +2879,6 @@ xmlRelaxNGCleanupTypes(void)
  *                                                                     *
  ************************************************************************/
 
-/* from automata.c but not exported */
-void xmlAutomataSetFlags(xmlAutomataPtr am, int flags);
-
-
 static int xmlRelaxNGTryCompile(xmlRelaxNGParserCtxtPtr ctxt,
                                 xmlRelaxNGDefinePtr def);
 
@@ -7987,12 +7987,7 @@ xmlRelaxNGValidateCompiledCallback(xmlRegExecCtxtPtr exec ATTRIBUTE_UNUSED,
             ctxt->errNo = XML_RELAXNG_ERR_INTERNAL;
         return;
     }
-    if ((ctxt == NULL) || (define == NULL)) {
-        fprintf(stderr, "callback on %s missing info\n", token);
-        if ((ctxt != NULL) && (ctxt->errNo == XML_RELAXNG_OK))
-            ctxt->errNo = XML_RELAXNG_ERR_INTERNAL;
-        return;
-    } else if (define->type != XML_RELAXNG_ELEMENT) {
+    if (define->type != XML_RELAXNG_ELEMENT) {
         fprintf(stderr, "callback on %s define is not element\n", token);
         if (ctxt->errNo == XML_RELAXNG_OK)
             ctxt->errNo = XML_RELAXNG_ERR_INTERNAL;
@@ -8588,7 +8583,7 @@ xmlRelaxNGNormalize(xmlRelaxNGValidCtxtPtr ctxt, const xmlChar * str)
         tmp++;
     len = tmp - str;
 
-    ret = (xmlChar *) xmlMallocAtomic((len + 1) * sizeof(xmlChar));
+    ret = (xmlChar *) xmlMallocAtomic(len + 1);
     if (ret == NULL) {
         xmlRngVErrMemory(ctxt, "validating\n");
         return (NULL);
index 2cc68b9..8e45a5a 100644 (file)
@@ -47,7 +47,7 @@ eval("page" + id + " = window.open(URL, '" + id + "', 'toolbars=0, scrollbars=0,
     <td valign="top" width="31"><a href="http://bp6.gamesquad.net/"><img align="bottom" border="0" height="74" src="doc3_files/logo.gif" width="252"></a></td>\r
     <td align="left" bgcolor="#000000">
 <img height="15" src="doc3_files/spacer.gif" width="15"><!-- START GAMESQUAD.NET IFRAME RICH MEDIA CODE --> <!-- Â© 2000 GameSquad.net All Rights Reserved. --><iframe border="0" frameborder="no" height="60" marginheight="0" marginwidth="0" scrolling="no" src="doc3_files/adcycle.htm" width="468">
-<a href="http://ads.gamesquad.net/addclick.exe/adclick.cgi?REGION=game%7Ctech%7Cent&amp;id=1" target="_top"><img src="http://ads.gamesquad.net/addclick.exe/adcycle.cgi?group=52&amp;media=1&amp;id=1" width="468" height="60" border="0" alt="GSN ROS Ad"></a>
+<a href="http://ads.gamesquad.net/addclick.exe/adclick.cgi?REGION=game|tech|ent&amp;id=1" target="_top"><img src="http://ads.gamesquad.net/addclick.exe/adcycle.cgi?group=52&amp;media=1&amp;id=1" width="468" height="60" border="0" alt="GSN ROS Ad"></a>
 </iframe><!-- END GAMESQUAD.NET IFRAME RICH MEDIA CODE --><br><img height="15" src="doc3_files/spacer.gif" width="400"> </td>
 </tr>\r
   <tr>\r
diff --git a/result/HTML/names.html b/result/HTML/names.html
new file mode 100644 (file)
index 0000000..dd7dcc2
--- /dev/null
@@ -0,0 +1,6 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<html>
+<body>
+  <o:p></o:p>
+</body>
+</html>
diff --git a/result/HTML/names.html.err b/result/HTML/names.html.err
new file mode 100644 (file)
index 0000000..4d91a5d
--- /dev/null
@@ -0,0 +1,3 @@
+./test/HTML/names.html:3: HTML parser error : Tag o:p invalid
+  <o:p></o:p>
+      ^
diff --git a/result/HTML/names.html.sax b/result/HTML/names.html.sax
new file mode 100644 (file)
index 0000000..12a107f
--- /dev/null
@@ -0,0 +1,20 @@
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.startElement(html)
+SAX.characters(
+, 1)
+SAX.startElement(body)
+SAX.characters(
+  , 3)
+SAX.startElement(o:p)
+SAX.error: Tag o:p invalid
+SAX.endElement(o:p)
+SAX.characters(
+, 1)
+SAX.endElement(body)
+SAX.characters(
+, 1)
+SAX.endElement(html)
+SAX.characters(
+, 1)
+SAX.endDocument()
index 66a498a..b497aa6 100644 (file)
@@ -43,7 +43,7 @@
 Ø¯Ø±Ø¨Ø§Ø±Ù‡ Ù…Ù† </a></span> <span class="Item">
 <a href="RSS2.asp">
 
-<img src="showimage.aspx?path=Files_Upload%5C192.png&amp;width=%&gt;" border="0">
+<img src="showimage.aspx?path=Files_Upload\192.png&amp;width=%&gt;" border="0">
 RSS </a></span> <span class="Item">
 <a href="">
  </a></span>
@@ -117,8 +117,8 @@ function ChangeSize( trgt,sz ) {
                        
                        <div class="Image">
                                
-                               <a href="showimage.aspx?path=Files_Upload%5C302.JPG&amp;Width=" rel="lightbox" title="شهير Ø¨Ù„اگ">
-                               <img src="showimage.aspx?path=Files_Upload%5C302.JPG&amp;Width=220" align="left" border="1">
+                               <a href="showimage.aspx?path=Files_Upload\302.JPG&amp;Width=" rel="lightbox" title="شهير Ø¨Ù„اگ">
+                               <img src="showimage.aspx?path=Files_Upload\302.JPG&amp;Width=220" align="left" border="1">
                                </a>
 </div>
                        <strong><font size="4"><font color="#0000ff">عکس</font> <font color="#0000ff">محصول Ù‡Ù†Ø± ÛŒÚ©ÛŒ Ø§Ø² Ù‡Ù…کاران Ø§Ø³Øª. Ø±ÙˆÛŒ Ø¢Ù† Ú©Ù„یک Ú©Ù†Ø¯.</font></font></strong><s1>  </s1>
index a6ef047..b51aa95 100644 (file)
@@ -11,5 +11,5 @@
 Ø² Ù‡Ù…کاران Ø§Ø³Øª. Ø±ÙˆÛŒ Ø¢Ù† Ú©Ù„یک Ú©Ù†Ø¯.</FONT></FONT></STRONG><S1
                                                                                ^
 ./test/HTML/utf8bug.html:177: HTML parser error : htmlParseEntityRef: expecting ';'
-§Û\8cÙ\86 Ã™Â¾Ã˜Â§Ã˜Â³Ã˜Â® Ã˜Â±Ã˜Â§ Ã˜Â¨Ã˜Â±Ã˜Â§Ã›\8c Ã™\86Ù\88Û\8cسÙ\86دÙ\87 Ã™\85Ù\82اÙ\84Ù\87 Ã˜Â±Ã˜Â¬Ã˜Â§Ã™\86Û\8cÙ\88ز copy&paste
+ین Ù¾Ø§Ø³Ø® Ø±Ø§ Ø¨Ø±Ø§ÛŒ Ù†ÙˆÛŒØ³Ù†Ø¯Ù‡ Ù…قاله Ø±Ø¬Ø§Ù†ÛŒÙˆØ² copy&paste 
                                                                                ^
index 3da303f..916630d 100644 (file)
     <td bgcolor="#99FF99"><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#000000"><a href="http://redirect.wired.com/redir/51/http://stocks.wired.com/">Today's Summary</a></font></td>
   </tr>
   <tr> 
-    <td bgcolor="#CCFFCC"><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#000000"><a href="http://r.wired.com/r/hb_fin_r_wn_top/http://stocks.wired.com/stocks_indexes_detail.asp?Symbol=%24WIRED">Wired Index</a> | <a href="http://redirect.wired.com/redir/52/http://stocks.wired.com/stocks_indexes.asp%20">All Indexes</a></font></td>
+    <td bgcolor="#CCFFCC"><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#000000"><a href="http://r.wired.com/r/hb_fin_r_wn_top/http://stocks.wired.com/stocks_indexes_detail.asp?Symbol=$WIRED">Wired Index</a> | <a href="http://redirect.wired.com/redir/52/http://stocks.wired.com/stocks_indexes.asp%20">All Indexes</a></font></td>
   </tr>
   <tr> 
     <td bgcolor="#99FF99"><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#000000"><a href="http://redirect.wired.com/redir/53/http://stocks.wired.com/stocks_portfolios.asp">Portfolios</a></font></td>
diff --git a/result/URI/file.uri b/result/URI/file.uri
new file mode 100644 (file)
index 0000000..8d8b7a7
--- /dev/null
@@ -0,0 +1 @@
+file:///foo.txt
diff --git a/result/URI/port.uri b/result/URI/port.uri
new file mode 100644 (file)
index 0000000..4b22322
--- /dev/null
@@ -0,0 +1,2 @@
+nbd://:10888
+https://example.com:12345/
index f22b4db..90c7905 100644 (file)
@@ -16,3 +16,6 @@ http://foo.com/root.cgi?OK#OK2
 http://elsewhere.com/#deep
 http://elsewhere.com/?deep
 http://elsewhere.com/?deep#deep2
+http://elsewhere.com/bar
+http://elsewhere.com:8080/bar
+http://:8080
index 899d759..91eef9c 100644 (file)
@@ -4,3 +4,6 @@
 ./test/VC/ElementValid5:8: element doc: validity error : Element doc content does not follow the DTD, Misplaced b
 
 ^
+./test/VC/ElementValid5:8: element doc: validity error : Element doc content does not follow the DTD, Expecting more children
+
+^
index aeafd6b..3b51d1a 100644 (file)
@@ -1,6 +1,6 @@
 ./test/VC/ElementValid6:7: element doc: validity error : Element doc content does not follow the DTD, expecting (a , b? , c+)?, got (a b)
 <doc><a/><b>lacks c</b></doc>
                              ^
-./test/VC/ElementValid6:8: element doc: validity error : Element doc content does not follow the DTD, Expecting more child
+./test/VC/ElementValid6:8: element doc: validity error : Element doc content does not follow the DTD, Expecting more children
 
 ^
index f001fd2..ecafd1d 100644 (file)
@@ -1,6 +1,6 @@
 ./test/VC/ElementValid7:7: element doc: validity error : Element doc content does not follow the DTD, expecting ((a | b)* , c+ , a , b? , c , a?), got (a b a c c a)
 <doc><a/><b/><a/><c/><c/><a/></doc>
                                    ^
-./test/VC/ElementValid7:8: element doc: validity error : Element doc content does not follow the DTD, Expecting more child
+./test/VC/ElementValid7:8: element doc: validity error : Element doc content does not follow the DTD, Expecting more children
 
 ^
index f1b0dad..7962630 100644 (file)
@@ -1,3 +1,3 @@
-./test/VC/ElementValid8:7: validity error : Content model of doc is not determinist: ((a , b) | (a , c))
+./test/VC/ElementValid8:7: validity error : Content model of doc is not deterministic: ((a , b) | (a , c))
 <doc><a/><c> doc is non-deterministic </c></doc>
                                                 ^
index f1b0dad..7962630 100644 (file)
@@ -1,3 +1,3 @@
-./test/VC/ElementValid8:7: validity error : Content model of doc is not determinist: ((a , b) | (a , c))
+./test/VC/ElementValid8:7: validity error : Content model of doc is not deterministic: ((a , b) | (a , c))
 <doc><a/><c> doc is non-deterministic </c></doc>
                                                 ^
diff --git a/result/XInclude/fallback.xml.err b/result/XInclude/fallback.xml.err
new file mode 100644 (file)
index 0000000..68b5cc0
--- /dev/null
@@ -0,0 +1 @@
+I/O warning : failed to load external entity "test/XInclude/docs/something.xml"
diff --git a/result/XInclude/fallback2.xml.err b/result/XInclude/fallback2.xml.err
new file mode 100644 (file)
index 0000000..5a35a2b
--- /dev/null
@@ -0,0 +1,2 @@
+I/O warning : failed to load external entity "test/XInclude/docs/b.xml"
+I/O warning : failed to load external entity "test/XInclude/docs/c.xml"
diff --git a/result/XInclude/fallback4.xml.err b/result/XInclude/fallback4.xml.err
new file mode 100644 (file)
index 0000000..2861bba
--- /dev/null
@@ -0,0 +1 @@
+I/O warning : failed to load external entity "test/XInclude/docs/c.xml"
diff --git a/result/XInclude/fallback5.xml.err b/result/XInclude/fallback5.xml.err
new file mode 100644 (file)
index 0000000..84dd18e
--- /dev/null
@@ -0,0 +1,16 @@
+I/O warning : failed to load external entity "test/XInclude/docs/a01.xml"
+I/O warning : failed to load external entity "test/XInclude/docs/a02.xml"
+I/O warning : failed to load external entity "test/XInclude/docs/a03.xml"
+I/O warning : failed to load external entity "test/XInclude/docs/a04.xml"
+I/O warning : failed to load external entity "test/XInclude/docs/a05.xml"
+I/O warning : failed to load external entity "test/XInclude/docs/a06.xml"
+I/O warning : failed to load external entity "test/XInclude/docs/a07.xml"
+I/O warning : failed to load external entity "test/XInclude/docs/a08.xml"
+I/O warning : failed to load external entity "test/XInclude/docs/a09.xml"
+I/O warning : failed to load external entity "test/XInclude/docs/a10.xml"
+I/O warning : failed to load external entity "test/XInclude/docs/a11.xml"
+I/O warning : failed to load external entity "test/XInclude/docs/a12.xml"
+I/O warning : failed to load external entity "test/XInclude/docs/a13.xml"
+I/O warning : failed to load external entity "test/XInclude/docs/a14.xml"
+I/O warning : failed to load external entity "test/XInclude/docs/a15.xml"
+I/O warning : failed to load external entity "test/XInclude/docs/a16.xml"
diff --git a/result/XInclude/fallback6.xml.err b/result/XInclude/fallback6.xml.err
new file mode 100644 (file)
index 0000000..5a35a2b
--- /dev/null
@@ -0,0 +1,2 @@
+I/O warning : failed to load external entity "test/XInclude/docs/b.xml"
+I/O warning : failed to load external entity "test/XInclude/docs/c.xml"
diff --git a/result/XInclude/fallback7.xml b/result/XInclude/fallback7.xml
new file mode 100644 (file)
index 0000000..f5d3718
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<x xmlns:xi="http://www.w3.org/2001/XInclude">
+    <a>text</a>
+    <b>
+                <a>text</a>
+            </b>
+    
+            <b>
+                <a>text</a>
+            </b>
+        
+    <b>
+                <a>text</a>
+            </b>
+</x>
diff --git a/result/XInclude/fallback7.xml.err b/result/XInclude/fallback7.xml.err
new file mode 100644 (file)
index 0000000..828a73a
--- /dev/null
@@ -0,0 +1 @@
+I/O warning : failed to load external entity "test/XInclude/without-reader/404.xml"
diff --git a/result/XInclude/invalid_char.xml.err b/result/XInclude/invalid_char.xml.err
new file mode 100644 (file)
index 0000000..c28c109
--- /dev/null
@@ -0,0 +1,2 @@
+./test/XInclude/docs/invalid_char.xml:2: element include: XInclude error : test/XInclude/ents/invalid_char.txt contains invalid char
+./test/XInclude/docs/invalid_char.xml:2: element include: XInclude error : could not load test/XInclude/ents/invalid_char.txt, and no fallback was found
diff --git a/result/XInclude/invalid_char.xml.rdr b/result/XInclude/invalid_char.xml.rdr
new file mode 100644 (file)
index 0000000..1fb5774
--- /dev/null
@@ -0,0 +1,7 @@
+0 1 x 0 0
+1 14 #text 0 1 
+   
+1 1 xinclude:include 1 0
+1 14 #text 0 1 
+
+0 15 x 0 0
diff --git a/result/XInclude/issue424-1.xml b/result/XInclude/issue424-1.xml
new file mode 100644 (file)
index 0000000..ff87b0e
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<x xmlns:xinclude="http://www.w3.org/2001/XInclude">
+   <p>Something</p>
+   <d><p>Something</p></d>
+   <d><p>Something</p></d>
+</x>
diff --git a/result/XInclude/issue424-2.xml b/result/XInclude/issue424-2.xml
new file mode 100644 (file)
index 0000000..ff87b0e
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<x xmlns:xinclude="http://www.w3.org/2001/XInclude">
+   <p>Something</p>
+   <d><p>Something</p></d>
+   <d><p>Something</p></d>
+</x>
diff --git a/result/XInclude/loop.xml.err b/result/XInclude/loop.xml.err
new file mode 100644 (file)
index 0000000..ec8534f
--- /dev/null
@@ -0,0 +1 @@
+./test/XInclude/without-reader/loop.xml:2: element include: XInclude error : inclusion loop detected
diff --git a/result/XInclude/max-recurse.xml.err b/result/XInclude/max-recurse.xml.err
new file mode 100644 (file)
index 0000000..38ff72a
--- /dev/null
@@ -0,0 +1 @@
+./test/XInclude/without-reader/max-recurse.xml:42: element include: XInclude error : maximum recursion depth exceeded
diff --git a/result/XInclude/nodes3.xml b/result/XInclude/nodes3.xml
deleted file mode 100644 (file)
index 9ab2044..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0"?>
-<x xmlns:xinclude="http://www.w3.org/2003/XInclude">
-   <!-- Simple test of including a set of nodes from an XML document -->
-   <xinclude:include href="../ents/something.xml#xpointer(//p)"/>
-</x>
diff --git a/result/XInclude/nodes3.xml.err b/result/XInclude/nodes3.xml.err
new file mode 100644 (file)
index 0000000..fb11525
--- /dev/null
@@ -0,0 +1 @@
+./test/XInclude/docs/nodes3.xml:3: element include: XInclude error : Invalid fragment identifier in URI test/XInclude/ents/something.xml#xpointer(//p) use the xpointer attribute
diff --git a/result/XInclude/ns1.xml.err b/result/XInclude/ns1.xml.err
new file mode 100644 (file)
index 0000000..b05fffb
--- /dev/null
@@ -0,0 +1 @@
+I/O warning : failed to load external entity "test/XInclude/without-reader/b.xml"
diff --git a/result/XInclude/ns1.xml.rdr b/result/XInclude/ns1.xml.rdr
deleted file mode 100644 (file)
index 9a3a5e7..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-0 1 doc 0 0
-1 14 #text 0 1 
-    
-1 1 xi:include 1 0
-1 14 #text 0 1 
-    
-1 1 elem 0 0
-2 14 #text 0 1 
-        
-2 1 ns:elem 1 0
-2 14 #text 0 1 
-    
-1 15 elem 0 0
-1 14 #text 0 1 
-    
-1 14 #text 0 1 
-            
-1 1 ns:elem 1 0
-1 14 #text 0 1 
-        
-1 14 #text 0 1 
-
-0 15 doc 0 0
index e09eb4a..4ff9c58 100644 (file)
@@ -20,6 +20,10 @@ Expression: -number('abc')
 Object is a number : NaN
 
 ========================
+Expression: number('-')
+Object is a number : NaN
+
+========================
 Expression: floor(0.1)
 Object is a number : 0
 
diff --git a/result/boundaries1.xml b/result/boundaries1.xml
new file mode 100644 (file)
index 0000000..dc1848f
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<!DOCTYPE d [
+<!ENTITY a "]>">
+<!ENTITY b "]>">
+<!--> ]> -->]>
+<?pi p1?>
+<!--> c1 -->
+<d a="&gt;" b="&gt;">
+text&a;text
+<![CDATA[cdata]]>
+<?pi p2?>
+<!--> c2 -->
+</d>
+<?pi p3?>
+<!--> c3 -->
diff --git a/result/boundaries1.xml.rde b/result/boundaries1.xml.rde
new file mode 100644 (file)
index 0000000..113b487
--- /dev/null
@@ -0,0 +1,19 @@
+0 10 d 0 0
+0 7 pi 0 1 p1
+0 8 #comment 0 1 > c1 
+0 1 d 0 0
+1 3 #text 0 1 
+text]>text
+
+1 4 #cdata-section 0 1 cdata
+1 14 #text 0 1 
+
+1 7 pi 0 1 p2
+1 14 #text 0 1 
+
+1 8 #comment 0 1 > c2 
+1 14 #text 0 1 
+
+0 15 d 0 0
+0 7 pi 0 1 p3
+0 8 #comment 0 1 > c3 
diff --git a/result/boundaries1.xml.rdr b/result/boundaries1.xml.rdr
new file mode 100644 (file)
index 0000000..784ece0
--- /dev/null
@@ -0,0 +1,21 @@
+0 10 d 0 0
+0 7 pi 0 1 p1
+0 8 #comment 0 1 > c1 
+0 1 d 0 0
+1 3 #text 0 1 
+text
+1 5 a 0 0
+1 3 #text 0 1 text
+
+1 4 #cdata-section 0 1 cdata
+1 14 #text 0 1 
+
+1 7 pi 0 1 p2
+1 14 #text 0 1 
+
+1 8 #comment 0 1 > c2 
+1 14 #text 0 1 
+
+0 15 d 0 0
+0 7 pi 0 1 p3
+0 8 #comment 0 1 > c3 
diff --git a/result/boundaries1.xml.sax b/result/boundaries1.xml.sax
new file mode 100644 (file)
index 0000000..19e3181
--- /dev/null
@@ -0,0 +1,32 @@
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.internalSubset(d, , )
+SAX.entityDecl(a, 1, (null), (null), ]>)
+SAX.getEntity(a)
+SAX.entityDecl(b, 1, (null), (null), ]>)
+SAX.getEntity(b)
+SAX.comment(> ]> )
+SAX.externalSubset(d, , )
+SAX.processingInstruction(pi, p1)
+SAX.comment(> c1 )
+SAX.startElement(d, a='>', b='>')
+SAX.characters(
+text, 5)
+SAX.getEntity(a)
+SAX.characters(]>, 2)
+SAX.reference(a)
+SAX.characters(text
+, 5)
+SAX.pcdata(cdata, 5)
+SAX.characters(
+, 1)
+SAX.processingInstruction(pi, p2)
+SAX.characters(
+, 1)
+SAX.comment(> c2 )
+SAX.characters(
+, 1)
+SAX.endElement(d)
+SAX.processingInstruction(pi, p3)
+SAX.comment(> c3 )
+SAX.endDocument()
diff --git a/result/boundaries1.xml.sax2 b/result/boundaries1.xml.sax2
new file mode 100644 (file)
index 0000000..b3ad5e8
--- /dev/null
@@ -0,0 +1,33 @@
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.internalSubset(d, , )
+SAX.entityDecl(a, 1, (null), (null), ]>)
+SAX.getEntity(a)
+SAX.entityDecl(b, 1, (null), (null), ]>)
+SAX.getEntity(b)
+SAX.comment(> ]> )
+SAX.externalSubset(d, , )
+SAX.processingInstruction(pi, p1)
+SAX.comment(> c1 )
+SAX.startElementNs(d, NULL, NULL, 0, 2, 0, a='>" b...', 1, b='>'>
+...', 1)
+SAX.characters(
+text, 5)
+SAX.getEntity(a)
+SAX.characters(]>, 2)
+SAX.reference(a)
+SAX.characters(text
+, 5)
+SAX.pcdata(cdata, 5)
+SAX.characters(
+, 1)
+SAX.processingInstruction(pi, p2)
+SAX.characters(
+, 1)
+SAX.comment(> c2 )
+SAX.characters(
+, 1)
+SAX.endElementNs(d, NULL, NULL)
+SAX.processingInstruction(pi, p3)
+SAX.comment(> c3 )
+SAX.endDocument()
index be77781..7dc0bb0 100644 (file)
@@ -5,16 +5,3 @@
 Entity: line 1: 
 A<lbbbbbbbbbbbbbbbbbbb_
 ^
-./test/errors/754946.xml:4: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
-
-  <![
-  ^
-./test/errors/754946.xml:4: parser error : DOCTYPE improperly terminated
-  <![
-  ^
-./test/errors/754946.xml:4: parser error : StartTag: invalid element name
-  <![
-   ^
-./test/errors/754946.xml:4: parser error : Extra content at the end of the document
-  <![
-   ^
index be77781..7dc0bb0 100644 (file)
@@ -5,16 +5,3 @@
 Entity: line 1: 
 A<lbbbbbbbbbbbbbbbbbbb_
 ^
-./test/errors/754946.xml:4: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
-
-  <![
-  ^
-./test/errors/754946.xml:4: parser error : DOCTYPE improperly terminated
-  <![
-  ^
-./test/errors/754946.xml:4: parser error : StartTag: invalid element name
-  <![
-   ^
-./test/errors/754946.xml:4: parser error : Extra content at the end of the document
-  <![
-   ^
index 49395b6..5d6a8b2 100644 (file)
@@ -1,4 +1,8 @@
-./test/errors/754946.xml:1: parser error : Extra content at the end of the document
-<!DOCTYPE A [
-            ^
+./test/errors/754946.xml:3: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
+
+  %SYSTEM;
+          ^
+Entity: line 1: 
+A<lbbbbbbbbbbbbbbbbbbb_
+^
 ./test/errors/754946.xml : failed to parse
index f45cb5a..1ea73d1 100644 (file)
@@ -1,7 +1,7 @@
 ./test/errors/754947.xml:1: parser error : Input is not proper UTF-8, indicate encoding !
 Bytes: 0xEE 0x5D 0x5D 0x3E
-<d><![CDATA[0000000000000î]]>
+<d><![CDATA[0000000000000
                          ^
 ./test/errors/754947.xml:1: parser error : Premature end of data in tag d line 1
-<d><![CDATA[0000000000000î]]>
-                             ^
+<d><![CDATA[0000000000000
+                         ^
index f45cb5a..1ea73d1 100644 (file)
@@ -1,7 +1,7 @@
 ./test/errors/754947.xml:1: parser error : Input is not proper UTF-8, indicate encoding !
 Bytes: 0xEE 0x5D 0x5D 0x3E
-<d><![CDATA[0000000000000î]]>
+<d><![CDATA[0000000000000
                          ^
 ./test/errors/754947.xml:1: parser error : Premature end of data in tag d line 1
-<d><![CDATA[0000000000000î]]>
-                             ^
+<d><![CDATA[0000000000000
+                         ^
index 4d2f52e..d248323 100644 (file)
@@ -1,5 +1,5 @@
 ./test/errors/754947.xml:1: parser error : Input is not proper UTF-8, indicate encoding !
 Bytes: 0xEE 0x5D 0x5D 0x3E
-<d><![CDATA[0000000000000î]]>
+<d><![CDATA[0000000000000
                          ^
 ./test/errors/754947.xml : failed to parse
index 4c45475..01c8157 100644 (file)
@@ -18,18 +18,8 @@ Entity: line 1:
                    ^
 ./test/errors/759573-2.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
 
-%xx;\ 3ÿggKENSMYNT&#35;MENTD&#372zz;'>
+%xx;\ 3
     ^
 Entity: line 2: 
 <![INCLUDE[
-^
-./test/errors/759573-2.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
-
-%xx;\ 3ÿggKENSMYNT&#35;MENTD&#372zz;'>
-    ^
-./test/errors/759573-2.xml:6: parser error : DOCTYPE improperly terminated
-%xx;\ 3ÿggKENSMYNT&#35;MENTD&#372zz;'>
-    ^
-./test/errors/759573-2.xml:6: parser error : Start tag expected, '<' not found
-%xx;\ 3ÿggKENSMYNT&#35;MENTD&#372zz;'>
-    ^
+  ^
index 4c45475..01c8157 100644 (file)
@@ -18,18 +18,8 @@ Entity: line 1:
                    ^
 ./test/errors/759573-2.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
 
-%xx;\ 3ÿggKENSMYNT&#35;MENTD&#372zz;'>
+%xx;\ 3
     ^
 Entity: line 2: 
 <![INCLUDE[
-^
-./test/errors/759573-2.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
-
-%xx;\ 3ÿggKENSMYNT&#35;MENTD&#372zz;'>
-    ^
-./test/errors/759573-2.xml:6: parser error : DOCTYPE improperly terminated
-%xx;\ 3ÿggKENSMYNT&#35;MENTD&#372zz;'>
-    ^
-./test/errors/759573-2.xml:6: parser error : Start tag expected, '<' not found
-%xx;\ 3ÿggKENSMYNT&#35;MENTD&#372zz;'>
-    ^
+  ^
index baac164..39f77a6 100644 (file)
@@ -1,4 +1,26 @@
-./test/errors/759573-2.xml:2: parser error : Extra content at the end of the document
-<!DOCTYPE test [
-               ^
+Entity: line 1: parser error : Space required after '<!ENTITY'
+%zz;
+    ^
+Entity: line 1: 
+<!ENTITY<?xDOCTYPEm~?>
+        ^
+Entity: line 1: parser error : xmlParseEntityDecl: no name
+%zz;
+    ^
+Entity: line 1: 
+<!ENTITY<?xDOCTYPEm~?>
+        ^
+Entity: line 1: parser error : ParsePI: PI xDOCTYPEm space expected
+%zz;
+    ^
+Entity: line 1: 
+<!ENTITY<?xDOCTYPEm~?>
+                   ^
+./test/errors/759573-2.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
+
+%xx;\ 3
+    ^
+Entity: line 2: 
+<![INCLUDE[
+  ^
 ./test/errors/759573-2.xml : failed to parse
index 5524750..74322b6 100644 (file)
@@ -19,14 +19,4 @@ T t (A)><!ENTITY % xx '&#37;<![INCLUDE[000&#37;&#3000;000&#37;z;'><!ENTITYz>%xx;
                                                                                ^
 Entity: line 1: 
 %<![INCLUDE[000%ஸ000%z;
- ^
-./test/errors/759573.xml:1: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
-
-T t (A)><!ENTITY % xx '&#37;<![INCLUDE[000&#37;&#3000;000&#37;z;'><!ENTITYz>%xx;
-                                                                               ^
-./test/errors/759573.xml:1: parser error : DOCTYPE improperly terminated
-T t (A)><!ENTITY % xx '&#37;<![INCLUDE[000&#37;&#3000;000&#37;z;'><!ENTITYz>%xx;
-                                                                               ^
-./test/errors/759573.xml:1: parser error : Start tag expected, '<' not found
-T t (A)><!ENTITY % xx '&#37;<![INCLUDE[000&#37;&#3000;000&#37;z;'><!ENTITYz>%xx;
-                                                                               ^
+   ^
index 5524750..74322b6 100644 (file)
@@ -19,14 +19,4 @@ T t (A)><!ENTITY % xx '&#37;<![INCLUDE[000&#37;&#3000;000&#37;z;'><!ENTITYz>%xx;
                                                                                ^
 Entity: line 1: 
 %<![INCLUDE[000%ஸ000%z;
- ^
-./test/errors/759573.xml:1: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
-
-T t (A)><!ENTITY % xx '&#37;<![INCLUDE[000&#37;&#3000;000&#37;z;'><!ENTITYz>%xx;
-                                                                               ^
-./test/errors/759573.xml:1: parser error : DOCTYPE improperly terminated
-T t (A)><!ENTITY % xx '&#37;<![INCLUDE[000&#37;&#3000;000&#37;z;'><!ENTITYz>%xx;
-                                                                               ^
-./test/errors/759573.xml:1: parser error : Start tag expected, '<' not found
-T t (A)><!ENTITY % xx '&#37;<![INCLUDE[000&#37;&#3000;000&#37;z;'><!ENTITYz>%xx;
-                                                                               ^
+   ^
index 1b6addb..37df762 100644 (file)
@@ -1,4 +1,23 @@
-./test/errors/759573.xml:1: parser error : Extra content at the end of the document
-<?h?><!DOCTYPEt[<!ELEMENT t (A)><!ENTITY % xx '&#37;<![INCLUDE[000&#37;&#3000;00
-               ^
+./test/errors/759573.xml:1: parser error : Space required after '<!ENTITY'
+ELEMENT t (A)><!ENTITY % xx '&#37;<![INCLUDE[000&#37;&#3000;000&#37;z;'><!ENTITY
+                                                                               ^
+./test/errors/759573.xml:1: parser error : Space required after the entity name
+LEMENT t (A)><!ENTITY % xx '&#37;<![INCLUDE[000&#37;&#3000;000&#37;z;'><!ENTITYz
+                                                                               ^
+./test/errors/759573.xml:1: parser error : Entity value required
+LEMENT t (A)><!ENTITY % xx '&#37;<![INCLUDE[000&#37;&#3000;000&#37;z;'><!ENTITYz
+                                                                               ^
+./test/errors/759573.xml:1: parser error : PEReference: no name
+T t (A)><!ENTITY % xx '&#37;<![INCLUDE[000&#37;&#3000;000&#37;z;'><!ENTITYz>%xx;
+                                                                               ^
+Entity: line 1: 
+%<![INCLUDE[000%ஸ000%z;
+ ^
+./test/errors/759573.xml:1: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
+
+T t (A)><!ENTITY % xx '&#37;<![INCLUDE[000&#37;&#3000;000&#37;z;'><!ENTITYz>%xx;
+                                                                               ^
+Entity: line 1: 
+%<![INCLUDE[000%ஸ000%z;
+   ^
 ./test/errors/759573.xml : failed to parse
index 288026e..dd0e68a 100644 (file)
@@ -1,6 +1,6 @@
-Entity: line 2: parser error : Detected an entity reference loop
-        %z; %z; %z; %z; %z;
-           ^
+./test/errors/759579.xml:9: parser error : Detected an entity reference loop
+    %z;
+       ^
 Entity: line 2: 
         %z; %z; %z; %z; %z;
            ^
index 288026e..dd0e68a 100644 (file)
@@ -1,6 +1,6 @@
-Entity: line 2: parser error : Detected an entity reference loop
-        %z; %z; %z; %z; %z;
-           ^
+./test/errors/759579.xml:9: parser error : Detected an entity reference loop
+    %z;
+       ^
 Entity: line 2: 
         %z; %z; %z; %z; %z;
            ^
index 09408f5..e9a929c 100644 (file)
@@ -1,6 +1,6 @@
-Entity: line 2: parser error : Detected an entity reference loop
-        %z; %z; %z; %z; %z;
-           ^
+./test/errors/759579.xml:9: parser error : Detected an entity reference loop
+    %z;
+       ^
 Entity: line 2: 
         %z; %z; %z; %z; %z;
            ^
index f757963..f7c7b48 100644 (file)
@@ -1,4 +1,4 @@
 ./test/errors/cdata.xml:2: parser error : Input is not proper UTF-8, indicate encoding !
 Bytes: 0xE1 0x72 0x5D 0x5D
-<A><![CDATA[Cár]]></A>
+<A><![CDATA[C
              ^
index f757963..f7c7b48 100644 (file)
@@ -1,4 +1,4 @@
 ./test/errors/cdata.xml:2: parser error : Input is not proper UTF-8, indicate encoding !
 Bytes: 0xE1 0x72 0x5D 0x5D
-<A><![CDATA[Cár]]></A>
+<A><![CDATA[C
              ^
index cf83d2b..af1321e 100644 (file)
@@ -1,5 +1,5 @@
 ./test/errors/cdata.xml:2: parser error : Input is not proper UTF-8, indicate encoding !
 Bytes: 0xE1 0x72 0x5D 0x5D
-<A><![CDATA[Cár]]></A>
+<A><![CDATA[C
              ^
 ./test/errors/cdata.xml : failed to parse
index 9fcd603..6451157 100644 (file)
@@ -8,9 +8,3 @@
 
 <!ELEMENT aElement (a |b * >
                          ^
-./test/errors/content1.xml:7: parser error : DOCTYPE improperly terminated
-<!ELEMENT aElement (a |b * >
-                         ^
-./test/errors/content1.xml:7: parser error : Start tag expected, '<' not found
-<!ELEMENT aElement (a |b * >
-                         ^
index 9fcd603..6451157 100644 (file)
@@ -8,9 +8,3 @@
 
 <!ELEMENT aElement (a |b * >
                          ^
-./test/errors/content1.xml:7: parser error : DOCTYPE improperly terminated
-<!ELEMENT aElement (a |b * >
-                         ^
-./test/errors/content1.xml:7: parser error : Start tag expected, '<' not found
-<!ELEMENT aElement (a |b * >
-                         ^
index d806a63..47a6b6f 100644 (file)
@@ -8,7 +8,4 @@
 
 <!ELEMENT aElement (a |b * >
                          ^
-./test/errors/content1.xml:7: parser error : DOCTYPE improperly terminated
-<!ELEMENT aElement (a |b * >
-                         ^
 ./test/errors/content1.xml : failed to parse
diff --git a/result/errors/rec_att_default.xml.ent b/result/errors/rec_att_default.xml.ent
new file mode 100644 (file)
index 0000000..375a0d6
--- /dev/null
@@ -0,0 +1,6 @@
+./test/errors/rec_att_default.xml:3: parser error : Entity 'b' not defined
+  <!ATTLIST x y CDATA "&a;">
+                          ^
+./test/errors/rec_att_default.xml:6: parser error : Detected an entity reference loop
+<doc attr="&a;"/>
+              ^
diff --git a/result/errors/rec_att_default.xml.err b/result/errors/rec_att_default.xml.err
new file mode 100644 (file)
index 0000000..375a0d6
--- /dev/null
@@ -0,0 +1,6 @@
+./test/errors/rec_att_default.xml:3: parser error : Entity 'b' not defined
+  <!ATTLIST x y CDATA "&a;">
+                          ^
+./test/errors/rec_att_default.xml:6: parser error : Detected an entity reference loop
+<doc attr="&a;"/>
+              ^
diff --git a/result/errors/rec_att_default.xml.str b/result/errors/rec_att_default.xml.str
new file mode 100644 (file)
index 0000000..11e6556
--- /dev/null
@@ -0,0 +1,7 @@
+./test/errors/rec_att_default.xml:3: parser error : Entity 'b' not defined
+  <!ATTLIST x y CDATA "&a;">
+                          ^
+./test/errors/rec_att_default.xml:6: parser error : Detected an entity reference loop
+<doc attr="&a;"/>
+              ^
+./test/errors/rec_att_default.xml : failed to parse
index d8ccec1..1b5f50f 100644 (file)
@@ -1,123 +1,3 @@
 test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
 <ent>&e; &e; &e; &e;</ent>
         ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-test/errors/rec_ext.ent:1: parser error : Detected an entity reference loop
-<ent>&e; &e; &e; &e;</ent>
-        ^
-./test/errors/rec_ext_ent.xml:4: parser error : Detected an entity reference loop
-<doc>&e; &e; &e; &e;</doc>
-        ^
diff --git a/result/errors/utf8-1.xml.ent b/result/errors/utf8-1.xml.ent
new file mode 100644 (file)
index 0000000..35d8498
--- /dev/null
@@ -0,0 +1,9 @@
+./test/errors/utf8-1.xml:1: parser error : StartTag: invalid element name
+..............................................................................<<
+                                                                               ^
+./test/errors/utf8-1.xml:1: parser error : StartTag: invalid element name
+..............................................................................<<
+                                                                               ^
+./test/errors/utf8-1.xml:2: parser error : Premature end of data in tag d line 1
+
+^
diff --git a/result/errors/utf8-1.xml.err b/result/errors/utf8-1.xml.err
new file mode 100644 (file)
index 0000000..35d8498
--- /dev/null
@@ -0,0 +1,9 @@
+./test/errors/utf8-1.xml:1: parser error : StartTag: invalid element name
+..............................................................................<<
+                                                                               ^
+./test/errors/utf8-1.xml:1: parser error : StartTag: invalid element name
+..............................................................................<<
+                                                                               ^
+./test/errors/utf8-1.xml:2: parser error : Premature end of data in tag d line 1
+
+^
diff --git a/result/errors/utf8-1.xml.str b/result/errors/utf8-1.xml.str
new file mode 100644 (file)
index 0000000..8c6df1d
--- /dev/null
@@ -0,0 +1,4 @@
+./test/errors/utf8-1.xml:1: parser error : StartTag: invalid element name
+..............................................................................<<
+                                                                               ^
+./test/errors/utf8-1.xml : failed to parse
diff --git a/result/errors/utf8-2.xml.ent b/result/errors/utf8-2.xml.ent
new file mode 100644 (file)
index 0000000..1631d66
--- /dev/null
@@ -0,0 +1,9 @@
+./test/errors/utf8-2.xml:1: parser error : StartTag: invalid element name
+<d>.<<€€€€€€€€€€€€€€€€€€€€€€€€
+     ^
+./test/errors/utf8-2.xml:2: parser error : Couldn't find end of Start Tag â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬ line 1
+
+^
+./test/errors/utf8-2.xml:2: parser error : Premature end of data in tag d line 1
+
+^
diff --git a/result/errors/utf8-2.xml.err b/result/errors/utf8-2.xml.err
new file mode 100644 (file)
index 0000000..1631d66
--- /dev/null
@@ -0,0 +1,9 @@
+./test/errors/utf8-2.xml:1: parser error : StartTag: invalid element name
+<d>.<<€€€€€€€€€€€€€€€€€€€€€€€€
+     ^
+./test/errors/utf8-2.xml:2: parser error : Couldn't find end of Start Tag â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬ line 1
+
+^
+./test/errors/utf8-2.xml:2: parser error : Premature end of data in tag d line 1
+
+^
diff --git a/result/errors/utf8-2.xml.str b/result/errors/utf8-2.xml.str
new file mode 100644 (file)
index 0000000..f8db7f7
--- /dev/null
@@ -0,0 +1,4 @@
+./test/errors/utf8-2.xml:1: parser error : StartTag: invalid element name
+<d>.<<€€€€€€€€€€€€€€€€€€€€€€€€
+     ^
+./test/errors/utf8-2.xml : failed to parse
index 3ddc203..f4e0892 100644 (file)
@@ -5,13 +5,3 @@
 Entity: line 1: 
 <:0000
 ^
-./test/errors10/781205.xml:4: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
-
-
-^
-./test/errors10/781205.xml:4: parser error : DOCTYPE improperly terminated
-
-^
-./test/errors10/781205.xml:4: parser error : Start tag expected, '<' not found
-
-^
index 655f41a..6153cc9 100644 (file)
@@ -5,9 +5,3 @@
 
 
 ^
-./test/errors10/781361.xml:4: parser error : DOCTYPE improperly terminated
-
-^
-./test/errors10/781361.xml:4: parser error : Start tag expected, '<' not found
-
-^
diff --git a/result/noent/boundaries1.xml b/result/noent/boundaries1.xml
new file mode 100644 (file)
index 0000000..da20872
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<!DOCTYPE d [
+<!ENTITY a "]>">
+<!ENTITY b "]>">
+<!--> ]> -->]>
+<?pi p1?>
+<!--> c1 -->
+<d a="&gt;" b="&gt;">
+text]&gt;text
+<![CDATA[cdata]]>
+<?pi p2?>
+<!--> c2 -->
+</d>
+<?pi p3?>
+<!--> c3 -->
diff --git a/result/noent/boundaries1.xml.sax2 b/result/noent/boundaries1.xml.sax2
new file mode 100644 (file)
index 0000000..093ac3b
--- /dev/null
@@ -0,0 +1,32 @@
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.internalSubset(d, , )
+SAX.entityDecl(a, 1, (null), (null), ]>)
+SAX.getEntity(a)
+SAX.entityDecl(b, 1, (null), (null), ]>)
+SAX.getEntity(b)
+SAX.comment(> ]> )
+SAX.externalSubset(d, , )
+SAX.processingInstruction(pi, p1)
+SAX.comment(> c1 )
+SAX.startElementNs(d, NULL, NULL, 0, 2, 0, a='>" b...', 1, b='>'>
+...', 1)
+SAX.characters(
+text, 5)
+SAX.getEntity(a)
+SAX.characters(]>, 2)
+SAX.characters(text
+, 5)
+SAX.pcdata(cdata, 5)
+SAX.characters(
+, 1)
+SAX.processingInstruction(pi, p2)
+SAX.characters(
+, 1)
+SAX.comment(> c2 )
+SAX.characters(
+, 1)
+SAX.endElementNs(d, NULL, NULL)
+SAX.processingInstruction(pi, p3)
+SAX.comment(> c3 )
+SAX.endDocument()
diff --git a/result/schemas/issue491_0_0.err b/result/schemas/issue491_0_0.err
new file mode 100644 (file)
index 0000000..9b2bb96
--- /dev/null
@@ -0,0 +1 @@
+./test/schemas/issue491_0.xsd:8: element complexType: Schemas parser error : complex type 'ChildType': The content type of both, the type and its base type, must either 'mixed' or 'element-only'.
diff --git a/result/schemas/oss-fuzz-51295_0_0.err b/result/schemas/oss-fuzz-51295_0_0.err
new file mode 100644 (file)
index 0000000..1e89524
--- /dev/null
@@ -0,0 +1,2 @@
+./test/schemas/oss-fuzz-51295_0.xsd:2: element element: Schemas parser error : element decl. 'e': The element declaration 'e' defines a circular substitution group to element declaration 'e'.
+./test/schemas/oss-fuzz-51295_0.xsd:2: element element: Schemas parser error : element decl. 'e': The element declaration 'e' defines a circular substitution group to element declaration 'e'.
index 5ff5699..dd9df08 100644 (file)
@@ -1,6 +1,6 @@
 ./test/valid/781333.xml:4: element a: validity error : Element a content does not follow the DTD, expecting ( ..., got 
 <a/>
     ^
-./test/valid/781333.xml:5: element a: validity error : Element a content does not follow the DTD, Expecting more child
+./test/valid/781333.xml:5: element a: validity error : Element a content does not follow the DTD, Expecting more children
 
 ^
index 5272694..8f87417 100644 (file)
@@ -5,17 +5,3 @@
 Entity: line 1: 
 &lt;!ELEMENT root (middle) >
 ^
-./test/valid/t8.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
-
-%defroot; %defmiddle; %deftest;
-                     ^
-Entity: line 1: 
-&lt;!ELEMENT middle (test) >
-^
-./test/valid/t8.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
-
-%defroot; %defmiddle; %deftest;
-                               ^
-Entity: line 1: 
-&lt;!ELEMENT test (#PCDATA) >
-^
index 8da08fb..06b7baf 100644 (file)
@@ -5,18 +5,4 @@
 Entity: line 1: 
 &lt;!ELEMENT root (middle) >
 ^
-./test/valid/t8.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
-
-%defroot; %defmiddle; %deftest;
-                     ^
-Entity: line 1: 
-&lt;!ELEMENT middle (test) >
-^
-./test/valid/t8.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
-
-%defroot; %defmiddle; %deftest;
-                               ^
-Entity: line 1: 
-&lt;!ELEMENT test (#PCDATA) >
-^
 ./test/valid/t8.xml : failed to parse
index 2846b19..211e9e8 100644 (file)
@@ -5,17 +5,3 @@
 Entity: line 1: 
 &lt;!ELEMENT root (middle) >
 ^
-./test/valid/t8a.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
-
-%defroot;%defmiddle;%deftest;
-                    ^
-Entity: line 1: 
-&lt;!ELEMENT middle (test) >
-^
-./test/valid/t8a.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
-
-%defroot;%defmiddle;%deftest;
-                             ^
-Entity: line 1: 
-&lt;!ELEMENT test (#PCDATA) >
-^
index 6abe75a..2ae90c9 100644 (file)
@@ -5,18 +5,4 @@
 Entity: line 1: 
 &lt;!ELEMENT root (middle) >
 ^
-./test/valid/t8a.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
-
-%defroot;%defmiddle;%deftest;
-                    ^
-Entity: line 1: 
-&lt;!ELEMENT middle (test) >
-^
-./test/valid/t8a.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration
-
-%defroot;%defmiddle;%deftest;
-                             ^
-Entity: line 1: 
-&lt;!ELEMENT test (#PCDATA) >
-^
 ./test/valid/t8a.xml : failed to parse
index 483490a..0880e0a 100644 (file)
@@ -9,13 +9,8 @@
 #include "libxml.h"
 #include <stdio.h>
 
-#if !defined(_WIN32)
-#include <unistd.h>
-#endif
 #include <string.h>
-#include <sys/types.h>
 #include <sys/stat.h>
-#include <fcntl.h>
 
 #include <libxml/parser.h>
 #include <libxml/parserInternals.h>
@@ -1054,13 +1049,19 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
     old_tests = nb_tests;
     old_leaks = nb_leaks;
     xsdTest();
-    if ((nb_errors == old_errors) && (nb_leaks == old_leaks))
-       printf("Ran %d tests, no errors\n", nb_tests - old_tests);
-    else
-       printf("Ran %d tests, %d errors, %d leaks\n",
-              nb_tests - old_tests,
-              nb_errors - old_errors,
-              nb_leaks - old_leaks);
+    printf("Ran %d tests, %d errors, %d leaks\n",
+           nb_tests - old_tests,
+           nb_errors - old_errors,
+           nb_leaks - old_leaks);
+    if (nb_errors - old_errors == 10) {
+        printf("10 errors were expected\n");
+        nb_errors = old_errors;
+    } else {
+        printf("10 errors were expected, got %d errors\n",
+               nb_errors - old_errors);
+        nb_errors = old_errors + 1;
+    }
+
     old_errors = nb_errors;
     old_tests = nb_tests;
     old_leaks = nb_leaks;
@@ -1072,6 +1073,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
               nb_tests - old_tests,
               nb_errors - old_errors,
               nb_leaks - old_leaks);
+
     old_errors = nb_errors;
     old_tests = nb_tests;
     old_leaks = nb_leaks;
@@ -1083,6 +1085,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
               nb_tests - old_tests,
               nb_errors - old_errors,
               nb_leaks - old_leaks);
+
     old_errors = nb_errors;
     old_tests = nb_tests;
     old_leaks = nb_leaks;
@@ -1100,6 +1103,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
               nb_errors - old_errors,
               nb_internals,
               nb_leaks - old_leaks);
+
     old_errors = nb_errors;
     old_tests = nb_tests;
     old_leaks = nb_leaks;
@@ -1107,16 +1111,20 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
     nb_schematas = 0;
     xstcMetadata("xstc/Tests/Metadata/SunXMLSchema1-0-20020116.testSet",
                 "xstc/Tests/");
-    if ((nb_errors == old_errors) && (nb_leaks == old_leaks))
+    if ((nb_errors == old_errors) && (nb_leaks == old_leaks)) {
        printf("Ran %d tests (%d schemata), no errors\n",
               nb_tests - old_tests, nb_schematas);
-    else
+    } else {
        printf("Ran %d tests (%d schemata), %d errors (%d internals), %d leaks\n",
               nb_tests - old_tests,
               nb_schematas,
               nb_errors - old_errors,
               nb_internals,
               nb_leaks - old_leaks);
+        printf("Some errors were expected.\n");
+        nb_errors = old_errors;
+    }
+
     old_errors = nb_errors;
     old_tests = nb_tests;
     old_leaks = nb_leaks;
@@ -1124,16 +1132,19 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
     nb_schematas = 0;
     xstcMetadata("xstc/Tests/Metadata/MSXMLSchema1-0-20020116.testSet",
                 "xstc/Tests/");
-    if ((nb_errors == old_errors) && (nb_leaks == old_leaks))
+    if ((nb_errors == old_errors) && (nb_leaks == old_leaks)) {
        printf("Ran %d tests (%d schemata), no errors\n",
               nb_tests - old_tests, nb_schematas);
-    else
+    } else {
        printf("Ran %d tests (%d schemata), %d errors (%d internals), %d leaks\n",
               nb_tests - old_tests,
               nb_schematas,
               nb_errors - old_errors,
               nb_internals,
               nb_leaks - old_leaks);
+        printf("Some errors were expected.\n");
+        nb_errors = old_errors;
+    }
 
     if ((nb_errors == 0) && (nb_leaks == 0)) {
         ret = 0;
index 8626b91..a29b92a 100644 (file)
--- a/runtest.c
+++ b/runtest.c
 #include "libxml.h"
 #include <stdio.h>
 
-#if !defined(_WIN32)
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#elif defined (_WIN32)
+#include <io.h>
 #endif
 #include <string.h>
-#include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 
 #ifdef LIBXML_HTML_ENABLED
 #include <libxml/HTMLparser.h>
 #include <libxml/HTMLtree.h>
-
-/*
- * pseudo flag for the unification of HTML and XML tests
- */
-#define XML_PARSE_HTML 1 << 24
 #endif
 
 #if defined(LIBXML_THREAD_ENABLED) && defined(LIBXML_CATALOG_ENABLED)
 #endif
 
 /*
+ * pseudo flag for the unification of HTML and XML tests
+ */
+#define XML_PARSE_HTML 1 << 24
+
+/*
  * O_BINARY is just for Windows compatibility - if it isn't defined
  * on this system, avoid any compilation error
  */
@@ -111,7 +112,6 @@ static int checkTestFile(const char *filename);
 #if defined(_WIN32)
 
 #include <windows.h>
-#include <io.h>
 
 typedef struct
 {
@@ -247,7 +247,7 @@ testExternalEntityLoader(const char *URL, const char *ID,
 static char testErrors[32769];
 static int testErrorsSize = 0;
 
-static void XMLCDECL
+static void
 testErrorHandler(void *ctx  ATTRIBUTE_UNUSED, const char *msg, ...) {
     va_list args;
     int res;
@@ -269,7 +269,7 @@ testErrorHandler(void *ctx  ATTRIBUTE_UNUSED, const char *msg, ...) {
     testErrors[testErrorsSize] = 0;
 }
 
-static void XMLCDECL
+static void
 channel(void *ctx  ATTRIBUTE_UNUSED, const char *msg, ...) {
     va_list args;
     int res;
@@ -292,7 +292,7 @@ channel(void *ctx  ATTRIBUTE_UNUSED, const char *msg, ...) {
 }
 
 /**
- * xmlParserPrintFileContext:
+ * xmlParserPrintFileContextInternal:
  * @input:  an xmlParserInputPtr input
  *
  * Displays current context within the input content for error tracking
@@ -301,12 +301,14 @@ channel(void *ctx  ATTRIBUTE_UNUSED, const char *msg, ...) {
 static void
 xmlParserPrintFileContextInternal(xmlParserInputPtr input ,
                xmlGenericErrorFunc chanl, void *data ) {
-    const xmlChar *cur, *base;
+    const xmlChar *cur, *base, *start;
     unsigned int n, col;       /* GCC warns if signed, because compared with sizeof() */
     xmlChar  content[81]; /* space for 80 chars + line terminator */
     xmlChar *ctnt;
 
-    if (input == NULL) return;
+    if ((input == NULL) || (input->cur == NULL))
+        return;
+
     cur = input->cur;
     base = input->base;
     /* skip backwards over any end-of-lines */
@@ -316,21 +318,32 @@ xmlParserPrintFileContextInternal(xmlParserInputPtr input ,
     n = 0;
     /* search backwards for beginning-of-line (to max buff size) */
     while ((n++ < (sizeof(content)-1)) && (cur > base) &&
-   (*(cur) != '\n') && (*(cur) != '\r'))
+          (*(cur) != '\n') && (*(cur) != '\r'))
         cur--;
-    if ((*(cur) == '\n') || (*(cur) == '\r')) cur++;
+    if ((*(cur) == '\n') || (*(cur) == '\r')) {
+        cur++;
+    } else {
+        /* skip over continuation bytes */
+        while ((cur < input->cur) && ((*cur & 0xC0) == 0x80))
+            cur++;
+    }
     /* calculate the error position in terms of the current position */
     col = input->cur - cur;
     /* search forward for end-of-line (to max buff size) */
     n = 0;
-    ctnt = content;
+    start = cur;
     /* copy selected text to our buffer */
-    while ((*cur != 0) && (*(cur) != '\n') &&
-   (*(cur) != '\r') && (n < sizeof(content)-1)) {
-               *ctnt++ = *cur++;
-       n++;
+    while ((*cur != 0) && (*(cur) != '\n') && (*(cur) != '\r')) {
+        int len = input->end - cur;
+        int c = xmlGetUTF8Char(cur, &len);
+
+        if ((c < 0) || (n + len > sizeof(content)-1))
+            break;
+        cur += len;
+       n += len;
     }
-    *ctnt = 0;
+    memcpy(content, start, n);
+    content[n] = 0;
     /* print out the selected text */
     chanl(data ,"%s\n", content);
     /* create blank line with problem pointer */
@@ -531,10 +544,17 @@ testStructuredErrorHandler(void *ctx  ATTRIBUTE_UNUSED, xmlErrorPtr err) {
 
 static void
 initializeLibxml2(void) {
-    xmlPedanticParserDefault(0);
-
-    xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup);
+    /*
+     * This verifies that xmlInitParser doesn't allocate memory with
+     * xmlMalloc
+     */
+    xmlFree = NULL;
+    xmlMalloc = NULL;
+    xmlRealloc = NULL;
+    xmlMemStrdup = NULL;
     xmlInitParser();
+    xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup);
+    xmlPedanticParserDefault(0);
     xmlSetExternalEntityLoader(testExternalEntityLoader);
     xmlSetStructuredErrorFunc(NULL, testStructuredErrorHandler);
 #ifdef LIBXML_SCHEMAS_ENABLED
@@ -1353,7 +1373,7 @@ commentDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *value)
  * Display and format a warning messages, gives file, line, position and
  * extra parameters.
  */
-static void XMLCDECL
+static void
 warningDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
 {
     va_list args;
@@ -1376,7 +1396,7 @@ warningDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
  * Display and format a error messages, gives file, line, position and
  * extra parameters.
  */
-static void XMLCDECL
+static void
 errorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
 {
     va_list args;
@@ -1399,7 +1419,7 @@ errorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
  * Display and format a fatalError messages, gives file, line, position and
  * extra parameters.
  */
-static void XMLCDECL
+static void
 fatalErrorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
 {
     va_list args;
@@ -1726,7 +1746,11 @@ saxParseTest(const char *filename, const char *result,
 
 #ifdef LIBXML_HTML_ENABLED
     if (options & XML_PARSE_HTML) {
-       htmlSAXParseFile(filename, NULL, emptySAXHandler, NULL);
+        htmlParserCtxtPtr ctxt;
+
+        ctxt = htmlNewSAXParserCtxt(emptySAXHandler, NULL);
+        htmlCtxtReadFile(ctxt, filename, NULL, options);
+        htmlFreeParserCtxt(ctxt);
        ret = 0;
     } else
 #endif
@@ -1750,7 +1774,11 @@ saxParseTest(const char *filename, const char *result,
     }
 #ifdef LIBXML_HTML_ENABLED
     if (options & XML_PARSE_HTML) {
-       htmlSAXParseFile(filename, NULL, debugHTMLSAXHandler, NULL);
+        htmlParserCtxtPtr ctxt;
+
+        ctxt = htmlNewSAXParserCtxt(debugHTMLSAXHandler, NULL);
+        htmlCtxtReadFile(ctxt, filename, NULL, options);
+        htmlFreeParserCtxt(ctxt);
        ret = 0;
     } else
 #endif
@@ -1963,6 +1991,306 @@ pushParseTest(const char *filename, const char *result,
     }
     return(0);
 }
+
+static int pushBoundaryCount;
+static int pushBoundaryRefCount;
+static int pushBoundaryCharsCount;
+static int pushBoundaryCDataCount;
+
+static void
+internalSubsetBnd(void *ctx, const xmlChar *name, const xmlChar *externalID,
+                  const xmlChar *systemID) {
+    pushBoundaryCount++;
+    xmlSAX2InternalSubset(ctx, name, externalID, systemID);
+}
+
+static void
+referenceBnd(void *ctx, const xmlChar *name) {
+    pushBoundaryRefCount++;
+    xmlSAX2Reference(ctx, name);
+}
+
+static void
+charactersBnd(void *ctx, const xmlChar *ch, int len) {
+    pushBoundaryCount++;
+    pushBoundaryCharsCount++;
+    xmlSAX2Characters(ctx, ch, len);
+}
+
+static void
+cdataBlockBnd(void *ctx, const xmlChar *ch, int len) {
+    pushBoundaryCount++;
+    pushBoundaryCDataCount++;
+    xmlSAX2CDataBlock(ctx, ch, len);
+}
+
+static void
+processingInstructionBnd(void *ctx, const xmlChar *target,
+                         const xmlChar *data) {
+    pushBoundaryCount++;
+    xmlSAX2ProcessingInstruction(ctx, target, data);
+}
+
+static void
+commentBnd(void *ctx, const xmlChar *value) {
+    xmlParserCtxtPtr ctxt = ctx;
+    if (ctxt->inSubset == 0)
+        pushBoundaryCount++;
+    xmlSAX2Comment(ctx, value);
+}
+
+static void
+startElementBnd(void *ctx, const xmlChar *xname, const xmlChar **atts) {
+    const char *name = (const char *)xname;
+
+    /* Some elements might be created automatically. */
+    if ((strcmp(name, "html") != 0) &&
+        (strcmp(name, "body") != 0) &&
+        (strcmp(name, "head") != 0) &&
+        (strcmp(name, "p") != 0)) {
+        pushBoundaryCount++;
+    }
+    xmlSAX2StartElement(ctx, xname, atts);
+}
+
+static void
+endElementBnd(void *ctx, const xmlChar *name) {
+    /*pushBoundaryCount++;*/
+    xmlSAX2EndElement(ctx, name);
+}
+
+static void
+startElementNsBnd(void *ctx, const xmlChar *localname, const xmlChar *prefix,
+                  const xmlChar *URI, int nb_namespaces,
+                  const xmlChar **namespaces, int nb_attributes,
+                  int nb_defaulted, const xmlChar **attributes) {
+    pushBoundaryCount++;
+    xmlSAX2StartElementNs(ctx, localname, prefix, URI, nb_namespaces,
+                          namespaces, nb_attributes, nb_defaulted, attributes);
+}
+
+static void
+endElementNsBnd(void *ctx, const xmlChar *localname, const xmlChar *prefix,
+                const xmlChar *URI) {
+    /*pushBoundaryCount++;*/
+    xmlSAX2EndElementNs(ctx, localname, prefix, URI);
+}
+
+/**
+ * pushBoundaryTest:
+ * @filename: the file to parse
+ * @result: the file with expected result
+ * @err: the file with error messages: unused
+ *
+ * Test whether the push parser detects boundaries between syntactical
+ * elements correctly.
+ *
+ * Returns 0 in case of success, an error code otherwise
+ */
+static int
+pushBoundaryTest(const char *filename, const char *result,
+                 const char *err ATTRIBUTE_UNUSED,
+                 int options) {
+    xmlParserCtxtPtr ctxt;
+    xmlDocPtr doc;
+    xmlSAXHandler bndSAX;
+    const char *base;
+    int size, res, numCallbacks;
+    int cur = 0;
+    unsigned long avail, oldConsumed, consumed;
+
+    /*
+     * If the parser made progress, check that exactly one construct was
+     * processed and that the input buffer is (almost) empty.
+     * Since we use a chunk size of 1, this tests whether content is
+     * processed as early as possible.
+     */
+
+    nb_tests++;
+
+    memset(&bndSAX, 0, sizeof(bndSAX));
+#ifdef LIBXML_HTML_ENABLED
+    if (options & XML_PARSE_HTML) {
+        xmlSAX2InitHtmlDefaultSAXHandler(&bndSAX);
+        bndSAX.startElement = startElementBnd;
+        bndSAX.endElement = endElementBnd;
+    } else
+#endif
+    {
+        xmlSAXVersion(&bndSAX, 2);
+        bndSAX.startElementNs = startElementNsBnd;
+        bndSAX.endElementNs = endElementNsBnd;
+    }
+
+    bndSAX.internalSubset = internalSubsetBnd;
+    bndSAX.reference = referenceBnd;
+    bndSAX.characters = charactersBnd;
+    bndSAX.cdataBlock = cdataBlockBnd;
+    bndSAX.processingInstruction = processingInstructionBnd;
+    bndSAX.comment = commentBnd;
+
+    /*
+     * load the document in memory and work from there.
+     */
+    if (loadMem(filename, &base, &size) != 0) {
+        fprintf(stderr, "Failed to load %s\n", filename);
+       return(-1);
+    }
+
+#ifdef LIBXML_HTML_ENABLED
+    if (options & XML_PARSE_HTML)
+       ctxt = htmlCreatePushParserCtxt(&bndSAX, NULL, base, 1, filename,
+                                       XML_CHAR_ENCODING_NONE);
+    else
+#endif
+    ctxt = xmlCreatePushParserCtxt(&bndSAX, NULL, base, 1, filename);
+    xmlCtxtUseOptions(ctxt, options);
+    cur = 1;
+    consumed = 0;
+    numCallbacks = 0;
+    avail = 0;
+    while ((cur < size) && (numCallbacks <= 1) && (avail <= 0)) {
+        int terminate = (cur + 1 >= size);
+        int isText = 0;
+
+        if (ctxt->instate == XML_PARSER_CONTENT) {
+            int firstChar = (ctxt->input->end > ctxt->input->cur) ?
+                            *ctxt->input->cur :
+                            base[cur];
+
+            if ((firstChar != '<') &&
+                ((options & XML_PARSE_HTML) || (firstChar != '&')))
+                isText = 1;
+        }
+
+        oldConsumed = ctxt->input->consumed +
+                      (unsigned long) (ctxt->input->cur - ctxt->input->base);
+
+        pushBoundaryCount = 0;
+        pushBoundaryRefCount = 0;
+        pushBoundaryCharsCount = 0;
+        pushBoundaryCDataCount = 0;
+
+#ifdef LIBXML_HTML_ENABLED
+        if (options & XML_PARSE_HTML)
+            htmlParseChunk(ctxt, base + cur, 1, terminate);
+        else
+#endif
+        xmlParseChunk(ctxt, base + cur, 1, terminate);
+       cur += 1;
+
+        /*
+         * Callback check: Check that only a single construct was parsed.
+         */
+        if (pushBoundaryRefCount > 0) {
+            numCallbacks = 1;
+        } else {
+            numCallbacks = pushBoundaryCount;
+            if (pushBoundaryCharsCount > 1) {
+                if (options & XML_PARSE_HTML) {
+                    /*
+                     * The HTML parser can generate a mix of chars and
+                     * references.
+                     */
+                    numCallbacks -= pushBoundaryCharsCount - 1;
+                } else {
+                    /*
+                     * Allow two chars callbacks. This can happen when
+                     * multi-byte chars are split across buffer boundaries.
+                     */
+                    numCallbacks -= 1;
+                }
+            }
+            if (options & XML_PARSE_HTML) {
+                /*
+                 * Allow multiple cdata callbacks in HTML mode.
+                 */
+                if (pushBoundaryCDataCount > 1)
+                    numCallbacks -= pushBoundaryCDataCount - 1;
+            }
+        }
+
+        /*
+         * Buffer check: If input was consumed, check that the input
+         * buffer is (almost) empty.
+         */
+        consumed = ctxt->input->consumed +
+                   (unsigned long) (ctxt->input->cur - ctxt->input->base);
+        if ((ctxt->instate != XML_PARSER_DTD) &&
+            (consumed >= 4) &&
+            (consumed != oldConsumed)) {
+            size_t max = 0;
+
+            avail = ctxt->input->end - ctxt->input->cur;
+
+            if ((options & XML_PARSE_HTML) &&
+                (ctxt->instate == XML_PARSER_END_TAG)) {
+                /* Something related to script parsing. */
+                max = 3;
+            } else if (isText) {
+                int c = *ctxt->input->cur;
+
+                /* 3 bytes for partial UTF-8 */
+                max = ((c == '<') || (c == '&')) ? 1 : 3;
+            } else if (ctxt->instate == XML_PARSER_CDATA_SECTION) {
+                /* 2 bytes for terminator, 3 bytes for UTF-8 */
+                max = 5;
+            }
+
+            if (avail <= max)
+                avail = 0;
+        }
+    }
+    doc = ctxt->myDoc;
+#ifdef LIBXML_HTML_ENABLED
+    if (options & XML_PARSE_HTML)
+        res = 1;
+    else
+#endif
+    res = ctxt->wellFormed;
+    xmlFreeParserCtxt(ctxt);
+    free((char *)base);
+    if (numCallbacks > 1) {
+       xmlFreeDoc(doc);
+       fprintf(stderr, "Failed push boundary callback test (%d@%lu-%lu): %s\n",
+                numCallbacks, oldConsumed, consumed, filename);
+       return(-1);
+    }
+    if (avail > 0) {
+       xmlFreeDoc(doc);
+       fprintf(stderr, "Failed push boundary buffer test (%lu@%lu): %s\n",
+                avail, consumed, filename);
+       return(-1);
+    }
+    if (!res) {
+       xmlFreeDoc(doc);
+       fprintf(stderr, "Failed to parse %s\n", filename);
+       return(-1);
+    }
+#ifdef LIBXML_HTML_ENABLED
+    if (options & XML_PARSE_HTML)
+       htmlDocDumpMemory(doc, (xmlChar **) &base, &size);
+    else
+#endif
+    xmlDocDumpMemory(doc, (xmlChar **) &base, &size);
+    xmlFreeDoc(doc);
+    res = compareFileMem(result, base, size);
+    if ((base == NULL) || (res != 0)) {
+       if (base != NULL)
+           xmlFree((char *)base);
+        fprintf(stderr, "Result for %s failed in %s\n", filename, result);
+       return(-1);
+    }
+    xmlFree((char *)base);
+    if (err != NULL) {
+       res = compareFileMem(err, testErrors, testErrorsSize);
+       if (res != 0) {
+           fprintf(stderr, "Error for %s failed\n", filename);
+           return(-1);
+       }
+    }
+    return(0);
+}
 #endif
 
 /**
@@ -2095,7 +2423,10 @@ errParseTest(const char *filename, const char *result, const char *err,
 #ifdef LIBXML_XINCLUDE_ENABLED
     if (options & XML_PARSE_XINCLUDE) {
        doc = xmlReadFile(filename, NULL, options);
-       xmlXIncludeProcessFlags(doc, options);
+       if (xmlXIncludeProcessFlags(doc, options) < 0) {
+           xmlFreeDoc(doc);
+            doc = NULL;
+        }
     } else
 #endif
     {
@@ -2420,12 +2751,11 @@ ignoreGenericError(void *ctx ATTRIBUTE_UNUSED,
 
 static void
 testXPath(const char *str, int xptr, int expr) {
-    xmlGenericErrorFunc handler = ignoreGenericError;
     xmlXPathObjectPtr res;
     xmlXPathContextPtr ctxt;
 
     /* Don't print generic errors to stderr. */
-    initGenericErrorDefaultFunc(&handler);
+    xmlSetGenericErrorFunc(NULL, ignoreGenericError);
 
     nb_tests++;
 #if defined(LIBXML_XPTR_ENABLED)
@@ -2457,7 +2787,7 @@ testXPath(const char *str, int xptr, int expr) {
     xmlXPathFreeContext(ctxt);
 
     /* Reset generic error handler. */
-    initGenericErrorDefaultFunc(NULL);
+    xmlSetGenericErrorFunc(NULL, NULL);
 }
 
 /**
@@ -4168,58 +4498,6 @@ testThread(void)
     return (res);
 }
 
-#elif defined __BEOS__
-#include <OS.h>
-
-static thread_id tid[MAX_ARGC];
-
-static int
-testThread(void)
-{
-    unsigned int i, repeat;
-    status_t ret;
-    int res = 0;
-
-    xmlInitParser();
-    for (repeat = 0; repeat < 500; repeat++) {
-        xmlLoadCatalog(catalog);
-        for (i = 0; i < num_threads; i++) {
-            tid[i] = (thread_id) - 1;
-        }
-        for (i = 0; i < num_threads; i++) {
-            tid[i] =
-                spawn_thread(thread_specific_data, "xmlTestThread",
-                             B_NORMAL_PRIORITY, (void *) &threadParams[i]);
-            if (tid[i] < B_OK) {
-                fprintf(stderr, "beos_thread_create failed\n");
-                return (1);
-            }
-            printf("beos_thread_create %d -> %d\n", i, tid[i]);
-        }
-        for (i = 0; i < num_threads; i++) {
-            void *result;
-            ret = wait_for_thread(tid[i], &result);
-            printf("beos_thread_wait %d -> %d\n", i, ret);
-            if (ret != B_OK) {
-                fprintf(stderr, "beos_thread_wait failed\n");
-                return (1);
-            }
-        }
-
-        xmlCatalogCleanup();
-        ret = B_OK;
-        for (i = 0; i < num_threads; i++)
-            if (threadParams[i].okay == 0) {
-                printf("Thread %d handling %s failed\n", i,
-                       threadParams[i].filename);
-                ret = B_ERROR;
-            }
-    }
-    if (ret != B_OK)
-        return(1);
-    return (0);
-}
-
 #elif defined HAVE_PTHREAD_H
 #include <pthread.h>
 
@@ -4316,7 +4594,9 @@ regexpTest(const char *filename, const char *result, const char *err,
     char expression[5000];
     int len, ret, res = 0;
 
-    input = fopen(filename, "r");
+    nb_tests++;
+
+    input = fopen(filename, "rb");
     if (input == NULL) {
         xmlGenericError(xmlGenericErrorContext,
                "Cannot open %s for reading\n", filename);
@@ -4392,7 +4672,246 @@ regexpTest(const char *filename, const char *result, const char *err,
     return(res);
 }
 
-#endif
+#endif /* LIBXML_REGEXPS_ENABLED */
+
+#ifdef LIBXML_AUTOMATA_ENABLED
+/************************************************************************
+ *                                                                     *
+ *                     Automata tests                                  *
+ *                                                                     *
+ ************************************************************************/
+
+static int scanNumber(char **ptr) {
+    int ret = 0;
+    char *cur;
+
+    cur = *ptr;
+    while ((*cur >= '0') && (*cur <= '9')) {
+       ret = ret * 10 + (*cur - '0');
+       cur++;
+    }
+    *ptr = cur;
+    return(ret);
+}
+
+static int
+automataTest(const char *filename, const char *result,
+             const char *err ATTRIBUTE_UNUSED, int options ATTRIBUTE_UNUSED) {
+    FILE *input, *output;
+    char *temp;
+    char expr[5000];
+    int len;
+    int ret;
+    int i;
+    int res = 0;
+    xmlAutomataPtr am;
+    xmlAutomataStatePtr states[1000];
+    xmlRegexpPtr regexp = NULL;
+    xmlRegExecCtxtPtr exec = NULL;
+
+    nb_tests++;
+
+    for (i = 0;i<1000;i++)
+       states[i] = NULL;
+
+    input = fopen(filename, "rb");
+    if (input == NULL) {
+        xmlGenericError(xmlGenericErrorContext,
+               "Cannot open %s for reading\n", filename);
+       return(-1);
+    }
+    temp = resultFilename(filename, "", ".res");
+    if (temp == NULL) {
+        fprintf(stderr, "Out of memory\n");
+        fatalError();
+    }
+    output = fopen(temp, "wb");
+    if (output == NULL) {
+       fprintf(stderr, "failed to open output file %s\n", temp);
+        free(temp);
+       return(-1);
+    }
+
+    am = xmlNewAutomata();
+    if (am == NULL) {
+        xmlGenericError(xmlGenericErrorContext,
+               "Cannot create automata\n");
+       fclose(input);
+       return(-1);
+    }
+    states[0] = xmlAutomataGetInitState(am);
+    if (states[0] == NULL) {
+        xmlGenericError(xmlGenericErrorContext,
+               "Cannot get start state\n");
+       xmlFreeAutomata(am);
+       fclose(input);
+       return(-1);
+    }
+    ret = 0;
+
+    while (fgets(expr, 4500, input) != NULL) {
+       if (expr[0] == '#')
+           continue;
+       len = strlen(expr);
+       len--;
+       while ((len >= 0) &&
+              ((expr[len] == '\n') || (expr[len] == '\t') ||
+               (expr[len] == '\r') || (expr[len] == ' '))) len--;
+       expr[len + 1] = 0;
+       if (len >= 0) {
+           if ((am != NULL) && (expr[0] == 't') && (expr[1] == ' ')) {
+               char *ptr = &expr[2];
+               int from, to;
+
+               from = scanNumber(&ptr);
+               if (*ptr != ' ') {
+                   xmlGenericError(xmlGenericErrorContext,
+                           "Bad line %s\n", expr);
+                   break;
+               }
+               if (states[from] == NULL)
+                   states[from] = xmlAutomataNewState(am);
+               ptr++;
+               to = scanNumber(&ptr);
+               if (*ptr != ' ') {
+                   xmlGenericError(xmlGenericErrorContext,
+                           "Bad line %s\n", expr);
+                   break;
+               }
+               if (states[to] == NULL)
+                   states[to] = xmlAutomataNewState(am);
+               ptr++;
+               xmlAutomataNewTransition(am, states[from], states[to],
+                                        BAD_CAST ptr, NULL);
+           } else if ((am != NULL) && (expr[0] == 'e') && (expr[1] == ' ')) {
+               char *ptr = &expr[2];
+               int from, to;
+
+               from = scanNumber(&ptr);
+               if (*ptr != ' ') {
+                   xmlGenericError(xmlGenericErrorContext,
+                           "Bad line %s\n", expr);
+                   break;
+               }
+               if (states[from] == NULL)
+                   states[from] = xmlAutomataNewState(am);
+               ptr++;
+               to = scanNumber(&ptr);
+               if (states[to] == NULL)
+                   states[to] = xmlAutomataNewState(am);
+               xmlAutomataNewEpsilon(am, states[from], states[to]);
+           } else if ((am != NULL) && (expr[0] == 'f') && (expr[1] == ' ')) {
+               char *ptr = &expr[2];
+               int state;
+
+               state = scanNumber(&ptr);
+               if (states[state] == NULL) {
+                   xmlGenericError(xmlGenericErrorContext,
+                           "Bad state %d : %s\n", state, expr);
+                   break;
+               }
+               xmlAutomataSetFinalState(am, states[state]);
+           } else if ((am != NULL) && (expr[0] == 'c') && (expr[1] == ' ')) {
+               char *ptr = &expr[2];
+               int from, to;
+               int min, max;
+
+               from = scanNumber(&ptr);
+               if (*ptr != ' ') {
+                   xmlGenericError(xmlGenericErrorContext,
+                           "Bad line %s\n", expr);
+                   break;
+               }
+               if (states[from] == NULL)
+                   states[from] = xmlAutomataNewState(am);
+               ptr++;
+               to = scanNumber(&ptr);
+               if (*ptr != ' ') {
+                   xmlGenericError(xmlGenericErrorContext,
+                           "Bad line %s\n", expr);
+                   break;
+               }
+               if (states[to] == NULL)
+                   states[to] = xmlAutomataNewState(am);
+               ptr++;
+               min = scanNumber(&ptr);
+               if (*ptr != ' ') {
+                   xmlGenericError(xmlGenericErrorContext,
+                           "Bad line %s\n", expr);
+                   break;
+               }
+               ptr++;
+               max = scanNumber(&ptr);
+               if (*ptr != ' ') {
+                   xmlGenericError(xmlGenericErrorContext,
+                           "Bad line %s\n", expr);
+                   break;
+               }
+               ptr++;
+               xmlAutomataNewCountTrans(am, states[from], states[to],
+                                        BAD_CAST ptr, min, max, NULL);
+           } else if ((am != NULL) && (expr[0] == '-') && (expr[1] == '-')) {
+               /* end of the automata */
+               regexp = xmlAutomataCompile(am);
+               xmlFreeAutomata(am);
+               am = NULL;
+               if (regexp == NULL) {
+                   xmlGenericError(xmlGenericErrorContext,
+                           "Failed to compile the automata");
+                   break;
+               }
+           } else if ((expr[0] == '=') && (expr[1] == '>')) {
+               if (regexp == NULL) {
+                   fprintf(output, "=> failed not compiled\n");
+               } else {
+                   if (exec == NULL)
+                       exec = xmlRegNewExecCtxt(regexp, NULL, NULL);
+                   if (ret == 0) {
+                       ret = xmlRegExecPushString(exec, NULL, NULL);
+                   }
+                   if (ret == 1)
+                       fprintf(output, "=> Passed\n");
+                   else if ((ret == 0) || (ret == -1))
+                       fprintf(output, "=> Failed\n");
+                   else if (ret < 0)
+                       fprintf(output, "=> Error\n");
+                   xmlRegFreeExecCtxt(exec);
+                   exec = NULL;
+               }
+               ret = 0;
+           } else if (regexp != NULL) {
+               if (exec == NULL)
+                   exec = xmlRegNewExecCtxt(regexp, NULL, NULL);
+               ret = xmlRegExecPushString(exec, BAD_CAST expr, NULL);
+           } else {
+               xmlGenericError(xmlGenericErrorContext,
+                       "Unexpected line %s\n", expr);
+           }
+       }
+    }
+    fclose(output);
+    fclose(input);
+    if (regexp != NULL)
+       xmlRegFreeRegexp(regexp);
+    if (exec != NULL)
+       xmlRegFreeExecCtxt(exec);
+    if (am != NULL)
+       xmlFreeAutomata(am);
+
+    ret = compareFiles(temp, result);
+    if (ret) {
+        fprintf(stderr, "Result for %s failed in %s\n", filename, result);
+        res = 1;
+    }
+    if (temp != NULL) {
+        unlink(temp);
+        free(temp);
+    }
+
+    return(res);
+}
+
+#endif /* LIBXML_AUTOMATA_ENABLED */
 
 /************************************************************************
  *                                                                     *
@@ -4462,6 +4981,9 @@ testDesc testDescriptions[] = {
     { "XML push regression tests" ,
       pushParseTest, "./test/*", "result/", "", NULL,
       0 },
+    { "XML push boundary tests" ,
+      pushBoundaryTest, "./test/*", "result/", "", NULL,
+      0 },
 #endif
 #ifdef LIBXML_HTML_ENABLED
     { "HTML regression tests" ,
@@ -4474,6 +4996,9 @@ testDesc testDescriptions[] = {
     { "Push HTML regression tests" ,
       pushParseTest, "./test/HTML/*", "result/HTML/", "", ".err",
       XML_PARSE_HTML },
+    { "Push HTML boundary tests" ,
+      pushBoundaryTest, "./test/HTML/*", "result/HTML/", "", NULL,
+      XML_PARSE_HTML },
 #endif
     { "HTML SAX regression tests" ,
       saxParseTest, "./test/HTML/*", "result/HTML/", ".sax", NULL,
@@ -4500,25 +5025,24 @@ testDesc testDescriptions[] = {
 #endif
 #ifdef LIBXML_XINCLUDE_ENABLED
     { "XInclude regression tests" ,
-      errParseTest, "./test/XInclude/docs/*", "result/XInclude/", "", NULL,
-      /* Ignore errors at this point ".err", */
+      errParseTest, "./test/XInclude/docs/*", "result/XInclude/", "", ".err",
       XML_PARSE_XINCLUDE },
 #ifdef LIBXML_READER_ENABLED
     { "XInclude xmlReader regression tests",
       streamParseTest, "./test/XInclude/docs/*", "result/XInclude/", ".rdr",
-      /* Ignore errors at this point ".err", */
-      NULL, XML_PARSE_XINCLUDE },
+      ".err", XML_PARSE_XINCLUDE },
 #endif
     { "XInclude regression tests stripping include nodes" ,
-      errParseTest, "./test/XInclude/docs/*", "result/XInclude/", "", NULL,
-      /* Ignore errors at this point ".err", */
+      errParseTest, "./test/XInclude/docs/*", "result/XInclude/", "", ".err",
       XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE },
 #ifdef LIBXML_READER_ENABLED
     { "XInclude xmlReader regression tests stripping include nodes",
       streamParseTest, "./test/XInclude/docs/*", "result/XInclude/", ".rdr",
-      /* Ignore errors at this point ".err", */
-      NULL, XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE },
+      ".err", XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE },
 #endif
+    { "XInclude regression tests without reader",
+      errParseTest, "./test/XInclude/without-reader/*", "result/XInclude/", "",
+      ".err", XML_PARSE_XINCLUDE },
 #endif
 #ifdef LIBXML_XPATH_ENABLED
 #ifdef LIBXML_DEBUG_ENABLED
@@ -4601,6 +5125,11 @@ testDesc testDescriptions[] = {
       regexpTest, "./test/regexp/*", "result/regexp/", "", ".err",
       0 },
 #endif
+#if defined(LIBXML_AUTOMATA_ENABLED)
+    { "Automata regression tests" ,
+      automataTest, "./test/automata/*", "result/automata/", "", NULL,
+      0 },
+#endif
     {NULL, NULL, NULL, NULL, NULL, NULL, 0}
 };
 
index 5e88f80..8df9df1 100644 (file)
 
 #ifdef LIBXML_XPATH_ENABLED
 
-#if !defined(_WIN32)
-#include <unistd.h>
-#endif
 #include <string.h>
-#include <sys/types.h>
 #include <sys/stat.h>
-#include <fcntl.h>
 
 #include <libxml/parser.h>
 #include <libxml/parserInternals.h>
diff --git a/save.h b/save.h
deleted file mode 100644 (file)
index 192b674..0000000
--- a/save.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Summary: Internal Interfaces for saving in libxml2
- * Description: this module describes a few interfaces which were
- *              added along with the API changes in 2.9.0
- *              those are private routines at this point
- *
- * Copy: See Copyright for the status of this software.
- *
- * Author: Daniel Veillard
- */
-
-#ifndef __XML_SAVE_H__
-#define __XML_SAVE_H__
-
-#include <libxml/tree.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef LIBXML_OUTPUT_ENABLED
-void xmlBufAttrSerializeTxtContent(xmlBufPtr buf, xmlDocPtr doc,
-                                   xmlAttrPtr attr, const xmlChar * string);
-void xmlBufDumpNotationTable(xmlBufPtr buf, xmlNotationTablePtr table);
-void xmlBufDumpElementDecl(xmlBufPtr buf, xmlElementPtr elem);
-void xmlBufDumpAttributeDecl(xmlBufPtr buf, xmlAttributePtr attr);
-void xmlBufDumpEntityDecl(xmlBufPtr buf, xmlEntityPtr ent);
-#endif
-
-xmlChar *xmlEncodeAttributeEntities(xmlDocPtr doc, const xmlChar *input);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __XML_SAVE_H__ */
-
index 68a4c62..c105a75 100644 (file)
@@ -34,6 +34,8 @@
 #include <libxml/pattern.h>
 #include <libxml/schematron.h>
 
+#include "private/error.h"
+
 #define SCHEMATRON_PARSE_OPTIONS XML_PARSE_NOENT
 
 #define SCT_OLD_NS BAD_CAST "http://www.ascc.net/xml/schematron"
@@ -1506,7 +1508,7 @@ xmlSchematronFormatReport(xmlSchematronValidCtxtPtr ctxt,
                 int size;
 
                 size = snprintf(NULL, 0, "%0g", eval->floatval);
-                buf = (xmlChar*) malloc(size * sizeof(xmlChar));
+                buf = (xmlChar*) malloc(size);
                 /* xmlStrPrintf(buf, size, "%0g", eval->floatval); // doesn't work */
                 sprintf((char*) buf, "%0g", eval->floatval);
                 ret = xmlStrcat(ret, buf);
@@ -1584,8 +1586,8 @@ xmlSchematronReportSuccess(xmlSchematronValidCtxtPtr ctxt,
         long line;
         const xmlChar *report = NULL;
 
-        if (((test->type == XML_SCHEMATRON_REPORT) & (!success)) ||
-            ((test->type == XML_SCHEMATRON_ASSERT) & (success)))
+        if (((test->type == XML_SCHEMATRON_REPORT) && (!success)) ||
+            ((test->type == XML_SCHEMATRON_ASSERT) && (success)))
             return;
         line = xmlGetLineNo(cur);
         path = xmlGetNodePath(cur);
diff --git a/test/HTML/names.html b/test/HTML/names.html
new file mode 100644 (file)
index 0000000..0dac7a4
--- /dev/null
@@ -0,0 +1,5 @@
+<html>
+<body>
+  <o:p></o:p>
+</body>
+</html>
diff --git a/test/URI/file.uri b/test/URI/file.uri
new file mode 100644 (file)
index 0000000..8d8b7a7
--- /dev/null
@@ -0,0 +1 @@
+file:///foo.txt
diff --git a/test/URI/port.uri b/test/URI/port.uri
new file mode 100644 (file)
index 0000000..4b22322
--- /dev/null
@@ -0,0 +1,2 @@
+nbd://:10888
+https://example.com:12345/
index a96ea5f..0a2e46f 100644 (file)
@@ -16,3 +16,6 @@ bar?baz#baz2
 http://elsewhere.com/#deep
 http://elsewhere.com/?deep
 http://elsewhere.com/?deep#deep2
+//elsewhere.com/bar
+//elsewhere.com:8080/bar
+//:8080
diff --git a/test/XInclude/docs/invalid_char.xml b/test/XInclude/docs/invalid_char.xml
new file mode 100644 (file)
index 0000000..28e5a48
--- /dev/null
@@ -0,0 +1,3 @@
+<x xmlns:xinclude="http://www.w3.org/2001/XInclude">
+   <xinclude:include href="../ents/invalid_char.txt" parse="text"/>
+</x>
diff --git a/test/XInclude/ents/invalid_char.txt b/test/XInclude/ents/invalid_char.txt
new file mode 100644 (file)
index 0000000..ae06618
--- /dev/null
@@ -0,0 +1 @@
+invalid: Ã¿
\ No newline at end of file
diff --git a/test/XInclude/without-reader/fallback7.xml b/test/XInclude/without-reader/fallback7.xml
new file mode 100644 (file)
index 0000000..7ddf936
--- /dev/null
@@ -0,0 +1,12 @@
+<x xmlns:xi="http://www.w3.org/2001/XInclude">
+    <a>text</a>
+    <xi:include xpointer="xpointer(//b)"/>
+    <xi:include href="404.xml">
+        <xi:fallback>
+            <b>
+                <xi:include xpointer="xpointer(//a)"/>
+            </b>
+        </xi:fallback>
+    </xi:include>
+    <xi:include xpointer="xpointer(//b)"/>
+</x>
diff --git a/test/XInclude/without-reader/issue424-1.xml b/test/XInclude/without-reader/issue424-1.xml
new file mode 100644 (file)
index 0000000..8b6aa93
--- /dev/null
@@ -0,0 +1,5 @@
+<x xmlns:xinclude="http://www.w3.org/2001/XInclude">
+   <p>Something</p>
+   <d><xinclude:include xpointer="xpointer(//p)"/></d>
+   <xinclude:include xpointer="xpointer(//d)"/>
+</x>
diff --git a/test/XInclude/without-reader/issue424-2.xml b/test/XInclude/without-reader/issue424-2.xml
new file mode 100644 (file)
index 0000000..e61eaba
--- /dev/null
@@ -0,0 +1,5 @@
+<x xmlns:xinclude="http://www.w3.org/2001/XInclude">
+   <p>Something</p>
+   <xinclude:include xpointer="xpointer(//d)"/>
+   <d><xinclude:include xpointer="xpointer(//p)"/></d>
+</x>
diff --git a/test/XInclude/without-reader/loop.xml b/test/XInclude/without-reader/loop.xml
new file mode 100644 (file)
index 0000000..99a7e0b
--- /dev/null
@@ -0,0 +1,4 @@
+<x xmlns:xi="http://www.w3.org/2001/XInclude">
+   <a><xi:include xpointer="xpointer(//b)"/></a>
+   <b><xi:include xpointer="xpointer(//a)"/></b>
+</x>
diff --git a/test/XInclude/without-reader/max-recurse.xml b/test/XInclude/without-reader/max-recurse.xml
new file mode 100644 (file)
index 0000000..cfe14bd
--- /dev/null
@@ -0,0 +1,104 @@
+<x xmlns:xi="http://www.w3.org/2001/XInclude">
+<e00><xi:include xpointer="xpointer(//e01)"/></e00>
+<e01><xi:include xpointer="xpointer(//e02)"/></e01>
+<e02><xi:include xpointer="xpointer(//e03)"/></e02>
+<e03><xi:include xpointer="xpointer(//e04)"/></e03>
+<e04><xi:include xpointer="xpointer(//e05)"/></e04>
+<e05><xi:include xpointer="xpointer(//e06)"/></e05>
+<e06><xi:include xpointer="xpointer(//e07)"/></e06>
+<e07><xi:include xpointer="xpointer(//e08)"/></e07>
+<e08><xi:include xpointer="xpointer(//e09)"/></e08>
+<e09><xi:include xpointer="xpointer(//e10)"/></e09>
+<e10><xi:include xpointer="xpointer(//e11)"/></e10>
+<e11><xi:include xpointer="xpointer(//e12)"/></e11>
+<e12><xi:include xpointer="xpointer(//e13)"/></e12>
+<e13><xi:include xpointer="xpointer(//e14)"/></e13>
+<e14><xi:include xpointer="xpointer(//e15)"/></e14>
+<e15><xi:include xpointer="xpointer(//e16)"/></e15>
+<e16><xi:include xpointer="xpointer(//e17)"/></e16>
+<e17><xi:include xpointer="xpointer(//e18)"/></e17>
+<e18><xi:include xpointer="xpointer(//e19)"/></e18>
+<e19><xi:include xpointer="xpointer(//e20)"/></e19>
+<e20><xi:include xpointer="xpointer(//e21)"/></e20>
+<e21><xi:include xpointer="xpointer(//e22)"/></e21>
+<e22><xi:include xpointer="xpointer(//e23)"/></e22>
+<e23><xi:include xpointer="xpointer(//e24)"/></e23>
+<e24><xi:include xpointer="xpointer(//e25)"/></e24>
+<e25><xi:include xpointer="xpointer(//e26)"/></e25>
+<e26><xi:include xpointer="xpointer(//e27)"/></e26>
+<e27><xi:include xpointer="xpointer(//e28)"/></e27>
+<e28><xi:include xpointer="xpointer(//e29)"/></e28>
+<e29><xi:include xpointer="xpointer(//e30)"/></e29>
+<e30><xi:include xpointer="xpointer(//e31)"/></e30>
+<e31><xi:include xpointer="xpointer(//e32)"/></e31>
+<e32><xi:include xpointer="xpointer(//e33)"/></e32>
+<e33><xi:include xpointer="xpointer(//e34)"/></e33>
+<e34><xi:include xpointer="xpointer(//e35)"/></e34>
+<e35><xi:include xpointer="xpointer(//e36)"/></e35>
+<e36><xi:include xpointer="xpointer(//e37)"/></e36>
+<e37><xi:include xpointer="xpointer(//e38)"/></e37>
+<e38><xi:include xpointer="xpointer(//e39)"/></e38>
+<e39><xi:include xpointer="xpointer(//e40)"/></e39>
+<e40><xi:include xpointer="xpointer(//e41)"/></e40>
+<e41><xi:include xpointer="xpointer(//e42)"/></e41>
+<e42><xi:include xpointer="xpointer(//e43)"/></e42>
+<e43><xi:include xpointer="xpointer(//e44)"/></e43>
+<e44><xi:include xpointer="xpointer(//e45)"/></e44>
+<e45><xi:include xpointer="xpointer(//e46)"/></e45>
+<e46><xi:include xpointer="xpointer(//e47)"/></e46>
+<e47><xi:include xpointer="xpointer(//e48)"/></e47>
+<e48><xi:include xpointer="xpointer(//e49)"/></e48>
+<e49><xi:include xpointer="xpointer(//e50)"/></e49>
+<e50><xi:include xpointer="xpointer(//e51)"/></e50>
+<e51><xi:include xpointer="xpointer(//e52)"/></e51>
+<e52><xi:include xpointer="xpointer(//e53)"/></e52>
+<e53><xi:include xpointer="xpointer(//e54)"/></e53>
+<e54><xi:include xpointer="xpointer(//e55)"/></e54>
+<e55><xi:include xpointer="xpointer(//e56)"/></e55>
+<e56><xi:include xpointer="xpointer(//e57)"/></e56>
+<e57><xi:include xpointer="xpointer(//e58)"/></e57>
+<e58><xi:include xpointer="xpointer(//e59)"/></e58>
+<e59><xi:include xpointer="xpointer(//e60)"/></e59>
+<e60><xi:include xpointer="xpointer(//e61)"/></e60>
+<e61><xi:include xpointer="xpointer(//e62)"/></e61>
+<e62><xi:include xpointer="xpointer(//e63)"/></e62>
+<e63><xi:include xpointer="xpointer(//e64)"/></e63>
+<e64><xi:include xpointer="xpointer(//e65)"/></e64>
+<e65><xi:include xpointer="xpointer(//e66)"/></e65>
+<e66><xi:include xpointer="xpointer(//e67)"/></e66>
+<e67><xi:include xpointer="xpointer(//e68)"/></e67>
+<e68><xi:include xpointer="xpointer(//e69)"/></e68>
+<e69><xi:include xpointer="xpointer(//e70)"/></e69>
+<e70><xi:include xpointer="xpointer(//e71)"/></e70>
+<e71><xi:include xpointer="xpointer(//e72)"/></e71>
+<e72><xi:include xpointer="xpointer(//e73)"/></e72>
+<e73><xi:include xpointer="xpointer(//e74)"/></e73>
+<e74><xi:include xpointer="xpointer(//e75)"/></e74>
+<e75><xi:include xpointer="xpointer(//e76)"/></e75>
+<e76><xi:include xpointer="xpointer(//e77)"/></e76>
+<e77><xi:include xpointer="xpointer(//e78)"/></e77>
+<e78><xi:include xpointer="xpointer(//e79)"/></e78>
+<e79><xi:include xpointer="xpointer(//e80)"/></e79>
+<e80><xi:include xpointer="xpointer(//e81)"/></e80>
+<e81><xi:include xpointer="xpointer(//e82)"/></e81>
+<e82><xi:include xpointer="xpointer(//e83)"/></e82>
+<e83><xi:include xpointer="xpointer(//e84)"/></e83>
+<e84><xi:include xpointer="xpointer(//e85)"/></e84>
+<e85><xi:include xpointer="xpointer(//e86)"/></e85>
+<e86><xi:include xpointer="xpointer(//e87)"/></e86>
+<e87><xi:include xpointer="xpointer(//e88)"/></e87>
+<e88><xi:include xpointer="xpointer(//e89)"/></e88>
+<e89><xi:include xpointer="xpointer(//e90)"/></e89>
+<e90><xi:include xpointer="xpointer(//e91)"/></e90>
+<e91><xi:include xpointer="xpointer(//e92)"/></e91>
+<e92><xi:include xpointer="xpointer(//e93)"/></e92>
+<e93><xi:include xpointer="xpointer(//e94)"/></e93>
+<e94><xi:include xpointer="xpointer(//e95)"/></e94>
+<e95><xi:include xpointer="xpointer(//e96)"/></e95>
+<e96><xi:include xpointer="xpointer(//e97)"/></e96>
+<e97><xi:include xpointer="xpointer(//e98)"/></e97>
+<e98><xi:include xpointer="xpointer(//e99)"/></e98>
+<e99><xi:include xpointer="xpointer(//e100)"/></e99>
+<e100><xi:include xpointer="xpointer(//e101)"/></e100>
+<e101/>
+</x>
index 00b9461..6008a07 100644 (file)
@@ -3,6 +3,7 @@ false()
 number("1.5")
 number('abc')
 -number('abc')
+number('-')
 floor(0.1)
 floor(-0.1)
 floor(-0)
diff --git a/test/boundaries1.xml b/test/boundaries1.xml
new file mode 100644 (file)
index 0000000..c4301cd
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<!DOCTYPE d [
+    <!ENTITY a "]>">
+    <!ENTITY b ']>'>
+    <!--> ]> -->
+]    >
+<?pi p1?>
+<!--> c1 -->
+<d a=">" b='>'>
+text&a;text
+<![CDATA[cdata]]>
+<?pi p2?>
+<!--> c2 -->
+</d>
+<?pi p3?>
+<!--> c3 -->
diff --git a/test/errors/rec_att_default.xml b/test/errors/rec_att_default.xml
new file mode 100644 (file)
index 0000000..9a33600
--- /dev/null
@@ -0,0 +1,6 @@
+<!DOCTYPE doc SYSTEM "N" [
+  <!ENTITY a "&b;">
+  <!ATTLIST x y CDATA "&a;">
+  <!ENTITY b "&a;">
+]>
+<doc attr="&a;"/>
diff --git a/test/errors/utf8-1.xml b/test/errors/utf8-1.xml
new file mode 100644 (file)
index 0000000..0481aa4
--- /dev/null
@@ -0,0 +1 @@
+<d>Ä..............................................................................<<
diff --git a/test/errors/utf8-2.xml b/test/errors/utf8-2.xml
new file mode 100644 (file)
index 0000000..190c7f8
--- /dev/null
@@ -0,0 +1 @@
+<d>.<<€€€€€€€€€€€€€€€€€€€€€€€€€
diff --git a/test/recurse/g0.ent b/test/recurse/g0.ent
new file mode 100644 (file)
index 0000000..46832f1
--- /dev/null
@@ -0,0 +1,4 @@
+hahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahaha
+hahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahaha
+hahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahaha
+hahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahaha
diff --git a/test/recurse/g1.ent b/test/recurse/g1.ent
new file mode 100644 (file)
index 0000000..e64e692
--- /dev/null
@@ -0,0 +1,4 @@
+&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;
+&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;
+&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;
+&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;&g0;
diff --git a/test/recurse/g2.ent b/test/recurse/g2.ent
new file mode 100644 (file)
index 0000000..16a80bb
--- /dev/null
@@ -0,0 +1,4 @@
+&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;
+&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;
+&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;
+&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;&g1;
diff --git a/test/recurse/g3.ent b/test/recurse/g3.ent
new file mode 100644 (file)
index 0000000..6407723
--- /dev/null
@@ -0,0 +1,4 @@
+&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;
+&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;
+&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;
+&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;&g2;
diff --git a/test/recurse/ga.ent b/test/recurse/ga.ent
new file mode 100644 (file)
index 0000000..4a182de
--- /dev/null
@@ -0,0 +1 @@
+some internal data
\ No newline at end of file
diff --git a/test/recurse/gb.ent b/test/recurse/gb.ent
new file mode 100644 (file)
index 0000000..1b25ad0
--- /dev/null
@@ -0,0 +1 @@
+&a;&a;
\ No newline at end of file
diff --git a/test/recurse/gc.ent b/test/recurse/gc.ent
new file mode 100644 (file)
index 0000000..c4f16e6
--- /dev/null
@@ -0,0 +1 @@
+&b;&b;
\ No newline at end of file
index 60aa1b6..21b18ae 100644 (file)
 &d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
 &d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
 &d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
 &d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;</foo>
diff --git a/test/recurse/good_attr.xml b/test/recurse/good_attr.xml
new file mode 100644 (file)
index 0000000..6d500dd
--- /dev/null
@@ -0,0 +1,100 @@
+<!DOCTYPE foo [
+<!ENTITY f "some internal data rather large taking quite some room">
+<!ENTITY e "&f;&f;">
+<!ENTITY d "&e;&e;">
+]>
+<foo bar="&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
+&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;"/>
diff --git a/test/recurse/goodattr.xml b/test/recurse/goodattr.xml
deleted file mode 100644 (file)
index 94f7071..0000000
+++ /dev/null
@@ -1,343 +0,0 @@
-<!DOCTYPE foo [
-<!ENTITY f "some internal data rather large taking quite some room">
-<!ENTITY e "&f;&f;">
-<!ENTITY d "&e;&e;">
-]>
-<foo bar="&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;
-&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;"/>
diff --git a/test/recurse/huge_dtd.xml b/test/recurse/huge_dtd.xml
new file mode 100644 (file)
index 0000000..86761b1
--- /dev/null
@@ -0,0 +1,5 @@
+<!-- The DTD is generated dynamically by testrecurse.c -->
+<!DOCTYPE foo SYSTEM "huge_dtd.dtd">
+<!-- Another entity reference to test whether the DTD is added to
+     sizeentities -->
+<foo>&ent;</foo>
diff --git a/test/recurse/lol3.xml b/test/recurse/lol3.xml
deleted file mode 100644 (file)
index acc2346..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0"?>\r
-<!DOCTYPE billion SYSTEM "lol3.dtd">\r
-\r
-<billion></billion>\r
-\r
diff --git a/test/recurse/lol4.patch b/test/recurse/lol4.patch
deleted file mode 100644 (file)
index f41be28..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-Index: parser.c
-===================================================================
---- parser.c   (revision 3773)
-+++ parser.c   (working copy)
-@@ -2505,6 +2505,11 @@ xmlStringLenDecodeEntities(xmlParserCtxt
-           c = CUR_SCHAR(str, l);
-       else
-           c = 0;
-+        if ((nbchars > 500000) &&
-+          (ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE)) {
-+          xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
-+          goto int_error;
-+        }
-     }
-     buffer[nbchars++] = 0;
-     return(buffer);
diff --git a/test/recurse/lol_eg.xml b/test/recurse/lol_eg.xml
new file mode 100644 (file)
index 0000000..2f8940b
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<!DOCTYPE billion [
+  <!ELEMENT billion (#PCDATA)>
+  <!ENTITY g0 SYSTEM "g0.ent">
+  <!ENTITY g1 SYSTEM "g1.ent">
+  <!ENTITY g2 SYSTEM "g2.ent">
+  <!ENTITY g3 SYSTEM "g3.ent">
+]>
+<billion>&g3;</billion>
diff --git a/test/recurse/lol_ep.xml b/test/recurse/lol_ep.xml
new file mode 100644 (file)
index 0000000..705437c
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!DOCTYPE billion [
+  <!ELEMENT billion (#PCDATA)>
+  <!ENTITY % p0 SYSTEM "p0.ent">
+  <!ENTITY % p1 SYSTEM "p1.ent">
+  <!ENTITY % p2 SYSTEM "p2.ent">
+  <!ENTITY % p3 SYSTEM "p3.ent">
+  %p3;
+]>
+<billion/>
diff --git a/test/recurse/lol_ip_content.dtd b/test/recurse/lol_ip_content.dtd
new file mode 100644 (file)
index 0000000..fca54b6
--- /dev/null
@@ -0,0 +1,9 @@
+<!ELEMENT billion (#PCDATA)>
+<!ENTITY % p0 "<!---->">
+<!ENTITY % p1 "%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;">
+<!ENTITY % p2 "%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;">
+<!ENTITY % p3 "%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;">
+<!ENTITY % p4 "%p3;%p3;%p3;%p3;%p3;%p3;%p3;%p3;%p3;%p3;%p3;%p3;%p3;%p3;">
+<!ENTITY % p5 "%p4;%p4;%p4;%p4;%p4;%p4;%p4;%p4;%p4;%p4;%p4;%p4;%p4;%p4;">
+<!ENTITY % p6 "%p5;%p5;%p5;%p5;%p5;%p5;%p5;%p5;%p5;%p5;%p5;%p5;%p5;%p5;">
+%p5;
diff --git a/test/recurse/lol_ip_content.xml b/test/recurse/lol_ip_content.xml
new file mode 100644 (file)
index 0000000..4e6f4c5
--- /dev/null
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<!DOCTYPE billion SYSTEM "lol_ip_content.dtd">
+<billion/>
diff --git a/test/recurse/lol_ip_value.xml b/test/recurse/lol_ip_value.xml
new file mode 100644 (file)
index 0000000..dda403d
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>\r
+<!DOCTYPE billion SYSTEM "lol_ip_value.dtd">\r
+\r
+<billion></billion>\r
+\r
diff --git a/test/recurse/lol_param.xml b/test/recurse/lol_param.xml
new file mode 100644 (file)
index 0000000..f627986
--- /dev/null
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+<!--
+  Copyright (C) 2020 Sebastian Pipping <sebastian@pipping.org>
+  v3.1 2020-06-21, not (yet) to be published
+
+  "Parameter Laughs", i.e. variant of Billion Laughs Attack
+                           using parameter entities the other way around
+
+  Use of "%pe24;" below makes the XML processor (e.g. "xmlwf -p < file.xml" or
+  "xmllint file.xml > /dev/null") take 3 to 12 seconds on my machine.
+  Increase to "%pe25;" and beyond carefully: use of "%pe40;" makes my machine
+  need a hard reset.
+
+  Note that unlike libxml2, libexpat does not have any protection against
+  billion laughs attacks to this day, so it's not a new vulnerability
+  with regard to libexpat.  Upcoming release libexpat 2.4.0 will have
+  protection against this family of attacks.
+-->
+<!DOCTYPE r [
+  <!ENTITY % pe_1 "<!---->">
+  <!ENTITY % pe_2 "&#37;pe_1;<!---->&#37;pe_1;">
+  <!ENTITY % pe_3 "&#37;pe_2;<!---->&#37;pe_2;">
+  <!ENTITY % pe_4 "&#37;pe_3;<!---->&#37;pe_3;">
+  <!ENTITY % pe_5 "&#37;pe_4;<!---->&#37;pe_4;">
+  <!ENTITY % pe_6 "&#37;pe_5;<!---->&#37;pe_5;">
+  <!ENTITY % pe_7 "&#37;pe_6;<!---->&#37;pe_6;">
+  <!ENTITY % pe_8 "&#37;pe_7;<!---->&#37;pe_7;">
+  <!ENTITY % pe_9 "&#37;pe_8;<!---->&#37;pe_8;">
+  <!ENTITY % pe10 "&#37;pe_9;<!---->&#37;pe_9;">
+  <!ENTITY % pe11 "&#37;pe10;<!---->&#37;pe10;">
+  <!ENTITY % pe12 "&#37;pe11;<!---->&#37;pe11;">
+  <!ENTITY % pe13 "&#37;pe12;<!---->&#37;pe12;">
+  <!ENTITY % pe14 "&#37;pe13;<!---->&#37;pe13;">
+  <!ENTITY % pe15 "&#37;pe14;<!---->&#37;pe14;">
+  <!ENTITY % pe16 "&#37;pe15;<!---->&#37;pe15;">
+  <!ENTITY % pe17 "&#37;pe16;<!---->&#37;pe16;">
+  <!ENTITY % pe17 "&#37;pe16;<!---->&#37;pe16;">
+  <!ENTITY % pe18 "&#37;pe17;<!---->&#37;pe17;">
+  <!ENTITY % pe19 "&#37;pe18;<!---->&#37;pe18;">
+  <!ENTITY % pe20 "&#37;pe19;<!---->&#37;pe19;">
+  <!ENTITY % pe21 "&#37;pe20;<!---->&#37;pe20;">
+  <!ENTITY % pe22 "&#37;pe21;<!---->&#37;pe21;">
+  <!ENTITY % pe23 "&#37;pe22;<!---->&#37;pe22;">
+  <!ENTITY % pe24 "&#37;pe23;<!---->&#37;pe23;">
+  <!ENTITY % pe25 "&#37;pe24;<!---->&#37;pe24;">
+  <!ENTITY % pe26 "&#37;pe25;<!---->&#37;pe25;">
+  <!ENTITY % pe27 "&#37;pe26;<!---->&#37;pe26;">
+  <!ENTITY % pe28 "&#37;pe27;<!---->&#37;pe27;">
+  <!ENTITY % pe29 "&#37;pe28;<!---->&#37;pe28;">
+  <!ENTITY % pe30 "&#37;pe29;<!---->&#37;pe29;">
+  <!ENTITY % pe31 "&#37;pe30;<!---->&#37;pe30;">
+  <!ENTITY % pe32 "&#37;pe31;<!---->&#37;pe31;">
+  <!ENTITY % pe33 "&#37;pe32;<!---->&#37;pe32;">
+  <!ENTITY % pe34 "&#37;pe33;<!---->&#37;pe33;">
+  <!ENTITY % pe35 "&#37;pe34;<!---->&#37;pe34;">
+  <!ENTITY % pe36 "&#37;pe35;<!---->&#37;pe35;">
+  <!ENTITY % pe37 "&#37;pe36;<!---->&#37;pe36;">
+  <!ENTITY % pe38 "&#37;pe37;<!---->&#37;pe37;">
+  <!ENTITY % pe39 "&#37;pe38;<!---->&#37;pe38;">
+  <!ENTITY % pe40 "&#37;pe39;<!---->&#37;pe39;">
+  %pe24; <!-- not at full potential, increase towards "%pe40;" carefully -->
+]>
+<r/>
diff --git a/test/recurse/p0.ent b/test/recurse/p0.ent
new file mode 100644 (file)
index 0000000..82e1292
--- /dev/null
@@ -0,0 +1,4 @@
+<!----><!----><!----><!----><!----><!----><!----><!----><!----><!---->
+<!----><!----><!----><!----><!----><!----><!----><!----><!----><!---->
+<!----><!----><!----><!----><!----><!----><!----><!----><!----><!---->
+<!----><!----><!----><!----><!----><!----><!----><!----><!----><!---->
diff --git a/test/recurse/p1.ent b/test/recurse/p1.ent
new file mode 100644 (file)
index 0000000..9a21bb5
--- /dev/null
@@ -0,0 +1,4 @@
+%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;
+%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;
+%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;
+%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;%p0;
diff --git a/test/recurse/p2.ent b/test/recurse/p2.ent
new file mode 100644 (file)
index 0000000..f45c306
--- /dev/null
@@ -0,0 +1,4 @@
+%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;
+%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;
+%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;
+%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;%p1;
diff --git a/test/recurse/p3.ent b/test/recurse/p3.ent
new file mode 100644 (file)
index 0000000..139d47a
--- /dev/null
@@ -0,0 +1,4 @@
+%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;
+%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;
+%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;
+%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;%p2;
diff --git a/test/recurse/pa.ent b/test/recurse/pa.ent
new file mode 100644 (file)
index 0000000..f68d1d0
--- /dev/null
@@ -0,0 +1 @@
+<!-- comment -->
\ No newline at end of file
diff --git a/test/recurse/pb.ent b/test/recurse/pb.ent
new file mode 100644 (file)
index 0000000..53a8942
--- /dev/null
@@ -0,0 +1 @@
+%a;%a;
\ No newline at end of file
diff --git a/test/recurse/pc.ent b/test/recurse/pc.ent
new file mode 100644 (file)
index 0000000..e3443ea
--- /dev/null
@@ -0,0 +1 @@
+%b;%b;
\ No newline at end of file
diff --git a/test/schemas/issue491_0.xml b/test/schemas/issue491_0.xml
new file mode 100644 (file)
index 0000000..e2b2fc2
--- /dev/null
@@ -0,0 +1 @@
+<Child xmlns="http://www.test.com">5</Child>
diff --git a/test/schemas/issue491_0.xsd b/test/schemas/issue491_0.xsd
new file mode 100644 (file)
index 0000000..8170264
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.test.com" targetNamespace="http://www.test.com" elementFormDefault="qualified" attributeFormDefault="unqualified">
+  <xs:complexType name="BaseType">
+    <xs:simpleContent>
+      <xs:extension base="xs:int" />
+    </xs:simpleContent>
+  </xs:complexType>
+  <xs:complexType name="ChildType">
+    <xs:complexContent>
+      <xs:extension base="BaseType">
+        <xs:sequence>
+          <xs:element name="bad" type="xs:int" minOccurs="0" maxOccurs="1"/>
+        </xs:sequence>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+  <xs:element name="Child" type="ChildType" />
+</xs:schema>
diff --git a/test/schemas/oss-fuzz-51295_0.xml b/test/schemas/oss-fuzz-51295_0.xml
new file mode 100644 (file)
index 0000000..10a7e70
--- /dev/null
@@ -0,0 +1 @@
+<e/>
diff --git a/test/schemas/oss-fuzz-51295_0.xsd b/test/schemas/oss-fuzz-51295_0.xsd
new file mode 100644 (file)
index 0000000..fde96af
--- /dev/null
@@ -0,0 +1,4 @@
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+    <xs:element name="e" substitutionGroup="e"/>
+    <xs:element name="t" substitutionGroup="e" type='xs:decimal'/>
+</xs:schema>
diff --git a/testAutomata.c b/testAutomata.c
deleted file mode 100644 (file)
index 8d3cb27..0000000
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * testAutomata.c: simple module for testing regexp automata
- *
- * See Copyright for the status of this software.
- *
- * Daniel Veillard <veillard@redhat.com>
- */
-
-#include "libxml.h"
-#ifdef LIBXML_AUTOMATA_ENABLED
-#include <string.h>
-
-#include <libxml/tree.h>
-#include <libxml/xmlautomata.h>
-
-static int scanNumber(char **ptr) {
-    int ret = 0;
-    char *cur;
-
-    cur = *ptr;
-    while ((*cur >= '0') && (*cur <= '9')) {
-       ret = ret * 10 + (*cur - '0');
-       cur++;
-    }
-    *ptr = cur;
-    return(ret);
-}
-
-static void
-testRegexpFile(const char *filename) {
-    FILE *input;
-    char expr[5000];
-    int len;
-    int ret;
-    int i;
-    xmlAutomataPtr am;
-    xmlAutomataStatePtr states[1000];
-    xmlRegexpPtr regexp = NULL;
-    xmlRegExecCtxtPtr exec = NULL;
-
-    for (i = 0;i<1000;i++)
-       states[i] = NULL;
-
-    input = fopen(filename, "rb");
-    if (input == NULL) {
-        xmlGenericError(xmlGenericErrorContext,
-               "Cannot open %s for reading\n", filename);
-       return;
-    }
-
-    am = xmlNewAutomata();
-    if (am == NULL) {
-        xmlGenericError(xmlGenericErrorContext,
-               "Cannot create automata\n");
-       fclose(input);
-       return;
-    }
-    states[0] = xmlAutomataGetInitState(am);
-    if (states[0] == NULL) {
-        xmlGenericError(xmlGenericErrorContext,
-               "Cannot get start state\n");
-       xmlFreeAutomata(am);
-       fclose(input);
-       return;
-    }
-    ret = 0;
-
-    while (fgets(expr, 4500, input) != NULL) {
-       if (expr[0] == '#')
-           continue;
-       len = strlen(expr);
-       len--;
-       while ((len >= 0) &&
-              ((expr[len] == '\n') || (expr[len] == '\t') ||
-               (expr[len] == '\r') || (expr[len] == ' '))) len--;
-       expr[len + 1] = 0;
-       if (len >= 0) {
-           if ((am != NULL) && (expr[0] == 't') && (expr[1] == ' ')) {
-               char *ptr = &expr[2];
-               int from, to;
-
-               from = scanNumber(&ptr);
-               if (*ptr != ' ') {
-                   xmlGenericError(xmlGenericErrorContext,
-                           "Bad line %s\n", expr);
-                   break;
-               }
-               if (states[from] == NULL)
-                   states[from] = xmlAutomataNewState(am);
-               ptr++;
-               to = scanNumber(&ptr);
-               if (*ptr != ' ') {
-                   xmlGenericError(xmlGenericErrorContext,
-                           "Bad line %s\n", expr);
-                   break;
-               }
-               if (states[to] == NULL)
-                   states[to] = xmlAutomataNewState(am);
-               ptr++;
-               xmlAutomataNewTransition(am, states[from], states[to],
-                                        BAD_CAST ptr, NULL);
-           } else if ((am != NULL) && (expr[0] == 'e') && (expr[1] == ' ')) {
-               char *ptr = &expr[2];
-               int from, to;
-
-               from = scanNumber(&ptr);
-               if (*ptr != ' ') {
-                   xmlGenericError(xmlGenericErrorContext,
-                           "Bad line %s\n", expr);
-                   break;
-               }
-               if (states[from] == NULL)
-                   states[from] = xmlAutomataNewState(am);
-               ptr++;
-               to = scanNumber(&ptr);
-               if (states[to] == NULL)
-                   states[to] = xmlAutomataNewState(am);
-               xmlAutomataNewEpsilon(am, states[from], states[to]);
-           } else if ((am != NULL) && (expr[0] == 'f') && (expr[1] == ' ')) {
-               char *ptr = &expr[2];
-               int state;
-
-               state = scanNumber(&ptr);
-               if (states[state] == NULL) {
-                   xmlGenericError(xmlGenericErrorContext,
-                           "Bad state %d : %s\n", state, expr);
-                   break;
-               }
-               xmlAutomataSetFinalState(am, states[state]);
-           } else if ((am != NULL) && (expr[0] == 'c') && (expr[1] == ' ')) {
-               char *ptr = &expr[2];
-               int from, to;
-               int min, max;
-
-               from = scanNumber(&ptr);
-               if (*ptr != ' ') {
-                   xmlGenericError(xmlGenericErrorContext,
-                           "Bad line %s\n", expr);
-                   break;
-               }
-               if (states[from] == NULL)
-                   states[from] = xmlAutomataNewState(am);
-               ptr++;
-               to = scanNumber(&ptr);
-               if (*ptr != ' ') {
-                   xmlGenericError(xmlGenericErrorContext,
-                           "Bad line %s\n", expr);
-                   break;
-               }
-               if (states[to] == NULL)
-                   states[to] = xmlAutomataNewState(am);
-               ptr++;
-               min = scanNumber(&ptr);
-               if (*ptr != ' ') {
-                   xmlGenericError(xmlGenericErrorContext,
-                           "Bad line %s\n", expr);
-                   break;
-               }
-               ptr++;
-               max = scanNumber(&ptr);
-               if (*ptr != ' ') {
-                   xmlGenericError(xmlGenericErrorContext,
-                           "Bad line %s\n", expr);
-                   break;
-               }
-               ptr++;
-               xmlAutomataNewCountTrans(am, states[from], states[to],
-                                        BAD_CAST ptr, min, max, NULL);
-           } else if ((am != NULL) && (expr[0] == '-') && (expr[1] == '-')) {
-               /* end of the automata */
-               regexp = xmlAutomataCompile(am);
-               xmlFreeAutomata(am);
-               am = NULL;
-               if (regexp == NULL) {
-                   xmlGenericError(xmlGenericErrorContext,
-                           "Failed to compile the automata");
-                   break;
-               }
-           } else if ((expr[0] == '=') && (expr[1] == '>')) {
-               if (regexp == NULL) {
-                   printf("=> failed not compiled\n");
-               } else {
-                   if (exec == NULL)
-                       exec = xmlRegNewExecCtxt(regexp, NULL, NULL);
-                   if (ret == 0) {
-                       ret = xmlRegExecPushString(exec, NULL, NULL);
-                   }
-                   if (ret == 1)
-                       printf("=> Passed\n");
-                   else if ((ret == 0) || (ret == -1))
-                       printf("=> Failed\n");
-                   else if (ret < 0)
-                       printf("=> Error\n");
-                   xmlRegFreeExecCtxt(exec);
-                   exec = NULL;
-               }
-               ret = 0;
-           } else if (regexp != NULL) {
-               if (exec == NULL)
-                   exec = xmlRegNewExecCtxt(regexp, NULL, NULL);
-               ret = xmlRegExecPushString(exec, BAD_CAST expr, NULL);
-           } else {
-               xmlGenericError(xmlGenericErrorContext,
-                       "Unexpected line %s\n", expr);
-           }
-       }
-    }
-    fclose(input);
-    if (regexp != NULL)
-       xmlRegFreeRegexp(regexp);
-    if (exec != NULL)
-       xmlRegFreeExecCtxt(exec);
-    if (am != NULL)
-       xmlFreeAutomata(am);
-}
-
-int main(int argc, char **argv) {
-
-    xmlInitParser();
-
-    if (argc == 1) {
-       int ret;
-       xmlAutomataPtr am;
-       xmlAutomataStatePtr start, cur;
-       xmlRegexpPtr regexp;
-       xmlRegExecCtxtPtr exec;
-
-       am = xmlNewAutomata();
-       start = xmlAutomataGetInitState(am);
-
-       /* generate a[ba]*a */
-       cur = xmlAutomataNewTransition(am, start, NULL, BAD_CAST"a", NULL);
-       xmlAutomataNewTransition(am, cur, cur, BAD_CAST"b", NULL);
-       xmlAutomataNewTransition(am, cur, cur, BAD_CAST"a", NULL);
-       cur = xmlAutomataNewCountTrans(am, cur, NULL, BAD_CAST"a", 2, 3, NULL);
-       xmlAutomataSetFinalState(am, cur);
-
-       /* compile it in a regexp and free the automata */
-       regexp = xmlAutomataCompile(am);
-       xmlFreeAutomata(am);
-
-       /* test the regexp */
-       xmlRegexpPrint(stdout, regexp);
-       exec = xmlRegNewExecCtxt(regexp, NULL, NULL);
-       ret = xmlRegExecPushString(exec, BAD_CAST"a", NULL);
-       if (ret == 1)
-           printf("final\n");
-       else if (ret < 0)
-           printf("error\n");
-       ret =xmlRegExecPushString(exec, BAD_CAST"a", NULL);
-       if (ret == 1)
-           printf("final\n");
-       else if (ret < 0)
-           printf("error\n");
-       ret =xmlRegExecPushString(exec, BAD_CAST"b", NULL);
-       if (ret == 1)
-           printf("final\n");
-       else if (ret < 0)
-           printf("error\n");
-       ret =xmlRegExecPushString(exec, BAD_CAST"a", NULL);
-       if (ret == 1)
-           printf("final\n");
-       else if (ret < 0)
-           printf("error\n");
-       ret =xmlRegExecPushString(exec, BAD_CAST"a", NULL);
-       if (ret == 1)
-           printf("final\n");
-       else if (ret < 0)
-           printf("error\n");
-       ret =xmlRegExecPushString(exec, BAD_CAST"a", NULL);
-       if (ret == 1)
-           printf("final\n");
-       else if (ret < 0)
-           printf("error\n");
-       ret =xmlRegExecPushString(exec, BAD_CAST"a", NULL);
-       if (ret == 1)
-           printf("final\n");
-       else if (ret < 0)
-           printf("error\n");
-       if (ret == 0) {
-           ret = xmlRegExecPushString(exec, NULL, NULL);
-           if (ret == 1)
-               printf("final\n");
-           else if (ret < 0)
-               printf("error\n");
-       }
-       xmlRegFreeExecCtxt(exec);
-
-       /* free the regexp */
-       xmlRegFreeRegexp(regexp);
-    } else {
-       int i;
-
-       for (i = 1;i < argc;i++)
-           testRegexpFile(argv[i]);
-    }
-
-    xmlCleanupParser();
-    xmlMemoryDump();
-    return(0);
-}
-
-#else
-#include <stdio.h>
-int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
-    printf("%s : Automata support not compiled in\n", argv[0]);
-    return(0);
-}
-#endif /* LIBXML_AUTOMATA_ENABLED */
index 77b7ba1..6d00596 100644 (file)
@@ -49,24 +49,26 @@ int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
     xmlStrPrintf(filename, sizeof(filename),
                  "%s/testdso%s",
                  (const xmlChar*)MODULE_PATH,
-                (const xmlChar*)LIBXML_MODULE_EXTENSION);
+                 (const xmlChar*)LIBXML_MODULE_EXTENSION);
 
     module = xmlModuleOpen((const char*)filename, 0);
-    if (module)
-      {
-        if (xmlModuleSymbol(module, "hello_world", (void **) &hello_world)) {
-           fprintf(stderr, "Failure to lookup\n");
-           return(1);
-       }
-       if (hello_world == NULL) {
-           fprintf(stderr, "Lookup returned NULL\n");
-           return(1);
-       }
+    if (module == NULL) {
+      fprintf(stderr, "Failed to open module\n");
+      return(1);
+    }
 
-        (*hello_world)();
+    if (xmlModuleSymbol(module, "hello_world", (void **) &hello_world)) {
+      fprintf(stderr, "Failure to lookup\n");
+      return(1);
+    }
+    if (hello_world == NULL) {
+      fprintf(stderr, "Lookup returned NULL\n");
+      return(1);
+    }
 
-        xmlModuleClose(module);
-      }
+    (*hello_world)();
+
+    xmlModuleClose(module);
 
     xmlMemoryDump();
 
index bef6537..709ae76 100644 (file)
 #include <libxml/catalog.h>
 #ifdef HAVE_PTHREAD_H
 #include <pthread.h>
-#elif defined HAVE_WIN32_THREADS
+#elif defined(_WIN32)
 #include <windows.h>
-#elif defined HAVE_BEOS_THREADS
-#include <OS.h>
 #endif
 #include <string.h>
-#if !defined(_MSC_VER)
-#include <unistd.h>
-#endif
 #include <assert.h>
 
 #define        MAX_ARGC        20
 #define TEST_REPEAT_COUNT 500
 #ifdef HAVE_PTHREAD_H
 static pthread_t tid[MAX_ARGC];
-#elif defined HAVE_WIN32_THREADS
+#elif defined(_WIN32)
 static HANDLE tid[MAX_ARGC];
-#elif defined HAVE_BEOS_THREADS
-static thread_id tid[MAX_ARGC];
 #endif
 
 typedef struct {
@@ -145,7 +138,7 @@ main(void)
     xmlMemoryDump();
     return (0);
 }
-#elif defined HAVE_WIN32_THREADS
+#elif defined(_WIN32)
 static DWORD WINAPI
 win32_thread_specific_data(void *private_data)
 {
@@ -209,61 +202,7 @@ main(void)
 
     return (0);
 }
-#elif defined HAVE_BEOS_THREADS
-int
-main(void)
-{
-    unsigned int i, repeat;
-    status_t ret;
-
-    xmlInitParser();
-    printf("Parser initialized\n");
-    for (repeat = 0;repeat < TEST_REPEAT_COUNT;repeat++) {
-    printf("repeat: %d\n",repeat);
-       xmlLoadCatalog(catalog);
-       printf("loaded catalog: %s\n", catalog);
-       for (i = 0; i < num_threads; i++) {
-           tid[i] = (thread_id) -1;
-       }
-       printf("cleaned threads\n");
-       for (i = 0; i < num_threads; i++) {
-               tid[i] = spawn_thread(thread_specific_data, "xmlTestThread", B_NORMAL_PRIORITY, (void *) &threadParams[i]);
-               if (tid[i] < B_OK) {
-                       perror("beos_thread_create");
-                       exit(1);
-               }
-               printf("beos_thread_create %d -> %d\n", i, tid[i]);
-       }
-       for (i = 0; i < num_threads; i++) {
-            void *result;
-           ret = wait_for_thread(tid[i], &result);
-           printf("beos_thread_wait %d -> %d\n", i, ret);
-           if (ret != B_OK) {
-                       perror("beos_thread_wait");
-                       exit(1);
-           }
-       }
-
-       xmlCatalogCleanup();
-       ret = B_OK;
-       for (i = 0; i < num_threads; i++)
-           if (threadParams[i].okay == 0) {
-                       printf("Thread %d handling %s failed\n", i,
-                               threadParams[i].filename);
-                       ret = B_ERROR;
-               }
-    }
-    xmlCleanupParser();
-    xmlMemoryDump();
-
-       if (ret == B_OK)
-               printf("testThread : BeOS : SUCCESS!\n");
-       else
-               printf("testThread : BeOS : FAILED!\n");
-
-    return (0);
-}
-#endif /* pthreads or BeOS threads */
+#endif /* pthreads */
 
 #else /* !LIBXML_THREADS_ENABLED */
 int
index c37cc23..ab22e72 100644 (file)
--- a/testapi.c
+++ b/testapi.c
@@ -17,6 +17,7 @@
 #include <stdlib.h> /* for putenv() */
 #include <string.h>
 #include <libxml/xmlerror.h>
+#include <libxml/catalog.h>
 #include <libxml/relaxng.h>
 
 
@@ -124,6 +125,14 @@ int main(int argc, char **argv) {
     int ret;
     int blocks, mem;
 
+#if defined(_WIN32)
+    setvbuf(stdout, NULL, _IONBF, 0);
+    setvbuf(stderr, NULL, _IONBF, 0);
+
+    printf("Skipping on Windows for now\n");
+    return(0);
+#endif
+
 #ifdef HAVE_PUTENV
     /* access to the proxy can slow up regression tests a lot */
     putenv((char *) "http_proxy=");
@@ -135,6 +144,9 @@ int main(int argc, char **argv) {
     memset(longtab, 0, sizeof(longtab));
 
     xmlInitParser();
+#ifdef LIBXML_CATALOG_ENABLED
+    xmlInitializeCatalog();
+#endif
 #ifdef LIBXML_SCHEMAS_ENABLED
     xmlRelaxNGInitTypes();
 #endif
@@ -170,7 +182,6 @@ int main(int argc, char **argv) {
 
 #include <libxml/HTMLparser.h>
 #include <libxml/HTMLtree.h>
-#include <libxml/catalog.h>
 #include <libxml/chvalid.h>
 #include <libxml/dict.h>
 #include <libxml/encoding.h>
@@ -464,10 +475,15 @@ static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val,
         xmlFreeParserCtxt(val);
 }
 
-#ifdef LIBXML_SAX1_ENABLED
+#if defined(LIBXML_SAX1_ENABLED) || \
+    defined(LIBXML_VALID_ENABLED) || \
+    defined(LIBXML_PUSH_ENABLED)
 #define gen_nb_xmlSAXHandlerPtr 2
 static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) {
+    (void) no;
+#ifdef LIBXML_SAX1_ENABLED
     if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler);
+#endif
     return(NULL);
 }
 static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
@@ -1457,6 +1473,47 @@ test_htmlAutoCloseTag(void) {
 
 
 static int
+test_htmlCreateFileParserCtxt(void) {
+    int test_ret = 0;
+
+#if defined(LIBXML_HTML_ENABLED)
+    int mem_base;
+    htmlParserCtxtPtr ret_val;
+    const char * filename; /* the filename */
+    int n_filename;
+    char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
+    int n_encoding;
+
+    for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
+    for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
+        mem_base = xmlMemBlocks();
+        filename = gen_fileoutput(n_filename, 0);
+        encoding = gen_const_char_ptr(n_encoding, 1);
+
+        ret_val = htmlCreateFileParserCtxt(filename, (const char *)encoding);
+        desret_htmlParserCtxtPtr(ret_val);
+        call_tests++;
+        des_fileoutput(n_filename, filename, 0);
+        des_const_char_ptr(n_encoding, (const char *)encoding, 1);
+        xmlResetLastError();
+        if (mem_base != xmlMemBlocks()) {
+            printf("Leak of %d blocks found in htmlCreateFileParserCtxt",
+                  xmlMemBlocks() - mem_base);
+           test_ret++;
+            printf(" %d", n_filename);
+            printf(" %d", n_encoding);
+            printf("\n");
+        }
+    }
+    }
+    function_tests++;
+#endif
+
+    return(test_ret);
+}
+
+
+static int
 test_htmlCreateMemoryParserCtxt(void) {
     int test_ret = 0;
 
@@ -1474,8 +1531,8 @@ test_htmlCreateMemoryParserCtxt(void) {
         buffer = gen_const_char_ptr(n_buffer, 0);
         size = gen_int(n_size, 1);
         if ((buffer != NULL) &&
-            (size > (int) strlen((const char *) buffer) + 1))
-            continue;
+            (size > xmlStrlen(BAD_CAST buffer)))
+            size = 0;
 
         ret_val = htmlCreateMemoryParserCtxt((const char *)buffer, size);
         desret_htmlParserCtxtPtr(ret_val);
@@ -1541,8 +1598,8 @@ test_htmlCreatePushParserCtxt(void) {
         filename = gen_fileoutput(n_filename, 4);
         enc = gen_xmlCharEncoding(n_enc, 5);
         if ((chunk != NULL) &&
-            (size > (int) strlen((const char *) chunk) + 1))
-            continue;
+            (size > xmlStrlen(BAD_CAST chunk)))
+            size = 0;
 
         ret_val = htmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename, enc);
         desret_htmlParserCtxtPtr(ret_val);
@@ -1718,8 +1775,8 @@ test_htmlCtxtReadMemory(void) {
         encoding = gen_const_char_ptr(n_encoding, 4);
         options = gen_int(n_options, 5);
         if ((buffer != NULL) &&
-            (size > (int) strlen((const char *) buffer) + 1))
-            continue;
+            (size > xmlStrlen(BAD_CAST buffer)))
+            size = 0;
 
         ret_val = htmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
         desret_htmlDocPtr(ret_val);
@@ -2076,6 +2133,31 @@ test_htmlHandleOmittedElem(void) {
 
 
 static int
+test_htmlInitAutoClose(void) {
+    int test_ret = 0;
+
+#if defined(LIBXML_HTML_ENABLED)
+    int mem_base;
+
+        mem_base = xmlMemBlocks();
+
+        htmlInitAutoClose();
+        call_tests++;
+        xmlResetLastError();
+        if (mem_base != xmlMemBlocks()) {
+            printf("Leak of %d blocks found in htmlInitAutoClose",
+                  xmlMemBlocks() - mem_base);
+           test_ret++;
+            printf("\n");
+        }
+    function_tests++;
+#endif
+
+    return(test_ret);
+}
+
+
+static int
 test_htmlIsAutoClosed(void) {
     int test_ret = 0;
 
@@ -2176,6 +2258,54 @@ test_htmlNewParserCtxt(void) {
     return(test_ret);
 }
 
+#ifdef LIBXML_HTML_ENABLED
+
+#define gen_nb_const_htmlSAXHandler_ptr 1
+#define gen_const_htmlSAXHandler_ptr(no, nr) NULL
+#define des_const_htmlSAXHandler_ptr(no, val, nr)
+#endif
+
+
+static int
+test_htmlNewSAXParserCtxt(void) {
+    int test_ret = 0;
+
+#if defined(LIBXML_HTML_ENABLED)
+    int mem_base;
+    htmlParserCtxtPtr ret_val;
+    htmlSAXHandler * sax; /* SAX handler */
+    int n_sax;
+    void * userData; /* user data */
+    int n_userData;
+
+    for (n_sax = 0;n_sax < gen_nb_const_htmlSAXHandler_ptr;n_sax++) {
+    for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
+        mem_base = xmlMemBlocks();
+        sax = gen_const_htmlSAXHandler_ptr(n_sax, 0);
+        userData = gen_userdata(n_userData, 1);
+
+        ret_val = htmlNewSAXParserCtxt((const htmlSAXHandler *)sax, userData);
+        desret_htmlParserCtxtPtr(ret_val);
+        call_tests++;
+        des_const_htmlSAXHandler_ptr(n_sax, (const htmlSAXHandler *)sax, 0);
+        des_userdata(n_userData, userData, 1);
+        xmlResetLastError();
+        if (mem_base != xmlMemBlocks()) {
+            printf("Leak of %d blocks found in htmlNewSAXParserCtxt",
+                  xmlMemBlocks() - mem_base);
+           test_ret++;
+            printf(" %d", n_sax);
+            printf(" %d", n_userData);
+            printf("\n");
+        }
+    }
+    }
+    function_tests++;
+#endif
+
+    return(test_ret);
+}
+
 
 static int
 test_htmlNodeStatus(void) {
@@ -2278,8 +2408,8 @@ test_htmlParseChunk(void) {
         size = gen_int(n_size, 2);
         terminate = gen_int(n_terminate, 3);
         if ((chunk != NULL) &&
-            (size > (int) strlen((const char *) chunk) + 1))
-            continue;
+            (size > xmlStrlen(BAD_CAST chunk)))
+            size = 0;
 
         ret_val = htmlParseChunk(ctxt, (const char *)chunk, size, terminate);
         if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
@@ -2624,8 +2754,8 @@ test_htmlReadMemory(void) {
         encoding = gen_const_char_ptr(n_encoding, 3);
         options = gen_int(n_options, 4);
         if ((buffer != NULL) &&
-            (size > (int) strlen((const char *) buffer) + 1))
-            continue;
+            (size > xmlStrlen(BAD_CAST buffer)))
+            size = 0;
 
         ret_val = htmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
         desret_htmlDocPtr(ret_val);
@@ -2782,10 +2912,11 @@ static int
 test_HTMLparser(void) {
     int test_ret = 0;
 
-    if (quiet == 0) printf("Testing HTMLparser : 32 of 38 functions ...\n");
+    if (quiet == 0) printf("Testing HTMLparser : 35 of 41 functions ...\n");
     test_ret += test_UTF8ToHtml();
     test_ret += test_htmlAttrAllowed();
     test_ret += test_htmlAutoCloseTag();
+    test_ret += test_htmlCreateFileParserCtxt();
     test_ret += test_htmlCreateMemoryParserCtxt();
     test_ret += test_htmlCreatePushParserCtxt();
     test_ret += test_htmlCtxtReadDoc();
@@ -2799,9 +2930,11 @@ test_HTMLparser(void) {
     test_ret += test_htmlEntityLookup();
     test_ret += test_htmlEntityValueLookup();
     test_ret += test_htmlHandleOmittedElem();
+    test_ret += test_htmlInitAutoClose();
     test_ret += test_htmlIsAutoClosed();
     test_ret += test_htmlIsScriptAttribute();
     test_ret += test_htmlNewParserCtxt();
+    test_ret += test_htmlNewSAXParserCtxt();
     test_ret += test_htmlNodeStatus();
     test_ret += test_htmlParseCharRef();
     test_ret += test_htmlParseChunk();
@@ -3843,8 +3976,8 @@ test_xmlSAX2CDataBlock(void) {
         value = gen_const_xmlChar_ptr(n_value, 1);
         len = gen_int(n_len, 2);
         if ((value != NULL) &&
-            (len > (int) strlen((const char *) value) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST value)))
+            len = 0;
 
         xmlSAX2CDataBlock(ctx, (const xmlChar *)value, len);
         call_tests++;
@@ -3890,8 +4023,8 @@ test_xmlSAX2Characters(void) {
         ch = gen_const_xmlChar_ptr(n_ch, 1);
         len = gen_int(n_len, 2);
         if ((ch != NULL) &&
-            (len > (int) strlen((const char *) ch) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST ch)))
+            len = 0;
 
         xmlSAX2Characters(ctx, (const xmlChar *)ch, len);
         call_tests++;
@@ -4533,8 +4666,8 @@ test_xmlSAX2IgnorableWhitespace(void) {
         ch = gen_const_xmlChar_ptr(n_ch, 1);
         len = gen_int(n_len, 2);
         if ((ch != NULL) &&
-            (len > (int) strlen((const char *) ch) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST ch)))
+            len = 0;
 
         xmlSAX2IgnorableWhitespace(ctx, (const xmlChar *)ch, len);
         call_tests++;
@@ -8154,8 +8287,8 @@ test_xmlDictExists(void) {
         name = gen_const_xmlChar_ptr(n_name, 1);
         len = gen_int(n_len, 2);
         if ((name != NULL) &&
-            (len > (int) strlen((const char *) name) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST name)))
+            len = 0;
 
         ret_val = xmlDictExists(dict, (const xmlChar *)name, len);
         desret_const_xmlChar_ptr(ret_val);
@@ -8213,8 +8346,8 @@ test_xmlDictLookup(void) {
         name = gen_const_xmlChar_ptr(n_name, 1);
         len = gen_int(n_len, 2);
         if ((name != NULL) &&
-            (len > (int) strlen((const char *) name) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST name)))
+            len = 0;
 
         ret_val = xmlDictLookup(dict, (const xmlChar *)name, len);
         desret_const_xmlChar_ptr(ret_val);
@@ -12061,8 +12194,8 @@ test_xmlCreatePushParserCtxt(void) {
         size = gen_int(n_size, 3);
         filename = gen_fileoutput(n_filename, 4);
         if ((chunk != NULL) &&
-            (size > (int) strlen((const char *) chunk) + 1))
-            continue;
+            (size > xmlStrlen(BAD_CAST chunk)))
+            size = 0;
 
         ret_val = xmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename);
         desret_xmlParserCtxtPtr(ret_val);
@@ -12242,8 +12375,8 @@ test_xmlCtxtReadMemory(void) {
         encoding = gen_const_char_ptr(n_encoding, 4);
         options = gen_parseroptions(n_options, 5);
         if ((buffer != NULL) &&
-            (size > (int) strlen((const char *) buffer) + 1))
-            continue;
+            (size > xmlStrlen(BAD_CAST buffer)))
+            size = 0;
 
         ret_val = xmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
         desret_xmlDocPtr(ret_val);
@@ -12338,8 +12471,8 @@ test_xmlCtxtResetPush(void) {
         filename = gen_filepath(n_filename, 3);
         encoding = gen_const_char_ptr(n_encoding, 4);
         if ((chunk != NULL) &&
-            (size > (int) strlen((const char *) chunk) + 1))
-            continue;
+            (size > xmlStrlen(BAD_CAST chunk)))
+            size = 0;
 
         ret_val = xmlCtxtResetPush(ctxt, (const char *)chunk, size, filename, (const char *)encoding);
         desret_int(ret_val);
@@ -12760,6 +12893,49 @@ test_xmlNewParserCtxt(void) {
 }
 
 
+#define gen_nb_const_xmlSAXHandler_ptr 1
+#define gen_const_xmlSAXHandler_ptr(no, nr) NULL
+#define des_const_xmlSAXHandler_ptr(no, val, nr)
+
+static int
+test_xmlNewSAXParserCtxt(void) {
+    int test_ret = 0;
+
+    int mem_base;
+    xmlParserCtxtPtr ret_val;
+    xmlSAXHandler * sax; /* SAX handler */
+    int n_sax;
+    void * userData; /* user data */
+    int n_userData;
+
+    for (n_sax = 0;n_sax < gen_nb_const_xmlSAXHandler_ptr;n_sax++) {
+    for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
+        mem_base = xmlMemBlocks();
+        sax = gen_const_xmlSAXHandler_ptr(n_sax, 0);
+        userData = gen_userdata(n_userData, 1);
+
+        ret_val = xmlNewSAXParserCtxt((const xmlSAXHandler *)sax, userData);
+        desret_xmlParserCtxtPtr(ret_val);
+        call_tests++;
+        des_const_xmlSAXHandler_ptr(n_sax, (const xmlSAXHandler *)sax, 0);
+        des_userdata(n_userData, userData, 1);
+        xmlResetLastError();
+        if (mem_base != xmlMemBlocks()) {
+            printf("Leak of %d blocks found in xmlNewSAXParserCtxt",
+                  xmlMemBlocks() - mem_base);
+           test_ret++;
+            printf(" %d", n_sax);
+            printf(" %d", n_userData);
+            printf("\n");
+        }
+    }
+    }
+    function_tests++;
+
+    return(test_ret);
+}
+
+
 #define gen_nb_xmlNodePtr_ptr 1
 #define gen_xmlNodePtr_ptr(no, nr) NULL
 #define des_xmlNodePtr_ptr(no, val, nr)
@@ -12949,8 +13125,8 @@ test_xmlParseChunk(void) {
         size = gen_int(n_size, 2);
         terminate = gen_int(n_terminate, 3);
         if ((chunk != NULL) &&
-            (size > (int) strlen((const char *) chunk) + 1))
-            continue;
+            (size > xmlStrlen(BAD_CAST chunk)))
+            size = 0;
 
         ret_val = xmlParseChunk(ctxt, (const char *)chunk, size, terminate);
         if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
@@ -13409,8 +13585,8 @@ test_xmlParseMemory(void) {
         buffer = gen_const_char_ptr(n_buffer, 0);
         size = gen_int(n_size, 1);
         if ((buffer != NULL) &&
-            (size > (int) strlen((const char *) buffer) + 1))
-            continue;
+            (size > xmlStrlen(BAD_CAST buffer)))
+            size = 0;
 
         ret_val = xmlParseMemory((const char *)buffer, size);
         desret_xmlDocPtr(ret_val);
@@ -13809,8 +13985,8 @@ test_xmlReadMemory(void) {
         encoding = gen_const_char_ptr(n_encoding, 3);
         options = gen_parseroptions(n_options, 4);
         if ((buffer != NULL) &&
-            (size > (int) strlen((const char *) buffer) + 1))
-            continue;
+            (size > xmlStrlen(BAD_CAST buffer)))
+            size = 0;
 
         ret_val = xmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
         desret_xmlDocPtr(ret_val);
@@ -13934,8 +14110,8 @@ test_xmlRecoverMemory(void) {
         buffer = gen_const_char_ptr(n_buffer, 0);
         size = gen_int(n_size, 1);
         if ((buffer != NULL) &&
-            (size > (int) strlen((const char *) buffer) + 1))
-            continue;
+            (size > xmlStrlen(BAD_CAST buffer)))
+            size = 0;
 
         ret_val = xmlRecoverMemory((const char *)buffer, size);
         desret_xmlDocPtr(ret_val);
@@ -14238,8 +14414,8 @@ test_xmlSAXParseMemory(void) {
         size = gen_int(n_size, 2);
         recovery = gen_int(n_recovery, 3);
         if ((buffer != NULL) &&
-            (size > (int) strlen((const char *) buffer) + 1))
-            continue;
+            (size > xmlStrlen(BAD_CAST buffer)))
+            size = 0;
 
         ret_val = xmlSAXParseMemory(sax, (const char *)buffer, size, recovery);
         desret_xmlDocPtr(ret_val);
@@ -14302,8 +14478,8 @@ test_xmlSAXParseMemoryWithData(void) {
         recovery = gen_int(n_recovery, 3);
         data = gen_userdata(n_data, 4);
         if ((buffer != NULL) &&
-            (size > (int) strlen((const char *) buffer) + 1))
-            continue;
+            (size > xmlStrlen(BAD_CAST buffer)))
+            size = 0;
 
         ret_val = xmlSAXParseMemoryWithData(sax, (const char *)buffer, size, recovery, data);
         desret_xmlDocPtr(ret_val);
@@ -14420,8 +14596,8 @@ test_xmlSAXUserParseMemory(void) {
         buffer = gen_const_char_ptr(n_buffer, 2);
         size = gen_int(n_size, 3);
         if ((buffer != NULL) &&
-            (size > (int) strlen((const char *) buffer) + 1))
-            continue;
+            (size > xmlStrlen(BAD_CAST buffer)))
+            size = 0;
         
 #ifdef LIBXML_SAX1_ENABLED
         if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
@@ -14583,7 +14759,7 @@ static int
 test_parser(void) {
     int test_ret = 0;
 
-    if (quiet == 0) printf("Testing parser : 58 of 70 functions ...\n");
+    if (quiet == 0) printf("Testing parser : 59 of 71 functions ...\n");
     test_ret += test_xmlByteConsumed();
     test_ret += test_xmlClearNodeInfoSeq();
     test_ret += test_xmlClearParserCtxt();
@@ -14606,6 +14782,7 @@ test_parser(void) {
     test_ret += test_xmlLoadExternalEntity();
     test_ret += test_xmlNewIOInputStream();
     test_ret += test_xmlNewParserCtxt();
+    test_ret += test_xmlNewSAXParserCtxt();
     test_ret += test_xmlParseBalancedChunkMemory();
     test_ret += test_xmlParseBalancedChunkMemoryRecover();
     test_ret += test_xmlParseChunk();
@@ -14651,72 +14828,6 @@ test_parser(void) {
 }
 
 static int
-test_htmlCreateFileParserCtxt(void) {
-    int test_ret = 0;
-
-#if defined(LIBXML_HTML_ENABLED)
-    int mem_base;
-    htmlParserCtxtPtr ret_val;
-    const char * filename; /* the filename */
-    int n_filename;
-    char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
-    int n_encoding;
-
-    for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
-    for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
-        mem_base = xmlMemBlocks();
-        filename = gen_fileoutput(n_filename, 0);
-        encoding = gen_const_char_ptr(n_encoding, 1);
-
-        ret_val = htmlCreateFileParserCtxt(filename, (const char *)encoding);
-        desret_htmlParserCtxtPtr(ret_val);
-        call_tests++;
-        des_fileoutput(n_filename, filename, 0);
-        des_const_char_ptr(n_encoding, (const char *)encoding, 1);
-        xmlResetLastError();
-        if (mem_base != xmlMemBlocks()) {
-            printf("Leak of %d blocks found in htmlCreateFileParserCtxt",
-                  xmlMemBlocks() - mem_base);
-           test_ret++;
-            printf(" %d", n_filename);
-            printf(" %d", n_encoding);
-            printf("\n");
-        }
-    }
-    }
-    function_tests++;
-#endif
-
-    return(test_ret);
-}
-
-
-static int
-test_htmlInitAutoClose(void) {
-    int test_ret = 0;
-
-#if defined(LIBXML_HTML_ENABLED)
-    int mem_base;
-
-        mem_base = xmlMemBlocks();
-
-        htmlInitAutoClose();
-        call_tests++;
-        xmlResetLastError();
-        if (mem_base != xmlMemBlocks()) {
-            printf("Leak of %d blocks found in htmlInitAutoClose",
-                  xmlMemBlocks() - mem_base);
-           test_ret++;
-            printf("\n");
-        }
-    function_tests++;
-#endif
-
-    return(test_ret);
-}
-
-
-static int
 test_inputPop(void) {
     int test_ret = 0;
 
@@ -15141,8 +15252,8 @@ test_xmlCreateMemoryParserCtxt(void) {
         buffer = gen_const_char_ptr(n_buffer, 0);
         size = gen_int(n_size, 1);
         if ((buffer != NULL) &&
-            (size > (int) strlen((const char *) buffer) + 1))
-            continue;
+            (size > xmlStrlen(BAD_CAST buffer)))
+            size = 0;
 
         ret_val = xmlCreateMemoryParserCtxt((const char *)buffer, size);
         desret_xmlParserCtxtPtr(ret_val);
@@ -15245,43 +15356,6 @@ test_xmlCurrentChar(void) {
 
 
 static int
-test_xmlErrMemory(void) {
-    int test_ret = 0;
-
-    int mem_base;
-    xmlParserCtxtPtr ctxt; /* an XML parser context */
-    int n_ctxt;
-    char * extra; /* extra information */
-    int n_extra;
-
-    for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
-    for (n_extra = 0;n_extra < gen_nb_const_char_ptr;n_extra++) {
-        mem_base = xmlMemBlocks();
-        ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
-        extra = gen_const_char_ptr(n_extra, 1);
-
-        xmlErrMemory(ctxt, (const char *)extra);
-        call_tests++;
-        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
-        des_const_char_ptr(n_extra, (const char *)extra, 1);
-        xmlResetLastError();
-        if (mem_base != xmlMemBlocks()) {
-            printf("Leak of %d blocks found in xmlErrMemory",
-                  xmlMemBlocks() - mem_base);
-           test_ret++;
-            printf(" %d", n_ctxt);
-            printf(" %d", n_extra);
-            printf("\n");
-        }
-    }
-    }
-    function_tests++;
-
-    return(test_ret);
-}
-
-
-static int
 test_xmlIsLetter(void) {
     int test_ret = 0;
 
@@ -15799,8 +15873,8 @@ test_xmlStringLenDecodeEntities(void) {
         end2 = gen_xmlChar(n_end2, 5);
         end3 = gen_xmlChar(n_end3, 6);
         if ((str != NULL) &&
-            (len > (int) strlen((const char *) str) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST str)))
+            len = 0;
 
         ret_val = xmlStringLenDecodeEntities(ctxt, (const xmlChar *)str, len, what, end, end2, end3);
         desret_xmlChar_ptr(ret_val);
@@ -15966,9 +16040,7 @@ static int
 test_parserInternals(void) {
     int test_ret = 0;
 
-    if (quiet == 0) printf("Testing parserInternals : 33 of 90 functions ...\n");
-    test_ret += test_htmlCreateFileParserCtxt();
-    test_ret += test_htmlInitAutoClose();
+    if (quiet == 0) printf("Testing parserInternals : 30 of 87 functions ...\n");
     test_ret += test_inputPop();
     test_ret += test_inputPush();
     test_ret += test_namePop();
@@ -15983,7 +16055,6 @@ test_parserInternals(void) {
     test_ret += test_xmlCreateMemoryParserCtxt();
     test_ret += test_xmlCreateURLParserCtxt();
     test_ret += test_xmlCurrentChar();
-    test_ret += test_xmlErrMemory();
     test_ret += test_xmlIsLetter();
     test_ret += test_xmlNewEntityInputStream();
     test_ret += test_xmlNewInputFromFile();
@@ -16754,8 +16825,8 @@ test_xmlRelaxNGNewMemParserCtxt(void) {
         buffer = gen_const_char_ptr(n_buffer, 0);
         size = gen_int(n_size, 1);
         if ((buffer != NULL) &&
-            (size > (int) strlen((const char *) buffer) + 1))
-            continue;
+            (size > xmlStrlen(BAD_CAST buffer)))
+            size = 0;
 
         ret_val = xmlRelaxNGNewMemParserCtxt((const char *)buffer, size);
         desret_xmlRelaxNGParserCtxtPtr(ret_val);
@@ -17033,8 +17104,8 @@ test_xmlRelaxNGValidatePushCData(void) {
         data = gen_const_xmlChar_ptr(n_data, 1);
         len = gen_int(n_len, 2);
         if ((data != NULL) &&
-            (len > (int) strlen((const char *) data) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST data)))
+            len = 0;
 
         ret_val = xmlRelaxNGValidatePushCData(ctxt, (const xmlChar *)data, len);
         desret_int(ret_val);
@@ -17739,8 +17810,8 @@ test_xmlBufferAdd(void) {
         str = gen_const_xmlChar_ptr(n_str, 1);
         len = gen_int(n_len, 2);
         if ((str != NULL) &&
-            (len > (int) strlen((const char *) str) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST str)))
+            len = 0;
 
         ret_val = xmlBufferAdd(buf, (const xmlChar *)str, len);
         desret_int(ret_val);
@@ -17788,8 +17859,8 @@ test_xmlBufferAddHead(void) {
         str = gen_const_xmlChar_ptr(n_str, 1);
         len = gen_int(n_len, 2);
         if ((str != NULL) &&
-            (len > (int) strlen((const char *) str) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST str)))
+            len = 0;
 
         ret_val = xmlBufferAddHead(buf, (const xmlChar *)str, len);
         desret_int(ret_val);
@@ -18164,7 +18235,6 @@ test_xmlBufferSetAllocationScheme(void) {
         scheme = gen_xmlBufferAllocationScheme(n_scheme, 1);
 
         xmlBufferSetAllocationScheme(buf, scheme);
-        if ((buf != NULL) && (scheme == XML_BUFFER_ALLOC_IMMUTABLE) && (buf->content != NULL) && (buf->content != static_buf_content)) { xmlFree(buf->content); buf->content = NULL;}
         call_tests++;
         des_xmlBufferPtr(n_buf, buf, 0);
         des_xmlBufferAllocationScheme(n_scheme, scheme, 1);
@@ -18360,8 +18430,8 @@ test_xmlBuildQName(void) {
         memory = gen_xmlChar_ptr(n_memory, 2);
         len = gen_int(n_len, 3);
         if ((prefix != NULL) &&
-            (len > (int) strlen((const char *) prefix) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST prefix)))
+            len = 0;
 
         ret_val = xmlBuildQName((const xmlChar *)ncname, (const xmlChar *)prefix, memory, len);
         if ((ret_val != NULL) && (ret_val != ncname) &&
@@ -20131,8 +20201,8 @@ test_xmlNewCDataBlock(void) {
         content = gen_const_xmlChar_ptr(n_content, 1);
         len = gen_int(n_len, 2);
         if ((content != NULL) &&
-            (len > (int) strlen((const char *) content) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST content)))
+            len = 0;
 
         ret_val = xmlNewCDataBlock(doc, (const xmlChar *)content, len);
         desret_xmlNodePtr(ret_val);
@@ -20707,8 +20777,8 @@ test_xmlNewDocTextLen(void) {
         content = gen_const_xmlChar_ptr(n_content, 1);
         len = gen_int(n_len, 2);
         if ((content != NULL) &&
-            (len > (int) strlen((const char *) content) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST content)))
+            len = 0;
 
         ret_val = xmlNewDocTextLen(doc, (const xmlChar *)content, len);
         desret_xmlNodePtr(ret_val);
@@ -21253,8 +21323,8 @@ test_xmlNewTextLen(void) {
         content = gen_const_xmlChar_ptr(n_content, 0);
         len = gen_int(n_len, 1);
         if ((content != NULL) &&
-            (len > (int) strlen((const char *) content) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST content)))
+            len = 0;
 
         ret_val = xmlNewTextLen((const xmlChar *)content, len);
         desret_xmlNodePtr(ret_val);
@@ -21369,8 +21439,8 @@ test_xmlNodeAddContentLen(void) {
         content = gen_const_xmlChar_ptr(n_content, 1);
         len = gen_int(n_len, 2);
         if ((content != NULL) &&
-            (len > (int) strlen((const char *) content) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST content)))
+            len = 0;
 
         xmlNodeAddContentLen(cur, (const xmlChar *)content, len);
         call_tests++;
@@ -21922,8 +21992,8 @@ test_xmlNodeSetContentLen(void) {
         content = gen_const_xmlChar_ptr(n_content, 1);
         len = gen_int(n_len, 2);
         if ((content != NULL) &&
-            (len > (int) strlen((const char *) content) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST content)))
+            len = 0;
 
         xmlNodeSetContentLen(cur, (const xmlChar *)content, len);
         call_tests++;
@@ -22989,8 +23059,8 @@ test_xmlStringLenGetNodeList(void) {
         value = gen_const_xmlChar_ptr(n_value, 1);
         len = gen_int(n_len, 2);
         if ((value != NULL) &&
-            (len > (int) strlen((const char *) value) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST value)))
+            len = 0;
 
         ret_val = xmlStringLenGetNodeList((const xmlDoc *)doc, (const xmlChar *)value, len);
         desret_xmlNodePtr(ret_val);
@@ -23038,8 +23108,8 @@ test_xmlTextConcat(void) {
         content = gen_const_xmlChar_ptr(n_content, 1);
         len = gen_int(n_len, 2);
         if ((content != NULL) &&
-            (len > (int) strlen((const char *) content) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST content)))
+            len = 0;
 
         ret_val = xmlTextConcat(node, (const xmlChar *)content, len);
         desret_int(ret_val);
@@ -25700,23 +25770,23 @@ test_xmlValidateElement(void) {
     int n_ctxt;
     xmlDocPtr doc; /* a document instance */
     int n_doc;
-    xmlNodePtr elem; /* an element instance */
-    int n_elem;
+    xmlNodePtr root; /*  */
+    int n_root;
 
     for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
-    for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
+    for (n_root = 0;n_root < gen_nb_xmlNodePtr;n_root++) {
         mem_base = xmlMemBlocks();
         ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
         doc = gen_xmlDocPtr(n_doc, 1);
-        elem = gen_xmlNodePtr(n_elem, 2);
+        root = gen_xmlNodePtr(n_root, 2);
 
-        ret_val = xmlValidateElement(ctxt, doc, elem);
+        ret_val = xmlValidateElement(ctxt, doc, root);
         desret_int(ret_val);
         call_tests++;
         des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
         des_xmlDocPtr(n_doc, doc, 1);
-        des_xmlNodePtr(n_elem, elem, 2);
+        des_xmlNodePtr(n_root, root, 2);
         xmlResetLastError();
         if (mem_base != xmlMemBlocks()) {
             printf("Leak of %d blocks found in xmlValidateElement",
@@ -25724,7 +25794,7 @@ test_xmlValidateElement(void) {
            test_ret++;
             printf(" %d", n_ctxt);
             printf(" %d", n_doc);
-            printf(" %d", n_elem);
+            printf(" %d", n_root);
             printf("\n");
         }
     }
@@ -26273,8 +26343,8 @@ test_xmlValidatePushCData(void) {
         data = gen_const_xmlChar_ptr(n_data, 1);
         len = gen_int(n_len, 2);
         if ((data != NULL) &&
-            (len > (int) strlen((const char *) data) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST data)))
+            len = 0;
 
         ret_val = xmlValidatePushCData(ctxt, (const xmlChar *)data, len);
         desret_int(ret_val);
@@ -27809,8 +27879,8 @@ test_xmlOutputBufferWrite(void) {
         len = gen_int(n_len, 1);
         buf = gen_const_char_ptr(n_buf, 2);
         if ((buf != NULL) &&
-            (len > (int) strlen((const char *) buf) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST buf)))
+            len = 0;
 
         ret_val = xmlOutputBufferWrite(out, len, (const char *)buf);
         desret_int(ret_val);
@@ -28038,8 +28108,8 @@ test_xmlParserInputBufferCreateMem(void) {
         size = gen_int(n_size, 1);
         enc = gen_xmlCharEncoding(n_enc, 2);
         if ((mem != NULL) &&
-            (size > (int) strlen((const char *) mem) + 1))
-            continue;
+            (size > xmlStrlen(BAD_CAST mem)))
+            size = 0;
 
         ret_val = xmlParserInputBufferCreateMem((const char *)mem, size, enc);
         desret_xmlParserInputBufferPtr(ret_val);
@@ -28087,8 +28157,8 @@ test_xmlParserInputBufferCreateStatic(void) {
         size = gen_int(n_size, 1);
         enc = gen_xmlCharEncoding(n_enc, 2);
         if ((mem != NULL) &&
-            (size > (int) strlen((const char *) mem) + 1))
-            continue;
+            (size > xmlStrlen(BAD_CAST mem)))
+            size = 0;
 
         ret_val = xmlParserInputBufferCreateStatic((const char *)mem, size, enc);
         desret_xmlParserInputBufferPtr(ret_val);
@@ -28175,8 +28245,8 @@ test_xmlParserInputBufferPush(void) {
         len = gen_int(n_len, 1);
         buf = gen_const_char_ptr(n_buf, 2);
         if ((buf != NULL) &&
-            (len > (int) strlen((const char *) buf) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST buf)))
+            len = 0;
 
         ret_val = xmlParserInputBufferPush(in, len, (const char *)buf);
         desret_int(ret_val);
@@ -29373,8 +29443,8 @@ test_xmlReaderForMemory(void) {
         encoding = gen_const_char_ptr(n_encoding, 3);
         options = gen_parseroptions(n_options, 4);
         if ((buffer != NULL) &&
-            (size > (int) strlen((const char *) buffer) + 1))
-            continue;
+            (size > xmlStrlen(BAD_CAST buffer)))
+            size = 0;
 
         ret_val = xmlReaderForMemory((const char *)buffer, size, URL, (const char *)encoding, options);
         desret_xmlTextReaderPtr(ret_val);
@@ -29559,8 +29629,8 @@ test_xmlReaderNewMemory(void) {
         encoding = gen_const_char_ptr(n_encoding, 4);
         options = gen_parseroptions(n_options, 5);
         if ((buffer != NULL) &&
-            (size > (int) strlen((const char *) buffer) + 1))
-            continue;
+            (size > xmlStrlen(BAD_CAST buffer)))
+            size = 0;
 
         ret_val = xmlReaderNewMemory(reader, (const char *)buffer, size, URL, (const char *)encoding, options);
         desret_int(ret_val);
@@ -33575,8 +33645,8 @@ test_xmlSchemaNewMemParserCtxt(void) {
         buffer = gen_const_char_ptr(n_buffer, 0);
         size = gen_int(n_size, 1);
         if ((buffer != NULL) &&
-            (size > (int) strlen((const char *) buffer) + 1))
-            continue;
+            (size > xmlStrlen(BAD_CAST buffer)))
+            size = 0;
 
         ret_val = xmlSchemaNewMemParserCtxt((const char *)buffer, size);
         desret_xmlSchemaParserCtxtPtr(ret_val);
@@ -34625,9 +34695,11 @@ test_xmlSchemaInitTypes(void) {
     int test_ret = 0;
 
 #if defined(LIBXML_SCHEMAS_ENABLED)
+    int ret_val;
 
 
-        xmlSchemaInitTypes();
+        ret_val = xmlSchemaInitTypes();
+        desret_int(ret_val);
         call_tests++;
         xmlResetLastError();
     function_tests++;
@@ -35437,8 +35509,8 @@ test_xmlCharStrndup(void) {
         cur = gen_const_char_ptr(n_cur, 0);
         len = gen_int(n_len, 1);
         if ((cur != NULL) &&
-            (len > (int) strlen((const char *) cur) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST cur)))
+            len = 0;
 
         ret_val = xmlCharStrndup((const char *)cur, len);
         desret_xmlChar_ptr(ret_val);
@@ -35879,8 +35951,8 @@ test_xmlStrncasecmp(void) {
         str2 = gen_const_xmlChar_ptr(n_str2, 1);
         len = gen_int(n_len, 2);
         if ((str2 != NULL) &&
-            (len > (int) strlen((const char *) str2) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST str2)))
+            len = 0;
 
         ret_val = xmlStrncasecmp((const xmlChar *)str1, (const xmlChar *)str2, len);
         desret_int(ret_val);
@@ -35928,8 +36000,8 @@ test_xmlStrncatNew(void) {
         str2 = gen_const_xmlChar_ptr(n_str2, 1);
         len = gen_int(n_len, 2);
         if ((str2 != NULL) &&
-            (len > (int) strlen((const char *) str2) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST str2)))
+            len = 0;
 
         ret_val = xmlStrncatNew((const xmlChar *)str1, (const xmlChar *)str2, len);
         desret_xmlChar_ptr(ret_val);
@@ -35977,8 +36049,8 @@ test_xmlStrncmp(void) {
         str2 = gen_const_xmlChar_ptr(n_str2, 1);
         len = gen_int(n_len, 2);
         if ((str2 != NULL) &&
-            (len > (int) strlen((const char *) str2) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST str2)))
+            len = 0;
 
         ret_val = xmlStrncmp((const xmlChar *)str1, (const xmlChar *)str2, len);
         desret_int(ret_val);
@@ -36022,8 +36094,8 @@ test_xmlStrndup(void) {
         cur = gen_const_xmlChar_ptr(n_cur, 0);
         len = gen_int(n_len, 1);
         if ((cur != NULL) &&
-            (len > (int) strlen((const char *) cur) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST cur)))
+            len = 0;
 
         ret_val = xmlStrndup((const xmlChar *)cur, len);
         desret_xmlChar_ptr(ret_val);
@@ -36107,11 +36179,11 @@ test_xmlStrsub(void) {
         start = gen_int(n_start, 1);
         len = gen_int(n_len, 2);
         if ((str != NULL) &&
-            (start > (int) strlen((const char *) str) + 1))
-            continue;
+            (start > xmlStrlen(BAD_CAST str)))
+            start = 0;
         if ((str != NULL) &&
-            (len > (int) strlen((const char *) str) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST str)))
+            len = 0;
 
         ret_val = xmlStrsub((const xmlChar *)str, start, len);
         desret_xmlChar_ptr(ret_val);
@@ -36297,8 +36369,8 @@ test_xmlUTF8Strndup(void) {
         utf = gen_const_xmlChar_ptr(n_utf, 0);
         len = gen_int(n_len, 1);
         if ((utf != NULL) &&
-            (len > (int) strlen((const char *) utf) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST utf)))
+            len = 0;
 
         ret_val = xmlUTF8Strndup((const xmlChar *)utf, len);
         desret_xmlChar_ptr(ret_val);
@@ -36378,8 +36450,8 @@ test_xmlUTF8Strsize(void) {
         utf = gen_const_xmlChar_ptr(n_utf, 0);
         len = gen_int(n_len, 1);
         if ((utf != NULL) &&
-            (len > (int) strlen((const char *) utf) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST utf)))
+            len = 0;
 
         ret_val = xmlUTF8Strsize((const xmlChar *)utf, len);
         desret_int(ret_val);
@@ -36424,11 +36496,11 @@ test_xmlUTF8Strsub(void) {
         start = gen_int(n_start, 1);
         len = gen_int(n_len, 2);
         if ((utf != NULL) &&
-            (start > (int) strlen((const char *) utf) + 1))
-            continue;
+            (start > xmlStrlen(BAD_CAST utf)))
+            start = 0;
         if ((utf != NULL) &&
-            (len > (int) strlen((const char *) utf) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST utf)))
+            len = 0;
 
         ret_val = xmlUTF8Strsub((const xmlChar *)utf, start, len);
         desret_xmlChar_ptr(ret_val);
@@ -43742,11 +43814,11 @@ test_xmlTextWriterWriteBase64(void) {
         start = gen_int(n_start, 2);
         len = gen_int(n_len, 3);
         if ((data != NULL) &&
-            (start > (int) strlen((const char *) data) + 1))
-            continue;
+            (start > xmlStrlen(BAD_CAST data)))
+            start = 0;
         if ((data != NULL) &&
-            (len > (int) strlen((const char *) data) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST data)))
+            len = 0;
 
         ret_val = xmlTextWriterWriteBase64(writer, (const char *)data, start, len);
         desret_int(ret_val);
@@ -43803,11 +43875,11 @@ test_xmlTextWriterWriteBinHex(void) {
         start = gen_int(n_start, 2);
         len = gen_int(n_len, 3);
         if ((data != NULL) &&
-            (start > (int) strlen((const char *) data) + 1))
-            continue;
+            (start > xmlStrlen(BAD_CAST data)))
+            start = 0;
         if ((data != NULL) &&
-            (len > (int) strlen((const char *) data) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST data)))
+            len = 0;
 
         ret_val = xmlTextWriterWriteBinHex(writer, (const char *)data, start, len);
         desret_int(ret_val);
@@ -44739,8 +44811,8 @@ test_xmlTextWriterWriteRawLen(void) {
         content = gen_const_xmlChar_ptr(n_content, 1);
         len = gen_int(n_len, 2);
         if ((content != NULL) &&
-            (len > (int) strlen((const char *) content) + 1))
-            continue;
+            (len > xmlStrlen(BAD_CAST content)))
+            len = 0;
 
         ret_val = xmlTextWriterWriteRawLen(writer, (const xmlChar *)content, len);
         desret_int(ret_val);
index bd1a8d6..e5916d0 100644 (file)
@@ -5,13 +5,14 @@
  * copy: see Copyright for the status of this software.
  */
 
+#define XML_DEPRECATED
+
 #include <stdio.h>
 #include <string.h>
+#include <libxml/tree.h>
 #include <libxml/parser.h>
 #include <libxml/parserInternals.h>
 
-#include "buf.h"
-
 int lastError;
 
 static void errorHandler(void *unused, xmlErrorPtr err) {
@@ -260,9 +261,10 @@ static int testDocumentRanges(void) {
     return(test_ret);
 }
 
-static int testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) {
+static int testCharRangeByte1(xmlParserCtxtPtr ctxt) {
     int i = 0;
     int len, c;
+    char *data = (char *) ctxt->input->cur;
 
     data[1] = 0;
     data[2] = 0;
@@ -270,6 +272,7 @@ static int testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) {
     for (i = 0;i <= 0xFF;i++) {
         data[0] = (char) i;
        ctxt->charset = XML_CHAR_ENCODING_UTF8;
+        ctxt->nbErrors = 0;
 
        lastError = 0;
         c = xmlCurrentChar(ctxt, &len);
@@ -293,9 +296,10 @@ static int testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) {
     return(0);
 }
 
-static int testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
+static int testCharRangeByte2(xmlParserCtxtPtr ctxt) {
     int i, j;
     int len, c;
+    char *data = (char *) ctxt->input->cur;
 
     data[2] = 0;
     data[3] = 0;
@@ -304,6 +308,7 @@ static int testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
            data[0] = (char) i;
            data[1] = (char) j;
            ctxt->charset = XML_CHAR_ENCODING_UTF8;
+            ctxt->nbErrors = 0;
 
            lastError = 0;
            c = xmlCurrentChar(ctxt, &len);
@@ -380,10 +385,11 @@ static int testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
     return(0);
 }
 
-static int testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
+static int testCharRangeByte3(xmlParserCtxtPtr ctxt) {
     int i, j, k, K;
     int len, c;
     unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF};
+    char *data = (char *) ctxt->input->cur;
     int value;
 
     data[3] = 0;
@@ -396,6 +402,7 @@ static int testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
        data[2] = (char) K;
        value = (K & 0x3F) + ((j & 0x3F) << 6) + ((i & 0xF) << 12);
        ctxt->charset = XML_CHAR_ENCODING_UTF8;
+        ctxt->nbErrors = 0;
 
        lastError = 0;
        c = xmlCurrentChar(ctxt, &len);
@@ -477,10 +484,11 @@ static int testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
     return(0);
 }
 
-static int testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
+static int testCharRangeByte4(xmlParserCtxtPtr ctxt) {
     int i, j, k, K, l, L;
     int len, c;
     unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF};
+    char *data = (char *) ctxt->input->cur;
     int value;
 
     data[4] = 0;
@@ -497,6 +505,7 @@ static int testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
        value = (L & 0x3F) + ((K & 0x3F) << 6) + ((j & 0x3F) << 12) +
                ((i & 0x7) << 18);
        ctxt->charset = XML_CHAR_ENCODING_UTF8;
+        ctxt->nbErrors = 0;
 
        lastError = 0;
        c = xmlCurrentChar(ctxt, &len);
@@ -607,8 +616,8 @@ static int testCharRanges(void) {
         fprintf(stderr, "Failed to allocate parser context\n");
        return(1);
     }
-    buf = xmlParserInputBufferCreateStatic(data, sizeof(data),
-                                           XML_CHAR_ENCODING_NONE);
+    buf = xmlParserInputBufferCreateMem(data, sizeof(data),
+                                        XML_CHAR_ENCODING_NONE);
     if (buf == NULL) {
         fprintf(stderr, "Failed to allocate input buffer\n");
        test_ret = 1;
@@ -629,16 +638,16 @@ static int testCharRanges(void) {
 
     printf("testing char range: 1");
     fflush(stdout);
-    test_ret += testCharRangeByte1(ctxt, data);
+    test_ret += testCharRangeByte1(ctxt);
     printf(" 2");
     fflush(stdout);
-    test_ret += testCharRangeByte2(ctxt, data);
+    test_ret += testCharRangeByte2(ctxt);
     printf(" 3");
     fflush(stdout);
-    test_ret += testCharRangeByte3(ctxt, data);
+    test_ret += testCharRangeByte3(ctxt);
     printf(" 4");
     fflush(stdout);
-    test_ret += testCharRangeByte4(ctxt, data);
+    test_ret += testCharRangeByte4(ctxt);
     printf(" done\n");
     fflush(stdout);
 
@@ -647,6 +656,63 @@ error:
     return(test_ret);
 }
 
+static int
+testUserEncoding(void) {
+    /*
+     * Create a document encoded as UTF-16LE with an ISO-8859-1 encoding
+     * declaration, then parse it with xmlReadMemory and the encoding
+     * argument set to UTF-16LE.
+     */
+    xmlDocPtr doc = NULL;
+    const char *start = "<?xml version='1.0' encoding='ISO-8859-1'?><d>";
+    const char *end = "</d>";
+    char *buf = NULL;
+    xmlChar *text;
+    int startSize = strlen(start);
+    int textSize = 100000; /* Make sure to exceed internal buffer sizes. */
+    int endSize = strlen(end);
+    int totalSize = startSize + textSize + endSize;
+    int k = 0;
+    int i;
+    int ret = 1;
+
+    buf = xmlMalloc(2 * totalSize);
+    for (i = 0; start[i] != 0; i++) {
+        buf[k++] = start[i];
+        buf[k++] = 0;
+    }
+    for (i = 0; i < textSize; i++) {
+        buf[k++] = 'x';
+        buf[k++] = 0;
+    }
+    for (i = 0; end[i] != 0; i++) {
+        buf[k++] = end[i];
+        buf[k++] = 0;
+    }
+
+    doc = xmlReadMemory(buf, 2 * totalSize, NULL, "UTF-16LE", 0);
+    if (doc == NULL) {
+        fprintf(stderr, "failed to parse document\n");
+        goto error;
+    }
+
+    text = doc->children->children->content;
+    for (i = 0; i < textSize; i++) {
+        if (text[i] != 'x') {
+            fprintf(stderr, "text node has wrong content at offset %d\n", k);
+            goto error;
+        }
+    }
+
+    ret = 0;
+
+error:
+    xmlFreeDoc(doc);
+    xmlFree(buf);
+
+    return ret;
+}
+
 int main(void) {
 
     int ret = 0;
@@ -669,6 +735,7 @@ int main(void) {
      */
     ret += testCharRanges();
     ret += testDocumentRanges();
+    ret += testUserEncoding();
 
     /*
      * Cleanup function for the XML library.
index 40bebd0..4d74552 100644 (file)
@@ -159,7 +159,8 @@ static int run_test2(xmlDictPtr parent) {
        fprintf(stderr, "Out of memory while creating sub-dictionary\n");
        exit(1);
     }
-    memset(test2, 0, sizeof(test2));
+    /* Cast to avoid buggy warning on MSVC. */
+    memset((void *) test2, 0, sizeof(test2));
 
     /*
      * Fill in NB_STRINGS_MIN, at this point the dictionary should not grow
@@ -322,7 +323,8 @@ static int run_test1(void) {
        fprintf(stderr, "Out of memory while creating dictionary\n");
        exit(1);
     }
-    memset(test1, 0, sizeof(test1));
+    /* Cast to avoid buggy warning on MSVC. */
+    memset((void *) test1, 0, sizeof(test1));
 
     /*
      * Fill in NB_STRINGS_MIN, at this point the dictionary should not grow
index 0b045ea..0680f95 100644 (file)
 #include "libxml.h"
 #include <stdio.h>
 
-#if !defined(_WIN32)
-#include <unistd.h>
-#endif
 #include <string.h>
-#include <sys/types.h>
 #include <sys/stat.h>
-#include <fcntl.h>
 #include <time.h>
 
 #include <libxml/parser.h>
@@ -402,7 +397,7 @@ testExternalEntityLoader(const char *URL, const char *ID,
 static char testErrors[32769];
 static int testErrorsSize = 0;
 
-static void XMLCDECL
+static void
 channel(void *ctx  ATTRIBUTE_UNUSED, const char *msg, ...) {
     va_list args;
     int res;
@@ -1117,7 +1112,7 @@ commentCallback(void *ctx ATTRIBUTE_UNUSED,
  * Display and format a warning messages, gives file, line, position and
  * extra parameters.
  */
-static void XMLCDECL
+static void
 warningCallback(void *ctx ATTRIBUTE_UNUSED,
                 const char *msg ATTRIBUTE_UNUSED, ...)
 {
@@ -1134,7 +1129,7 @@ warningCallback(void *ctx ATTRIBUTE_UNUSED,
  * Display and format a error messages, gives file, line, position and
  * extra parameters.
  */
-static void XMLCDECL
+static void
 errorCallback(void *ctx ATTRIBUTE_UNUSED, const char *msg ATTRIBUTE_UNUSED,
               ...)
 {
@@ -1151,7 +1146,7 @@ errorCallback(void *ctx ATTRIBUTE_UNUSED, const char *msg ATTRIBUTE_UNUSED,
  * Display and format a fatalError messages, gives file, line, position and
  * extra parameters.
  */
-static void XMLCDECL
+static void
 fatalErrorCallback(void *ctx ATTRIBUTE_UNUSED,
                    const char *msg ATTRIBUTE_UNUSED, ...)
 {
@@ -1261,19 +1256,15 @@ saxTest(const char *filename, size_t limit, int options, int fail) {
     int res = 0;
     xmlParserCtxtPtr ctxt;
     xmlDocPtr doc;
-    xmlSAXHandlerPtr old_sax;
 
     nb_tests++;
 
     maxlen = limit;
-    ctxt = xmlNewParserCtxt();
+    ctxt = xmlNewSAXParserCtxt(callbackSAX2Handler, NULL);
     if (ctxt == NULL) {
         fprintf(stderr, "Failed to create parser context\n");
        return(1);
     }
-    old_sax = ctxt->sax;
-    ctxt->sax = callbackSAX2Handler;
-    ctxt->userData = NULL;
     doc = xmlCtxtReadFile(ctxt, filename, NULL, options);
 
     if (doc != NULL) {
@@ -1296,7 +1287,6 @@ saxTest(const char *filename, size_t limit, int options, int fail) {
         } else
             res = 0;
     }
-    ctxt->sax = old_sax;
     xmlFreeParserCtxt(ctxt);
 
     return(res);
index fabc513..a70ca34 100644 (file)
 #include "libxml.h"
 #include <stdio.h>
 
-#if !defined(_WIN32)
-#include <unistd.h>
-#endif
 #include <string.h>
-#include <sys/types.h>
 #include <sys/stat.h>
-#include <fcntl.h>
 
 #include <libxml/parser.h>
+#include <libxml/parserInternals.h>
 #include <libxml/tree.h>
 #include <libxml/uri.h>
-#ifdef LIBXML_READER_ENABLED
-#include <libxml/xmlreader.h>
-#endif
 
 /*
  * O_BINARY is just for Windows compatibility - if it isn't defined
@@ -38,6 +31,9 @@
 #define        RD_FLAGS        O_RDONLY
 #endif
 
+#define OPT_SAX         (1<<0)
+#define OPT_NO_SUBST    (1<<1)
+
 typedef int (*functest) (const char *filename, const char *result,
                          const char *error, int options);
 
@@ -59,7 +55,6 @@ static int checkTestFile(const char *filename);
 #if defined(_WIN32)
 
 #include <windows.h>
-#include <io.h>
 
 typedef struct
 {
@@ -158,17 +153,62 @@ static void globfree(glob_t *pglob) {
 
 #include <libxml/xmlIO.h>
 
+typedef struct {
+    const char *URL;
+    const char *start;
+    const char *segment;
+    const char *finish;
+} xmlHugeDocParts;
+
+static const xmlHugeDocParts hugeDocTable[] = {
+    {
+        "test/recurse/huge.xml",
+
+        "<!DOCTYPE foo ["
+        "<!ELEMENT foo (bar*)> "
+        "<!ELEMENT bar (#PCDATA)> "
+        "<!ATTLIST bar attr CDATA #IMPLIED> "
+        "<!ENTITY a SYSTEM 'ga.ent'> "
+        "<!ENTITY b SYSTEM 'gb.ent'> "
+        "<!ENTITY c SYSTEM 'gc.ent'> "
+        "<!ENTITY f 'some internal data'> "
+        "<!ENTITY e '&f;&f;'> "
+        "<!ENTITY d '&e;&e;'> "
+        "]> "
+        "<foo>",
+
+        "  <bar attr='&e; &f; &d;'>&a; &b; &c; &e; &f; &d;</bar>\n"
+        "  <bar>_123456789_123456789_123456789_123456789</bar>\n"
+        "  <bar>_123456789_123456789_123456789_123456789</bar>\n"
+        "  <bar>_123456789_123456789_123456789_123456789</bar>\n"
+        "  <bar>_123456789_123456789_123456789_123456789</bar>\n",
+
+        "</foo>"
+    },
+    {
+        "test/recurse/huge_dtd.dtd",
+
+        "<!ELEMENT foo (#PCDATA)>\n"
+        "<!ENTITY ent 'success'>\n"
+        "<!ENTITY % a SYSTEM 'pa.ent'>\n"
+        "<!ENTITY % b SYSTEM 'pb.ent'>\n"
+        "<!ENTITY % c SYSTEM 'pc.ent'>\n"
+        "<!ENTITY % d '<!-- comment -->'>\n"
+        "<!ENTITY % e '%d;%d;'>\n"
+        "<!ENTITY % f '%e;%e;'>\n",
+
+        "<!ENTITY ent '%a; %b; %c; %d; %e; %f;'>\n"
+        "%a; %b; %c; %d; %e; %f;\n"
+        "<!-- _123456789_123456789_123456789_123456789 -->\n"
+        "<!-- _123456789_123456789_123456789_123456789 -->\n"
+        "<!-- _123456789_123456789_123456789_123456789 -->\n",
+
+        ""
+    },
+    { NULL, NULL, NULL, NULL }
+};
 
-static const char *start = "<!DOCTYPE foo [\
-<!ENTITY f 'some internal data'> \
-<!ENTITY e '&f;&f;'> \
-<!ENTITY d '&e;&e;'> \
-]> \
-<foo>";
-
-static const char *segment = "  <bar>&e; &f; &d;</bar>\n";
-static const char *finish = "</foo>";
-
+static const xmlHugeDocParts *hugeDocParts;
 static int curseg = 0;
 static const char *current;
 static int rlen;
@@ -177,14 +217,22 @@ static int rlen;
  * hugeMatch:
  * @URI: an URI to test
  *
- * Check for an huge: query
+ * Check for a huge query
  *
  * Returns 1 if yes and 0 if another Input module should be used
  */
 static int
 hugeMatch(const char * URI) {
-    if ((URI != NULL) && (!strncmp(URI, "huge:", 4)))
-        return(1);
+    int i;
+
+    if (URI == NULL)
+        return(0);
+
+    for (i = 0; hugeDocTable[i].URL; i++) {
+        if (strcmp(URI, hugeDocTable[i].URL) == 0)
+            return(1);
+    }
+
     return(0);
 }
 
@@ -192,25 +240,36 @@ hugeMatch(const char * URI) {
  * hugeOpen:
  * @URI: an URI to test
  *
- * Return a pointer to the huge: query handler, in this example simply
+ * Return a pointer to the huge query handler, in this example simply
  * the current pointer...
  *
  * Returns an Input context or NULL in case or error
  */
 static void *
 hugeOpen(const char * URI) {
-    if ((URI == NULL) || (strncmp(URI, "huge:", 4)))
+    int i;
+
+    if (URI == NULL)
         return(NULL);
-    rlen = strlen(start);
-    current = start;
-    return((void *) current);
+
+    for (i = 0; hugeDocTable[i].URL; i++) {
+        if (strcmp(URI, hugeDocTable[i].URL) == 0) {
+            hugeDocParts = hugeDocTable + i;
+            curseg = 0;
+            current = hugeDocParts->start;
+            rlen = strlen(current);
+            return((void *) current);
+        }
+    }
+
+    return(NULL);
 }
 
 /**
  * hugeClose:
  * @context: the read context
  *
- * Close the huge: query handler
+ * Close the huge query handler
  *
  * Returns 0 or -1 in case of error
  */
@@ -220,7 +279,7 @@ hugeClose(void * context) {
     return(0);
 }
 
-#define MAX_NODES 1000000
+#define MAX_NODES 1000
 
 /**
  * hugeRead:
@@ -228,7 +287,7 @@ hugeClose(void * context) {
  * @buffer: where to store data
  * @len: number of bytes to read
  *
- * Implement an huge: query read.
+ * Implement an huge query read.
  *
  * Returns the number of bytes read or -1 in case of error
  */
@@ -248,15 +307,11 @@ hugeRead(void *context, char *buffer, int len)
        memcpy(buffer, current, len);
         curseg ++;
         if (curseg == MAX_NODES) {
-           fprintf(stderr, "\n");
-            rlen = strlen(finish);
-            current = finish;
+            current = hugeDocParts->finish;
        } else {
-           if (curseg % (MAX_NODES / 10) == 0)
-               fprintf(stderr, ".");
-            rlen = strlen(segment);
-            current = segment;
+            current = hugeDocParts->segment;
        }
+        rlen = strlen(current);
     } else {
        memcpy(buffer, current, len);
        rlen -= len;
@@ -310,7 +365,7 @@ testExternalEntityLoader(const char *URL, const char *ID,
 static char testErrors[32769];
 static int testErrorsSize = 0;
 
-static void XMLCDECL
+static void
 channel(void *ctx  ATTRIBUTE_UNUSED, const char *msg, ...) {
     va_list args;
     int res;
@@ -589,6 +644,17 @@ initializeLibxml2(void) {
     }
 }
 
+static void
+initSAX(xmlParserCtxtPtr ctxt) {
+    ctxt->sax->startElementNs = NULL;
+    ctxt->sax->endElementNs = NULL;
+    ctxt->sax->characters = NULL;
+    ctxt->sax->cdataBlock = NULL;
+    ctxt->sax->ignorableWhitespace = NULL;
+    ctxt->sax->processingInstruction = NULL;
+    ctxt->sax->comment = NULL;
+}
+
 /************************************************************************
  *                                                                     *
  *             File name and path utilities                            *
@@ -676,19 +742,28 @@ static int
 recursiveDetectTest(const char *filename,
              const char *result ATTRIBUTE_UNUSED,
              const char *err ATTRIBUTE_UNUSED,
-            int options ATTRIBUTE_UNUSED) {
+            int options) {
     xmlDocPtr doc;
     xmlParserCtxtPtr ctxt;
     int res = 0;
+    /*
+     * XML_PARSE_DTDVALID is the only way to load external entities
+     * without XML_PARSE_NOENT. The validation result doesn't matter
+     * anyway.
+     */
+    int parserOptions = XML_PARSE_DTDVALID;
 
     nb_tests++;
 
     ctxt = xmlNewParserCtxt();
+    if (options & OPT_SAX)
+        initSAX(ctxt);
+    if ((options & OPT_NO_SUBST) == 0)
+        parserOptions |= XML_PARSE_NOENT;
     /*
      * base of the test, parse with the old API
      */
-    doc = xmlCtxtReadFile(ctxt, filename, NULL,
-                          XML_PARSE_NOENT | XML_PARSE_DTDLOAD);
+    doc = xmlCtxtReadFile(ctxt, filename, NULL, parserOptions);
     if ((doc != NULL) || (ctxt->lastError.code != XML_ERR_ENTITY_LOOP)) {
         fprintf(stderr, "Failed to detect recursion in %s\n", filename);
        xmlFreeParserCtxt(ctxt);
@@ -715,19 +790,23 @@ static int
 notRecursiveDetectTest(const char *filename,
              const char *result ATTRIBUTE_UNUSED,
              const char *err ATTRIBUTE_UNUSED,
-            int options ATTRIBUTE_UNUSED) {
+            int options) {
     xmlDocPtr doc;
     xmlParserCtxtPtr ctxt;
     int res = 0;
+    int parserOptions = XML_PARSE_DTDLOAD;
 
     nb_tests++;
 
     ctxt = xmlNewParserCtxt();
+    if (options & OPT_SAX)
+        initSAX(ctxt);
+    if ((options & OPT_NO_SUBST) == 0)
+        parserOptions |= XML_PARSE_NOENT;
     /*
      * base of the test, parse with the old API
      */
-    doc = xmlCtxtReadFile(ctxt, filename, NULL,
-                          XML_PARSE_NOENT | XML_PARSE_DTDLOAD);
+    doc = xmlCtxtReadFile(ctxt, filename, NULL, parserOptions);
     if (doc == NULL) {
         fprintf(stderr, "Failed to parse correct file %s\n", filename);
        xmlFreeParserCtxt(ctxt);
@@ -739,7 +818,6 @@ notRecursiveDetectTest(const char *filename,
     return(res);
 }
 
-#ifdef LIBXML_READER_ENABLED
 /**
  * notRecursiveHugeTest:
  * @filename: the file to parse
@@ -755,32 +833,181 @@ static int
 notRecursiveHugeTest(const char *filename ATTRIBUTE_UNUSED,
              const char *result ATTRIBUTE_UNUSED,
              const char *err ATTRIBUTE_UNUSED,
-            int options ATTRIBUTE_UNUSED) {
-    xmlTextReaderPtr reader;
+            int options) {
+    xmlParserCtxtPtr ctxt;
+    xmlDocPtr doc;
     int res = 0;
-    int ret;
+    int parserOptions = XML_PARSE_DTDVALID;
 
     nb_tests++;
 
-    reader = xmlReaderForFile("huge:test" , NULL,
-                              XML_PARSE_NOENT | XML_PARSE_DTDLOAD);
-    if (reader == NULL) {
-        fprintf(stderr, "Failed to open huge:test\n");
-       return(1);
-    }
-    ret = xmlTextReaderRead(reader);
-    while (ret == 1) {
-        ret = xmlTextReaderRead(reader);
+    ctxt = xmlNewParserCtxt();
+    if (options & OPT_SAX)
+        initSAX(ctxt);
+    if ((options & OPT_NO_SUBST) == 0)
+        parserOptions |= XML_PARSE_NOENT;
+    doc = xmlCtxtReadFile(ctxt, "test/recurse/huge.xml", NULL, parserOptions);
+    if (doc == NULL) {
+        fprintf(stderr, "Failed to parse huge.xml\n");
+       res = 1;
+    } else {
+        xmlEntityPtr ent;
+        unsigned long fixed_cost = 20;
+        unsigned long allowed_expansion = 1000000;
+        unsigned long f_size = xmlStrlen(BAD_CAST "some internal data");
+        unsigned long e_size;
+        unsigned long d_size;
+        unsigned long total_size;
+
+        ent = xmlGetDocEntity(doc, BAD_CAST "e");
+        e_size = f_size * 2 +
+                 xmlStrlen(BAD_CAST "&f;") * 2 +
+                 fixed_cost * 2;
+        if (ent->expandedSize != e_size) {
+            fprintf(stderr, "Wrong size for entity e: %lu (expected %lu)\n",
+                    ent->expandedSize, e_size);
+            res = 1;
+        }
+
+        ent = xmlGetDocEntity(doc, BAD_CAST "b");
+        if (ent->expandedSize != e_size) {
+            fprintf(stderr, "Wrong size for entity b: %lu (expected %lu)\n",
+                    ent->expandedSize, e_size);
+            res = 1;
+        }
+
+        ent = xmlGetDocEntity(doc, BAD_CAST "d");
+        d_size = e_size * 2 +
+                 xmlStrlen(BAD_CAST "&e;") * 2 +
+                 fixed_cost * 2;
+        if (ent->expandedSize != d_size) {
+            fprintf(stderr, "Wrong size for entity d: %lu (expected %lu)\n",
+                    ent->expandedSize, d_size);
+            res = 1;
+        }
+
+        ent = xmlGetDocEntity(doc, BAD_CAST "c");
+        if (ent->expandedSize != d_size) {
+            fprintf(stderr, "Wrong size for entity c: %lu (expected %lu)\n",
+                    ent->expandedSize, d_size);
+            res = 1;
+        }
+
+        if (ctxt->sizeentcopy < allowed_expansion) {
+            fprintf(stderr, "Total entity size too small: %lu\n",
+                    ctxt->sizeentcopy);
+            res = 1;
+        }
+
+        total_size = (f_size + e_size + d_size + 3 * fixed_cost) *
+                     (MAX_NODES - 1) * 3;
+        if (ctxt->sizeentcopy != total_size) {
+            fprintf(stderr, "Wrong total entity size: %lu (expected %lu)\n",
+                    ctxt->sizeentcopy, total_size);
+            res = 1;
+        }
+
+        if (ctxt->sizeentities != 30) {
+            fprintf(stderr, "Wrong parsed entity size: %lu (expected %lu)\n",
+                    ctxt->sizeentities, 30lu);
+            res = 1;
+        }
     }
-    if (ret != 0) {
-        fprintf(stderr, "Failed to parser huge:test with entities\n");
+
+    xmlFreeDoc(doc);
+    xmlFreeParserCtxt(ctxt);
+
+    return(res);
+}
+
+/**
+ * notRecursiveHugeTest:
+ * @filename: the file to parse
+ * @result: the file with expected result
+ * @err: the file with error messages: unused
+ *
+ * Parse a memory generated file
+ * good cases
+ *
+ * Returns 0 in case of success, an error code otherwise
+ */
+static int
+hugeDtdTest(const char *filename ATTRIBUTE_UNUSED,
+            const char *result ATTRIBUTE_UNUSED,
+            const char *err ATTRIBUTE_UNUSED,
+            int options) {
+    xmlParserCtxtPtr ctxt;
+    xmlDocPtr doc;
+    int res = 0;
+    int parserOptions = XML_PARSE_DTDVALID;
+
+    nb_tests++;
+
+    ctxt = xmlNewParserCtxt();
+    if (options & OPT_SAX)
+        initSAX(ctxt);
+    if ((options & OPT_NO_SUBST) == 0)
+        parserOptions |= XML_PARSE_NOENT;
+    doc = xmlCtxtReadFile(ctxt, "test/recurse/huge_dtd.xml", NULL,
+                          parserOptions);
+    if (doc == NULL) {
+        fprintf(stderr, "Failed to parse huge_dtd.xml\n");
        res = 1;
+    } else {
+        unsigned long fixed_cost = 20;
+        unsigned long allowed_expansion = 1000000;
+        unsigned long a_size = xmlStrlen(BAD_CAST "<!-- comment -->");
+        unsigned long b_size;
+        unsigned long c_size;
+        unsigned long e_size;
+        unsigned long f_size;
+        unsigned long total_size;
+
+        if (ctxt->sizeentcopy < allowed_expansion) {
+            fprintf(stderr, "Total entity size too small: %lu\n",
+                    ctxt->sizeentcopy);
+            res = 1;
+        }
+
+        b_size = (a_size + strlen("&a;") + fixed_cost) * 2;
+        c_size = (b_size + strlen("&b;") + fixed_cost) * 2;
+        /*
+         * Internal parameter entites are substitued eagerly and
+         * need different accounting.
+         */
+        e_size = a_size * 2;
+        f_size = e_size * 2;
+        total_size = /* internal */
+                     e_size + f_size + fixed_cost * 4 +
+                     (a_size + e_size + f_size + fixed_cost * 3) *
+                     (MAX_NODES - 1) * 2 +
+                     /* external */
+                     (a_size + b_size + c_size + fixed_cost * 3) *
+                     (MAX_NODES - 1) * 2 +
+                     /* final reference in main doc */
+                     strlen("success") + fixed_cost;
+        if (ctxt->sizeentcopy != total_size) {
+            fprintf(stderr, "Wrong total entity size: %lu (expected %lu)\n",
+                    ctxt->sizeentcopy, total_size);
+            res = 1;
+        }
+
+        total_size = strlen(hugeDocParts->start) +
+                     strlen(hugeDocParts->segment) * (MAX_NODES - 1) +
+                     strlen(hugeDocParts->finish) +
+                     28;
+        if (ctxt->sizeentities != total_size) {
+            fprintf(stderr, "Wrong parsed entity size: %lu (expected %lu)\n",
+                    ctxt->sizeentities, total_size);
+            res = 1;
+        }
     }
-    xmlFreeTextReader(reader);
+
+    xmlFreeDoc(doc);
+    xmlFreeParserCtxt(ctxt);
 
     return(res);
 }
-#endif
 
 /************************************************************************
  *                                                                     *
@@ -793,14 +1020,36 @@ testDesc testDescriptions[] = {
     { "Parsing recursive test cases" ,
       recursiveDetectTest, "./test/recurse/lol*.xml", NULL, NULL, NULL,
       0 },
+    { "Parsing recursive test cases (no substitution)" ,
+      recursiveDetectTest, "./test/recurse/lol*.xml", NULL, NULL, NULL,
+      OPT_NO_SUBST },
+    { "Parsing recursive test cases (SAX)" ,
+      recursiveDetectTest, "./test/recurse/lol*.xml", NULL, NULL, NULL,
+      OPT_SAX },
+    { "Parsing recursive test cases (SAX, no substitution)" ,
+      recursiveDetectTest, "./test/recurse/lol*.xml", NULL, NULL, NULL,
+      OPT_SAX | OPT_NO_SUBST },
     { "Parsing non-recursive test cases" ,
       notRecursiveDetectTest, "./test/recurse/good*.xml", NULL, NULL, NULL,
       0 },
-#ifdef LIBXML_READER_ENABLED
+    { "Parsing non-recursive test cases (SAX)" ,
+      notRecursiveDetectTest, "./test/recurse/good*.xml", NULL, NULL, NULL,
+      OPT_SAX },
     { "Parsing non-recursive huge case" ,
       notRecursiveHugeTest, NULL, NULL, NULL, NULL,
       0 },
-#endif
+    { "Parsing non-recursive huge case (no substitution)" ,
+      notRecursiveHugeTest, NULL, NULL, NULL, NULL,
+      OPT_NO_SUBST },
+    { "Parsing non-recursive huge case (SAX)" ,
+      notRecursiveHugeTest, NULL, NULL, NULL, NULL,
+      OPT_SAX },
+    { "Parsing non-recursive huge case (SAX, no substitution)" ,
+      notRecursiveHugeTest, NULL, NULL, NULL, NULL,
+      OPT_SAX | OPT_NO_SUBST },
+    { "Parsing non-recursive huge DTD case" ,
+      hugeDtdTest, NULL, NULL, NULL, NULL,
+      0 },
     {NULL, NULL, NULL, NULL, NULL, NULL, 0}
 };
 
index f462ebf..60dbce4 100644 (file)
--- a/threads.c
+++ b/threads.c
 #include <libxml/threads.h>
 #include <libxml/globals.h>
 
-#ifdef HAVE_PTHREAD_H
-#include <pthread.h>
-#elif defined HAVE_WIN32_THREADS
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#ifndef HAVE_COMPILER_TLS
-#include <process.h>
-#endif
-#endif
-
-#ifdef HAVE_BEOS_THREADS
-#include <OS.h>
-#include <TLS.h>
-#endif
-
 #if defined(SOLARIS)
 #include <note.h>
 #endif
 
+#include "private/dict.h"
+#include "private/threads.h"
+
 /* #define DEBUG_THREADS */
 
-#ifdef HAVE_PTHREAD_H
+#if defined(HAVE_POSIX_THREADS) && \
+    defined(__GLIBC__) && \
+    __GLIBC__ * 100 + __GLIBC_MINOR__ >= 234
 
-#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 303) && \
-    defined(__GLIBC__) && defined(__linux__)
+/*
+ * The modern way available since glibc 2.32.
+ *
+ * The check above is for glibc 2.34 which merged the pthread symbols into
+ * libc. Since we still allow linking without pthread symbols (see below),
+ * this only works if pthread symbols are guaranteed to be available.
+ */
 
-static int libxml_is_threaded = -1;
+#include <sys/single_threaded.h>
 
-#define XML_PTHREAD_WEAK
+#define XML_IS_THREADED() (!__libc_single_threaded)
+#define XML_IS_NEVER_THREADED() 0
+
+#elif defined(HAVE_POSIX_THREADS) && \
+      defined(__GLIBC__) && \
+      defined(__GNUC__)
+
+/*
+ * The traditional way to check for single-threaded applications with
+ * glibc was to check whether the separate libpthread library is
+ * linked in. This works by not linking libxml2 with libpthread (see
+ * BASE_THREAD_LIBS in configure.ac and Makefile.am) and declaring
+ * pthread functions as weak symbols.
+ *
+ * In glibc 2.34, the pthread symbols were moved from libpthread to libc,
+ * so this doesn't work anymore.
+ *
+ * At some point, this legacy code and the BASE_THREAD_LIBS hack in
+ * configure.ac can probably be removed.
+ */
 
-#pragma weak pthread_once
 #pragma weak pthread_getspecific
 #pragma weak pthread_setspecific
 #pragma weak pthread_key_create
@@ -64,13 +77,18 @@ static int libxml_is_threaded = -1;
 #pragma weak pthread_key_delete
 #pragma weak pthread_cond_signal
 
-#else /* __GNUC__, __GLIBC__, __linux__ */
+#define XML_PTHREAD_WEAK
+#define XML_IS_THREADED() libxml_is_threaded
+#define XML_IS_NEVER_THREADED() (!libxml_is_threaded)
 
-static int libxml_is_threaded = 1;
+static int libxml_is_threaded = -1;
 
-#endif /* __GNUC__, __GLIBC__, __linux__ */
+#else /* other POSIX platforms */
 
-#endif /* HAVE_PTHREAD_H */
+#define XML_IS_THREADED() 1
+#define XML_IS_NEVER_THREADED() 0
+
+#endif
 
 /*
  * TODO: this module still uses malloc/free and not xmlMalloc/xmlFree
@@ -79,26 +97,10 @@ static int libxml_is_threaded = 1;
  */
 
 /*
- * xmlMutex are a simple mutual exception locks
- */
-struct _xmlMutex {
-#ifdef HAVE_PTHREAD_H
-    pthread_mutex_t lock;
-#elif defined HAVE_WIN32_THREADS
-    CRITICAL_SECTION cs;
-#elif defined HAVE_BEOS_THREADS
-    sem_id sem;
-    thread_id tid;
-#else
-    int empty;
-#endif
-};
-
-/*
  * xmlRMutex are reentrant mutual exception locks
  */
 struct _xmlRMutex {
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
     pthread_mutex_t lock;
     unsigned int held;
     unsigned int waiters;
@@ -106,10 +108,6 @@ struct _xmlRMutex {
     pthread_cond_t cv;
 #elif defined HAVE_WIN32_THREADS
     CRITICAL_SECTION cs;
-#elif defined HAVE_BEOS_THREADS
-    xmlMutexPtr lock;
-    thread_id tid;
-    int32 count;
 #else
     int empty;
 #endif
@@ -121,11 +119,9 @@ struct _xmlRMutex {
  *   - globalkey used for per-thread data
  */
 
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
 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)
@@ -135,26 +131,29 @@ static __declspec(thread) int tlstate_inited = 0;
 static DWORD globalkey = TLS_OUT_OF_INDEXES;
 #endif /* HAVE_COMPILER_TLS */
 static DWORD mainthread;
-static struct {
-    DWORD done;
-    LONG control;
-} run_once = { 0, 0};
 static volatile LPCRITICAL_SECTION global_init_lock = NULL;
-
-/* endif HAVE_WIN32_THREADS */
-#elif defined HAVE_BEOS_THREADS
-int32 globalkey = 0;
-thread_id mainthread = 0;
-int32 run_once_init = 0;
-static int32 global_init_lock = -1;
-static vint32 global_init_count = 0;
 #endif
 
 static xmlRMutexPtr xmlLibraryLock = NULL;
 
-#ifdef LIBXML_THREAD_ENABLED
-static void xmlOnceInit(void);
+/**
+ * xmlInitMutex:
+ * @mutex:  the mutex
+ *
+ * Initialize a mutex.
+ */
+void
+xmlInitMutex(xmlMutexPtr mutex)
+{
+#ifdef HAVE_POSIX_THREADS
+    if (XML_IS_NEVER_THREADED() == 0)
+        pthread_mutex_init(&mutex->lock, NULL);
+#elif defined HAVE_WIN32_THREADS
+    InitializeCriticalSection(&mutex->cs);
+#else
+    (void) mutex;
 #endif
+}
 
 /**
  * xmlNewMutex:
@@ -171,27 +170,34 @@ xmlNewMutex(void)
 
     if ((tok = malloc(sizeof(xmlMutex))) == NULL)
         return (NULL);
-#ifdef HAVE_PTHREAD_H
-    if (libxml_is_threaded != 0)
-        pthread_mutex_init(&tok->lock, NULL);
+    xmlInitMutex(tok);
+    return (tok);
+}
+
+/**
+ * xmlCleanupMutex:
+ * @mutex:  the simple mutex
+ *
+ * Reclaim resources associated with a mutex.
+ */
+void
+xmlCleanupMutex(xmlMutexPtr mutex)
+{
+#ifdef HAVE_POSIX_THREADS
+    if (XML_IS_NEVER_THREADED() == 0)
+        pthread_mutex_destroy(&mutex->lock);
 #elif defined HAVE_WIN32_THREADS
-    InitializeCriticalSection(&tok->cs);
-#elif defined HAVE_BEOS_THREADS
-    if ((tok->sem = create_sem(1, "xmlMutex")) < B_OK) {
-        free(tok);
-        return NULL;
-    }
-    tok->tid = -1;
+    DeleteCriticalSection(&mutex->cs);
+#else
+    (void) mutex;
 #endif
-    return (tok);
 }
 
 /**
  * xmlFreeMutex:
  * @tok:  the simple mutex
  *
- * xmlFreeMutex() is used to reclaim resources associated with a libxml2 token
- * struct.
+ * Free a mutex.
  */
 void
 xmlFreeMutex(xmlMutexPtr tok)
@@ -199,14 +205,7 @@ xmlFreeMutex(xmlMutexPtr tok)
     if (tok == NULL)
         return;
 
-#ifdef HAVE_PTHREAD_H
-    if (libxml_is_threaded != 0)
-        pthread_mutex_destroy(&tok->lock);
-#elif defined HAVE_WIN32_THREADS
-    DeleteCriticalSection(&tok->cs);
-#elif defined HAVE_BEOS_THREADS
-    delete_sem(tok->sem);
-#endif
+    xmlCleanupMutex(tok);
     free(tok);
 }
 
@@ -221,19 +220,15 @@ xmlMutexLock(xmlMutexPtr tok)
 {
     if (tok == NULL)
         return;
-#ifdef HAVE_PTHREAD_H
-    if (libxml_is_threaded != 0)
+#ifdef HAVE_POSIX_THREADS
+    /*
+     * This assumes that __libc_single_threaded won't change while the
+     * lock is held.
+     */
+    if (XML_IS_THREADED() != 0)
         pthread_mutex_lock(&tok->lock);
 #elif defined HAVE_WIN32_THREADS
     EnterCriticalSection(&tok->cs);
-#elif defined HAVE_BEOS_THREADS
-    if (acquire_sem(tok->sem) != B_NO_ERROR) {
-#ifdef DEBUG_THREADS
-        xmlGenericError(xmlGenericErrorContext,
-                        "xmlMutexLock():BeOS:Couldn't acquire semaphore\n");
-#endif
-    }
-    tok->tid = find_thread(NULL);
 #endif
 
 }
@@ -249,16 +244,11 @@ xmlMutexUnlock(xmlMutexPtr tok)
 {
     if (tok == NULL)
         return;
-#ifdef HAVE_PTHREAD_H
-    if (libxml_is_threaded != 0)
+#ifdef HAVE_POSIX_THREADS
+    if (XML_IS_THREADED() != 0)
         pthread_mutex_unlock(&tok->lock);
 #elif defined HAVE_WIN32_THREADS
     LeaveCriticalSection(&tok->cs);
-#elif defined HAVE_BEOS_THREADS
-    if (tok->tid == find_thread(NULL)) {
-        tok->tid = -1;
-        release_sem(tok->sem);
-    }
 #endif
 }
 
@@ -279,8 +269,8 @@ xmlNewRMutex(void)
 
     if ((tok = malloc(sizeof(xmlRMutex))) == NULL)
         return (NULL);
-#ifdef HAVE_PTHREAD_H
-    if (libxml_is_threaded != 0) {
+#ifdef HAVE_POSIX_THREADS
+    if (XML_IS_NEVER_THREADED() == 0) {
         pthread_mutex_init(&tok->lock, NULL);
         tok->held = 0;
         tok->waiters = 0;
@@ -288,12 +278,6 @@ xmlNewRMutex(void)
     }
 #elif defined HAVE_WIN32_THREADS
     InitializeCriticalSection(&tok->cs);
-#elif defined HAVE_BEOS_THREADS
-    if ((tok->lock = xmlNewMutex()) == NULL) {
-        free(tok);
-        return NULL;
-    }
-    tok->count = 0;
 #endif
     return (tok);
 }
@@ -310,15 +294,13 @@ xmlFreeRMutex(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
 {
     if (tok == NULL)
         return;
-#ifdef HAVE_PTHREAD_H
-    if (libxml_is_threaded != 0) {
+#ifdef HAVE_POSIX_THREADS
+    if (XML_IS_NEVER_THREADED() == 0) {
         pthread_mutex_destroy(&tok->lock);
         pthread_cond_destroy(&tok->cv);
     }
 #elif defined HAVE_WIN32_THREADS
     DeleteCriticalSection(&tok->cs);
-#elif defined HAVE_BEOS_THREADS
-    xmlFreeMutex(tok->lock);
 #endif
     free(tok);
 }
@@ -334,8 +316,8 @@ xmlRMutexLock(xmlRMutexPtr tok)
 {
     if (tok == NULL)
         return;
-#ifdef HAVE_PTHREAD_H
-    if (libxml_is_threaded == 0)
+#ifdef HAVE_POSIX_THREADS
+    if (XML_IS_THREADED() == 0)
         return;
 
     pthread_mutex_lock(&tok->lock);
@@ -356,14 +338,6 @@ xmlRMutexLock(xmlRMutexPtr tok)
     pthread_mutex_unlock(&tok->lock);
 #elif defined HAVE_WIN32_THREADS
     EnterCriticalSection(&tok->cs);
-#elif defined HAVE_BEOS_THREADS
-    if (tok->lock->tid == find_thread(NULL)) {
-        tok->count++;
-        return;
-    } else {
-        xmlMutexLock(tok->lock);
-        tok->count = 1;
-    }
 #endif
 }
 
@@ -378,8 +352,8 @@ xmlRMutexUnlock(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
 {
     if (tok == NULL)
         return;
-#ifdef HAVE_PTHREAD_H
-    if (libxml_is_threaded == 0)
+#ifdef HAVE_POSIX_THREADS
+    if (XML_IS_THREADED() == 0)
         return;
 
     pthread_mutex_lock(&tok->lock);
@@ -392,14 +366,6 @@ xmlRMutexUnlock(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
     pthread_mutex_unlock(&tok->lock);
 #elif defined HAVE_WIN32_THREADS
     LeaveCriticalSection(&tok->cs);
-#elif defined HAVE_BEOS_THREADS
-    if (tok->lock->tid == find_thread(NULL)) {
-        tok->count--;
-        if (tok->count == 0) {
-            xmlMutexUnlock(tok->lock);
-        }
-        return;
-    }
 #endif
 }
 
@@ -413,12 +379,15 @@ void
 __xmlGlobalInitMutexLock(void)
 {
     /* Make sure the global init lock is initialized and then lock it. */
-#ifdef HAVE_PTHREAD_H
-    /* The mutex is statically initialized, so we just lock it. */
+#ifdef HAVE_POSIX_THREADS
 #ifdef XML_PTHREAD_WEAK
     if (pthread_mutex_lock == NULL)
         return;
-#endif /* XML_PTHREAD_WEAK */
+#else
+    if (XML_IS_THREADED() == 0)
+        return;
+#endif
+    /* The mutex is statically initialized, so we just lock it. */
     pthread_mutex_lock(&global_init_lock);
 #elif defined HAVE_WIN32_THREADS
     LPCRITICAL_SECTION cs;
@@ -453,52 +422,25 @@ __xmlGlobalInitMutexLock(void)
 
     /* Lock the chosen critical section */
     EnterCriticalSection(global_init_lock);
-#elif defined HAVE_BEOS_THREADS
-    int32 sem;
-
-    /* Allocate a new semaphore */
-    sem = create_sem(1, "xmlGlobalinitMutex");
-
-    while (global_init_lock == -1) {
-        if (atomic_add(&global_init_count, 1) == 0) {
-            global_init_lock = sem;
-        } else {
-            snooze(1);
-            atomic_add(&global_init_count, -1);
-        }
-    }
-
-    /* If another thread successfully recorded its critical
-     * section in the global_init_lock then discard the one
-     * allocated by this thread. */
-    if (global_init_lock != sem)
-        delete_sem(sem);
-
-    /* Acquire the chosen semaphore */
-    if (acquire_sem(global_init_lock) != B_NO_ERROR) {
-#ifdef DEBUG_THREADS
-        xmlGenericError(xmlGenericErrorContext,
-                        "xmlGlobalInitMutexLock():BeOS:Couldn't acquire semaphore\n");
-#endif
-    }
 #endif
 }
 
 void
 __xmlGlobalInitMutexUnlock(void)
 {
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
 #ifdef XML_PTHREAD_WEAK
-    if (pthread_mutex_unlock == NULL)
+    if (pthread_mutex_lock == NULL)
         return;
-#endif /* XML_PTHREAD_WEAK */
+#else
+    if (XML_IS_THREADED() == 0)
+        return;
+#endif
     pthread_mutex_unlock(&global_init_lock);
 #elif defined HAVE_WIN32_THREADS
     if (global_init_lock != NULL) {
        LeaveCriticalSection(global_init_lock);
     }
-#elif defined HAVE_BEOS_THREADS
-    release_sem(global_init_lock);
 #endif
 }
 
@@ -511,7 +453,7 @@ __xmlGlobalInitMutexUnlock(void)
 void
 __xmlGlobalInitMutexDestroy(void)
 {
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
 #elif defined HAVE_WIN32_THREADS
     if (global_init_lock != NULL) {
         DeleteCriticalSection(global_init_lock);
@@ -576,7 +518,7 @@ xmlNewGlobalState(void)
 }
 #endif /* LIBXML_THREAD_ENABLED */
 
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
 #elif defined HAVE_WIN32_THREADS
 #if !defined(HAVE_COMPILER_TLS)
 #if defined(LIBXML_STATIC) && !defined(LIBXML_STATIC_FOR_DLL)
@@ -585,7 +527,7 @@ typedef struct _xmlGlobalStateCleanupHelperParams {
     void *memory;
 } xmlGlobalStateCleanupHelperParams;
 
-static void XMLCDECL
+static void
 xmlGlobalStateCleanupHelper(void *p)
 {
     xmlGlobalStateCleanupHelperParams *params =
@@ -611,27 +553,11 @@ static CRITICAL_SECTION cleanup_helpers_cs;
 #endif /* HAVE_COMPILER_TLS */
 #endif /* HAVE_WIN32_THREADS */
 
-#if defined HAVE_BEOS_THREADS
-
-/**
- * xmlGlobalStateCleanup:
- * @data: unused parameter
- *
- * Used for Beos only
- */
-void
-xmlGlobalStateCleanup(void *data)
-{
-    void *globalval = tls_get(globalkey);
-
-    if (globalval != NULL)
-        xmlFreeGlobalState(globalval);
-}
-#endif
-
 /**
  * xmlGetGlobalState:
  *
+ * DEPRECATED: Internal function, do not use.
+ *
  * xmlGetGlobalState() is called to retrieve the global state for a thread.
  *
  * Returns the thread global state or NULL in case of error
@@ -639,14 +565,12 @@ xmlGlobalStateCleanup(void *data)
 xmlGlobalStatePtr
 xmlGetGlobalState(void)
 {
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
     xmlGlobalState *globalval;
 
-    if (libxml_is_threaded == 0)
+    if (XML_IS_THREADED() == 0)
         return (NULL);
 
-    pthread_once(&once_control, xmlOnceInit);
-
     if ((globalval = (xmlGlobalState *)
          pthread_getspecific(globalkey)) == NULL) {
         xmlGlobalState *tsd = xmlNewGlobalState();
@@ -667,8 +591,6 @@ xmlGetGlobalState(void)
 #else /* HAVE_COMPILER_TLS */
     xmlGlobalState *globalval;
     xmlGlobalStateCleanupHelperParams *p;
-
-    xmlOnceInit();
 #if defined(LIBXML_STATIC) && !defined(LIBXML_STATIC_FOR_DLL)
     globalval = (xmlGlobalState *) TlsGetValue(globalkey);
 #else
@@ -711,21 +633,6 @@ xmlGetGlobalState(void)
     }
     return (globalval);
 #endif /* HAVE_COMPILER_TLS */
-#elif defined HAVE_BEOS_THREADS
-    xmlGlobalState *globalval;
-
-    xmlOnceInit();
-
-    if ((globalval = (xmlGlobalState *) tls_get(globalkey)) == NULL) {
-        xmlGlobalState *tsd = xmlNewGlobalState();
-       if (tsd == NULL)
-           return (NULL);
-
-        tls_set(globalkey, tsd);
-        on_exit_thread(xmlGlobalStateCleanup, NULL);
-        return (tsd);
-    }
-    return (globalval);
 #else
     return (NULL);
 #endif
@@ -740,6 +647,8 @@ xmlGetGlobalState(void)
 /**
  * xmlGetThreadId:
  *
+ * DEPRECATED: Internal function, do not use.
+ *
  * xmlGetThreadId() find the current thread ID number
  * Note that this is likely to be broken on some platforms using pthreads
  * as the specification doesn't mandate pthread_t to be an integer type
@@ -749,11 +658,11 @@ xmlGetGlobalState(void)
 int
 xmlGetThreadId(void)
 {
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
     pthread_t id;
     int ret;
 
-    if (libxml_is_threaded == 0)
+    if (XML_IS_THREADED() == 0)
         return (0);
     id = pthread_self();
     /* horrible but preserves compat, see warning above */
@@ -761,8 +670,6 @@ xmlGetThreadId(void)
     return (ret);
 #elif defined HAVE_WIN32_THREADS
     return GetCurrentThreadId();
-#elif defined HAVE_BEOS_THREADS
-    return find_thread(NULL);
 #else
     return ((int) 0);
 #endif
@@ -771,6 +678,8 @@ xmlGetThreadId(void)
 /**
  * xmlIsMainThread:
  *
+ * DEPRECATED: Internal function, do not use.
+ *
  * xmlIsMainThread() check whether the current thread is the main thread.
  *
  * Returns 1 if the current thread is the main thread, 0 otherwise
@@ -778,27 +687,17 @@ xmlGetThreadId(void)
 int
 xmlIsMainThread(void)
 {
-#ifdef HAVE_PTHREAD_H
-    if (libxml_is_threaded == -1)
-        xmlInitThreads();
-    if (libxml_is_threaded == 0)
-        return (1);
-    pthread_once(&once_control, xmlOnceInit);
-#elif defined HAVE_WIN32_THREADS
-    xmlOnceInit();
-#elif defined HAVE_BEOS_THREADS
-    xmlOnceInit();
-#endif
+    xmlInitParser();
 
 #ifdef DEBUG_THREADS
     xmlGenericError(xmlGenericErrorContext, "xmlIsMainThread()\n");
 #endif
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
+    if (XML_IS_THREADED() == 0)
+        return (1);
     return (pthread_equal(mainthread,pthread_self()));
 #elif defined HAVE_WIN32_THREADS
     return (mainthread == GetCurrentThreadId());
-#elif defined HAVE_BEOS_THREADS
-    return (mainthread == find_thread(NULL));
 #else
     return (1);
 #endif
@@ -837,19 +736,31 @@ xmlUnlockLibrary(void)
 /**
  * xmlInitThreads:
  *
- * DEPRECATED: This function will be made private. Call xmlInitParser to
- * initialize the library.
- *
- * xmlInitThreads() is used to to initialize all the thread related
- * data of the libxml2 library.
+ * DEPRECATED: Alias for xmlInitParser.
  */
 void
 xmlInitThreads(void)
 {
-#ifdef HAVE_PTHREAD_H
+    xmlInitParser();
+}
+
+/**
+ * xmlInitThreadsInternal:
+ *
+ * Used to to initialize all the thread related data.
+ */
+void
+xmlInitThreadsInternal(void)
+{
+#ifdef HAVE_POSIX_THREADS
 #ifdef XML_PTHREAD_WEAK
-    if (libxml_is_threaded == -1) {
-        if ((pthread_once != NULL) &&
+    /*
+     * This is somewhat unreliable since libpthread could be loaded
+     * later with dlopen() and threads could be created. But it's
+     * long-standing behavior and hard to work around.
+     */
+    if (libxml_is_threaded == -1)
+        libxml_is_threaded =
             (pthread_getspecific != NULL) &&
             (pthread_setspecific != NULL) &&
             (pthread_key_create != NULL) &&
@@ -861,51 +772,56 @@ xmlInitThreads(void)
             (pthread_cond_init != NULL) &&
             (pthread_cond_destroy != NULL) &&
             (pthread_cond_wait != NULL) &&
-            (pthread_equal != NULL) &&
+            /*
+             * pthread_equal can be inline, resuting in -Waddress warnings.
+             * Let's assume it's available if all the other functions are.
+             */
+            /* (pthread_equal != NULL) && */
             (pthread_self != NULL) &&
-            (pthread_cond_signal != NULL)) {
-            libxml_is_threaded = 1;
-
-/* fprintf(stderr, "Running multithreaded\n"); */
-        } else {
-
-/* fprintf(stderr, "Running without multithread\n"); */
-            libxml_is_threaded = 0;
-        }
-    }
+            (pthread_cond_signal != NULL);
+    if (libxml_is_threaded == 0)
+        return;
 #endif /* XML_PTHREAD_WEAK */
+    pthread_key_create(&globalkey, xmlFreeGlobalState);
+    mainthread = pthread_self();
+#elif defined(HAVE_WIN32_THREADS)
+#if !defined(HAVE_COMPILER_TLS)
+#if !defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)
+    InitializeCriticalSection(&cleanup_helpers_cs);
+#endif
+    globalkey = TlsAlloc();
+#endif
+    mainthread = GetCurrentThreadId();
 #endif
 }
 
 /**
  * xmlCleanupThreads:
  *
- * DEPRECATED: This function will be made private. Call xmlCleanupParser
+ * DEPRECATED: This function is a no-op. Call xmlCleanupParser
  * to free global state but see the warnings there. xmlCleanupParser
  * should be only called once at program exit. In most cases, you don't
  * have call cleanup functions at all.
- *
- * xmlCleanupThreads() is used to to cleanup all the thread related
- * data of the libxml2 library once processing has ended.
- *
- * WARNING: if your application is multithreaded or has plugin support
- *          calling this may crash the application if another thread or
- *          a plugin is still using libxml2. It's sometimes very hard to
- *          guess if libxml2 is in use in the application, some libraries
- *          or plugins may use it without notice. In case of doubt abstain
- *          from calling this function or do it just before calling exit()
- *          to avoid leak reports from valgrind !
  */
 void
 xmlCleanupThreads(void)
 {
-#ifdef DEBUG_THREADS
-    xmlGenericError(xmlGenericErrorContext, "xmlCleanupThreads()\n");
-#endif
-#ifdef HAVE_PTHREAD_H
-    if (libxml_is_threaded != 0)
-        pthread_key_delete(globalkey);
-    once_control = once_control_init;
+}
+
+/**
+ * xmlCleanupThreadsInternal:
+ *
+ * Used to to cleanup all the thread related data.
+ */
+void
+xmlCleanupThreadsInternal(void)
+{
+#ifdef HAVE_POSIX_THREADS
+#ifdef XML_PTHREAD_WEAK
+    if (libxml_is_threaded == 0)
+        return;
+#endif /* XML_PTHREAD_WEAK */
+    pthread_key_delete(globalkey);
 #elif defined(HAVE_WIN32_THREADS)
 #if !defined(HAVE_COMPILER_TLS)
     if (globalkey != TLS_OUT_OF_INDEXES) {
@@ -931,59 +847,8 @@ xmlCleanupThreads(void)
     DeleteCriticalSection(&cleanup_helpers_cs);
 #endif
 #endif
-    run_once.done = 0;
-    run_once.control = 0;
-#endif
-}
-
-#ifdef LIBXML_THREAD_ENABLED
-
-/**
- * xmlOnceInit
- *
- * xmlOnceInit() is used to initialize the value of mainthread for use
- * in other routines. This function should only be called using
- * pthread_once() in association with the once_control variable to ensure
- * that the function is only called once. See man pthread_once for more
- * details.
- */
-static void
-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) {
-#if !defined(HAVE_COMPILER_TLS)
-#if !defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)
-            InitializeCriticalSection(&cleanup_helpers_cs);
-#endif
-            globalkey = TlsAlloc();
-#endif
-            mainthread = GetCurrentThreadId();
-           __xmlInitializeDict();
-            run_once.done = 1;
-        } else {
-            /* Another thread is working; give up our slice and
-             * wait until they're done. */
-            while (!run_once.done)
-                Sleep(0);
-        }
-    }
-#elif defined HAVE_BEOS_THREADS
-    if (atomic_add(&run_once_init, 1) == 0) {
-        globalkey = tls_allocate();
-        tls_set(globalkey, NULL);
-        mainthread = find_thread(NULL);
-       __xmlInitializeDict();
-    } else
-        atomic_add(&run_once_init, -1);
 #endif
 }
-#endif
 
 /**
  * DllMain:
@@ -996,10 +861,10 @@ xmlOnceInit(void)
  *
  * Returns TRUE always
  */
-#ifdef HAVE_PTHREAD_H
+#ifdef HAVE_POSIX_THREADS
 #elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
 #if defined(LIBXML_STATIC_FOR_DLL)
-int XMLCALL
+int
 xmlDllMain(ATTRIBUTE_UNUSED void *hinstDLL, unsigned long fdwReason,
            ATTRIBUTE_UNUSED void *lpvReserved)
 #else
diff --git a/tree.c b/tree.c
index 4c9f00d..eae778d 100644 (file)
--- a/tree.c
+++ b/tree.c
 #include <libxml/debugXML.h>
 #endif
 
-#include "buf.h"
-#include "save.h"
+#include "private/buf.h"
+#include "private/entities.h"
+#include "private/error.h"
+#include "private/tree.h"
 
 int __xmlRegisterCallbacks = 0;
 
@@ -1214,11 +1216,6 @@ xmlFreeDoc(xmlDocPtr cur) {
 #endif
        return;
     }
-#ifdef LIBXML_DEBUG_RUNTIME
-#ifdef LIBXML_DEBUG_ENABLED
-    xmlDebugCheckDocument(stderr, cur);
-#endif
-#endif
 
     if (cur != NULL) dict = cur->dict;
 
@@ -1414,14 +1411,21 @@ xmlStringLenGetNodeList(const xmlDoc *doc, const xmlChar *value, int len) {
                            if (val != NULL) xmlFree(val);
                            goto out;
                        }
-                       else if ((ent != NULL) && (ent->children == NULL)) {
+                       else if ((ent != NULL) &&
+                                 ((ent->flags & XML_ENT_PARSED) == 0) &&
+                                 ((ent->flags & XML_ENT_EXPANDING) == 0)) {
                            xmlNodePtr temp;
 
-                            /* Set to non-NULL value to avoid recursion. */
-                           ent->children = (xmlNodePtr) -1;
+                            /*
+                             * The entity should have been checked already,
+                             * but set the flag anyway to avoid recursion.
+                             */
+                           ent->flags |= XML_ENT_EXPANDING;
                            ent->children = xmlStringGetNodeList(doc,
                                    (const xmlChar*)node->content);
                            ent->owner = 1;
+                           ent->flags &= ~XML_ENT_EXPANDING;
+                            ent->flags |= XML_ENT_PARSED;
                            temp = ent->children;
                            while (temp) {
                                temp->parent = (xmlNodePtr)ent;
@@ -1493,9 +1497,9 @@ out:
  */
 xmlNodePtr
 xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) {
-    xmlNodePtr ret = NULL, last = NULL;
+    xmlNodePtr ret = NULL, head = NULL, last = NULL;
     xmlNodePtr node;
-    xmlChar *val;
+    xmlChar *val = NULL;
     const xmlChar *cur = value;
     const xmlChar *q;
     xmlEntityPtr ent;
@@ -1593,14 +1597,12 @@ xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) {
                         */
                        if (!xmlBufIsEmpty(buf)) {
                            node = xmlNewDocText(doc, NULL);
-                           if (node == NULL) {
-                               if (val != NULL) xmlFree(val);
-                               goto out;
-                           }
+                            if (node == NULL)
+                                goto out;
                            node->content = xmlBufDetach(buf);
 
                            if (last == NULL) {
-                               last = ret = node;
+                               last = head = node;
                            } else {
                                last = xmlAddNextSibling(last, node);
                            }
@@ -1610,18 +1612,23 @@ xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) {
                         * Create a new REFERENCE_REF node
                         */
                        node = xmlNewReference(doc, val);
-                       if (node == NULL) {
-                           if (val != NULL) xmlFree(val);
+                       if (node == NULL)
                            goto out;
-                       }
-                       else if ((ent != NULL) && (ent->children == NULL)) {
+                       if ((ent != NULL) &&
+                            ((ent->flags & XML_ENT_PARSED) == 0) &&
+                            ((ent->flags & XML_ENT_EXPANDING) == 0)) {
                            xmlNodePtr temp;
 
-                            /* Set to non-NULL value to avoid recursion. */
-                           ent->children = (xmlNodePtr) -1;
+                            /*
+                             * The entity should have been checked already,
+                             * but set the flag anyway to avoid recursion.
+                             */
+                           ent->flags |= XML_ENT_EXPANDING;
                            ent->children = xmlStringGetNodeList(doc,
                                    (const xmlChar*)node->content);
                            ent->owner = 1;
+                           ent->flags &= ~XML_ENT_EXPANDING;
+                            ent->flags |= XML_ENT_PARSED;
                            temp = ent->children;
                            while (temp) {
                                temp->parent = (xmlNodePtr)ent;
@@ -1630,12 +1637,13 @@ xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) {
                            }
                        }
                        if (last == NULL) {
-                           last = ret = node;
+                           last = head = node;
                        } else {
                            last = xmlAddNextSibling(last, node);
                        }
                    }
                    xmlFree(val);
+                    val = NULL;
                }
                cur++;
                q = cur;
@@ -1654,7 +1662,7 @@ xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) {
        } else
            cur++;
     }
-    if ((cur != q) || (ret == NULL)) {
+    if ((cur != q) || (head == NULL)) {
         /*
         * Handle the last piece of text.
         */
@@ -1663,21 +1671,24 @@ xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) {
 
     if (!xmlBufIsEmpty(buf)) {
        node = xmlNewDocText(doc, NULL);
-        if (node == NULL) {
-            xmlBufFree(buf);
-            return(NULL);
-        }
+        if (node == NULL)
+            goto out;
        node->content = xmlBufDetach(buf);
 
        if (last == NULL) {
-           ret = node;
+           head = node;
        } else {
            xmlAddNextSibling(last, node);
        }
     }
 
+    ret = head;
+    head = NULL;
+
 out:
     xmlBufFree(buf);
+    if (val != NULL) xmlFree(val);
+    if (head != NULL) xmlFreeNodeList(head);
     return(ret);
 }
 
@@ -1863,7 +1874,7 @@ xmlNewPropInternal(xmlNodePtr node, xmlNsPtr ns,
 
     if ((node != NULL) && (node->type != XML_ELEMENT_NODE)) {
         if ((eatname == 1) &&
-           ((node->doc == NULL) ||
+           ((node->doc == NULL) || (node->doc->dict == NULL) ||
             (!(xmlDictOwns(node->doc->dict, name)))))
             xmlFree((xmlChar *) name);
         return (NULL);
@@ -1876,6 +1887,7 @@ xmlNewPropInternal(xmlNodePtr node, xmlNsPtr ns,
     if (cur == NULL) {
         if ((eatname == 1) &&
            ((node == NULL) || (node->doc == NULL) ||
+             (node->doc->dict == NULL) ||
             (!(xmlDictOwns(node->doc->dict, name)))))
             xmlFree((xmlChar *) name);
         xmlTreeErrMemory("building attribute");
@@ -2386,8 +2398,9 @@ xmlNewDocNodeEatName(xmlDocPtr doc, xmlNsPtr ns,
        }
     } else {
         /* if name don't come from the doc dictionary free it here */
-        if ((name != NULL) && (doc != NULL) &&
-           (!(xmlDictOwns(doc->dict, name))))
+        if ((name != NULL) &&
+            ((doc == NULL) || (doc->dict == NULL) ||
+            (!(xmlDictOwns(doc->dict, name)))))
            xmlFree(name);
     }
     return(cur);
@@ -4077,6 +4090,10 @@ xmlCopyNamespaceList(xmlNsPtr cur) {
 
     while (cur != NULL) {
         q = xmlCopyNamespace(cur);
+        if (q == NULL) {
+            xmlFreeNsList(ret);
+            return(NULL);
+        }
        if (p == NULL) {
            ret = p = q;
        } else {
@@ -4088,9 +4105,6 @@ xmlCopyNamespaceList(xmlNsPtr cur) {
     return(ret);
 }
 
-static xmlNodePtr
-xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent);
-
 static xmlAttrPtr
 xmlCopyPropInternal(xmlDocPtr doc, xmlNodePtr target, xmlAttrPtr cur) {
     xmlAttrPtr ret;
@@ -4221,8 +4235,10 @@ xmlCopyPropList(xmlNodePtr target, xmlAttrPtr cur) {
         return(NULL);
     while (cur != NULL) {
         q = xmlCopyProp(target, cur);
-       if (q == NULL)
+       if (q == NULL) {
+            xmlFreePropList(ret);
            return(NULL);
+        }
        if (p == NULL) {
            ret = p = q;
        } else {
@@ -4254,7 +4270,7 @@ xmlCopyPropList(xmlNodePtr target, xmlAttrPtr cur) {
  * namespace info, but don't recurse on children.
  */
 
-static xmlNodePtr
+xmlNodePtr
 xmlStaticCopyNode(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
                   int extended) {
     xmlNodePtr ret;
@@ -4453,7 +4469,7 @@ out:
     return(ret);
 }
 
-static xmlNodePtr
+xmlNodePtr
 xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent) {
     xmlNodePtr ret = NULL;
     xmlNodePtr p = NULL,q;
@@ -4467,7 +4483,7 @@ xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent) {
            }
            if (doc->intSubset == NULL) {
                q = (xmlNodePtr) xmlCopyDtd( (xmlDtdPtr) node );
-               if (q == NULL) return(NULL);
+               if (q == NULL) goto error;
                q->doc = doc;
                q->parent = parent;
                doc->intSubset = (xmlDtdPtr) q;
@@ -4479,7 +4495,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 (q == NULL) goto error;
        if (ret == NULL) {
            q->prev = NULL;
            ret = p = q;
@@ -4492,6 +4508,9 @@ xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent) {
        node = node->next;
     }
     return(ret);
+error:
+    xmlFreeNodeList(ret);
+    return(NULL);
 }
 
 /**
@@ -4808,12 +4827,12 @@ xmlGetNodePath(const xmlNode *node)
         return (NULL);
 
     buf_len = 500;
-    buffer = (xmlChar *) xmlMallocAtomic(buf_len * sizeof(xmlChar));
+    buffer = (xmlChar *) xmlMallocAtomic(buf_len);
     if (buffer == NULL) {
        xmlTreeErrMemory("getting node path");
         return (NULL);
     }
-    buf = (xmlChar *) xmlMallocAtomic(buf_len * sizeof(xmlChar));
+    buf = (xmlChar *) xmlMallocAtomic(buf_len);
     if (buf == NULL) {
        xmlTreeErrMemory("getting node path");
         xmlFree(buffer);
@@ -6019,7 +6038,7 @@ xmlGetNsList(const xmlDoc *doc ATTRIBUTE_UNUSED, const xmlNode *node)
     xmlNsPtr cur;
     xmlNsPtr *ret = NULL;
     int nbns = 0;
-    int maxns = 10;
+    int maxns = 0;
     int i;
 
     if ((node == NULL) || (node->type == XML_NAMESPACE_DECL))
@@ -6029,16 +6048,6 @@ xmlGetNsList(const xmlDoc *doc ATTRIBUTE_UNUSED, const xmlNode *node)
         if (node->type == XML_ELEMENT_NODE) {
             cur = node->nsDef;
             while (cur != NULL) {
-                if (ret == NULL) {
-                    ret =
-                        (xmlNsPtr *) xmlMalloc((maxns + 1) *
-                                               sizeof(xmlNsPtr));
-                    if (ret == NULL) {
-                       xmlTreeErrMemory("getting namespace list");
-                        return (NULL);
-                    }
-                    ret[nbns] = NULL;
-                }
                 for (i = 0; i < nbns; i++) {
                     if ((cur->prefix == ret[i]->prefix) ||
                         (xmlStrEqual(cur->prefix, ret[i]->prefix)))
@@ -6046,15 +6055,18 @@ xmlGetNsList(const xmlDoc *doc ATTRIBUTE_UNUSED, const xmlNode *node)
                 }
                 if (i >= nbns) {
                     if (nbns >= maxns) {
-                        maxns *= 2;
-                        ret = (xmlNsPtr *) xmlRealloc(ret,
-                                                      (maxns +
-                                                       1) *
+                        xmlNsPtr *tmp;
+
+                        maxns = maxns ? maxns * 2 : 10;
+                        tmp = (xmlNsPtr *) xmlRealloc(ret,
+                                                      (maxns + 1) *
                                                       sizeof(xmlNsPtr));
-                        if (ret == NULL) {
+                        if (tmp == NULL) {
                            xmlTreeErrMemory("getting namespace list");
+                            xmlFree(ret);
                             return (NULL);
                         }
+                        ret = tmp;
                     }
                     ret[nbns++] = cur;
                     ret[nbns] = NULL;
@@ -7146,7 +7158,7 @@ xmlBufferCreate(void) {
     ret->use = 0;
     ret->size = xmlDefaultBufferSize;
     ret->alloc = xmlBufferAllocScheme;
-    ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar));
+    ret->content = (xmlChar *) xmlMallocAtomic(ret->size);
     if (ret->content == NULL) {
        xmlTreeErrMemory("creating buffer");
        xmlFree(ret);
@@ -7179,7 +7191,7 @@ xmlBufferCreateSize(size_t size) {
     ret->alloc = xmlBufferAllocScheme;
     ret->size = (size ? size + 1 : 0);         /* +1 for ending null */
     if (ret->size){
-        ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar));
+        ret->content = (xmlChar *) xmlMallocAtomic(ret->size);
         if (ret->content == NULL) {
            xmlTreeErrMemory("creating buffer");
             xmlFree(ret);
@@ -7208,8 +7220,6 @@ xmlBufferDetach(xmlBufferPtr buf) {
 
     if (buf == NULL)
         return(NULL);
-    if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE)
-        return(NULL);
 
     ret = buf->content;
     buf->content = NULL;
@@ -7225,31 +7235,14 @@ xmlBufferDetach(xmlBufferPtr buf) {
  * @mem: the memory area
  * @size:  the size in byte
  *
- * routine to create an XML buffer from an immutable memory area.
- * The area won't be modified nor copied, and is expected to be
- * present until the end of the buffer lifetime.
- *
- * returns the new structure.
+ * Create an XML buffer initialized with bytes.
  */
 xmlBufferPtr
 xmlBufferCreateStatic(void *mem, size_t size) {
-    xmlBufferPtr ret;
+    xmlBufferPtr buf = xmlBufferCreateSize(size);
 
-    if ((mem == NULL) || (size == 0))
-        return(NULL);
-    if (size > UINT_MAX)
-        return(NULL);
-
-    ret = (xmlBufferPtr) xmlMalloc(sizeof(xmlBuffer));
-    if (ret == NULL) {
-       xmlTreeErrMemory("creating buffer");
-        return(NULL);
-    }
-    ret->use = size;
-    ret->size = size;
-    ret->alloc = XML_BUFFER_ALLOC_IMMUTABLE;
-    ret->content = (xmlChar *) mem;
-    return(ret);
+    xmlBufferAdd(buf, mem, size);
+    return(buf);
 }
 
 /**
@@ -7269,12 +7262,10 @@ xmlBufferSetAllocationScheme(xmlBufferPtr buf,
 #endif
         return;
     }
-    if ((buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) ||
-        (buf->alloc == XML_BUFFER_ALLOC_IO)) return;
+    if (buf->alloc == XML_BUFFER_ALLOC_IO) return;
     if ((scheme == XML_BUFFER_ALLOC_DOUBLEIT) ||
         (scheme == XML_BUFFER_ALLOC_EXACT) ||
-        (scheme == XML_BUFFER_ALLOC_HYBRID) ||
-        (scheme == XML_BUFFER_ALLOC_IMMUTABLE))
+        (scheme == XML_BUFFER_ALLOC_HYBRID))
        buf->alloc = scheme;
 }
 
@@ -7298,8 +7289,7 @@ xmlBufferFree(xmlBufferPtr buf) {
     if ((buf->alloc == XML_BUFFER_ALLOC_IO) &&
         (buf->contentIO != NULL)) {
         xmlFree(buf->contentIO);
-    } else if ((buf->content != NULL) &&
-        (buf->alloc != XML_BUFFER_ALLOC_IMMUTABLE)) {
+    } else if (buf->content != NULL) {
         xmlFree(buf->content);
     }
     xmlFree(buf);
@@ -7316,10 +7306,7 @@ xmlBufferEmpty(xmlBufferPtr buf) {
     if (buf == NULL) return;
     if (buf->content == NULL) return;
     buf->use = 0;
-    if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) {
-        buf->content = BAD_CAST "";
-    } else if ((buf->alloc == XML_BUFFER_ALLOC_IO) &&
-               (buf->contentIO != NULL)) {
+    if ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL)) {
         size_t start_buf = buf->content - buf->contentIO;
 
        buf->size += start_buf;
@@ -7346,8 +7333,7 @@ xmlBufferShrink(xmlBufferPtr buf, unsigned int len) {
     if (len > buf->use) return(-1);
 
     buf->use -= len;
-    if ((buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) ||
-        ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL))) {
+    if ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL)) {
        /*
         * we just move the content pointer, but also make sure
         * the perceived buffer size has shrunk accordingly
@@ -7391,7 +7377,6 @@ xmlBufferGrow(xmlBufferPtr buf, unsigned int len) {
 
     if (buf == NULL) return(-1);
 
-    if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0);
     if (len < buf->size - buf->use)
         return(0);
     if (len >= UINT_MAX - buf->use) {
@@ -7456,8 +7441,8 @@ xmlBufferDump(FILE *file, xmlBufferPtr buf) {
     }
     if (file == NULL)
        file = stdout;
-    ret = fwrite(buf->content, sizeof(xmlChar), buf->use, file);
-    return(ret > INT_MAX ? INT_MAX : (int)ret);
+    ret = fwrite(buf->content, 1, buf->use, file);
+    return(ret > INT_MAX ? INT_MAX : ret);
 }
 
 /**
@@ -7515,8 +7500,6 @@ xmlBufferResize(xmlBufferPtr buf, unsigned int size)
     if (buf == NULL)
         return(0);
 
-    if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0);
-
     /* Don't resize if we don't have to */
     if (size < buf->size)
         return 1;
@@ -7634,7 +7617,6 @@ xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len) {
     if ((str == NULL) || (buf == NULL)) {
        return -1;
     }
-    if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1;
     if (len < -1) {
 #ifdef DEBUG_BUFFER
         xmlGenericError(xmlGenericErrorContext,
@@ -7663,7 +7645,7 @@ xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len) {
         }
     }
 
-    memmove(&buf->content[buf->use], str, len*sizeof(xmlChar));
+    memmove(&buf->content[buf->use], str, len);
     buf->use += len;
     buf->content[buf->use] = 0;
     return 0;
@@ -7687,7 +7669,6 @@ xmlBufferAddHead(xmlBufferPtr buf, const xmlChar *str, int len) {
 
     if (buf == NULL)
         return(-1);
-    if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1;
     if (str == NULL) {
 #ifdef DEBUG_BUFFER
         xmlGenericError(xmlGenericErrorContext,
@@ -7758,7 +7739,6 @@ int
 xmlBufferCat(xmlBufferPtr buf, const xmlChar *str) {
     if (buf == NULL)
         return(-1);
-    if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1;
     if (str == NULL) return -1;
     return xmlBufferAdd(buf, str, -1);
 }
@@ -7790,7 +7770,6 @@ void
 xmlBufferWriteCHAR(xmlBufferPtr buf, const xmlChar *string) {
     if (buf == NULL)
         return;
-    if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return;
     xmlBufferCat(buf, string);
 }
 
@@ -7806,7 +7785,6 @@ void
 xmlBufferWriteChar(xmlBufferPtr buf, const char *string) {
     if (buf == NULL)
         return;
-    if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return;
     xmlBufferCCat(buf, string);
 }
 
@@ -7825,7 +7803,6 @@ xmlBufferWriteQuotedString(xmlBufferPtr buf, const xmlChar *string) {
     const xmlChar *cur, *base;
     if (buf == NULL)
         return;
-    if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return;
     if (xmlStrchr(string, '\"')) {
         if (xmlStrchr(string, '\'')) {
 #ifdef DEBUG_BUFFER
@@ -10248,3 +10225,48 @@ xmlDOMWrapAdoptNode(xmlDOMWrapCtxtPtr ctxt,
     return (0);
 }
 
+/************************************************************************
+ *                                                                     *
+ *                     XHTML detection                                 *
+ *                                                                     *
+ ************************************************************************/
+
+#define XHTML_STRICT_PUBLIC_ID BAD_CAST \
+   "-//W3C//DTD XHTML 1.0 Strict//EN"
+#define XHTML_STRICT_SYSTEM_ID BAD_CAST \
+   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+#define XHTML_FRAME_PUBLIC_ID BAD_CAST \
+   "-//W3C//DTD XHTML 1.0 Frameset//EN"
+#define XHTML_FRAME_SYSTEM_ID BAD_CAST \
+   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"
+#define XHTML_TRANS_PUBLIC_ID BAD_CAST \
+   "-//W3C//DTD XHTML 1.0 Transitional//EN"
+#define XHTML_TRANS_SYSTEM_ID BAD_CAST \
+   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+
+/**
+ * xmlIsXHTML:
+ * @systemID:  the system identifier
+ * @publicID:  the public identifier
+ *
+ * Try to find if the document correspond to an XHTML DTD
+ *
+ * Returns 1 if true, 0 if not and -1 in case of error
+ */
+int
+xmlIsXHTML(const xmlChar *systemID, const xmlChar *publicID) {
+    if ((systemID == NULL) && (publicID == NULL))
+       return(-1);
+    if (publicID != NULL) {
+       if (xmlStrEqual(publicID, XHTML_STRICT_PUBLIC_ID)) return(1);
+       if (xmlStrEqual(publicID, XHTML_FRAME_PUBLIC_ID)) return(1);
+       if (xmlStrEqual(publicID, XHTML_TRANS_PUBLIC_ID)) return(1);
+    }
+    if (systemID != NULL) {
+       if (xmlStrEqual(systemID, XHTML_STRICT_SYSTEM_ID)) return(1);
+       if (xmlStrEqual(systemID, XHTML_FRAME_SYSTEM_ID)) return(1);
+       if (xmlStrEqual(systemID, XHTML_TRANS_SYSTEM_ID)) return(1);
+    }
+    return(0);
+}
+
diff --git a/uri.c b/uri.c
index e5c790e..c3d4871 100644 (file)
--- a/uri.c
+++ b/uri.c
@@ -19,6 +19,8 @@
 #include <libxml/globals.h>
 #include <libxml/xmlerror.h>
 
+#include "private/error.h"
+
 /**
  * MAX_URI_LENGTH:
  *
@@ -33,6 +35,9 @@
  */
 #define MAX_URI_LENGTH 1024 * 1024
 
+#define PORT_EMPTY           0
+#define PORT_EMPTY_SERVER   -1
+
 static void
 xmlURIErrMemory(const char *extra)
 {
@@ -768,8 +773,11 @@ xmlParse3986HierPart(xmlURIPtr uri, const char **str)
         cur += 2;
        ret = xmlParse3986Authority(uri, &cur);
        if (ret != 0) return(ret);
-       if (uri->server == NULL)
-           uri->port = -1;
+        /*
+         * An empty server is marked with a special URI value.
+         */
+       if ((uri->server == NULL) && (uri->port == PORT_EMPTY))
+           uri->port = PORT_EMPTY_SERVER;
        ret = xmlParse3986PathAbEmpty(uri, &cur);
        if (ret != 0) return(ret);
        *str = cur;
@@ -1026,6 +1034,7 @@ xmlCreateURI(void) {
        return(NULL);
     }
     memset(ret, 0, sizeof(xmlURI));
+    ret->port = PORT_EMPTY;
     return(ret);
 }
 
@@ -1074,7 +1083,7 @@ xmlSaveUri(xmlURIPtr uri) {
 
 
     max = 80;
-    ret = (xmlChar *) xmlMallocAtomic((max + 1) * sizeof(xmlChar));
+    ret = (xmlChar *) xmlMallocAtomic(max + 1);
     if (ret == NULL) {
         xmlURIErrMemory("saving URI\n");
        return(NULL);
@@ -1117,7 +1126,7 @@ xmlSaveUri(xmlURIPtr uri) {
            }
        }
     } else {
-       if ((uri->server != NULL) || (uri->port == -1)) {
+       if ((uri->server != NULL) || (uri->port != PORT_EMPTY)) {
            if (len + 3 >= max) {
                 temp = xmlSaveUriRealloc(ret, &max);
                 if (temp == NULL) goto mem_error;
@@ -1162,17 +1171,18 @@ xmlSaveUri(xmlURIPtr uri) {
                        if (temp == NULL) goto mem_error;
                        ret = temp;
                    }
-                   ret[len++] = *p++;
-               }
-               if (uri->port > 0) {
-                   if (len + 10 >= max) {
-                       temp = xmlSaveUriRealloc(ret, &max);
-                       if (temp == NULL) goto mem_error;
-                       ret = temp;
-                   }
-                   len += snprintf((char *) &ret[len], max - len, ":%d", uri->port);
+                    /* TODO: escaping? */
+                   ret[len++] = (xmlChar) *p++;
                }
            }
+            if (uri->port > 0) {
+                if (len + 10 >= max) {
+                    temp = xmlSaveUriRealloc(ret, &max);
+                    if (temp == NULL) goto mem_error;
+                    ret = temp;
+                }
+                len += snprintf((char *) &ret[len], max - len, ":%d", uri->port);
+            }
        } else if (uri->authority != NULL) {
            if (len + 3 >= max) {
                 temp = xmlSaveUriRealloc(ret, &max);
@@ -1655,6 +1665,7 @@ xmlURIUnescapeString(const char *str, int len, char *target) {
                c = c * 16 + (*in - 'A') + 10;
            in++;
            len -= 3;
+            /* Explicit sign change */
            *out++ = (char) c;
        } else {
            *out++ = *in++;
@@ -1670,8 +1681,8 @@ xmlURIUnescapeString(const char *str, int len, char *target) {
  * @str:  string to escape
  * @list: exception list string of chars not to escape
  *
- * This routine escapes a string to hex, ignoring reserved characters (a-z)
- * and the characters in the exception list.
+ * This routine escapes a string to hex, ignoring reserved characters
+ * (a-z, A-Z, 0-9, "@-_.!~*'()") and the characters in the exception list.
  *
  * Returns a new escaped string or NULL in case of error.
  */
@@ -1817,10 +1828,10 @@ xmlURIEscape(const xmlChar * str)
         xmlFree(segment);
     }
 
-    if (uri->port) {
-        xmlChar port[10];
+    if (uri->port > 0) {
+        xmlChar port[11];
 
-        snprintf((char *) port, 10, "%d", uri->port);
+        snprintf((char *) port, 11, "%d", uri->port);
         ret = xmlStrcat(ret, BAD_CAST ":");
         ret = xmlStrcat(ret, port);
     }
@@ -1966,12 +1977,13 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) {
     if (res == NULL)
        goto done;
     if ((ref->scheme == NULL) && (ref->path == NULL) &&
-       ((ref->authority == NULL) && (ref->server == NULL))) {
+       ((ref->authority == NULL) && (ref->server == NULL) &&
+         (ref->port == PORT_EMPTY))) {
        if (bas->scheme != NULL)
            res->scheme = xmlMemStrdup(bas->scheme);
        if (bas->authority != NULL)
            res->authority = xmlMemStrdup(bas->authority);
-       else if ((bas->server != NULL) || (bas->port == -1)) {
+       else {
            if (bas->server != NULL)
                res->server = xmlMemStrdup(bas->server);
            if (bas->user != NULL)
@@ -2020,11 +2032,13 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) {
      *    component, which will also be undefined if the URI scheme does not
      *    use an authority component.
      */
-    if ((ref->authority != NULL) || (ref->server != NULL)) {
+    if ((ref->authority != NULL) || (ref->server != NULL) ||
+         (ref->port != PORT_EMPTY)) {
        if (ref->authority != NULL)
            res->authority = xmlMemStrdup(ref->authority);
        else {
-           res->server = xmlMemStrdup(ref->server);
+            if (ref->server != NULL)
+                res->server = xmlMemStrdup(ref->server);
            if (ref->user != NULL)
                res->user = xmlMemStrdup(ref->user);
             res->port = ref->port;
@@ -2035,7 +2049,7 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) {
     }
     if (bas->authority != NULL)
        res->authority = xmlMemStrdup(bas->authority);
-    else if ((bas->server != NULL) || (bas->port == -1)) {
+    else if ((bas->server != NULL) || (bas->port != PORT_EMPTY)) {
        if (bas->server != NULL)
            res->server = xmlMemStrdup(bas->server);
        if (bas->user != NULL)
@@ -2105,7 +2119,7 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) {
        /*
         * Ensure the path includes a '/'
         */
-       if ((out == 0) && (bas->server != NULL))
+       if ((out == 0) && ((bas->server != NULL) || bas->port != PORT_EMPTY))
            res->path[out++] = '/';
        while (ref->path[indx] != 0) {
            res->path[out++] = ref->path[indx++];
@@ -2223,7 +2237,8 @@ xmlBuildRelativeURI (const xmlChar * URI, const xmlChar * base)
     if ((ref->scheme != NULL) &&
        ((bas->scheme == NULL) ||
         (xmlStrcmp ((xmlChar *)bas->scheme, (xmlChar *)ref->scheme)) ||
-        (xmlStrcmp ((xmlChar *)bas->server, (xmlChar *)ref->server)))) {
+        (xmlStrcmp ((xmlChar *)bas->server, (xmlChar *)ref->server)) ||
+         (bas->port != ref->port))) {
        val = xmlStrdup (URI);
        goto done;
     }
diff --git a/valid.c b/valid.c
index 1da812e..67e1b1d 100644 (file)
--- a/valid.c
+++ b/valid.c
 #include <libxml/list.h>
 #include <libxml/globals.h>
 
-static xmlElementPtr xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name,
-                                  int create);
+#include "private/error.h"
+#include "private/parser.h"
+
+static xmlElementPtr
+xmlGetDtdElementDesc2(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *name,
+                      int create);
 /* #define DEBUG_VALID_ALGO */
 /* #define DEBUG_REGEXP_ALGO */
 
@@ -64,9 +68,7 @@ xmlVErrMemory(xmlValidCtxtPtr ctxt, const char *extra)
        /* Look up flag to detect if it is part of a parsing
           context */
        if (ctxt->flags & XML_VCTXT_USE_PCTXT) {
-           long delta = (char *) ctxt - (char *) ctxt->userData;
-           if ((delta > 0) && (delta < 250))
-               pctxt = ctxt->userData;
+           pctxt = ctxt->userData;
        }
     }
     if (extra)
@@ -103,9 +105,7 @@ xmlErrValid(xmlValidCtxtPtr ctxt, xmlParserErrors error,
        /* Look up flag to detect if it is part of a parsing
           context */
        if (ctxt->flags & XML_VCTXT_USE_PCTXT) {
-           long delta = (char *) ctxt - (char *) ctxt->userData;
-           if ((delta > 0) && (delta < 250))
-               pctxt = ctxt->userData;
+           pctxt = ctxt->userData;
        }
     }
     if (extra)
@@ -149,9 +149,7 @@ xmlErrValidNode(xmlValidCtxtPtr ctxt,
        /* Look up flag to detect if it is part of a parsing
           context */
        if (ctxt->flags & XML_VCTXT_USE_PCTXT) {
-           long delta = (char *) ctxt - (char *) ctxt->userData;
-           if ((delta > 0) && (delta < 250))
-               pctxt = ctxt->userData;
+           pctxt = ctxt->userData;
        }
     }
     __xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error,
@@ -191,9 +189,7 @@ xmlErrValidNodeNr(xmlValidCtxtPtr ctxt,
        /* Look up flag to detect if it is part of a parsing
           context */
        if (ctxt->flags & XML_VCTXT_USE_PCTXT) {
-           long delta = (char *) ctxt - (char *) ctxt->userData;
-           if ((delta > 0) && (delta < 250))
-               pctxt = ctxt->userData;
+           pctxt = ctxt->userData;
        }
     }
     __xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error,
@@ -231,9 +227,7 @@ xmlErrValidWarning(xmlValidCtxtPtr ctxt,
        /* Look up flag to detect if it is part of a parsing
           context */
        if (ctxt->flags & XML_VCTXT_USE_PCTXT) {
-           long delta = (char *) ctxt - (char *) ctxt->userData;
-           if ((delta > 0) && (delta < 250))
-               pctxt = ctxt->userData;
+           pctxt = ctxt->userData;
        }
     }
     __xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error,
@@ -832,7 +826,7 @@ xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, xmlElementPtr elem) {
        xmlSnprintfElementContent(expr, 5000, elem->content, 1);
        xmlErrValidNode(ctxt, (xmlNodePtr) elem,
                        XML_DTD_CONTENT_NOT_DETERMINIST,
-              "Content model of %s is not determinist: %s\n",
+              "Content model of %s is not deterministic: %s\n",
               elem->name, BAD_CAST expr, NULL);
 #ifdef DEBUG_REGEXP_ALGO
         xmlRegexpPrint(stderr, elem->contModel);
@@ -885,6 +879,8 @@ xmlValidCtxtPtr xmlNewValidCtxt(void) {
  */
 void
 xmlFreeValidCtxt(xmlValidCtxtPtr cur) {
+    if (cur == NULL)
+        return;
     if (cur->vstateTab != NULL)
         xmlFree(cur->vstateTab);
     if (cur->nodeTab != NULL)
@@ -1056,7 +1052,7 @@ xmlCopyDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur) {
            if (cur->c1 != NULL)
                tmp->c1 = xmlCopyDocElementContent(doc,cur->c1);
            if (tmp->c1 != NULL)
-               tmp->c1->parent = ret;
+               tmp->c1->parent = tmp;
            prev = tmp;
            cur = cur->c2;
        }
@@ -2120,7 +2116,7 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt,
      * Validity Check:
      * Multiple ID per element
      */
-    elemDef = xmlGetDtdElementDesc2(dtd, elem, 1);
+    elemDef = xmlGetDtdElementDesc2(ctxt, dtd, elem, 1);
     if (elemDef != NULL) {
 
 #ifdef LIBXML_VALID_ENABLED
@@ -3284,7 +3280,8 @@ xmlGetDtdElementDesc(xmlDtdPtr dtd, const xmlChar *name) {
  */
 
 static xmlElementPtr
-xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name, int create) {
+xmlGetDtdElementDesc2(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *name,
+                      int create) {
     xmlElementTablePtr table;
     xmlElementPtr cur;
     xmlChar *uqname = NULL, *prefix = NULL;
@@ -3307,7 +3304,7 @@ xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name, int create) {
            dtd->elements = (void *) table;
        }
        if (table == NULL) {
-           xmlVErrMemory(NULL, "element table allocation failed");
+           xmlVErrMemory(ctxt, "element table allocation failed");
            return(NULL);
        }
     }
@@ -3320,8 +3317,8 @@ xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name, int create) {
     if ((cur == NULL) && (create)) {
        cur = (xmlElementPtr) xmlMalloc(sizeof(xmlElement));
        if (cur == NULL) {
-           xmlVErrMemory(NULL, "malloc failed");
-           return(NULL);
+           xmlVErrMemory(ctxt, "malloc failed");
+           goto error;
        }
        memset(cur, 0, sizeof(xmlElement));
        cur->type = XML_ELEMENT_DECL;
@@ -3333,8 +3330,13 @@ xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name, int create) {
        cur->prefix = xmlStrdup(prefix);
        cur->etype = XML_ELEMENT_TYPE_UNDEFINED;
 
-       xmlHashAddEntry2(table, name, prefix, cur);
+       if (xmlHashAddEntry2(table, name, prefix, cur) < 0) {
+           xmlVErrMemory(ctxt, "adding entry failed");
+            xmlFreeElement(cur);
+            cur = NULL;
+        }
     }
+error:
     if (prefix != NULL) xmlFree(prefix);
     if (uqname != NULL) xmlFree(uqname);
     return(cur);
@@ -4903,6 +4905,7 @@ cont:
      */
     if ((CONT != NULL) &&
        ((CONT->parent == NULL) ||
+        (CONT->parent == (xmlElementContentPtr) 1) ||
         (CONT->parent->type != XML_ELEMENT_CONTENT_OR)) &&
        ((CONT->ocur == XML_ELEMENT_CONTENT_MULT) ||
         (CONT->ocur == XML_ELEMENT_CONTENT_OPT) ||
@@ -5015,7 +5018,7 @@ cont:
             * save the second branch 'or' branch
             */
            DEBUG_VALID_MSG("saving 'or' branch");
-           if (vstateVPush(ctxt, CONT->c2, NODE, (unsigned char)(DEPTH + 1),
+           if (vstateVPush(ctxt, CONT->c2, NODE, DEPTH + 1,
                            OCCURS, ROLLBACK_OR) < 0)
                return(-1);
            DEPTH++;
@@ -5155,7 +5158,8 @@ analyze:
         * Then act accordingly at the parent level
         */
        RESET_OCCURRENCE;
-       if (CONT->parent == NULL)
+       if ((CONT->parent == NULL) ||
+            (CONT->parent == (xmlElementContentPtr) 1))
            break;
 
        switch (CONT->parent->type) {
@@ -5437,9 +5441,13 @@ fail:
     STATE = 0;
     ret = xmlValidateElementType(ctxt);
     if ((ret == -3) && (warn)) {
-       xmlErrValidWarning(ctxt, child, XML_DTD_CONTENT_NOT_DETERMINIST,
-              "Content model for Element %s is ambiguous\n",
-                          name, NULL, NULL);
+       char expr[5000];
+       expr[0] = 0;
+       xmlSnprintfElementContent(expr, 5000, elemDecl->content, 1);
+       xmlErrValidNode(ctxt, (xmlNodePtr) elemDecl,
+                XML_DTD_CONTENT_NOT_DETERMINIST,
+               "Content model of %s is not deterministic: %s\n",
+               name, BAD_CAST expr, NULL);
     } else if (ret == -2) {
        /*
         * An entities reference appeared at this level.
@@ -5660,6 +5668,7 @@ done:
     return(ret);
 }
 
+#ifdef LIBXML_REGEXP_ENABLED
 /**
  * xmlValidateCheckMixed:
  * @ctxt:  the validation context
@@ -5725,6 +5734,7 @@ xmlValidateCheckMixed(xmlValidCtxtPtr ctxt,
     }
     return(0);
 }
+#endif /* LIBXML_REGEXP_ENABLED */
 
 /**
  * xmlValidGetElemDecl:
@@ -5989,11 +5999,12 @@ xmlValidatePopElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc ATTRIBUTE_UNUSED,
            if (elemDecl->etype == XML_ELEMENT_TYPE_ELEMENT) {
                if (state->exec != NULL) {
                    ret = xmlRegExecPushString(state->exec, NULL, NULL);
-                   if (ret == 0) {
+                   if (ret <= 0) {
                        xmlErrValidNode(ctxt, state->node,
                                        XML_DTD_CONTENT_MODEL,
-          "Element %s content does not follow the DTD, Expecting more child\n",
+          "Element %s content does not follow the DTD, Expecting more children\n",
                               state->node->name, NULL,NULL);
+                       ret = 0;
                    } else {
                        /*
                         * previous validation errors should not generate
@@ -6457,60 +6468,60 @@ name_ok:
  */
 
 int
-xmlValidateElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem) {
-    xmlNodePtr child;
+xmlValidateElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr root) {
+    xmlNodePtr elem;
     xmlAttrPtr attr;
     xmlNsPtr ns;
     const xmlChar *value;
     int ret = 1;
 
-    if (elem == NULL) return(0);
-
-    /*
-     * XInclude elements were added after parsing in the infoset,
-     * they don't really mean anything validation wise.
-     */
-    if ((elem->type == XML_XINCLUDE_START) ||
-       (elem->type == XML_XINCLUDE_END) ||
-       (elem->type == XML_NAMESPACE_DECL))
-       return(1);
+    if (root == NULL) return(0);
 
     CHECK_DTD;
 
-    /*
-     * Entities references have to be handled separately
-     */
-    if (elem->type == XML_ENTITY_REF_NODE) {
-       return(1);
-    }
+    elem = root;
+    while (1) {
+        ret &= xmlValidateOneElement(ctxt, doc, elem);
+
+        if (elem->type == XML_ELEMENT_NODE) {
+            attr = elem->properties;
+            while (attr != NULL) {
+                value = xmlNodeListGetString(doc, attr->children, 0);
+                ret &= xmlValidateOneAttribute(ctxt, doc, elem, attr, value);
+                if (value != NULL)
+                    xmlFree((char *)value);
+                attr= attr->next;
+            }
 
-    ret &= xmlValidateOneElement(ctxt, doc, elem);
-    if (elem->type == XML_ELEMENT_NODE) {
-       attr = elem->properties;
-       while (attr != NULL) {
-           value = xmlNodeListGetString(doc, attr->children, 0);
-           ret &= xmlValidateOneAttribute(ctxt, doc, elem, attr, value);
-           if (value != NULL)
-               xmlFree((char *)value);
-           attr= attr->next;
-       }
-       ns = elem->nsDef;
-       while (ns != NULL) {
-           if (elem->ns == NULL)
-               ret &= xmlValidateOneNamespace(ctxt, doc, elem, NULL,
-                                              ns, ns->href);
-           else
-               ret &= xmlValidateOneNamespace(ctxt, doc, elem,
-                                              elem->ns->prefix, ns, ns->href);
-           ns = ns->next;
-       }
-    }
-    child = elem->children;
-    while (child != NULL) {
-        ret &= xmlValidateElement(ctxt, doc, child);
-        child = child->next;
+            ns = elem->nsDef;
+            while (ns != NULL) {
+                if (elem->ns == NULL)
+                    ret &= xmlValidateOneNamespace(ctxt, doc, elem, NULL,
+                                                   ns, ns->href);
+                else
+                    ret &= xmlValidateOneNamespace(ctxt, doc, elem,
+                                                   elem->ns->prefix, ns,
+                                                   ns->href);
+                ns = ns->next;
+            }
+
+            if (elem->children != NULL) {
+                elem = elem->children;
+                continue;
+            }
+        }
+
+        while (1) {
+            if (elem == root)
+                goto done;
+            if (elem->next != NULL)
+                break;
+            elem = elem->parent;
+        }
+        elem = elem->next;
     }
 
+done:
     return(ret);
 }
 
@@ -7007,7 +7018,7 @@ xmlValidGetPotentialChildren(xmlElementContent *ctree,
 /*
  * Dummy function to suppress messages while we try out valid elements
  */
-static void XMLCDECL xmlNoValidityErr(void *ctx ATTRIBUTE_UNUSED,
+static void xmlNoValidityErr(void *ctx ATTRIBUTE_UNUSED,
                                 const char *msg ATTRIBUTE_UNUSED, ...) {
     return;
 }
index c4b5125..bf599a5 100644 (file)
@@ -31,7 +31,6 @@ XML_NAME = xml2
 XML_BASENAME = lib$(XML_NAME)
 XML_SO = $(XML_BASENAME).dll
 XML_IMP = $(XML_BASENAME).lib
-XML_DEF = $(XML_BASENAME).def
 XML_A = $(XML_BASENAME)_a.lib
 DUMMY = dir.exists
 
@@ -42,7 +41,7 @@ XML_INTDIR_A = int.a.bcb
 UTILS_INTDIR = int.utils.bcb
 
 # The preprocessor and its options.
-CPP = cpp32.exe -P- -DWIN32
+CPP = cpp32.exe -P-
 CPPFLAGS = -I"$(XML_SRCDIR)\include" -DNOLIBTOOL 
 !if "$(WITH_THREADS)" != "no"
 CPPFLAGS = $(CPPFLAGS) -D_REENTRANT -D__MT__
@@ -50,7 +49,7 @@ CPPFLAGS = $(CPPFLAGS) -D_REENTRANT -D__MT__
 
 # The compiler and its options.
 CC = bcc32.exe
-CFLAGS = -q -DWIN32 -D_NO_VCL -D_WINDOWS -D_MBCS -DEILSEQ=2 -DNOLIBTOOL -w-
+CFLAGS = -q -D_NO_VCL -D_WINDOWS -D_MBCS -DEILSEQ=2 -DNOLIBTOOL -w-
 CFLAGS = $(CFLAGS) -I"$(XML_SRCDIR)" -I"$(XML_SRCDIR)\include" -I"$(INCPREFIX)" -I"$(INCLUDE)"
 !if "$(WITH_THREADS)" != "no"
 CFLAGS = $(CFLAGS) -D_REENTRANT -tWM
@@ -59,9 +58,7 @@ CFLAGS = $(CFLAGS) -D_REENTRANT -tWM
 CFLAGS = $(CFLAGS) -tWR
 !endif
 !if "$(WITH_THREADS)" == "yes" || "$(WITH_THREADS)" == "ctls"
-CFLAGS = $(CFLAGS) -DHAVE_WIN32_THREADS -DHAVE_COMPILER_TLS
-!else if "$(WITH_THREADS)" == "native"
-CFLAGS = $(CFLAGS) -DHAVE_WIN32_THREADS
+CFLAGS = $(CFLAGS) -DHAVE_COMPILER_TLS
 !else if "$(WITH_THREADS)" == "posix"
 CFLAGS = $(CFLAGS) -DHAVE_PTHREAD_H
 !endif
@@ -205,7 +202,6 @@ XML_OBJS_A = $(XML_INTDIR_A)\buf.obj\
 # Xmllint and friends executables.
 UTILS = $(BINDIR)\xmllint.exe\
        $(BINDIR)\xmlcatalog.exe\
-       $(BINDIR)\testAutomata.exe\
        $(BINDIR)\testModule.exe\
        $(BINDIR)\runtest.exe\
        $(BINDIR)\runsuite.exe\
@@ -295,17 +291,12 @@ $(XML_OBJS_A) : $(XML_INTDIR_A)\$(DUMMY)
 
 #def4bcb.exe : def4bcb.c
 
-# Creates the export definition file (DEF) for libxml.
-#$(XML_INTDIR)\$(XML_DEF) : $(XML_INTDIR)\$(DUMMY) $(XML_DEF).src def4bcb.exe
-#      $(CPP) $(CPPFLAGS) -o $(XML_INTDIR)\$(XML_DEF).tmp $(XML_DEF).src
-#      def4bcb -msnames < $(XML_INTDIR)\$(XML_DEF).tmp > $(XML_INTDIR)\$(XML_DEF)
-
 # Creates the libxml shared object.
 $(BINDIR)\$(XML_SO) : $(BINDIR)\$(DUMMY) $(XML_OBJS)
        $(LD) $(LDFLAGS) -Tpd -Gi c0d32.obj $(XML_OBJS),$(BINDIR)\$(XML_SO),,$(LIBS)
 
-#$(BINDIR)\$(XML_SO) : $(BINDIR)\$(DUMMY) $(XML_OBJS) $(XML_INTDIR)\$(XML_DEF)
-#      $(LD) $(LDFLAGS) -Tpd -Gi c0d32.obj $(XML_OBJS),$(BINDIR)\$(XML_SO),,$(LIBS),$(XML_INTDIR)\$(XML_DEF)
+#$(BINDIR)\$(XML_SO) : $(BINDIR)\$(DUMMY) $(XML_OBJS)
+#      $(LD) $(LDFLAGS) -Tpd -Gi c0d32.obj $(XML_OBJS),$(BINDIR)\$(XML_SO),,$(LIBS)
 
 # Creates the libxml archive.
 $(BINDIR)\$(XML_A) : $(BINDIR)\$(DUMMY) $(XML_OBJS_A)
index 13f2d96..bd0c429 100644 (file)
@@ -40,19 +40,16 @@ endif
 
 # The compiler and its options.
 CC = gcc.exe
-CFLAGS += -DWIN32 -D_WINDOWS -D_MBCS -DNOLIBTOOL 
+CFLAGS += -D_WINDOWS -D_MBCS -DNOLIBTOOL
 CFLAGS += -I$(XML_SRCDIR) -I$(XML_SRCDIR)/include -I$(INCPREFIX) $(INCLUDE)
 ifneq ($(WITH_THREADS),no)
 CFLAGS += -D_REENTRANT
 endif
 ifeq ($(WITH_THREADS),yes) 
-CFLAGS += -DHAVE_WIN32_THREADS -DHAVE_COMPILER_TLS
+CFLAGS += -DHAVE_COMPILER_TLS
 endif
 ifeq ($(WITH_THREADS),ctls)
-CFLAGS += -DHAVE_WIN32_THREADS -DHAVE_COMPILER_TLS
-endif
-ifeq ($(WITH_THREADS),native)
-CFLAGS += -DHAVE_WIN32_THREADS
+CFLAGS += -DHAVE_COMPILER_TLS
 endif
 ifeq ($(WITH_THREADS),posix)
 CFLAGS += -DHAVE_PTHREAD_H
@@ -201,7 +198,6 @@ XML_SRCS_A = $(subst .o,.c,$(subst $(XML_INTDIR_A)/,$(XML_SRCDIR)/,$(XML_OBJS_A)
 # Xmllint and friends executables.
 UTILS = $(BINDIR)/xmllint.exe\
        $(BINDIR)/xmlcatalog.exe\
-       $(BINDIR)/testAutomata.exe\
        $(BINDIR)/testModule.exe\
        $(BINDIR)/runtest.exe\
        $(BINDIR)/runsuite.exe\
index 80e64e2..cf348f5 100644 (file)
@@ -24,7 +24,6 @@ XML_BASENAME = lib$(XML_NAME)
 XML_SO = $(XML_BASENAME).dll
 XML_RES = $(XML_BASENAME).res
 XML_IMP = $(XML_BASENAME).lib
-XML_DEF = $(XML_BASENAME).def
 XML_A = $(XML_BASENAME)_a.lib
 XML_A_DLL = $(XML_BASENAME)_a_dll.lib
 
@@ -50,9 +49,7 @@ CFLAGS = $(CFLAGS) /I$(XML_SRCDIR) /I$(XML_SRCDIR)\include /I$(INCPREFIX)
 CFLAGS = $(CFLAGS) /D "_REENTRANT"
 !endif
 !if "$(WITH_THREADS)" == "yes" || "$(WITH_THREADS)" == "ctls"
-CFLAGS = $(CFLAGS) /D "HAVE_WIN32_THREADS" /D "HAVE_COMPILER_TLS"
-!else if "$(WITH_THREADS)" == "native"
-CFLAGS = $(CFLAGS) /D "HAVE_WIN32_THREADS"
+CFLAGS = $(CFLAGS) /D "HAVE_COMPILER_TLS"
 !else if "$(WITH_THREADS)" == "posix"
 CFLAGS = $(CFLAGS) /D "HAVE_PTHREAD_H"
 !endif
@@ -255,7 +252,6 @@ XML_OBJS_A_DLL = $(XML_OBJS_A_DLL) $(XML_INTDIR_A_DLL)\xzlib.obj
 # Xmllint and friends executables.
 UTILS = $(BINDIR)\xmllint.exe\
        $(BINDIR)\xmlcatalog.exe\
-       $(BINDIR)\testAutomata.exe\
        $(BINDIR)\testModule.exe\
        $(BINDIR)\runtest.exe\
        $(BINDIR)\runsuite.exe\
@@ -368,22 +364,15 @@ $(XML_OBJS_A) : $(XML_INTDIR_A)
 # Compiles static for dll libxml source. Uses the implicit rule for commands.
 $(XML_OBJS_A_DLL) : $(XML_INTDIR_A_DLL) 
 
-# Creates the export definition file (DEF) for libxml.
-$(XML_INTDIR)\$(XML_DEF) : $(XML_INTDIR) $(XML_DEF).src
-       $(CPP) $(CPPFLAGS) $(XML_DEF).src > $(XML_INTDIR)\$(XML_DEF)
 $(XML_INTDIR)\$(XML_RES) : $(XML_INTDIR) libxml2.rc
        rc -Fo $(XML_INTDIR)\$(XML_RES) libxml2.rc
 
 # Creates the libxml shared object.
-$(BINDIR)\$(XML_SO) : $(BINDIR) $(XML_OBJS) $(XML_INTDIR)\$(XML_DEF) $(XML_INTDIR)\$(XML_RES)
+$(BINDIR)\$(XML_SO) : $(BINDIR) $(XML_OBJS) $(XML_INTDIR)\$(XML_RES)
        $(LD) $(LDFLAGS) /DLL \
                /IMPLIB:$(BINDIR)\$(XML_IMP) /OUT:$(BINDIR)\$(XML_SO) $(XML_OBJS) $(XML_INTDIR)\$(XML_RES) $(LIBS)
        @$(_VC_MANIFEST_EMBED_DLL)
 
-#$(BINDIR)\$(XML_SO) : $(BINDIR) $(XML_OBJS) $(XML_INTDIR)\$(XML_DEF)
-#      $(LD) $(LDFLAGS) /DLL /DEF:$(XML_INTDIR)\$(XML_DEF) \
-#              /IMPLIB:$(BINDIR)\$(XML_IMP) /OUT:$(BINDIR)\$(XML_SO) $(XML_OBJS) $(LIBS)
-
 # Creates the libxml archive.
 $(BINDIR)\$(XML_A) : $(BINDIR) $(XML_OBJS_A)
        $(AR) $(ARFLAGS) /OUT:$(BINDIR)\$(XML_A) $(XML_OBJS_A)
index 8499428..e53cfcb 100644 (file)
@@ -46,7 +46,6 @@ var withZlib = false;
 var withLzma = false;
 var withDebug = true;
 var withMemDebug = false;
-var withRunDebug = false;
 var withSchemas = true;
 var withSchematron = true;
 var withRegExps = true;
@@ -132,7 +131,6 @@ function usage()
        txt += "  lzma:       Enable lzma support (" + (withLzma? "yes" : "no")  + ")\n";
        txt += "  xml_debug:  Enable XML debbugging module (" + (withDebug? "yes" : "no")  + ")\n";
        txt += "  mem_debug:  Enable memory debugger (" + (withMemDebug? "yes" : "no")  + ")\n";
-       txt += "  run_debug:  Enable memory debugger (" + (withRunDebug? "yes" : "no")  + ")\n";
        txt += "  regexps:    Enable regular expressions (" + (withRegExps? "yes" : "no") + ")\n";
        txt += "  modules:    Enable module support (" + (withModules? "yes" : "no") + ")\n";
        txt += "  tree:       Enable tree api (" + (withTree? "yes" : "no") + ")\n";
@@ -229,7 +227,6 @@ function discoverVersion()
        vf.WriteLine("WITH_LZMA=" + (withLzma? "1" : "0"));
        vf.WriteLine("WITH_DEBUG=" + (withDebug? "1" : "0"));
        vf.WriteLine("WITH_MEM_DEBUG=" + (withMemDebug? "1" : "0"));
-       vf.WriteLine("WITH_RUN_DEBUG=" + (withRunDebug? "1" : "0"));
        vf.WriteLine("WITH_SCHEMAS=" + (withSchemas? "1" : "0"));
        vf.WriteLine("WITH_SCHEMATRON=" + (withSchematron? "1" : "0"));
        vf.WriteLine("WITH_REGEXPS=" + (withRegExps? "1" : "0"));
@@ -337,8 +334,6 @@ function configureLibxml()
                        of.WriteLine(s.replace(/\@WITH_DEBUG\@/, withDebug? "1" : "0"));
                } else if (s.search(/\@WITH_MEM_DEBUG\@/) != -1) {
                        of.WriteLine(s.replace(/\@WITH_MEM_DEBUG\@/, withMemDebug? "1" : "0"));
-               } else if (s.search(/\@WITH_RUN_DEBUG\@/) != -1) {
-                       of.WriteLine(s.replace(/\@WITH_RUN_DEBUG\@/, withRunDebug? "1" : "0"));
                } else if (s.search(/\@WITH_SCHEMAS\@/) != -1) {
                        of.WriteLine(s.replace(/\@WITH_SCHEMAS\@/, withSchemas? "1" : "0"));
                } else if (s.search(/\@WITH_SCHEMATRON\@/) != -1) {
@@ -492,8 +487,6 @@ for (i = 0; (i < WScript.Arguments.length) && (error == 0); i++) {
                        withDebug = strToBool(arg.substring(opt.length + 1, arg.length));
                else if (opt == "mem_debug")
                        withMemDebug = strToBool(arg.substring(opt.length + 1, arg.length));
-               else if (opt == "run_debug")
-                       withRunDebug = strToBool(arg.substring(opt.length + 1, arg.length));
                else if (opt == "schemas")
                        withSchemas = strToBool(arg.substring(opt.length + 1, arg.length));
                else if (opt == "schematron")
@@ -672,7 +665,6 @@ txtOut += "      zlib support: " + boolToStr(withZlib) + "\n";
 txtOut += "      lzma support: " + boolToStr(withLzma) + "\n";
 txtOut += "  Debugging module: " + boolToStr(withDebug) + "\n";
 txtOut += "  Memory debugging: " + boolToStr(withMemDebug) + "\n";
-txtOut += " Runtime debugging: " + boolToStr(withRunDebug) + "\n";
 txtOut += "    Regexp support: " + boolToStr(withRegExps) + "\n";
 txtOut += "    Module support: " + boolToStr(withModules) + "\n";
 txtOut += "      Tree support: " + boolToStr(withTree) + "\n";
diff --git a/win32/defgen.xsl b/win32/defgen.xsl
deleted file mode 100644 (file)
index 423a231..0000000
+++ /dev/null
@@ -1,261 +0,0 @@
-<?xml version="1.0"?>
-<!-- 
-       win32/defgen.xsl
-       This stylesheet is used to transform doc/libxml2-api.xml into a pseudo-source,
-       which can then be preprocessed to get the .DEF file for the Microsoft's linker.
-       
-       Use any XSLT processor to produce a file called libxml2.def.src in the win32
-       subdirectory, for example, run xsltproc from the win32 subdirectory:
-       
-         xsltproc -o libxml2.def.src defgen.xsl ../doc/libxml2-api.xml
-         
-       Once that finishes, rest assured, the Makefile will know what to do with the
-       generated file. 
-
-       April 2003, Igor Zlatkovic <igor@zlatkovic.com>
--->
-<!DOCTYPE xsl:stylesheet [ <!ENTITY nl '&#xd;&#xa;'> ]>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-       <xsl:strip-space elements="*"/>
-       <xsl:output method="text"/>
-       <xsl:template match="/">
-               <xsl:text>#define LIBXML2_COMPILING_MSCCDEF&nl;</xsl:text>
-               <xsl:text>#include "../include/libxml/xmlversion.h"&nl;</xsl:text>
-               <xsl:text>LIBRARY libxml2&nl;</xsl:text>
-               <xsl:text>EXPORTS&nl;</xsl:text>
-               <xsl:for-each select="/api/symbols/*[self::variable or self::function]">
-                       <!-- Basic tests -->
-                       <xsl:if test="@file = 'c14n'">
-                               <xsl:text>#ifdef LIBXML_C14N_ENABLED&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="@file = 'catalog'">
-                               <xsl:text>#ifdef LIBXML_CATALOG_ENABLED&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="@file = 'debugXML'">
-                               <xsl:text>#ifdef LIBXML_DEBUG_ENABLED&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="(@file = 'HTMLparser') 
-                                       or (@file = 'HTMLtree')">
-                               <xsl:text>#ifdef LIBXML_HTML_ENABLED&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="@file = 'nanohttp'">
-                               <xsl:text>#ifdef LIBXML_HTTP_ENABLED&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="@file = 'nanoftp'">
-                               <xsl:text>#ifdef LIBXML_FTP_ENABLED&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="(@file = 'relaxng') 
-                                       or (@file = 'xmlschemas') 
-                                       or (@file = 'xmlschemastypes')">
-                               <xsl:text>#ifdef LIBXML_SCHEMAS_ENABLED&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="@file = 'xinclude'">
-                               <xsl:text>#ifdef LIBXML_XINCLUDE_ENABLED&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="@file = 'xlink'">
-                               <xsl:text>#ifdef LIBXML_XLINK_ENABLED&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="@file = 'xmlautomata'">
-                               <xsl:text>#ifdef LIBXML_AUTOMATA_ENABLED&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="(@file = 'xmlregexp') 
-                                       or (@file = 'xmlunicode')">
-                               <xsl:text>#ifdef LIBXML_REGEXP_ENABLED&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="(@file = 'xpath') 
-                                       or (@file = 'xpathInternals')">
-                               <xsl:text>#ifdef LIBXML_XPATH_ENABLED&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="@file = 'xpointer'">
-                               <xsl:text>#ifdef LIBXML_XPTR_ENABLED&nl;</xsl:text>
-                       </xsl:if>
-                       <!-- Extended tests -->
-                       <xsl:if test="(@name = 'htmlDefaultSAXHandlerInit') 
-                                       or (@name = 'htmlInitAutoClose') 
-                                       or (@name = 'htmlCreateFileParserCtxt') 
-                                       or (@name = 'inithtmlDefaultSAXHandler')
-                                       or (@name = 'xmlIsXHTML') 
-                                       or (@name = 'xmlIOHTTPOpenW') 
-                                       or (@name = 'xmlRegisterHTTPPostCallbacks') 
-                                       or (@name = 'xmlIOHTTPMatch')
-                                       or (@name = 'xmlIOHTTPOpen') 
-                                       or (@name = 'xmlIOHTTPRead') 
-                                       or (@name = 'xmlIOHTTPClose')">
-                               <xsl:text>#ifdef LIBXML_HTML_ENABLED&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="@name = 'xmlValidBuildContentModel'">
-                               <xsl:text>#ifdef LIBXML_REGEXP_ENABLED&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="(@name = 'xmlIOFTPMatch') 
-                                       or (@name = 'xmlIOFTPOpen') 
-                                       or (@name = 'xmlIOFTPRead') 
-                                       or (@name = 'xmlIOFTPClose')">
-                               <xsl:text>#ifdef LIBXML_FTP_ENABLED&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="(@name = 'xmlTextReaderRelaxNGValidate') 
-                                       or (@name = 'xmlTextReaderRelaxNGSetSchema')">
-                               <xsl:text>#ifdef LIBXML_SCHEMAS_ENABLED&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="(@name = 'xmlXPathDebugDumpObject') 
-                                       or (@name = 'xmlXPathDebugDumpCompExpr')">
-                               <xsl:text>#ifdef LIBXML_DEBUG_ENABLED&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="(@name = 'xmlMallocLoc') 
-                                       or (@name = 'xmlMallocAtomicLoc') 
-                                       or (@name = 'xmlReallocLoc') 
-                                       or (@name = 'xmlMemStrdupLoc')">
-                               <xsl:text>#ifdef DEBUG_MEMORY_LOCATION&nl;</xsl:text>
-                       </xsl:if>
-                       <!-- Symbol -->
-                       <xsl:choose>
-                               <xsl:when test="(@name = 'xmlMalloc') 
-                                               or (@name = 'xmlMallocAtomic') 
-                                               or (@name = 'xmlRealloc') 
-                                               or (@name = 'xmlFree') 
-                                               or (@name = 'xmlMemStrdup')">
-                                       <xsl:text>#ifdef LIBXML_THREAD_ALLOC_ENABLED&nl;</xsl:text>
-                                       <xsl:text>__</xsl:text>
-                                       <xsl:value-of select="@name"/>
-                                       <xsl:text>&nl;</xsl:text>
-                                       <xsl:text>#else&nl;</xsl:text>
-                                       <xsl:value-of select="@name"/>
-                                       <xsl:text> DATA&nl;</xsl:text>
-                                       <xsl:text>#endif&nl;</xsl:text>
-                               </xsl:when>
-                               <xsl:when test="(@name = 'htmlDefaultSAXHandler') 
-                                               or (@name = 'oldXMLWDcompatibility') 
-                                               or (@name = 'xmlBufferAllocScheme') 
-                                               or (@name = 'xmlDefaultBufferSize') 
-                                               or (@name = 'xmlDefaultSAXHandler') 
-                                               or (@name = 'xmlDefaultSAXLocator') 
-                                               or (@name = 'xmlDoValidityCheckingDefaultValue') 
-                                               or (@name = 'xmlGenericError') 
-                                               or (@name = 'xmlGenericErrorContext') 
-                                               or (@name = 'xmlGetWarningsDefaultValue') 
-                                               or (@name = 'xmlIndentTreeOutput') 
-                                               or (@name = 'xmlTreeIndentString') 
-                                               or (@name = 'xmlKeepBlanksDefaultValue') 
-                                               or (@name = 'xmlLineNumbersDefaultValue') 
-                                               or (@name = 'xmlLoadExtDtdDefaultValue') 
-                                               or (@name = 'xmlParserDebugEntities') 
-                                               or (@name = 'xmlParserVersion') 
-                                               or (@name = 'xmlPedanticParserDefaultValue') 
-                                               or (@name = 'xmlSaveNoEmptyTags') 
-                                               or (@name = 'xmlSubstituteEntitiesDefaultValue') 
-                                               or (@name = 'xmlRegisterNodeDefaultValue') 
-                                               or (@name = 'xmlDeregisterNodeDefaultValue')">
-                                       <xsl:text>#ifdef LIBXML_THREAD_ENABLED&nl;</xsl:text>
-                                       <xsl:if test="@name = 'htmlDefaultSAXHandler'">
-                                               <xsl:text>#ifdef LIBXML_HTML_ENABLED&nl;</xsl:text>
-                                       </xsl:if>
-                                       <xsl:text>__</xsl:text>
-                                       <xsl:value-of select="@name"/>
-                                       <xsl:text>&nl;</xsl:text>
-                                       <xsl:if test="@name = 'htmlDefaultSAXHandler'">
-                                               <xsl:text>#endif&nl;</xsl:text>
-                                       </xsl:if>
-                                       <xsl:text>#else&nl;</xsl:text>
-                                       <xsl:if test="@name = 'htmlDefaultSAXHandler'">
-                                               <xsl:text>#ifdef LIBXML_HTML_ENABLED&nl;</xsl:text>
-                                       </xsl:if>
-                                       <xsl:value-of select="@name"/>
-                                       <xsl:text> DATA&nl;</xsl:text>
-                                       <xsl:if test="@name = 'htmlDefaultSAXHandler'">
-                                               <xsl:text>#endif&nl;</xsl:text>
-                                       </xsl:if>
-                                       <xsl:text>#endif&nl;</xsl:text>
-                               </xsl:when>
-                               <xsl:otherwise>
-                                       <xsl:value-of select="@name"/>
-                                       <xsl:if test="self::variable">
-                                               <xsl:text> DATA</xsl:text>
-                                       </xsl:if>
-                                       <xsl:text>&nl;</xsl:text>
-                               </xsl:otherwise>
-                       </xsl:choose>
-                       <!-- Basic tests (close) -->
-                       <xsl:if test="@file = 'c14n'">
-                               <xsl:text>#endif&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="@file = 'catalog'">
-                               <xsl:text>#endif&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="@file = 'debugXML'">
-                               <xsl:text>#endif&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="(@file = 'HTMLparser') 
-                                       or (@file = 'HTMLtree')">
-                               <xsl:text>#endif&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="@file = 'nanohttp'">
-                               <xsl:text>#endif&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="@file = 'nanoftp'">
-                               <xsl:text>#endif&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="(@file = 'relaxng') 
-                                       or (@file = 'xmlschemas') 
-                                       or (@file = 'xmlschemastypes')">
-                               <xsl:text>#endif&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="@file = 'xinclude'">
-                               <xsl:text>#endif&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="@file = 'xlink'">
-                               <xsl:text>#endif&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="@file = 'xmlautomata'">
-                               <xsl:text>#endif&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="(@file = 'xmlregexp') 
-                                       or (@file = 'xmlunicode')">
-                               <xsl:text>#endif&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="(@file = 'xpath') 
-                                       or (@file = 'xpathInternals')">
-                               <xsl:text>#endif&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="@file = 'xpointer'">
-                               <xsl:text>#endif&nl;</xsl:text>
-                       </xsl:if>
-                       <!-- Extended tests (close) -->
-                       <xsl:if test="(@name = 'htmlDefaultSAXHandlerInit') 
-                                       or (@name = 'htmlInitAutoClose') 
-                                       or (@name = 'htmlCreateFileParserCtxt') 
-                                       or (@name = 'inithtmlDefaultSAXHandler')
-                                       or (@name = 'xmlIsXHTML') 
-                                       or (@name = 'xmlIOHTTPOpenW') 
-                                       or (@name = 'xmlRegisterHTTPPostCallbacks') 
-                                       or (@name = 'xmlIOHTTPMatch')
-                                       or (@name = 'xmlIOHTTPOpen') 
-                                       or (@name = 'xmlIOHTTPRead') 
-                                       or (@name = 'xmlIOHTTPClose')">
-                               <xsl:text>#endif&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="@name = 'xmlValidBuildContentModel'">
-                               <xsl:text>#endif&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="(@name = 'xmlIOFTPMatch') 
-                                       or (@name = 'xmlIOFTPOpen') 
-                                       or (@name = 'xmlIOFTPRead') 
-                                       or (@name = 'xmlIOFTPClose')">
-                               <xsl:text>#endif&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="(@name = 'xmlTextReaderRelaxNGValidate') 
-                                       or (@name = 'xmlTextReaderRelaxNGSetSchema')">
-                               <xsl:text>#endif&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="(@name = 'xmlXPathDebugDumpObject') 
-                                       or (@name = 'xmlXPathDebugDumpCompExpr')">
-                               <xsl:text>#endif&nl;</xsl:text>
-                       </xsl:if>
-                       <xsl:if test="(@name = 'xmlMallocLoc') 
-                                       or (@name = 'xmlMallocAtomicLoc') 
-                                       or (@name = 'xmlReallocLoc') 
-                                       or (@name = 'xmlMemStrdupLoc')">
-                               <xsl:text>#endif&nl;</xsl:text>
-                       </xsl:if>
-               </xsl:for-each>
-       </xsl:template>
-</xsl:stylesheet>
-
diff --git a/win32/libxml2.def.src b/win32/libxml2.def.src
deleted file mode 100644 (file)
index d83dbf4..0000000
+++ /dev/null
@@ -1,3146 +0,0 @@
-#define LIBXML2_COMPILING_MSCCDEF
-#include "../include/libxml/xmlversion.h"
-LIBRARY libxml2
-EXPORTS
-#ifdef LIBXML_REGEXP_ENABLED
-emptyExp DATA
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-forbiddenExp DATA
-#endif
-#ifdef LIBXML_THREAD_ENABLED
-#ifdef LIBXML_HTML_ENABLED
-__htmlDefaultSAXHandler
-#endif
-#else
-#ifdef LIBXML_HTML_ENABLED
-htmlDefaultSAXHandler DATA
-#endif
-#endif
-#ifdef LIBXML_THREAD_ENABLED
-__oldXMLWDcompatibility
-#else
-oldXMLWDcompatibility DATA
-#endif
-#ifdef LIBXML_THREAD_ENABLED
-__xmlBufferAllocScheme
-#else
-xmlBufferAllocScheme DATA
-#endif
-#ifdef LIBXML_THREAD_ENABLED
-__xmlDefaultBufferSize
-#else
-xmlDefaultBufferSize DATA
-#endif
-#ifdef LIBXML_THREAD_ENABLED
-__xmlDefaultSAXHandler
-#else
-xmlDefaultSAXHandler DATA
-#endif
-#ifdef LIBXML_THREAD_ENABLED
-__xmlDefaultSAXLocator
-#else
-xmlDefaultSAXLocator DATA
-#endif
-#ifdef LIBXML_THREAD_ENABLED
-__xmlDeregisterNodeDefaultValue
-#else
-xmlDeregisterNodeDefaultValue DATA
-#endif
-#ifdef LIBXML_THREAD_ENABLED
-__xmlDoValidityCheckingDefaultValue
-#else
-xmlDoValidityCheckingDefaultValue DATA
-#endif
-#ifdef LIBXML_THREAD_ALLOC_ENABLED
-__xmlFree
-#else
-xmlFree DATA
-#endif
-#ifdef LIBXML_THREAD_ENABLED
-__xmlGenericError
-#else
-xmlGenericError DATA
-#endif
-#ifdef LIBXML_THREAD_ENABLED
-__xmlGenericErrorContext
-#else
-xmlGenericErrorContext DATA
-#endif
-#ifdef LIBXML_THREAD_ENABLED
-__xmlGetWarningsDefaultValue
-#else
-xmlGetWarningsDefaultValue DATA
-#endif
-#ifdef LIBXML_THREAD_ENABLED
-__xmlIndentTreeOutput
-#else
-xmlIndentTreeOutput DATA
-#endif
-xmlIsBaseCharGroup DATA
-xmlIsCharGroup DATA
-xmlIsCombiningGroup DATA
-xmlIsDigitGroup DATA
-xmlIsExtenderGroup DATA
-xmlIsIdeographicGroup DATA
-xmlIsPubidChar_tab DATA
-#ifdef LIBXML_THREAD_ENABLED
-__xmlKeepBlanksDefaultValue
-#else
-xmlKeepBlanksDefaultValue DATA
-#endif
-xmlLastError DATA
-#ifdef LIBXML_THREAD_ENABLED
-__xmlLineNumbersDefaultValue
-#else
-xmlLineNumbersDefaultValue DATA
-#endif
-#ifdef LIBXML_THREAD_ENABLED
-__xmlLoadExtDtdDefaultValue
-#else
-xmlLoadExtDtdDefaultValue DATA
-#endif
-#ifdef LIBXML_THREAD_ALLOC_ENABLED
-__xmlMalloc
-#else
-xmlMalloc DATA
-#endif
-#ifdef LIBXML_THREAD_ALLOC_ENABLED
-__xmlMallocAtomic
-#else
-xmlMallocAtomic DATA
-#endif
-#ifdef LIBXML_THREAD_ALLOC_ENABLED
-__xmlMemStrdup
-#else
-xmlMemStrdup DATA
-#endif
-xmlOutputBufferCreateFilenameValue DATA
-#ifdef LIBXML_THREAD_ENABLED
-__xmlParserDebugEntities
-#else
-xmlParserDebugEntities DATA
-#endif
-xmlParserInputBufferCreateFilenameValue DATA
-xmlParserMaxDepth DATA
-#ifdef LIBXML_THREAD_ENABLED
-__xmlParserVersion
-#else
-xmlParserVersion DATA
-#endif
-#ifdef LIBXML_THREAD_ENABLED
-__xmlPedanticParserDefaultValue
-#else
-xmlPedanticParserDefaultValue DATA
-#endif
-#ifdef LIBXML_THREAD_ALLOC_ENABLED
-__xmlRealloc
-#else
-xmlRealloc DATA
-#endif
-#ifdef LIBXML_THREAD_ENABLED
-__xmlRegisterNodeDefaultValue
-#else
-xmlRegisterNodeDefaultValue DATA
-#endif
-#ifdef LIBXML_THREAD_ENABLED
-__xmlSaveNoEmptyTags
-#else
-xmlSaveNoEmptyTags DATA
-#endif
-xmlStringComment DATA
-xmlStringText DATA
-xmlStringTextNoenc DATA
-xmlStructuredError DATA
-xmlStructuredErrorContext DATA
-#ifdef LIBXML_THREAD_ENABLED
-__xmlSubstituteEntitiesDefaultValue
-#else
-xmlSubstituteEntitiesDefaultValue DATA
-#endif
-#ifdef LIBXML_THREAD_ENABLED
-__xmlTreeIndentString
-#else
-xmlTreeIndentString DATA
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNAN DATA
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNINF DATA
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathPINF DATA
-#endif
-#ifdef LIBXML_HTML_ENABLED
-UTF8ToHtml
-#endif
-UTF8Toisolat1
-attribute
-attributeDecl
-cdataBlock
-characters
-checkNamespace
-comment
-elementDecl
-endDocument
-endElement
-entityDecl
-externalSubset
-getColumnNumber
-getEntity
-getLineNumber
-getNamespace
-getParameterEntity
-getPublicId
-getSystemId
-globalNamespace
-hasExternalSubset
-hasInternalSubset
-#ifdef LIBXML_HTML_ENABLED
-htmlAttrAllowed
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlAutoCloseTag
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlCreateFileParserCtxt
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlCreateMemoryParserCtxt
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlCreatePushParserCtxt
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlCtxtReadDoc
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlCtxtReadFd
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlCtxtReadFile
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlCtxtReadIO
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlCtxtReadMemory
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlCtxtReset
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlCtxtUseOptions
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlDefaultSAXHandlerInit
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlDocContentDumpFormatOutput
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlDocContentDumpOutput
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlDocDump
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlDocDumpMemory
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlDocDumpMemoryFormat
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlElementAllowedHere
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlElementStatusHere
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlEncodeEntities
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlEntityLookup
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlEntityValueLookup
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlFreeParserCtxt
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlGetMetaEncoding
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlHandleOmittedElem
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlInitAutoClose
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlIsAutoClosed
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlIsBooleanAttr
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlIsScriptAttribute
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlNewDoc
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlNewDocNoDtD
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlNewParserCtxt
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlNodeDump
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlNodeDumpFile
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlNodeDumpFileFormat
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlNodeDumpFormatOutput
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlNodeDumpOutput
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlNodeStatus
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlParseCharRef
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlParseChunk
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlParseDoc
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlParseDocument
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlParseElement
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlParseEntityRef
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlParseFile
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlReadDoc
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlReadFd
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlReadFile
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlReadIO
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlReadMemory
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlSAXParseDoc
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlSAXParseFile
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlSaveFile
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlSaveFileEnc
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlSaveFileFormat
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlSetMetaEncoding
-#endif
-#ifdef LIBXML_HTML_ENABLED
-htmlTagLookup
-#endif
-ignorableWhitespace
-initGenericErrorDefaultFunc
-#ifdef LIBXML_HTML_ENABLED
-inithtmlDefaultSAXHandler
-#endif
-initxmlDefaultSAXHandler
-inputPop
-inputPush
-internalSubset
-isStandalone
-isolat1ToUTF8
-namePop
-namePush
-namespaceDecl
-nodePop
-nodePush
-notationDecl
-processingInstruction
-reference
-resolveEntity
-setDocumentLocator
-setNamespace
-startDocument
-startElement
-unparsedEntityDecl
-#ifdef LIBXML_XPATH_ENABLED
-valuePop
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-valuePush
-#endif
-#ifdef LIBXML_XLINK_ENABLED
-xlinkGetDefaultDetect
-#endif
-#ifdef LIBXML_XLINK_ENABLED
-xlinkGetDefaultHandler
-#endif
-#ifdef LIBXML_XLINK_ENABLED
-xlinkIsLink
-#endif
-#ifdef LIBXML_XLINK_ENABLED
-xlinkSetDefaultDetect
-#endif
-#ifdef LIBXML_XLINK_ENABLED
-xlinkSetDefaultHandler
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlACatalogAdd
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlACatalogDump
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlACatalogRemove
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlACatalogResolve
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlACatalogResolvePublic
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlACatalogResolveSystem
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlACatalogResolveURI
-#endif
-xmlAddAttributeDecl
-xmlAddChild
-xmlAddChildList
-xmlAddDocEntity
-xmlAddDtdEntity
-xmlAddElementDecl
-xmlAddEncodingAlias
-xmlAddID
-xmlAddNextSibling
-xmlAddNotationDecl
-xmlAddPrevSibling
-xmlAddRef
-xmlAddSibling
-xmlAllocOutputBuffer
-xmlAllocParserInputBuffer
-xmlAttrSerializeTxtContent
-#ifdef LIBXML_AUTOMATA_ENABLED
-xmlAutomataCompile
-#endif
-#ifdef LIBXML_AUTOMATA_ENABLED
-xmlAutomataGetInitState
-#endif
-#ifdef LIBXML_AUTOMATA_ENABLED
-xmlAutomataIsDeterminist
-#endif
-#ifdef LIBXML_AUTOMATA_ENABLED
-xmlAutomataNewAllTrans
-#endif
-#ifdef LIBXML_AUTOMATA_ENABLED
-xmlAutomataNewCountTrans
-#endif
-#ifdef LIBXML_AUTOMATA_ENABLED
-xmlAutomataNewCountTrans2
-#endif
-#ifdef LIBXML_AUTOMATA_ENABLED
-xmlAutomataNewCountedTrans
-#endif
-#ifdef LIBXML_AUTOMATA_ENABLED
-xmlAutomataNewCounter
-#endif
-#ifdef LIBXML_AUTOMATA_ENABLED
-xmlAutomataNewCounterTrans
-#endif
-#ifdef LIBXML_AUTOMATA_ENABLED
-xmlAutomataNewEpsilon
-#endif
-#ifdef LIBXML_AUTOMATA_ENABLED
-xmlAutomataNewNegTrans
-#endif
-#ifdef LIBXML_AUTOMATA_ENABLED
-xmlAutomataNewOnceTrans
-#endif
-#ifdef LIBXML_AUTOMATA_ENABLED
-xmlAutomataNewOnceTrans2
-#endif
-#ifdef LIBXML_AUTOMATA_ENABLED
-xmlAutomataNewState
-#endif
-#ifdef LIBXML_AUTOMATA_ENABLED
-xmlAutomataNewTransition
-#endif
-#ifdef LIBXML_AUTOMATA_ENABLED
-xmlAutomataNewTransition2
-#endif
-#ifdef LIBXML_AUTOMATA_ENABLED
-xmlAutomataSetFinalState
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-xmlBoolToText
-#endif
-xmlBufContent
-xmlBufEnd
-xmlBufGetNodeContent
-xmlBufNodeDump
-xmlBufShrink
-xmlBufUse
-xmlBufferAdd
-xmlBufferAddHead
-xmlBufferCCat
-xmlBufferCat
-xmlBufferContent
-xmlBufferCreate
-xmlBufferCreateSize
-xmlBufferCreateStatic
-xmlBufferDetach
-xmlBufferDump
-xmlBufferEmpty
-xmlBufferFree
-xmlBufferGrow
-xmlBufferLength
-xmlBufferResize
-xmlBufferSetAllocationScheme
-xmlBufferShrink
-xmlBufferWriteCHAR
-xmlBufferWriteChar
-xmlBufferWriteQuotedString
-xmlBuildQName
-xmlBuildRelativeURI
-xmlBuildURI
-xmlByteConsumed
-#ifdef LIBXML_C14N_ENABLED
-xmlC14NDocDumpMemory
-#endif
-#ifdef LIBXML_C14N_ENABLED
-xmlC14NDocSave
-#endif
-#ifdef LIBXML_C14N_ENABLED
-xmlC14NDocSaveTo
-#endif
-#ifdef LIBXML_C14N_ENABLED
-xmlC14NExecute
-#endif
-xmlCanonicPath
-#ifdef LIBXML_CATALOG_ENABLED
-xmlCatalogAdd
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlCatalogAddLocal
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlCatalogCleanup
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlCatalogConvert
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlCatalogDump
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlCatalogFreeLocal
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlCatalogGetDefaults
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlCatalogGetPublic
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlCatalogGetSystem
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlCatalogIsEmpty
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlCatalogLocalResolve
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlCatalogLocalResolveURI
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlCatalogRemove
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlCatalogResolve
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlCatalogResolvePublic
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlCatalogResolveSystem
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlCatalogResolveURI
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlCatalogSetDebug
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlCatalogSetDefaultPrefer
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlCatalogSetDefaults
-#endif
-xmlCharEncCloseFunc
-xmlCharEncFirstLine
-xmlCharEncInFunc
-xmlCharEncOutFunc
-xmlCharInRange
-xmlCharStrdup
-xmlCharStrndup
-xmlCheckFilename
-xmlCheckHTTPInput
-xmlCheckLanguageID
-xmlCheckUTF8
-xmlCheckVersion
-xmlChildElementCount
-xmlCleanupCharEncodingHandlers
-xmlCleanupEncodingAliases
-xmlCleanupGlobals
-xmlCleanupInputCallbacks
-xmlCleanupMemory
-xmlCleanupOutputCallbacks
-xmlCleanupParser
-xmlCleanupPredefinedEntities
-xmlCleanupThreads
-xmlClearNodeInfoSeq
-xmlClearParserCtxt
-#ifdef LIBXML_CATALOG_ENABLED
-xmlConvertSGMLCatalog
-#endif
-xmlCopyAttributeTable
-xmlCopyChar
-xmlCopyCharMultiByte
-xmlCopyDoc
-xmlCopyDocElementContent
-xmlCopyDtd
-xmlCopyElementContent
-xmlCopyElementTable
-xmlCopyEntitiesTable
-xmlCopyEnumeration
-xmlCopyError
-xmlCopyNamespace
-xmlCopyNamespaceList
-xmlCopyNode
-xmlCopyNodeList
-xmlCopyNotationTable
-xmlCopyProp
-xmlCopyPropList
-xmlCreateDocParserCtxt
-xmlCreateEntitiesTable
-xmlCreateEntityParserCtxt
-xmlCreateEnumeration
-xmlCreateFileParserCtxt
-xmlCreateIOParserCtxt
-xmlCreateIntSubset
-xmlCreateMemoryParserCtxt
-xmlCreatePushParserCtxt
-xmlCreateURI
-xmlCreateURLParserCtxt
-xmlCtxtGetLastError
-xmlCtxtReadDoc
-xmlCtxtReadFd
-xmlCtxtReadFile
-xmlCtxtReadIO
-xmlCtxtReadMemory
-xmlCtxtReset
-xmlCtxtResetLastError
-xmlCtxtResetPush
-xmlCtxtUseOptions
-xmlCurrentChar
-xmlDOMWrapAdoptNode
-xmlDOMWrapCloneNode
-xmlDOMWrapFreeCtxt
-xmlDOMWrapNewCtxt
-xmlDOMWrapReconcileNamespaces
-xmlDOMWrapRemoveNode
-#ifdef LIBXML_DEBUG_ENABLED
-xmlDebugCheckDocument
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-xmlDebugDumpAttr
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-xmlDebugDumpAttrList
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-xmlDebugDumpDTD
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-xmlDebugDumpDocument
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-xmlDebugDumpDocumentHead
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-xmlDebugDumpEntities
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-xmlDebugDumpNode
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-xmlDebugDumpNodeList
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-xmlDebugDumpOneNode
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-xmlDebugDumpString
-#endif
-xmlDecodeEntities
-xmlDefaultSAXHandlerInit
-xmlDelEncodingAlias
-xmlDeregisterNodeDefault
-xmlDetectCharEncoding
-xmlDictCleanup
-xmlDictCreate
-xmlDictCreateSub
-xmlDictExists
-xmlDictFree
-xmlDictGetUsage
-xmlDictLookup
-xmlDictOwns
-xmlDictQLookup
-xmlDictReference
-xmlDictSetLimit
-xmlDictSize
-xmlDllMain
-xmlDocCopyNode
-xmlDocCopyNodeList
-xmlDocDump
-xmlDocDumpFormatMemory
-xmlDocDumpFormatMemoryEnc
-xmlDocDumpMemory
-xmlDocDumpMemoryEnc
-xmlDocFormatDump
-xmlDocGetRootElement
-xmlDocSetRootElement
-xmlDumpAttributeDecl
-xmlDumpAttributeTable
-xmlDumpElementDecl
-xmlDumpElementTable
-xmlDumpEntitiesTable
-xmlDumpEntityDecl
-xmlDumpNotationDecl
-xmlDumpNotationTable
-xmlElemDump
-xmlEncodeEntities
-xmlEncodeEntitiesReentrant
-xmlEncodeSpecialChars
-xmlErrMemory
-#ifdef LIBXML_REGEXP_ENABLED
-xmlExpCtxtNbCons
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlExpCtxtNbNodes
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlExpDump
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlExpExpDerive
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlExpFree
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlExpFreeCtxt
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlExpGetLanguage
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlExpGetStart
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlExpIsNillable
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlExpMaxToken
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlExpNewAtom
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlExpNewCtxt
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlExpNewOr
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlExpNewRange
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlExpNewSeq
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlExpParse
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlExpRef
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlExpStringDerive
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlExpSubsume
-#endif
-xmlFileClose
-xmlFileMatch
-xmlFileOpen
-xmlFileRead
-xmlFindCharEncodingHandler
-xmlFirstElementChild
-xmlFreeAttributeTable
-#ifdef LIBXML_AUTOMATA_ENABLED
-xmlFreeAutomata
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlFreeCatalog
-#endif
-xmlFreeDoc
-xmlFreeDocElementContent
-xmlFreeDtd
-xmlFreeElementContent
-xmlFreeElementTable
-xmlFreeEntitiesTable
-xmlFreeEnumeration
-xmlFreeIDTable
-xmlFreeInputStream
-xmlFreeMutex
-xmlFreeNode
-xmlFreeNodeList
-xmlFreeNotationTable
-xmlFreeNs
-xmlFreeNsList
-xmlFreeParserCtxt
-xmlFreeParserInputBuffer
-xmlFreePattern
-xmlFreePatternList
-xmlFreeProp
-xmlFreePropList
-xmlFreeRMutex
-xmlFreeRefTable
-xmlFreeStreamCtxt
-xmlFreeTextReader
-xmlFreeTextWriter
-xmlFreeURI
-xmlFreeValidCtxt
-xmlGcMemGet
-xmlGcMemSetup
-xmlGetBufferAllocationScheme
-xmlGetCharEncodingHandler
-xmlGetCharEncodingName
-xmlGetCompressMode
-xmlGetDocCompressMode
-xmlGetDocEntity
-xmlGetDtdAttrDesc
-xmlGetDtdElementDesc
-xmlGetDtdEntity
-xmlGetDtdNotationDesc
-xmlGetDtdQAttrDesc
-xmlGetDtdQElementDesc
-xmlGetEncodingAlias
-xmlGetExternalEntityLoader
-xmlGetFeature
-xmlGetFeaturesList
-xmlGetGlobalState
-xmlGetID
-xmlGetIntSubset
-xmlGetLastChild
-xmlGetLastError
-xmlGetLineNo
-xmlGetNoNsProp
-xmlGetNodePath
-xmlGetNsList
-xmlGetNsProp
-xmlGetParameterEntity
-xmlGetPredefinedEntity
-xmlGetProp
-xmlGetRefs
-xmlGetThreadId
-xmlGetUTF8Char
-xmlHandleEntity
-xmlHasFeature
-xmlHasNsProp
-xmlHasProp
-xmlHashAddEntry
-xmlHashAddEntry2
-xmlHashAddEntry3
-xmlHashCopy
-xmlHashCreate
-xmlHashCreateDict
-xmlHashDefaultDeallocator
-xmlHashFree
-xmlHashLookup
-xmlHashLookup2
-xmlHashLookup3
-xmlHashQLookup
-xmlHashQLookup2
-xmlHashQLookup3
-xmlHashRemoveEntry
-xmlHashRemoveEntry2
-xmlHashRemoveEntry3
-xmlHashScan
-xmlHashScan3
-xmlHashScanFull
-xmlHashScanFull3
-xmlHashSize
-xmlHashUpdateEntry
-xmlHashUpdateEntry2
-xmlHashUpdateEntry3
-#ifdef LIBXML_FTP_ENABLED
-xmlIOFTPClose
-#endif
-#ifdef LIBXML_FTP_ENABLED
-xmlIOFTPMatch
-#endif
-#ifdef LIBXML_FTP_ENABLED
-xmlIOFTPOpen
-#endif
-#ifdef LIBXML_FTP_ENABLED
-xmlIOFTPRead
-#endif
-#ifdef LIBXML_HTML_ENABLED
-xmlIOHTTPClose
-#endif
-#ifdef LIBXML_HTML_ENABLED
-xmlIOHTTPMatch
-#endif
-#ifdef LIBXML_HTML_ENABLED
-xmlIOHTTPOpen
-#endif
-#ifdef LIBXML_HTML_ENABLED
-xmlIOHTTPOpenW
-#endif
-#ifdef LIBXML_HTML_ENABLED
-xmlIOHTTPRead
-#endif
-xmlIOParseDTD
-xmlInitCharEncodingHandlers
-xmlInitGlobals
-xmlInitMemory
-xmlInitNodeInfoSeq
-xmlInitParser
-xmlInitParserCtxt
-xmlInitThreads
-#ifdef LIBXML_CATALOG_ENABLED
-xmlInitializeCatalog
-#endif
-xmlInitializeDict
-xmlInitializeGlobalState
-xmlInitializePredefinedEntities
-xmlIsBaseChar
-xmlIsBlank
-xmlIsBlankNode
-xmlIsChar
-xmlIsCombining
-xmlIsDigit
-xmlIsExtender
-xmlIsID
-xmlIsIdeographic
-xmlIsLetter
-xmlIsMainThread
-xmlIsMixedElement
-xmlIsPubidChar
-xmlIsRef
-#ifdef LIBXML_HTML_ENABLED
-xmlIsXHTML
-#endif
-xmlKeepBlanksDefault
-xmlLastElementChild
-xmlLineNumbersDefault
-xmlLinkGetData
-xmlListAppend
-xmlListClear
-xmlListCopy
-xmlListCreate
-xmlListDelete
-xmlListDup
-xmlListEmpty
-xmlListEnd
-xmlListFront
-xmlListInsert
-xmlListMerge
-xmlListPopBack
-xmlListPopFront
-xmlListPushBack
-xmlListPushFront
-xmlListRemoveAll
-xmlListRemoveFirst
-xmlListRemoveLast
-xmlListReverse
-xmlListReverseSearch
-xmlListReverseWalk
-xmlListSearch
-xmlListSize
-xmlListSort
-xmlListWalk
-#ifdef LIBXML_CATALOG_ENABLED
-xmlLoadACatalog
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlLoadCatalog
-#endif
-#ifdef LIBXML_CATALOG_ENABLED
-xmlLoadCatalogs
-#endif
-xmlLoadExternalEntity
-#ifdef LIBXML_CATALOG_ENABLED
-xmlLoadSGMLSuperCatalog
-#endif
-xmlLockLibrary
-#ifdef LIBXML_DEBUG_ENABLED
-xmlLsCountNode
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-xmlLsOneNode
-#endif
-#ifdef DEBUG_MEMORY_LOCATION
-xmlMallocAtomicLoc
-#endif
-#ifdef DEBUG_MEMORY_LOCATION
-xmlMallocLoc
-#endif
-xmlMemBlocks
-xmlMemDisplay
-xmlMemDisplayLast
-xmlMemFree
-xmlMemGet
-xmlMemMalloc
-xmlMemRealloc
-xmlMemSetup
-xmlMemShow
-#ifdef DEBUG_MEMORY_LOCATION
-xmlMemStrdupLoc
-#endif
-xmlMemUsed
-xmlMemoryDump
-xmlMemoryStrdup
-xmlModuleClose
-xmlModuleFree
-xmlModuleOpen
-xmlModuleSymbol
-xmlMutexLock
-xmlMutexUnlock
-xmlNamespaceParseNCName
-xmlNamespaceParseNSDef
-xmlNamespaceParseQName
-#ifdef LIBXML_FTP_ENABLED
-xmlNanoFTPCheckResponse
-#endif
-#ifdef LIBXML_FTP_ENABLED
-xmlNanoFTPCleanup
-#endif
-#ifdef LIBXML_FTP_ENABLED
-xmlNanoFTPClose
-#endif
-#ifdef LIBXML_FTP_ENABLED
-xmlNanoFTPCloseConnection
-#endif
-#ifdef LIBXML_FTP_ENABLED
-xmlNanoFTPConnect
-#endif
-#ifdef LIBXML_FTP_ENABLED
-xmlNanoFTPConnectTo
-#endif
-#ifdef LIBXML_FTP_ENABLED
-xmlNanoFTPCwd
-#endif
-#ifdef LIBXML_FTP_ENABLED
-xmlNanoFTPDele
-#endif
-#ifdef LIBXML_FTP_ENABLED
-xmlNanoFTPFreeCtxt
-#endif
-#ifdef LIBXML_FTP_ENABLED
-xmlNanoFTPGet
-#endif
-#ifdef LIBXML_FTP_ENABLED
-xmlNanoFTPGetConnection
-#endif
-#ifdef LIBXML_FTP_ENABLED
-xmlNanoFTPGetResponse
-#endif
-#ifdef LIBXML_FTP_ENABLED
-xmlNanoFTPGetSocket
-#endif
-#ifdef LIBXML_FTP_ENABLED
-xmlNanoFTPInit
-#endif
-#ifdef LIBXML_FTP_ENABLED
-xmlNanoFTPList
-#endif
-#ifdef LIBXML_FTP_ENABLED
-xmlNanoFTPNewCtxt
-#endif
-#ifdef LIBXML_FTP_ENABLED
-xmlNanoFTPOpen
-#endif
-#ifdef LIBXML_FTP_ENABLED
-xmlNanoFTPProxy
-#endif
-#ifdef LIBXML_FTP_ENABLED
-xmlNanoFTPQuit
-#endif
-#ifdef LIBXML_FTP_ENABLED
-xmlNanoFTPRead
-#endif
-#ifdef LIBXML_FTP_ENABLED
-xmlNanoFTPScanProxy
-#endif
-#ifdef LIBXML_FTP_ENABLED
-xmlNanoFTPUpdateURL
-#endif
-#ifdef LIBXML_HTTP_ENABLED
-xmlNanoHTTPAuthHeader
-#endif
-#ifdef LIBXML_HTTP_ENABLED
-xmlNanoHTTPCleanup
-#endif
-#ifdef LIBXML_HTTP_ENABLED
-xmlNanoHTTPClose
-#endif
-#ifdef LIBXML_HTTP_ENABLED
-xmlNanoHTTPContentLength
-#endif
-#ifdef LIBXML_HTTP_ENABLED
-xmlNanoHTTPEncoding
-#endif
-#ifdef LIBXML_HTTP_ENABLED
-xmlNanoHTTPFetch
-#endif
-#ifdef LIBXML_HTTP_ENABLED
-xmlNanoHTTPInit
-#endif
-#ifdef LIBXML_HTTP_ENABLED
-xmlNanoHTTPMethod
-#endif
-#ifdef LIBXML_HTTP_ENABLED
-xmlNanoHTTPMethodRedir
-#endif
-#ifdef LIBXML_HTTP_ENABLED
-xmlNanoHTTPMimeType
-#endif
-#ifdef LIBXML_HTTP_ENABLED
-xmlNanoHTTPOpen
-#endif
-#ifdef LIBXML_HTTP_ENABLED
-xmlNanoHTTPOpenRedir
-#endif
-#ifdef LIBXML_HTTP_ENABLED
-xmlNanoHTTPRead
-#endif
-#ifdef LIBXML_HTTP_ENABLED
-xmlNanoHTTPRedir
-#endif
-#ifdef LIBXML_HTTP_ENABLED
-xmlNanoHTTPReturnCode
-#endif
-#ifdef LIBXML_HTTP_ENABLED
-xmlNanoHTTPSave
-#endif
-#ifdef LIBXML_HTTP_ENABLED
-xmlNanoHTTPScanProxy
-#endif
-#ifdef LIBXML_AUTOMATA_ENABLED
-xmlNewAutomata
-#endif
-xmlNewCDataBlock
-#ifdef LIBXML_CATALOG_ENABLED
-xmlNewCatalog
-#endif
-xmlNewCharEncodingHandler
-xmlNewCharRef
-xmlNewChild
-xmlNewComment
-xmlNewDoc
-xmlNewDocComment
-xmlNewDocElementContent
-xmlNewDocFragment
-xmlNewDocNode
-xmlNewDocNodeEatName
-xmlNewDocPI
-xmlNewDocProp
-xmlNewDocRawNode
-xmlNewDocText
-xmlNewDocTextLen
-xmlNewDtd
-xmlNewElementContent
-xmlNewEntity
-xmlNewEntityInputStream
-xmlNewGlobalNs
-xmlNewIOInputStream
-xmlNewInputFromFile
-xmlNewInputStream
-xmlNewMutex
-xmlNewNode
-xmlNewNodeEatName
-xmlNewNs
-xmlNewNsProp
-xmlNewNsPropEatName
-xmlNewPI
-xmlNewParserCtxt
-xmlNewProp
-xmlNewRMutex
-xmlNewReference
-xmlNewStringInputStream
-xmlNewText
-xmlNewTextChild
-xmlNewTextLen
-xmlNewTextReader
-xmlNewTextReaderFilename
-xmlNewTextWriter
-xmlNewTextWriterDoc
-xmlNewTextWriterFilename
-xmlNewTextWriterMemory
-xmlNewTextWriterPushParser
-xmlNewTextWriterTree
-xmlNewValidCtxt
-xmlNextChar
-xmlNextElementSibling
-xmlNoNetExternalEntityLoader
-xmlNodeAddContent
-xmlNodeAddContentLen
-xmlNodeBufGetContent
-xmlNodeDump
-xmlNodeDumpOutput
-xmlNodeGetBase
-xmlNodeGetContent
-xmlNodeGetLang
-xmlNodeGetSpacePreserve
-xmlNodeIsText
-xmlNodeListGetRawString
-xmlNodeListGetString
-xmlNodeSetBase
-xmlNodeSetContent
-xmlNodeSetContentLen
-xmlNodeSetLang
-xmlNodeSetName
-xmlNodeSetSpacePreserve
-xmlNormalizeURIPath
-xmlNormalizeWindowsPath
-xmlOutputBufferClose
-xmlOutputBufferCreateBuffer
-xmlOutputBufferCreateFd
-xmlOutputBufferCreateFile
-xmlOutputBufferCreateFilename
-xmlOutputBufferCreateFilenameDefault
-xmlOutputBufferCreateIO
-xmlOutputBufferFlush
-xmlOutputBufferGetContent
-xmlOutputBufferGetSize
-xmlOutputBufferWrite
-xmlOutputBufferWriteEscape
-xmlOutputBufferWriteString
-xmlParseAttValue
-xmlParseAttribute
-xmlParseAttributeListDecl
-xmlParseAttributeType
-xmlParseBalancedChunkMemory
-xmlParseBalancedChunkMemoryRecover
-xmlParseCDSect
-#ifdef LIBXML_CATALOG_ENABLED
-xmlParseCatalogFile
-#endif
-xmlParseCharData
-xmlParseCharEncoding
-xmlParseCharRef
-xmlParseChunk
-xmlParseComment
-xmlParseContent
-xmlParseCtxtExternalEntity
-xmlParseDTD
-xmlParseDefaultDecl
-xmlParseDoc
-xmlParseDocTypeDecl
-xmlParseDocument
-xmlParseElement
-xmlParseElementChildrenContentDecl
-xmlParseElementContentDecl
-xmlParseElementDecl
-xmlParseElementMixedContentDecl
-xmlParseEncName
-xmlParseEncodingDecl
-xmlParseEndTag
-xmlParseEntity
-xmlParseEntityDecl
-xmlParseEntityRef
-xmlParseEntityValue
-xmlParseEnumeratedType
-xmlParseEnumerationType
-xmlParseExtParsedEnt
-xmlParseExternalEntity
-xmlParseExternalID
-xmlParseExternalSubset
-xmlParseFile
-xmlParseInNodeContext
-xmlParseMarkupDecl
-xmlParseMemory
-xmlParseMisc
-xmlParseName
-xmlParseNamespace
-xmlParseNmtoken
-xmlParseNotationDecl
-xmlParseNotationType
-xmlParsePEReference
-xmlParsePI
-xmlParsePITarget
-xmlParsePubidLiteral
-xmlParseQuotedString
-xmlParseReference
-xmlParseSDDecl
-xmlParseStartTag
-xmlParseSystemLiteral
-xmlParseTextDecl
-xmlParseURI
-xmlParseURIRaw
-xmlParseURIReference
-xmlParseVersionInfo
-xmlParseVersionNum
-xmlParseXMLDecl
-xmlParserAddNodeInfo
-xmlParserError
-xmlParserFindNodeInfo
-xmlParserFindNodeInfoIndex
-xmlParserGetDirectory
-xmlParserHandlePEReference
-xmlParserHandleReference
-xmlParserInputBufferCreateFd
-xmlParserInputBufferCreateFile
-xmlParserInputBufferCreateFilename
-xmlParserInputBufferCreateFilenameDefault
-xmlParserInputBufferCreateIO
-xmlParserInputBufferCreateMem
-xmlParserInputBufferCreateStatic
-xmlParserInputBufferGrow
-xmlParserInputBufferPush
-xmlParserInputBufferRead
-xmlParserInputGrow
-xmlParserInputRead
-xmlParserInputShrink
-xmlParserPrintFileContext
-xmlParserPrintFileInfo
-xmlParserValidityError
-xmlParserValidityWarning
-xmlParserWarning
-xmlPathToURI
-xmlPatternFromRoot
-xmlPatternGetStreamCtxt
-xmlPatternMatch
-xmlPatternMaxDepth
-xmlPatternMinDepth
-xmlPatternStreamable
-xmlPatterncompile
-xmlPedanticParserDefault
-xmlPopInput
-xmlPopInputCallbacks
-xmlPopOutputCallbacks
-xmlPreviousElementSibling
-xmlPrintURI
-xmlPushInput
-xmlRMutexLock
-xmlRMutexUnlock
-xmlReadDoc
-xmlReadFd
-xmlReadFile
-xmlReadIO
-xmlReadMemory
-xmlReaderForDoc
-xmlReaderForFd
-xmlReaderForFile
-xmlReaderForIO
-xmlReaderForMemory
-xmlReaderNewDoc
-xmlReaderNewFd
-xmlReaderNewFile
-xmlReaderNewIO
-xmlReaderNewMemory
-xmlReaderNewWalker
-xmlReaderWalker
-#ifdef DEBUG_MEMORY_LOCATION
-xmlReallocLoc
-#endif
-xmlReconciliateNs
-xmlRecoverDoc
-xmlRecoverFile
-xmlRecoverMemory
-#ifdef LIBXML_REGEXP_ENABLED
-xmlRegExecErrInfo
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlRegExecNextValues
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlRegExecPushString
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlRegExecPushString2
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlRegFreeExecCtxt
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlRegFreeRegexp
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlRegNewExecCtxt
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlRegexpCompile
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlRegexpExec
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlRegexpIsDeterminist
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlRegexpPrint
-#endif
-xmlRegisterCharEncodingHandler
-xmlRegisterDefaultInputCallbacks
-xmlRegisterDefaultOutputCallbacks
-#ifdef LIBXML_HTML_ENABLED
-xmlRegisterHTTPPostCallbacks
-#endif
-xmlRegisterInputCallbacks
-xmlRegisterNodeDefault
-xmlRegisterOutputCallbacks
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlRelaxNGCleanupTypes
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlRelaxNGDump
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlRelaxNGDumpTree
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlRelaxNGFree
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlRelaxNGFreeParserCtxt
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlRelaxNGFreeValidCtxt
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlRelaxNGGetParserErrors
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlRelaxNGGetValidErrors
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlRelaxNGInitTypes
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlRelaxNGNewDocParserCtxt
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlRelaxNGNewMemParserCtxt
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlRelaxNGNewParserCtxt
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlRelaxNGNewValidCtxt
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlRelaxNGParse
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlRelaxNGSetParserErrors
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlRelaxNGSetParserStructuredErrors
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlRelaxNGSetValidErrors
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlRelaxNGSetValidStructuredErrors
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlRelaxNGValidateDoc
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlRelaxNGValidateFullElement
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlRelaxNGValidatePopElement
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlRelaxNGValidatePushCData
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlRelaxNGValidatePushElement
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlRelaxParserSetFlag
-#endif
-xmlRemoveID
-xmlRemoveProp
-xmlRemoveRef
-xmlReplaceNode
-xmlResetError
-xmlResetLastError
-xmlSAX2AttributeDecl
-xmlSAX2CDataBlock
-xmlSAX2Characters
-xmlSAX2Comment
-xmlSAX2ElementDecl
-xmlSAX2EndDocument
-xmlSAX2EndElement
-xmlSAX2EndElementNs
-xmlSAX2EntityDecl
-xmlSAX2ExternalSubset
-xmlSAX2GetColumnNumber
-xmlSAX2GetEntity
-xmlSAX2GetLineNumber
-xmlSAX2GetParameterEntity
-xmlSAX2GetPublicId
-xmlSAX2GetSystemId
-xmlSAX2HasExternalSubset
-xmlSAX2HasInternalSubset
-xmlSAX2IgnorableWhitespace
-xmlSAX2InitDefaultSAXHandler
-xmlSAX2InitHtmlDefaultSAXHandler
-xmlSAX2InternalSubset
-xmlSAX2IsStandalone
-xmlSAX2NotationDecl
-xmlSAX2ProcessingInstruction
-xmlSAX2Reference
-xmlSAX2ResolveEntity
-xmlSAX2SetDocumentLocator
-xmlSAX2StartDocument
-xmlSAX2StartElement
-xmlSAX2StartElementNs
-xmlSAX2UnparsedEntityDecl
-xmlSAXDefaultVersion
-xmlSAXParseDTD
-xmlSAXParseDoc
-xmlSAXParseEntity
-xmlSAXParseFile
-xmlSAXParseFileWithData
-xmlSAXParseMemory
-xmlSAXParseMemoryWithData
-xmlSAXUserParseFile
-xmlSAXUserParseMemory
-xmlSAXVersion
-xmlSaveClose
-xmlSaveDoc
-xmlSaveFile
-xmlSaveFileEnc
-xmlSaveFileTo
-xmlSaveFlush
-xmlSaveFormatFile
-xmlSaveFormatFileEnc
-xmlSaveFormatFileTo
-xmlSaveSetAttrEscape
-xmlSaveSetEscape
-xmlSaveToBuffer
-xmlSaveToFd
-xmlSaveToFilename
-xmlSaveToIO
-xmlSaveTree
-xmlSaveUri
-xmlScanName
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaCheckFacet
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaCleanupTypes
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaCollapseString
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaCompareValues
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaCompareValuesWhtsp
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaCopyValue
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaDump
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaFree
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaFreeFacet
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaFreeParserCtxt
-#endif
-xmlSchemaFreeType
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaFreeValidCtxt
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaFreeValue
-#endif
-xmlSchemaFreeWildcard
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaGetBuiltInListSimpleTypeItemType
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaGetBuiltInType
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaGetCanonValue
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaGetCanonValueWhtsp
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaGetFacetValueAsULong
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaGetParserErrors
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaGetPredefinedType
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaGetValType
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaGetValidErrors
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaInitTypes
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaIsBuiltInTypeFacet
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaIsValid
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaNewDocParserCtxt
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaNewFacet
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaNewMemParserCtxt
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaNewNOTATIONValue
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaNewParserCtxt
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaNewQNameValue
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaNewStringValue
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaNewValidCtxt
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaParse
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaSAXPlug
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaSAXUnplug
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaSetParserErrors
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaSetParserStructuredErrors
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaSetValidErrors
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaSetValidOptions
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaSetValidStructuredErrors
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaValPredefTypeNode
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaValPredefTypeNodeNoNorm
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaValidCtxtGetOptions
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaValidCtxtGetParserCtxt
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaValidateDoc
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaValidateFacet
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaValidateFacetWhtsp
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaValidateFile
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaValidateLengthFacet
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaValidateLengthFacetWhtsp
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaValidateListSimpleTypeFacet
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaValidateOneElement
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaValidatePredefinedType
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaValidateSetFilename
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaValidateSetLocator
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaValidateStream
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaValueAppend
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaValueGetAsBoolean
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaValueGetAsString
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaValueGetNext
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlSchemaWhiteSpaceReplace
-#endif
-xmlSchematronFree
-xmlSchematronFreeParserCtxt
-xmlSchematronFreeValidCtxt
-xmlSchematronNewDocParserCtxt
-xmlSchematronNewMemParserCtxt
-xmlSchematronNewParserCtxt
-xmlSchematronNewValidCtxt
-xmlSchematronParse
-xmlSchematronSetValidStructuredErrors
-xmlSchematronValidateDoc
-xmlSearchNs
-xmlSearchNsByHref
-xmlSetBufferAllocationScheme
-xmlSetCompressMode
-xmlSetDocCompressMode
-xmlSetEntityReferenceFunc
-xmlSetExternalEntityLoader
-xmlSetFeature
-xmlSetGenericErrorFunc
-xmlSetListDoc
-xmlSetNs
-xmlSetNsProp
-xmlSetProp
-xmlSetStructuredErrorFunc
-xmlSetTreeDoc
-xmlSetupParserForBuffer
-#ifdef LIBXML_DEBUG_ENABLED
-xmlShell
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-xmlShellBase
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-xmlShellCat
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-xmlShellDir
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-xmlShellDu
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-xmlShellList
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-xmlShellLoad
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-xmlShellPrintNode
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-xmlShellPrintXPathError
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-xmlShellPrintXPathResult
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-xmlShellPwd
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-xmlShellSave
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-xmlShellValidate
-#endif
-#ifdef LIBXML_DEBUG_ENABLED
-xmlShellWrite
-#endif
-xmlSkipBlankChars
-xmlSnprintfElementContent
-xmlSplitQName
-xmlSplitQName2
-xmlSplitQName3
-xmlSprintfElementContent
-xmlStopParser
-xmlStrEqual
-xmlStrPrintf
-xmlStrQEqual
-xmlStrVPrintf
-xmlStrcasecmp
-xmlStrcasestr
-xmlStrcat
-xmlStrchr
-xmlStrcmp
-xmlStrdup
-xmlStreamPop
-xmlStreamPush
-xmlStreamPushAttr
-xmlStreamPushNode
-xmlStreamWantsAnyNode
-xmlStringCurrentChar
-xmlStringDecodeEntities
-xmlStringGetNodeList
-xmlStringLenDecodeEntities
-xmlStringLenGetNodeList
-xmlStrlen
-xmlStrncasecmp
-xmlStrncat
-xmlStrncatNew
-xmlStrncmp
-xmlStrndup
-xmlStrstr
-xmlStrsub
-xmlSubstituteEntitiesDefault
-xmlSwitchEncoding
-xmlSwitchInputEncoding
-xmlSwitchToEncoding
-xmlTextConcat
-xmlTextMerge
-xmlTextReaderAttributeCount
-xmlTextReaderBaseUri
-xmlTextReaderByteConsumed
-xmlTextReaderClose
-xmlTextReaderConstBaseUri
-xmlTextReaderConstEncoding
-xmlTextReaderConstLocalName
-xmlTextReaderConstName
-xmlTextReaderConstNamespaceUri
-xmlTextReaderConstPrefix
-xmlTextReaderConstString
-xmlTextReaderConstValue
-xmlTextReaderConstXmlLang
-xmlTextReaderConstXmlVersion
-xmlTextReaderCurrentDoc
-xmlTextReaderCurrentNode
-xmlTextReaderDepth
-xmlTextReaderExpand
-xmlTextReaderGetAttribute
-xmlTextReaderGetAttributeNo
-xmlTextReaderGetAttributeNs
-xmlTextReaderGetErrorHandler
-xmlTextReaderGetParserColumnNumber
-xmlTextReaderGetParserLineNumber
-xmlTextReaderGetParserProp
-xmlTextReaderGetRemainder
-xmlTextReaderHasAttributes
-xmlTextReaderHasValue
-xmlTextReaderIsDefault
-xmlTextReaderIsEmptyElement
-xmlTextReaderIsNamespaceDecl
-xmlTextReaderIsValid
-xmlTextReaderLocalName
-xmlTextReaderLocatorBaseURI
-xmlTextReaderLocatorLineNumber
-xmlTextReaderLookupNamespace
-xmlTextReaderMoveToAttribute
-xmlTextReaderMoveToAttributeNo
-xmlTextReaderMoveToAttributeNs
-xmlTextReaderMoveToElement
-xmlTextReaderMoveToFirstAttribute
-xmlTextReaderMoveToNextAttribute
-xmlTextReaderName
-xmlTextReaderNamespaceUri
-xmlTextReaderNext
-xmlTextReaderNextSibling
-xmlTextReaderNodeType
-xmlTextReaderNormalization
-xmlTextReaderPrefix
-xmlTextReaderPreserve
-xmlTextReaderPreservePattern
-xmlTextReaderQuoteChar
-xmlTextReaderRead
-xmlTextReaderReadAttributeValue
-xmlTextReaderReadInnerXml
-xmlTextReaderReadOuterXml
-xmlTextReaderReadState
-xmlTextReaderReadString
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlTextReaderRelaxNGSetSchema
-#endif
-#ifdef LIBXML_SCHEMAS_ENABLED
-xmlTextReaderRelaxNGValidate
-#endif
-xmlTextReaderRelaxNGValidateCtxt
-xmlTextReaderSchemaValidate
-xmlTextReaderSchemaValidateCtxt
-xmlTextReaderSetErrorHandler
-xmlTextReaderSetParserProp
-xmlTextReaderSetSchema
-xmlTextReaderSetStructuredErrorHandler
-xmlTextReaderSetup
-xmlTextReaderStandalone
-xmlTextReaderValue
-xmlTextReaderXmlLang
-xmlTextWriterEndAttribute
-xmlTextWriterEndCDATA
-xmlTextWriterEndComment
-xmlTextWriterEndDTD
-xmlTextWriterEndDTDAttlist
-xmlTextWriterEndDTDElement
-xmlTextWriterEndDTDEntity
-xmlTextWriterEndDocument
-xmlTextWriterEndElement
-xmlTextWriterEndPI
-xmlTextWriterFlush
-xmlTextWriterFullEndElement
-xmlTextWriterSetIndent
-xmlTextWriterSetIndentString
-xmlTextWriterSetQuoteChar
-xmlTextWriterStartAttribute
-xmlTextWriterStartAttributeNS
-xmlTextWriterStartCDATA
-xmlTextWriterStartComment
-xmlTextWriterStartDTD
-xmlTextWriterStartDTDAttlist
-xmlTextWriterStartDTDElement
-xmlTextWriterStartDTDEntity
-xmlTextWriterStartDocument
-xmlTextWriterStartElement
-xmlTextWriterStartElementNS
-xmlTextWriterStartPI
-xmlTextWriterWriteAttribute
-xmlTextWriterWriteAttributeNS
-xmlTextWriterWriteBase64
-xmlTextWriterWriteBinHex
-xmlTextWriterWriteCDATA
-xmlTextWriterWriteComment
-xmlTextWriterWriteDTD
-xmlTextWriterWriteDTDAttlist
-xmlTextWriterWriteDTDElement
-xmlTextWriterWriteDTDEntity
-xmlTextWriterWriteDTDExternalEntity
-xmlTextWriterWriteDTDExternalEntityContents
-xmlTextWriterWriteDTDInternalEntity
-xmlTextWriterWriteDTDNotation
-xmlTextWriterWriteElement
-xmlTextWriterWriteElementNS
-xmlTextWriterWriteFormatAttribute
-xmlTextWriterWriteFormatAttributeNS
-xmlTextWriterWriteFormatCDATA
-xmlTextWriterWriteFormatComment
-xmlTextWriterWriteFormatDTD
-xmlTextWriterWriteFormatDTDAttlist
-xmlTextWriterWriteFormatDTDElement
-xmlTextWriterWriteFormatDTDInternalEntity
-xmlTextWriterWriteFormatElement
-xmlTextWriterWriteFormatElementNS
-xmlTextWriterWriteFormatPI
-xmlTextWriterWriteFormatRaw
-xmlTextWriterWriteFormatString
-xmlTextWriterWritePI
-xmlTextWriterWriteRaw
-xmlTextWriterWriteRawLen
-xmlTextWriterWriteString
-xmlTextWriterWriteVFormatAttribute
-xmlTextWriterWriteVFormatAttributeNS
-xmlTextWriterWriteVFormatCDATA
-xmlTextWriterWriteVFormatComment
-xmlTextWriterWriteVFormatDTD
-xmlTextWriterWriteVFormatDTDAttlist
-xmlTextWriterWriteVFormatDTDElement
-xmlTextWriterWriteVFormatDTDInternalEntity
-xmlTextWriterWriteVFormatElement
-xmlTextWriterWriteVFormatElementNS
-xmlTextWriterWriteVFormatPI
-xmlTextWriterWriteVFormatRaw
-xmlTextWriterWriteVFormatString
-xmlThrDefBufferAllocScheme
-xmlThrDefDefaultBufferSize
-xmlThrDefDeregisterNodeDefault
-xmlThrDefDoValidityCheckingDefaultValue
-xmlThrDefGetWarningsDefaultValue
-xmlThrDefIndentTreeOutput
-xmlThrDefKeepBlanksDefaultValue
-xmlThrDefLineNumbersDefaultValue
-xmlThrDefLoadExtDtdDefaultValue
-xmlThrDefOutputBufferCreateFilenameDefault
-xmlThrDefParserDebugEntities
-xmlThrDefParserInputBufferCreateFilenameDefault
-xmlThrDefPedanticParserDefaultValue
-xmlThrDefRegisterNodeDefault
-xmlThrDefSaveNoEmptyTags
-xmlThrDefSetGenericErrorFunc
-xmlThrDefSetStructuredErrorFunc
-xmlThrDefSubstituteEntitiesDefaultValue
-xmlThrDefTreeIndentString
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsAegeanNumbers
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsAlphabeticPresentationForms
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsArabic
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsArabicPresentationFormsA
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsArabicPresentationFormsB
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsArmenian
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsArrows
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsBasicLatin
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsBengali
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsBlock
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsBlockElements
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsBopomofo
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsBopomofoExtended
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsBoxDrawing
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsBraillePatterns
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsBuhid
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsByzantineMusicalSymbols
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCJKCompatibility
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCJKCompatibilityForms
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCJKCompatibilityIdeographs
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCJKCompatibilityIdeographsSupplement
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCJKRadicalsSupplement
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCJKSymbolsandPunctuation
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCJKUnifiedIdeographs
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCJKUnifiedIdeographsExtensionA
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCJKUnifiedIdeographsExtensionB
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCat
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatC
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatCc
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatCf
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatCo
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatCs
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatL
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatLl
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatLm
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatLo
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatLt
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatLu
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatM
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatMc
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatMe
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatMn
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatN
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatNd
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatNl
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatNo
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatP
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatPc
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatPd
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatPe
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatPf
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatPi
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatPo
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatPs
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatS
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatSc
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatSk
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatSm
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatSo
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatZ
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatZl
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatZp
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCatZs
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCherokee
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCombiningDiacriticalMarks
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCombiningDiacriticalMarksforSymbols
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCombiningHalfMarks
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCombiningMarksforSymbols
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsControlPictures
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCurrencySymbols
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCypriotSyllabary
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCyrillic
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsCyrillicSupplement
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsDeseret
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsDevanagari
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsDingbats
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsEnclosedAlphanumerics
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsEnclosedCJKLettersandMonths
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsEthiopic
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsGeneralPunctuation
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsGeometricShapes
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsGeorgian
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsGothic
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsGreek
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsGreekExtended
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsGreekandCoptic
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsGujarati
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsGurmukhi
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsHalfwidthandFullwidthForms
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsHangulCompatibilityJamo
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsHangulJamo
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsHangulSyllables
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsHanunoo
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsHebrew
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsHighPrivateUseSurrogates
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsHighSurrogates
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsHiragana
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsIPAExtensions
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsIdeographicDescriptionCharacters
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsKanbun
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsKangxiRadicals
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsKannada
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsKatakana
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsKatakanaPhoneticExtensions
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsKhmer
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsKhmerSymbols
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsLao
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsLatin1Supplement
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsLatinExtendedA
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsLatinExtendedAdditional
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsLatinExtendedB
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsLetterlikeSymbols
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsLimbu
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsLinearBIdeograms
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsLinearBSyllabary
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsLowSurrogates
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsMalayalam
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsMathematicalAlphanumericSymbols
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsMathematicalOperators
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsMiscellaneousMathematicalSymbolsA
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsMiscellaneousMathematicalSymbolsB
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsMiscellaneousSymbols
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsMiscellaneousSymbolsandArrows
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsMiscellaneousTechnical
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsMongolian
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsMusicalSymbols
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsMyanmar
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsNumberForms
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsOgham
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsOldItalic
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsOpticalCharacterRecognition
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsOriya
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsOsmanya
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsPhoneticExtensions
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsPrivateUse
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsPrivateUseArea
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsRunic
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsShavian
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsSinhala
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsSmallFormVariants
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsSpacingModifierLetters
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsSpecials
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsSuperscriptsandSubscripts
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsSupplementalArrowsA
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsSupplementalArrowsB
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsSupplementalMathematicalOperators
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsSupplementaryPrivateUseAreaA
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsSupplementaryPrivateUseAreaB
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsSyriac
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsTagalog
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsTagbanwa
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsTags
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsTaiLe
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsTaiXuanJingSymbols
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsTamil
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsTelugu
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsThaana
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsThai
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsTibetan
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsUgaritic
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsUnifiedCanadianAboriginalSyllabics
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsVariationSelectors
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsVariationSelectorsSupplement
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsYiRadicals
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsYiSyllables
-#endif
-#ifdef LIBXML_REGEXP_ENABLED
-xmlUCSIsYijingHexagramSymbols
-#endif
-xmlURIEscape
-xmlURIEscapeStr
-xmlURIUnescapeString
-xmlUTF8Charcmp
-xmlUTF8Size
-xmlUTF8Strlen
-xmlUTF8Strloc
-xmlUTF8Strndup
-xmlUTF8Strpos
-xmlUTF8Strsize
-xmlUTF8Strsub
-xmlUnlinkNode
-xmlUnlockLibrary
-xmlUnsetNsProp
-xmlUnsetProp
-#ifdef LIBXML_REGEXP_ENABLED
-xmlValidBuildContentModel
-#endif
-xmlValidCtxtNormalizeAttributeValue
-xmlValidGetPotentialChildren
-xmlValidGetValidElements
-xmlValidNormalizeAttributeValue
-xmlValidateAttributeDecl
-xmlValidateAttributeValue
-xmlValidateDocument
-xmlValidateDocumentFinal
-xmlValidateDtd
-xmlValidateDtdFinal
-xmlValidateElement
-xmlValidateElementDecl
-xmlValidateNCName
-xmlValidateNMToken
-xmlValidateName
-xmlValidateNameValue
-xmlValidateNamesValue
-xmlValidateNmtokenValue
-xmlValidateNmtokensValue
-xmlValidateNotationDecl
-xmlValidateNotationUse
-xmlValidateOneAttribute
-xmlValidateOneElement
-xmlValidateOneNamespace
-xmlValidatePopElement
-xmlValidatePushCData
-xmlValidatePushElement
-xmlValidateQName
-xmlValidateRoot
-#ifdef LIBXML_XINCLUDE_ENABLED
-xmlXIncludeFreeContext
-#endif
-#ifdef LIBXML_XINCLUDE_ENABLED
-xmlXIncludeNewContext
-#endif
-#ifdef LIBXML_XINCLUDE_ENABLED
-xmlXIncludeProcess
-#endif
-#ifdef LIBXML_XINCLUDE_ENABLED
-xmlXIncludeProcessFlags
-#endif
-#ifdef LIBXML_XINCLUDE_ENABLED
-xmlXIncludeProcessFlagsData
-#endif
-#ifdef LIBXML_XINCLUDE_ENABLED
-xmlXIncludeProcessNode
-#endif
-#ifdef LIBXML_XINCLUDE_ENABLED
-xmlXIncludeProcessTree
-#endif
-#ifdef LIBXML_XINCLUDE_ENABLED
-xmlXIncludeProcessTreeFlags
-#endif
-#ifdef LIBXML_XINCLUDE_ENABLED
-xmlXIncludeProcessTreeFlagsData
-#endif
-#ifdef LIBXML_XINCLUDE_ENABLED
-xmlXIncludeSetFlags
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathAddValues
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathBooleanFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathCastBooleanToNumber
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathCastBooleanToString
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathCastNodeSetToBoolean
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathCastNodeSetToNumber
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathCastNodeSetToString
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathCastNodeToNumber
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathCastNodeToString
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathCastNumberToBoolean
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathCastNumberToString
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathCastStringToBoolean
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathCastStringToNumber
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathCastToBoolean
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathCastToNumber
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathCastToString
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathCeilingFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathCmpNodes
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathCompareValues
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathCompile
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathCompiledEval
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathCompiledEvalToBoolean
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathConcatFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathContainsFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathContextSetCache
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathConvertBoolean
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathConvertNumber
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathConvertString
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathCountFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathCtxtCompile
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-#ifdef LIBXML_DEBUG_ENABLED
-xmlXPathDebugDumpCompExpr
-#endif
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-#ifdef LIBXML_DEBUG_ENABLED
-xmlXPathDebugDumpObject
-#endif
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathDifference
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathDistinct
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathDistinctSorted
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathDivValues
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathEqualValues
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathErr
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathEval
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathEvalExpr
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathEvalExpression
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathEvalPredicate
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathEvaluatePredicateResult
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathFalseFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathFloorFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathFreeCompExpr
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathFreeContext
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathFreeNodeSet
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathFreeNodeSetList
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathFreeObject
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathFreeParserContext
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathFunctionLookup
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathFunctionLookupNS
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathHasSameNodes
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathIdFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathInit
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathIntersection
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathIsInf
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathIsNaN
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathIsNodeType
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathLangFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathLastFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathLeading
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathLeadingSorted
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathLocalNameFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathModValues
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathMultValues
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNamespaceURIFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNewBoolean
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNewCString
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNewContext
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNewFloat
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNewNodeSet
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNewNodeSetList
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNewParserContext
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNewString
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNewValueTree
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNextAncestor
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNextAncestorOrSelf
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNextAttribute
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNextChild
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNextDescendant
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNextDescendantOrSelf
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNextFollowing
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNextFollowingSibling
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNextNamespace
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNextParent
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNextPreceding
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNextPrecedingSibling
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNextSelf
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNodeEval
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNodeLeading
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNodeLeadingSorted
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNodeSetAdd
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNodeSetAddNs
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNodeSetAddUnique
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNodeSetContains
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNodeSetCreate
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNodeSetDel
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNodeSetFreeNs
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNodeSetMerge
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNodeSetRemove
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNodeSetSort
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNodeTrailing
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNodeTrailingSorted
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNormalizeFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNotEqualValues
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNotFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNsLookup
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathNumberFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathObjectCopy
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathOrderDocElems
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathParseNCName
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathParseName
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathPopBoolean
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathPopExternal
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathPopNodeSet
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathPopNumber
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathPopString
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathPositionFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathRegisterAllFunctions
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathRegisterFunc
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathRegisterFuncLookup
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathRegisterFuncNS
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathRegisterNs
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathRegisterVariable
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathRegisterVariableLookup
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathRegisterVariableNS
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathRegisteredFuncsCleanup
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathRegisteredNsCleanup
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathRegisteredVariablesCleanup
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathRoot
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathRoundFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathSetContextNode
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathStartsWithFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathStringEvalNumber
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathStringFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathStringLengthFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathSubValues
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathSubstringAfterFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathSubstringBeforeFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathSubstringFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathSumFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathTrailing
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathTrailingSorted
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathTranslateFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathTrueFunction
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathValueFlipSign
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathVariableLookup
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathVariableLookupNS
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathWrapCString
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathWrapExternal
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathWrapNodeSet
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPathWrapString
-#endif
-#ifdef LIBXML_XPATH_ENABLED
-xmlXPatherror
-#endif
-#ifdef LIBXML_XPTR_ENABLED
-xmlXPtrBuildNodeList
-#endif
-#ifdef LIBXML_XPTR_ENABLED
-xmlXPtrEval
-#endif
-#ifdef LIBXML_XPTR_ENABLED
-xmlXPtrEvalRangePredicate
-#endif
-#ifdef LIBXML_XPTR_ENABLED
-xmlXPtrFreeLocationSet
-#endif
-#ifdef LIBXML_XPTR_ENABLED
-xmlXPtrLocationSetAdd
-#endif
-#ifdef LIBXML_XPTR_ENABLED
-xmlXPtrLocationSetCreate
-#endif
-#ifdef LIBXML_XPTR_ENABLED
-xmlXPtrLocationSetDel
-#endif
-#ifdef LIBXML_XPTR_ENABLED
-xmlXPtrLocationSetMerge
-#endif
-#ifdef LIBXML_XPTR_ENABLED
-xmlXPtrLocationSetRemove
-#endif
-#ifdef LIBXML_XPTR_ENABLED
-xmlXPtrNewCollapsedRange
-#endif
-#ifdef LIBXML_XPTR_ENABLED
-xmlXPtrNewContext
-#endif
-#ifdef LIBXML_XPTR_ENABLED
-xmlXPtrNewLocationSetNodeSet
-#endif
-#ifdef LIBXML_XPTR_ENABLED
-xmlXPtrNewLocationSetNodes
-#endif
-#ifdef LIBXML_XPTR_ENABLED
-xmlXPtrNewRange
-#endif
-#ifdef LIBXML_XPTR_ENABLED
-xmlXPtrNewRangeNodeObject
-#endif
-#ifdef LIBXML_XPTR_ENABLED
-xmlXPtrNewRangeNodePoint
-#endif
-#ifdef LIBXML_XPTR_ENABLED
-xmlXPtrNewRangeNodes
-#endif
-#ifdef LIBXML_XPTR_ENABLED
-xmlXPtrNewRangePointNode
-#endif
-#ifdef LIBXML_XPTR_ENABLED
-xmlXPtrNewRangePoints
-#endif
-#ifdef LIBXML_XPTR_ENABLED
-xmlXPtrRangeToFunction
-#endif
-#ifdef LIBXML_XPTR_ENABLED
-xmlXPtrWrapLocationSet
-#endif
index 0c6b3f2..09c1eef 100644 (file)
 #ifdef LIBXML_XINCLUDE_ENABLED
 #include <libxml/xinclude.h>
 
-#include "buf.h"
+#include "private/buf.h"
+#include "private/error.h"
+#include "private/tree.h"
+#include "private/xinclude.h"
 
 #define XINCLUDE_MAX_DEPTH 40
 
@@ -54,45 +57,67 @@ typedef xmlXIncludeRef *xmlXIncludeRefPtr;
 struct _xmlXIncludeRef {
     xmlChar              *URI; /* the fully resolved resource URL */
     xmlChar         *fragment; /* the fragment in the URI */
-    xmlDocPtr            doc; /* the parsed document */
-    xmlNodePtr            ref; /* the node making the reference in the source */
+    xmlNodePtr           elem; /* the xi:include element */
     xmlNodePtr            inc; /* the included copy */
     int                   xml; /* xml or txt */
-    int                 count; /* how many refs use that specific doc */
     int                     fallback; /* fallback was loaded */
     int                      emptyFb; /* flag to show fallback empty */
+    int                    expanding; /* flag to detect inclusion loops */
+    int                      replace; /* should the node be replaced? */
+};
+
+typedef struct _xmlXIncludeDoc xmlXIncludeDoc;
+typedef xmlXIncludeDoc *xmlXIncludeDocPtr;
+struct _xmlXIncludeDoc {
+    xmlDocPtr             doc; /* the parsed document */
+    xmlChar              *url; /* the URL */
+    int             expanding; /* flag to detect inclusion loops */
+};
+
+typedef struct _xmlXIncludeTxt xmlXIncludeTxt;
+typedef xmlXIncludeTxt *xmlXIncludeTxtPtr;
+struct _xmlXIncludeTxt {
+    xmlChar            *text; /* text string */
+    xmlChar              *url; /* the URL */
 };
 
 struct _xmlXIncludeCtxt {
     xmlDocPtr             doc; /* the source document */
-    int               incBase; /* the first include for this document */
     int                 incNr; /* number of includes */
     int                incMax; /* size of includes tab */
     xmlXIncludeRefPtr *incTab; /* array of included references */
 
     int                 txtNr; /* number of unparsed documents */
     int                txtMax; /* size of unparsed documents tab */
-    xmlChar *         *txtTab; /* array of unparsed text strings */
-    xmlURL         *txturlTab; /* array of unparsed text URLs */
+    xmlXIncludeTxt    *txtTab; /* array of unparsed documents */
 
-    xmlChar *             url; /* the current URL processed */
-    int                 urlNr; /* number of URLs stacked */
-    int                urlMax; /* size of URL stack */
-    xmlChar *         *urlTab; /* URL stack */
+    int                 urlNr; /* number of documents stacked */
+    int                urlMax; /* size of document stack */
+    xmlXIncludeDoc    *urlTab; /* document stack */
 
     int              nbErrors; /* the number of errors detected */
+    int              fatalErr; /* abort processing */
     int                legacy; /* using XINCLUDE_OLD_NS */
     int            parseFlags; /* the flags used for parsing XML documents */
     xmlChar *           base; /* the current xml:base */
 
     void            *_private; /* application data */
 
+#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
     unsigned long    incTotal; /* total number of processed inclusions */
+#endif
+    int                        depth; /* recursion depth */
+    int                     isStream; /* streaming mode */
 };
 
+static xmlXIncludeRefPtr
+xmlXIncludeExpandNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr node);
+
 static int
-xmlXIncludeDoProcess(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr tree,
-                     int skipRoot);
+xmlXIncludeLoadNode(xmlXIncludeCtxtPtr ctxt, xmlXIncludeRefPtr ref);
+
+static int
+xmlXIncludeDoProcess(xmlXIncludeCtxtPtr ctxt, xmlNodePtr tree);
 
 
 /************************************************************************
@@ -200,12 +225,6 @@ xmlXIncludeFreeRef(xmlXIncludeRefPtr ref) {
 #ifdef DEBUG_XINCLUDE
     xmlGenericError(xmlGenericErrorContext, "Freeing ref\n");
 #endif
-    if (ref->doc != NULL) {
-#ifdef DEBUG_XINCLUDE
-       xmlGenericError(xmlGenericErrorContext, "Freeing doc %s\n", ref->URI);
-#endif
-       xmlFreeDoc(ref->doc);
-    }
     if (ref->URI != NULL)
        xmlFree(ref->URI);
     if (ref->fragment != NULL)
@@ -217,6 +236,7 @@ xmlXIncludeFreeRef(xmlXIncludeRefPtr ref) {
  * xmlXIncludeNewRef:
  * @ctxt: the XInclude context
  * @URI:  the resource URI
+ * @elem:  the xi:include element
  *
  * Creates a new reference within an XInclude context
  *
@@ -224,7 +244,7 @@ xmlXIncludeFreeRef(xmlXIncludeRefPtr ref) {
  */
 static xmlXIncludeRefPtr
 xmlXIncludeNewRef(xmlXIncludeCtxtPtr ctxt, const xmlChar *URI,
-                 xmlNodePtr ref) {
+                 xmlNodePtr elem) {
     xmlXIncludeRefPtr ret;
 
 #ifdef DEBUG_XINCLUDE
@@ -232,7 +252,7 @@ xmlXIncludeNewRef(xmlXIncludeCtxtPtr ctxt, const xmlChar *URI,
 #endif
     ret = (xmlXIncludeRefPtr) xmlMalloc(sizeof(xmlXIncludeRef));
     if (ret == NULL) {
-        xmlXIncludeErrMemory(ctxt, ref, "growing XInclude context");
+        xmlXIncludeErrMemory(ctxt, elem, "growing XInclude context");
        return(NULL);
     }
     memset(ret, 0, sizeof(xmlXIncludeRef));
@@ -241,9 +261,7 @@ xmlXIncludeNewRef(xmlXIncludeCtxtPtr ctxt, const xmlChar *URI,
     else
        ret->URI = xmlStrdup(URI);
     ret->fragment = NULL;
-    ret->ref = ref;
-    ret->doc = NULL;
-    ret->count = 0;
+    ret->elem = elem;
     ret->xml = 0;
     ret->inc = NULL;
     if (ctxt->incMax == 0) {
@@ -251,20 +269,24 @@ xmlXIncludeNewRef(xmlXIncludeCtxtPtr ctxt, const xmlChar *URI,
         ctxt->incTab = (xmlXIncludeRefPtr *) xmlMalloc(ctxt->incMax *
                                              sizeof(ctxt->incTab[0]));
         if (ctxt->incTab == NULL) {
-           xmlXIncludeErrMemory(ctxt, ref, "growing XInclude context");
+           xmlXIncludeErrMemory(ctxt, elem, "growing XInclude context");
            xmlXIncludeFreeRef(ret);
            return(NULL);
        }
     }
     if (ctxt->incNr >= ctxt->incMax) {
-       ctxt->incMax *= 2;
-        ctxt->incTab = (xmlXIncludeRefPtr *) xmlRealloc(ctxt->incTab,
-                    ctxt->incMax * sizeof(ctxt->incTab[0]));
-        if (ctxt->incTab == NULL) {
-           xmlXIncludeErrMemory(ctxt, ref, "growing XInclude context");
+        xmlXIncludeRefPtr *tmp;
+        size_t newSize = ctxt->incMax * 2;
+
+        tmp = (xmlXIncludeRefPtr *) xmlRealloc(ctxt->incTab,
+                    newSize * sizeof(ctxt->incTab[0]));
+        if (tmp == NULL) {
+           xmlXIncludeErrMemory(ctxt, elem, "growing XInclude context");
            xmlXIncludeFreeRef(ret);
            return(NULL);
        }
+        ctxt->incTab = tmp;
+        ctxt->incMax *= 2;
     }
     ctxt->incTab[ctxt->incNr++] = ret;
     return(ret);
@@ -296,7 +318,6 @@ xmlXIncludeNewContext(xmlDocPtr doc) {
     memset(ret, 0, sizeof(xmlXIncludeCtxt));
     ret->doc = doc;
     ret->incNr = 0;
-    ret->incBase = 0;
     ret->incMax = 0;
     ret->incTab = NULL;
     ret->nbErrors = 0;
@@ -304,73 +325,6 @@ xmlXIncludeNewContext(xmlDocPtr doc) {
 }
 
 /**
- * xmlXIncludeURLPush:
- * @ctxt:  the parser context
- * @value:  the url
- *
- * Pushes a new url on top of the url stack
- *
- * Returns -1 in case of error, the index in the stack otherwise
- */
-static int
-xmlXIncludeURLPush(xmlXIncludeCtxtPtr ctxt,
-                  const xmlChar *value)
-{
-    if (ctxt->urlNr > XINCLUDE_MAX_DEPTH) {
-       xmlXIncludeErr(ctxt, NULL, XML_XINCLUDE_RECURSION,
-                      "detected a recursion in %s\n", value);
-       return(-1);
-    }
-    if (ctxt->urlTab == NULL) {
-       ctxt->urlMax = 4;
-       ctxt->urlNr = 0;
-       ctxt->urlTab = (xmlChar * *) xmlMalloc(
-                       ctxt->urlMax * sizeof(ctxt->urlTab[0]));
-        if (ctxt->urlTab == NULL) {
-           xmlXIncludeErrMemory(ctxt, NULL, "adding URL");
-            return (-1);
-        }
-    }
-    if (ctxt->urlNr >= ctxt->urlMax) {
-        ctxt->urlMax *= 2;
-        ctxt->urlTab =
-            (xmlChar * *) xmlRealloc(ctxt->urlTab,
-                                      ctxt->urlMax *
-                                      sizeof(ctxt->urlTab[0]));
-        if (ctxt->urlTab == NULL) {
-           xmlXIncludeErrMemory(ctxt, NULL, "adding URL");
-            return (-1);
-        }
-    }
-    ctxt->url = ctxt->urlTab[ctxt->urlNr] = xmlStrdup(value);
-    return (ctxt->urlNr++);
-}
-
-/**
- * xmlXIncludeURLPop:
- * @ctxt: the parser context
- *
- * Pops the top URL from the URL stack
- */
-static void
-xmlXIncludeURLPop(xmlXIncludeCtxtPtr ctxt)
-{
-    xmlChar * ret;
-
-    if (ctxt->urlNr <= 0)
-        return;
-    ctxt->urlNr--;
-    if (ctxt->urlNr > 0)
-        ctxt->url = ctxt->urlTab[ctxt->urlNr - 1];
-    else
-        ctxt->url = NULL;
-    ret = ctxt->urlTab[ctxt->urlNr];
-    ctxt->urlTab[ctxt->urlNr] = NULL;
-    if (ret != NULL)
-       xmlFree(ret);
-}
-
-/**
  * xmlXIncludeFreeContext:
  * @ctxt: the XInclude context
  *
@@ -385,10 +339,13 @@ xmlXIncludeFreeContext(xmlXIncludeCtxtPtr ctxt) {
 #endif
     if (ctxt == NULL)
        return;
-    while (ctxt->urlNr > 0)
-       xmlXIncludeURLPop(ctxt);
-    if (ctxt->urlTab != NULL)
+    if (ctxt->urlTab != NULL) {
+       for (i = 0; i < ctxt->urlNr; i++) {
+           xmlFreeDoc(ctxt->urlTab[i].doc);
+           xmlFree(ctxt->urlTab[i].url);
+       }
        xmlFree(ctxt->urlTab);
+    }
     for (i = 0;i < ctxt->incNr;i++) {
        if (ctxt->incTab[i] != NULL)
            xmlXIncludeFreeRef(ctxt->incTab[i]);
@@ -397,18 +354,11 @@ xmlXIncludeFreeContext(xmlXIncludeCtxtPtr ctxt) {
        xmlFree(ctxt->incTab);
     if (ctxt->txtTab != NULL) {
        for (i = 0;i < ctxt->txtNr;i++) {
-           if (ctxt->txtTab[i] != NULL)
-               xmlFree(ctxt->txtTab[i]);
+           xmlFree(ctxt->txtTab[i].text);
+           xmlFree(ctxt->txtTab[i].url);
        }
        xmlFree(ctxt->txtTab);
     }
-    if (ctxt->txturlTab != NULL) {
-       for (i = 0;i < ctxt->txtNr;i++) {
-           if (ctxt->txturlTab[i] != NULL)
-               xmlFree(ctxt->txturlTab[i]);
-       }
-       xmlFree(ctxt->txturlTab);
-    }
     if (ctxt->base != NULL) {
         xmlFree(ctxt->base);
     }
@@ -494,7 +444,7 @@ xmlXIncludeParseFile(xmlXIncludeCtxtPtr ctxt, const char *URL) {
  *
  * Add a new node to process to an XInclude context
  */
-static int
+static xmlXIncludeRefPtr
 xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr cur) {
     xmlXIncludeRefPtr ref;
     xmlURIPtr uri;
@@ -504,14 +454,14 @@ xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr cur) {
     xmlChar *parse;
     xmlChar *base;
     xmlChar *URI;
-    int xml = 1, i; /* default Issue 64 */
+    int xml = 1;
     int local = 0;
 
 
     if (ctxt == NULL)
-       return(-1);
+       return(NULL);
     if (cur == NULL)
-       return(-1);
+       return(NULL);
 
 #ifdef DEBUG_XINCLUDE
     xmlGenericError(xmlGenericErrorContext, "Add node\n");
@@ -523,7 +473,7 @@ xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr cur) {
     if (href == NULL) {
        href = xmlStrdup(BAD_CAST ""); /* @@@@ href is now optional */
        if (href == NULL)
-           return(-1);
+           return(NULL);
     }
     parse = xmlXIncludeGetProp(ctxt, cur, XINCLUDE_PARSE);
     if (parse != NULL) {
@@ -538,7 +488,7 @@ xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr cur) {
                xmlFree(href);
            if (parse != NULL)
                xmlFree(parse);
-           return(-1);
+           return(NULL);
        }
     }
 
@@ -574,7 +524,7 @@ xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr cur) {
     if (URI == NULL) {
        xmlXIncludeErr(ctxt, cur, XML_XINCLUDE_HREF_URI,
                       "failed build URL\n", NULL);
-       return(-1);
+       return(NULL);
     }
     fragment = xmlXIncludeGetProp(ctxt, cur, XINCLUDE_PARSE_XPOINTER);
 
@@ -588,7 +538,7 @@ xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr cur) {
        if (fragment != NULL)
            xmlFree(fragment);
        xmlFree(URI);
-       return(-1);
+       return(NULL);
     }
 
     if (uri->fragment != NULL) {
@@ -606,20 +556,21 @@ xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr cur) {
                xmlFree(fragment);
            xmlFreeURI(uri);
            xmlFree(URI);
-           return(-1);
+           return(NULL);
        }
        uri->fragment = NULL;
     }
     URL = xmlSaveUri(uri);
     xmlFreeURI(uri);
-    xmlFree(URI);
     if (URL == NULL) {
        xmlXIncludeErr(ctxt, cur, XML_XINCLUDE_HREF_URI,
                       "invalid value URI %s\n", URI);
        if (fragment != NULL)
            xmlFree(fragment);
-       return(-1);
+        xmlFree(URI);
+       return(NULL);
     }
+    xmlFree(URI);
 
     if (xmlStrEqual(URL, ctxt->doc->URL))
        local = 1;
@@ -634,34 +585,18 @@ xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr cur) {
                       URL);
         xmlFree(URL);
         xmlFree(fragment);
-       return(-1);
-    }
-
-    /*
-     * Check the URL against the stack for recursions
-     */
-    if ((!local) && (xml == 1)) {
-       for (i = 0;i < ctxt->urlNr;i++) {
-           if (xmlStrEqual(URL, ctxt->urlTab[i])) {
-               xmlXIncludeErr(ctxt, cur, XML_XINCLUDE_RECURSION,
-                              "detected a recursion in %s\n", URL);
-                xmlFree(URL);
-                xmlFree(fragment);
-               return(-1);
-           }
-       }
+       return(NULL);
     }
 
     ref = xmlXIncludeNewRef(ctxt, URL, cur);
     xmlFree(URL);
     if (ref == NULL) {
-       return(-1);
+        xmlFree(fragment);
+       return(NULL);
     }
     ref->fragment = fragment;
-    ref->doc = NULL;
     ref->xml = xml;
-    ref->count = 1;
-    return(0);
+    return(ref);
 }
 
 /**
@@ -675,138 +610,35 @@ xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr cur) {
 static void
 xmlXIncludeRecurseDoc(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc,
                      const xmlURL url ATTRIBUTE_UNUSED) {
-    xmlXIncludeCtxtPtr newctxt;
+    xmlDocPtr oldDoc;
+    xmlXIncludeRefPtr *oldIncTab;
+    int oldIncMax, oldIncNr, oldIsStream;
     int i;
 
-    /*
-     * Avoid recursion in already substituted resources
-    for (i = 0;i < ctxt->urlNr;i++) {
-       if (xmlStrEqual(doc->URL, ctxt->urlTab[i]))
-           return;
-    }
-     */
-
-#ifdef DEBUG_XINCLUDE
-    xmlGenericError(xmlGenericErrorContext, "Recursing in doc %s\n", doc->URL);
-#endif
-    /*
-     * Handle recursion here.
-     */
-
-    newctxt = xmlXIncludeNewContext(doc);
-    if (newctxt != NULL) {
-       /*
-        * Copy the private user data
-        */
-       newctxt->_private = ctxt->_private;
-       /*
-        * Copy the existing document set
-        */
-       newctxt->incMax = ctxt->incMax;
-       newctxt->incNr = ctxt->incNr;
-        newctxt->incTab = (xmlXIncludeRefPtr *) xmlMalloc(newctxt->incMax *
-                                         sizeof(newctxt->incTab[0]));
-        if (newctxt->incTab == NULL) {
-           xmlXIncludeErrMemory(ctxt, (xmlNodePtr) doc, "processing doc");
-           xmlFree(newctxt);
-           return;
-       }
-       /*
-        * copy the urlTab
-        */
-       newctxt->urlMax = ctxt->urlMax;
-       newctxt->urlNr = ctxt->urlNr;
-       newctxt->urlTab = ctxt->urlTab;
-
-       /*
-        * Inherit the existing base
-        */
-       newctxt->base = xmlStrdup(ctxt->base);
-
-       /*
-        * Inherit the documents already in use by other includes
-        */
-       newctxt->incBase = ctxt->incNr;
-       for (i = 0;i < ctxt->incNr;i++) {
-           newctxt->incTab[i] = ctxt->incTab[i];
-           newctxt->incTab[i]->count++; /* prevent the recursion from
-                                           freeing it */
-       }
-       /*
-        * The new context should also inherit the Parse Flags
-        * (bug 132597)
-        */
-       newctxt->parseFlags = ctxt->parseFlags;
-        newctxt->incTotal = ctxt->incTotal;
-       xmlXIncludeDoProcess(newctxt, doc, xmlDocGetRootElement(doc), 0);
-        ctxt->incTotal = newctxt->incTotal;
-       for (i = 0;i < ctxt->incNr;i++) {
-           newctxt->incTab[i]->count--;
-           newctxt->incTab[i] = NULL;
-       }
-
-       /* urlTab may have been reallocated */
-       ctxt->urlTab = newctxt->urlTab;
-       ctxt->urlMax = newctxt->urlMax;
-
-       newctxt->urlMax = 0;
-       newctxt->urlNr = 0;
-       newctxt->urlTab = NULL;
-
-       xmlXIncludeFreeContext(newctxt);
-    }
-#ifdef DEBUG_XINCLUDE
-    xmlGenericError(xmlGenericErrorContext, "Done recursing in doc %s\n", url);
-#endif
-}
-
-/**
- * xmlXIncludeAddTxt:
- * @ctxt:  the XInclude context
- * @txt:  the new text node
- * @url:  the associated URL
- *
- * Add a new text node to the list
- */
-static void
-xmlXIncludeAddTxt(xmlXIncludeCtxtPtr ctxt, const xmlChar *txt,
-                  const xmlURL url) {
-#ifdef DEBUG_XINCLUDE
-    xmlGenericError(xmlGenericErrorContext, "Adding text %s\n", url);
-#endif
-    if (ctxt->txtMax == 0) {
-       ctxt->txtMax = 4;
-        ctxt->txtTab = (xmlChar **) xmlMalloc(ctxt->txtMax *
-                                         sizeof(ctxt->txtTab[0]));
-        if (ctxt->txtTab == NULL) {
-           xmlXIncludeErrMemory(ctxt, NULL, "processing text");
-           return;
-       }
-        ctxt->txturlTab = (xmlURL *) xmlMalloc(ctxt->txtMax *
-                                         sizeof(ctxt->txturlTab[0]));
-        if (ctxt->txturlTab == NULL) {
-           xmlXIncludeErrMemory(ctxt, NULL, "processing text");
-           return;
-       }
-    }
-    if (ctxt->txtNr >= ctxt->txtMax) {
-       ctxt->txtMax *= 2;
-        ctxt->txtTab = (xmlChar **) xmlRealloc(ctxt->txtTab,
-                    ctxt->txtMax * sizeof(ctxt->txtTab[0]));
-        if (ctxt->txtTab == NULL) {
-           xmlXIncludeErrMemory(ctxt, NULL, "processing text");
-           return;
-       }
-        ctxt->txturlTab = (xmlURL *) xmlRealloc(ctxt->txturlTab,
-                    ctxt->txtMax * sizeof(ctxt->txturlTab[0]));
-        if (ctxt->txturlTab == NULL) {
-           xmlXIncludeErrMemory(ctxt, NULL, "processing text");
-           return;
-       }
-    }
-    ctxt->txtTab[ctxt->txtNr] = xmlStrdup(txt);
-    ctxt->txturlTab[ctxt->txtNr] = xmlStrdup(url);
-    ctxt->txtNr++;
+    oldDoc = ctxt->doc;
+    oldIncMax = ctxt->incMax;
+    oldIncNr = ctxt->incNr;
+    oldIncTab = ctxt->incTab;
+    oldIsStream = ctxt->isStream;
+    ctxt->doc = doc;
+    ctxt->incMax = 0;
+    ctxt->incNr = 0;
+    ctxt->incTab = NULL;
+    ctxt->isStream = 0;
+
+    xmlXIncludeDoProcess(ctxt, xmlDocGetRootElement(doc));
+
+    if (ctxt->incTab != NULL) {
+        for (i = 0; i < ctxt->incNr; i++)
+            xmlXIncludeFreeRef(ctxt->incTab[i]);
+        xmlFree(ctxt->incTab);
+    }
+
+    ctxt->doc = oldDoc;
+    ctxt->incMax = oldIncMax;
+    ctxt->incNr = oldIncNr;
+    ctxt->incTab = oldIncTab;
+    ctxt->isStream = oldIsStream;
 }
 
 /************************************************************************
@@ -815,70 +647,106 @@ xmlXIncludeAddTxt(xmlXIncludeCtxtPtr ctxt, const xmlChar *txt,
  *                                                                     *
  ************************************************************************/
 
-static xmlNodePtr
-xmlXIncludeCopyNodeList(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
-                       xmlDocPtr source, xmlNodePtr elem);
-
 /**
  * xmlXIncludeCopyNode:
  * @ctxt:  the XInclude context
- * @target:  the document target
- * @source:  the document source
  * @elem:  the element
+ * @copyChildren:  copy children instead of node if true
+ *
+ * Make a copy of the node while expanding nested XIncludes.
  *
- * Make a copy of the node while preserving the XInclude semantic
- * of the Infoset copy
+ * Returns a node list, not a single node.
  */
 static xmlNodePtr
-xmlXIncludeCopyNode(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
-                   xmlDocPtr source, xmlNodePtr elem) {
+xmlXIncludeCopyNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr elem,
+                    int copyChildren) {
     xmlNodePtr result = NULL;
+    xmlNodePtr insertParent = NULL;
+    xmlNodePtr insertLast = NULL;
+    xmlNodePtr cur;
 
-    if ((ctxt == NULL) || (target == NULL) || (source == NULL) ||
-       (elem == NULL))
-       return(NULL);
-    if (elem->type == XML_DTD_NODE)
-       return(NULL);
-    if (elem->type == XML_DOCUMENT_NODE)
-       result = xmlXIncludeCopyNodeList(ctxt, target, source, elem->children);
-    else
-        result = xmlDocCopyNode(elem, target, 1);
-    return(result);
-}
+    if (copyChildren) {
+        cur = elem->children;
+        if (cur == NULL)
+            return(NULL);
+    } else {
+        cur = elem;
+    }
 
-/**
- * xmlXIncludeCopyNodeList:
- * @ctxt:  the XInclude context
- * @target:  the document target
- * @source:  the document source
- * @elem:  the element list
- *
- * Make a copy of the node list while preserving the XInclude semantic
- * of the Infoset copy
- */
-static xmlNodePtr
-xmlXIncludeCopyNodeList(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
-                       xmlDocPtr source, xmlNodePtr elem) {
-    xmlNodePtr cur, res, result = NULL, last = NULL;
+    while (1) {
+        xmlNodePtr copy = NULL;
+        int recurse = 0;
 
-    if ((ctxt == NULL) || (target == NULL) || (source == NULL) ||
-       (elem == NULL))
-       return(NULL);
-    cur = elem;
-    while (cur != NULL) {
-       res = xmlXIncludeCopyNode(ctxt, target, source, cur);
-       if (res != NULL) {
-           if (result == NULL) {
-               result = last = res;
-           } else {
-               last->next = res;
-               res->prev = last;
-               last = res;
-           }
-       }
-       cur = cur->next;
+        if ((cur->type == XML_DOCUMENT_NODE) ||
+            (cur->type == XML_DTD_NODE)) {
+            ;
+        } else if ((cur->type == XML_ELEMENT_NODE) &&
+                   (cur->ns != NULL) &&
+                   (xmlStrEqual(cur->name, XINCLUDE_NODE)) &&
+                   ((xmlStrEqual(cur->ns->href, XINCLUDE_NS)) ||
+                    (xmlStrEqual(cur->ns->href, XINCLUDE_OLD_NS)))) {
+            xmlXIncludeRefPtr ref = xmlXIncludeExpandNode(ctxt, cur);
+
+            if (ref == NULL)
+                goto error;
+            /*
+             * TODO: Insert XML_XINCLUDE_START and XML_XINCLUDE_END nodes
+             */
+            if (ref->inc != NULL) {
+                copy = xmlStaticCopyNodeList(ref->inc, ctxt->doc,
+                                             insertParent);
+                if (copy == NULL)
+                    goto error;
+            }
+        } else {
+            copy = xmlStaticCopyNode(cur, ctxt->doc, insertParent, 2);
+            if (copy == NULL)
+                goto error;
+
+            recurse = (cur->type != XML_ENTITY_REF_NODE) &&
+                      (cur->children != NULL);
+        }
+
+        if (copy != NULL) {
+            if (result == NULL)
+                result = copy;
+            if (insertLast != NULL) {
+                insertLast->next = copy;
+                copy->prev = insertLast;
+            } else if (insertParent != NULL) {
+                insertParent->children = copy;
+            }
+            insertLast = copy;
+            while (insertLast->next != NULL) {
+                insertLast = insertLast->next;
+            }
+        }
+
+        if (recurse) {
+            cur = cur->children;
+            insertParent = insertLast;
+            insertLast = NULL;
+            continue;
+        }
+
+        if (cur == elem)
+            return(result);
+
+        while (cur->next == NULL) {
+            cur = cur->parent;
+            if (cur == elem)
+                return(result);
+            insertParent->last = insertLast;
+            insertLast = insertParent;
+            insertParent = insertParent->parent;
+        }
+
+        cur = cur->next;
     }
-    return(result);
+
+error:
+    xmlFreeNodeList(result);
+    return(NULL);
 }
 
 #ifdef LIBXML_XPTR_LOCS_ENABLED
@@ -913,8 +781,6 @@ xmlNodePtr xmlXPtrAdvanceNode(xmlNodePtr cur, int *level); /* in xpointer.c */
 /**
  * xmlXIncludeCopyRange:
  * @ctxt:  the XInclude context
- * @target:  the document target
- * @source:  the document source
  * @obj:  the XPointer result from the evaluation.
  *
  * Build a node list tree copy of the XPointer result.
@@ -923,8 +789,7 @@ xmlNodePtr xmlXPtrAdvanceNode(xmlNodePtr cur, int *level); /* in xpointer.c */
  *         The caller has to free the node tree.
  */
 static xmlNodePtr
-xmlXIncludeCopyRange(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
-                       xmlDocPtr source, xmlXPathObjectPtr range) {
+xmlXIncludeCopyRange(xmlXIncludeCtxtPtr ctxt, xmlXPathObjectPtr range) {
     /* pointers to generated nodes */
     xmlNodePtr list = NULL, last = NULL, listParent = NULL;
     xmlNodePtr tmp, tmp2;
@@ -933,8 +798,7 @@ xmlXIncludeCopyRange(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
     int index1, index2;
     int level = 0, lastLevel = 0, endLevel = 0, endFlag = 0;
 
-    if ((ctxt == NULL) || (target == NULL) || (source == NULL) ||
-       (range == NULL))
+    if ((ctxt == NULL) || (range == NULL))
        return(NULL);
     if (range->type != XPATH_RANGE)
        return(NULL);
@@ -944,7 +808,7 @@ xmlXIncludeCopyRange(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
        return(NULL);
     end = range->user2;
     if (end == NULL)
-       return(xmlDocCopyNode(start, target, 1));
+       return(xmlDocCopyNode(start, ctxt->doc, 1));
     if (end->type == XML_NAMESPACE_DECL)
         return(NULL);
 
@@ -966,7 +830,7 @@ xmlXIncludeCopyRange(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
        if (level < 0) {
            while (level < 0) {
                /* copy must include namespaces and properties */
-               tmp2 = xmlDocCopyNode(listParent, target, 2);
+               tmp2 = xmlDocCopyNode(listParent, ctxt->doc, 2);
                xmlAddChild(tmp2, list);
                list = tmp2;
                listParent = listParent->parent;
@@ -988,7 +852,7 @@ xmlXIncludeCopyRange(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
                int len;
 
                if (content == NULL) {
-                   tmp = xmlNewDocTextLen(target, NULL, 0);
+                   tmp = xmlNewDocTextLen(ctxt->doc, NULL, 0);
                } else {
                    len = index2;
                    if ((cur == start) && (index1 > 1)) {
@@ -997,7 +861,7 @@ xmlXIncludeCopyRange(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
                    } else {
                        len = index2;
                    }
-                   tmp = xmlNewDocTextLen(target, content, len);
+                   tmp = xmlNewDocTextLen(ctxt->doc, content, len);
                }
                /* single sub text node selection */
                if (list == NULL)
@@ -1012,7 +876,7 @@ xmlXIncludeCopyRange(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
                endLevel = level;       /* remember the level of the end node */
                endFlag = 1;
                /* last node - need to take care of properties + namespaces */
-               tmp = xmlDocCopyNode(cur, target, 2);
+               tmp = xmlDocCopyNode(cur, ctxt->doc, 2);
                if (list == NULL) {
                    list = tmp;
                    listParent = cur->parent;
@@ -1048,13 +912,13 @@ xmlXIncludeCopyRange(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
                const xmlChar *content = cur->content;
 
                if (content == NULL) {
-                   tmp = xmlNewDocTextLen(target, NULL, 0);
+                   tmp = xmlNewDocTextLen(ctxt->doc, NULL, 0);
                } else {
                    if (index1 > 1) {
                        content += (index1 - 1);
                        index1 = 0;
                    }
-                   tmp = xmlNewDocText(target, content);
+                   tmp = xmlNewDocText(ctxt->doc, content);
                }
                last = list = tmp;
                listParent = cur->parent;
@@ -1063,7 +927,7 @@ xmlXIncludeCopyRange(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
                 * start of the range - need to take care of
                 * properties and namespaces
                 */
-               tmp = xmlDocCopyNode(cur, target, 2);
+               tmp = xmlDocCopyNode(cur, ctxt->doc, 2);
                list = last = tmp;
                listParent = cur->parent;
                if (index1 > 1) {       /* Do we need to position? */
@@ -1100,7 +964,7 @@ xmlXIncludeCopyRange(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
                     * Middle of the range - need to take care of
                     * properties and namespaces
                     */
-                   tmp = xmlDocCopyNode(cur, target, 2);
+                   tmp = xmlDocCopyNode(cur, ctxt->doc, 2);
                    break;
            }
            if (tmp != NULL) {
@@ -1124,10 +988,8 @@ xmlXIncludeCopyRange(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
 #endif /* LIBXML_XPTR_LOCS_ENABLED */
 
 /**
- * xmlXIncludeBuildNodeList:
+ * xmlXIncludeCopyXPointer:
  * @ctxt:  the XInclude context
- * @target:  the document target
- * @source:  the document source
  * @obj:  the XPointer result from the evaluation.
  *
  * Build a node list tree copy of the XPointer result.
@@ -1137,15 +999,11 @@ xmlXIncludeCopyRange(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
  *         the caller has to free the node tree.
  */
 static xmlNodePtr
-xmlXIncludeCopyXPointer(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
-                       xmlDocPtr source, xmlXPathObjectPtr obj) {
-    xmlNodePtr list = NULL, last = NULL;
+xmlXIncludeCopyXPointer(xmlXIncludeCtxtPtr ctxt, xmlXPathObjectPtr obj) {
+    xmlNodePtr list = NULL, last = NULL, copy;
     int i;
 
-    if (source == NULL)
-       source = ctxt->doc;
-    if ((ctxt == NULL) || (target == NULL) || (source == NULL) ||
-       (obj == NULL))
+    if ((ctxt == NULL) || (obj == NULL))
        return(NULL);
     switch (obj->type) {
         case XPATH_NODESET: {
@@ -1153,70 +1011,56 @@ xmlXIncludeCopyXPointer(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
            if (set == NULL)
                return(NULL);
            for (i = 0;i < set->nodeNr;i++) {
+                xmlNodePtr node;
+
                if (set->nodeTab[i] == NULL)
                    continue;
                switch (set->nodeTab[i]->type) {
+                   case XML_DOCUMENT_NODE:
+                   case XML_HTML_DOCUMENT_NODE:
+                        node = xmlDocGetRootElement(
+                                (xmlDocPtr) set->nodeTab[i]);
+                        if (node == NULL) {
+                            xmlXIncludeErr(ctxt, set->nodeTab[i],
+                                           XML_ERR_INTERNAL_ERROR,
+                                           "document without root\n", NULL);
+                            continue;
+                        }
+                        break;
                    case XML_TEXT_NODE:
                    case XML_CDATA_SECTION_NODE:
                    case XML_ELEMENT_NODE:
-                   case XML_ENTITY_REF_NODE:
-                   case XML_ENTITY_NODE:
                    case XML_PI_NODE:
                    case XML_COMMENT_NODE:
-                   case XML_DOCUMENT_NODE:
-                   case XML_HTML_DOCUMENT_NODE:
-                   case XML_XINCLUDE_END:
+                        node = set->nodeTab[i];
                        break;
-                   case XML_XINCLUDE_START: {
-                       xmlNodePtr tmp, cur = set->nodeTab[i];
-
-                       cur = cur->next;
-                       while (cur != NULL) {
-                           switch(cur->type) {
-                               case XML_TEXT_NODE:
-                               case XML_CDATA_SECTION_NODE:
-                               case XML_ELEMENT_NODE:
-                               case XML_ENTITY_REF_NODE:
-                               case XML_ENTITY_NODE:
-                               case XML_PI_NODE:
-                               case XML_COMMENT_NODE:
-                                   tmp = xmlXIncludeCopyNode(ctxt, target,
-                                                             source, cur);
-                                   if (last == NULL) {
-                                       list = last = tmp;
-                                   } else {
-                                       last = xmlAddNextSibling(last, tmp);
-                                   }
-                                   cur = cur->next;
-                                   continue;
-                               default:
-                                   break;
-                           }
-                           break;
-                       }
-                       continue;
-                   }
-                   case XML_ATTRIBUTE_NODE:
-                   case XML_NAMESPACE_DECL:
-                   case XML_DOCUMENT_TYPE_NODE:
-                   case XML_DOCUMENT_FRAG_NODE:
-                   case XML_NOTATION_NODE:
-                   case XML_DTD_NODE:
-                   case XML_ELEMENT_DECL:
-                   case XML_ATTRIBUTE_DECL:
-                   case XML_ENTITY_DECL:
+                    default:
+                        xmlXIncludeErr(ctxt, set->nodeTab[i],
+                                       XML_XINCLUDE_XPTR_RESULT,
+                                       "invalid node type in XPtr result\n",
+                                       NULL);
                        continue; /* for */
                }
-               if (last == NULL)
-                   list = last = xmlXIncludeCopyNode(ctxt, target, source,
-                                                     set->nodeTab[i]);
-               else {
-                   xmlAddNextSibling(last,
-                           xmlXIncludeCopyNode(ctxt, target, source,
-                                               set->nodeTab[i]));
-                   if (last->next != NULL)
-                       last = last->next;
+                /*
+                 * OPTIMIZE TODO: External documents should already be
+                 * expanded, so xmlDocCopyNode should work as well.
+                 * xmlXIncludeCopyNode is only required for the initial
+                 * document.
+                 */
+               copy = xmlXIncludeCopyNode(ctxt, node, 0);
+                if (copy == NULL) {
+                    xmlFreeNodeList(list);
+                    return(NULL);
+                }
+               if (last == NULL) {
+                    list = copy;
+                } else {
+                    while (last->next != NULL)
+                        last = last->next;
+                    copy->prev = last;
+                    last->next = copy;
                }
+                last = copy;
            }
            break;
        }
@@ -1227,12 +1071,11 @@ xmlXIncludeCopyXPointer(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
                return(NULL);
            for (i = 0;i < set->locNr;i++) {
                if (last == NULL)
-                   list = last = xmlXIncludeCopyXPointer(ctxt, target, source,
+                   list = last = xmlXIncludeCopyXPointer(ctxt,
                                                          set->locTab[i]);
                else
                    xmlAddNextSibling(last,
-                           xmlXIncludeCopyXPointer(ctxt, target, source,
-                                                   set->locTab[i]));
+                           xmlXIncludeCopyXPointer(ctxt, set->locTab[i]));
                if (last != NULL) {
                    while (last->next != NULL)
                        last = last->next;
@@ -1241,7 +1084,7 @@ xmlXIncludeCopyXPointer(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
            break;
        }
        case XPATH_RANGE:
-           return(xmlXIncludeCopyRange(ctxt, target, source, obj));
+           return(xmlXIncludeCopyRange(ctxt, obj));
        case XPATH_POINT:
            /* points are ignored in XInclude */
            break;
@@ -1268,7 +1111,7 @@ struct _xmlXIncludeMergeData {
  * xmlXIncludeMergeOneEntity:
  * @ent: the entity
  * @doc:  the including doc
- * @nr: the entity name
+ * @name: the entity name
  *
  * Implements the merge of one entity
  */
@@ -1406,59 +1249,53 @@ xmlXIncludeMergeEntities(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc,
  * xmlXIncludeLoadDoc:
  * @ctxt:  the XInclude context
  * @url:  the associated URL
- * @nr:  the xinclude node number
+ * @ref:  an XMLXincludeRefPtr
  *
  * Load the document, and store the result in the XInclude context
  *
  * Returns 0 in case of success, -1 in case of failure
  */
 static int
-xmlXIncludeLoadDoc(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
+xmlXIncludeLoadDoc(xmlXIncludeCtxtPtr ctxt, const xmlChar *url,
+                   xmlXIncludeRefPtr ref) {
+    xmlXIncludeDocPtr cache;
     xmlDocPtr doc;
     xmlURIPtr uri;
-    xmlChar *URL;
+    xmlChar *URL = NULL;
     xmlChar *fragment = NULL;
     int i = 0;
+    int ret = -1;
+    int cacheNr;
 #ifdef LIBXML_XPTR_ENABLED
     int saveFlags;
 #endif
 
 #ifdef DEBUG_XINCLUDE
-    xmlGenericError(xmlGenericErrorContext, "Loading doc %s:%d\n", url, nr);
+    xmlGenericError(xmlGenericErrorContext, "Loading doc %s\n", url);
 #endif
     /*
      * Check the URL and remove any fragment identifier
      */
     uri = xmlParseURI((const char *)url);
     if (uri == NULL) {
-       xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
-                      XML_XINCLUDE_HREF_URI,
+       xmlXIncludeErr(ctxt, ref->elem, XML_XINCLUDE_HREF_URI,
                       "invalid value URI %s\n", url);
-       return(-1);
+        goto error;
     }
     if (uri->fragment != NULL) {
        fragment = (xmlChar *) uri->fragment;
        uri->fragment = NULL;
     }
-    if ((ctxt->incTab != NULL) && (ctxt->incTab[nr] != NULL) &&
-        (ctxt->incTab[nr]->fragment != NULL)) {
+    if (ref->fragment != NULL) {
        if (fragment != NULL) xmlFree(fragment);
-       fragment = xmlStrdup(ctxt->incTab[nr]->fragment);
+       fragment = xmlStrdup(ref->fragment);
     }
     URL = xmlSaveUri(uri);
     xmlFreeURI(uri);
     if (URL == NULL) {
-        if (ctxt->incTab != NULL)
-           xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
-                          XML_XINCLUDE_HREF_URI,
-                          "invalid value URI %s\n", url);
-       else
-           xmlXIncludeErr(ctxt, NULL,
-                          XML_XINCLUDE_HREF_URI,
-                          "invalid value URI %s\n", url);
-       if (fragment != NULL)
-           xmlFree(fragment);
-       return(-1);
+        xmlXIncludeErr(ctxt, ref->elem, XML_XINCLUDE_HREF_URI,
+                       "invalid value URI %s\n", url);
+        goto error;
     }
 
     /*
@@ -1472,15 +1309,21 @@ xmlXIncludeLoadDoc(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
     }
 
     /*
-     * Prevent reloading twice the document.
+     * Prevent reloading the document twice.
      */
-    for (i = 0; i < ctxt->incNr; i++) {
-       if ((xmlStrEqual(URL, ctxt->incTab[i]->URI)) &&
-           (ctxt->incTab[i]->doc != NULL)) {
-           doc = ctxt->incTab[i]->doc;
+    for (i = 0; i < ctxt->urlNr; i++) {
+       if (xmlStrEqual(URL, ctxt->urlTab[i].url)) {
 #ifdef DEBUG_XINCLUDE
            printf("Already loaded %s\n", URL);
 #endif
+            if (ctxt->urlTab[i].expanding) {
+                xmlXIncludeErr(ctxt, ref->elem, XML_XINCLUDE_RECURSION,
+                               "inclusion loop detected\n", NULL);
+                goto error;
+            }
+           doc = ctxt->urlTab[i].doc;
+            if (doc == NULL)
+                goto error;
            goto loaded;
        }
     }
@@ -1507,13 +1350,30 @@ xmlXIncludeLoadDoc(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
 #ifdef LIBXML_XPTR_ENABLED
     ctxt->parseFlags = saveFlags;
 #endif
-    if (doc == NULL) {
-       xmlFree(URL);
-       if (fragment != NULL)
-           xmlFree(fragment);
-       return(-1);
+
+    /* Also cache NULL docs */
+    if (ctxt->urlNr >= ctxt->urlMax) {
+        xmlXIncludeDoc *tmp;
+        size_t newSize = ctxt->urlMax ? ctxt->urlMax * 2 : 8;
+
+        tmp = xmlRealloc(ctxt->urlTab, sizeof(xmlXIncludeDoc) * newSize);
+        if (tmp == NULL) {
+            xmlXIncludeErrMemory(ctxt, ref->elem,
+                                 "growing XInclude URL table");
+            xmlFreeDoc(doc);
+            goto error;
+        }
+        ctxt->urlMax = newSize;
+        ctxt->urlTab = tmp;
     }
-    ctxt->incTab[nr]->doc = doc;
+    cacheNr = ctxt->urlNr++;
+    cache = &ctxt->urlTab[cacheNr];
+    cache->doc = doc;
+    cache->url = xmlStrdup(URL);
+    cache->expanding = 0;
+
+    if (doc == NULL)
+        goto error;
     /*
      * It's possible that the requested URL has been mapped to a
      * completely different location (e.g. through a catalog entry).
@@ -1524,15 +1384,6 @@ xmlXIncludeLoadDoc(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
        xmlFree(URL);
        URL = xmlStrdup(doc->URL);
    }
-    for (i = nr + 1; i < ctxt->incNr; i++) {
-       if (xmlStrEqual(URL, ctxt->incTab[i]->URI)) {
-           ctxt->incTab[nr]->count++;
-#ifdef DEBUG_XINCLUDE
-           printf("Increasing %s count since reused\n", URL);
-#endif
-            break;
-       }
-    }
 
     /*
      * Make sure we have all entities fixed up
@@ -1552,15 +1403,18 @@ xmlXIncludeLoadDoc(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
        doc->extSubset = NULL;
     }
      */
+    cache->expanding = 1;
     xmlXIncludeRecurseDoc(ctxt, doc, URL);
+    /* urlTab might be reallocated. */
+    cache = &ctxt->urlTab[cacheNr];
+    cache->expanding = 0;
 
 loaded:
     if (fragment == NULL) {
        /*
         * Add the top children list as the replacement copy.
         */
-       ctxt->incTab[nr]->inc = xmlXIncludeCopyNodeList(ctxt, ctxt->doc,
-                                                       doc, doc->children);
+        ref->inc = xmlDocCopyNode(xmlDocGetRootElement(doc), ctxt->doc, 1);
     }
 #ifdef LIBXML_XPTR_ENABLED
     else {
@@ -1572,25 +1426,26 @@ loaded:
        xmlXPathContextPtr xptrctxt;
        xmlNodeSetPtr set;
 
+        if (ctxt->isStream && doc == ctxt->doc) {
+           xmlXIncludeErr(ctxt, ref->elem, XML_XINCLUDE_XPTR_FAILED,
+                          "XPointer expressions not allowed in streaming"
+                           " mode\n", NULL);
+            goto error;
+        }
+
        xptrctxt = xmlXPtrNewContext(doc, NULL, NULL);
        if (xptrctxt == NULL) {
-           xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
-                          XML_XINCLUDE_XPTR_FAILED,
+           xmlXIncludeErr(ctxt, ref->elem, XML_XINCLUDE_XPTR_FAILED,
                           "could not create XPointer context\n", NULL);
-           xmlFree(URL);
-           xmlFree(fragment);
-           return(-1);
+            goto error;
        }
        xptr = xmlXPtrEval(fragment, xptrctxt);
        if (xptr == NULL) {
-           xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
-                          XML_XINCLUDE_XPTR_FAILED,
+           xmlXIncludeErr(ctxt, ref->elem, XML_XINCLUDE_XPTR_FAILED,
                           "XPointer evaluation failed: #%s\n",
                           fragment);
            xmlXPathFreeContext(xptrctxt);
-           xmlFree(URL);
-           xmlFree(fragment);
-           return(-1);
+            goto error;
        }
        switch (xptr->type) {
            case XPATH_UNDEFINED:
@@ -1602,23 +1457,18 @@ loaded:
 #endif
            case XPATH_USERS:
            case XPATH_XSLT_TREE:
-               xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
-                              XML_XINCLUDE_XPTR_RESULT,
+               xmlXIncludeErr(ctxt, ref->elem, XML_XINCLUDE_XPTR_RESULT,
                               "XPointer is not a range: #%s\n",
                               fragment);
                 xmlXPathFreeObject(xptr);
                xmlXPathFreeContext(xptrctxt);
-               xmlFree(URL);
-               xmlFree(fragment);
-               return(-1);
+                goto error;
            case XPATH_NODESET:
                if ((xptr->nodesetval == NULL) ||
                    (xptr->nodesetval->nodeNr <= 0)) {
                     xmlXPathFreeObject(xptr);
                    xmlXPathFreeContext(xptrctxt);
-                   xmlFree(URL);
-                   xmlFree(fragment);
-                   return(-1);
+                    goto error;
                }
 
 #ifdef LIBXML_XPTR_LOCS_ENABLED
@@ -1645,14 +1495,14 @@ loaded:
                        continue;
 
                    case XML_ATTRIBUTE_NODE:
-                       xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
+                       xmlXIncludeErr(ctxt, ref->elem,
                                       XML_XINCLUDE_XPTR_RESULT,
                                       "XPointer selects an attribute: #%s\n",
                                       fragment);
                        set->nodeTab[i] = NULL;
                        continue;
                    case XML_NAMESPACE_DECL:
-                       xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
+                       xmlXIncludeErr(ctxt, ref->elem,
                                       XML_XINCLUDE_XPTR_RESULT,
                                       "XPointer selects a namespace: #%s\n",
                                       fragment);
@@ -1667,7 +1517,7 @@ loaded:
                    case XML_ENTITY_DECL:
                    case XML_XINCLUDE_START:
                    case XML_XINCLUDE_END:
-                       xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
+                       xmlXIncludeErr(ctxt, ref->elem,
                                       XML_XINCLUDE_XPTR_RESULT,
                                   "XPointer selects unexpected nodes: #%s\n",
                                       fragment);
@@ -1677,11 +1527,9 @@ loaded:
                }
            }
        }
-        ctxt->incTab[nr]->inc =
-            xmlXIncludeCopyXPointer(ctxt, ctxt->doc, doc, xptr);
+        ref->inc = xmlXIncludeCopyXPointer(ctxt, xptr);
         xmlXPathFreeObject(xptr);
        xmlXPathFreeContext(xptrctxt);
-       xmlFree(fragment);
     }
 #endif
 
@@ -1699,8 +1547,7 @@ loaded:
         * The base is only adjusted if "necessary", i.e. if the xinclude node
         * has a base specified, or the URL is relative
         */
-       base = xmlGetNsProp(ctxt->incTab[nr]->ref, BAD_CAST "base",
-                       XML_XML_NAMESPACE);
+       base = xmlGetNsProp(ref->elem, BAD_CAST "base", XML_XML_NAMESPACE);
        if (base == NULL) {
            /*
             * No xml:base on the xinclude node, so we check whether the
@@ -1708,19 +1555,18 @@ loaded:
             */
            curBase = xmlBuildRelativeURI(URL, ctxt->base);
            if (curBase == NULL) {      /* Error return */
-               xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
-                      XML_XINCLUDE_HREF_URI,
+               xmlXIncludeErr(ctxt, ref->elem, XML_XINCLUDE_HREF_URI,
                       "trying to build relative URI from %s\n", URL);
            } else {
                /* If the URI doesn't contain a slash, it's not relative */
-               if (!xmlStrchr(curBase, (xmlChar) '/'))
+               if (!xmlStrchr(curBase, '/'))
                    xmlFree(curBase);
                else
                    base = curBase;
            }
        }
        if (base != NULL) {     /* Adjustment may be needed */
-           node = ctxt->incTab[nr]->inc;
+           node = ref->inc;
            while (node != NULL) {
                /* Only work on element nodes */
                if (node->type == XML_ELEMENT_NODE) {
@@ -1750,7 +1596,7 @@ loaded:
                                relBase = xmlBuildURI(xmlBase, base);
                                if (relBase == NULL) { /* error */
                                    xmlXIncludeErr(ctxt,
-                                               ctxt->incTab[nr]->ref,
+                                               ref->elem,
                                                XML_XINCLUDE_HREF_URI,
                                        "trying to rebuild base from %s\n",
                                                xmlBase);
@@ -1769,40 +1615,40 @@ loaded:
            xmlFree(base);
        }
     }
-    if ((nr < ctxt->incNr) && (ctxt->incTab[nr]->doc != NULL) &&
-       (ctxt->incTab[nr]->count <= 1)) {
-#ifdef DEBUG_XINCLUDE
-        printf("freeing %s\n", ctxt->incTab[nr]->doc->URL);
-#endif
-       xmlFreeDoc(ctxt->incTab[nr]->doc);
-       ctxt->incTab[nr]->doc = NULL;
-    }
+    ret = 0;
+
+error:
     xmlFree(URL);
-    return(0);
+    xmlFree(fragment);
+    return(ret);
 }
 
 /**
  * xmlXIncludeLoadTxt:
  * @ctxt:  the XInclude context
  * @url:  the associated URL
- * @nr:  the xinclude node number
+ * @ref:  an XMLXincludeRefPtr
  *
  * Load the content, and store the result in the XInclude context
  *
  * Returns 0 in case of success, -1 in case of failure
  */
 static int
-xmlXIncludeLoadTxt(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
+xmlXIncludeLoadTxt(xmlXIncludeCtxtPtr ctxt, const xmlChar *url,
+                   xmlXIncludeRefPtr ref) {
     xmlParserInputBufferPtr buf;
-    xmlNodePtr node;
-    xmlURIPtr uri;
-    xmlChar *URL;
+    xmlNodePtr node = NULL;
+    xmlURIPtr uri = NULL;
+    xmlChar *URL = NULL;
     int i;
+    int ret = -1;
     xmlChar *encoding = NULL;
     xmlCharEncoding enc = (xmlCharEncoding) 0;
-    xmlParserCtxtPtr pctxt;
-    xmlParserInputPtr inputStream;
-    int xinclude_multibyte_fallback_used = 0;
+    xmlParserCtxtPtr pctxt = NULL;
+    xmlParserInputPtr inputStream = NULL;
+    int len;
+    const xmlChar *content;
+
 
     /* Don't read from stdin. */
     if (xmlStrcmp(url, BAD_CAST "-") == 0)
@@ -1813,23 +1659,21 @@ xmlXIncludeLoadTxt(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
      */
     uri = xmlParseURI((const char *)url);
     if (uri == NULL) {
-       xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, XML_XINCLUDE_HREF_URI,
+       xmlXIncludeErr(ctxt, ref->elem, XML_XINCLUDE_HREF_URI,
                       "invalid value URI %s\n", url);
-       return(-1);
+       goto error;
     }
     if (uri->fragment != NULL) {
-       xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, XML_XINCLUDE_TEXT_FRAGMENT,
+       xmlXIncludeErr(ctxt, ref->elem, XML_XINCLUDE_TEXT_FRAGMENT,
                       "fragment identifier forbidden for text: %s\n",
                       (const xmlChar *) uri->fragment);
-       xmlFreeURI(uri);
-       return(-1);
+       goto error;
     }
     URL = xmlSaveUri(uri);
-    xmlFreeURI(uri);
     if (URL == NULL) {
-       xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, XML_XINCLUDE_HREF_URI,
+       xmlXIncludeErr(ctxt, ref->elem, XML_XINCLUDE_HREF_URI,
                       "invalid value URI %s\n", url);
-       return(-1);
+       goto error;
     }
 
     /*
@@ -1837,27 +1681,26 @@ xmlXIncludeLoadTxt(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
      * directly through ctxt->doc.
      */
     if (URL[0] == 0) {
-       xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
-                      XML_XINCLUDE_TEXT_DOCUMENT,
+       xmlXIncludeErr(ctxt, ref->elem, XML_XINCLUDE_TEXT_DOCUMENT,
                       "text serialization of document not available\n", NULL);
-       xmlFree(URL);
-       return(-1);
+       goto error;
     }
 
     /*
-     * Prevent reloading twice the document.
+     * Prevent reloading the document twice.
      */
     for (i = 0; i < ctxt->txtNr; i++) {
-       if (xmlStrEqual(URL, ctxt->txturlTab[i])) {
-            node = xmlNewDocText(ctxt->doc, ctxt->txtTab[i]);
+       if (xmlStrEqual(URL, ctxt->txtTab[i].url)) {
+            node = xmlNewDocText(ctxt->doc, ctxt->txtTab[i].text);
            goto loaded;
        }
     }
+
     /*
      * Try to get the encoding if available
      */
-    if ((ctxt->incTab[nr] != NULL) && (ctxt->incTab[nr]->ref != NULL)) {
-       encoding = xmlGetProp(ctxt->incTab[nr]->ref, XINCLUDE_PARSE_ENCODING);
+    if (ref->elem != NULL) {
+       encoding = xmlGetProp(ref->elem, XINCLUDE_PARSE_ENCODING);
     }
     if (encoding != NULL) {
        /*
@@ -1868,14 +1711,10 @@ xmlXIncludeLoadTxt(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
         */
         enc = xmlParseCharEncoding((const char *) encoding);
        if (enc == XML_CHAR_ENCODING_ERROR) {
-           xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
-                          XML_XINCLUDE_UNKNOWN_ENCODING,
+           xmlXIncludeErr(ctxt, ref->elem, XML_XINCLUDE_UNKNOWN_ENCODING,
                           "encoding %s not supported\n", encoding);
-           xmlFree(encoding);
-           xmlFree(URL);
-           return(-1);
+           goto error;
        }
-       xmlFree(encoding);
     }
 
     /*
@@ -1883,79 +1722,84 @@ xmlXIncludeLoadTxt(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
      */
     pctxt = xmlNewParserCtxt();
     inputStream = xmlLoadExternalEntity((const char*)URL, NULL, pctxt);
-    if(inputStream == NULL) {
-       xmlFreeParserCtxt(pctxt);
-       xmlFree(URL);
-       return(-1);
-    }
+    if(inputStream == NULL)
+       goto error;
     buf = inputStream->buf;
-    if (buf == NULL) {
-       xmlFreeInputStream (inputStream);
-       xmlFreeParserCtxt(pctxt);
-       xmlFree(URL);
-       return(-1);
-    }
+    if (buf == NULL)
+       goto error;
     if (buf->encoder)
        xmlCharEncCloseFunc(buf->encoder);
     buf->encoder = xmlGetCharEncodingHandler(enc);
     node = xmlNewDocText(ctxt->doc, NULL);
+    if (node == NULL) {
+        xmlXIncludeErrMemory(ctxt, ref->elem, NULL);
+       goto error;
+    }
 
     /*
      * Scan all chars from the resource and add the to the node
      */
-xinclude_multibyte_fallback:
-    while (xmlParserInputBufferRead(buf, 128) > 0) {
-       int len;
-       const xmlChar *content;
-
-       content = xmlBufContent(buf->buffer);
-       len = xmlBufLength(buf->buffer);
-       for (i = 0;i < len;) {
-           int cur;
-           int l;
-
-           cur = xmlStringCurrentChar(NULL, &content[i], &l);
-           if (!IS_CHAR(cur)) {
-               /* Handle split multibyte char at buffer boundary */
-               if (((len - i) < 4) && (!xinclude_multibyte_fallback_used)) {
-                   xinclude_multibyte_fallback_used = 1;
-                   xmlBufShrink(buf->buffer, i);
-                   goto xinclude_multibyte_fallback;
-               } else {
-                   xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
-                                  XML_XINCLUDE_INVALID_CHAR,
-                                  "%s contains invalid char\n", URL);
-                   xmlFreeParserCtxt(pctxt);
-                   xmlFreeParserInputBuffer(buf);
-                   xmlFree(URL);
-                   return(-1);
-               }
-           } else {
-               xinclude_multibyte_fallback_used = 0;
-               xmlNodeAddContentLen(node, &content[i], l);
-           }
-           i += l;
-       }
-       xmlBufShrink(buf->buffer, len);
+    while (xmlParserInputBufferRead(buf, 4096) > 0)
+        ;
+
+    content = xmlBufContent(buf->buffer);
+    len = xmlBufLength(buf->buffer);
+    for (i = 0; i < len;) {
+        int cur;
+        int l;
+
+        cur = xmlStringCurrentChar(NULL, &content[i], &l);
+        if (!IS_CHAR(cur)) {
+            xmlXIncludeErr(ctxt, ref->elem, XML_XINCLUDE_INVALID_CHAR,
+                           "%s contains invalid char\n", URL);
+            goto error;
+        }
+
+        i += l;
     }
-    xmlFreeParserCtxt(pctxt);
-    xmlXIncludeAddTxt(ctxt, node->content, URL);
-    xmlFreeInputStream(inputStream);
+
+    xmlNodeAddContentLen(node, content, len);
+
+    if (ctxt->txtNr >= ctxt->txtMax) {
+        xmlXIncludeTxt *tmp;
+        size_t newSize = ctxt->txtMax ? ctxt->txtMax * 2 : 8;
+
+        tmp = xmlRealloc(ctxt->txtTab, sizeof(xmlXIncludeTxt) * newSize);
+        if (tmp == NULL) {
+            xmlXIncludeErrMemory(ctxt, ref->elem,
+                                 "growing XInclude text table");
+           goto error;
+        }
+        ctxt->txtMax = newSize;
+        ctxt->txtTab = tmp;
+    }
+    ctxt->txtTab[ctxt->txtNr].text = xmlStrdup(node->content);
+    ctxt->txtTab[ctxt->txtNr].url = xmlStrdup(URL);
+    ctxt->txtNr++;
 
 loaded:
     /*
      * Add the element as the replacement copy.
      */
-    ctxt->incTab[nr]->inc = node;
+    ref->inc = node;
+    node = NULL;
+    ret = 0;
+
+error:
+    xmlFreeNode(node);
+    xmlFreeInputStream(inputStream);
+    xmlFreeParserCtxt(pctxt);
+    xmlFree(encoding);
+    xmlFreeURI(uri);
     xmlFree(URL);
-    return(0);
+    return(ret);
 }
 
 /**
  * xmlXIncludeLoadFallback:
  * @ctxt:  the XInclude context
  * @fallback:  the fallback node
- * @nr:  the xinclude node number
+ * @ref:  an XMLXincludeRefPtr
  *
  * Load the content of the fallback node, and store the result
  * in the XInclude context
@@ -1963,10 +1807,10 @@ loaded:
  * Returns 0 in case of success, -1 in case of failure
  */
 static int
-xmlXIncludeLoadFallback(xmlXIncludeCtxtPtr ctxt, xmlNodePtr fallback, int nr) {
-    xmlXIncludeCtxtPtr newctxt;
+xmlXIncludeLoadFallback(xmlXIncludeCtxtPtr ctxt, xmlNodePtr fallback,
+                        xmlXIncludeRefPtr ref) {
     int ret = 0;
-    int oldNbErrors = ctxt->nbErrors;
+    int oldNbErrors;
 
     if ((fallback == NULL) || (fallback->type == XML_NAMESPACE_DECL) ||
         (ctxt == NULL))
@@ -1976,29 +1820,17 @@ xmlXIncludeLoadFallback(xmlXIncludeCtxtPtr ctxt, xmlNodePtr fallback, int nr) {
         * It's possible that the fallback also has 'includes'
         * (Bug 129969), so we re-process the fallback just in case
         */
-       newctxt = xmlXIncludeNewContext(ctxt->doc);
-       if (newctxt == NULL)
-           return (-1);
-       newctxt->_private = ctxt->_private;
-       newctxt->base = xmlStrdup(ctxt->base);  /* Inherit the base from the existing context */
-       xmlXIncludeSetFlags(newctxt, ctxt->parseFlags);
-        newctxt->incTotal = ctxt->incTotal;
-        if (xmlXIncludeDoProcess(newctxt, ctxt->doc, fallback, 1) < 0)
-            ret = -1;
-        ctxt->incTotal = newctxt->incTotal;
+        oldNbErrors = ctxt->nbErrors;
+       ref->inc = xmlXIncludeCopyNode(ctxt, fallback, 1);
        if (ctxt->nbErrors > oldNbErrors)
            ret = -1;
-       xmlXIncludeFreeContext(newctxt);
-
-       ctxt->incTab[nr]->inc = xmlDocCopyNodeList(ctxt->doc,
-                                                  fallback->children);
-        if (ctxt->incTab[nr]->inc == NULL)
-            ctxt->incTab[nr]->emptyFb = 1;
+        else if (ref->inc == NULL)
+            ref->emptyFb = 1;
     } else {
-        ctxt->incTab[nr]->inc = NULL;
-       ctxt->incTab[nr]->emptyFb = 1;  /* flag empty callback */
+        ref->inc = NULL;
+       ref->emptyFb = 1;       /* flag empty callback */
     }
-    ctxt->incTab[nr]->fallback = 1;
+    ref->fallback = 1;
     return(ret);
 }
 
@@ -2009,32 +1841,74 @@ xmlXIncludeLoadFallback(xmlXIncludeCtxtPtr ctxt, xmlNodePtr fallback, int nr) {
  ************************************************************************/
 
 /**
- * xmlXIncludePreProcessNode:
+ * xmlXIncludeExpandNode:
  * @ctxt: an XInclude context
  * @node: an XInclude node
  *
- * Implement the XInclude preprocessing, currently just adding the element
- * for further processing.
+ * If the XInclude node wasn't processed yet, create a new RefPtr,
+ * add it to ctxt->incTab and load the included items.
  *
- * Returns the result list or NULL in case of error
+ * Returns the new or existing xmlXIncludeRefPtr, or NULL in case of error.
  */
-static xmlNodePtr
-xmlXIncludePreProcessNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr node) {
-    xmlXIncludeAddNode(ctxt, node);
-    return(NULL);
+static xmlXIncludeRefPtr
+xmlXIncludeExpandNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr node) {
+    xmlXIncludeRefPtr ref;
+    int i;
+
+    if (ctxt->fatalErr)
+        return(NULL);
+    if (ctxt->depth >= XINCLUDE_MAX_DEPTH) {
+        xmlXIncludeErr(ctxt, node, XML_XINCLUDE_RECURSION,
+                       "maximum recursion depth exceeded\n", NULL);
+        ctxt->fatalErr = 1;
+        return(NULL);
+    }
+
+#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
+    /*
+     * The XInclude engine offers no protection against exponential
+     * expansion attacks similar to "billion laughs". Avoid timeouts by
+     * limiting the total number of replacements when fuzzing.
+     */
+    if (ctxt->incTotal >= 20)
+        return(NULL);
+    ctxt->incTotal++;
+#endif
+
+    for (i = 0; i < ctxt->incNr; i++) {
+        if (ctxt->incTab[i]->elem == node) {
+            if (ctxt->incTab[i]->expanding) {
+                xmlXIncludeErr(ctxt, node, XML_XINCLUDE_RECURSION,
+                               "inclusion loop detected\n", NULL);
+                return(NULL);
+            }
+            return(ctxt->incTab[i]);
+        }
+    }
+
+    ref = xmlXIncludeAddNode(ctxt, node);
+    if (ref == NULL)
+        return(NULL);
+    ref->expanding = 1;
+    ctxt->depth++;
+    xmlXIncludeLoadNode(ctxt, ref);
+    ctxt->depth--;
+    ref->expanding = 0;
+
+    return(ref);
 }
 
 /**
  * xmlXIncludeLoadNode:
  * @ctxt: an XInclude context
- * @nr: the node number
+ * @ref: an xmlXIncludeRefPtr
  *
  * Find and load the infoset replacement for the given node.
  *
  * Returns 0 if substitution succeeded, -1 if some processing failed
  */
 static int
-xmlXIncludeLoadNode(xmlXIncludeCtxtPtr ctxt, int nr) {
+xmlXIncludeLoadNode(xmlXIncludeCtxtPtr ctxt, xmlXIncludeRefPtr ref) {
     xmlNodePtr cur;
     xmlChar *href;
     xmlChar *parse;
@@ -2044,11 +1918,9 @@ xmlXIncludeLoadNode(xmlXIncludeCtxtPtr ctxt, int nr) {
     int xml = 1; /* default Issue 64 */
     int ret;
 
-    if (ctxt == NULL)
-       return(-1);
-    if ((nr < 0) || (nr >= ctxt->incNr))
+    if ((ctxt == NULL) || (ref == NULL))
        return(-1);
-    cur = ctxt->incTab[nr]->ref;
+    cur = ref->elem;
     if (cur == NULL)
        return(-1);
 
@@ -2068,8 +1940,7 @@ xmlXIncludeLoadNode(xmlXIncludeCtxtPtr ctxt, int nr) {
        else if (xmlStrEqual(parse, XINCLUDE_PARSE_TEXT))
            xml = 0;
        else {
-           xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
-                          XML_XINCLUDE_PARSE_VALUE,
+           xmlXIncludeErr(ctxt, cur, XML_XINCLUDE_PARSE_VALUE,
                           "invalid value %s for 'parse'\n", parse);
            if (href != NULL)
                xmlFree(href);
@@ -2103,8 +1974,8 @@ xmlXIncludeLoadNode(xmlXIncludeCtxtPtr ctxt, int nr) {
            xmlFree(eschref);
     }
     if (URI == NULL) {
-       xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
-                      XML_XINCLUDE_HREF_URI, "failed build URL\n", NULL);
+       xmlXIncludeErr(ctxt, cur, XML_XINCLUDE_HREF_URI,
+                       "failed build URL\n", NULL);
        if (parse != NULL)
            xmlFree(parse);
        if (href != NULL)
@@ -2126,10 +1997,10 @@ xmlXIncludeLoadNode(xmlXIncludeCtxtPtr ctxt, int nr) {
     ctxt->base = base;
 
     if (xml) {
-       ret = xmlXIncludeLoadDoc(ctxt, URI, nr);
+       ret = xmlXIncludeLoadDoc(ctxt, URI, ref);
        /* xmlXIncludeGetFragment(ctxt, cur, URI); */
     } else {
-       ret = xmlXIncludeLoadTxt(ctxt, URI, nr);
+       ret = xmlXIncludeLoadTxt(ctxt, URI, ref);
     }
 
     /*
@@ -2153,15 +2024,14 @@ xmlXIncludeLoadNode(xmlXIncludeCtxtPtr ctxt, int nr) {
                (xmlStrEqual(children->name, XINCLUDE_FALLBACK)) &&
                ((xmlStrEqual(children->ns->href, XINCLUDE_NS)) ||
                 (xmlStrEqual(children->ns->href, XINCLUDE_OLD_NS)))) {
-               ret = xmlXIncludeLoadFallback(ctxt, children, nr);
+               ret = xmlXIncludeLoadFallback(ctxt, children, ref);
                break;
            }
            children = children->next;
        }
     }
     if (ret < 0) {
-       xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
-                      XML_XINCLUDE_NO_FALLBACK,
+       xmlXIncludeErr(ctxt, cur, XML_XINCLUDE_NO_FALLBACK,
                       "could not load %s, and no fallback was found\n",
                       URI);
     }
@@ -2183,27 +2053,25 @@ xmlXIncludeLoadNode(xmlXIncludeCtxtPtr ctxt, int nr) {
 /**
  * xmlXIncludeIncludeNode:
  * @ctxt: an XInclude context
- * @nr: the node number
+ * @ref: an xmlXIncludeRefPtr
  *
  * Implement the infoset replacement for the given node
  *
  * Returns 0 if substitution succeeded, -1 if some processing failed
  */
 static int
-xmlXIncludeIncludeNode(xmlXIncludeCtxtPtr ctxt, int nr) {
+xmlXIncludeIncludeNode(xmlXIncludeCtxtPtr ctxt, xmlXIncludeRefPtr ref) {
     xmlNodePtr cur, end, list, tmp;
 
-    if (ctxt == NULL)
-       return(-1);
-    if ((nr < 0) || (nr >= ctxt->incNr))
+    if ((ctxt == NULL) || (ref == NULL))
        return(-1);
-    cur = ctxt->incTab[nr]->ref;
+    cur = ref->elem;
     if ((cur == NULL) || (cur->type == XML_NAMESPACE_DECL))
        return(-1);
 
-    list = ctxt->incTab[nr]->inc;
-    ctxt->incTab[nr]->inc = NULL;
-    ctxt->incTab[nr]->emptyFb = 0;
+    list = ref->inc;
+    ref->inc = NULL;
+    ref->emptyFb = 0;
 
     /*
      * Check against the risk of generating a multi-rooted document
@@ -2219,8 +2087,7 @@ xmlXIncludeIncludeNode(xmlXIncludeCtxtPtr ctxt, int nr) {
            tmp = tmp->next;
        }
        if (nb_elem > 1) {
-           xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
-                          XML_XINCLUDE_MULTIPLE_ROOT,
+           xmlXIncludeErr(ctxt, ref->elem, XML_XINCLUDE_MULTIPLE_ROOT,
                       "XInclude error: would result in multiple root nodes\n",
                           NULL);
             xmlFreeNodeList(list);
@@ -2250,7 +2117,7 @@ xmlXIncludeIncludeNode(xmlXIncludeCtxtPtr ctxt, int nr) {
         * Change the current node as an XInclude start one, and add an
         * XInclude end one
         */
-        if (ctxt->incTab[nr]->fallback)
+        if (ref->fallback)
             xmlUnsetProp(cur, BAD_CAST "href");
        cur->type = XML_XINCLUDE_START;
         /* Remove fallback children */
@@ -2261,8 +2128,7 @@ xmlXIncludeIncludeNode(xmlXIncludeCtxtPtr ctxt, int nr) {
         }
        end = xmlNewDocNode(cur->doc, cur->ns, cur->name, NULL);
        if (end == NULL) {
-           xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
-                          XML_XINCLUDE_BUILD_FAILED,
+           xmlXIncludeErr(ctxt, ref->elem, XML_XINCLUDE_BUILD_FAILED,
                           "failed to build node\n", NULL);
             xmlFreeNodeList(list);
            return(-1);
@@ -2364,9 +2230,7 @@ xmlXIncludeTestNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr node) {
 /**
  * xmlXIncludeDoProcess:
  * @ctxt: the XInclude processing context
- * @doc: an XML document
  * @tree: the top of the tree to process
- * @skipRoot: don't process the root node of the tree
  *
  * Implement the XInclude substitution on the XML document @doc
  *
@@ -2374,63 +2238,31 @@ xmlXIncludeTestNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr node) {
  *    or the number of substitutions done.
  */
 static int
-xmlXIncludeDoProcess(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr tree,
-                     int skipRoot) {
+xmlXIncludeDoProcess(xmlXIncludeCtxtPtr ctxt, xmlNodePtr tree) {
+    xmlXIncludeRefPtr ref;
     xmlNodePtr cur;
     int ret = 0;
     int i, start;
 
-    if ((doc == NULL) || (tree == NULL) || (tree->type == XML_NAMESPACE_DECL))
+    if ((tree == NULL) || (tree->type == XML_NAMESPACE_DECL))
        return(-1);
-    if ((skipRoot) && (tree->children == NULL))
-        return(-1);
     if (ctxt == NULL)
        return(-1);
 
-    if (doc->URL != NULL) {
-       ret = xmlXIncludeURLPush(ctxt, doc->URL);
-       if (ret < 0)
-           return(-1);
-    }
-    start = ctxt->incNr;
-
-    /*
-     * TODO: The phases must run separately for recursive inclusions.
-     *
-     * - Phase 1 should start with top-level XInclude nodes, load documents,
-     *   execute XPointer expressions, then process only the result nodes
-     *   (not whole document, see bug #324081) and only for phase 1
-     *   recursively. We will need a backreference from xmlNodes to
-     *   xmlIncludeRefs to detect references that were already visited.
-     *   This can also be used for proper cycle detection, see bug #344240.
-     *
-     * - Phase 2 should visit all top-level XInclude nodes and expand
-     *   possible subreferences in the replacement recursively.
-     *
-     * - Phase 3 should finally replace the top-level XInclude nodes.
-     *   It could also be run together with phase 2.
-     */
-
     /*
      * First phase: lookup the elements in the document
      */
-    if (skipRoot)
-        cur = tree->children;
-    else
-        cur = tree;
+    start = ctxt->incNr;
+    cur = tree;
     do {
        /* TODO: need to work on entities -> stack */
         if (xmlXIncludeTestNode(ctxt, cur) == 1) {
-#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
+            ref = xmlXIncludeExpandNode(ctxt, cur);
             /*
-             * Avoid superlinear expansion by limiting the total number
-             * of replacements.
+             * Mark direct includes.
              */
-            if (ctxt->incTotal >= 20)
-                return(-1);
-#endif
-            ctxt->incTotal++;
-            xmlXIncludePreProcessNode(ctxt, cur);
+            if (ref != NULL)
+                ref->replace = 1;
         } else if ((cur->children != NULL) &&
                    ((cur->type == XML_DOCUMENT_NODE) ||
                     (cur->type == XML_ELEMENT_NODE))) {
@@ -2449,32 +2281,40 @@ xmlXIncludeDoProcess(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr tree,
     } while ((cur != NULL) && (cur != tree));
 
     /*
-     * Second Phase : collect the infosets fragments
+     * Second phase: extend the original document infoset.
      */
-    for (i = start;i < ctxt->incNr; i++) {
-        xmlXIncludeLoadNode(ctxt, i);
+    for (i = start; i < ctxt->incNr; i++) {
+       if (ctxt->incTab[i]->replace != 0) {
+            if ((ctxt->incTab[i]->inc != NULL) ||
+                (ctxt->incTab[i]->emptyFb != 0)) {     /* (empty fallback) */
+                xmlXIncludeIncludeNode(ctxt, ctxt->incTab[i]);
+            }
+            ctxt->incTab[i]->replace = 0;
+        } else {
+            /*
+             * Ignore includes which were added indirectly, for example
+             * inside xi:fallback elements.
+             */
+            if (ctxt->incTab[i]->inc != NULL) {
+                xmlFreeNodeList(ctxt->incTab[i]->inc);
+                ctxt->incTab[i]->inc = NULL;
+            }
+        }
        ret++;
     }
 
-    /*
-     * Third phase: extend the original document infoset.
-     *
-     * Originally we bypassed the inclusion if there were any errors
-     * encountered on any of the XIncludes.  A bug was raised (bug
-     * 132588) requesting that we output the XIncludes without error,
-     * so the check for inc!=NULL || xptr!=NULL was put in.  This may
-     * give some other problems in the future, but for now it seems to
-     * work ok.
-     *
-     */
-    for (i = ctxt->incBase;i < ctxt->incNr; i++) {
-       if ((ctxt->incTab[i]->inc != NULL) ||
-           (ctxt->incTab[i]->emptyFb != 0))    /* (empty fallback) */
-           xmlXIncludeIncludeNode(ctxt, i);
+    if (ctxt->isStream) {
+        /*
+         * incTab references nodes which will eventually be deleted in
+         * streaming mode. The table is only required for XPointer
+         * expressions which aren't allowed in streaming mode.
+         */
+        for (i = 0;i < ctxt->incNr;i++) {
+            xmlXIncludeFreeRef(ctxt->incTab[i]);
+        }
+        ctxt->incNr = 0;
     }
 
-    if (doc->URL != NULL)
-       xmlXIncludeURLPop(ctxt);
     return(ret);
 }
 
@@ -2496,6 +2336,23 @@ xmlXIncludeSetFlags(xmlXIncludeCtxtPtr ctxt, int flags) {
 }
 
 /**
+ * xmlXIncludeSetStreamingMode:
+ * @ctxt:  an XInclude processing context
+ * @mode:  whether streaming mode should be enabled
+ *
+ * In streaming mode, XPointer expressions aren't allowed.
+ *
+ * Returns 0 in case of success and -1 in case of error.
+ */
+int
+xmlXIncludeSetStreamingMode(xmlXIncludeCtxtPtr ctxt, int mode) {
+    if (ctxt == NULL)
+        return(-1);
+    ctxt->isStream = !!mode;
+    return(0);
+}
+
+/**
  * xmlXIncludeProcessTreeFlagsData:
  * @tree: an XML node
  * @flags: a set of xmlParserOption used for parsing XML includes
@@ -2523,7 +2380,7 @@ xmlXIncludeProcessTreeFlagsData(xmlNodePtr tree, int flags, void *data) {
     ctxt->_private = data;
     ctxt->base = xmlStrdup((xmlChar *)tree->doc->URL);
     xmlXIncludeSetFlags(ctxt, flags);
-    ret = xmlXIncludeDoProcess(ctxt, tree->doc, tree, 0);
+    ret = xmlXIncludeDoProcess(ctxt, tree);
     if ((ret >= 0) && (ctxt->nbErrors > 0))
         ret = -1;
 
@@ -2607,7 +2464,7 @@ xmlXIncludeProcessTreeFlags(xmlNodePtr tree, int flags) {
        return(-1);
     ctxt->base = xmlNodeGetBase(tree->doc, tree);
     xmlXIncludeSetFlags(ctxt, flags);
-    ret = xmlXIncludeDoProcess(ctxt, tree->doc, tree, 0);
+    ret = xmlXIncludeDoProcess(ctxt, tree);
     if ((ret >= 0) && (ctxt->nbErrors > 0))
        ret = -1;
 
@@ -2647,7 +2504,7 @@ xmlXIncludeProcessNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr node) {
     if ((node == NULL) || (node->type == XML_NAMESPACE_DECL) ||
         (node->doc == NULL) || (ctxt == NULL))
        return(-1);
-    ret = xmlXIncludeDoProcess(ctxt, node->doc, node, 0);
+    ret = xmlXIncludeDoProcess(ctxt, node);
     if ((ret >= 0) && (ctxt->nbErrors > 0))
        ret = -1;
     return(ret);
diff --git a/xmlIO.c b/xmlIO.c
index 16c29f5..5cab16f 100644 (file)
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -15,9 +15,6 @@
 #include <stdlib.h>
 #include <errno.h>
 
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
 #endif
 #include <libxml/globals.h>
 
-#include "buf.h"
-#include "enc.h"
+#include "private/buf.h"
+#include "private/enc.h"
+#include "private/error.h"
+#include "private/io.h"
+#include "private/parser.h"
 
 /* #define VERBOSE_FAILURE */
 /* #define DEBUG_EXTERNAL_ENTITIES */
@@ -111,9 +111,6 @@ typedef struct _xmlOutputCallback {
 static xmlOutputCallback xmlOutputCallbackTable[MAX_OUTPUT_CALLBACK];
 static int xmlOutputCallbackNr = 0;
 static int xmlOutputCallbackInitialized = 0;
-
-xmlOutputBufferPtr
-xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder);
 #endif /* LIBXML_OUTPUT_ENABLED */
 
 /************************************************************************
@@ -720,20 +717,6 @@ xmlCheckFilename (const char *path)
 }
 
 /**
- * xmlInputReadCallbackNop:
- *
- * No Operation xmlInputReadCallback function, does nothing.
- *
- * Returns zero
- */
-int
-xmlInputReadCallbackNop(void *context ATTRIBUTE_UNUSED,
-                        char *buffer ATTRIBUTE_UNUSED,
-                        int len ATTRIBUTE_UNUSED) {
-    return(0);
-}
-
-/**
  * xmlFdRead:
  * @context:  the I/O context
  * @buffer:  where to drop data
@@ -1266,7 +1249,7 @@ xmlGzfileClose (void * context) {
  *             I/O for compressed file accesses                        *
  *                                                                     *
  ************************************************************************/
-#include "xzlib.h"
+#include "private/xzlib.h"
 /**
  * xmlXzfileMatch:
  * @filename:  the URI for matching
@@ -2035,8 +2018,7 @@ xmlIOHTTPCloseWrite( void * context, const char * http_mthd ) {
                    xmlGenericError( xmlGenericErrorContext,
                        "Transmitted content saved in file:  %s\n", buffer );
 
-                   fwrite( http_content, sizeof( char ),
-                                       content_lgth, tst_file );
+                   fwrite( http_content, 1, content_lgth, tst_file );
                    fclose( tst_file );
                }
 
@@ -2050,7 +2032,7 @@ xmlIOHTTPCloseWrite( void * context, const char * http_mthd ) {
                    while ( (avail = xmlNanoHTTPRead( http_ctxt,
                                        buffer, sizeof( buffer ) )) > 0 ) {
 
-                       fwrite( buffer, sizeof( char ), avail, tst_file );
+                       fwrite( buffer, 1, avail, tst_file );
                    }
 
                    fclose( tst_file );
@@ -2346,7 +2328,7 @@ xmlAllocParserInputBuffer(xmlCharEncoding enc) {
        xmlIOErrMemory("creating input buffer");
        return(NULL);
     }
-    memset(ret, 0, (size_t) sizeof(xmlParserInputBuffer));
+    memset(ret, 0, sizeof(xmlParserInputBuffer));
     ret->buffer = xmlBufCreateSize(2 * xmlDefaultBufferSize);
     if (ret->buffer == NULL) {
         xmlFree(ret);
@@ -2385,7 +2367,7 @@ xmlAllocOutputBuffer(xmlCharEncodingHandlerPtr encoder) {
        xmlIOErrMemory("creating output buffer");
        return(NULL);
     }
-    memset(ret, 0, (size_t) sizeof(xmlOutputBuffer));
+    memset(ret, 0, sizeof(xmlOutputBuffer));
     ret->buffer = xmlBufCreate();
     if (ret->buffer == NULL) {
         xmlFree(ret);
@@ -2433,7 +2415,7 @@ xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder) {
        xmlIOErrMemory("creating output buffer");
        return(NULL);
     }
-    memset(ret, 0, (size_t) sizeof(xmlOutputBuffer));
+    memset(ret, 0, sizeof(xmlOutputBuffer));
     ret->buffer = xmlBufCreate();
     if (ret->buffer == NULL) {
         xmlFree(ret);
@@ -2950,11 +2932,11 @@ xmlParserInputBufferCreateMem(const char *mem, int size, xmlCharEncoding enc) {
     ret = xmlAllocParserInputBuffer(enc);
     if (ret != NULL) {
         ret->context = (void *) mem;
-       ret->readcallback = xmlInputReadCallbackNop;
+       ret->readcallback = NULL;
        ret->closecallback = NULL;
        errcode = xmlBufAdd(ret->buffer, (const xmlChar *) mem, size);
        if (errcode != 0) {
-           xmlFree(ret);
+           xmlFreeParserInputBuffer(ret);
            return(NULL);
        }
     }
@@ -2968,43 +2950,14 @@ xmlParserInputBufferCreateMem(const char *mem, int size, xmlCharEncoding enc) {
  * @size:  the length of the memory block
  * @enc:  the charset encoding if known
  *
- * Create a buffered parser input for the progressive parsing for the input
- * from an immutable memory area. This will not copy the memory area to
- * the buffer, but the memory is expected to be available until the end of
- * the parsing, this is useful for example when using mmap'ed file.
+ * DEPRECATED: Use xmlParserInputBufferCreateMem.
  *
  * Returns the new parser input or NULL
  */
 xmlParserInputBufferPtr
 xmlParserInputBufferCreateStatic(const char *mem, int size,
                                  xmlCharEncoding enc) {
-    xmlParserInputBufferPtr ret;
-
-    if (size < 0) return(NULL);
-    if (mem == NULL) return(NULL);
-
-    ret = (xmlParserInputBufferPtr) xmlMalloc(sizeof(xmlParserInputBuffer));
-    if (ret == NULL) {
-       xmlIOErrMemory("creating input buffer");
-       return(NULL);
-    }
-    memset(ret, 0, (size_t) sizeof(xmlParserInputBuffer));
-    ret->buffer = xmlBufCreateStatic((void *)mem, (size_t) size);
-    if (ret->buffer == NULL) {
-        xmlFree(ret);
-       return(NULL);
-    }
-    ret->encoder = xmlGetCharEncodingHandler(enc);
-    if (ret->encoder != NULL)
-        ret->raw = xmlBufCreateSize(2 * xmlDefaultBufferSize);
-    else
-        ret->raw = NULL;
-    ret->compressed = -1;
-    ret->context = (void *) mem;
-    ret->readcallback = NULL;
-    ret->closecallback = NULL;
-
-    return(ret);
+    return(xmlParserInputBufferCreateMem(mem, size, enc));
 }
 
 #ifdef LIBXML_OUTPUT_ENABLED
@@ -3159,7 +3112,7 @@ xmlParserInputBufferPush(xmlParserInputBufferPtr in,
     if (len < 0) return(0);
     if ((in == NULL) || (in->error)) return(-1);
     if (in->encoder != NULL) {
-        unsigned int use;
+        size_t use, consumed;
 
         /*
         * Store the data in the incoming raw buffer
@@ -3181,7 +3134,12 @@ xmlParserInputBufferPush(xmlParserInputBufferPtr in,
            in->error = XML_IO_ENCODER;
            return(-1);
        }
-       in->rawconsumed += (use - xmlBufUse(in->raw));
+        consumed = use - xmlBufUse(in->raw);
+        if ((consumed > ULONG_MAX) ||
+            (in->rawconsumed > ULONG_MAX - (unsigned long)consumed))
+            in->rawconsumed = ULONG_MAX;
+        else
+           in->rawconsumed += consumed;
     } else {
        nbchars = len;
         ret = xmlBufAdd(in->buffer, (xmlChar *) buf, nbchars);
@@ -3226,41 +3184,42 @@ endOfInput (void * context ATTRIBUTE_UNUSED,
  */
 int
 xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len) {
-    char *buffer = NULL;
+    xmlBufPtr buf;
     int res = 0;
-    int nbchars = 0;
 
     if ((in == NULL) || (in->error)) return(-1);
     if ((len <= MINLEN) && (len != 4))
         len = MINLEN;
 
-    if (xmlBufAvail(in->buffer) <= 0) {
-       xmlIOErr(XML_IO_BUFFER_FULL, NULL);
-       in->error = XML_IO_BUFFER_FULL;
-       return(-1);
-    }
-
-    if (xmlBufGrow(in->buffer, len + 1) < 0) {
-        xmlIOErrMemory("growing input buffer");
-        in->error = XML_ERR_NO_MEMORY;
-        return(-1);
+    if (in->encoder == NULL) {
+        if (in->readcallback == NULL)
+            return(0);
+        buf = in->buffer;
+    } else {
+        if (in->raw == NULL) {
+           in->raw = xmlBufCreate();
+       }
+        buf = in->raw;
     }
-    buffer = (char *)xmlBufEnd(in->buffer);
 
     /*
      * Call the read method for this I/O type.
      */
     if (in->readcallback != NULL) {
-       res = in->readcallback(in->context, &buffer[0], len);
+        if (xmlBufGrow(buf, len + 1) < 0) {
+            xmlIOErrMemory("growing input buffer");
+            in->error = XML_ERR_NO_MEMORY;
+            return(-1);
+        }
+
+       res = in->readcallback(in->context, (char *)xmlBufEnd(buf), len);
        if (res <= 0)
            in->readcallback = endOfInput;
-    } else {
-       xmlIOErr(XML_IO_NO_INPUT, NULL);
-       in->error = XML_IO_NO_INPUT;
-       return(-1);
-    }
-    if (res < 0) {
-       return(-1);
+        if (res < 0)
+            return(-1);
+
+        if (xmlBufAddLen(buf, res) < 0)
+            return(-1);
     }
 
     /*
@@ -3273,41 +3232,32 @@ xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len) {
 #endif
     }
 
-    len = res;
     if (in->encoder != NULL) {
-        unsigned int use;
-
-        /*
-        * Store the data in the incoming raw buffer
-        */
-        if (in->raw == NULL) {
-           in->raw = xmlBufCreate();
-       }
-       res = xmlBufAdd(in->raw, (const xmlChar *) buffer, len);
-       if (res != 0)
-           return(-1);
+        size_t use, consumed;
 
        /*
         * convert as much as possible to the parser reading buffer.
         */
-       use = xmlBufUse(in->raw);
-       nbchars = xmlCharEncInput(in, 1);
-       if (nbchars < 0) {
+       use = xmlBufUse(buf);
+       res = xmlCharEncInput(in, 1);
+       if (res < 0) {
            xmlIOErr(XML_IO_ENCODER, NULL);
            in->error = XML_IO_ENCODER;
            return(-1);
        }
-       in->rawconsumed += (use - xmlBufUse(in->raw));
-    } else {
-       nbchars = len;
-        xmlBufAddLen(in->buffer, nbchars);
+        consumed = use - xmlBufUse(buf);
+        if ((consumed > ULONG_MAX) ||
+            (in->rawconsumed > ULONG_MAX - (unsigned long)consumed))
+            in->rawconsumed = ULONG_MAX;
+        else
+           in->rawconsumed += consumed;
     }
 #ifdef DEBUG_INPUT
     xmlGenericError(xmlGenericErrorContext,
            "I/O: read %d chars, buffer %d\n",
             nbchars, xmlBufUse(in->buffer));
 #endif
-    return(nbchars);
+    return(res);
 }
 
 /**
@@ -3324,13 +3274,7 @@ xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len) {
  */
 int
 xmlParserInputBufferRead(xmlParserInputBufferPtr in, int len) {
-    if ((in == NULL) || (in->error)) return(-1);
-    if (in->readcallback != NULL)
-       return(xmlParserInputBufferGrow(in, len));
-    else if (xmlBufGetAllocationScheme(in->buffer) == XML_BUFFER_ALLOC_IMMUTABLE)
-       return(0);
-    else
-        return(-1);
+    return(xmlParserInputBufferGrow(in, len));
 }
 
 #ifdef LIBXML_OUTPUT_ENABLED
@@ -3496,7 +3440,7 @@ xmlEscapeContent(unsigned char* out, int *outlen,
            *out++ = '3';
            *out++ = ';';
        } else {
-           *out++ = (unsigned char) *in;
+           *out++ = *in;
        }
        ++in;
     }
@@ -3532,8 +3476,7 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str,
     int cons;        /* byte from str consumed */
 
     if ((out == NULL) || (out->error) || (str == NULL) ||
-        (out->buffer == NULL) ||
-       (xmlBufGetAllocationScheme(out->buffer) == XML_BUFFER_ALLOC_IMMUTABLE))
+        (out->buffer == NULL))
         return(-1);
     len = strlen((const char *)str);
     if (len < 0) return(0);
index 9d92611..60ff001 100644 (file)
@@ -509,6 +509,9 @@ int main(int argc, char **argv) {
                    xmlACatalogDump(catal, stdout);
                }
                i += 2;
+
+                xmlFreeCatalog(catal);
+                xmlFreeCatalog(super);
            } else {
                if ((!strcmp(argv[i], "-add")) ||
                    (!strcmp(argv[i], "--add"))) {
index b5dfbd0..398670b 100644 (file)
--- a/xmllint.c
+++ b/xmllint.c
 
 #include <string.h>
 #include <stdarg.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <assert.h>
 #include <time.h>
+#include <errno.h>
+#include <limits.h>
 
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
@@ -20,9 +23,6 @@
 #ifdef HAVE_SYS_TIMEB_H
 #include <sys/timeb.h>
 #endif
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
@@ -31,6 +31,8 @@
 #endif
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#elif defined (_WIN32)
+#include <io.h>
 #endif
 #ifdef HAVE_SYS_MMAN_H
 #include <sys/mman.h>
@@ -112,8 +114,8 @@ static int noenc = 0;
 static int noblanks = 0;
 static int noout = 0;
 static int nowrap = 0;
-#ifdef LIBXML_OUTPUT_ENABLED
 static int format = 0;
+#ifdef LIBXML_OUTPUT_ENABLED
 static const char *output = NULL;
 static int compress = 0;
 static int oldout = 0;
@@ -352,17 +354,14 @@ myMallocFunc(size_t size)
 static void *
 myReallocFunc(void *mem, size_t size)
 {
-    void *ret;
+    size_t oldsize = xmlMemSize(mem);
 
-    ret = xmlMemRealloc(mem, size);
-    if (ret != NULL) {
-        if (xmlMemUsed() > maxmem) {
-            OOM();
-            xmlMemFree(ret);
-            return (NULL);
-        }
+    if (xmlMemUsed() + size - oldsize > (size_t) maxmem) {
+        OOM();
+        return (NULL);
     }
-    return (ret);
+
+    return (xmlMemRealloc(mem, size));
 }
 static char *
 myStrdupFunc(const char *str)
@@ -428,7 +427,7 @@ startTimer(void)
  *           message about the timing performed; format is a printf
  *           type argument
  */
-static void XMLCDECL LIBXML_ATTR_FORMAT(1,2)
+static void LIBXML_ATTR_FORMAT(1,2)
 endTimer(const char *fmt, ...)
 {
     long msec;
@@ -461,7 +460,7 @@ startTimer(void)
 {
     begin = clock();
 }
-static void XMLCDECL LIBXML_ATTR_FORMAT(1,2)
+static void LIBXML_ATTR_FORMAT(1,2)
 endTimer(const char *fmt, ...)
 {
     long msec;
@@ -583,7 +582,7 @@ xmlHTMLPrintFileContext(xmlParserInputPtr input) {
  * Display and format an error messages, gives file, line, position and
  * extra parameters.
  */
-static void XMLCDECL LIBXML_ATTR_FORMAT(2,3)
+static void LIBXML_ATTR_FORMAT(2,3)
 xmlHTMLError(void *ctx, const char *msg, ...)
 {
     xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
@@ -620,7 +619,7 @@ xmlHTMLError(void *ctx, const char *msg, ...)
  * Display and format a warning messages, gives file, line, position and
  * extra parameters.
  */
-static void XMLCDECL LIBXML_ATTR_FORMAT(2,3)
+static void LIBXML_ATTR_FORMAT(2,3)
 xmlHTMLWarning(void *ctx, const char *msg, ...)
 {
     xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
@@ -658,7 +657,7 @@ xmlHTMLWarning(void *ctx, const char *msg, ...)
  * Display and format an validity error messages, gives file,
  * line, position and extra parameters.
  */
-static void XMLCDECL LIBXML_ATTR_FORMAT(2,3)
+static void LIBXML_ATTR_FORMAT(2,3)
 xmlHTMLValidityError(void *ctx, const char *msg, ...)
 {
     xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
@@ -695,7 +694,7 @@ xmlHTMLValidityError(void *ctx, const char *msg, ...)
  * Display and format a validity warning messages, gives file, line,
  * position and extra parameters.
  */
-static void XMLCDECL LIBXML_ATTR_FORMAT(2,3)
+static void LIBXML_ATTR_FORMAT(2,3)
 xmlHTMLValidityWarning(void *ctx, const char *msg, ...)
 {
     xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
@@ -1361,7 +1360,7 @@ commentDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *value)
  * Display and format a warning messages, gives file, line, position and
  * extra parameters.
  */
-static void XMLCDECL LIBXML_ATTR_FORMAT(2,3)
+static void LIBXML_ATTR_FORMAT(2,3)
 warningDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
 {
     va_list args;
@@ -1384,7 +1383,7 @@ warningDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
  * Display and format a error messages, gives file, line, position and
  * extra parameters.
  */
-static void XMLCDECL LIBXML_ATTR_FORMAT(2,3)
+static void LIBXML_ATTR_FORMAT(2,3)
 errorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
 {
     va_list args;
@@ -1407,7 +1406,7 @@ errorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
  * Display and format a fatalError messages, gives file, line, position and
  * extra parameters.
  */
-static void XMLCDECL LIBXML_ATTR_FORMAT(2,3)
+static void LIBXML_ATTR_FORMAT(2,3)
 fatalErrorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
 {
     va_list args;
@@ -1586,10 +1585,6 @@ static void
 testSAX(const char *filename) {
     xmlSAXHandlerPtr handler;
     const char *user_data = "user_data"; /* mostly for debugging */
-    xmlParserInputBufferPtr buf = NULL;
-    xmlParserInputPtr inputStream;
-    xmlParserCtxtPtr ctxt = NULL;
-    xmlSAXHandlerPtr old_sax = NULL;
 
     callbacks = 0;
 
@@ -1603,24 +1598,22 @@ testSAX(const char *filename) {
         handler = debugSAX2Handler;
     }
 
-    /*
-     * it's not the simplest code but the most generic in term of I/O
-     */
-    buf = xmlParserInputBufferCreateFilename(filename, XML_CHAR_ENCODING_NONE);
-    if (buf == NULL) {
-        goto error;
-    }
-
 #ifdef LIBXML_SCHEMAS_ENABLED
     if (wxschemas != NULL) {
         int ret;
        xmlSchemaValidCtxtPtr vctxt;
+        xmlParserInputBufferPtr buf;
+
+        buf = xmlParserInputBufferCreateFilename(filename,
+                XML_CHAR_ENCODING_NONE);
+        if (buf == NULL)
+            return;
 
        vctxt = xmlSchemaNewValidCtxt(wxschemas);
         if (vctxt == NULL) {
             progresult = XMLLINT_ERR_MEM;
             xmlFreeParserInputBuffer(buf);
-            goto error;
+            return;
         }
        xmlSchemaSetValidErrors(vctxt, xmlGenericError, xmlGenericError, NULL);
        xmlSchemaValidateSetFilename(vctxt, filename);
@@ -1645,38 +1638,23 @@ testSAX(const char *filename) {
     } else
 #endif
     {
+        xmlParserCtxtPtr ctxt = NULL;
+
        /*
         * Create the parser context amd hook the input
         */
-       ctxt = xmlNewParserCtxt();
+       ctxt = xmlNewSAXParserCtxt(handler, (void *) user_data);
        if (ctxt == NULL) {
             progresult = XMLLINT_ERR_MEM;
-           xmlFreeParserInputBuffer(buf);
-           goto error;
-       }
-       old_sax = ctxt->sax;
-       ctxt->sax = handler;
-       ctxt->userData = (void *) user_data;
-       inputStream = xmlNewIOInputStream(ctxt, buf, XML_CHAR_ENCODING_NONE);
-       if (inputStream == NULL) {
-           xmlFreeParserInputBuffer(buf);
-           goto error;
+           return;
        }
-       inputPush(ctxt, inputStream);
-
-       /* do the parsing */
-       xmlParseDocument(ctxt);
+        xmlCtxtReadFile(ctxt, filename, NULL, options);
 
        if (ctxt->myDoc != NULL) {
            fprintf(stderr, "SAX generated a doc !\n");
            xmlFreeDoc(ctxt->myDoc);
            ctxt->myDoc = NULL;
        }
-    }
-
-error:
-    if (ctxt != NULL) {
-        ctxt->sax = old_sax;
         xmlFreeParserCtxt(ctxt);
     }
 }
@@ -1806,15 +1784,6 @@ static void streamFile(char *filename) {
 #endif
        reader = xmlReaderForFile(filename, NULL, options);
 #ifdef LIBXML_PATTERN_ENABLED
-    if (pattern != NULL) {
-        patternc = xmlPatterncompile((const xmlChar *) pattern, NULL, 0, NULL);
-       if (patternc == NULL) {
-           xmlGenericError(xmlGenericErrorContext,
-                   "Pattern %s failed to compile\n", pattern);
-            progresult = XMLLINT_ERR_SCHEMAPAT;
-           pattern = NULL;
-       }
-    }
     if (patternc != NULL) {
         patstream = xmlPatternGetStreamCtxt(patternc);
        if (patstream != NULL) {
@@ -2046,8 +2015,9 @@ static void doXPathDump(xmlXPathObjectPtr cur) {
             xmlOutputBufferPtr buf;
 
             if ((cur->nodesetval == NULL) || (cur->nodesetval->nodeNr <= 0)) {
-                fprintf(stderr, "XPath set is empty\n");
-                progresult = XMLLINT_ERR_XPATH;
+                if (!quiet) {
+                    fprintf(stderr, "XPath set is empty\n");
+                }
                 break;
             }
             buf = xmlOutputBufferCreateFile(stdout, NULL);
@@ -2357,14 +2327,8 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
        } else {
            if (rectxt != NULL)
                doc = xmlCtxtReadFile(rectxt, filename, NULL, options);
-           else {
-#ifdef LIBXML_SAX1_ENABLED
-                if (sax1)
-                   doc = xmlParseFile(filename);
-               else
-#endif /* LIBXML_SAX1_ENABLED */
+           else
                doc = xmlReadFile(filename, NULL, options);
-           }
        }
     }
 
@@ -2738,7 +2702,6 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
                 xmlFreeDtd(dtd);
                 return;
            }
-           cvp->userData = NULL;
            cvp->error    = xmlGenericError;
            cvp->warning  = xmlGenericError;
 
@@ -2776,7 +2739,6 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
        if ((timing) && (!repeat)) {
            startTimer();
        }
-       cvp->userData = NULL;
        cvp->error    = xmlGenericError;
        cvp->warning  = xmlGenericError;
        if (!xmlValidateDocument(cvp, doc)) {
@@ -3125,10 +3087,25 @@ main(int argc, char **argv) {
 
        if ((!strcmp(argv[i], "-maxmem")) ||
            (!strcmp(argv[i], "--maxmem"))) {
-            i++;
-            if ((i >= argc) || (sscanf(argv[i], "%d", &maxmem) != 1)) {
-                maxmem = 0;
-            }
+            char *val_end;
+            long val;
+
+            i++;
+            if (i >= argc) {
+                fprintf(stderr, "maxmem: missing integer value\n");
+                return(XMLLINT_ERR_UNCLASS);
+            }
+            errno = 0;
+            val = strtol(argv[i], &val_end, 10);
+            if (errno == EINVAL || *val_end != 0) {
+                fprintf(stderr, "maxmem: invalid integer: %s\n", argv[i]);
+                return(XMLLINT_ERR_UNCLASS);
+            }
+            if (errno != 0 || val < 0 || val > INT_MAX) {
+                fprintf(stderr, "maxmem: integer out of range: %s\n", argv[i]);
+                return(XMLLINT_ERR_UNCLASS);
+            }
+            maxmem = val;
         }
     }
     if (maxmem != 0)
@@ -3164,8 +3141,7 @@ main(int argc, char **argv) {
            options |= XML_PARSE_HUGE;
        } else if ((!strcmp(argv[i], "-noent")) ||
                 (!strcmp(argv[i], "--noent"))) {
-           noent++;
-           options |= XML_PARSE_NOENT;
+           noent = 1;
        } else if ((!strcmp(argv[i], "-noenc")) ||
                 (!strcmp(argv[i], "--noenc"))) {
            noenc++;
@@ -3318,15 +3294,13 @@ main(int argc, char **argv) {
 #endif /* LIBXML_OUTPUT_ENABLED */
        else if ((!strcmp(argv[i], "-nowarning")) ||
                 (!strcmp(argv[i], "--nowarning"))) {
-           xmlGetWarningsDefaultValue = 0;
-           xmlPedanticParserDefault(0);
            options |= XML_PARSE_NOWARNING;
+            options &= ~XML_PARSE_PEDANTIC;
         }
        else if ((!strcmp(argv[i], "-pedantic")) ||
                 (!strcmp(argv[i], "--pedantic"))) {
-           xmlGetWarningsDefaultValue = 1;
-           xmlPedanticParserDefault(1);
            options |= XML_PARSE_PEDANTIC;
+            options &= XML_PARSE_NOWARNING;
         }
 #ifdef LIBXML_DEBUG_ENABLED
        else if ((!strcmp(argv[i], "-debugent")) ||
@@ -3372,9 +3346,7 @@ main(int argc, char **argv) {
         }
        else if ((!strcmp(argv[i], "-noblanks")) ||
                 (!strcmp(argv[i], "--noblanks"))) {
-           noblanks++;
-           xmlKeepBlanksDefault(0);
-           options |= XML_PARSE_NOBLANKS;
+           noblanks = 1;
         }
        else if ((!strcmp(argv[i], "-maxmem")) ||
                 (!strcmp(argv[i], "--maxmem"))) {
@@ -3382,23 +3354,16 @@ main(int argc, char **argv) {
         }
        else if ((!strcmp(argv[i], "-format")) ||
                 (!strcmp(argv[i], "--format"))) {
-            noblanks++;
 #ifdef LIBXML_OUTPUT_ENABLED
-            format = 1;
+           format = 1;
 #endif /* LIBXML_OUTPUT_ENABLED */
-            xmlKeepBlanksDefault(0);
        }
        else if ((!strcmp(argv[i], "-pretty")) ||
                 (!strcmp(argv[i], "--pretty"))) {
-            i++;
+           i++;
 #ifdef LIBXML_OUTPUT_ENABLED
-       if (argv[i] != NULL) {
-                format = atoi(argv[i]);
-                if (format == 1) {
-                    noblanks++;
-                    xmlKeepBlanksDefault(0);
-                }
-       }
+            if (argv[i] != NULL)
+               format = atoi(argv[i]);
 #endif /* LIBXML_OUTPUT_ENABLED */
        }
 #ifdef LIBXML_READER_ENABLED
@@ -3437,20 +3402,19 @@ main(int argc, char **argv) {
                 (!strcmp(argv[i], "--relaxng"))) {
            i++;
            relaxng = argv[i];
-           noent++;
-           options |= XML_PARSE_NOENT;
+           noent = 1;
        } else if ((!strcmp(argv[i], "-schema")) ||
                 (!strcmp(argv[i], "--schema"))) {
            i++;
            schema = argv[i];
-           noent++;
+           noent = 1;
 #endif
 #ifdef LIBXML_SCHEMATRON_ENABLED
        } else if ((!strcmp(argv[i], "-schematron")) ||
                 (!strcmp(argv[i], "--schematron"))) {
            i++;
            schematron = argv[i];
-           noent++;
+           noent = 1;
 #endif
         } else if ((!strcmp(argv[i], "-nonet")) ||
                    (!strcmp(argv[i], "--nonet"))) {
@@ -3499,13 +3463,6 @@ main(int argc, char **argv) {
     }
 #endif
 
-#ifdef LIBXML_SAX1_ENABLED
-    if (sax1)
-        xmlSAXDefaultVersion(1);
-    else
-        xmlSAXDefaultVersion(2);
-#endif /* LIBXML_SAX1_ENABLED */
-
     if (chkregister) {
        xmlRegisterNodeDefault(registerNode);
        xmlDeregisterNodeDefault(deregisterNode);
@@ -3520,15 +3477,14 @@ main(int argc, char **argv) {
     defaultEntityLoader = xmlGetExternalEntityLoader();
     xmlSetExternalEntityLoader(xmllintExternalEntityLoader);
 
-    xmlLineNumbersDefault(1);
     if (loaddtd != 0)
        xmlLoadExtDtdDefaultValue |= XML_DETECT_IDS;
     if (dtdattrs)
        xmlLoadExtDtdDefaultValue |= XML_COMPLETE_ATTRS;
-    if (noent != 0) xmlSubstituteEntitiesDefault(1);
-#ifdef LIBXML_VALID_ENABLED
-    if (valid != 0) xmlDoValidityCheckingDefaultValue = 1;
-#endif /* LIBXML_VALID_ENABLED */
+    if (noent != 0)
+        options |= XML_PARSE_NOENT;
+    if ((noblanks != 0) || (format == 1))
+        options |= XML_PARSE_NOBLANKS;
     if ((htmlout) && (!nowrap)) {
        xmlGenericError(xmlGenericErrorContext,
          "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"\n");
index 892d50c..9ec4770 100644 (file)
 #include <libxml/xmlerror.h>
 #include <libxml/threads.h>
 
-static int xmlMemInitialized = 0;
+#include "private/memory.h"
+#include "private/threads.h"
+
 static unsigned long  debugMemSize = 0;
 static unsigned long  debugMemBlocks = 0;
 static unsigned long  debugMaxMemSize = 0;
-static xmlMutexPtr xmlMemMutex = NULL;
+static xmlMutex xmlMemMutex;
 
 void xmlMallocBreakpoint(void);
 
@@ -147,7 +149,7 @@ xmlMallocLoc(size_t size, const char * file, int line)
     MEMHDR *p;
     void *ret;
 
-    if (!xmlMemInitialized) xmlInitMemory();
+    xmlInitParser();
 #ifdef DEBUG_MEMORY
     xmlGenericError(xmlGenericErrorContext,
            "Malloc(%d)\n",size);
@@ -175,7 +177,7 @@ xmlMallocLoc(size_t size, const char * file, int line)
     p->mh_type = MALLOC_TYPE;
     p->mh_file = file;
     p->mh_line = line;
-    xmlMutexLock(xmlMemMutex);
+    xmlMutexLock(&xmlMemMutex);
     p->mh_number = ++block;
     debugMemSize += size;
     debugMemBlocks++;
@@ -183,7 +185,7 @@ xmlMallocLoc(size_t size, const char * file, int line)
 #ifdef MEM_LIST
     debugmem_list_add(p);
 #endif
-    xmlMutexUnlock(xmlMemMutex);
+    xmlMutexUnlock(&xmlMemMutex);
 
 #ifdef DEBUG_MEMORY
     xmlGenericError(xmlGenericErrorContext,
@@ -223,7 +225,7 @@ xmlMallocAtomicLoc(size_t size, const char * file, int line)
     MEMHDR *p;
     void *ret;
 
-    if (!xmlMemInitialized) xmlInitMemory();
+    xmlInitParser();
 #ifdef DEBUG_MEMORY
     xmlGenericError(xmlGenericErrorContext,
            "Malloc(%d)\n",size);
@@ -251,7 +253,7 @@ xmlMallocAtomicLoc(size_t size, const char * file, int line)
     p->mh_type = MALLOC_ATOMIC_TYPE;
     p->mh_file = file;
     p->mh_line = line;
-    xmlMutexLock(xmlMemMutex);
+    xmlMutexLock(&xmlMemMutex);
     p->mh_number = ++block;
     debugMemSize += size;
     debugMemBlocks++;
@@ -259,7 +261,7 @@ xmlMallocAtomicLoc(size_t size, const char * file, int line)
 #ifdef MEM_LIST
     debugmem_list_add(p);
 #endif
-    xmlMutexUnlock(xmlMemMutex);
+    xmlMutexUnlock(&xmlMemMutex);
 
 #ifdef DEBUG_MEMORY
     xmlGenericError(xmlGenericErrorContext,
@@ -320,7 +322,7 @@ xmlReallocLoc(void *ptr,size_t size, const char * file, int line)
     if (ptr == NULL)
         return(xmlMallocLoc(size, file, line));
 
-    if (!xmlMemInitialized) xmlInitMemory();
+    xmlInitParser();
     TEST_POINT
 
     p = CLIENT_2_HDR(ptr);
@@ -331,7 +333,7 @@ xmlReallocLoc(void *ptr,size_t size, const char * file, int line)
         goto error;
     }
     p->mh_tag = ~MEMTAG;
-    xmlMutexLock(xmlMemMutex);
+    xmlMutexLock(&xmlMemMutex);
     debugMemSize -= p->mh_size;
     debugMemBlocks--;
 #ifdef DEBUG_MEMORY
@@ -340,7 +342,7 @@ xmlReallocLoc(void *ptr,size_t size, const char * file, int line)
 #ifdef MEM_LIST
     debugmem_list_delete(p);
 #endif
-    xmlMutexUnlock(xmlMemMutex);
+    xmlMutexUnlock(&xmlMemMutex);
 
     if (size > (MAX_SIZE_T - RESERVE_SIZE)) {
        xmlGenericError(xmlGenericErrorContext,
@@ -368,14 +370,14 @@ xmlReallocLoc(void *ptr,size_t size, const char * file, int line)
     p->mh_size = size;
     p->mh_file = file;
     p->mh_line = line;
-    xmlMutexLock(xmlMemMutex);
+    xmlMutexLock(&xmlMemMutex);
     debugMemSize += size;
     debugMemBlocks++;
     if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize;
 #ifdef MEM_LIST
     debugmem_list_add(p);
 #endif
-    xmlMutexUnlock(xmlMemMutex);
+    xmlMutexUnlock(&xmlMemMutex);
 
     TEST_POINT
 
@@ -446,7 +448,7 @@ xmlMemFree(void *ptr)
     if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint();
     p->mh_tag = ~MEMTAG;
     memset(target, -1, p->mh_size);
-    xmlMutexLock(xmlMemMutex);
+    xmlMutexLock(&xmlMemMutex);
     debugMemSize -= p->mh_size;
     debugMemBlocks--;
 #ifdef DEBUG_MEMORY
@@ -455,7 +457,7 @@ xmlMemFree(void *ptr)
 #ifdef MEM_LIST
     debugmem_list_delete(p);
 #endif
-    xmlMutexUnlock(xmlMemMutex);
+    xmlMutexUnlock(&xmlMemMutex);
 
     free(p);
 
@@ -493,7 +495,7 @@ xmlMemStrdupLoc(const char *str, const char *file, int line)
     size_t size = strlen(str) + 1;
     MEMHDR *p;
 
-    if (!xmlMemInitialized) xmlInitMemory();
+    xmlInitParser();
     TEST_POINT
 
     if (size > (MAX_SIZE_T - RESERVE_SIZE)) {
@@ -512,7 +514,7 @@ xmlMemStrdupLoc(const char *str, const char *file, int line)
     p->mh_type = STRDUP_TYPE;
     p->mh_file = file;
     p->mh_line = line;
-    xmlMutexLock(xmlMemMutex);
+    xmlMutexLock(&xmlMemMutex);
     p->mh_number = ++block;
     debugMemSize += size;
     debugMemBlocks++;
@@ -520,7 +522,7 @@ xmlMemStrdupLoc(const char *str, const char *file, int line)
 #ifdef MEM_LIST
     debugmem_list_add(p);
 #endif
-    xmlMutexUnlock(xmlMemMutex);
+    xmlMutexUnlock(&xmlMemMutex);
 
     s = (char *) HDR_2_CLIENT(p);
 
@@ -557,6 +559,27 @@ xmlMemoryStrdup(const char *str) {
 }
 
 /**
+ * xmlMemSize:
+ * @ptr:  pointer to the memory allocation
+ *
+ * Returns the size of a memory allocation.
+ */
+
+size_t
+xmlMemSize(void *ptr) {
+    MEMHDR *p;
+
+    if (ptr == NULL)
+       return(0);
+
+    p = CLIENT_2_HDR(ptr);
+    if (p->mh_tag != MEMTAG)
+        return(0);
+
+    return(p->mh_size);
+}
+
+/**
  * xmlMemUsed:
  *
  * Provides the amount of memory currently allocated
@@ -566,12 +589,7 @@ xmlMemoryStrdup(const char *str) {
 
 int
 xmlMemUsed(void) {
-    int res;
-
-    xmlMutexLock(xmlMemMutex);
-    res = debugMemSize;
-    xmlMutexUnlock(xmlMemMutex);
-    return(res);
+    return(debugMemSize);
 }
 
 /**
@@ -586,74 +604,12 @@ int
 xmlMemBlocks(void) {
     int res;
 
-    xmlMutexLock(xmlMemMutex);
+    xmlMutexLock(&xmlMemMutex);
     res = debugMemBlocks;
-    xmlMutexUnlock(xmlMemMutex);
+    xmlMutexUnlock(&xmlMemMutex);
     return(res);
 }
 
-#ifdef MEM_LIST
-/**
- * xmlMemContentShow:
- * @fp:  a FILE descriptor used as the output file
- * @p:  a memory block header
- *
- * tries to show some content from the memory block
- */
-
-static void
-xmlMemContentShow(FILE *fp, MEMHDR *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;
-       if (!isprint((unsigned char) buf[i])) break;
-    }
-    if ((i < 4) && ((buf[i] != 0) || (i == 0))) {
-        if (len >= 4) {
-           MEMHDR *q;
-           void *cur;
-
-            for (j = 0;(j < len -3) && (j < 40);j += 4) {
-               cur = *((void **) &buf[j]);
-               q = CLIENT_2_HDR(cur);
-               p = memlist;
-               k = 0;
-               while (p != NULL) {
-                   if (p == q) break;
-                   p = p->mh_next;
-                   if (k++ > 100) break;
-               }
-               if ((p != NULL) && (p == q)) {
-                   fprintf(fp, " pointer to #%lu at index %d",
-                           p->mh_number, j);
-                   return;
-               }
-           }
-       }
-    } else if ((i == 0) && (buf[i] == 0)) {
-        fprintf(fp," null");
-    } else {
-        if (buf[i] == 0) fprintf(fp," \"%.25s\"", buf);
-       else {
-            fprintf(fp," [");
-           for (j = 0;j < i;j++)
-                fprintf(fp,"%c", buf[j]);
-            fprintf(fp,"]");
-       }
-    }
-}
-#endif
-
 /**
  * xmlMemDisplayLast:
  * @fp:  a FILE descriptor used as the output file, if NULL, the result is
@@ -688,7 +644,7 @@ xmlMemDisplayLast(FILE *fp, long nbBytes)
             nbBytes, debugMemSize, debugMaxMemSize);
     fprintf(fp,"BLOCK  NUMBER   SIZE  TYPE\n");
     idx = 0;
-    xmlMutexLock(xmlMemMutex);
+    xmlMutexLock(&xmlMemMutex);
     p = memlist;
     while ((p) && (nbBytes > 0)) {
          fprintf(fp,"%-5u  %6lu %6lu ",idx++,p->mh_number,
@@ -701,7 +657,7 @@ xmlMemDisplayLast(FILE *fp, long nbBytes)
            case REALLOC_ATOMIC_TYPE:fprintf(fp,"atomicrealloc() in ");break;
            default:
                fprintf(fp,"Unknown memory block, may be corrupted");
-               xmlMutexUnlock(xmlMemMutex);
+               xmlMutexUnlock(&xmlMemMutex);
                if (old_fp == NULL)
                    fclose(fp);
                return;
@@ -710,16 +666,12 @@ xmlMemDisplayLast(FILE *fp, long nbBytes)
         if (p->mh_tag != MEMTAG)
              fprintf(fp,"  INVALID");
         nb++;
-       if (nb < 100)
-           xmlMemContentShow(fp, p);
-       else
-           fprintf(fp," skip");
 
         fprintf(fp,"\n");
        nbBytes -= (unsigned long)p->mh_size;
         p = p->mh_next;
     }
-    xmlMutexUnlock(xmlMemMutex);
+    xmlMutexUnlock(&xmlMemMutex);
 #else
     fprintf(fp,"Memory list not compiled (MEM_LIST not defined !)\n");
 #endif
@@ -765,7 +717,7 @@ xmlMemDisplay(FILE *fp)
             debugMemSize, debugMaxMemSize);
     fprintf(fp,"BLOCK  NUMBER   SIZE  TYPE\n");
     idx = 0;
-    xmlMutexLock(xmlMemMutex);
+    xmlMutexLock(&xmlMemMutex);
     p = memlist;
     while (p) {
          fprintf(fp,"%-5u  %6lu %6lu ",idx++,p->mh_number,
@@ -778,7 +730,7 @@ xmlMemDisplay(FILE *fp)
            case REALLOC_ATOMIC_TYPE:fprintf(fp,"atomicrealloc() in ");break;
            default:
                fprintf(fp,"Unknown memory block, may be corrupted");
-               xmlMutexUnlock(xmlMemMutex);
+               xmlMutexUnlock(&xmlMemMutex);
                if (old_fp == NULL)
                    fclose(fp);
                return;
@@ -787,15 +739,11 @@ xmlMemDisplay(FILE *fp)
         if (p->mh_tag != MEMTAG)
              fprintf(fp,"  INVALID");
         nb++;
-       if (nb < 100)
-           xmlMemContentShow(fp, p);
-       else
-           fprintf(fp," skip");
 
         fprintf(fp,"\n");
         p = p->mh_next;
     }
-    xmlMutexUnlock(xmlMemMutex);
+    xmlMutexUnlock(&xmlMemMutex);
 #else
     fprintf(fp,"Memory list not compiled (MEM_LIST not defined !)\n");
 #endif
@@ -872,7 +820,7 @@ xmlMemShow(FILE *fp, int nr ATTRIBUTE_UNUSED)
        fprintf(fp,"      MEMORY ALLOCATED : %lu, MAX was %lu\n",
                debugMemSize, debugMaxMemSize);
 #ifdef MEM_LIST
-    xmlMutexLock(xmlMemMutex);
+    xmlMutexLock(&xmlMemMutex);
     if (nr > 0) {
        fprintf(fp,"NUMBER   SIZE  TYPE   WHERE\n");
        p = memlist;
@@ -890,13 +838,12 @@ xmlMemShow(FILE *fp, int nr ATTRIBUTE_UNUSED)
                fprintf(fp,"%s(%u)", p->mh_file, p->mh_line);
            if (p->mh_tag != MEMTAG)
                fprintf(fp,"  INVALID");
-           xmlMemContentShow(fp, p);
            fprintf(fp,"\n");
            nr--;
            p = p->mh_next;
        }
     }
-    xmlMutexUnlock(xmlMemMutex);
+    xmlMutexUnlock(&xmlMemMutex);
 #endif /* MEM_LIST */
 }
 
@@ -935,28 +882,29 @@ xmlMemoryDump(void)
 /**
  * xmlInitMemory:
  *
- * DEPRECATED: This function will be made private. Call xmlInitParser to
- * initialize the library.
+ * DEPRECATED: Alias for xmlInitParser.
+ */
+int
+xmlInitMemory(void) {
+    xmlInitParser();
+    return(0);
+}
+
+/**
+ * xmlInitMemoryInternal:
  *
  * Initialize the memory layer.
  *
  * Returns 0 on success
  */
-int
-xmlInitMemory(void)
-{
+void
+xmlInitMemoryInternal(void) {
      char *breakpoint;
 #ifdef DEBUG_MEMORY
      xmlGenericError(xmlGenericErrorContext,
             "xmlInitMemory()\n");
 #endif
-    /*
-     This is really not good code (see Bug 130419).  Suggestions for
-     improvement will be welcome!
-    */
-     if (xmlMemInitialized) return(-1);
-     xmlMemInitialized = 1;
-     xmlMemMutex = xmlNewMutex();
+     xmlInitMutex(&xmlMemMutex);
 
      breakpoint = getenv("XML_MEM_BREAKPOINT");
      if (breakpoint != NULL) {
@@ -971,32 +919,34 @@ xmlInitMemory(void)
      xmlGenericError(xmlGenericErrorContext,
             "xmlInitMemory() Ok\n");
 #endif
-     return(0);
 }
 
 /**
  * xmlCleanupMemory:
  *
- * DEPRECATED: This function will be made private. Call xmlCleanupParser
+ * DEPRECATED: This function is a no-op. Call xmlCleanupParser
  * to free global state but see the warnings there. xmlCleanupParser
  * should be only called once at program exit. In most cases, you don't
  * have call cleanup functions at all.
+ */
+void
+xmlCleanupMemory(void) {
+}
+
+/**
+ * xmlCleanupMemoryInternal:
  *
  * Free up all the memory allocated by the library for its own
  * use. This should not be called by user level code.
  */
 void
-xmlCleanupMemory(void) {
+xmlCleanupMemoryInternal(void) {
 #ifdef DEBUG_MEMORY
      xmlGenericError(xmlGenericErrorContext,
             "xmlCleanupMemory()\n");
 #endif
-    if (xmlMemInitialized == 0)
-        return;
 
-    xmlFreeMutex(xmlMemMutex);
-    xmlMemMutex = NULL;
-    xmlMemInitialized = 0;
+    xmlCleanupMutex(&xmlMemMutex);
 #ifdef DEBUG_MEMORY
      xmlGenericError(xmlGenericErrorContext,
             "xmlCleanupMemory() Ok\n");
index 44eba06..cbb25a6 100644 (file)
@@ -22,6 +22,8 @@
 #include <libxml/xmlmodule.h>
 #include <libxml/globals.h>
 
+#include "private/error.h"
+
 #ifdef LIBXML_MODULES_ENABLED
 
 struct _xmlModule {
@@ -340,7 +342,7 @@ xmlModulePlatformClose(void *handle)
 static int
 xmlModulePlatformSymbol(void *handle, const char *name, void **symbol)
 {
-XML_IGNORE_PEDANTIC_WARNINGS
+XML_IGNORE_FPTR_CAST_WARNINGS
     *symbol = GetProcAddress(handle, name);
     return (NULL == *symbol) ? -1 : 0;
 XML_POP_WARNINGS
@@ -348,112 +350,4 @@ XML_POP_WARNINGS
 
 #endif /* _WIN32 */
 
-#ifdef HAVE_BEOS
-
-#include <kernel/image.h>
-
-/*
- * xmlModulePlatformOpen:
- * beos api info: http://www.beunited.org/bebook/The%20Kernel%20Kit/Images.html
- * returns a handle on success, and zero on error.
- */
-
-static void *
-xmlModulePlatformOpen(const char *name)
-{
-    return (void *) load_add_on(name);
-}
-
-/*
- * xmlModulePlatformClose:
- * beos api info: http://www.beunited.org/bebook/The%20Kernel%20Kit/Images.html
- * returns 0 on success, and non-zero on error.
- */
-
-static int
-xmlModulePlatformClose(void *handle)
-{
-    status_t rc;
-
-    rc = unload_add_on((image_id) handle);
-
-    if (rc == B_OK)
-        return 0;
-    else
-        return -1;
-}
-
-/*
- * xmlModulePlatformSymbol:
- * beos api info: http://www.beunited.org/bebook/The%20Kernel%20Kit/Images.html
- * returns 0 on success and the loaded symbol in result, and -1 on error.
- */
-
-static int
-xmlModulePlatformSymbol(void *handle, const char *name, void **symbol)
-{
-    status_t rc;
-
-    rc = get_image_symbol((image_id) handle, name, B_SYMBOL_TYPE_ANY, symbol);
-
-    return (rc == B_OK) ? 0 : -1;
-}
-
-#endif /* HAVE_BEOS */
-
-#ifdef HAVE_OS2
-
-#include <os2.h>
-
-/*
- * xmlModulePlatformOpen:
- * os2 api info: http://www.edm2.com/os2api/Dos/DosLoadModule.html
- * returns a handle on success, and zero on error.
- */
-
-static void *
-xmlModulePlatformOpen(const char *name)
-{
-    char errbuf[256];
-    void *handle;
-    int rc;
-
-    rc = DosLoadModule(errbuf, sizeof(errbuf) - 1, name, &handle);
-
-    if (rc)
-        return 0;
-    else
-        return (handle);
-}
-
-/*
- * xmlModulePlatformClose:
- * os2 api info: http://www.edm2.com/os2api/Dos/DosFreeModule.html
- * returns 0 on success, and non-zero on error.
- */
-
-static int
-xmlModulePlatformClose(void *handle)
-{
-    return DosFreeModule(handle);
-}
-
-/*
- * xmlModulePlatformSymbol:
- * os2 api info: http://www.edm2.com/os2api/Dos/DosQueryProcAddr.html
- * returns 0 on success and the loaded symbol in result, and -1 on error.
- */
-
-static int
-xmlModulePlatformSymbol(void *handle, const char *name, void **symbol)
-{
-    int rc;
-
-    rc = DosQueryProcAddr(handle, 0, name, symbol);
-
-    return (rc == NO_ERROR) ? 0 : -1;
-}
-
-#endif /* HAVE_OS2 */
-
 #endif /* LIBXML_MODULES_ENABLED */
index b3299ce..979385a 100644 (file)
 #include <libxml/pattern.h>
 #endif
 
-#include "buf.h"
+#include "private/buf.h"
+#include "private/tree.h"
+#ifdef LIBXML_XINCLUDE_ENABLED
+#include "private/xinclude.h"
+#endif
 
 #define MAX_ERR_MSG_SIZE 64000
 
@@ -536,30 +540,23 @@ xmlTextReaderDebug(xmlTextReaderPtr reader) {
  *
  * Pushes a new entity reference node on top of the entities stack
  *
- * Returns 0 in case of error, the index in the stack otherwise
+ * Returns -1 in case of error, the index in the stack otherwise
  */
 static int
 xmlTextReaderEntPush(xmlTextReaderPtr reader, xmlNodePtr value)
 {
-    if (reader->entMax <= 0) {
-       reader->entMax = 10;
-       reader->entTab = (xmlNodePtr *) xmlMalloc(reader->entMax *
-                                                 sizeof(reader->entTab[0]));
-        if (reader->entTab == NULL) {
-            xmlGenericError(xmlGenericErrorContext, "xmlMalloc failed !\n");
-            return (0);
-        }
-    }
     if (reader->entNr >= reader->entMax) {
-        reader->entMax *= 2;
-        reader->entTab =
-            (xmlNodePtr *) xmlRealloc(reader->entTab,
-                                      reader->entMax *
-                                      sizeof(reader->entTab[0]));
-        if (reader->entTab == NULL) {
+        size_t newSize = reader->entMax == 0 ? 10 : reader->entMax * 2;
+        xmlNodePtr *tmp;
+
+        tmp = (xmlNodePtr *) xmlRealloc(reader->entTab,
+                                        newSize * sizeof(*tmp));
+        if (tmp == NULL) {
             xmlGenericError(xmlGenericErrorContext, "xmlRealloc failed !\n");
-            return (0);
+            return (-1);
         }
+        reader->entTab = tmp;
+        reader->entMax = newSize;
     }
     reader->entTab[reader->entNr] = value;
     reader->ent = value;
@@ -769,7 +766,6 @@ xmlTextReaderPushData(xmlTextReaderPtr reader) {
     xmlBufPtr inbuf;
     int val, s;
     xmlTextReaderState oldstate;
-    int alloc;
 
     if ((reader->input == NULL) || (reader->input->buffer == NULL))
        return(-1);
@@ -777,7 +773,6 @@ xmlTextReaderPushData(xmlTextReaderPtr reader) {
     oldstate = reader->state;
     reader->state = XML_TEXTREADER_NONE;
     inbuf = reader->input->buffer;
-    alloc = xmlBufGetAllocationScheme(inbuf);
 
     while (reader->state == XML_TEXTREADER_NONE) {
        if (xmlBufUse(inbuf) < reader->cur + CHUNK_SIZE) {
@@ -787,7 +782,7 @@ xmlTextReaderPushData(xmlTextReaderPtr reader) {
            if (reader->mode != XML_TEXTREADER_MODE_EOF) {
                val = xmlParserInputBufferRead(reader->input, 4096);
                if ((val == 0) &&
-                   (alloc == XML_BUFFER_ALLOC_IMMUTABLE)) {
+                   (reader->input->readcallback == NULL)) {
                    if (xmlBufUse(inbuf) == reader->cur) {
                        reader->mode = XML_TEXTREADER_MODE_EOF;
                        reader->state = oldstate;
@@ -836,7 +831,7 @@ xmlTextReaderPushData(xmlTextReaderPtr reader) {
      * Discard the consumed input when needed and possible
      */
     if (reader->mode == XML_TEXTREADER_MODE_INTERACTIVE) {
-        if (alloc != XML_BUFFER_ALLOC_IMMUTABLE) {
+        if (reader->input->readcallback != NULL) {
            if ((reader->cur >= 4096) &&
                (xmlBufUse(inbuf) - reader->cur <= CHUNK_SIZE)) {
                val = xmlBufShrink(inbuf, reader->cur);
@@ -1034,7 +1029,11 @@ xmlTextReaderValidateEntity(xmlTextReaderPtr reader) {
            if ((node->children != NULL) &&
                (node->children->type == XML_ENTITY_DECL) &&
                (node->children->children != NULL)) {
-               xmlTextReaderEntPush(reader, node);
+               if (xmlTextReaderEntPush(reader, node) < 0) {
+                    if (node == oldnode)
+                        break;
+                    goto skip_children;
+                }
                node = node->children->children;
                continue;
            } else {
@@ -1453,6 +1452,7 @@ node_found:
            reader->xincctxt = xmlXIncludeNewContext(reader->ctxt->myDoc);
            xmlXIncludeSetFlags(reader->xincctxt,
                                reader->parserFlags & (~XML_PARSE_NOXINCNODE));
+            xmlXIncludeSetStreamingMode(reader->xincctxt, 1);
        }
        /*
         * expand that node and process it
@@ -1479,7 +1479,8 @@ node_found:
        if ((reader->node->children != NULL) &&
            (reader->node->children->type == XML_ENTITY_DECL) &&
            (reader->node->children->children != NULL)) {
-           xmlTextReaderEntPush(reader, reader->node);
+           if (xmlTextReaderEntPush(reader, reader->node) < 0)
+                goto get_next_node;
            reader->node = reader->node->children->children;
        }
 #ifdef LIBXML_REGEXP_ENABLED
@@ -3613,7 +3614,7 @@ xmlTextReaderQuoteChar(xmlTextReaderPtr reader) {
     if (reader == NULL)
        return(-1);
     /* TODO maybe lookup the attribute value for " first */
-    return((int) '"');
+    return('"');
 }
 
 /**
@@ -3978,19 +3979,19 @@ xmlTextReaderCurrentDoc(xmlTextReaderPtr reader) {
 #ifdef LIBXML_SCHEMAS_ENABLED
 static char *xmlTextReaderBuildMessage(const char *msg, va_list ap) LIBXML_ATTR_FORMAT(1,0);
 
-static void XMLCDECL
+static void
 xmlTextReaderValidityError(void *ctxt, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
 
-static void XMLCDECL
+static void
 xmlTextReaderValidityWarning(void *ctxt, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
 
-static void XMLCDECL
+static void
 xmlTextReaderValidityErrorRelay(void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
 
-static void XMLCDECL
+static void
 xmlTextReaderValidityWarningRelay(void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
 
-static void XMLCDECL
+static void
 xmlTextReaderValidityErrorRelay(void *ctx, const char *msg, ...)
 {
     xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx;
@@ -4013,7 +4014,7 @@ xmlTextReaderValidityErrorRelay(void *ctx, const char *msg, ...)
     va_end(ap);
 }
 
-static void XMLCDECL
+static void
 xmlTextReaderValidityWarningRelay(void *ctx, const char *msg, ...)
 {
     xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx;
@@ -4782,7 +4783,7 @@ xmlTextReaderStructuredError(void *ctxt, xmlErrorPtr error)
     }
 }
 
-static void XMLCDECL LIBXML_ATTR_FORMAT(2,3)
+static void LIBXML_ATTR_FORMAT(2,3)
 xmlTextReaderError(void *ctxt, const char *msg, ...)
 {
     va_list ap;
@@ -4795,7 +4796,7 @@ xmlTextReaderError(void *ctxt, const char *msg, ...)
 
 }
 
-static void XMLCDECL LIBXML_ATTR_FORMAT(2,3)
+static void LIBXML_ATTR_FORMAT(2,3)
 xmlTextReaderWarning(void *ctxt, const char *msg, ...)
 {
     va_list ap;
@@ -4807,7 +4808,7 @@ xmlTextReaderWarning(void *ctxt, const char *msg, ...)
     va_end(ap);
 }
 
-static void XMLCDECL
+static void
 xmlTextReaderValidityError(void *ctxt, const char *msg, ...)
 {
     va_list ap;
@@ -4827,7 +4828,7 @@ xmlTextReaderValidityError(void *ctxt, const char *msg, ...)
     }
 }
 
-static void XMLCDECL
+static void
 xmlTextReaderValidityWarning(void *ctxt, const char *msg, ...)
 {
     va_list ap;
@@ -5361,8 +5362,7 @@ xmlReaderForMemory(const char *buffer, int size, const char *URL,
     xmlTextReaderPtr reader;
     xmlParserInputBufferPtr buf;
 
-    buf = xmlParserInputBufferCreateStatic(buffer, size,
-                                      XML_CHAR_ENCODING_NONE);
+    buf = xmlParserInputBufferCreateMem(buffer, size, XML_CHAR_ENCODING_NONE);
     if (buf == NULL) {
         return (NULL);
     }
@@ -5588,7 +5588,7 @@ xmlReaderNewMemory(xmlTextReaderPtr reader, const char *buffer, int size,
     if (buffer == NULL)
         return (-1);
 
-    input = xmlParserInputBufferCreateStatic(buffer, size,
+    input = xmlParserInputBufferCreateMem(buffer, size,
                                       XML_CHAR_ENCODING_NONE);
     if (input == NULL) {
         return (-1);
index a2a36c4..5638ddc 100644 (file)
@@ -31,6 +31,9 @@
 #include <libxml/xmlautomata.h>
 #include <libxml/xmlunicode.h>
 
+#include "private/error.h"
+#include "private/regexp.h"
+
 #ifndef SIZE_MAX
 #define SIZE_MAX ((size_t) -1)
 #endif
@@ -361,8 +364,6 @@ static int xmlRegCheckCharacter(xmlRegAtomPtr atom, int codepoint);
 static int xmlRegCheckCharacterRange(xmlRegAtomType type, int codepoint,
                   int neg, int start, int end, const xmlChar *blockName);
 
-void xmlAutomataSetFlags(xmlAutomataPtr am, int flags);
-
 /************************************************************************
  *                                                                     *
  *             Regexp memory error handler                             *
@@ -435,7 +436,8 @@ xmlRegCalloc2(size_t dim1, size_t dim2, size_t elemSize) {
     void *ret;
 
     /* Check for overflow */
-    if (dim1 > SIZE_MAX / dim2 / elemSize)
+    if ((dim2 == 0) || (elemSize == 0) ||
+        (dim1 > SIZE_MAX / dim2 / elemSize))
         return (NULL);
     totalSize = dim1 * dim2 * elemSize;
     ret = xmlMalloc(totalSize);
@@ -1237,7 +1239,7 @@ xmlRegPrintCtxt(FILE *output, xmlRegParserCtxtPtr ctxt) {
  *                                                                     *
  ************************************************************************/
 
-static void
+static xmlRegRangePtr
 xmlRegAtomAddRange(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom,
                   int neg, xmlRegAtomType type, int start, int end,
                   xmlChar *blockName) {
@@ -1245,11 +1247,11 @@ xmlRegAtomAddRange(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom,
 
     if (atom == NULL) {
        ERROR("add range: atom is NULL");
-       return;
+       return(NULL);
     }
     if (atom->type != XML_REGEXP_RANGES) {
        ERROR("add range: atom is not ranges");
-       return;
+       return(NULL);
     }
     if (atom->maxRanges == 0) {
        atom->maxRanges = 4;
@@ -1258,7 +1260,7 @@ xmlRegAtomAddRange(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom,
        if (atom->ranges == NULL) {
            xmlRegexpErrMemory(ctxt, "adding ranges");
            atom->maxRanges = 0;
-           return;
+           return(NULL);
        }
     } else if (atom->nbRanges >= atom->maxRanges) {
        xmlRegRangePtr *tmp;
@@ -1268,16 +1270,17 @@ xmlRegAtomAddRange(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom,
        if (tmp == NULL) {
            xmlRegexpErrMemory(ctxt, "adding ranges");
            atom->maxRanges /= 2;
-           return;
+           return(NULL);
        }
        atom->ranges = tmp;
     }
     range = xmlRegNewRange(ctxt, neg, type, start, end);
     if (range == NULL)
-       return;
+       return(NULL);
     range->blockName = blockName;
     atom->ranges[atom->nbRanges++] = range;
 
+    return(range);
 }
 
 static int
@@ -1314,26 +1317,17 @@ xmlRegAtomPush(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom) {
        ERROR("atom push: atom is NULL");
        return(-1);
     }
-    if (ctxt->maxAtoms == 0) {
-       ctxt->maxAtoms = 4;
-       ctxt->atoms = (xmlRegAtomPtr *) xmlMalloc(ctxt->maxAtoms *
-                                            sizeof(xmlRegAtomPtr));
-       if (ctxt->atoms == NULL) {
-           xmlRegexpErrMemory(ctxt, "pushing atom");
-           ctxt->maxAtoms = 0;
-           return(-1);
-       }
-    } else if (ctxt->nbAtoms >= ctxt->maxAtoms) {
+    if (ctxt->nbAtoms >= ctxt->maxAtoms) {
+        size_t newSize = ctxt->maxAtoms ? ctxt->maxAtoms * 2 : 4;
        xmlRegAtomPtr *tmp;
-       ctxt->maxAtoms *= 2;
-       tmp = (xmlRegAtomPtr *) xmlRealloc(ctxt->atoms, ctxt->maxAtoms *
-                                            sizeof(xmlRegAtomPtr));
+
+       tmp = xmlRealloc(ctxt->atoms, newSize * sizeof(xmlRegAtomPtr));
        if (tmp == NULL) {
            xmlRegexpErrMemory(ctxt, "allocating counter");
-           ctxt->maxAtoms /= 2;
            return(-1);
        }
        ctxt->atoms = tmp;
+        ctxt->maxAtoms = newSize;
     }
     atom->no = ctxt->nbAtoms;
     ctxt->atoms[ctxt->nbAtoms++] = atom;
@@ -1447,33 +1441,31 @@ xmlRegStateAddTrans(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state,
     xmlRegStateAddTransTo(ctxt, target, state->no);
 }
 
-static int
-xmlRegStatePush(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state) {
-    if (state == NULL) return(-1);
-    if (ctxt->maxStates == 0) {
-       ctxt->maxStates = 4;
-       ctxt->states = (xmlRegStatePtr *) xmlMalloc(ctxt->maxStates *
-                                            sizeof(xmlRegStatePtr));
-       if (ctxt->states == NULL) {
-           xmlRegexpErrMemory(ctxt, "adding state");
-           ctxt->maxStates = 0;
-           return(-1);
-       }
-    } else if (ctxt->nbStates >= ctxt->maxStates) {
+static xmlRegStatePtr
+xmlRegStatePush(xmlRegParserCtxtPtr ctxt) {
+    xmlRegStatePtr state;
+
+    if (ctxt->nbStates >= ctxt->maxStates) {
+        size_t newSize = ctxt->maxStates ? ctxt->maxStates * 2 : 4;
        xmlRegStatePtr *tmp;
-       ctxt->maxStates *= 2;
-       tmp = (xmlRegStatePtr *) xmlRealloc(ctxt->states, ctxt->maxStates *
-                                            sizeof(xmlRegStatePtr));
+
+       tmp = xmlRealloc(ctxt->states, newSize * sizeof(tmp[0]));
        if (tmp == NULL) {
            xmlRegexpErrMemory(ctxt, "adding state");
-           ctxt->maxStates /= 2;
-           return(-1);
+           return(NULL);
        }
        ctxt->states = tmp;
+       ctxt->maxStates = newSize;
     }
+
+    state = xmlRegNewState(ctxt);
+    if (state == NULL)
+        return(NULL);
+
     state->no = ctxt->nbStates;
     ctxt->states[ctxt->nbStates++] = state;
-    return(0);
+
+    return(state);
 }
 
 /**
@@ -1484,19 +1476,21 @@ xmlRegStatePush(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state) {
  * @lax:
  *
  */
-static void
+static int
 xmlFAGenerateAllTransition(xmlRegParserCtxtPtr ctxt,
                           xmlRegStatePtr from, xmlRegStatePtr to,
                           int lax) {
     if (to == NULL) {
-       to = xmlRegNewState(ctxt);
-       xmlRegStatePush(ctxt, to);
+       to = xmlRegStatePush(ctxt);
+        if (to == NULL)
+            return(-1);
        ctxt->state = to;
     }
     if (lax)
        xmlRegStateAddTrans(ctxt, from, NULL, to, -1, REGEXP_ALL_LAX_COUNTER);
     else
        xmlRegStateAddTrans(ctxt, from, NULL, to, -1, REGEXP_ALL_COUNTER);
+    return(0);
 }
 
 /**
@@ -1506,15 +1500,17 @@ xmlFAGenerateAllTransition(xmlRegParserCtxtPtr ctxt,
  * @to:  the target state or NULL for building a new one
  *
  */
-static void
+static int
 xmlFAGenerateEpsilonTransition(xmlRegParserCtxtPtr ctxt,
                               xmlRegStatePtr from, xmlRegStatePtr to) {
     if (to == NULL) {
-       to = xmlRegNewState(ctxt);
-       xmlRegStatePush(ctxt, to);
+       to = xmlRegStatePush(ctxt);
+        if (to == NULL)
+            return(-1);
        ctxt->state = to;
     }
     xmlRegStateAddTrans(ctxt, from, NULL, to, -1, -1);
+    return(0);
 }
 
 /**
@@ -1525,15 +1521,17 @@ xmlFAGenerateEpsilonTransition(xmlRegParserCtxtPtr ctxt,
  * counter:  the counter for that transition
  *
  */
-static void
+static int
 xmlFAGenerateCountedEpsilonTransition(xmlRegParserCtxtPtr ctxt,
            xmlRegStatePtr from, xmlRegStatePtr to, int counter) {
     if (to == NULL) {
-       to = xmlRegNewState(ctxt);
-       xmlRegStatePush(ctxt, to);
+       to = xmlRegStatePush(ctxt);
+        if (to == NULL)
+            return(-1);
        ctxt->state = to;
     }
     xmlRegStateAddTrans(ctxt, from, NULL, to, counter, -1);
+    return(0);
 }
 
 /**
@@ -1544,15 +1542,17 @@ xmlFAGenerateCountedEpsilonTransition(xmlRegParserCtxtPtr ctxt,
  * counter:  the counter for that transition
  *
  */
-static void
+static int
 xmlFAGenerateCountedTransition(xmlRegParserCtxtPtr ctxt,
            xmlRegStatePtr from, xmlRegStatePtr to, int counter) {
     if (to == NULL) {
-       to = xmlRegNewState(ctxt);
-       xmlRegStatePush(ctxt, to);
+       to = xmlRegStatePush(ctxt);
+        if (to == NULL)
+            return(-1);
        ctxt->state = to;
     }
     xmlRegStateAddTrans(ctxt, from, NULL, to, -1, counter);
+    return(0);
 }
 
 /**
@@ -1579,9 +1579,6 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
         * this is a subexpression handling one should not need to
         * create a new node except for XML_REGEXP_QUANT_RANGE.
         */
-       if (xmlRegAtomPush(ctxt, atom) < 0) {
-           return(-1);
-       }
        if ((to != NULL) && (atom->stop != to) &&
            (atom->quant != XML_REGEXP_QUANT_RANGE)) {
            /*
@@ -1591,8 +1588,9 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
 #ifdef DV
        } else if ((to == NULL) && (atom->quant != XML_REGEXP_QUANT_RANGE) &&
                   (atom->quant != XML_REGEXP_QUANT_ONCE)) {
-           to = xmlRegNewState(ctxt);
-           xmlRegStatePush(ctxt, to);
+           to = xmlRegStatePush(ctxt, to);
+            if (to == NULL)
+                return(-1);
            ctxt->state = to;
            xmlFAGenerateEpsilonTransition(ctxt, atom->stop, to);
 #endif
@@ -1632,8 +1630,9 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
                if (to != NULL) {
                    newstate = to;
                } else {
-                   newstate = xmlRegNewState(ctxt);
-                   xmlRegStatePush(ctxt, newstate);
+                   newstate = xmlRegStatePush(ctxt);
+                    if (newstate == NULL)
+                        return(-1);
                }
 
                /*
@@ -1661,10 +1660,14 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
                    copy->max = 0;
 
                    if (xmlFAGenerateTransitions(ctxt, atom->start, NULL, copy)
-                       < 0)
+                       < 0) {
+                        xmlRegFreeAtom(copy);
                        return(-1);
+                    }
                    inter = ctxt->state;
                    counter = xmlRegGetCounter(ctxt);
+                    if (counter < 0)
+                        return(-1);
                    ctxt->counters[counter].min = atom->min - 1;
                    ctxt->counters[counter].max = atom->max - 1;
                    /* count the number of times we see it again */
@@ -1683,6 +1686,8 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
                     * epsilon transition.
                     */
                    counter = xmlRegGetCounter(ctxt);
+                    if (counter < 0)
+                        return(-1);
                    ctxt->counters[counter].min = atom->min - 1;
                    ctxt->counters[counter].max = atom->max - 1;
                    /* allow a way out based on the count */
@@ -1705,6 +1710,8 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
            default:
                break;
        }
+       if (xmlRegAtomPush(ctxt, atom) < 0)
+           return(-1);
        return(0);
     }
     if ((atom->min == 0) && (atom->max == 0) &&
@@ -1713,12 +1720,9 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
         * we can discard the atom and generate an epsilon transition instead
         */
        if (to == NULL) {
-           to = xmlRegNewState(ctxt);
-           if (to != NULL)
-               xmlRegStatePush(ctxt, to);
-           else {
+           to = xmlRegStatePush(ctxt);
+           if (to == NULL)
                return(-1);
-           }
        }
        xmlFAGenerateEpsilonTransition(ctxt, from, to);
        ctxt->state = to;
@@ -1726,12 +1730,9 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
        return(0);
     }
     if (to == NULL) {
-       to = xmlRegNewState(ctxt);
-       if (to != NULL)
-           xmlRegStatePush(ctxt, to);
-       else {
+       to = xmlRegStatePush(ctxt);
+       if (to == NULL)
            return(-1);
-       }
     }
     end = to;
     if ((atom->quant == XML_REGEXP_QUANT_MULT) ||
@@ -1743,18 +1744,12 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
         */
         xmlRegStatePtr tmp;
 
-       tmp = xmlRegNewState(ctxt);
-       if (tmp != NULL)
-           xmlRegStatePush(ctxt, tmp);
-       else {
+       tmp = xmlRegStatePush(ctxt);
+        if (tmp == NULL)
            return(-1);
-       }
        xmlFAGenerateEpsilonTransition(ctxt, tmp, to);
        to = tmp;
     }
-    if (xmlRegAtomPush(ctxt, atom) < 0) {
-       return(-1);
-    }
     if ((atom->quant == XML_REGEXP_QUANT_RANGE) &&
         (atom->min == 0) && (atom->max > 0)) {
        nullable = 1;
@@ -1785,6 +1780,8 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
        default:
            break;
     }
+    if (xmlRegAtomPush(ctxt, atom) < 0)
+       return(-1);
     return(0);
 }
 
@@ -4892,11 +4889,16 @@ xmlFAParseCharProp(xmlRegParserCtxtPtr ctxt) {
     }
     if (ctxt->atom == NULL) {
        ctxt->atom = xmlRegNewAtom(ctxt, type);
-       if (ctxt->atom != NULL)
-           ctxt->atom->valuep = blockName;
+        if (ctxt->atom == NULL) {
+            xmlFree(blockName);
+            return;
+        }
+       ctxt->atom->valuep = blockName;
     } else if (ctxt->atom->type == XML_REGEXP_RANGES) {
-        xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
-                          type, 0, 0, blockName);
+        if (xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
+                               type, 0, 0, blockName) == NULL) {
+            xmlFree(blockName);
+        }
     }
 }
 
@@ -5500,8 +5502,12 @@ xmlFAParseBranch(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr to) {
        xmlFAGenerateEpsilonTransition(ctxt, previous, to);
     } else {
        if (xmlFAGenerateTransitions(ctxt, previous,
-               (CUR=='|' || CUR==')' || CUR==0) ? to : NULL, ctxt->atom) < 0)
+               (CUR=='|' || CUR==')' || CUR==0) ? to : NULL,
+                ctxt->atom) < 0) {
+            xmlRegFreeAtom(ctxt->atom);
+            ctxt->atom = NULL;
            return(-1);
+        }
        previous = ctxt->state;
        ctxt->atom = NULL;
     }
@@ -5510,8 +5516,11 @@ xmlFAParseBranch(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr to) {
        if (ret != 0) {
            if (xmlFAGenerateTransitions(ctxt, previous,
                    (CUR=='|' || CUR==')' || CUR==0) ? to : NULL,
-                    ctxt->atom) < 0)
-                   return(-1);
+                    ctxt->atom) < 0) {
+                xmlRegFreeAtom(ctxt->atom);
+                ctxt->atom = NULL;
+                return(-1);
+            }
            previous = ctxt->state;
            ctxt->atom = NULL;
        }
@@ -5612,7 +5621,7 @@ xmlRegexpPrint(FILE *output, xmlRegexpPtr regexp) {
  */
 xmlRegexpPtr
 xmlRegexpCompile(const xmlChar *regexp) {
-    xmlRegexpPtr ret;
+    xmlRegexpPtr ret = NULL;
     xmlRegParserCtxtPtr ctxt;
 
     ctxt = xmlRegNewParserCtxt(regexp);
@@ -5620,19 +5629,19 @@ xmlRegexpCompile(const xmlChar *regexp) {
        return(NULL);
 
     /* initialize the parser */
+    ctxt->state = xmlRegStatePush(ctxt);
+    if (ctxt->state == NULL)
+        goto error;
+    ctxt->start = ctxt->state;
     ctxt->end = NULL;
-    ctxt->start = ctxt->state = xmlRegNewState(ctxt);
-    xmlRegStatePush(ctxt, ctxt->start);
 
     /* parse the expression building an automata */
     xmlFAParseRegExp(ctxt, 1);
     if (CUR != 0) {
        ERROR("xmlFAParseRegExp: extra characters");
     }
-    if (ctxt->error != 0) {
-       xmlRegFreeParserCtxt(ctxt);
-       return(NULL);
-    }
+    if (ctxt->error != 0)
+        goto error;
     ctxt->end = ctxt->state;
     ctxt->start->type = XML_REGEXP_START_STATE;
     ctxt->end->type = XML_REGEXP_FINAL_STATE;
@@ -5641,11 +5650,11 @@ xmlRegexpCompile(const xmlChar *regexp) {
     xmlFAEliminateEpsilonTransitions(ctxt);
 
 
-    if (ctxt->error != 0) {
-       xmlRegFreeParserCtxt(ctxt);
-       return(NULL);
-    }
+    if (ctxt->error != 0)
+        goto error;
     ret = xmlRegEpxFromParse(ctxt);
+
+error:
     xmlRegFreeParserCtxt(ctxt);
     return(ret);
 }
@@ -5770,18 +5779,15 @@ xmlNewAutomata(void) {
        return(NULL);
 
     /* initialize the parser */
-    ctxt->end = NULL;
-    ctxt->start = ctxt->state = xmlRegNewState(ctxt);
-    if (ctxt->start == NULL) {
+    ctxt->state = xmlRegStatePush(ctxt);
+    if (ctxt->state == NULL) {
        xmlFreeAutomata(ctxt);
        return(NULL);
     }
+    ctxt->start = ctxt->state;
+    ctxt->end = NULL;
+
     ctxt->start->type = XML_REGEXP_START_STATE;
-    if (xmlRegStatePush(ctxt, ctxt->start) < 0) {
-        xmlRegFreeState(ctxt->start);
-       xmlFreeAutomata(ctxt);
-       return(NULL);
-    }
     ctxt->flags = 0;
 
     return(ctxt);
@@ -6044,6 +6050,8 @@ xmlAutomataNewCountTrans2(xmlAutomataPtr am, xmlAutomataStatePtr from,
        return(NULL);
     if ((token2 == NULL) || (*token2 == 0)) {
        atom->valuep = xmlStrdup(token);
+        if (atom->valuep == NULL)
+            goto error;
     } else {
        int lenn, lenp;
        xmlChar *str;
@@ -6052,10 +6060,8 @@ xmlAutomataNewCountTrans2(xmlAutomataPtr am, xmlAutomataStatePtr from,
        lenp = strlen((char *) token);
 
        str = (xmlChar *) xmlMallocAtomic(lenn + lenp + 2);
-       if (str == NULL) {
-           xmlRegFreeAtom(atom);
-           return(NULL);
-       }
+       if (str == NULL)
+           goto error;
        memcpy(&str[0], token, lenp);
        str[lenp] = '|';
        memcpy(&str[lenp + 1], token2, lenn);
@@ -6074,16 +6080,20 @@ xmlAutomataNewCountTrans2(xmlAutomataPtr am, xmlAutomataStatePtr from,
      * associate a counter to the transition.
      */
     counter = xmlRegGetCounter(am);
+    if (counter < 0)
+        goto error;
     am->counters[counter].min = min;
     am->counters[counter].max = max;
 
     /* xmlFAGenerateTransitions(am, from, to, atom); */
     if (to == NULL) {
-        to = xmlRegNewState(am);
-       xmlRegStatePush(am, to);
+       to = xmlRegStatePush(am);
+        if (to == NULL)
+            goto error;
     }
     xmlRegStateAddTrans(am, from, atom, to, counter, -1);
-    xmlRegAtomPush(am, atom);
+    if (xmlRegAtomPush(am, atom) < 0)
+        goto error;
     am->state = to;
 
     if (to == NULL)
@@ -6093,6 +6103,10 @@ xmlAutomataNewCountTrans2(xmlAutomataPtr am, xmlAutomataStatePtr from,
     if (min == 0)
        xmlFAGenerateEpsilonTransition(am, from, to);
     return(to);
+
+error:
+    xmlRegFreeAtom(atom);
+    return(NULL);
 }
 
 /**
@@ -6129,6 +6143,8 @@ xmlAutomataNewCountTrans(xmlAutomataPtr am, xmlAutomataStatePtr from,
     if (atom == NULL)
        return(NULL);
     atom->valuep = xmlStrdup(token);
+    if (atom->valuep == NULL)
+        goto error;
     atom->data = data;
     if (min == 0)
        atom->min = 1;
@@ -6140,16 +6156,20 @@ xmlAutomataNewCountTrans(xmlAutomataPtr am, xmlAutomataStatePtr from,
      * associate a counter to the transition.
      */
     counter = xmlRegGetCounter(am);
+    if (counter < 0)
+        goto error;
     am->counters[counter].min = min;
     am->counters[counter].max = max;
 
     /* xmlFAGenerateTransitions(am, from, to, atom); */
     if (to == NULL) {
-        to = xmlRegNewState(am);
-       xmlRegStatePush(am, to);
+       to = xmlRegStatePush(am);
+        if (to == NULL)
+            goto error;
     }
     xmlRegStateAddTrans(am, from, atom, to, counter, -1);
-    xmlRegAtomPush(am, atom);
+    if (xmlRegAtomPush(am, atom) < 0)
+        goto error;
     am->state = to;
 
     if (to == NULL)
@@ -6159,6 +6179,10 @@ xmlAutomataNewCountTrans(xmlAutomataPtr am, xmlAutomataStatePtr from,
     if (min == 0)
        xmlFAGenerateEpsilonTransition(am, from, to);
     return(to);
+
+error:
+    xmlRegFreeAtom(atom);
+    return(NULL);
 }
 
 /**
@@ -6199,6 +6223,8 @@ xmlAutomataNewOnceTrans2(xmlAutomataPtr am, xmlAutomataStatePtr from,
        return(NULL);
     if ((token2 == NULL) || (*token2 == 0)) {
        atom->valuep = xmlStrdup(token);
+        if (atom->valuep == NULL)
+            goto error;
     } else {
        int lenn, lenp;
        xmlChar *str;
@@ -6207,10 +6233,8 @@ xmlAutomataNewOnceTrans2(xmlAutomataPtr am, xmlAutomataStatePtr from,
        lenp = strlen((char *) token);
 
        str = (xmlChar *) xmlMallocAtomic(lenn + lenp + 2);
-       if (str == NULL) {
-           xmlRegFreeAtom(atom);
-           return(NULL);
-       }
+       if (str == NULL)
+           goto error;
        memcpy(&str[0], token, lenp);
        str[lenp] = '|';
        memcpy(&str[lenp + 1], token2, lenn);
@@ -6226,18 +6250,26 @@ xmlAutomataNewOnceTrans2(xmlAutomataPtr am, xmlAutomataStatePtr from,
      * associate a counter to the transition.
      */
     counter = xmlRegGetCounter(am);
+    if (counter < 0)
+        goto error;
     am->counters[counter].min = 1;
     am->counters[counter].max = 1;
 
     /* xmlFAGenerateTransitions(am, from, to, atom); */
     if (to == NULL) {
-       to = xmlRegNewState(am);
-       xmlRegStatePush(am, to);
+       to = xmlRegStatePush(am);
+        if (to == NULL)
+            goto error;
     }
     xmlRegStateAddTrans(am, from, atom, to, counter, -1);
-    xmlRegAtomPush(am, atom);
+    if (xmlRegAtomPush(am, atom) < 0)
+        goto error;
     am->state = to;
     return(to);
+
+error:
+    xmlRegFreeAtom(atom);
+    return(NULL);
 }
 
 
@@ -6285,18 +6317,26 @@ xmlAutomataNewOnceTrans(xmlAutomataPtr am, xmlAutomataStatePtr from,
      * associate a counter to the transition.
      */
     counter = xmlRegGetCounter(am);
+    if (counter < 0)
+        goto error;
     am->counters[counter].min = 1;
     am->counters[counter].max = 1;
 
     /* xmlFAGenerateTransitions(am, from, to, atom); */
     if (to == NULL) {
-       to = xmlRegNewState(am);
-       xmlRegStatePush(am, to);
+       to = xmlRegStatePush(am);
+        if (to == NULL)
+            goto error;
     }
     xmlRegStateAddTrans(am, from, atom, to, counter, -1);
-    xmlRegAtomPush(am, atom);
+    if (xmlRegAtomPush(am, atom) < 0)
+        goto error;
     am->state = to;
     return(to);
+
+error:
+    xmlRegFreeAtom(atom);
+    return(NULL);
 }
 
 /**
@@ -6309,13 +6349,9 @@ xmlAutomataNewOnceTrans(xmlAutomataPtr am, xmlAutomataStatePtr from,
  */
 xmlAutomataStatePtr
 xmlAutomataNewState(xmlAutomataPtr am) {
-    xmlAutomataStatePtr to;
-
     if (am == NULL)
        return(NULL);
-    to = xmlRegNewState(am);
-    xmlRegStatePush(am, to);
-    return(to);
+    return(xmlRegStatePush(am));
 }
 
 /**
index 9b42c66..5b5c8f1 100644 (file)
--- a/xmlsave.c
+++ b/xmlsave.c
 
 #include <libxml/HTMLtree.h>
 
-#include "buf.h"
-#include "enc.h"
-#include "save.h"
+#include "private/buf.h"
+#include "private/enc.h"
+#include "private/error.h"
+#include "private/save.h"
 
-/************************************************************************
- *                                                                     *
- *                     XHTML detection                                 *
- *                                                                     *
- ************************************************************************/
-#define XHTML_STRICT_PUBLIC_ID BAD_CAST \
-   "-//W3C//DTD XHTML 1.0 Strict//EN"
-#define XHTML_STRICT_SYSTEM_ID BAD_CAST \
-   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
-#define XHTML_FRAME_PUBLIC_ID BAD_CAST \
-   "-//W3C//DTD XHTML 1.0 Frameset//EN"
-#define XHTML_FRAME_SYSTEM_ID BAD_CAST \
-   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"
-#define XHTML_TRANS_PUBLIC_ID BAD_CAST \
-   "-//W3C//DTD XHTML 1.0 Transitional//EN"
-#define XHTML_TRANS_SYSTEM_ID BAD_CAST \
-   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+#ifdef LIBXML_OUTPUT_ENABLED
 
 #define XHTML_NS_NAME BAD_CAST "http://www.w3.org/1999/xhtml"
-/**
- * xmlIsXHTML:
- * @systemID:  the system identifier
- * @publicID:  the public identifier
- *
- * Try to find if the document correspond to an XHTML DTD
- *
- * Returns 1 if true, 0 if not and -1 in case of error
- */
-int
-xmlIsXHTML(const xmlChar *systemID, const xmlChar *publicID) {
-    if ((systemID == NULL) && (publicID == NULL))
-       return(-1);
-    if (publicID != NULL) {
-       if (xmlStrEqual(publicID, XHTML_STRICT_PUBLIC_ID)) return(1);
-       if (xmlStrEqual(publicID, XHTML_FRAME_PUBLIC_ID)) return(1);
-       if (xmlStrEqual(publicID, XHTML_TRANS_PUBLIC_ID)) return(1);
-    }
-    if (systemID != NULL) {
-       if (xmlStrEqual(systemID, XHTML_STRICT_SYSTEM_ID)) return(1);
-       if (xmlStrEqual(systemID, XHTML_FRAME_SYSTEM_ID)) return(1);
-       if (xmlStrEqual(systemID, XHTML_TRANS_SYSTEM_ID)) return(1);
-    }
-    return(0);
-}
-
-#ifdef LIBXML_OUTPUT_ENABLED
 
 #define TODO                                                           \
     xmlGenericError(xmlGenericErrorContext,                            \
@@ -463,7 +421,7 @@ xmlAttrSerializeContent(xmlOutputBufferPtr buf, xmlAttrPtr attr)
  *
  * This will dump the content of the notation table as an XML DTD definition
  */
-void
+static void
 xmlBufDumpNotationTable(xmlBufPtr buf, xmlNotationTablePtr table) {
     xmlBufferPtr buffer;
 
@@ -487,7 +445,7 @@ xmlBufDumpNotationTable(xmlBufPtr buf, xmlNotationTablePtr table) {
  * This will dump the content of the element declaration as an XML
  * DTD definition
  */
-void
+static void
 xmlBufDumpElementDecl(xmlBufPtr buf, xmlElementPtr elem) {
     xmlBufferPtr buffer;
 
@@ -511,7 +469,7 @@ xmlBufDumpElementDecl(xmlBufPtr buf, xmlElementPtr elem) {
  * This will dump the content of the attribute declaration as an XML
  * DTD definition
  */
-void
+static void
 xmlBufDumpAttributeDecl(xmlBufPtr buf, xmlAttributePtr attr) {
     xmlBufferPtr buffer;
 
@@ -534,7 +492,7 @@ xmlBufDumpAttributeDecl(xmlBufPtr buf, xmlAttributePtr attr) {
  *
  * This will dump the content of the entity table as an XML DTD definition
  */
-void
+static void
 xmlBufDumpEntityDecl(xmlBufPtr buf, xmlEntityPtr ent) {
     xmlBufferPtr buffer;
 
@@ -595,7 +553,6 @@ static void
 xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur);
 #endif
 static void xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur);
-void xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur);
 static int xmlDocContentDumpOutput(xmlSaveCtxtPtr ctxt, xmlDocPtr cur);
 
 /**
@@ -2178,7 +2135,7 @@ xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level,
     xmlBufBackToBuffer(buffer);
     if (ret > INT_MAX)
         return(-1);
-    return((int) ret);
+    return(ret);
 }
 
 /**
@@ -2406,6 +2363,7 @@ xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc, xmlChar **doc_txt_ptr,
 
     if ((out_buff = xmlAllocOutputBuffer(conv_hdlr)) == NULL ) {
         xmlSaveErrMemory("creating buffer");
+        xmlCharEncCloseFunc(conv_hdlr);
         return;
     }
 
index f31d3d1..4662ebb 100644 (file)
@@ -76,6 +76,9 @@
 #include <libxml/xmlreader.h>
 #endif
 
+#include "private/error.h"
+#include "private/string.h"
+
 /* #define DEBUG 1 */
 
 /* #define DEBUG_CONTENT 1 */
@@ -305,10 +308,20 @@ static const xmlChar *xmlNamespaceNs = (const xmlChar *)
 #define WXS_SCHEMA(ctx) (ctx)->schema
 
 #define WXS_ADD_LOCAL(ctx, item) \
-    xmlSchemaAddItemSize(&(WXS_BUCKET(ctx)->locals), 10, item)
+    do { \
+        if (xmlSchemaAddItemSize(&(WXS_BUCKET(ctx)->locals), 10, item) < 0) { \
+            xmlFree(item); \
+            item = NULL; \
+        } \
+    } while (0)
 
 #define WXS_ADD_GLOBAL(ctx, item) \
-    xmlSchemaAddItemSize(&(WXS_BUCKET(ctx)->globals), 5, item)
+    do { \
+        if (xmlSchemaAddItemSize(&(WXS_BUCKET(ctx)->globals), 5, item) < 0) { \
+            xmlFree(item); \
+            item = NULL; \
+        } \
+    } while (0)
 
 #define WXS_ADD_PENDING(ctx, item) \
     xmlSchemaAddItemSize(&((ctx)->constructor->pending), 10, item)
@@ -3407,23 +3420,17 @@ xmlSchemaItemListClear(xmlSchemaItemListPtr list)
 static int
 xmlSchemaItemListAdd(xmlSchemaItemListPtr list, void *item)
 {
-    if (list->items == NULL) {
-       list->items = (void **) xmlMalloc(
-           20 * sizeof(void *));
-       if (list->items == NULL) {
-           xmlSchemaPErrMemory(NULL, "allocating new item list", NULL);
-           return(-1);
-       }
-       list->sizeItems = 20;
-    } else if (list->sizeItems <= list->nbItems) {
-       list->sizeItems *= 2;
-       list->items = (void **) xmlRealloc(list->items,
-           list->sizeItems * sizeof(void *));
-       if (list->items == NULL) {
+    if (list->sizeItems <= list->nbItems) {
+        void **tmp;
+        size_t newSize = list->sizeItems == 0 ? 20 : list->sizeItems * 2;
+
+       tmp = (void **) xmlRealloc(list->items, newSize * sizeof(void *));
+       if (tmp == NULL) {
            xmlSchemaPErrMemory(NULL, "growing item list", NULL);
-           list->sizeItems = 0;
            return(-1);
        }
+        list->items = tmp;
+       list->sizeItems = newSize;
     }
     list->items[list->nbItems++] = item;
     return(0);
@@ -3445,14 +3452,17 @@ xmlSchemaItemListAddSize(xmlSchemaItemListPtr list,
        }
        list->sizeItems = initialSize;
     } else if (list->sizeItems <= list->nbItems) {
+        void **tmp;
+
        list->sizeItems *= 2;
-       list->items = (void **) xmlRealloc(list->items,
+       tmp = (void **) xmlRealloc(list->items,
            list->sizeItems * sizeof(void *));
-       if (list->items == NULL) {
+       if (tmp == NULL) {
            xmlSchemaPErrMemory(NULL, "growing item list", NULL);
-           list->sizeItems = 0;
+           list->sizeItems /= 2;
            return(-1);
        }
+        list->items = tmp;
     }
     list->items[list->nbItems++] = item;
     return(0);
@@ -3461,23 +3471,17 @@ xmlSchemaItemListAddSize(xmlSchemaItemListPtr list,
 static int
 xmlSchemaItemListInsert(xmlSchemaItemListPtr list, void *item, int idx)
 {
-    if (list->items == NULL) {
-       list->items = (void **) xmlMalloc(
-           20 * sizeof(void *));
-       if (list->items == NULL) {
-           xmlSchemaPErrMemory(NULL, "allocating new item list", NULL);
-           return(-1);
-       }
-       list->sizeItems = 20;
-    } else if (list->sizeItems <= list->nbItems) {
-       list->sizeItems *= 2;
-       list->items = (void **) xmlRealloc(list->items,
-           list->sizeItems * sizeof(void *));
-       if (list->items == NULL) {
+    if (list->sizeItems <= list->nbItems) {
+        void **tmp;
+        size_t newSize = list->sizeItems == 0 ? 20 : list->sizeItems * 2;
+
+       tmp = (void **) xmlRealloc(list->items, newSize * sizeof(void *));
+       if (tmp == NULL) {
            xmlSchemaPErrMemory(NULL, "growing item list", NULL);
-           list->sizeItems = 0;
            return(-1);
        }
+        list->items = tmp;
+       list->sizeItems = newSize;
     }
     /*
     * Just append if the index is greater/equal than the item count.
@@ -3645,12 +3649,12 @@ xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt,
     ret->type = type;
     ret->globals = xmlSchemaItemListCreate();
     if (ret->globals == NULL) {
-       xmlFree(ret);
+       xmlSchemaBucketFree(ret);
        return(NULL);
     }
     ret->locals = xmlSchemaItemListCreate();
     if (ret->locals == NULL) {
-       xmlFree(ret);
+       xmlSchemaBucketFree(ret);
        return(NULL);
     }
     /*
@@ -3739,7 +3743,10 @@ xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt,
                return(NULL);
            }
        }
-       xmlSchemaItemListAdd(mainSchema->includes, ret);
+       if (xmlSchemaItemListAdd(mainSchema->includes, ret) < 0) {
+           xmlSchemaBucketFree(ret);
+           return(NULL);
+        }
     }
     /*
     * Add to list of all buckets; this is used for lookup
@@ -3758,8 +3765,7 @@ xmlSchemaAddItemSize(xmlSchemaItemListPtr *list, int initialSize, void *item)
        if (*list == NULL)
            return(-1);
     }
-    xmlSchemaItemListAddSize(*list, initialSize, item);
-    return(0);
+    return(xmlSchemaItemListAddSize(*list, initialSize, item));
 }
 
 /**
@@ -4757,6 +4763,8 @@ xmlSchemaGetNodeContent(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node)
        val = xmlStrdup((xmlChar *)"");
     ret = xmlDictLookup(ctxt->dict, val, -1);
     xmlFree(val);
+    if (ret == NULL)
+        xmlSchemaPErrMemory(ctxt, "getting node content", node);
     return(ret);
 }
 
@@ -6100,6 +6108,8 @@ xmlGetMaxOccurs(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node,
     if (attr == NULL)
        return (def);
     val = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr);
+    if (val == NULL)
+        return (def);
 
     if (xmlStrEqual(val, (const xmlChar *) "unbounded")) {
        if (max != UNBOUNDED) {
@@ -6174,6 +6184,8 @@ xmlGetMinOccurs(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node,
     if (attr == NULL)
        return (def);
     val = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr);
+    if (val == NULL)
+       return (def);
     cur = val;
     while (IS_BLANK_CH(*cur))
         cur++;
@@ -6846,6 +6858,8 @@ xmlSchemaParseWildcardNs(xmlSchemaParserCtxtPtr ctxt,
      */
     attr = xmlSchemaGetPropNode(node, "namespace");
     ns = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr);
+    if (ns == NULL)
+        return (-1);
     if ((attr == NULL) || (xmlStrEqual(ns, BAD_CAST "##any")))
        wildc->any = 1;
     else if (xmlStrEqual(ns, BAD_CAST "##other")) {
@@ -8994,6 +9008,8 @@ xmlSchemaParseUnion(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
        xmlSchemaQNameRefPtr ref;
 
        cur = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr);
+        if (cur == NULL)
+            return (-1);
        type->base = cur;
        do {
            while (IS_BLANK_CH(*cur))
@@ -9004,6 +9020,11 @@ xmlSchemaParseUnion(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
            if (end == cur)
                break;
            tmp = xmlStrndup(cur, end - cur);
+            if (tmp == NULL) {
+                xmlSchemaPErrMemory(ctxt, "xmlSchemaParseUnion, "
+                    "duplicating type name", NULL);
+                return (-1);
+            }
            if (xmlSchemaPValAttrNodeQNameValue(ctxt, schema,
                NULL, attr, BAD_CAST tmp, &nsName, &localName) == 0) {
                /*
@@ -9014,6 +9035,7 @@ xmlSchemaParseUnion(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
                if (link == NULL) {
                    xmlSchemaPErrMemory(ctxt, "xmlSchemaParseUnion, "
                        "allocating a type link", NULL);
+                   FREE_AND_NULL(tmp)
                    return (-1);
                }
                link->type = NULL;
@@ -11149,17 +11171,6 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt,
            * differ from the resulting namespace.
            */
            isChameleon = 1;
-           if (bucket->parsed &&
-               bucket->origTargetNamespace != NULL) {
-               xmlSchemaCustomErr(ACTXT_CAST pctxt,
-                   XML_SCHEMAP_SRC_INCLUDE,
-                   node, NULL,
-                   "The target namespace of the included/redefined schema "
-                   "'%s' has to be absent or the same as the "
-                   "including/redefining schema's target namespace",
-                   schemaLocation, NULL);
-               goto exit_error;
-           }
            bucket->targetNamespace = pctxt->targetNamespace;
        }
     }
@@ -13345,8 +13356,19 @@ xmlSchemaResolveElementReferences(xmlSchemaElementPtr elemDecl,
            * declaration `resolved` to by the `actual value`
            * of the substitutionGroup [attribute], if present"
            */
-           if (elemDecl->subtypes == NULL)
-               elemDecl->subtypes = substHead->subtypes;
+           if (elemDecl->subtypes == NULL) {
+                if (substHead->subtypes == NULL) {
+                    /*
+                     * This can happen with self-referencing substitution
+                     * groups. The cycle will be detected later, but we have
+                     * to set subtypes to avoid null-pointer dereferences.
+                     */
+                   elemDecl->subtypes = xmlSchemaGetBuiltInType(
+                            XML_SCHEMAS_ANYTYPE);
+                } else {
+                   elemDecl->subtypes = substHead->subtypes;
+                }
+            }
        }
     }
     /*
@@ -14536,6 +14558,7 @@ xmlSchemaFixupTypeAttributeUses(xmlSchemaParserCtxtPtr pctxt,
            {
                PERROR_INT("xmlSchemaFixupTypeAttributeUses",
                "failed to expand attributes");
+                return(-1);
            }
            if (pctxt->attrProhibs->nbItems != 0)
                prohibs = pctxt->attrProhibs;
@@ -14546,6 +14569,7 @@ xmlSchemaFixupTypeAttributeUses(xmlSchemaParserCtxtPtr pctxt,
            {
                PERROR_INT("xmlSchemaFixupTypeAttributeUses",
                "failed to expand attributes");
+                return(-1);
            }
        }
     }
@@ -18608,7 +18632,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt,
                        "allowed to appear inside other model groups",
                        NULL, NULL);
 
-               } else if (! dummySequence) {
+               } else if ((!dummySequence) && (baseType->subtypes != NULL)) {
                    xmlSchemaTreeItemPtr effectiveContent =
                        (xmlSchemaTreeItemPtr) type->subtypes;
                    /*
@@ -19946,7 +19970,8 @@ xmlSchemaCheckElemSubstGroup(xmlSchemaParserCtxtPtr ctxt,
            /*
            * The set of all {derivation method}s involved in the derivation
            */
-           while ((type != NULL) && (type != headType)) {
+           while ((type != NULL) && (type != headType) &&
+                   (type != type->baseType)) {
                if ((WXS_IS_EXTENSION(type)) &&
                    ((methSet & XML_SCHEMAS_TYPE_BLOCK_RESTRICTION) == 0))
                    methSet |= XML_SCHEMAS_TYPE_BLOCK_EXTENSION;
@@ -21432,7 +21457,8 @@ xmlSchemaParse(xmlSchemaParserCtxtPtr ctxt)
     * the API; i.e. not automatically by the validated instance document.
     */
 
-    xmlSchemaInitTypes();
+    if (xmlSchemaInitTypes() < 0)
+        return (NULL);
 
     if (ctxt == NULL)
         return (NULL);
@@ -21452,7 +21478,7 @@ xmlSchemaParse(xmlSchemaParserCtxtPtr ctxt)
     if (ctxt->constructor == NULL) {
        ctxt->constructor = xmlSchemaConstructionCtxtCreate(ctxt->dict);
        if (ctxt->constructor == NULL)
-           return(NULL);
+           goto exit_failure;
        /* Take ownership of the constructor to be able to free it. */
        ctxt->ownsConstructor = 1;
     }
@@ -21861,7 +21887,6 @@ xmlSchemaAssembleByXSI(xmlSchemaValidCtxtPtr vctxt)
 {
     const xmlChar *cur, *end;
     const xmlChar *nsname = NULL, *location;
-    int count = 0;
     int ret = 0;
     xmlSchemaAttrInfoPtr iattr;
 
@@ -21896,7 +21921,7 @@ xmlSchemaAssembleByXSI(xmlSchemaValidCtxtPtr vctxt)
                end++;
            if (end == cur)
                break;
-           count++; /* TODO: Don't use the schema's dict. */
+           /* TODO: Don't use the schema's dict. */
            nsname = xmlDictLookup(vctxt->schema->dict, cur, end - cur);
            cur = end;
        }
@@ -21923,7 +21948,7 @@ xmlSchemaAssembleByXSI(xmlSchemaValidCtxtPtr vctxt)
            }
            break;
        }
-       count++; /* TODO: Don't use the schema's dict. */
+       /* TODO: Don't use the schema's dict. */
        location = xmlDictLookup(vctxt->schema->dict, cur, end - cur);
        cur = end;
        ret = xmlSchemaAssembleByLocation(vctxt, vctxt->schema,
@@ -28691,7 +28716,7 @@ commentSplit(void *ctx, const xmlChar *value)
  * Varargs error callbacks to the user application, harder ...
  */
 
-static void XMLCDECL
+static void
 warningSplit(void *ctx, const char *msg ATTRIBUTE_UNUSED, ...) {
     xmlSchemaSAXPlugPtr ctxt = (xmlSchemaSAXPlugPtr) ctx;
     if ((ctxt != NULL) && (ctxt->user_sax != NULL) &&
@@ -28699,7 +28724,7 @@ warningSplit(void *ctx, const char *msg ATTRIBUTE_UNUSED, ...) {
        TODO
     }
 }
-static void XMLCDECL
+static void
 errorSplit(void *ctx, const char *msg ATTRIBUTE_UNUSED, ...) {
     xmlSchemaSAXPlugPtr ctxt = (xmlSchemaSAXPlugPtr) ctx;
     if ((ctxt != NULL) && (ctxt->user_sax != NULL) &&
@@ -28707,7 +28732,7 @@ errorSplit(void *ctx, const char *msg ATTRIBUTE_UNUSED, ...) {
        TODO
     }
 }
-static void XMLCDECL
+static void
 fatalErrorSplit(void *ctx, const char *msg ATTRIBUTE_UNUSED, ...) {
     xmlSchemaSAXPlugPtr ctxt = (xmlSchemaSAXPlugPtr) ctx;
     if ((ctxt != NULL) && (ctxt->user_sax != NULL) &&
@@ -29063,7 +29088,6 @@ xmlSchemaValidateStream(xmlSchemaValidCtxtPtr ctxt,
                         xmlSAXHandlerPtr sax, void *user_data)
 {
     xmlSchemaSAXPlugPtr plug = NULL;
-    xmlSAXHandlerPtr old_sax = NULL;
     xmlParserCtxtPtr pctxt = NULL;
     xmlParserInputPtr inputStream = NULL;
     int ret;
@@ -29074,12 +29098,18 @@ xmlSchemaValidateStream(xmlSchemaValidCtxtPtr ctxt,
     /*
      * prepare the parser
      */
-    pctxt = xmlNewParserCtxt();
-    if (pctxt == NULL)
-        return (-1);
-    old_sax = pctxt->sax;
-    pctxt->sax = sax;
-    pctxt->userData = user_data;
+    if (sax != NULL) {
+        pctxt = xmlNewSAXParserCtxt(sax, user_data);
+        if (pctxt == NULL)
+            return (-1);
+    } else {
+        pctxt = xmlNewParserCtxt();
+        if (pctxt == NULL)
+            return (-1);
+        /* We really want pctxt->sax to be NULL here. */
+        xmlFree(pctxt->sax);
+        pctxt->sax = NULL;
+    }
 #if 0
     if (options)
         xmlCtxtUseOptions(pctxt, options);
@@ -29125,7 +29155,6 @@ done:
     }
     /* cleanup */
     if (pctxt != NULL) {
-       pctxt->sax = old_sax;
        xmlFreeParserCtxt(pctxt);
     }
     return (ret);
index 26c033d..60268e2 100644 (file)
@@ -33,6 +33,8 @@
 #include <libxml/schemasInternals.h>
 #include <libxml/xmlschemastypes.h>
 
+#include "private/error.h"
+
 #define DEBUG
 
 #ifndef LIBXML_XPATH_ENABLED
@@ -383,18 +385,61 @@ xmlSchemaAddParticle(void)
     return (ret);
 }
 
+static void
+xmlSchemaFreeTypeEntry(void *type, const xmlChar *name ATTRIBUTE_UNUSED) {
+    xmlSchemaFreeType((xmlSchemaTypePtr) type);
+}
+
+/**
+ * xmlSchemaCleanupTypesInternal:
+ *
+ * Cleanup the default XML Schemas type library
+ */
+static void
+xmlSchemaCleanupTypesInternal(void) {
+    xmlSchemaParticlePtr particle;
+
+    /*
+    * Free xs:anyType.
+    */
+    if (xmlSchemaTypeAnyTypeDef != NULL) {
+        /* Attribute wildcard. */
+        xmlSchemaFreeWildcard(xmlSchemaTypeAnyTypeDef->attributeWildcard);
+        /* Content type. */
+        particle = (xmlSchemaParticlePtr) xmlSchemaTypeAnyTypeDef->subtypes;
+        /* Wildcard. */
+        xmlSchemaFreeWildcard((xmlSchemaWildcardPtr)
+            particle->children->children->children);
+        xmlFree((xmlSchemaParticlePtr) particle->children->children);
+        /* Sequence model group. */
+        xmlFree((xmlSchemaModelGroupPtr) particle->children);
+        xmlFree((xmlSchemaParticlePtr) particle);
+        xmlSchemaTypeAnyTypeDef->subtypes = NULL;
+        xmlSchemaTypeAnyTypeDef = NULL;
+    }
+
+    xmlHashFree(xmlSchemaTypesBank, xmlSchemaFreeTypeEntry);
+    xmlSchemaTypesBank = NULL;
+    /* Note that the xmlSchemaType*Def pointers aren't set to NULL. */
+}
+
 /*
  * xmlSchemaInitTypes:
  *
  * Initialize the default XML Schemas type library
+ *
+ * Returns 0 on success, -1 on error.
  */
-void
+int
 xmlSchemaInitTypes(void)
 {
     if (xmlSchemaTypesInitialized != 0)
-        return;
+        return (0);
     xmlSchemaTypesBank = xmlHashCreate(40);
-
+    if (xmlSchemaTypesBank == NULL) {
+       xmlSchemaTypeErrMemory(NULL, NULL);
+        goto error;
+    }
 
     /*
     * 3.4.7 Built-in Complex Type Definition
@@ -402,6 +447,8 @@ xmlSchemaInitTypes(void)
     xmlSchemaTypeAnyTypeDef = xmlSchemaInitBasicType("anyType",
                                                      XML_SCHEMAS_ANYTYPE,
                                                     NULL);
+    if (xmlSchemaTypeAnyTypeDef == NULL)
+        goto error;
     xmlSchemaTypeAnyTypeDef->baseType = xmlSchemaTypeAnyTypeDef;
     xmlSchemaTypeAnyTypeDef->contentType = XML_SCHEMA_CONTENT_MIXED;
     /*
@@ -415,14 +462,14 @@ xmlSchemaInitTypes(void)
        /* First particle. */
        particle = xmlSchemaAddParticle();
        if (particle == NULL)
-           return;
+           goto error;
        xmlSchemaTypeAnyTypeDef->subtypes = (xmlSchemaTypePtr) particle;
        /* Sequence model group. */
        sequence = (xmlSchemaModelGroupPtr)
            xmlMalloc(sizeof(xmlSchemaModelGroup));
        if (sequence == NULL) {
            xmlSchemaTypeErrMemory(NULL, "allocating model group component");
-           return;
+           goto error;
        }
        memset(sequence, 0, sizeof(xmlSchemaModelGroup));
        sequence->type = XML_SCHEMA_TYPE_SEQUENCE;
@@ -430,7 +477,7 @@ xmlSchemaInitTypes(void)
        /* Second particle. */
        particle = xmlSchemaAddParticle();
        if (particle == NULL)
-           return;
+           goto error;
        particle->minOccurs = 0;
        particle->maxOccurs = UNBOUNDED;
        sequence->children = (xmlSchemaTreeItemPtr) particle;
@@ -438,7 +485,7 @@ xmlSchemaInitTypes(void)
        wild = (xmlSchemaWildcardPtr) xmlMalloc(sizeof(xmlSchemaWildcard));
        if (wild == NULL) {
            xmlSchemaTypeErrMemory(NULL, "allocating wildcard component");
-           return;
+           goto error;
        }
        memset(wild, 0, sizeof(xmlSchemaWildcard));
        wild->type = XML_SCHEMA_TYPE_ANY;
@@ -452,7 +499,7 @@ xmlSchemaInitTypes(void)
        if (wild == NULL) {
            xmlSchemaTypeErrMemory(NULL, "could not create an attribute "
                "wildcard on anyType");
-           return;
+           goto error;
        }
        memset(wild, 0, sizeof(xmlSchemaWildcard));
        wild->any = 1;
@@ -462,66 +509,106 @@ xmlSchemaInitTypes(void)
     xmlSchemaTypeAnySimpleTypeDef = xmlSchemaInitBasicType("anySimpleType",
                                                            XML_SCHEMAS_ANYSIMPLETYPE,
                                                           xmlSchemaTypeAnyTypeDef);
+    if (xmlSchemaTypeAnySimpleTypeDef == NULL)
+        goto error;
     /*
     * primitive datatypes
     */
     xmlSchemaTypeStringDef = xmlSchemaInitBasicType("string",
                                                     XML_SCHEMAS_STRING,
                                                    xmlSchemaTypeAnySimpleTypeDef);
+    if (xmlSchemaTypeStringDef == NULL)
+        goto error;
     xmlSchemaTypeDecimalDef = xmlSchemaInitBasicType("decimal",
                                                      XML_SCHEMAS_DECIMAL,
                                                     xmlSchemaTypeAnySimpleTypeDef);
+    if (xmlSchemaTypeDecimalDef == NULL)
+        goto error;
     xmlSchemaTypeDateDef = xmlSchemaInitBasicType("date",
                                                   XML_SCHEMAS_DATE,
                                                  xmlSchemaTypeAnySimpleTypeDef);
+    if (xmlSchemaTypeDateDef == NULL)
+        goto error;
     xmlSchemaTypeDatetimeDef = xmlSchemaInitBasicType("dateTime",
                                                       XML_SCHEMAS_DATETIME,
                                                      xmlSchemaTypeAnySimpleTypeDef);
+    if (xmlSchemaTypeDatetimeDef == NULL)
+        goto error;
     xmlSchemaTypeTimeDef = xmlSchemaInitBasicType("time",
                                                   XML_SCHEMAS_TIME,
                                                  xmlSchemaTypeAnySimpleTypeDef);
+    if (xmlSchemaTypeTimeDef == NULL)
+        goto error;
     xmlSchemaTypeGYearDef = xmlSchemaInitBasicType("gYear",
                                                    XML_SCHEMAS_GYEAR,
                                                   xmlSchemaTypeAnySimpleTypeDef);
+    if (xmlSchemaTypeGYearDef == NULL)
+        goto error;
     xmlSchemaTypeGYearMonthDef = xmlSchemaInitBasicType("gYearMonth",
                                                         XML_SCHEMAS_GYEARMONTH,
                                                        xmlSchemaTypeAnySimpleTypeDef);
+    if (xmlSchemaTypeGYearMonthDef == NULL)
+        goto error;
     xmlSchemaTypeGMonthDef = xmlSchemaInitBasicType("gMonth",
                                                     XML_SCHEMAS_GMONTH,
                                                    xmlSchemaTypeAnySimpleTypeDef);
+    if (xmlSchemaTypeGMonthDef == NULL)
+        goto error;
     xmlSchemaTypeGMonthDayDef = xmlSchemaInitBasicType("gMonthDay",
                                                        XML_SCHEMAS_GMONTHDAY,
                                                       xmlSchemaTypeAnySimpleTypeDef);
+    if (xmlSchemaTypeGMonthDayDef == NULL)
+        goto error;
     xmlSchemaTypeGDayDef = xmlSchemaInitBasicType("gDay",
                                                   XML_SCHEMAS_GDAY,
                                                  xmlSchemaTypeAnySimpleTypeDef);
+    if (xmlSchemaTypeGDayDef == NULL)
+        goto error;
     xmlSchemaTypeDurationDef = xmlSchemaInitBasicType("duration",
                                                       XML_SCHEMAS_DURATION,
                                                      xmlSchemaTypeAnySimpleTypeDef);
+    if (xmlSchemaTypeDurationDef == NULL)
+        goto error;
     xmlSchemaTypeFloatDef = xmlSchemaInitBasicType("float",
                                                    XML_SCHEMAS_FLOAT,
                                                   xmlSchemaTypeAnySimpleTypeDef);
+    if (xmlSchemaTypeFloatDef == NULL)
+        goto error;
     xmlSchemaTypeDoubleDef = xmlSchemaInitBasicType("double",
                                                     XML_SCHEMAS_DOUBLE,
                                                    xmlSchemaTypeAnySimpleTypeDef);
+    if (xmlSchemaTypeDoubleDef == NULL)
+        goto error;
     xmlSchemaTypeBooleanDef = xmlSchemaInitBasicType("boolean",
                                                      XML_SCHEMAS_BOOLEAN,
                                                     xmlSchemaTypeAnySimpleTypeDef);
+    if (xmlSchemaTypeBooleanDef == NULL)
+        goto error;
     xmlSchemaTypeAnyURIDef = xmlSchemaInitBasicType("anyURI",
                                                     XML_SCHEMAS_ANYURI,
                                                    xmlSchemaTypeAnySimpleTypeDef);
+    if (xmlSchemaTypeAnyURIDef == NULL)
+        goto error;
     xmlSchemaTypeHexBinaryDef = xmlSchemaInitBasicType("hexBinary",
                                                      XML_SCHEMAS_HEXBINARY,
                                                     xmlSchemaTypeAnySimpleTypeDef);
+    if (xmlSchemaTypeHexBinaryDef == NULL)
+        goto error;
     xmlSchemaTypeBase64BinaryDef
         = xmlSchemaInitBasicType("base64Binary", XML_SCHEMAS_BASE64BINARY,
        xmlSchemaTypeAnySimpleTypeDef);
+    if (xmlSchemaTypeBase64BinaryDef == NULL)
+        goto error;
     xmlSchemaTypeNotationDef = xmlSchemaInitBasicType("NOTATION",
                                                     XML_SCHEMAS_NOTATION,
                                                    xmlSchemaTypeAnySimpleTypeDef);
+    if (xmlSchemaTypeNotationDef == NULL)
+        goto error;
     xmlSchemaTypeQNameDef = xmlSchemaInitBasicType("QName",
                                                    XML_SCHEMAS_QNAME,
                                                   xmlSchemaTypeAnySimpleTypeDef);
+    if (xmlSchemaTypeQNameDef == NULL)
+        goto error;
 
     /*
      * derived datatypes
@@ -529,69 +616,113 @@ xmlSchemaInitTypes(void)
     xmlSchemaTypeIntegerDef = xmlSchemaInitBasicType("integer",
                                                      XML_SCHEMAS_INTEGER,
                                                     xmlSchemaTypeDecimalDef);
+    if (xmlSchemaTypeIntegerDef == NULL)
+        goto error;
     xmlSchemaTypeNonPositiveIntegerDef =
         xmlSchemaInitBasicType("nonPositiveInteger",
                                XML_SCHEMAS_NPINTEGER,
                               xmlSchemaTypeIntegerDef);
+    if (xmlSchemaTypeNonPositiveIntegerDef == NULL)
+        goto error;
     xmlSchemaTypeNegativeIntegerDef =
         xmlSchemaInitBasicType("negativeInteger", XML_SCHEMAS_NINTEGER,
        xmlSchemaTypeNonPositiveIntegerDef);
+    if (xmlSchemaTypeNegativeIntegerDef == NULL)
+        goto error;
     xmlSchemaTypeLongDef =
         xmlSchemaInitBasicType("long", XML_SCHEMAS_LONG,
        xmlSchemaTypeIntegerDef);
+    if (xmlSchemaTypeLongDef == NULL)
+        goto error;
     xmlSchemaTypeIntDef = xmlSchemaInitBasicType("int", XML_SCHEMAS_INT,
        xmlSchemaTypeLongDef);
+    if (xmlSchemaTypeIntDef == NULL)
+        goto error;
     xmlSchemaTypeShortDef = xmlSchemaInitBasicType("short",
                                                    XML_SCHEMAS_SHORT,
                                                   xmlSchemaTypeIntDef);
+    if (xmlSchemaTypeShortDef == NULL)
+        goto error;
     xmlSchemaTypeByteDef = xmlSchemaInitBasicType("byte",
                                                   XML_SCHEMAS_BYTE,
                                                  xmlSchemaTypeShortDef);
+    if (xmlSchemaTypeByteDef == NULL)
+        goto error;
     xmlSchemaTypeNonNegativeIntegerDef =
         xmlSchemaInitBasicType("nonNegativeInteger",
                                XML_SCHEMAS_NNINTEGER,
                               xmlSchemaTypeIntegerDef);
+    if (xmlSchemaTypeNonNegativeIntegerDef == NULL)
+        goto error;
     xmlSchemaTypeUnsignedLongDef =
         xmlSchemaInitBasicType("unsignedLong", XML_SCHEMAS_ULONG,
        xmlSchemaTypeNonNegativeIntegerDef);
+    if (xmlSchemaTypeUnsignedLongDef == NULL)
+        goto error;
     xmlSchemaTypeUnsignedIntDef =
         xmlSchemaInitBasicType("unsignedInt", XML_SCHEMAS_UINT,
        xmlSchemaTypeUnsignedLongDef);
+    if (xmlSchemaTypeUnsignedIntDef == NULL)
+        goto error;
     xmlSchemaTypeUnsignedShortDef =
         xmlSchemaInitBasicType("unsignedShort", XML_SCHEMAS_USHORT,
        xmlSchemaTypeUnsignedIntDef);
+    if (xmlSchemaTypeUnsignedShortDef == NULL)
+        goto error;
     xmlSchemaTypeUnsignedByteDef =
         xmlSchemaInitBasicType("unsignedByte", XML_SCHEMAS_UBYTE,
        xmlSchemaTypeUnsignedShortDef);
+    if (xmlSchemaTypeUnsignedByteDef == NULL)
+        goto error;
     xmlSchemaTypePositiveIntegerDef =
         xmlSchemaInitBasicType("positiveInteger", XML_SCHEMAS_PINTEGER,
        xmlSchemaTypeNonNegativeIntegerDef);
+    if (xmlSchemaTypePositiveIntegerDef == NULL)
+        goto error;
     xmlSchemaTypeNormStringDef = xmlSchemaInitBasicType("normalizedString",
                                                         XML_SCHEMAS_NORMSTRING,
                                                        xmlSchemaTypeStringDef);
+    if (xmlSchemaTypeNormStringDef == NULL)
+        goto error;
     xmlSchemaTypeTokenDef = xmlSchemaInitBasicType("token",
                                                    XML_SCHEMAS_TOKEN,
                                                   xmlSchemaTypeNormStringDef);
+    if (xmlSchemaTypeTokenDef == NULL)
+        goto error;
     xmlSchemaTypeLanguageDef = xmlSchemaInitBasicType("language",
                                                       XML_SCHEMAS_LANGUAGE,
                                                      xmlSchemaTypeTokenDef);
+    if (xmlSchemaTypeLanguageDef == NULL)
+        goto error;
     xmlSchemaTypeNameDef = xmlSchemaInitBasicType("Name",
                                                   XML_SCHEMAS_NAME,
                                                  xmlSchemaTypeTokenDef);
+    if (xmlSchemaTypeNameDef == NULL)
+        goto error;
     xmlSchemaTypeNmtokenDef = xmlSchemaInitBasicType("NMTOKEN",
                                                      XML_SCHEMAS_NMTOKEN,
                                                     xmlSchemaTypeTokenDef);
+    if (xmlSchemaTypeNmtokenDef == NULL)
+        goto error;
     xmlSchemaTypeNCNameDef = xmlSchemaInitBasicType("NCName",
                                                     XML_SCHEMAS_NCNAME,
                                                    xmlSchemaTypeNameDef);
+    if (xmlSchemaTypeNCNameDef == NULL)
+        goto error;
     xmlSchemaTypeIdDef = xmlSchemaInitBasicType("ID", XML_SCHEMAS_ID,
                                                    xmlSchemaTypeNCNameDef);
+    if (xmlSchemaTypeIdDef == NULL)
+        goto error;
     xmlSchemaTypeIdrefDef = xmlSchemaInitBasicType("IDREF",
                                                    XML_SCHEMAS_IDREF,
                                                   xmlSchemaTypeNCNameDef);
+    if (xmlSchemaTypeIdrefDef == NULL)
+        goto error;
     xmlSchemaTypeEntityDef = xmlSchemaInitBasicType("ENTITY",
                                                     XML_SCHEMAS_ENTITY,
                                                    xmlSchemaTypeNCNameDef);
+    if (xmlSchemaTypeEntityDef == NULL)
+        goto error;
     /*
     * Derived list types.
     */
@@ -599,25 +730,31 @@ xmlSchemaInitTypes(void)
     xmlSchemaTypeEntitiesDef = xmlSchemaInitBasicType("ENTITIES",
                                                       XML_SCHEMAS_ENTITIES,
                                                      xmlSchemaTypeAnySimpleTypeDef);
+    if (xmlSchemaTypeEntitiesDef == NULL)
+        goto error;
     xmlSchemaTypeEntitiesDef->subtypes = xmlSchemaTypeEntityDef;
     /* IDREFS */
     xmlSchemaTypeIdrefsDef = xmlSchemaInitBasicType("IDREFS",
                                                     XML_SCHEMAS_IDREFS,
                                                    xmlSchemaTypeAnySimpleTypeDef);
+    if (xmlSchemaTypeIdrefsDef == NULL)
+        goto error;
     xmlSchemaTypeIdrefsDef->subtypes = xmlSchemaTypeIdrefDef;
 
     /* NMTOKENS */
     xmlSchemaTypeNmtokensDef = xmlSchemaInitBasicType("NMTOKENS",
                                                       XML_SCHEMAS_NMTOKENS,
                                                      xmlSchemaTypeAnySimpleTypeDef);
+    if (xmlSchemaTypeNmtokensDef == NULL)
+        goto error;
     xmlSchemaTypeNmtokensDef->subtypes = xmlSchemaTypeNmtokenDef;
 
     xmlSchemaTypesInitialized = 1;
-}
+    return (0);
 
-static void
-xmlSchemaFreeTypeEntry(void *type, const xmlChar *name ATTRIBUTE_UNUSED) {
-    xmlSchemaFreeType((xmlSchemaTypePtr) type);
+error:
+    xmlSchemaCleanupTypesInternal();
+    return (-1);
 }
 
 /**
@@ -626,34 +763,16 @@ xmlSchemaFreeTypeEntry(void *type, const xmlChar *name ATTRIBUTE_UNUSED) {
  * DEPRECATED: This function will be made private. Call xmlCleanupParser
  * to free global state but see the warnings there. xmlCleanupParser
  * should be only called once at program exit. In most cases, you don't
- * have call cleanup functions at all.
+ * have to call cleanup functions at all.
  *
  * Cleanup the default XML Schemas type library
  */
 void
 xmlSchemaCleanupTypes(void) {
-    if (xmlSchemaTypesInitialized == 0)
-       return;
-    /*
-    * Free xs:anyType.
-    */
-    {
-       xmlSchemaParticlePtr particle;
-       /* Attribute wildcard. */
-       xmlSchemaFreeWildcard(xmlSchemaTypeAnyTypeDef->attributeWildcard);
-       /* Content type. */
-       particle = (xmlSchemaParticlePtr) xmlSchemaTypeAnyTypeDef->subtypes;
-       /* Wildcard. */
-       xmlSchemaFreeWildcard((xmlSchemaWildcardPtr)
-           particle->children->children->children);
-       xmlFree((xmlSchemaParticlePtr) particle->children->children);
-       /* Sequence model group. */
-       xmlFree((xmlSchemaModelGroupPtr) particle->children);
-       xmlFree((xmlSchemaParticlePtr) particle);
-       xmlSchemaTypeAnyTypeDef->subtypes = NULL;
+    if (xmlSchemaTypesInitialized != 0) {
+        xmlSchemaCleanupTypesInternal();
+        xmlSchemaTypesInitialized = 0;
     }
-    xmlHashFree(xmlSchemaTypesBank, xmlSchemaFreeTypeEntry);
-    xmlSchemaTypesInitialized = 0;
 }
 
 /**
@@ -748,8 +867,9 @@ xmlSchemaIsBuiltInTypeFacet(xmlSchemaTypePtr type, int facetType)
 xmlSchemaTypePtr
 xmlSchemaGetBuiltInType(xmlSchemaValType type)
 {
-    if (xmlSchemaTypesInitialized == 0)
-       xmlSchemaInitTypes();
+    if ((xmlSchemaTypesInitialized == 0) &&
+       (xmlSchemaInitTypes() < 0))
+        return (NULL);
     switch (type) {
 
        case XML_SCHEMAS_ANYSIMPLETYPE:
@@ -1081,8 +1201,9 @@ xmlSchemaFreeValue(xmlSchemaValPtr value) {
  */
 xmlSchemaTypePtr
 xmlSchemaGetPredefinedType(const xmlChar *name, const xmlChar *ns) {
-    if (xmlSchemaTypesInitialized == 0)
-       xmlSchemaInitTypes();
+    if ((xmlSchemaTypesInitialized == 0) &&
+       (xmlSchemaInitTypes() < 0))
+        return (NULL);
     if (name == NULL)
        return(NULL);
     return((xmlSchemaTypePtr) xmlHashLookup2(xmlSchemaTypesBank, name, ns));
@@ -2251,8 +2372,9 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value,
     xmlChar *norm = NULL;
     int ret = 0;
 
-    if (xmlSchemaTypesInitialized == 0)
-        xmlSchemaInitTypes();
+    if ((xmlSchemaTypesInitialized == 0) &&
+       (xmlSchemaInitTypes() < 0))
+        return (-1);
     if (type == NULL)
         return (-1);
 
@@ -3034,6 +3156,8 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value,
                            value = norm;
                    }
                    tmpval = xmlStrdup(value);
+                    if (tmpval == NULL)
+                        goto error;
                    for (cur = tmpval; *cur; ++cur) {
                        if (*cur < 32 || *cur >= 127 || *cur == ' ' ||
                            *cur == '<' || *cur == '>' || *cur == '"' ||
@@ -3220,8 +3344,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value,
                     if (v == NULL)
                         goto error;
                     base =
-                        (xmlChar *) xmlMallocAtomic((i + pad + 1) *
-                                                    sizeof(xmlChar));
+                        (xmlChar *) xmlMallocAtomic(i + pad + 1);
                     if (base == NULL) {
                        xmlSchemaTypeErrMemory(node, "allocating base64 data");
                         xmlFree(v);
@@ -4141,9 +4264,15 @@ xmlSchemaCompareDates (xmlSchemaValPtr x, xmlSchemaValPtr y)
 
         if (!y->value.date.tz_flag) {
             p1 = xmlSchemaDateNormalize(x, 0);
+            if (p1 == NULL)
+                return -2;
             p1d = _xmlSchemaDateCastYMToDays(p1) + p1->value.date.day;
             /* normalize y + 14:00 */
             q1 = xmlSchemaDateNormalize(y, (14 * SECS_PER_HOUR));
+            if (q1 == NULL) {
+               xmlSchemaFreeValue(p1);
+                return -2;
+            }
 
             q1d = _xmlSchemaDateCastYMToDays(q1) + q1->value.date.day;
             if (p1d < q1d) {
@@ -4162,6 +4291,11 @@ xmlSchemaCompareDates (xmlSchemaValPtr x, xmlSchemaValPtr y)
                    int ret = 0;
                     /* normalize y - 14:00 */
                     q2 = xmlSchemaDateNormalize(y, -(14 * SECS_PER_HOUR));
+                    if (q2 == NULL) {
+                        xmlSchemaFreeValue(p1);
+                        xmlSchemaFreeValue(q1);
+                        return -2;
+                    }
                     q2d = _xmlSchemaDateCastYMToDays(q2) + q2->value.date.day;
                     if (p1d > q2d)
                         ret = 1;
@@ -4185,10 +4319,16 @@ xmlSchemaCompareDates (xmlSchemaValPtr x, xmlSchemaValPtr y)
         }
     } else if (y->value.date.tz_flag) {
         q1 = xmlSchemaDateNormalize(y, 0);
+        if (q1 == NULL)
+            return -2;
         q1d = _xmlSchemaDateCastYMToDays(q1) + q1->value.date.day;
 
         /* normalize x - 14:00 */
         p1 = xmlSchemaDateNormalize(x, -(14 * SECS_PER_HOUR));
+        if (p1 == NULL) {
+           xmlSchemaFreeValue(q1);
+            return -2;
+        }
         p1d = _xmlSchemaDateCastYMToDays(p1) + p1->value.date.day;
 
         if (p1d < q1d) {
@@ -4207,6 +4347,11 @@ xmlSchemaCompareDates (xmlSchemaValPtr x, xmlSchemaValPtr y)
                int ret = 0;
                 /* normalize x + 14:00 */
                 p2 = xmlSchemaDateNormalize(x, (14 * SECS_PER_HOUR));
+                if (p2 == NULL) {
+                    xmlSchemaFreeValue(p1);
+                    xmlSchemaFreeValue(q1);
+                    return -2;
+                }
                 p2d = _xmlSchemaDateCastYMToDays(p2) + p2->value.date.day;
 
                 if (p2d > q1d) {
@@ -4236,9 +4381,15 @@ xmlSchemaCompareDates (xmlSchemaValPtr x, xmlSchemaValPtr y)
     if (x->type == y->type) {
         int ret = 0;
         q1 = xmlSchemaDateNormalize(y, 0);
+        if (q1 == NULL)
+            return -2;
         q1d = _xmlSchemaDateCastYMToDays(q1) + q1->value.date.day;
 
         p1 = xmlSchemaDateNormalize(x, 0);
+        if (p1 == NULL) {
+           xmlSchemaFreeValue(q1);
+            return -2;
+        }
         p1d = _xmlSchemaDateCastYMToDays(p1) + p1->value.date.day;
 
         if (p1d < q1d) {
index 46301c3..5473472 100644 (file)
@@ -23,6 +23,9 @@
 #include <libxml/parserInternals.h>
 #include <libxml/xmlstring.h>
 
+#include "private/parser.h"
+#include "private/string.h"
+
 /************************************************************************
  *                                                                      *
  *                Commodity functions to handle xmlChars                *
@@ -43,12 +46,11 @@ xmlStrndup(const xmlChar *cur, int len) {
     xmlChar *ret;
 
     if ((cur == NULL) || (len < 0)) return(NULL);
-    ret = (xmlChar *) xmlMallocAtomic(((size_t) len + 1) * sizeof(xmlChar));
+    ret = (xmlChar *) xmlMallocAtomic((size_t) len + 1);
     if (ret == NULL) {
-        xmlErrMemory(NULL, NULL);
         return(NULL);
     }
-    memcpy(ret, cur, len * sizeof(xmlChar));
+    memcpy(ret, cur, len);
     ret[len] = 0;
     return(ret);
 }
@@ -88,12 +90,12 @@ xmlCharStrndup(const char *cur, int len) {
     xmlChar *ret;
 
     if ((cur == NULL) || (len < 0)) return(NULL);
-    ret = (xmlChar *) xmlMallocAtomic(((size_t) len + 1) * sizeof(xmlChar));
+    ret = (xmlChar *) xmlMallocAtomic((size_t) len + 1);
     if (ret == NULL) {
-        xmlErrMemory(NULL, NULL);
         return(NULL);
     }
     for (i = 0;i < len;i++) {
+        /* Explicit sign change */
         ret[i] = (xmlChar) cur[i];
         if (ret[i] == 0) return(ret);
     }
@@ -457,12 +459,11 @@ xmlStrncat(xmlChar *cur, const xmlChar *add, int len) {
     size = xmlStrlen(cur);
     if ((size < 0) || (size > INT_MAX - len))
         return(NULL);
-    ret = (xmlChar *) xmlRealloc(cur, ((size_t) size + len + 1) * sizeof(xmlChar));
+    ret = (xmlChar *) xmlRealloc(cur, (size_t) size + len + 1);
     if (ret == NULL) {
-        xmlErrMemory(NULL, NULL);
         return(cur);
     }
-    memcpy(&ret[size], add, len * sizeof(xmlChar));
+    memcpy(&ret[size], add, len);
     ret[size + len] = 0;
     return(ret);
 }
@@ -497,13 +498,12 @@ xmlStrncatNew(const xmlChar *str1, const xmlChar *str2, int len) {
     size = xmlStrlen(str1);
     if ((size < 0) || (size > INT_MAX - len))
         return(NULL);
-    ret = (xmlChar *) xmlMalloc(((size_t) size + len + 1) * sizeof(xmlChar));
+    ret = (xmlChar *) xmlMalloc((size_t) size + len + 1);
     if (ret == NULL) {
-        xmlErrMemory(NULL, NULL);
         return(xmlStrndup(str1, size));
     }
-    memcpy(ret, str1, size * sizeof(xmlChar));
-    memcpy(&ret[size], str2, len * sizeof(xmlChar));
+    memcpy(ret, str1, size);
+    memcpy(&ret[size], str2, len);
     ret[size + len] = 0;
     return(ret);
 }
@@ -543,7 +543,7 @@ xmlStrcat(xmlChar *cur, const xmlChar *add) {
  *
  * Returns the number of characters written to @buf or -1 if an error occurs.
  */
-int XMLCDECL
+int
 xmlStrPrintf(xmlChar *buf, int len, const char *msg, ...) {
     va_list args;
     int ret;
@@ -871,11 +871,11 @@ xmlUTF8Strndup(const xmlChar *utf, int len) {
 
     if ((utf == NULL) || (len < 0)) return(NULL);
     i = xmlUTF8Strsize(utf, len);
-    ret = (xmlChar *) xmlMallocAtomic(((size_t) i + 1) * sizeof(xmlChar));
+    ret = (xmlChar *) xmlMallocAtomic((size_t) i + 1);
     if (ret == NULL) {
         return(NULL);
     }
-    memcpy(ret, utf, i * sizeof(xmlChar));
+    memcpy(ret, utf, i);
     ret[i] = 0;
     return(ret);
 }
@@ -1022,13 +1022,12 @@ xmlEscapeFormatString(xmlChar **msg)
     if ((count > INT_MAX) || (msgLen > INT_MAX - count))
         return(NULL);
     resultLen = msgLen + count + 1;
-    result = (xmlChar *) xmlMallocAtomic(resultLen * sizeof(xmlChar));
+    result = (xmlChar *) xmlMallocAtomic(resultLen);
     if (result == NULL) {
         /* Clear *msg to prevent format string vulnerabilities in
            out-of-memory situations. */
         xmlFree(*msg);
         *msg = NULL;
-        xmlErrMemory(NULL, NULL);
         return(NULL);
     }
 
index 85c1955..0de56e7 100644 (file)
 
 #include <libxml/xmlwriter.h>
 
-#include "buf.h"
-#include "enc.h"
-#include "save.h"
+#include "private/buf.h"
+#include "private/enc.h"
+#include "private/error.h"
+#include "private/save.h"
 
 #define B64LINELEN 72
 #define B64CRLF "\r\n"
@@ -188,7 +189,7 @@ xmlNewTextWriter(xmlOutputBufferPtr out)
                         "xmlNewTextWriter : out of memory!\n");
         return NULL;
     }
-    memset(ret, 0, (size_t) sizeof(xmlTextWriter));
+    memset(ret, 0, sizeof(xmlTextWriter));
 
     ret->nodes = xmlListCreate(xmlFreeTextWriterStackEntry,
                                xmlCmpTextWriterStackEntry);
@@ -863,7 +864,7 @@ xmlTextWriterEndComment(xmlTextWriterPtr writer)
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int XMLCDECL
+int
 xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer,
                                 const char *format, ...)
 {
@@ -1291,7 +1292,7 @@ xmlTextWriterFullEndElement(xmlTextWriterPtr writer)
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int XMLCDECL
+int
 xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer, const char *format,
                             ...)
 {
@@ -1417,7 +1418,7 @@ xmlTextWriterWriteRaw(xmlTextWriterPtr writer, const xmlChar * content)
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int XMLCDECL
+int
 xmlTextWriterWriteFormatString(xmlTextWriterPtr writer, const char *format,
                                ...)
 {
@@ -1963,7 +1964,7 @@ xmlTextWriterEndAttribute(xmlTextWriterPtr writer)
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int XMLCDECL
+int
 xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer,
                                   const xmlChar * name, const char *format,
                                   ...)
@@ -2058,7 +2059,7 @@ xmlTextWriterWriteAttribute(xmlTextWriterPtr writer, const xmlChar * name,
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int XMLCDECL
+int
 xmlTextWriterWriteFormatAttributeNS(xmlTextWriterPtr writer,
                                     const xmlChar * prefix,
                                     const xmlChar * name,
@@ -2166,7 +2167,7 @@ xmlTextWriterWriteAttributeNS(xmlTextWriterPtr writer,
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int XMLCDECL
+int
 xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer,
                                 const xmlChar * name, const char *format,
                                 ...)
@@ -2263,7 +2264,7 @@ xmlTextWriterWriteElement(xmlTextWriterPtr writer, const xmlChar * name,
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int XMLCDECL
+int
 xmlTextWriterWriteFormatElementNS(xmlTextWriterPtr writer,
                                   const xmlChar * prefix,
                                   const xmlChar * name,
@@ -2520,7 +2521,7 @@ xmlTextWriterEndPI(xmlTextWriterPtr writer)
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int XMLCDECL
+int
 xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer, const xmlChar * target,
                            const char *format, ...)
 {
@@ -2735,7 +2736,7 @@ xmlTextWriterEndCDATA(xmlTextWriterPtr writer)
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int XMLCDECL
+int
 xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer, const char *format,
                               ...)
 {
@@ -3044,7 +3045,7 @@ xmlTextWriterEndDTD(xmlTextWriterPtr writer)
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int XMLCDECL
+int
 xmlTextWriterWriteFormatDTD(xmlTextWriterPtr writer,
                             const xmlChar * name,
                             const xmlChar * pubid,
@@ -3288,7 +3289,7 @@ xmlTextWriterEndDTDElement(xmlTextWriterPtr writer)
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int XMLCDECL
+int
 xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer,
                                    const xmlChar * name,
                                    const char *format, ...)
@@ -3525,7 +3526,7 @@ xmlTextWriterEndDTDAttlist(xmlTextWriterPtr writer)
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int XMLCDECL
+int
 xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer,
                                    const xmlChar * name,
                                    const char *format, ...)
@@ -3783,7 +3784,7 @@ xmlTextWriterEndDTDEntity(xmlTextWriterPtr writer)
  *
  * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
  */
-int XMLCDECL
+int
 xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriterPtr writer,
                                           int pe,
                                           const xmlChar * name,
diff --git a/xpath.c b/xpath.c
index fbee6a5..8df7974 100644 (file)
--- a/xpath.c
+++ b/xpath.c
@@ -49,7 +49,9 @@
 #include <libxml/pattern.h>
 #endif
 
-#include "buf.h"
+#include "private/buf.h"
+#include "private/error.h"
+#include "private/xpath.h"
 
 #ifdef LIBXML_PATTERN_ENABLED
 #define XPATH_STREAMING
  */
 #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 #define XPATH_MAX_RECURSION_DEPTH 500
+#elif defined(_WIN32)
+/* Windows typically limits stack size to 1MB. */
+#define XPATH_MAX_RECURSION_DEPTH 1000
 #else
 #define XPATH_MAX_RECURSION_DEPTH 5000
 #endif
  * any use of the macros IS_ASCII_CHARACTER and IS_ASCII_DIGIT)
  */
 
+#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
+
+/************************************************************************
+ *                                                                     *
+ *                     Floating point stuff                            *
+ *                                                                     *
+ ************************************************************************/
+
+double xmlXPathNAN = 0.0;
+double xmlXPathPINF = 0.0;
+double xmlXPathNINF = 0.0;
+
+/**
+ * xmlXPathInit:
+ *
+ * DEPRECATED: Alias for xmlInitParser.
+ */
+void
+xmlXPathInit(void) {
+    xmlInitParser();
+}
+
+/**
+ * xmlInitXPathInternal:
+ *
+ * Initialize the XPath environment
+ */
+ATTRIBUTE_NO_SANITIZE("float-divide-by-zero")
+void
+xmlInitXPathInternal(void) {
+#if defined(NAN) && defined(INFINITY)
+    xmlXPathNAN = NAN;
+    xmlXPathPINF = INFINITY;
+    xmlXPathNINF = -INFINITY;
+#else
+    /* MSVC doesn't allow division by zero in constant expressions. */
+    double zero = 0.0;
+    xmlXPathNAN = 0.0 / zero;
+    xmlXPathPINF = 1.0 / zero;
+    xmlXPathNINF = -xmlXPathPINF;
+#endif
+}
+
+/**
+ * xmlXPathIsNaN:
+ * @val:  a double value
+ *
+ * Returns 1 if the value is a NaN, 0 otherwise
+ */
+int
+xmlXPathIsNaN(double val) {
+#ifdef isnan
+    return isnan(val);
+#else
+    return !(val == val);
+#endif
+}
+
+/**
+ * xmlXPathIsInf:
+ * @val:  a double value
+ *
+ * Returns 1 if the value is +Infinite, -1 if -Infinite, 0 otherwise
+ */
+int
+xmlXPathIsInf(double val) {
+#ifdef isinf
+    return isinf(val) ? (val > 0 ? 1 : -1) : 0;
+#else
+    if (val >= xmlXPathPINF)
+        return 1;
+    if (val <= -xmlXPathPINF)
+        return -1;
+    return 0;
+#endif
+}
+
+#endif /* SCHEMAS or XPATH */
+
+#ifdef LIBXML_XPATH_ENABLED
+
+/*
+ * TODO: when compatibility allows remove all "fake node libxslt" strings
+ *       the test should just be name[0] = ' '
+ */
+#ifdef DEBUG_XPATH_EXPRESSION
+#define DEBUG_STEP
+#define DEBUG_EXPR
+#define DEBUG_EVAL_COUNTS
+#endif
+
+static xmlNs xmlXPathXMLNamespaceStruct = {
+    NULL,
+    XML_NAMESPACE_DECL,
+    XML_XML_NAMESPACE,
+    BAD_CAST "xml",
+    NULL,
+    NULL
+};
+static xmlNsPtr xmlXPathXMLNamespace = &xmlXPathXMLNamespaceStruct;
+#ifndef LIBXML_THREAD_ENABLED
+/*
+ * Optimizer is disabled only when threaded apps are detected while
+ * the library ain't compiled for thread safety.
+ */
+static int xmlXPathDisableOptimizer = 0;
+#endif
+
+static void
+xmlXPathNodeSetClear(xmlNodeSetPtr set, int hasNsNodes);
+
 #ifdef XP_OPTIMIZED_NON_ELEM_COMPARISON
 /**
  * xmlXPathCmpNodesExt:
@@ -467,107 +583,6 @@ int wrap_cmp( xmlNodePtr x, xmlNodePtr y );
 #include "timsort.h"
 #endif /* WITH_TIM_SORT */
 
-#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
-
-/************************************************************************
- *                                                                     *
- *                     Floating point stuff                            *
- *                                                                     *
- ************************************************************************/
-
-double xmlXPathNAN = 0.0;
-double xmlXPathPINF = 0.0;
-double xmlXPathNINF = 0.0;
-
-/**
- * xmlXPathInit:
- *
- * DEPRECATED: This function will be made private. Call xmlInitParser to
- * initialize the library.
- *
- * Initialize the XPath environment
- */
-ATTRIBUTE_NO_SANITIZE("float-divide-by-zero")
-void
-xmlXPathInit(void) {
-#if defined(NAN) && defined(INFINITY)
-    xmlXPathNAN = NAN;
-    xmlXPathPINF = INFINITY;
-    xmlXPathNINF = -INFINITY;
-#else
-    /* MSVC doesn't allow division by zero in constant expressions. */
-    double zero = 0.0;
-    xmlXPathNAN = 0.0 / zero;
-    xmlXPathPINF = 1.0 / zero;
-    xmlXPathNINF = -xmlXPathPINF;
-#endif
-}
-
-/**
- * xmlXPathIsNaN:
- * @val:  a double value
- *
- * Returns 1 if the value is a NaN, 0 otherwise
- */
-int
-xmlXPathIsNaN(double val) {
-#ifdef isnan
-    return isnan(val);
-#else
-    return !(val == val);
-#endif
-}
-
-/**
- * xmlXPathIsInf:
- * @val:  a double value
- *
- * Returns 1 if the value is +Infinite, -1 if -Infinite, 0 otherwise
- */
-int
-xmlXPathIsInf(double val) {
-#ifdef isinf
-    return isinf(val) ? (val > 0 ? 1 : -1) : 0;
-#else
-    if (val >= xmlXPathPINF)
-        return 1;
-    if (val <= -xmlXPathPINF)
-        return -1;
-    return 0;
-#endif
-}
-
-#endif /* SCHEMAS or XPATH */
-
-#ifdef LIBXML_XPATH_ENABLED
-
-/*
- * TODO: when compatibility allows remove all "fake node libxslt" strings
- *       the test should just be name[0] = ' '
- */
-#ifdef DEBUG_XPATH_EXPRESSION
-#define DEBUG_STEP
-#define DEBUG_EXPR
-#define DEBUG_EVAL_COUNTS
-#endif
-
-static xmlNs xmlXPathXMLNamespaceStruct = {
-    NULL,
-    XML_NAMESPACE_DECL,
-    XML_XML_NAMESPACE,
-    BAD_CAST "xml",
-    NULL,
-    NULL
-};
-static xmlNsPtr xmlXPathXMLNamespace = &xmlXPathXMLNamespaceStruct;
-#ifndef LIBXML_THREAD_ENABLED
-/*
- * Optimizer is disabled only when threaded apps are detected while
- * the library ain't compiled for thread safety.
- */
-static int xmlXPathDisableOptimizer = 0;
-#endif
-
 /************************************************************************
  *                                                                     *
  *                     Error handling routines                         *
@@ -700,6 +715,9 @@ xmlXPathErr(xmlXPathParserContextPtr ctxt, int error)
                        "%s", xmlXPathErrorMessages[error]);
        return;
     }
+    /* Only report the first error */
+    if (ctxt->error != 0)
+        return;
     ctxt->error = error;
     if (ctxt->context == NULL) {
        __xmlRaiseError(NULL, NULL, NULL,
@@ -805,32 +823,30 @@ xmlPointerListAddSize(xmlPointerListPtr list,
                       void *item,
                       int initialSize)
 {
-    if (list->items == NULL) {
-       if (initialSize <= 0)
-           initialSize = 1;
-       list->items = (void **) xmlMalloc(initialSize * sizeof(void *));
-       if (list->items == NULL) {
-           xmlXPathErrMemory(NULL,
-               "xmlPointerListCreate: allocating item\n");
-           return(-1);
-       }
-       list->number = 0;
-       list->size = initialSize;
-    } else if (list->size <= list->number) {
-        if (list->size > 50000000) {
-           xmlXPathErrMemory(NULL,
-               "xmlPointerListAddSize: re-allocating item\n");
-            return(-1);
+    if (list->size <= list->number) {
+        void **tmp;
+        size_t newSize;
+
+        if (list->size == 0) {
+            if (initialSize <= 0)
+                initialSize = 1;
+            newSize = initialSize;
+        } else {
+            if (list->size > 50000000) {
+                xmlXPathErrMemory(NULL,
+                    "xmlPointerListAddSize: re-allocating item\n");
+                return(-1);
+            }
+           newSize = list->size * 2;
         }
-       list->size *= 2;
-       list->items = (void **) xmlRealloc(list->items,
-           list->size * sizeof(void *));
-       if (list->items == NULL) {
+       tmp = (void **) xmlRealloc(list->items, newSize * sizeof(void *));
+       if (tmp == NULL) {
            xmlXPathErrMemory(NULL,
                "xmlPointerListAddSize: re-allocating item\n");
-           list->size = 0;
            return(-1);
        }
+        list->items = tmp;
+        list->size = newSize;
     }
     list->items[list->number++] = item;
     return(0);
@@ -2204,7 +2220,7 @@ xmlXPathNewCache(void)
         xmlXPathErrMemory(NULL, "creating object cache\n");
        return(NULL);
     }
-    memset(ret, 0 , (size_t) sizeof(xmlXPathContextCache));
+    memset(ret, 0 , sizeof(xmlXPathContextCache));
     ret->maxNodeset = 100;
     ret->maxString = 100;
     ret->maxBoolean = 100;
@@ -2323,6 +2339,8 @@ xmlXPathContextSetCache(xmlXPathContextPtr ctxt,
  * Wrap the Nodeset @val in a new xmlXPathObjectPtr
  *
  * Returns the created or reused object.
+ *
+ * In case of error the node set is destroyed and NULL is returned.
  */
 static xmlXPathObjectPtr
 xmlXPathCacheWrapNodeSet(xmlXPathContextPtr ctxt, xmlNodeSetPtr val)
@@ -2449,21 +2467,24 @@ xmlXPathCacheNewNodeSet(xmlXPathContextPtr ctxt, xmlNodePtr val)
            (cache->miscObjs->number != 0))
        {
            xmlXPathObjectPtr ret;
+            xmlNodeSetPtr set;
            /*
            * Fallback to misc-cache.
            */
 
+           set = xmlXPathNodeSetCreate(val);
+           if (set == NULL) {
+               ctxt->lastError.domain = XML_FROM_XPATH;
+               ctxt->lastError.code = XML_ERR_NO_MEMORY;
+               return(NULL);
+           }
+
            ret = (xmlXPathObjectPtr)
                cache->miscObjs->items[--cache->miscObjs->number];
 
            ret->type = XPATH_NODESET;
            ret->boolval = 0;
-           ret->nodesetval = xmlXPathNodeSetCreate(val);
-           if (ret->nodesetval == NULL) {
-               ctxt->lastError.domain = XML_FROM_XPATH;
-               ctxt->lastError.code = XML_ERR_NO_MEMORY;
-               return(NULL);
-           }
+           ret->nodesetval = set;
 #ifdef XP_DEBUG_OBJ_USAGE
            xmlXPathDebugObjUsageRequested(ctxt, XPATH_NODESET);
 #endif
@@ -2474,17 +2495,17 @@ xmlXPathCacheNewNodeSet(xmlXPathContextPtr ctxt, xmlNodePtr val)
 }
 
 /**
- * xmlXPathCacheNewCString:
+ * xmlXPathCacheNewString:
  * @ctxt: the XPath context
- * @val:  the char * value
+ * @val:  the xmlChar * value
  *
- * This is the cached version of xmlXPathNewCString().
+ * This is the cached version of xmlXPathNewString().
  * Acquire an xmlXPathObjectPtr of type string and of value @val
  *
  * Returns the created or reused object.
  */
 static xmlXPathObjectPtr
-xmlXPathCacheNewCString(xmlXPathContextPtr ctxt, const char *val)
+xmlXPathCacheNewString(xmlXPathContextPtr ctxt, const xmlChar *val)
 {
     if ((ctxt != NULL) && (ctxt->cache)) {
        xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache;
@@ -2493,12 +2514,20 @@ xmlXPathCacheNewCString(xmlXPathContextPtr ctxt, const char *val)
            (cache->stringObjs->number != 0))
        {
            xmlXPathObjectPtr ret;
+            xmlChar *copy;
+
+            if (val == NULL)
+                val = BAD_CAST "";
+            copy = xmlStrdup(val);
+            if (copy == NULL) {
+                xmlXPathErrMemory(ctxt, NULL);
+                return(NULL);
+            }
 
            ret = (xmlXPathObjectPtr)
                cache->stringObjs->items[--cache->stringObjs->number];
-
            ret->type = XPATH_STRING;
-           ret->stringval = xmlStrdup(BAD_CAST val);
+            ret->stringval = copy;
 #ifdef XP_DEBUG_OBJ_USAGE
            xmlXPathDebugObjUsageRequested(ctxt, XPATH_STRING);
 #endif
@@ -2507,73 +2536,44 @@ xmlXPathCacheNewCString(xmlXPathContextPtr ctxt, const char *val)
            (cache->miscObjs->number != 0))
        {
            xmlXPathObjectPtr ret;
+            xmlChar *copy;
+
+            if (val == NULL)
+                val = BAD_CAST "";
+            copy = xmlStrdup(val);
+            if (copy == NULL) {
+                xmlXPathErrMemory(ctxt, NULL);
+                return(NULL);
+            }
 
            ret = (xmlXPathObjectPtr)
                cache->miscObjs->items[--cache->miscObjs->number];
 
            ret->type = XPATH_STRING;
-           ret->stringval = xmlStrdup(BAD_CAST val);
+            ret->stringval = copy;
 #ifdef XP_DEBUG_OBJ_USAGE
            xmlXPathDebugObjUsageRequested(ctxt, XPATH_STRING);
 #endif
            return(ret);
        }
     }
-    return(xmlXPathNewCString(val));
+    return(xmlXPathNewString(val));
 }
 
 /**
- * xmlXPathCacheNewString:
+ * xmlXPathCacheNewCString:
  * @ctxt: the XPath context
- * @val:  the xmlChar * value
+ * @val:  the char * value
  *
- * This is the cached version of xmlXPathNewString().
+ * This is the cached version of xmlXPathNewCString().
  * Acquire an xmlXPathObjectPtr of type string and of value @val
  *
  * Returns the created or reused object.
  */
 static xmlXPathObjectPtr
-xmlXPathCacheNewString(xmlXPathContextPtr ctxt, const xmlChar *val)
+xmlXPathCacheNewCString(xmlXPathContextPtr ctxt, const char *val)
 {
-    if ((ctxt != NULL) && (ctxt->cache)) {
-       xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache;
-
-       if ((cache->stringObjs != NULL) &&
-           (cache->stringObjs->number != 0))
-       {
-           xmlXPathObjectPtr ret;
-
-           ret = (xmlXPathObjectPtr)
-               cache->stringObjs->items[--cache->stringObjs->number];
-           ret->type = XPATH_STRING;
-           if (val != NULL)
-               ret->stringval = xmlStrdup(val);
-           else
-               ret->stringval = xmlStrdup((const xmlChar *)"");
-#ifdef XP_DEBUG_OBJ_USAGE
-           xmlXPathDebugObjUsageRequested(ctxt, XPATH_STRING);
-#endif
-           return(ret);
-       } else if ((cache->miscObjs != NULL) &&
-           (cache->miscObjs->number != 0))
-       {
-           xmlXPathObjectPtr ret;
-
-           ret = (xmlXPathObjectPtr)
-               cache->miscObjs->items[--cache->miscObjs->number];
-
-           ret->type = XPATH_STRING;
-           if (val != NULL)
-               ret->stringval = xmlStrdup(val);
-           else
-               ret->stringval = xmlStrdup((const xmlChar *)"");
-#ifdef XP_DEBUG_OBJ_USAGE
-           xmlXPathDebugObjUsageRequested(ctxt, XPATH_STRING);
-#endif
-           return(ret);
-       }
-    }
-    return(xmlXPathNewString(val));
+    return xmlXPathCacheNewString(ctxt, BAD_CAST val);
 }
 
 /**
@@ -2813,42 +2813,6 @@ xmlXPathCacheConvertNumber(xmlXPathContextPtr ctxt, xmlXPathObjectPtr val) {
  ************************************************************************/
 
 /**
- * xmlXPathSetFrame:
- * @ctxt: an XPath parser context
- *
- * Set the callee evaluation frame
- *
- * Returns the previous frame value to be restored once done
- */
-static int
-xmlXPathSetFrame(xmlXPathParserContextPtr ctxt) {
-    int ret;
-
-    if (ctxt == NULL)
-        return(0);
-    ret = ctxt->valueFrame;
-    ctxt->valueFrame = ctxt->valueNr;
-    return(ret);
-}
-
-/**
- * xmlXPathPopFrame:
- * @ctxt: an XPath parser context
- * @frame: the previous frame value
- *
- * Remove the callee evaluation frame
- */
-static void
-xmlXPathPopFrame(xmlXPathParserContextPtr ctxt, int frame) {
-    if (ctxt == NULL)
-        return;
-    if (ctxt->valueNr < ctxt->valueFrame) {
-        xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_STACK_ERROR);
-    }
-    ctxt->valueFrame = frame;
-}
-
-/**
  * valuePop:
  * @ctxt: an XPath evaluation context
  *
@@ -2864,11 +2828,6 @@ valuePop(xmlXPathParserContextPtr ctxt)
     if ((ctxt == NULL) || (ctxt->valueNr <= 0))
         return (NULL);
 
-    if (ctxt->valueNr <= ctxt->valueFrame) {
-        xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_STACK_ERROR);
-        return (NULL);
-    }
-
     ctxt->valueNr--;
     if (ctxt->valueNr > 0)
         ctxt->value = ctxt->valueTab[ctxt->valueNr - 1];
@@ -2887,6 +2846,8 @@ valuePop(xmlXPathParserContextPtr ctxt)
  * a memory error is recorded in the parser context.
  *
  * Returns the number of items on the value stack, or -1 in case of error.
+ *
+ * The object is destroyed in case of error.
  */
 int
 valuePush(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr value)
@@ -2905,6 +2866,7 @@ valuePush(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr value)
 
         if (ctxt->valueMax >= XPATH_MAX_STACK_DEPTH) {
             xmlXPathPErrMemory(ctxt, "XPath stack depth limit reached\n");
+            xmlXPathFreeObject(value);
             return (-1);
         }
         tmp = (xmlXPathObjectPtr *) xmlRealloc(ctxt->valueTab,
@@ -2912,6 +2874,7 @@ valuePush(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr value)
                                              sizeof(ctxt->valueTab[0]));
         if (tmp == NULL) {
             xmlXPathPErrMemory(ctxt, "pushing value\n");
+            xmlXPathFreeObject(value);
             return (-1);
         }
         ctxt->valueMax *= 2;
@@ -3097,7 +3060,7 @@ xmlXPathPopExternal (xmlXPathParserContextPtr ctxt) {
 #define CUR_CHAR(l) xmlXPathCurrentChar(ctxt, &l)
 
 #define COPY_BUF(l,b,i,v)                                              \
-    if (l == 1) b[i++] = (xmlChar) v;                                  \
+    if (l == 1) b[i++] = v;                                            \
     else i += xmlCopyChar(l,&b[i],v)
 
 #define NEXTL(l)  ctxt->cur += l
@@ -3304,7 +3267,7 @@ xmlXPathOrderDocElems(xmlDocPtr doc) {
            }
        } while (cur != NULL);
     }
-    return((long) count);
+    return(count);
 }
 
 /**
@@ -3580,7 +3543,7 @@ xmlXPathNodeSetCreate(xmlNodePtr val) {
         xmlXPathErrMemory(NULL, "creating nodeset\n");
        return(NULL);
     }
-    memset(ret, 0 , (size_t) sizeof(xmlNodeSet));
+    memset(ret, 0 , sizeof(xmlNodeSet));
     if (val != NULL) {
         ret->nodeTab = (xmlNodePtr *) xmlMalloc(XML_NODESET_DEFAULT *
                                             sizeof(xmlNodePtr));
@@ -3590,14 +3553,17 @@ xmlXPathNodeSetCreate(xmlNodePtr val) {
            return(NULL);
        }
        memset(ret->nodeTab, 0 ,
-              XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr));
+              XML_NODESET_DEFAULT * sizeof(xmlNodePtr));
         ret->nodeMax = XML_NODESET_DEFAULT;
        if (val->type == XML_NAMESPACE_DECL) {
            xmlNsPtr ns = (xmlNsPtr) val;
+            xmlNodePtr nsNode = xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns);
 
-            /* TODO: Check memory error. */
-           ret->nodeTab[ret->nodeNr++] =
-               xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns);
+            if (nsNode == NULL) {
+                xmlXPathFreeNodeSet(ret);
+                return(NULL);
+            }
+           ret->nodeTab[ret->nodeNr++] = nsNode;
        } else
            ret->nodeTab[ret->nodeNr++] = val;
     }
@@ -3654,7 +3620,7 @@ xmlXPathNodeSetContains (xmlNodeSetPtr cur, xmlNodePtr val) {
 int
 xmlXPathNodeSetAddNs(xmlNodeSetPtr cur, xmlNodePtr node, xmlNsPtr ns) {
     int i;
-
+    xmlNodePtr nsNode;
 
     if ((cur == NULL) || (ns == NULL) || (node == NULL) ||
         (ns->type != XML_NAMESPACE_DECL) ||
@@ -3684,7 +3650,7 @@ xmlXPathNodeSetAddNs(xmlNodeSetPtr cur, xmlNodePtr node, xmlNsPtr ns) {
            return(-1);
        }
        memset(cur->nodeTab, 0 ,
-              XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr));
+              XML_NODESET_DEFAULT * sizeof(xmlNodePtr));
         cur->nodeMax = XML_NODESET_DEFAULT;
     } else if (cur->nodeNr == cur->nodeMax) {
         xmlNodePtr *temp;
@@ -3702,8 +3668,10 @@ xmlXPathNodeSetAddNs(xmlNodeSetPtr cur, xmlNodePtr node, xmlNsPtr ns) {
         cur->nodeMax *= 2;
        cur->nodeTab = temp;
     }
-    /* TODO: Check memory error. */
-    cur->nodeTab[cur->nodeNr++] = xmlXPathNodeSetDupNs(node, ns);
+    nsNode = xmlXPathNodeSetDupNs(node, ns);
+    if(nsNode == NULL)
+        return(-1);
+    cur->nodeTab[cur->nodeNr++] = nsNode;
     return(0);
 }
 
@@ -3740,7 +3708,7 @@ xmlXPathNodeSetAdd(xmlNodeSetPtr cur, xmlNodePtr val) {
            return(-1);
        }
        memset(cur->nodeTab, 0 ,
-              XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr));
+              XML_NODESET_DEFAULT * sizeof(xmlNodePtr));
         cur->nodeMax = XML_NODESET_DEFAULT;
     } else if (cur->nodeNr == cur->nodeMax) {
         xmlNodePtr *temp;
@@ -3760,10 +3728,11 @@ xmlXPathNodeSetAdd(xmlNodeSetPtr cur, xmlNodePtr val) {
     }
     if (val->type == XML_NAMESPACE_DECL) {
        xmlNsPtr ns = (xmlNsPtr) val;
+        xmlNodePtr nsNode = xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns);
 
-        /* TODO: Check memory error. */
-       cur->nodeTab[cur->nodeNr++] =
-           xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns);
+        if (nsNode == NULL)
+            return(-1);
+       cur->nodeTab[cur->nodeNr++] = nsNode;
     } else
        cur->nodeTab[cur->nodeNr++] = val;
     return(0);
@@ -3795,7 +3764,7 @@ xmlXPathNodeSetAddUnique(xmlNodeSetPtr cur, xmlNodePtr val) {
            return(-1);
        }
        memset(cur->nodeTab, 0 ,
-              XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr));
+              XML_NODESET_DEFAULT * sizeof(xmlNodePtr));
         cur->nodeMax = XML_NODESET_DEFAULT;
     } else if (cur->nodeNr == cur->nodeMax) {
         xmlNodePtr *temp;
@@ -3815,10 +3784,11 @@ xmlXPathNodeSetAddUnique(xmlNodeSetPtr cur, xmlNodePtr val) {
     }
     if (val->type == XML_NAMESPACE_DECL) {
        xmlNsPtr ns = (xmlNsPtr) val;
+        xmlNodePtr nsNode = xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns);
 
-        /* TODO: Check memory error. */
-       cur->nodeTab[cur->nodeNr++] =
-           xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns);
+        if (nsNode == NULL)
+            return(-1);
+       cur->nodeTab[cur->nodeNr++] = nsNode;
     } else
        cur->nodeTab[cur->nodeNr++] = val;
     return(0);
@@ -3833,6 +3803,8 @@ xmlXPathNodeSetAddUnique(xmlNodeSetPtr cur, xmlNodePtr val) {
  * if @val1 is NULL, a new set is created and copied from @val2
  *
  * Returns @val1 once extended or NULL in case of error.
+ *
+ * Frees @val1 in case of error.
  */
 xmlNodeSetPtr
 xmlXPathNodeSetMerge(xmlNodeSetPtr val1, xmlNodeSetPtr val2) {
@@ -3842,35 +3814,8 @@ xmlXPathNodeSetMerge(xmlNodeSetPtr val1, xmlNodeSetPtr val2) {
     if (val2 == NULL) return(val1);
     if (val1 == NULL) {
        val1 = xmlXPathNodeSetCreate(NULL);
-    if (val1 == NULL)
-        return (NULL);
-#if 0
-       /*
-       * TODO: The optimization won't work in every case, since
-       *  those nasty namespace nodes need to be added with
-       *  xmlXPathNodeSetDupNs() to the set; thus a pure
-       *  memcpy is not possible.
-       *  If there was a flag on the nodesetval, indicating that
-       *  some temporary nodes are in, that would be helpful.
-       */
-       /*
-       * Optimization: Create an equally sized node-set
-       * and memcpy the content.
-       */
-       val1 = xmlXPathNodeSetCreateSize(val2->nodeNr);
-       if (val1 == NULL)
-           return(NULL);
-       if (val2->nodeNr != 0) {
-           if (val2->nodeNr == 1)
-               *(val1->nodeTab) = *(val2->nodeTab);
-           else {
-               memcpy(val1->nodeTab, val2->nodeTab,
-                   val2->nodeNr * sizeof(xmlNodePtr));
-           }
-           val1->nodeNr = val2->nodeNr;
-       }
-       return(val1);
-#endif
+        if (val1 == NULL)
+            return (NULL);
     }
 
     /* @@ with_ns to check whether namespace nodes should be looked at @@ */
@@ -3909,38 +3854,43 @@ xmlXPathNodeSetMerge(xmlNodeSetPtr val1, xmlNodeSetPtr val2) {
                                                    sizeof(xmlNodePtr));
            if (val1->nodeTab == NULL) {
                xmlXPathErrMemory(NULL, "merging nodeset\n");
-               return(NULL);
+               goto error;
            }
            memset(val1->nodeTab, 0 ,
-                  XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr));
+                  XML_NODESET_DEFAULT * sizeof(xmlNodePtr));
            val1->nodeMax = XML_NODESET_DEFAULT;
        } else if (val1->nodeNr == val1->nodeMax) {
            xmlNodePtr *temp;
 
             if (val1->nodeMax >= XPATH_MAX_NODESET_LENGTH) {
                 xmlXPathErrMemory(NULL, "merging nodeset hit limit\n");
-                return(NULL);
+                goto error;
             }
            temp = (xmlNodePtr *) xmlRealloc(val1->nodeTab, val1->nodeMax * 2 *
                                             sizeof(xmlNodePtr));
            if (temp == NULL) {
                xmlXPathErrMemory(NULL, "merging nodeset\n");
-               return(NULL);
+               goto error;
            }
            val1->nodeTab = temp;
            val1->nodeMax *= 2;
        }
        if (n2->type == XML_NAMESPACE_DECL) {
            xmlNsPtr ns = (xmlNsPtr) n2;
+            xmlNodePtr nsNode = xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns);
 
-            /* TODO: Check memory error. */
-           val1->nodeTab[val1->nodeNr++] =
-               xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns);
+            if (nsNode == NULL)
+                goto error;
+           val1->nodeTab[val1->nodeNr++] = nsNode;
        } else
            val1->nodeTab[val1->nodeNr++] = n2;
     }
 
     return(val1);
+
+error:
+    xmlXPathFreeNodeSet(val1);
+    return(NULL);
 }
 
 
@@ -3953,6 +3903,8 @@ xmlXPathNodeSetMerge(xmlNodeSetPtr val1, xmlNodeSetPtr val2) {
  * Checks for duplicate nodes. Clears set2.
  *
  * Returns @set1 once extended or NULL in case of error.
+ *
+ * Frees @set1 in case of error.
  */
 static xmlNodeSetPtr
 xmlXPathNodeSetMergeAndClear(xmlNodeSetPtr set1, xmlNodeSetPtr set2)
@@ -3981,7 +3933,6 @@ xmlXPathNodeSetMergeAndClear(xmlNodeSetPtr set1, xmlNodeSetPtr set2)
                        /*
                        * Free the namespace node.
                        */
-                       set2->nodeTab[i] = NULL;
                        xmlXPathNodeSetFreeNs((xmlNsPtr) n2);
                        goto skip_node;
                    }
@@ -3995,34 +3946,39 @@ xmlXPathNodeSetMergeAndClear(xmlNodeSetPtr set1, xmlNodeSetPtr set2)
                    XML_NODESET_DEFAULT * sizeof(xmlNodePtr));
                if (set1->nodeTab == NULL) {
                    xmlXPathErrMemory(NULL, "merging nodeset\n");
-                   return(NULL);
+                   goto error;
                }
                memset(set1->nodeTab, 0,
-                   XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr));
+                   XML_NODESET_DEFAULT * sizeof(xmlNodePtr));
                set1->nodeMax = XML_NODESET_DEFAULT;
            } else if (set1->nodeNr >= set1->nodeMax) {
                xmlNodePtr *temp;
 
                 if (set1->nodeMax >= XPATH_MAX_NODESET_LENGTH) {
                     xmlXPathErrMemory(NULL, "merging nodeset hit limit\n");
-                    return(NULL);
+                    goto error;
                 }
                temp = (xmlNodePtr *) xmlRealloc(
                    set1->nodeTab, set1->nodeMax * 2 * sizeof(xmlNodePtr));
                if (temp == NULL) {
                    xmlXPathErrMemory(NULL, "merging nodeset\n");
-                   return(NULL);
+                   goto error;
                }
                set1->nodeTab = temp;
                set1->nodeMax *= 2;
            }
            set1->nodeTab[set1->nodeNr++] = n2;
 skip_node:
-           {}
+            set2->nodeTab[i] = NULL;
        }
     }
     set2->nodeNr = 0;
     return(set1);
+
+error:
+    xmlXPathFreeNodeSet(set1);
+    xmlXPathNodeSetClear(set2, 1);
+    return(NULL);
 }
 
 /**
@@ -4034,6 +3990,8 @@ skip_node:
  * Doesn't check for duplicate nodes. Clears set2.
  *
  * Returns @set1 once extended or NULL in case of error.
+ *
+ * Frees @set1 in case of error.
  */
 static xmlNodeSetPtr
 xmlXPathNodeSetMergeAndClearNoDupls(xmlNodeSetPtr set1, xmlNodeSetPtr set2)
@@ -4049,32 +4007,38 @@ xmlXPathNodeSetMergeAndClearNoDupls(xmlNodeSetPtr set1, xmlNodeSetPtr set2)
                    XML_NODESET_DEFAULT * sizeof(xmlNodePtr));
                if (set1->nodeTab == NULL) {
                    xmlXPathErrMemory(NULL, "merging nodeset\n");
-                   return(NULL);
+                   goto error;
                }
                memset(set1->nodeTab, 0,
-                   XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr));
+                   XML_NODESET_DEFAULT * sizeof(xmlNodePtr));
                set1->nodeMax = XML_NODESET_DEFAULT;
            } else if (set1->nodeNr >= set1->nodeMax) {
                xmlNodePtr *temp;
 
                 if (set1->nodeMax >= XPATH_MAX_NODESET_LENGTH) {
                     xmlXPathErrMemory(NULL, "merging nodeset hit limit\n");
-                    return(NULL);
+                    goto error;
                 }
                temp = (xmlNodePtr *) xmlRealloc(
                    set1->nodeTab, set1->nodeMax * 2 * sizeof(xmlNodePtr));
                if (temp == NULL) {
                    xmlXPathErrMemory(NULL, "merging nodeset\n");
-                   return(NULL);
+                   goto error;
                }
                set1->nodeTab = temp;
                set1->nodeMax *= 2;
            }
            set1->nodeTab[set1->nodeNr++] = n2;
+            set2->nodeTab[i] = NULL;
        }
     }
     set2->nodeNr = 0;
     return(set1);
+
+error:
+    xmlXPathFreeNodeSet(set1);
+    xmlXPathNodeSetClear(set2, 1);
+    return(NULL);
 }
 
 /**
@@ -4311,7 +4275,7 @@ xmlXPathNewNodeSet(xmlNodePtr val) {
         xmlXPathErrMemory(NULL, "creating nodeset\n");
        return(NULL);
     }
-    memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+    memset(ret, 0 , sizeof(xmlXPathObject));
     ret->type = XPATH_NODESET;
     ret->boolval = 0;
     /* TODO: Check memory error. */
@@ -4341,7 +4305,7 @@ xmlXPathNewValueTree(xmlNodePtr val) {
         xmlXPathErrMemory(NULL, "creating result value tree\n");
        return(NULL);
     }
-    memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+    memset(ret, 0 , sizeof(xmlXPathObject));
     ret->type = XPATH_XSLT_TREE;
     ret->boolval = 1;
     ret->user = (void *) val;
@@ -4392,6 +4356,8 @@ xmlXPathNewNodeSetList(xmlNodeSetPtr val)
  * Wrap the Nodeset @val in a new xmlXPathObjectPtr
  *
  * Returns the newly created object.
+ *
+ * In case of error the node set is destroyed and NULL is returned.
  */
 xmlXPathObjectPtr
 xmlXPathWrapNodeSet(xmlNodeSetPtr val) {
@@ -4400,9 +4366,10 @@ xmlXPathWrapNodeSet(xmlNodeSetPtr val) {
     ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
     if (ret == NULL) {
         xmlXPathErrMemory(NULL, "creating node set object\n");
+        xmlXPathFreeNodeSet(val);
        return(NULL);
     }
-    memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+    memset(ret, 0 , sizeof(xmlXPathObject));
     ret->type = XPATH_NODESET;
     ret->nodesetval = val;
 #ifdef XP_DEBUG_OBJ_USAGE
@@ -4532,16 +4499,23 @@ xmlXPathDistinctSorted (xmlNodeSetPtr nodes) {
        cur = xmlXPathNodeSetItem(nodes, i);
        strval = xmlXPathCastNodeToString(cur);
        if (xmlHashLookup(hash, strval) == NULL) {
-           xmlHashAddEntry(hash, strval, strval);
-            /* TODO: Propagate memory error. */
+           if (xmlHashAddEntry(hash, strval, strval) < 0) {
+                xmlFree(strval);
+                goto error;
+            }
            if (xmlXPathNodeSetAddUnique(ret, cur) < 0)
-               break;
+               goto error;
        } else {
            xmlFree(strval);
        }
     }
     xmlHashFree(hash, xmlHashDefaultDeallocator);
     return(ret);
+
+error:
+    xmlHashFree(hash, xmlHashDefaultDeallocator);
+    xmlXPathFreeNodeSet(ret);
+    return(NULL);
 }
 
 /**
@@ -4854,7 +4828,7 @@ xmlXPathRegisterFuncNS(xmlXPathContextPtr ctxt, const xmlChar *name,
        return(-1);
     if (f == NULL)
         return(xmlHashRemoveEntry2(ctxt->funcHash, name, ns_uri, NULL));
-XML_IGNORE_PEDANTIC_WARNINGS
+XML_IGNORE_FPTR_CAST_WARNINGS
     return(xmlHashAddEntry2(ctxt->funcHash, name, ns_uri, (void *) f));
 XML_POP_WARNINGS
 }
@@ -4937,7 +4911,7 @@ xmlXPathFunctionLookupNS(xmlXPathContextPtr ctxt, const xmlChar *name,
     if (ctxt->funcHash == NULL)
        return(NULL);
 
-XML_IGNORE_PEDANTIC_WARNINGS
+XML_IGNORE_FPTR_CAST_WARNINGS
     ret = (xmlXPathFunction) xmlHashLookup2(ctxt->funcHash, name, ns_uri);
 XML_POP_WARNINGS
     return(ret);
@@ -5118,6 +5092,8 @@ xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt) {
 int
 xmlXPathRegisterNs(xmlXPathContextPtr ctxt, const xmlChar *prefix,
                           const xmlChar *ns_uri) {
+    xmlChar *copy;
+
     if (ctxt == NULL)
        return(-1);
     if (prefix == NULL)
@@ -5132,8 +5108,17 @@ xmlXPathRegisterNs(xmlXPathContextPtr ctxt, const xmlChar *prefix,
     if (ns_uri == NULL)
         return(xmlHashRemoveEntry(ctxt->nsHash, prefix,
                                  xmlHashDefaultDeallocator));
-    return(xmlHashUpdateEntry(ctxt->nsHash, prefix, (void *) xmlStrdup(ns_uri),
-                             xmlHashDefaultDeallocator));
+
+    copy = xmlStrdup(ns_uri);
+    if (copy == NULL)
+        return(-1);
+    if (xmlHashUpdateEntry(ctxt->nsHash, prefix, copy,
+                           xmlHashDefaultDeallocator) < 0) {
+        xmlFree(copy);
+        return(-1);
+    }
+
+    return(0);
 }
 
 /**
@@ -5211,7 +5196,7 @@ xmlXPathNewFloat(double val) {
         xmlXPathErrMemory(NULL, "creating float object\n");
        return(NULL);
     }
-    memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+    memset(ret, 0 , sizeof(xmlXPathObject));
     ret->type = XPATH_NUMBER;
     ret->floatval = val;
 #ifdef XP_DEBUG_OBJ_USAGE
@@ -5237,7 +5222,7 @@ xmlXPathNewBoolean(int val) {
         xmlXPathErrMemory(NULL, "creating boolean object\n");
        return(NULL);
     }
-    memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+    memset(ret, 0 , sizeof(xmlXPathObject));
     ret->type = XPATH_BOOLEAN;
     ret->boolval = (val != 0);
 #ifdef XP_DEBUG_OBJ_USAGE
@@ -5263,12 +5248,15 @@ xmlXPathNewString(const xmlChar *val) {
         xmlXPathErrMemory(NULL, "creating string object\n");
        return(NULL);
     }
-    memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+    memset(ret, 0 , sizeof(xmlXPathObject));
     ret->type = XPATH_STRING;
-    if (val != NULL)
-       ret->stringval = xmlStrdup(val);
-    else
-       ret->stringval = xmlStrdup((const xmlChar *)"");
+    if (val == NULL)
+        val = BAD_CAST "";
+    ret->stringval = xmlStrdup(val);
+    if (ret->stringval == NULL) {
+        xmlFree(ret);
+        return(NULL);
+    }
 #ifdef XP_DEBUG_OBJ_USAGE
     xmlXPathDebugObjUsageRequested(NULL, XPATH_STRING);
 #endif
@@ -5282,6 +5270,8 @@ xmlXPathNewString(const xmlChar *val) {
  * Wraps the @val string into an XPath object.
  *
  * Returns the newly created object.
+ *
+ * Frees @val in case of error.
  */
 xmlXPathObjectPtr
 xmlXPathWrapString (xmlChar *val) {
@@ -5290,9 +5280,10 @@ xmlXPathWrapString (xmlChar *val) {
     ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
     if (ret == NULL) {
         xmlXPathErrMemory(NULL, "creating string object\n");
+        xmlFree(val);
        return(NULL);
     }
-    memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+    memset(ret, 0 , sizeof(xmlXPathObject));
     ret->type = XPATH_STRING;
     ret->stringval = val;
 #ifdef XP_DEBUG_OBJ_USAGE
@@ -5311,20 +5302,7 @@ xmlXPathWrapString (xmlChar *val) {
  */
 xmlXPathObjectPtr
 xmlXPathNewCString(const char *val) {
-    xmlXPathObjectPtr ret;
-
-    ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
-    if (ret == NULL) {
-        xmlXPathErrMemory(NULL, "creating string object\n");
-       return(NULL);
-    }
-    memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
-    ret->type = XPATH_STRING;
-    ret->stringval = xmlStrdup(BAD_CAST val);
-#ifdef XP_DEBUG_OBJ_USAGE
-    xmlXPathDebugObjUsageRequested(NULL, XPATH_STRING);
-#endif
-    return(ret);
+    return(xmlXPathNewString(BAD_CAST val));
 }
 
 /**
@@ -5357,7 +5335,7 @@ xmlXPathWrapExternal (void *val) {
         xmlXPathErrMemory(NULL, "creating user object\n");
        return(NULL);
     }
-    memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+    memset(ret, 0 , sizeof(xmlXPathObject));
     ret->type = XPATH_USERS;
     ret->user = val;
 #ifdef XP_DEBUG_OBJ_USAGE
@@ -5386,7 +5364,7 @@ xmlXPathObjectCopy(xmlXPathObjectPtr val) {
         xmlXPathErrMemory(NULL, "copying object\n");
        return(NULL);
     }
-    memcpy(ret, val , (size_t) sizeof(xmlXPathObject));
+    memcpy(ret, val , sizeof(xmlXPathObject));
 #ifdef XP_DEBUG_OBJ_USAGE
     xmlXPathDebugObjUsageRequested(NULL, val->type);
 #endif
@@ -5400,6 +5378,10 @@ xmlXPathObjectCopy(xmlXPathObjectPtr val) {
            break;
        case XPATH_STRING:
            ret->stringval = xmlStrdup(val->stringval);
+            if (ret->stringval == NULL) {
+                xmlFree(ret);
+                return(NULL);
+            }
            break;
        case XPATH_XSLT_TREE:
 #if 0
@@ -6118,7 +6100,7 @@ xmlXPathNewContext(xmlDocPtr doc) {
         xmlXPathErrMemory(NULL, "creating context\n");
        return(NULL);
     }
-    memset(ret, 0 , (size_t) sizeof(xmlXPathContext));
+    memset(ret, 0 , sizeof(xmlXPathContext));
     ret->doc = doc;
     ret->node = NULL;
 
@@ -6226,7 +6208,7 @@ xmlXPathNewParserContext(const xmlChar *str, xmlXPathContextPtr ctxt) {
         xmlXPathErrMemory(ctxt, "creating parser context\n");
        return(NULL);
     }
-    memset(ret, 0 , (size_t) sizeof(xmlXPathParserContext));
+    memset(ret, 0 , sizeof(xmlXPathParserContext));
     ret->cur = ret->base = str;
     ret->context = ctxt;
 
@@ -6262,7 +6244,7 @@ xmlXPathCompParserContext(xmlXPathCompExprPtr comp, xmlXPathContextPtr ctxt) {
         xmlXPathErrMemory(ctxt, "creating evaluation context\n");
        return(NULL);
     }
-    memset(ret, 0 , (size_t) sizeof(xmlXPathParserContext));
+    memset(ret, 0 , sizeof(xmlXPathParserContext));
 
     /* Allocate the value stack */
     ret->valueTab = (xmlXPathObjectPtr *)
@@ -6275,7 +6257,6 @@ xmlXPathCompParserContext(xmlXPathCompExprPtr comp, xmlXPathContextPtr ctxt) {
     ret->valueNr = 0;
     ret->valueMax = 10;
     ret->value = NULL;
-    ret->valueFrame = 0;
 
     ret->context = ctxt;
     ret->comp = comp;
@@ -6360,16 +6341,14 @@ xmlXPathNodeValHash(xmlNodePtr node) {
                return(0);
            if (string[0] == 0)
                return(0);
-           return(((unsigned int) string[0]) +
-                  (((unsigned int) string[1]) << 8));
+           return(string[0] + (string[1] << 8));
        case XML_NAMESPACE_DECL:
            string = ((xmlNsPtr)node)->href;
            if (string == NULL)
                return(0);
            if (string[0] == 0)
                return(0);
-           return(((unsigned int) string[0]) +
-                  (((unsigned int) string[1]) << 8));
+           return(string[0] + (string[1] << 8));
        case XML_ATTRIBUTE_NODE:
            tmp = ((xmlAttrPtr) node)->children;
            break;
@@ -6391,14 +6370,13 @@ xmlXPathNodeValHash(xmlNodePtr node) {
        }
        if ((string != NULL) && (string[0] != 0)) {
            if (len == 1) {
-               return(ret + (((unsigned int) string[0]) << 8));
+               return(ret + (string[0] << 8));
            }
            if (string[1] == 0) {
                len = 1;
-               ret = (unsigned int) string[0];
+               ret = string[0];
            } else {
-               return(((unsigned int) string[0]) +
-                      (((unsigned int) string[1]) << 8));
+               return(string[0] + (string[1] << 8));
            }
        }
        /*
@@ -6447,11 +6425,10 @@ xmlXPathNodeValHash(xmlNodePtr node) {
 static unsigned int
 xmlXPathStringHash(const xmlChar * string) {
     if (string == NULL)
-       return((unsigned int) 0);
+       return(0);
     if (string[0] == 0)
        return(0);
-    return(((unsigned int) string[0]) +
-          (((unsigned int) string[1]) << 8));
+    return(string[0] + (string[1] << 8));
 }
 
 /**
@@ -6814,6 +6791,7 @@ xmlXPathEqualNodeSetFloat(xmlXPathParserContextPtr ctxt,
                valuePush(ctxt, xmlXPathCacheNewString(ctxt->context, str2));
                xmlFree(str2);
                xmlXPathNumberFunction(ctxt, 1);
+                CHECK_ERROR0;
                val = valuePop(ctxt);
                v = val->floatval;
                xmlXPathReleaseObject(ctxt->context, val);
@@ -7029,6 +7007,8 @@ xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt,
                    valuePush(ctxt, arg2);
                    xmlXPathNumberFunction(ctxt, 1);
                    arg2 = valuePop(ctxt);
+                    if (ctxt->error)
+                        break;
                     /* Falls through. */
                case XPATH_NUMBER:
                    /* Hand check NaN and Infinity equalities */
@@ -7094,6 +7074,8 @@ xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt,
                    valuePush(ctxt, arg1);
                    xmlXPathNumberFunction(ctxt, 1);
                    arg1 = valuePop(ctxt);
+                    if (ctxt->error)
+                        break;
                    /* Hand check NaN and Infinity equalities */
                    if (xmlXPathIsNaN(arg1->floatval) ||
                            xmlXPathIsNaN(arg2->floatval)) {
@@ -7393,21 +7375,13 @@ xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict) {
        xmlXPathNumberFunction(ctxt, 1);
        arg1 = valuePop(ctxt);
     }
-    if (arg1->type != XPATH_NUMBER) {
-       xmlXPathFreeObject(arg1);
-       xmlXPathFreeObject(arg2);
-       XP_ERROR0(XPATH_INVALID_OPERAND);
-    }
     if (arg2->type != XPATH_NUMBER) {
        valuePush(ctxt, arg2);
        xmlXPathNumberFunction(ctxt, 1);
        arg2 = valuePop(ctxt);
     }
-    if (arg2->type != XPATH_NUMBER) {
-       xmlXPathReleaseObject(ctxt->context, arg1);
-       xmlXPathReleaseObject(ctxt->context, arg2);
-       XP_ERROR0(XPATH_INVALID_OPERAND);
-    }
+    if (ctxt->error)
+        goto error;
     /*
      * Add tests for infinity and nan
      * => feedback on 3.4 for Inf and NaN
@@ -7457,6 +7431,7 @@ xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict) {
            }
        }
     }
+error:
     xmlXPathReleaseObject(ctxt->context, arg1);
     xmlXPathReleaseObject(ctxt->context, arg2);
     return(ret);
@@ -8842,9 +8817,8 @@ xmlXPathNameFunction(xmlXPathParserContextPtr ctxt, int nargs)
                                     NULL, 0);
                    if (fullname == cur->nodesetval->nodeTab[i]->name)
                        fullname = xmlStrdup(cur->nodesetval->nodeTab[i]->name);
-                   if (fullname == NULL) {
-                       XP_ERROR(XPATH_MEMORY_ERROR);
-                   }
+                   if (fullname == NULL)
+                        xmlXPathPErrMemory(ctxt, NULL);
                    valuePush(ctxt, xmlXPathCacheWrapString(
                        ctxt->context, fullname));
                 }
@@ -9196,7 +9170,7 @@ xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs) {
   if (target) {
     point = xmlStrstr(str->stringval, find->stringval);
     if (point) {
-      offset = (int)(point - str->stringval);
+      offset = point - str->stringval;
       xmlBufAdd(target, str->stringval, offset);
     }
     valuePush(ctxt, xmlXPathCacheNewString(ctxt->context,
@@ -9239,7 +9213,7 @@ xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs) {
   if (target) {
     point = xmlStrstr(str->stringval, find->stringval);
     if (point) {
-      offset = (int)(point - str->stringval) + xmlStrlen(find->stringval);
+      offset = point - str->stringval + xmlStrlen(find->stringval);
       xmlBufAdd(target, &str->stringval[offset],
                   xmlStrlen(str->stringval) - offset);
     }
@@ -9336,7 +9310,7 @@ xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs) {
     xmlXPathObjectPtr to;
     xmlBufPtr target;
     int offset, max;
-    xmlChar ch;
+    int ch;
     const xmlChar *point;
     xmlChar *cptr;
 
@@ -9742,7 +9716,7 @@ xmlXPathCurrentChar(xmlXPathParserContextPtr ctxt, int *len) {
     } else {
        /* 1-byte code */
        *len = 1;
-       return((int) *cur);
+       return(*cur);
     }
 encoding_error:
     /*
@@ -9924,7 +9898,7 @@ xmlXPathParseNameComplex(xmlXPathParserContextPtr ctxt, int qualified) {
             if (len > XML_MAX_NAME_LENGTH) {
                 XP_ERRORNULL(XPATH_EXPR_ERROR);
             }
-           buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar));
+           buffer = (xmlChar *) xmlMallocAtomic(max);
            if (buffer == NULL) {
                XP_ERRORNULL(XPATH_MEMORY_ERROR);
            }
@@ -9941,8 +9915,7 @@ xmlXPathParseNameComplex(xmlXPathParserContextPtr ctxt, int qualified) {
                         XP_ERRORNULL(XPATH_EXPR_ERROR);
                     }
                    max *= 2;
-                   tmp = (xmlChar *) xmlRealloc(buffer,
-                                                max * sizeof(xmlChar));
+                   tmp = (xmlChar *) xmlRealloc(buffer, max);
                    if (tmp == NULL) {
                         xmlFree(buffer);
                        XP_ERRORNULL(XPATH_MEMORY_ERROR);
@@ -9994,13 +9967,13 @@ xmlXPathStringEvalNumber(const xmlChar *str) {
 #endif
     if (cur == NULL) return(0);
     while (IS_BLANK_CH(*cur)) cur++;
-    if ((*cur != '.') && ((*cur < '0') || (*cur > '9')) && (*cur != '-')) {
-        return(xmlXPathNAN);
-    }
     if (*cur == '-') {
        isneg = 1;
        cur++;
     }
+    if ((*cur != '.') && ((*cur < '0') || (*cur > '9'))) {
+        return(xmlXPathNAN);
+    }
 
 #ifdef __GNUC__
     /*
@@ -10257,7 +10230,10 @@ xmlXPathCompLiteral(xmlXPathParserContextPtr ctxt) {
     } else {
        XP_ERROR(XPATH_START_LITERAL_ERROR);
     }
-    if (ret == NULL) return;
+    if (ret == NULL) {
+        xmlXPathPErrMemory(ctxt, NULL);
+        return;
+    }
     lit = xmlXPathCacheNewString(ctxt->context, ret);
     if (lit == NULL) {
        ctxt->error = XPATH_MEMORY_ERROR;
@@ -12862,6 +12838,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt,
 {
     int total = 0;
     xmlXPathCompExprPtr comp;
+    xmlXPathObjectPtr obj;
     xmlNodeSetPtr set;
 
     CHECK_ERROR0;
@@ -12929,13 +12906,20 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt,
     }
 #endif /* LIBXML_XPTR_LOCS_ENABLED */
 
+    /*
+     * In case of errors, xmlXPathNodeSetFilter can pop additional nodes from
+     * the stack. We have to temporarily remove the nodeset object from the
+     * stack to avoid freeing it prematurely.
+     */
     CHECK_TYPE0(XPATH_NODESET);
-    set = ctxt->value->nodesetval;
+    obj = valuePop(ctxt);
+    set = obj->nodesetval;
     if (set != NULL) {
         xmlXPathNodeSetFilter(ctxt, set, op->ch2, 1, 1, 1);
         if (set->nodeNr > 0)
             *first = set->nodeTab[0];
     }
+    valuePush(ctxt, obj);
 
     return (total);
 }
@@ -13152,20 +13136,17 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
                int i;
                 int frame;
 
-                frame = xmlXPathSetFrame(ctxt);
+                frame = ctxt->valueNr;
                 if (op->ch1 != -1) {
                     total +=
                         xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
-                    if (ctxt->error != XPATH_EXPRESSION_OK) {
-                        xmlXPathPopFrame(ctxt, frame);
+                    if (ctxt->error != XPATH_EXPRESSION_OK)
                         break;
-                    }
                 }
-               if (ctxt->valueNr < ctxt->valueFrame + op->value) {
+               if (ctxt->valueNr < frame + op->value) {
                    xmlGenericError(xmlGenericErrorContext,
                            "xmlXPathCompOpEval: parameter error\n");
                    ctxt->error = XPATH_INVALID_OPERAND;
-                    xmlXPathPopFrame(ctxt, frame);
                    break;
                }
                for (i = 0; i < op->value; i++) {
@@ -13173,7 +13154,6 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
                        xmlGenericError(xmlGenericErrorContext,
                                "xmlXPathCompOpEval: parameter error\n");
                        ctxt->error = XPATH_INVALID_OPERAND;
-                        xmlXPathPopFrame(ctxt, frame);
                        break;
                    }
                 }
@@ -13192,7 +13172,6 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
                             xmlGenericError(xmlGenericErrorContext,
             "xmlXPathCompOpEval: function %s bound to undefined prefix %s\n",
                                     (char *)op->value4, (char *)op->value5);
-                            xmlXPathPopFrame(ctxt, frame);
                             ctxt->error = XPATH_UNDEF_PREFIX_ERROR;
                             break;
                         }
@@ -13216,9 +13195,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
                 ctxt->context->function = oldFunc;
                 ctxt->context->functionURI = oldFuncURI;
                 if ((ctxt->error == XPATH_EXPRESSION_OK) &&
-                    (ctxt->valueNr != ctxt->valueFrame + 1))
+                    (ctxt->valueNr != frame + 1))
                     XP_ERROR0(XPATH_STACK_ERROR);
-                xmlXPathPopFrame(ctxt, frame);
                 break;
             }
         case XPATH_OP_ARG:
@@ -13233,6 +13211,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
             break;
         case XPATH_OP_PREDICATE:
         case XPATH_OP_FILTER:{
+                xmlXPathObjectPtr obj;
                 xmlNodeSetPtr set;
 
                 /*
@@ -13347,11 +13326,19 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
                 }
 #endif /* LIBXML_XPTR_LOCS_ENABLED */
 
+                /*
+                 * In case of errors, xmlXPathNodeSetFilter can pop additional
+                 * nodes from the stack. We have to temporarily remove the
+                 * nodeset object from the stack to avoid freeing it
+                 * prematurely.
+                 */
                 CHECK_TYPE0(XPATH_NODESET);
-                set = ctxt->value->nodesetval;
+                obj = valuePop(ctxt);
+                set = obj->nodesetval;
                 if (set != NULL)
                     xmlXPathNodeSetFilter(ctxt, set, op->ch2,
                                           1, set->nodeNr, 1);
+                valuePush(ctxt, obj);
                 break;
             }
         case XPATH_OP_SORT:
@@ -13645,8 +13632,6 @@ xmlXPathRunStreamEval(xmlXPathContextPtr ctxt, xmlPatternPtr comp,
     xmlNodePtr cur = NULL, limit = NULL;
     xmlStreamCtxtPtr patstream = NULL;
 
-    int nb_nodes = 0;
-
     if ((ctxt == NULL) || (comp == NULL))
         return(-1);
     max_depth = xmlPatternMaxDepth(comp);
@@ -13763,8 +13748,6 @@ next_node:
             ctxt->opCount++;
         }
 
-        nb_nodes++;
-
        switch (cur->type) {
            case XML_ELEMENT_NODE:
            case XML_TEXT_NODE:
@@ -13856,11 +13839,6 @@ scan_children:
 
 done:
 
-#if 0
-    printf("stream eval: checked %d nodes selected %d\n",
-           nb_nodes, retObj->nodesetval->nodeNr);
-#endif
-
     if (patstream)
        xmlFreeStreamCtxt(patstream);
     return(0);
@@ -13899,7 +13877,6 @@ xmlXPathRunEval(xmlXPathParserContextPtr ctxt, int toBool)
        ctxt->valueNr = 0;
        ctxt->valueMax = 10;
        ctxt->value = NULL;
-        ctxt->valueFrame = 0;
     }
 #ifdef XPATH_STREAMING
     if (ctxt->comp->stream) {
@@ -14114,6 +14091,7 @@ xmlXPathTryStreamCompile(xmlXPathContextPtr ctxt, const xmlChar *str) {
            comp = xmlXPathNewCompExpr();
            if (comp == NULL) {
                xmlXPathErrMemory(ctxt, "allocating streamable expression\n");
+               xmlFreePattern(stream);
                return(NULL);
            }
            comp->stream = stream;
@@ -14335,6 +14313,8 @@ xmlXPathCompiledEvalInternal(xmlXPathCompExprPtr comp,
     }
 #endif
     pctxt = xmlXPathCompParserContext(comp, ctxt);
+    if (pctxt == NULL)
+        return(-1);
     res = xmlXPathRunEval(pctxt, toBool);
 
     if (pctxt->error != XPATH_EXPRESSION_OK) {
index ba1e31e..d8c18d7 100644 (file)
@@ -52,6 +52,8 @@
 #endif
 #endif
 
+#include "private/error.h"
+
 #define TODO                                                           \
     xmlGenericError(xmlGenericErrorContext,                            \
            "Unimplemented block at %s:%d\n",                           \
@@ -266,7 +268,7 @@ xmlXPtrNewPoint(xmlNodePtr node, int indx) {
         xmlXPtrErrMemory("allocating point");
        return(NULL);
     }
-    memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+    memset(ret, 0 , sizeof(xmlXPathObject));
     ret->type = XPATH_POINT;
     ret->user = (void *) node;
     ret->index = indx;
@@ -586,7 +588,7 @@ xmlXPtrLocationSetCreate(xmlXPathObjectPtr val) {
         xmlXPtrErrMemory("allocating locationset");
        return(NULL);
     }
-    memset(ret, 0 , (size_t) sizeof(xmlLocationSet));
+    memset(ret, 0 , sizeof(xmlLocationSet));
     if (val != NULL) {
         ret->locTab = (xmlXPathObjectPtr *) xmlMalloc(XML_RANGESET_DEFAULT *
                                             sizeof(xmlXPathObjectPtr));
@@ -596,7 +598,7 @@ xmlXPtrLocationSetCreate(xmlXPathObjectPtr val) {
            return(NULL);
        }
        memset(ret->locTab, 0 ,
-              XML_RANGESET_DEFAULT * (size_t) sizeof(xmlXPathObjectPtr));
+              XML_RANGESET_DEFAULT * sizeof(xmlXPathObjectPtr));
         ret->locMax = XML_RANGESET_DEFAULT;
        ret->locTab[ret->locNr++] = val;
     }
@@ -638,7 +640,7 @@ xmlXPtrLocationSetAdd(xmlLocationSetPtr cur, xmlXPathObjectPtr val) {
            return;
        }
        memset(cur->locTab, 0 ,
-              XML_RANGESET_DEFAULT * (size_t) sizeof(xmlXPathObjectPtr));
+              XML_RANGESET_DEFAULT * sizeof(xmlXPathObjectPtr));
         cur->locMax = XML_RANGESET_DEFAULT;
     } else if (cur->locNr == cur->locMax) {
         xmlXPathObjectPtr *temp;
@@ -771,7 +773,7 @@ xmlXPtrNewLocationSetNodes(xmlNodePtr start, xmlNodePtr end) {
         xmlXPtrErrMemory("allocating locationset");
        return(NULL);
     }
-    memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+    memset(ret, 0 , sizeof(xmlXPathObject));
     ret->type = XPATH_LOCATIONSET;
     if (end == NULL)
        ret->user = xmlXPtrLocationSetCreate(xmlXPtrNewCollapsedRange(start));
@@ -798,7 +800,7 @@ xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set) {
         xmlXPtrErrMemory("allocating locationset");
        return(NULL);
     }
-    memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+    memset(ret, 0, sizeof(xmlXPathObject));
     ret->type = XPATH_LOCATIONSET;
     if (set != NULL) {
        int i;
@@ -834,7 +836,7 @@ xmlXPtrWrapLocationSet(xmlLocationSetPtr val) {
         xmlXPtrErrMemory("allocating locationset");
        return(NULL);
     }
-    memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
+    memset(ret, 0, sizeof(xmlXPathObject));
     ret->type = XPATH_LOCATIONSET;
     ret->user = (void *) val;
     return(ret);
@@ -967,7 +969,7 @@ xmlXPtrEvalXPtrPart(xmlXPathParserContextPtr ctxt, xmlChar *name) {
 
     len = xmlStrlen(ctxt->cur);
     len++;
-    buffer = (xmlChar *) xmlMallocAtomic(len * sizeof (xmlChar));
+    buffer = (xmlChar *) xmlMallocAtomic(len);
     if (buffer == NULL) {
         xmlXPtrErrMemory("allocating buffer");
         xmlFree(name);
index 921820b..138d6e0 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 import sys, os
 import libxml2
@@ -11,7 +11,7 @@ mainXSD = str()
 signature = str()
 dictXSD = dict()
 
-def gatherFiles():     
+def gatherFiles():
     for file in filenames:
         if (file[-5] in ["a", "b", "c"]) and (file[-3:] == 'xsd'):
             # newfilename = string.replace(filename, ' ', '_')
@@ -26,74 +26,74 @@ def gatherFiles():
 
 def debugMsg(text):
     #pass
-    print "DEBUG:", text
-    
-    
-def fixup():      
+    print("DEBUG:", text)
+
+
+def fixup():
     for mainXSD in dictXSD:
-        debugMsg("fixing '%s'..." % mainXSD)   
-       schemaDoc = None
-       xpmainCtx = None        
+        debugMsg("fixing '%s'..." % mainXSD)
+        schemaDoc = None
+        xpmainCtx = None
         # Load the schema document.
         schemaFile = os.path.join(baseDir, mainXSD)
         schemaDoc = libxml2.parseFile(schemaFile)
-       if (schemaDoc is None):
-           print "ERROR: doc '%s' not found" % mainXSD
+        if (schemaDoc is None):
+            print("ERROR: doc '%s' not found" % mainXSD)
             sys.exit(1)
-       try:    
-           xpmainCtx = schemaDoc.xpathNewContext()
-            xpmainCtx.xpathRegisterNs("xs", "http://www.w3.org/2001/XMLSchema");               
+        try:
+            xpmainCtx = schemaDoc.xpathNewContext()
+            xpmainCtx.xpathRegisterNs("xs", "http://www.w3.org/2001/XMLSchema")
             xpres = xpmainCtx.xpathEval("/xs:schema")
             if len(xpres) == 0:
-                print "ERROR: doc '%s' has no <schema> element" % mainXSD
+                print("ERROR: doc '%s' has no <schema> element" % mainXSD)
                 sys.exit(1)
-           schemaElem = xpres[0]  
-           schemaNs = schemaElem.ns()
-           # Select all <import>s.
-           xpres = xpmainCtx.xpathEval("/xs:schema/xs:import") 
-           if len(xpres) != 0:
-               for elem in xpres:
-                   loc = elem.noNsProp("schemaLocation")
-                   if (loc is not None):
-                       debugMsg("  imports '%s'" % loc)
-                       if loc in dictXSD[mainXSD]:
-                           dictXSD[mainXSD].remove(loc)                        
-           for loc in dictXSD[mainXSD]:            
-               # Read out the targetNamespace.
-               impTargetNs = None
-               impFile = os.path.join(baseDir, loc)
-               impDoc = libxml2.parseFile(impFile)
-               try:
+            schemaElem = xpres[0]
+            schemaNs = schemaElem.ns()
+            # Select all <import>s.
+            xpres = xpmainCtx.xpathEval("/xs:schema/xs:import")
+            if len(xpres) != 0:
+                for elem in xpres:
+                    loc = elem.noNsProp("schemaLocation")
+                    if (loc is not None):
+                        debugMsg("  imports '%s'" % loc)
+                        if loc in dictXSD[mainXSD]:
+                            dictXSD[mainXSD].remove(loc)
+            for loc in dictXSD[mainXSD]:
+                # Read out the targetNamespace.
+                impTargetNs = None
+                impFile = os.path.join(baseDir, loc)
+                impDoc = libxml2.parseFile(impFile)
+                try:
                     xpimpCtx = impDoc.xpathNewContext()
-                   try:
+                    try:
                         xpimpCtx.setContextDoc(impDoc)
-                       xpimpCtx.xpathRegisterNs("xs", "http://www.w3.org/2001/XMLSchema");  
-                       xpres = xpimpCtx.xpathEval("/xs:schema")
-                       impTargetNs = xpres[0].noNsProp("targetNamespace")
-                   finally:
+                        xpimpCtx.xpathRegisterNs("xs", "http://www.w3.org/2001/XMLSchema")
+                        xpres = xpimpCtx.xpathEval("/xs:schema")
+                        impTargetNs = xpres[0].noNsProp("targetNamespace")
+                    finally:
                         xpimpCtx.xpathFreeContext()
-               finally:
+                finally:
                     impDoc.freeDoc()
-                       
-               # Add the <import>.
-               debugMsg("  adding <import namespace='%s' schemaLocation='%s'/>" % (impTargetNs, loc))
-               newElem = schemaDoc.newDocNode(schemaNs, "import", None)
-               if (impTargetNs is not None):
+
+                # Add the <import>.
+                debugMsg("  adding <import namespace='%s' schemaLocation='%s'/>" % (impTargetNs, loc))
+                newElem = schemaDoc.newDocNode(schemaNs, "import", None)
+                if (impTargetNs is not None):
                     newElem.newProp("namespace", impTargetNs)
-               newElem.newProp("schemaLocation", loc)
-               if schemaElem.children is not None:
+                newElem.newProp("schemaLocation", loc)
+                if schemaElem.children is not None:
                     schemaElem.children.addPrevSibling(newElem)
                 schemaDoc.saveFile(schemaFile)
-       finally:
+        finally:
             xpmainCtx.xpathFreeContext()
             schemaDoc.freeDoc()
-           
+
 try:
     gatherFiles()
     fixup()
 finally:
     libxml2.cleanupParser()
     if libxml2.debugMemory(1) != 0:
-        print "Memory leak %d bytes" % (libxml2.debugMemory(1))
+        print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
         libxml2.dumpMemory()
 
index 7b119bd..cf4a8a1 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 #
 # This is the MS subset of the W3C test suite for XML Schemas.
diff --git a/xzlib.c b/xzlib.c
index c13e17d..5470c4e 100644 (file)
--- a/xzlib.c
+++ b/xzlib.c
@@ -14,9 +14,6 @@
 #include <stdlib.h>
 #include <errno.h>
 
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
@@ -25,6 +22,8 @@
 #endif
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#elif defined (_WIN32)
+#include <io.h>
 #endif
 #ifdef LIBXML_ZLIB_ENABLED
 #include <zlib.h>
@@ -33,7 +32,7 @@
 #include <lzma.h>
 #endif
 
-#include "xzlib.h"
+#include "private/xzlib.h"
 #include <libxml/xmlmemory.h>
 
 /* values for xz_state how */
@@ -134,6 +133,7 @@ static xzFile
 xz_open(const char *path, int fd, const char *mode ATTRIBUTE_UNUSED)
 {
     xz_statep state;
+    off_t offset;
 
     /* allocate xzFile structure to return */
     state = xmlMalloc(sizeof(xz_state));
@@ -168,9 +168,11 @@ xz_open(const char *path, int fd, const char *mode ATTRIBUTE_UNUSED)
     }
 
     /* save the current position for rewinding (only if reading) */
-    state->start = lseek(state->fd, 0, SEEK_CUR);
-    if (state->start == (uint64_t) - 1)
+    offset = lseek(state->fd, 0, SEEK_CUR);
+    if (offset == -1)
         state->start = 0;
+    else
+        state->start = offset;
 
     /* initialize stream */
     xz_reset(state);
diff --git a/xzlib.h b/xzlib.h
deleted file mode 100644 (file)
index 7b1df15..0000000
--- a/xzlib.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * xzlib.h: header for the front end for the transparent support of lzma
- *          compression at the I/O layer
- *
- * See Copyright for the status of this software.
- *
- * Anders F Bjorklund <afb@users.sourceforge.net>
- */
-
-#ifndef LIBXML2_XZLIB_H
-#define LIBXML2_XZLIB_H
-typedef void *xzFile;           /* opaque lzma file descriptor */
-
-xzFile __libxml2_xzopen(const char *path, const char *mode);
-xzFile __libxml2_xzdopen(int fd, const char *mode);
-int __libxml2_xzread(xzFile file, void *buf, unsigned len);
-int __libxml2_xzclose(xzFile file);
-int __libxml2_xzcompressed(xzFile f);
-#endif /* LIBXML2_XZLIB_H */