aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog18
-rw-r--r--Makefile.am280
-rw-r--r--configure.in2
-rw-r--r--doc/libxml2-api.xml137
-rw-r--r--error.c466
-rw-r--r--globals.c14
-rw-r--r--include/libxml/globals.h13
-rw-r--r--include/libxml/parser.h8
-rw-r--r--include/libxml/parserInternals.h2
-rw-r--r--include/libxml/xmlerror.h104
-rw-r--r--parser.c107
-rw-r--r--parserInternals.c13
-rw-r--r--python/libxml2class.txt3
-rw-r--r--result/VC/PENesting4
-rw-r--r--result/VC/PENesting24
-rw-r--r--result/ent7.sax1
-rw-r--r--result/namespaces/err_1.xml.err2
-rw-r--r--result/namespaces/err_10.xml.err2
-rw-r--r--result/namespaces/err_11.xml.err2
-rw-r--r--result/namespaces/err_2.xml.err2
-rw-r--r--result/namespaces/err_3.xml.err2
-rw-r--r--result/namespaces/err_4.xml.err2
-rw-r--r--result/namespaces/err_5.xml.err2
-rw-r--r--result/namespaces/err_6.xml.err2
-rw-r--r--result/namespaces/err_7.xml.err2
-rw-r--r--result/namespaces/err_8.xml.err2
-rw-r--r--result/namespaces/err_9.xml.err2
-rw-r--r--result/valid/t4.dtd.err4
-rw-r--r--result/valid/t4a.dtd.err4
-rw-r--r--result/valid/t6.dtd.err4
-rw-r--r--result/valid/t8.xml.err7
-rw-r--r--result/valid/t8a.xml.err7
-rw-r--r--result/xml2.sax1
-rw-r--r--valid.c285
34 files changed, 1010 insertions, 500 deletions
diff --git a/ChangeLog b/ChangeLog
index 73abf868..ca032f60 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+Fri Oct 3 00:19:02 CEST 2003 Daniel Veillard <daniel@veillard.com>
+
+ * Makefile.am: changed 'make tests' to use a concise output,
+ scrolling to see where thing broke wasn't pleasant
+ * configure.in: some beta4 preparation, but not ready yet
+ * error.c globals.c include/libxml/globals.h include/libxml/xmlerror.h:
+ new error handling code, last error informations are stored
+ in the parsing context or a global variable, new APIs to
+ handle the xmlErrorPtr type.
+ * parser.c parserInternals.c valid.c : started migrating to the
+ new error handling code, it's a royal pain.
+ * include/libxml/parser.h include/libxml/parserInternals.h:
+ moved the definition of xmlNewParserCtxt()
+ * parser.c: small potential buffer access problem in push code
+ provided by Justin Fletcher
+ * result/*.sax result/VC/PENesting* result/namespaces/*
+ result/valid/*.err: some error messages were sligthly changed.
+
Thu Oct 2 13:01:13 2003 Aleksey Sanin <aleksey@aleksey.com>
* include/libxml/parser.h parser.c: introduced xmlStrPrintf
diff --git a/Makefile.am b/Makefile.am
index 0f60478f..134cfd1b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -132,9 +132,7 @@ valgrind:
HTMLtests : testHTML$(EXEEXT)
@(echo > .memdump)
- @echo "##"
@echo "## HTML regression tests"
- @echo "##"
-@(for i in $(srcdir)/test/HTML/* ; do \
name=`basename $$i`; \
if [ ! -d $$i ] ; then \
@@ -142,20 +140,18 @@ HTMLtests : testHTML$(EXEEXT)
echo New test file $$name ; \
$(CHECKER) $(top_builddir)/testHTML $$i > $(srcdir)/result/HTML/$$name 2>$(srcdir)/result/HTML/$$name.err ; \
else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/testHTML $$i > result.$$name 2> error.$$name ; \
+ log=`$(CHECKER) $(top_builddir)/testHTML $$i > result.$$name 2> error.$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
diff $(srcdir)/result/HTML/$$name result.$$name ; \
diff -b $(srcdir)/result/HTML/$$name.err error.$$name ; \
$(CHECKER) $(top_builddir)/testHTML result.$$name > result2.$$name 2>error.$$name ; \
- diff result.$$name result2.$$name ; \
+ diff result.$$name result2.$$name` ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
rm result.$$name result2.$$name error.$$name ; \
fi ; fi ; done)
HTMLPushtests : testHTML$(EXEEXT)
- @echo "##"
@echo "## Push HTML regression tests"
- @echo "##"
-@(for i in $(srcdir)/test/HTML/* ; do \
name=`basename $$i`; \
if [ ! -d $$i ] ; then \
@@ -163,20 +159,18 @@ HTMLPushtests : testHTML$(EXEEXT)
echo New test file $$name ; \
$(CHECKER) $(top_builddir)/testHTML $$i > $(srcdir)/result/HTML/$$name 2>$(srcdir)/result/HTML/$$name.err ; \
else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/testHTML --push $$i > result.$$name 2> error.$$name ; \
+ log=`$(CHECKER) $(top_builddir)/testHTML --push $$i > result.$$name 2> error.$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
diff $(srcdir)/result/HTML/$$name result.$$name ; \
cut -b 1-15 $(srcdir)/result/HTML/$$name.err > errorcut.$$name; \
cut -b 1-15 error.$$name > errorcut2.$$name; \
diff -b errorcut.$$name errorcut2.$$name ; \
$(CHECKER) $(top_builddir)/testHTML --push result.$$name > result2.$$name 2>error.$$name ; \
- diff result.$$name result2.$$name ; \
+ diff result.$$name result2.$$name` ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
rm result.$$name result2.$$name error.$$name errorcut.$$name errorcut2.$$name ; \
fi ; fi ; done)
- @echo "##"
@echo "## HTML SAX regression tests"
- @echo "##"
-@(for i in $(srcdir)/test/HTML/* ; do \
name=`basename $$i`; \
if [ ! -d $$i ] ; then \
@@ -184,10 +178,10 @@ HTMLPushtests : testHTML$(EXEEXT)
echo New test file $$name ; \
$(CHECKER) $(top_builddir)/testHTML --sax $$i > $(srcdir)/result/HTML/$$name.sax ; \
else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/testHTML --sax $$i > result.$$name.sax ; \
+ log=`$(CHECKER) $(top_builddir)/testHTML --sax $$i > result.$$name.sax ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/HTML/$$name.sax result.$$name.sax ; \
+ diff $(srcdir)/result/HTML/$$name.sax result.$$name.sax` ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
rm result.$$name.sax ; \
fi ; fi ; done)
@echo "##"
@@ -200,21 +194,16 @@ HTMLPushtests : testHTML$(EXEEXT)
echo New test file $$name ; \
$(CHECKER) $(top_builddir)/testHTML --sax $$i > $(srcdir)/result/HTML/$$name.sax ; \
else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/testHTML --push --sax $$i > result.$$name.sax ; \
+ log=`$(CHECKER) $(top_builddir)/testHTML --push --sax $$i 2>&1 > result.$$name.sax ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/HTML/$$name.sax result.$$name.sax ; \
+ diff $(srcdir)/result/HTML/$$name.sax result.$$name.sax` ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
rm result.$$name.sax ; \
fi ; fi ; done)
-
XMLtests : xmllint$(EXEEXT)
@(echo > .memdump)
- @echo "##"
@echo "## XML regression tests"
- @echo "##"
- @echo "## You should see one warning on entity 'title.xml' for ent2"
- @echo "##"
-@(for i in $(srcdir)/test/* ; do \
name=`basename $$i`; \
if [ ! -d $$i ] ; then \
@@ -223,20 +212,16 @@ XMLtests : xmllint$(EXEEXT)
$(CHECKER) $(top_builddir)/xmllint $$i > $(srcdir)/result/$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/xmllint $$i > result.$$name ; \
+ log=`$(CHECKER) $(top_builddir)/xmllint $$i 2>&1 > result.$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
diff $(srcdir)/result/$$name result.$$name ; \
- $(CHECKER) $(top_builddir)/xmllint result.$$name > result2.$$name ; \
+ $(CHECKER) $(top_builddir)/xmllint result.$$name 2>&1 > result2.$$name | grep -v 'failed to load external entity' ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- diff result.$$name result2.$$name ; \
+ diff result.$$name result2.$$name` ;\
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
rm result.$$name result2.$$name ; \
fi ; fi ; done)
- @echo "##"
@echo "## XML regression tests on memory"
- @echo "##"
- @echo "## You should see two warnings on entity 'title.xml' for ent2"
- @echo "##"
-@(for i in $(srcdir)/test/* ; do \
name=`basename $$i`; \
if [ ! -d $$i ] ; then \
@@ -245,23 +230,19 @@ XMLtests : xmllint$(EXEEXT)
$(CHECKER) $(top_builddir)/xmllint --memory $$i > $(srcdir)/result/$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --memory $$i > result.$$name ; \
+ log=`$(CHECKER) $(top_builddir)/xmllint --memory $$i 2>&1 > result.$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
diff $(srcdir)/result/$$name result.$$name ; \
- $(CHECKER) $(top_builddir)/xmllint --memory result.$$name > result2.$$name ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
+ $(CHECKER) $(top_builddir)/xmllint --memory result.$$name 2>&1 > result2.$$name | grep -v 'failed to load external entity' ; \
+ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"`; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
diff result.$$name result2.$$name ; \
rm result.$$name result2.$$name ; \
fi ; fi ; done)
XMLPushtests: xmllint$(EXEEXT)
@(echo > .memdump)
- @echo "##"
@echo "## XML push regression tests"
- @echo "##"
- @echo "## You should see one warning on entity 'title.xml' for ent2"
- @echo "##"
-@(for i in $(srcdir)/test/* ; do \
name=`basename $$i`; \
if [ ! -d $$i ] ; then \
@@ -270,21 +251,19 @@ XMLPushtests: xmllint$(EXEEXT)
$(CHECKER) $(top_builddir)/xmllint --push $$i > $(srcdir)/result/$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --push $$i > result.$$name ; \
+ log=`$(CHECKER) $(top_builddir)/xmllint --push $$i 2>&1 > result.$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
diff $(srcdir)/result/$$name result.$$name ; \
- $(CHECKER) $(top_builddir)/xmllint --push result.$$name > result2.$$name ; \
+ $(CHECKER) $(top_builddir)/xmllint --push result.$$name 2>&1 > result2.$$name | grep -v 'failed to load external entity' ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- diff result.$$name result2.$$name ; \
+ diff result.$$name result2.$$name` ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
rm result.$$name result2.$$name ; \
fi ; fi ; done)
NStests : xmllint$(EXEEXT)
@(echo > .memdump)
- @echo "##"
@echo "## XML Namespaces regression tests"
- @echo "##"
-@(for i in $(srcdir)/test/namespaces/* ; do \
name=`basename $$i`; \
if [ ! -d $$i ] ; then \
@@ -295,39 +274,19 @@ NStests : xmllint$(EXEEXT)
> $(srcdir)/result/namespaces/$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/xmllint $$i 2> error.$$name > result.$$name ; \
+ log=`$(CHECKER) $(top_builddir)/xmllint $$i 2> error.$$name > result.$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
diff $(srcdir)/result/namespaces/$$name result.$$name ; \
- diff $(srcdir)/result/namespaces/$$name.err error.$$name ; \
+ diff $(srcdir)/result/namespaces/$$name.err error.$$name` ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
rm result.$$name error.$$name ; \
fi ; fi ; done)
Docbtests : xmllint$(EXEEXT)
- @(echo > .memdump)
- @echo "##"
- @echo "## SGML DocBook regression tests"
- @echo "##"
- -@(for i in $(srcdir)/test/DocBook/*.sgm ; do \
- name=`basename $$i .sgm`; \
- if [ ! -d $$i ] ; then \
- if [ ! -f $(srcdir)/result/DocBook/$$name.xml ] ; then \
- echo New test file $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --sgml $$i > $(srcdir)/result/DocBook/$$name.xml ; \
- $(CHECKER) $(top_builddir)/xmllint --valid --noout $(srcdir)/result/DocBook/$$name.xml ; \
- else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --sgml $$i > result.$$name ; \
- diff $(srcdir)/result/DocBook/$$name.xml result.$$name ; \
- $(CHECKER) $(top_builddir)/xmllint --valid --noout result.$$name ; \
- rm result.$$name ; \
- fi ; fi ; done)
XMLenttests : xmllint$(EXEEXT)
@(echo > .memdump)
- @echo "##"
@echo "## XML entity subst regression tests"
- @echo "##"
-@(for i in $(srcdir)/test/* ; do \
name=`basename $$i`; \
if [ ! -d $$i ] ; then \
@@ -336,21 +295,19 @@ XMLenttests : xmllint$(EXEEXT)
$(CHECKER) $(top_builddir)/xmllint --noent $$i > $(srcdir)/result/noent/$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --noent $$i > result.$$name ; \
+ log=`$(CHECKER) $(top_builddir)/xmllint --noent $$i 2>&1 > result.$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
diff $(srcdir)/result/noent/$$name result.$$name ; \
- $(CHECKER) $(top_builddir)/xmllint --noent result.$$name > result2.$$name ; \
+ $(CHECKER) $(top_builddir)/xmllint --noent result.$$name 2>&1 > result2.$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
- diff result.$$name result2.$$name ; \
+ diff result.$$name result2.$$name` ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
rm result.$$name result2.$$name ; \
fi ; fi ; done)
URItests : testURI$(EXEEXT)
@(echo > .memdump)
- @echo "##"
@echo "## URI module regression tests"
- @echo "##"
-@(for i in $(srcdir)/test/URI/*.data ; do \
name=`basename $$i`; \
if [ ! -d $$i ] ; then \
@@ -359,10 +316,10 @@ URItests : testURI$(EXEEXT)
$(CHECKER) $(top_builddir)/testURI -base 'http://foo.com/path/to/index.html?orig#help' < $$i > $(srcdir)/result/URI/$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/testURI -base 'http://foo.com/path/to/index.html?orig#help' < $$i > result.$$name ; \
+ log=`$(CHECKER) $(top_builddir)/testURI -base 'http://foo.com/path/to/index.html?orig#help' < $$i 2>&1 > result.$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/URI/$$name result.$$name ; \
+ diff $(srcdir)/result/URI/$$name result.$$name` ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
rm result.$$name ; \
fi ; fi ; done)
-@(for i in $(srcdir)/test/URI/*.uri ; do \
@@ -373,18 +330,16 @@ URItests : testURI$(EXEEXT)
$(CHECKER) $(top_builddir)/testURI < $$i > $(srcdir)/result/URI/$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/testURI < $$i > result.$$name ; \
+ log=`$(CHECKER) $(top_builddir)/testURI < $$i 2>&1 > result.$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/URI/$$name result.$$name ; \
+ diff $(srcdir)/result/URI/$$name result.$$name` ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
rm result.$$name ; \
fi ; fi ; done)
XPathtests : testXPath$(EXEEXT)
@(echo > .memdump)
- @echo "##"
@echo "## XPath regression tests"
- @echo "##"
-@(if [ "`$(top_builddir)/testXPath | grep 'support not compiled in'`" != "" ] ; \
then echo Skipping debug not compiled in ; exit 0 ; fi ; \
for i in $(srcdir)/test/XPath/expr/* ; do \
@@ -395,10 +350,10 @@ XPathtests : testXPath$(EXEEXT)
$(CHECKER) $(top_builddir)/testXPath -f --expr $$i > $(srcdir)/result/XPath/expr/$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/testXPath -f --expr $$i > result.$$name ; \
+ log=`$(CHECKER) $(top_builddir)/testXPath -f --expr $$i 2>&1 > result.$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/XPath/expr/$$name result.$$name ; \
+ diff $(srcdir)/result/XPath/expr/$$name result.$$name` ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
rm result.$$name ; \
fi ; fi ; done ; \
for i in $(srcdir)/test/XPath/docs/* ; do \
@@ -413,18 +368,16 @@ XPathtests : testXPath$(EXEEXT)
$(CHECKER) $(top_builddir)/testXPath -f -i $$i $$j > $(srcdir)/result/XPath/tests/$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/testXPath -f -i $$i $$j > result.$$name ; \
+ log=`$(CHECKER) $(top_builddir)/testXPath -f -i $$i $$j 2>&1 > result.$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/XPath/tests/$$name result.$$name ; \
+ diff $(srcdir)/result/XPath/tests/$$name result.$$name` ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
rm result.$$name ; \
fi ; fi ; done ; fi ; done)
XPtrtests : testXPath$(EXEEXT)
@(echo > .memdump)
- @echo "##"
@echo "## XPointer regression tests"
- @echo "##"
-@(if [ "`$(top_builddir)/testXPath | grep 'support not compiled in'`" != "" ] ; \
then echo Skipping debug not compiled in ; exit 0 ; fi ; \
for i in $(srcdir)/test/XPath/docs/* ; do \
@@ -439,20 +392,17 @@ XPtrtests : testXPath$(EXEEXT)
$(CHECKER) $(top_builddir)/testXPath -xptr -f -i $$i $$j > $(srcdir)/result/XPath/xptr/$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/testXPath -xptr -f -i $$i $$j > result.$$name ; \
+ log=`$(CHECKER) $(top_builddir)/testXPath -xptr -f -i $$i $$j 2>&1 > result.$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/XPath/xptr/$$name result.$$name ; \
+ diff $(srcdir)/result/XPath/xptr/$$name result.$$name` ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
rm result.$$name ; \
fi ; fi ; done ; fi ; done)
XIncludetests : xmllint$(EXEEXT)
@(echo > .memdump)
- @echo "##"
@echo "## XInclude regression tests"
- @echo "##"
@echo "## the warning reported on fallback.xml test is expected"
- @echo "##"
-@(for i in $(srcdir)/test/XInclude/docs/* ; do \
name=`basename $$i`; \
if [ ! -d $$i ] ; then \
@@ -461,19 +411,17 @@ XIncludetests : xmllint$(EXEEXT)
$(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude $$i > $(srcdir)/result/XInclude/$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude $$i > result.$$name ; \
+ log=`$(CHECKER) $(top_builddir)/xmllint --nowarning --xinclude $$i 2>&1 > result.$$name | grep -v 'failed to load external entity' ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/XInclude/$$name result.$$name ; \
+ diff $(srcdir)/result/XInclude/$$name result.$$name` ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
rm result.$$name ; \
fi ; fi ; done)
Scripttests : xmllint$(EXEEXT)
@(echo > .memdump)
- @echo "##"
@echo "## Scripts regression tests"
@echo "## Some of the base computations may be different if srcdir != ."
- @echo "##"
-@(for i in $(srcdir)/test/scripts/*.script ; do \
name=`basename $$i .script`; \
xml=$(srcdir)/test/scripts/`basename $$i .script`.xml; \
@@ -483,18 +431,16 @@ Scripttests : xmllint$(EXEEXT)
$(CHECKER) $(top_builddir)/xmllint --shell $$xml < $$i > $(srcdir)/result/scripts/$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --shell $$xml < $$i > result.$$name ; \
+ log=`$(CHECKER) $(top_builddir)/xmllint --shell $$xml < $$i 2>&1 > result.$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/scripts/$$name result.$$name ; \
+ diff $(srcdir)/result/scripts/$$name result.$$name` ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
rm result.$$name ; \
fi ; fi ; done)
Catatests : xmlcatalog$(EXEEXT)
@(echo > .memdump)
- @echo "##"
@echo "## Catalog regression tests"
- @echo "##"
-@(for i in $(srcdir)/test/catalogs/*.script ; do \
name=`basename $$i .script`; \
xml=$(srcdir)/test/catalogs/`basename $$i .script`.xml; \
@@ -504,10 +450,10 @@ Catatests : xmlcatalog$(EXEEXT)
$(CHECKER) $(top_builddir)/xmlcatalog --shell $$xml < $$i > $(srcdir)/result/catalogs/$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/xmlcatalog --shell $$xml < $$i > result.$$name ; \
+ log=`$(CHECKER) $(top_builddir)/xmlcatalog --shell $$xml < $$i 2>&1 > result.$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/catalogs/$$name result.$$name ; \
+ diff $(srcdir)/result/catalogs/$$name result.$$name` ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
rm result.$$name ; \
fi ; fi ; done)
-@(for i in $(srcdir)/test/catalogs/*.script ; do \
@@ -519,13 +465,13 @@ Catatests : xmlcatalog$(EXEEXT)
$(CHECKER) $(top_builddir)/xmlcatalog --shell $$sgml < $$i > $(srcdir)/result/catalogs/$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/xmlcatalog --shell $$sgml < $$i > result.$$name ; \
+ log=`$(CHECKER) $(top_builddir)/xmlcatalog --shell $$sgml < $$i > result.$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/catalogs/$$name result.$$name ; \
+ diff $(srcdir)/result/catalogs/$$name result.$$name` ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
rm result.$$name ; \
fi ; fi ; done)
- @echo "Add and del operations on XML Catalogs"
+ @echo "## Add and del operations on XML Catalogs"
-@($(CHECKER) $(top_builddir)/xmlcatalog --create --noout $(srcdir)/result/catalogs/mycatalog; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"; \
$(CHECKER) $(top_builddir)/xmlcatalog --noout --add public Pubid sysid $(srcdir)/result/catalogs/mycatalog; \
@@ -547,9 +493,7 @@ Catatests : xmlcatalog$(EXEEXT)
rm -f $(srcdir)/result/catalogs/mycatalog)
SVGtests : xmllint$(EXEEXT)
- @echo "##"
@echo "## SVG parsing regression tests"
- @echo "##"
-@(for i in $(srcdir)/test/SVG/* ; do \
name=`basename $$i`; \
if [ ! -d $$i ] ; then \
@@ -569,17 +513,13 @@ SVGtests : xmllint$(EXEEXT)
fi ; fi ; done)
Threadtests : testThreads$(EXEEXT)
- @echo "##"
@echo "## Threaded regression tests"
- @echo "##"
-($(CHECKER) $(top_builddir)/testThreads ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";)
Readertests : xmllint$(EXEEXT)
@(echo > .memdump)
- @echo "##"
@echo "## Reader regression tests"
- @echo "##"
-@(for i in $(srcdir)/test/* ; do \
name=`basename $$i`; \
if [ ! -d $$i ] ; then \
@@ -588,15 +528,13 @@ Readertests : xmllint$(EXEEXT)
$(CHECKER) $(top_builddir)/xmllint --nonet --debug --stream $$i > $(srcdir)/result/$$name.rdr 2>/dev/null ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --nonet --debug --stream $$i > result.$$name 2>/dev/null ; \
+ log=`$(CHECKER) $(top_builddir)/xmllint --nonet --debug --stream $$i > result.$$name 2>/dev/null ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/$$name.rdr result.$$name ; \
+ diff $(srcdir)/result/$$name.rdr result.$$name` ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
rm result.$$name ; \
fi ; fi ; done)
- @echo "##"
@echo "## Reader on memory regression tests"
- @echo "##"
-@(for i in $(srcdir)/test/* ; do \
name=`basename $$i`; \
if [ ! -d $$i ] ; then \
@@ -605,19 +543,16 @@ Readertests : xmllint$(EXEEXT)
$(CHECKER) $(top_builddir)/xmllint --memory --nonet --debug --stream $$i > $(srcdir)/result/$$name.rdr 2>/dev/null ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --memory --nonet --debug --stream $$i > result.$$name 2>/dev/null ; \
+ log=`$(CHECKER) $(top_builddir)/xmllint --memory --nonet --debug --stream $$i > result.$$name 2>/dev/null ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/$$name.rdr result.$$name ; \
+ diff $(srcdir)/result/$$name.rdr result.$$name` ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
rm result.$$name ; \
fi ; fi ; done)
-
SAXtests : testSAX$(EXEEXT)
@(echo > .memdump)
- @echo "##"
@echo "## SAX callbacks regression tests"
- @echo "##"
-@(for i in $(srcdir)/test/* ; do \
name=`basename $$i`; \
if [ ! -d $$i ] ; then \
@@ -626,29 +561,24 @@ SAXtests : testSAX$(EXEEXT)
$(CHECKER) $(top_builddir)/testSAX $$i > $(srcdir)/result/$$name.sax ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/testSAX $$i > result.$$name ; \
+ log=`$(CHECKER) $(top_builddir)/testSAX $$i > result.$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/$$name.sax result.$$name ; \
+ diff $(srcdir)/result/$$name.sax result.$$name` ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
rm result.$$name ; \
fi ; fi ; done)
-
Validtests : xmllint$(EXEEXT)
@(echo > .memdump)
- @echo "##"
@echo "## Valid documents regression tests"
- @echo "##"
-@(for i in $(srcdir)/test/VCM/* ; do \
name=`basename $$i`; \
if [ ! -d $$i ] ; then \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --valid --noout --nowarning $$i ; \
- grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
+ log=`$(CHECKER) $(top_builddir)/xmllint --valid --noout --nowarning $$i ; \
+ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0"`;\
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
fi ; done ; exit 0)
- @echo "##"
@echo "## Validity checking regression tests"
- @echo "##"
-@(for i in $(srcdir)/test/VC/* ; do \
name=`basename $$i`; \
if [ ! -d $$i ] ; then \
@@ -657,15 +587,13 @@ Validtests : xmllint$(EXEEXT)
$(CHECKER) $(top_builddir)/xmllint --noout --valid $$i 2> $(srcdir)/result/VC/$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --noout --valid $$i 2> result.$$name ; \
+ log=`$(CHECKER) $(top_builddir)/xmllint --noout --valid $$i 2> result.$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/VC/$$name result.$$name ; \
+ diff $(srcdir)/result/VC/$$name result.$$name` ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
rm result.$$name ; \
fi ; fi ; done)
- @echo "##"
@echo "## General documents valid regression tests"
- @echo "##"
-@(for i in $(srcdir)/test/valid/* ; do \
name=`basename $$i`; \
if [ ! -d $$i ] ; then \
@@ -674,19 +602,17 @@ Validtests : xmllint$(EXEEXT)
$(CHECKER) $(top_builddir)/xmllint --valid $$i > $(srcdir)/result/valid/$$name 2>$(srcdir)/result/valid/$$name.err ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/xmllint --valid $$i > result.$$name 2>error.$$name ; \
+ log=`$(CHECKER) $(top_builddir)/xmllint --valid $$i > result.$$name 2>error.$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
diff $(srcdir)/result/valid/$$name result.$$name ; \
- diff $(srcdir)/result/valid/$$name.err error.$$name ; \
+ diff $(srcdir)/result/valid/$$name.err error.$$name` ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
rm result.$$name error.$$name ; \
fi ; fi ; done)
Regexptests: testRegexp$(EXEEXT)
@(echo > .memdump)
- @echo "##"
@echo "## Regexp regression tests"
- @echo "##"
-@(for i in $(srcdir)/test/regexp/* ; do \
name=`basename $$i`; \
if [ ! -d $$i ] ; then \
@@ -695,18 +621,16 @@ Regexptests: testRegexp$(EXEEXT)
$(CHECKER) $(top_builddir)/testRegexp -i $$i > $(srcdir)/result/regexp/$$name; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/testRegexp -i $$i > result.$$name ; \
+ log=`$(CHECKER) $(top_builddir)/testRegexp -i $$i 2>&1 > result.$$name ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
- diff $(srcdir)/result/regexp/$$name result.$$name ; \
+ diff $(srcdir)/result/regexp/$$name result.$$name` ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
rm result.$$name ; \
fi ; fi ; done)
Automatatests: testAutomata$(EXEEXT)
@(echo > .memdump)
- @echo "##"
@echo "## Automata regression tests"
- @echo "##"
-@(for i in $(srcdir)/test/automata/* ; do \
name=`basename $$i`; \
if [ ! -d $$i ] ; then \
@@ -715,10 +639,10 @@ Automatatests: testAutomata$(EXEEXT)
$(CHECKER) $(top_builddir)/testAutomata $$i > $(srcdir)/result/automata/$$name; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
else \
- echo Testing $$name ; \
- $(CHECKER) $(top_builddir)/testAutomata $$i > result.$$name ; \
+ 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 ; \
+ diff $(srcdir)/result/automata/$$name result.$$name` ; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
rm result.$$name ; \
fi ; fi ; done)
@@ -727,14 +651,12 @@ $(srcdir)/dba100000.xml: dbgenattr.pl
@(dbgenattr.pl 100000 > $(srcdir)/dba100000.xml)
Timingtests: xmllint$(EXEEXT) $(srcdir)/dba100000.xml
- @echo "##"
@echo "## Timing tests to try to detect performance"
@echo "## as well a memory usage breakage when streaming"
@echo "## 1/ using the file interface"
@echo "## 2/ using the memory interface"
@echo "## 3/ repeated DOM parsing"
@echo "## 4/ repeated DOM validation"
- @echo "##"
-@(xmllint --stream --timing $(srcdir)/dba100000.xml; \
MEM=`cat .memdump | grep "MEMORY ALLOCATED" | awk '{ print $$7}'`;\
if [ "$$MEM" != "" ] ; then echo Using $$MEM bytes ; fi ; \
@@ -759,14 +681,11 @@ VTimingtests: xmllint$(EXEEXT)
exit 0)
C14Ntests : testC14N$(EXEEXT)
- @echo "##"
@echo "## C14N and XPath regression tests"
- @echo "##"
-@(for m in with-comments without-comments exc-without-comments ; do \
for i in $(srcdir)/test/c14n/$$m/*.xml ; do \
if [ ! -d $$i ] ; then \
name=`basename $$i .xml`; \
- echo Testing $$m/$$name; \
cmdline="$(CHECKER) $(top_builddir)/testC14N --$$m $$i"; \
if [ -f $(srcdir)/test/c14n/$$m/$$name.xpath ] ; then \
cmdline="$$cmdline $(srcdir)/test/c14n/$$m/$$name.xpath"; \
@@ -778,7 +697,7 @@ C14Ntests : testC14N$(EXEEXT)
if [ $$? -eq 0 ]; then \
diff $(srcdir)/result/c14n/$$m/$$name $(srcdir)/test/c14n/test.tmp; \
if [ $$? -ne 0 ]; then \
- echo "Test failed"; \
+ echo "Test $$m/$$name failed"; \
cat $(srcdir)/test/c14n/test.tmp; \
fi; \
else \
@@ -792,9 +711,7 @@ C14Ntests : testC14N$(EXEEXT)
Schemastests: testSchemas$(EXEEXT)
@(echo > .memdump)
- @echo "##"
@echo "## Schemas regression tests"
- @echo "##"
-@(for i in $(srcdir)/test/schemas/*_*.xsd ; do \
name=`basename $$i | sed 's+_.*++'`; \
sno=`basename $$i | sed 's+.*_\(.*\).xsd+\1+'`; \
@@ -809,24 +726,22 @@ Schemastests: testSchemas$(EXEEXT)
2> $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno".err; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
else \
- echo Testing "$$name"_"$$sno"_"$$xno" ; \
- $(CHECKER) $(top_builddir)/testSchemas $$i $$j \
+ log=`$(CHECKER) $(top_builddir)/testSchemas $$i $$j \
> res.$$name 2> err.$$name;\
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
diff $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno" \
res.$$name;\
diff $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno".err \
err.$$name;\
- grep Unimplemented err.$$name; \
+ grep Unimplemented err.$$name`; \
+ if [ -n "$$log" ] ; then echo "$$name"_"$$sno"_"$$xno" result ; echo $$log ; fi ; \
rm res.$$name err.$$name ; \
fi ; fi ;\
done; done)
Relaxtests: xmllint$(EXEEXT)
@(echo > .memdump)
- @echo "##"
@echo "## Relax-NG regression tests"
- @echo "##"
-@(for i in $(srcdir)/test/relaxng/*.rng ; do \
name=`basename $$i | sed 's+\.rng++'`; \
if [ ! -f $(srcdir)/result/relaxng/"$$name"_valid ] ; then \
@@ -836,15 +751,15 @@ Relaxtests: xmllint$(EXEEXT)
2> $(srcdir)/result/relaxng/"$$name"_err; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
else \
- echo Checking schemas $$name ; \
- $(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $(srcdir)/test/relaxng/tutorA.rng $$i \
+ log=`$(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $(srcdir)/test/relaxng/tutorA.rng $$i \
> res.$$name 2> err.$$name;\
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
diff $(srcdir)/result/relaxng/"$$name"_valid \
res.$$name;\
diff $(srcdir)/result/relaxng/"$$name"_err \
err.$$name | grep -v "error detected at";\
- grep Unimplemented err.$$name; \
+ grep Unimplemented err.$$name`; \
+ if [ -n "$$log" ] ; then echo schemas $$name result ; echo $$log ; fi ; \
rm res.$$name err.$$name ; \
fi; \
for j in $(srcdir)/test/relaxng/"$$name"_*.xml ; do \
@@ -858,24 +773,21 @@ Relaxtests: xmllint$(EXEEXT)
2> $(srcdir)/result/relaxng/"$$name"_"$$xno".err; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
else \
- echo Testing "$$name"_"$$xno" ; \
- $(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $$i $$j \
+ log=`$(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --relaxng $$i $$j \
> res.$$name 2> err.$$name;\
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
diff $(srcdir)/result/relaxng/"$$name"_"$$xno" \
res.$$name;\
diff $(srcdir)/result/relaxng/"$$name"_"$$xno".err \
err.$$name | grep -v "error detected at";\
- grep Unimplemented err.$$name; \
+ grep Unimplemented err.$$name`; \
+ if [ -n "$$log" ] ; then echo "$$name"_"$$xno" result ; echo $$log ; fi ; \
rm res.$$name err.$$name ; \
fi ; fi ; \
done; done)
- @echo "##"
@echo "## Relax-NG streaming regression tests"
- @echo "##"
@echo "## Some error messages are different than non-streaming"
@echo "## and generate small diffs"
- @echo "##"
-@(for i in $(srcdir)/test/relaxng/*.rng ; do \
name=`basename $$i | sed 's+\.rng++'`; \
for j in $(srcdir)/test/relaxng/"$$name"_*.xml ; do \
@@ -889,15 +801,15 @@ Relaxtests: xmllint$(EXEEXT)
2> $(srcdir)/result/relaxng/"$$name"_"$$xno".err; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
else \
- echo Testing "$$name"_"$$xno" ; \
- $(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --stream --relaxng $$i $$j \
+ log=`$(CHECKER) $(top_builddir)/xmllint$(EXEEXT) --noout --stream --relaxng $$i $$j \
> res.$$name 2> err.$$name;\
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
diff $(srcdir)/result/relaxng/"$$name"_"$$xno" \
res.$$name;\
diff $(srcdir)/result/relaxng/"$$name"_"$$xno".err \
err.$$name | grep -v "error detected at";\
- grep Unimplemented err.$$name; \
+ grep Unimplemented err.$$name`; \
+ if [ -n "$$log" ] ; then echo $$name result ; echo $$log ; fi ; \
rm res.$$name err.$$name ; \
fi ; fi ; \
done; done)
diff --git a/configure.in b/configure.in
index 57af8c45..2746dccb 100644
--- a/configure.in
+++ b/configure.in
@@ -7,7 +7,7 @@ AC_CANONICAL_HOST
LIBXML_MAJOR_VERSION=2
LIBXML_MINOR_VERSION=6
LIBXML_MICRO_VERSION=0
-LIBXML_MICRO_VERSION_SUFFIX=beta3
+LIBXML_MICRO_VERSION_SUFFIX=beta4
LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml
index 402fcd81..f92587fc 100644
--- a/doc/libxml2-api.xml
+++ b/doc/libxml2-api.xml
@@ -62,7 +62,6 @@
<exports symbol='xmlXPtrWrapLocationSet'/>
</file>
<file name='SAX'>
- <exports symbol='_xmlSAXHandlerV1'/>
<exports symbol='attribute'/>
<exports symbol='attributeDecl'/>
<exports symbol='cdataBlock'/>
@@ -100,13 +99,12 @@
<exports symbol='startDocument'/>
<exports symbol='startElement'/>
<exports symbol='unparsedEntityDecl'/>
- <exports symbol='xmlSAXHandlerV1'/>
- <exports symbol='xmlSAXHandlerV1Ptr'/>
</file>
<file name='parserInternals'>
<exports symbol='INPUT_CHUNK'/>
<exports symbol='IS_BASECHAR'/>
<exports symbol='IS_BLANK'/>
+ <exports symbol='IS_BYTE_CHAR'/>
<exports symbol='IS_CHAR'/>
<exports symbol='IS_COMBINING'/>
<exports symbol='IS_DIGIT'/>
@@ -882,11 +880,18 @@
<exports symbol='LIBXML_HTTP_ENABLED'/>
<exports symbol='LIBXML_ICONV_ENABLED'/>
<exports symbol='LIBXML_ISO8859X_ENABLED'/>
+ <exports symbol='LIBXML_LEGACY_ENABLED'/>
+ <exports symbol='LIBXML_OUTPUT_ENABLED'/>
+ <exports symbol='LIBXML_PUSH_ENABLED'/>
+ <exports symbol='LIBXML_READER_ENABLED'/>
<exports symbol='LIBXML_REGEXP_ENABLED'/>
+ <exports symbol='LIBXML_SAX1_ENABLED'/>
<exports symbol='LIBXML_SCHEMAS_ENABLED'/>
<exports symbol='LIBXML_TEST_VERSION'/>
<exports symbol='LIBXML_THREAD_ENABLED'/>
+ <exports symbol='LIBXML_TREE_ENABLED'/>
<exports symbol='LIBXML_UNICODE_ENABLED'/>
+ <exports symbol='LIBXML_VALID_ENABLED'/>
<exports symbol='LIBXML_VERSION'/>
<exports symbol='LIBXML_VERSION_STRING'/>
<exports symbol='LIBXML_XINCLUDE_ENABLED'/>
@@ -1095,6 +1100,7 @@
<exports symbol='_xmlParserNodeInfo'/>
<exports symbol='_xmlParserNodeInfoSeq'/>
<exports symbol='_xmlSAXHandler'/>
+ <exports symbol='_xmlSAXHandlerV1'/>
<exports symbol='_xmlSAXLocator'/>
<exports symbol='attributeDeclSAXFunc'/>
<exports symbol='attributeSAXFunc'/>
@@ -1187,6 +1193,8 @@
<exports symbol='xmlRecoverDoc'/>
<exports symbol='xmlRecoverFile'/>
<exports symbol='xmlRecoverMemory'/>
+ <exports symbol='xmlSAXHandlerV1'/>
+ <exports symbol='xmlSAXHandlerV1Ptr'/>
<exports symbol='xmlSAXParseDTD'/>
<exports symbol='xmlSAXParseDoc'/>
<exports symbol='xmlSAXParseEntity'/>
@@ -1573,6 +1581,8 @@
<exports symbol='xmlInitializeGlobalState'/>
<exports symbol='xmlKeepBlanksDefaultValue'/>
<exports symbol='xmlKeepBlanksDefaultValue'/>
+ <exports symbol='xmlLastError'/>
+ <exports symbol='xmlLastError'/>
<exports symbol='xmlLineNumbersDefaultValue'/>
<exports symbol='xmlLineNumbersDefaultValue'/>
<exports symbol='xmlLoadExtDtdDefaultValue'/>
@@ -1709,10 +1719,13 @@
<exports symbol='XML_ERR_ENTITY_NOT_STARTED'/>
<exports symbol='XML_ERR_ENTITY_PE_INTERNAL'/>
<exports symbol='XML_ERR_EQUAL_REQUIRED'/>
+ <exports symbol='XML_ERR_ERROR'/>
<exports symbol='XML_ERR_EXTRA_CONTENT'/>
<exports symbol='XML_ERR_EXT_ENTITY_STANDALONE'/>
<exports symbol='XML_ERR_EXT_SUBSET_NOT_FINISHED'/>
+ <exports symbol='XML_ERR_FATAL'/>
<exports symbol='XML_ERR_GT_REQUIRED'/>
+ <exports symbol='XML_ERR_HTML'/>
<exports symbol='XML_ERR_HYPHEN_IN_COMMENT'/>
<exports symbol='XML_ERR_INTERNAL_ERROR'/>
<exports symbol='XML_ERR_INVALID_CHAR'/>
@@ -1721,16 +1734,19 @@
<exports symbol='XML_ERR_INVALID_ENCODING'/>
<exports symbol='XML_ERR_INVALID_HEX_CHARREF'/>
<exports symbol='XML_ERR_INVALID_URI'/>
+ <exports symbol='XML_ERR_IO'/>
<exports symbol='XML_ERR_LITERAL_NOT_FINISHED'/>
<exports symbol='XML_ERR_LITERAL_NOT_STARTED'/>
<exports symbol='XML_ERR_LTSLASH_REQUIRED'/>
<exports symbol='XML_ERR_LT_IN_ATTRIBUTE'/>
<exports symbol='XML_ERR_LT_REQUIRED'/>
+ <exports symbol='XML_ERR_MEMORY'/>
<exports symbol='XML_ERR_MISPLACED_CDATA_END'/>
<exports symbol='XML_ERR_MIXED_NOT_FINISHED'/>
<exports symbol='XML_ERR_MIXED_NOT_STARTED'/>
<exports symbol='XML_ERR_NAME_REQUIRED'/>
<exports symbol='XML_ERR_NMTOKEN_REQUIRED'/>
+ <exports symbol='XML_ERR_NONE'/>
<exports symbol='XML_ERR_NOTATION_NOT_FINISHED'/>
<exports symbol='XML_ERR_NOTATION_NOT_STARTED'/>
<exports symbol='XML_ERR_NOT_WELL_BALANCED'/>
@@ -1738,6 +1754,7 @@
<exports symbol='XML_ERR_NO_MEMORY'/>
<exports symbol='XML_ERR_NS_DECL_ERROR'/>
<exports symbol='XML_ERR_OK'/>
+ <exports symbol='XML_ERR_OUTPUT'/>
<exports symbol='XML_ERR_PCDATA_REQUIRED'/>
<exports symbol='XML_ERR_PEREF_AT_EOF'/>
<exports symbol='XML_ERR_PEREF_IN_EPILOG'/>
@@ -1764,16 +1781,31 @@
<exports symbol='XML_ERR_URI_REQUIRED'/>
<exports symbol='XML_ERR_VALUE_REQUIRED'/>
<exports symbol='XML_ERR_VERSION_MISSING'/>
+ <exports symbol='XML_ERR_WARNING'/>
+ <exports symbol='XML_ERR_XINCLUDE'/>
<exports symbol='XML_ERR_XMLDECL_NOT_FINISHED'/>
<exports symbol='XML_ERR_XMLDECL_NOT_STARTED'/>
+ <exports symbol='XML_ERR_XPATH'/>
+ <exports symbol='XML_ERR_XPOINTER'/>
+ <exports symbol='XML_FROM_NONE'/>
+ <exports symbol='XML_FROM_PARSER'/>
<exports symbol='XML_NS_ERR_ATTRIBUTE_REDEFINED'/>
<exports symbol='XML_NS_ERR_QNAME'/>
<exports symbol='XML_NS_ERR_UNDEFINED_NAMESPACE'/>
<exports symbol='XML_NS_ERR_XML_NAMESPACE'/>
<exports symbol='XML_WAR_CATALOG_PI'/>
<exports symbol='XML_WAR_UNDECLARED_ENTITY'/>
+ <exports symbol='_xmlError'/>
<exports symbol='initGenericErrorDefaultFunc'/>
+ <exports symbol='xmlCopyError'/>
+ <exports symbol='xmlCtxtGetLastError'/>
+ <exports symbol='xmlCtxtResetLastError'/>
+ <exports symbol='xmlError'/>
+ <exports symbol='xmlErrorDomain'/>
+ <exports symbol='xmlErrorLevel'/>
+ <exports symbol='xmlErrorPtr'/>
<exports symbol='xmlGenericErrorFunc'/>
+ <exports symbol='xmlGetLastError'/>
<exports symbol='xmlParserError'/>
<exports symbol='xmlParserErrors'/>
<exports symbol='xmlParserPrintFileContext'/>
@@ -1781,6 +1813,7 @@
<exports symbol='xmlParserValidityError'/>
<exports symbol='xmlParserValidityWarning'/>
<exports symbol='xmlParserWarning'/>
+ <exports symbol='xmlResetLastError'/>
<exports symbol='xmlSetGenericErrorFunc'/>
</file>
<file name='tree'>
@@ -1854,7 +1887,6 @@
<exports symbol='_xmlNotation'/>
<exports symbol='_xmlNs'/>
<exports symbol='_xmlRef'/>
- <exports symbol='oldXMLWDcompatibility'/>
<exports symbol='xmlAddChild'/>
<exports symbol='xmlAddChildList'/>
<exports symbol='xmlAddNextSibling'/>
@@ -1869,7 +1901,6 @@
<exports symbol='xmlBuffer'/>
<exports symbol='xmlBufferAdd'/>
<exports symbol='xmlBufferAddHead'/>
- <exports symbol='xmlBufferAllocScheme'/>
<exports symbol='xmlBufferAllocationScheme'/>
<exports symbol='xmlBufferCCat'/>
<exports symbol='xmlBufferCat'/>
@@ -1901,7 +1932,6 @@
<exports symbol='xmlCopyProp'/>
<exports symbol='xmlCopyPropList'/>
<exports symbol='xmlCreateIntSubset'/>
- <exports symbol='xmlDefaultBufferSize'/>
<exports symbol='xmlDoc'/>
<exports symbol='xmlDocCopyNode'/>
<exports symbol='xmlDocDump'/>
@@ -1951,7 +1981,6 @@
<exports symbol='xmlHasProp'/>
<exports symbol='xmlID'/>
<exports symbol='xmlIDPtr'/>
- <exports symbol='xmlIndentTreeOutput'/>
<exports symbol='xmlIsBlankNode'/>
<exports symbol='xmlIsXHTML'/>
<exports symbol='xmlNewCDataBlock'/>
@@ -2028,7 +2057,6 @@
<exports symbol='xmlSaveFormatFile'/>
<exports symbol='xmlSaveFormatFileEnc'/>
<exports symbol='xmlSaveFormatFileTo'/>
- <exports symbol='xmlSaveNoEmptyTags'/>
<exports symbol='xmlSearchNs'/>
<exports symbol='xmlSearchNsByHref'/>
<exports symbol='xmlSetBufferAllocationScheme'/>
@@ -2368,6 +2396,10 @@
<info>Macro to check the following production in the XML spec: [3] S ::= (#x20 | #x9 | #xD | #xA)+</info>
<arg name='c' info='an UNICODE value (int)'/>
</macro>
+ <macro name='IS_BYTE_CHAR' file='parserInternals'>
+ <info>Macro to check the following production in the XML spec: [2] Char ::= #x9 | #xA | #xD | [#x20...] any byte character in the accepted range</info>
+ <arg name='c' info='an byte value (int)'/>
+ </macro>
<macro name='IS_CHAR' file='parserInternals'>
<info>Macro to check the following production in the XML spec: [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.</info>
<arg name='c' info='an UNICODE value (int)'/>
@@ -2431,9 +2463,24 @@
<macro name='LIBXML_ISO8859X_ENABLED' file='xmlversion'>
<info>Whether ISO-8859-* support is made available in case iconv is not</info>
</macro>
+ <macro name='LIBXML_LEGACY_ENABLED' file='xmlversion'>
+ <info>Whether the deprecated APIs are compiled in for compatibility</info>
+ </macro>
+ <macro name='LIBXML_OUTPUT_ENABLED' file='xmlversion'>
+ <info>Whether the serialization/saving support is configured in</info>
+ </macro>
+ <macro name='LIBXML_PUSH_ENABLED' file='xmlversion'>
+ <info>Whether the push parsing interfaces are configured in</info>
+ </macro>
+ <macro name='LIBXML_READER_ENABLED' file='xmlversion'>
+ <info>Whether the xmlReader parsing interface is configured in</info>
+ </macro>
<macro name='LIBXML_REGEXP_ENABLED' file='xmlversion'>
<info>Whether the regular expressions interfaces are compiled in</info>
</macro>
+ <macro name='LIBXML_SAX1_ENABLED' file='xmlversion'>
+ <info>Whether the older SAX1 interface is configured in</info>
+ </macro>
<macro name='LIBXML_SCHEMAS_ENABLED' file='xmlversion'>
<info>Whether the Schemas validation interfaces are compiled in</info>
</macro>
@@ -2443,9 +2490,15 @@
<macro name='LIBXML_THREAD_ENABLED' file='xmlversion'>
<info>Whether the thread support is configured in</info>
</macro>
+ <macro name='LIBXML_TREE_ENABLED' file='xmlversion'>
+ <info>Whether the DOM like tree manipulation API support is configured in</info>
+ </macro>
<macro name='LIBXML_UNICODE_ENABLED' file='xmlversion'>
<info>Whether the Unicode related interfaces are compiled in</info>
</macro>
+ <macro name='LIBXML_VALID_ENABLED' file='xmlversion'>
+ <info>Whether the DTD validation support is configured in</info>
+ </macro>
<macro name='LIBXML_VERSION' file='xmlversion'>
<info>the version number: 1.2.3 value is 1002003</info>
</macro>
@@ -2839,10 +2892,13 @@
<enum name='XML_ERR_ENTITY_NOT_STARTED' file='xmlerror' value='36' type='xmlParserErrors' info='36'/>
<enum name='XML_ERR_ENTITY_PE_INTERNAL' file='xmlerror' value='88' type='xmlParserErrors' info='88'/>
<enum name='XML_ERR_EQUAL_REQUIRED' file='xmlerror' value='75' type='xmlParserErrors'/>
+ <enum name='XML_ERR_ERROR' file='xmlerror' value='2' type='xmlErrorLevel' info='A recoverable error'/>
<enum name='XML_ERR_EXTRA_CONTENT' file='xmlerror' value='86' type='xmlParserErrors' info='86'/>
<enum name='XML_ERR_EXT_ENTITY_STANDALONE' file='xmlerror' value='82' type='xmlParserErrors' info='82'/>
<enum name='XML_ERR_EXT_SUBSET_NOT_FINISHED' file='xmlerror' value='60' type='xmlParserErrors' info='60'/>
+ <enum name='XML_ERR_FATAL' file='xmlerror' value='3' type='xmlErrorLevel' info=' A fatal error'/>
<enum name='XML_ERR_GT_REQUIRED' file='xmlerror' value='73' type='xmlParserErrors'/>
+ <enum name='XML_ERR_HTML' file='xmlerror' value='2' type='xmlErrorDomain' info='The HTML parser'/>
<enum name='XML_ERR_HYPHEN_IN_COMMENT' file='xmlerror' value='80' type='xmlParserErrors' info='80'/>
<enum name='XML_ERR_INTERNAL_ERROR' file='xmlerror' value='1' type='xmlParserErrors'/>
<enum name='XML_ERR_INVALID_CHAR' file='xmlerror' value='9' type='xmlParserErrors'/>
@@ -2851,16 +2907,19 @@
<enum name='XML_ERR_INVALID_ENCODING' file='xmlerror' value='81' type='xmlParserErrors' info='81'/>
<enum name='XML_ERR_INVALID_HEX_CHARREF' file='xmlerror' value='6' type='xmlParserErrors' info='6'/>
<enum name='XML_ERR_INVALID_URI' file='xmlerror' value='91' type='xmlParserErrors' info='91'/>
+ <enum name='XML_ERR_IO' file='xmlerror' value='5' type='xmlErrorDomain' info='The Input/Output stack'/>
<enum name='XML_ERR_LITERAL_NOT_FINISHED' file='xmlerror' value='44' type='xmlParserErrors'/>
<enum name='XML_ERR_LITERAL_NOT_STARTED' file='xmlerror' value='43' type='xmlParserErrors' info='43'/>
<enum name='XML_ERR_LTSLASH_REQUIRED' file='xmlerror' value='74' type='xmlParserErrors'/>
<enum name='XML_ERR_LT_IN_ATTRIBUTE' file='xmlerror' value='38' type='xmlParserErrors' info='38'/>
<enum name='XML_ERR_LT_REQUIRED' file='xmlerror' value='72' type='xmlParserErrors'/>
+ <enum name='XML_ERR_MEMORY' file='xmlerror' value='3' type='xmlErrorDomain' info='The memory allocator'/>
<enum name='XML_ERR_MISPLACED_CDATA_END' file='xmlerror' value='62' type='xmlParserErrors' info='62'/>
<enum name='XML_ERR_MIXED_NOT_FINISHED' file='xmlerror' value='53' type='xmlParserErrors'/>
<enum name='XML_ERR_MIXED_NOT_STARTED' file='xmlerror' value='52' type='xmlParserErrors' info='52'/>
<enum name='XML_ERR_NAME_REQUIRED' file='xmlerror' value='68' type='xmlParserErrors'/>
<enum name='XML_ERR_NMTOKEN_REQUIRED' file='xmlerror' value='67' type='xmlParserErrors'/>
+ <enum name='XML_ERR_NONE' file='xmlerror' value='0' type='xmlErrorLevel'/>
<enum name='XML_ERR_NOTATION_NOT_FINISHED' file='xmlerror' value='49' type='xmlParserErrors'/>
<enum name='XML_ERR_NOTATION_NOT_STARTED' file='xmlerror' value='48' type='xmlParserErrors' info='48'/>
<enum name='XML_ERR_NOT_WELL_BALANCED' file='xmlerror' value='85' type='xmlParserErrors' info='85'/>
@@ -2868,6 +2927,7 @@
<enum name='XML_ERR_NO_MEMORY' file='xmlerror' value='2' type='xmlParserErrors'/>
<enum name='XML_ERR_NS_DECL_ERROR' file='xmlerror' value='35' type='xmlParserErrors'/>
<enum name='XML_ERR_OK' file='xmlerror' value='0' type='xmlParserErrors'/>
+ <enum name='XML_ERR_OUTPUT' file='xmlerror' value='4' type='xmlErrorDomain' info='The serialization code'/>
<enum name='XML_ERR_PCDATA_REQUIRED' file='xmlerror' value='69' type='xmlParserErrors'/>
<enum name='XML_ERR_PEREF_AT_EOF' file='xmlerror' value='18' type='xmlParserErrors'/>
<enum name='XML_ERR_PEREF_IN_EPILOG' file='xmlerror' value='20' type='xmlParserErrors'/>
@@ -2894,11 +2954,17 @@
<enum name='XML_ERR_URI_REQUIRED' file='xmlerror' value='70' type='xmlParserErrors'/>
<enum name='XML_ERR_VALUE_REQUIRED' file='xmlerror' value='84' type='xmlParserErrors' info='84'/>
<enum name='XML_ERR_VERSION_MISSING' file='xmlerror' value='100' type='xmlParserErrors'/>
+ <enum name='XML_ERR_WARNING' file='xmlerror' value='1' type='xmlErrorLevel' info='A simple warning'/>
+ <enum name='XML_ERR_XINCLUDE' file='xmlerror' value='6' type='xmlErrorDomain' info='The XInclude processing'/>
<enum name='XML_ERR_XMLDECL_NOT_FINISHED' file='xmlerror' value='57' type='xmlParserErrors'/>
<enum name='XML_ERR_XMLDECL_NOT_STARTED' file='xmlerror' value='56' type='xmlParserErrors' info='56'/>
+ <enum name='XML_ERR_XPATH' file='xmlerror' value='7' type='xmlErrorDomain' info='The XPath engine'/>
+ <enum name='XML_ERR_XPOINTER' file='xmlerror' value='8' type='xmlErrorDomain' info=' The XPointer engine'/>
<enum name='XML_EXTERNAL_GENERAL_PARSED_ENTITY' file='entities' value='2' type='xmlEntityType'/>
<enum name='XML_EXTERNAL_GENERAL_UNPARSED_ENTITY' file='entities' value='3' type='xmlEntityType'/>
<enum name='XML_EXTERNAL_PARAMETER_ENTITY' file='entities' value='5' type='xmlEntityType'/>
+ <enum name='XML_FROM_NONE' file='xmlerror' value='0' type='xmlErrorDomain'/>
+ <enum name='XML_FROM_PARSER' file='xmlerror' value='1' type='xmlErrorDomain' info='The XML parser'/>
<enum name='XML_HTML_DOCUMENT_NODE' file='tree' value='13' type='xmlElementType'/>
<enum name='XML_INTERNAL_GENERAL_ENTITY' file='entities' value='1' type='xmlEntityType'/>
<enum name='XML_INTERNAL_PARAMETER_ENTITY' file='entities' value='4' type='xmlEntityType'/>
@@ -3347,6 +3413,21 @@ actually an xmlCharEncoding'/>
<field name='name' type='const xmlChar *' info=' Enumeration name'/>
</struct>
<typedef name='xmlEnumerationPtr' file='tree' type='xmlEnumeration *'/>
+ <struct name='xmlError' file='xmlerror' type='struct _xmlError'>
+ <field name='domain' type='int' info=' What part of the library raised this error'/>
+ <field name='code' type='int' info=' The error code, e.g. an xmlParserError'/>
+ <field name='message' type='char *' info=' human-readable informative error message'/>
+ <field name='level' type='xmlErrorLevel' info=' how consequent is the error'/>
+ <field name='file' type='char *' info=' the filename'/>
+ <field name='line' type='int' info=' the line number if available'/>
+ <field name='str1' type='char *' info=' extra string information'/>
+ <field name='str2' type='char *' info=' extra string information'/>
+ <field name='int1' type='int' info=' extra number information'/>
+ <field name='int2' type='int' info=' extra number information'/>
+ </struct>
+ <typedef name='xmlErrorDomain' file='xmlerror' type='enum'/>
+ <typedef name='xmlErrorLevel' file='xmlerror' type='enum'/>
+ <typedef name='xmlErrorPtr' file='xmlerror' type='xmlError *'/>
<struct name='xmlGlobalState' file='globals' type='struct _xmlGlobalState'>
<field name='xmlParserVersion' type='const char *' info=''/>
<field name='xmlDefaultSAXLocator' type='xmlSAXLocator' info=''/>
@@ -3376,6 +3457,7 @@ actually an xmlCharEncoding'/>
<field name='xmlRegisterNodeDefaultValue' type='xmlRegisterNodeFunc' info=''/>
<field name='xmlDeregisterNodeDefaultValue' type='xmlDeregisterNodeFunc' info=''/>
<field name='xmlMallocAtomic' type='xmlMallocFunc' info=''/>
+ <field name='xmlLastError' type='xmlError' info=''/>
</struct>
<typedef name='xmlGlobalStatePtr' file='globals' type='xmlGlobalState *'/>
<struct name='xmlHashTable' file='hash' type='struct _xmlHashTable'/>
@@ -3645,7 +3727,7 @@ actually an xmlCharEncoding'/>
<field name='endElementNs' type='endElementNsSAX2Func' info=''/>
</struct>
<typedef name='xmlSAXHandlerPtr' file='tree' type='xmlSAXHandler *'/>
- <struct name='xmlSAXHandlerV1' file='SAX' type='struct _xmlSAXHandlerV1'>
+ <struct name='xmlSAXHandlerV1' file='parser' type='struct _xmlSAXHandlerV1'>
<field name='internalSubset' type='internalSubsetSAXFunc' info=''/>
<field name='isStandalone' type='isStandaloneSAXFunc' info=''/>
<field name='hasInternalSubset' type='hasInternalSubsetSAXFunc' info=''/>
@@ -3675,7 +3757,7 @@ actually an xmlCharEncoding'/>
<field name='externalSubset' type='externalSubsetSAXFunc' info=''/>
<field name='initialized' type='unsigned int' info=''/>
</struct>
- <typedef name='xmlSAXHandlerV1Ptr' file='SAX' type='xmlSAXHandlerV1 *'/>
+ <typedef name='xmlSAXHandlerV1Ptr' file='parser' type='xmlSAXHandlerV1 *'/>
<struct name='xmlSAXLocator' file='tree' type='struct _xmlSAXLocator'>
<field name='getPublicId' type='const xmlChar *(*getPublicId)' info=''/>
<field name='getSystemId' type='const xmlChar *(*getSystemId)' info=''/>
@@ -3960,6 +4042,7 @@ actually an xmlCharEncoding'/>
<variable name='xmlGetWarningsDefaultValue' file='globals' type='int'/>
<variable name='xmlIndentTreeOutput' file='globals' type='int'/>
<variable name='xmlKeepBlanksDefaultValue' file='globals' type='int'/>
+ <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'/>
@@ -5699,7 +5782,7 @@ actually an xmlCharEncoding'/>
<return type='void'/>
</function>
<function name='xmlCleanupPredefinedEntities' file='entities'>
- <info>Cleanup up the predefined entities table.</info>
+ <info>Cleanup up the predefined entities table. Deprecated call</info>
<return type='void'/>
</function>
<function name='xmlCleanupThreads' file='threads'>
@@ -5770,6 +5853,12 @@ actually an xmlCharEncoding'/>
<return type='xmlEnumerationPtr' info='the xmlEnumerationPtr just created or NULL in case of error.'/>
<arg name='cur' type='xmlEnumerationPtr' info='the tree to copy.'/>
</function>
+ <function name='xmlCopyError' file='xmlerror'>
+ <info></info>
+ <return type='int' info=''/>
+ <arg name='from' type='xmlErrorPtr' info=''/>
+ <arg name='to' type='xmlErrorPtr' info=''/>
+ </function>
<function name='xmlCopyNamespace' file='tree'>
<info>Do a copy of the namespace.</info>
<return type='xmlNsPtr' info='a new #xmlNsPtr, or NULL in case of error.'/>
@@ -5871,6 +5960,11 @@ actually an xmlCharEncoding'/>
<info>Simply creates an empty xmlURI</info>
<return type='xmlURIPtr' info='the new structure or NULL in case of error'/>
</function>
+ <function name='xmlCtxtGetLastError' file='xmlerror'>
+ <info></info>
+ <return type='xmlErrorPtr' info=''/>
+ <arg name='ctxt' type='void *' info=''/>
+ </function>
<function name='xmlCtxtReadDoc' file='parser'>
<info>parse an XML in-memory document and build a tree. This reuses the existing @ctxt parser context</info>
<return type='xmlDocPtr' info='the resulting document tree'/>
@@ -5923,6 +6017,11 @@ actually an xmlCharEncoding'/>
<return type='void'/>
<arg name='ctxt' type='xmlParserCtxtPtr' info='an XML parser context'/>
</function>
+ <function name='xmlCtxtResetLastError' file='xmlerror'>
+ <info></info>
+ <return type='void'/>
+ <arg name='ctxt' type='void *' info=''/>
+ </function>
<function name='xmlCtxtUseOptions' file='parser'>
<info>Applies the options to the parser context</info>
<return type='int' info='0 in case of success, the set of unknown or unimplemented options in case of error.'/>
@@ -6193,8 +6292,8 @@ actually an xmlCharEncoding'/>
<arg name='cur' type='xmlNodePtr' info='the current node'/>
</function>
<function name='xmlEncodeEntities' file='entities'>
- <info>Do a global encoding of a string, replacing the predefined entities and non ASCII values with their entities and CharRef counterparts. TODO: remove xmlEncodeEntities, once we are not afraid of breaking binary compatibility People must migrate their code to xmlEncodeEntitiesReentrant ! This routine will issue a warning when encountered.</info>
- <return type='const xmlChar *' info='A newly allocated string with the substitution done.'/>
+ <info>TODO: remove xmlEncodeEntities, once we are not afraid of breaking binary compatibility People must migrate their code to xmlEncodeEntitiesReentrant ! This routine will issue a warning when encountered.</info>
+ <return type='const xmlChar *' info='NULL'/>
<arg name='doc' type='xmlDocPtr' info='the document containing the string'/>
<arg name='input' type='const xmlChar *' info='A string to convert to XML.'/>
</function>
@@ -6522,6 +6621,10 @@ actually an xmlCharEncoding'/>
<return type='xmlNodePtr' info='the last child or NULL if none.'/>
<arg name='parent' type='xmlNodePtr' info='the parent node'/>
</function>
+ <function name='xmlGetLastError' file='xmlerror'>
+ <info></info>
+ <return type='xmlErrorPtr' info=''/>
+ </function>
<function name='xmlGetLineNo' file='tree'>
<info>Get line number of node. this requires activation of this option before invoking the parser by calling xmlLineNumbersDefault(1)</info>
<return type='long' info='the line number if successful, -1 otherwise'/>
@@ -6907,7 +7010,7 @@ actually an xmlCharEncoding'/>
<arg name='gs' type='xmlGlobalStatePtr' info='a pointer to a newly allocated global state'/>
</function>
<function name='xmlInitializePredefinedEntities' file='entities'>
- <info>Set up the predefined entities.</info>
+ <info>Set up the predefined entities. Deprecated call</info>
<return type='void'/>
</function>
<functype name='xmlInputCloseCallback' file='xmlIO'>
@@ -8875,6 +8978,10 @@ actually an xmlCharEncoding'/>
<arg name='old' type='xmlNodePtr' info='the old node'/>
<arg name='cur' type='xmlNodePtr' info='the node'/>
</function>
+ <function name='xmlResetLastError' file='xmlerror'>
+ <info></info>
+ <return type='void'/>
+ </function>
<function name='xmlSAX2AttributeDecl' file='SAX2'>
<info>An attribute definition has been parsed</info>
<return type='void'/>
@@ -9891,7 +9998,7 @@ actually an xmlCharEncoding'/>
<arg name='reader' type='xmlTextReaderPtr' info='the xmlTextReaderPtr used'/>
</function>
<function name='xmlTextReaderCurrentDoc' file='xmlreader'>
- <info>Hacking interface allowing to get the xmlDocPtr correponding to the current document being accessed by the xmlTextReader. This is dangerous because the associated node may be destroyed on the next Reads.</info>
+ <info>Hacking interface allowing to get the xmlDocPtr correponding 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.</info>
<return type='xmlDocPtr' info='the xmlDocPtr or NULL in case of error.'/>
<arg name='reader' type='xmlTextReaderPtr' info='the xmlTextReaderPtr used'/>
</function>
diff --git a/error.c b/error.c
index c6f5bcf2..876a8ad2 100644
--- a/error.c
+++ b/error.c
@@ -9,6 +9,7 @@
#define IN_LIBXML
#include "libxml.h"
+#include <string.h>
#include <stdarg.h>
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
@@ -26,8 +27,7 @@ void xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
va_list ap; \
\
str = (char *) xmlMalloc(150); \
- if (str == NULL) \
- return; \
+ if (str != NULL) { \
\
size = 150; \
\
@@ -42,11 +42,10 @@ void xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
else \
size += 100; \
if ((larger = (char *) xmlRealloc(str, size)) == NULL) {\
- xmlFree(str); \
- return; \
+ break; \
} \
str = larger; \
- } \
+ }} \
}
/************************************************************************
@@ -146,8 +145,9 @@ xmlParserPrintFileInfo(xmlParserInputPtr input) {
* Displays current context within the input content for error tracking
*/
-void
-xmlParserPrintFileContext(xmlParserInputPtr input) {
+static void
+xmlParserPrintFileContextInternal(xmlParserInputPtr input ,
+ xmlGenericErrorFunc channel, void *data ) {
const xmlChar *cur, *base;
unsigned int n, col; /* GCC warns if signed, because compared with sizeof() */
xmlChar content[81]; /* space for 80 chars + line terminator */
@@ -179,7 +179,7 @@ xmlParserPrintFileContext(xmlParserInputPtr input) {
}
*ctnt = 0;
/* print out the selected text */
- xmlGenericError(xmlGenericErrorContext,"%s\n", content);
+ channel(data ,"%s\n", content);
/* create blank line with problem pointer */
n = 0;
ctnt = content;
@@ -191,57 +191,267 @@ xmlParserPrintFileContext(xmlParserInputPtr input) {
}
*ctnt++ = '^';
*ctnt = 0;
- xmlGenericError(xmlGenericErrorContext,"%s\n", content);
+ channel(data ,"%s\n", content);
+}
+
+/**
+ * xmlParserPrintFileContext:
+ * @input: an xmlParserInputPtr input
+ *
+ * Displays current context within the input content for error tracking
+ */
+void
+xmlParserPrintFileContext(xmlParserInputPtr input) {
+ xmlParserPrintFileContextInternal(input, xmlGenericError,
+ xmlGenericErrorContext);
}
-#if 0
/**
- * xmlGetVarStr:
- * @msg: the message format
- * @args: a va_list argument list
+ * xmlReportError:
+ * @ctx: the parser context or NULL
+ * @str: the formatted error message
*
- * SGS contribution
- * Get an arbitrary-sized string for an error argument
- * The caller must free() the returned string
+ * Report an erro with its context, replace the 4 old error/warning
+ * routines.
*/
-static char *
-xmlGetVarStr(const char * msg, va_list args) {
- int size;
- int length;
- int chars, left;
- char *str, *larger;
- va_list ap;
-
- str = (char *) xmlMalloc(150);
- if (str == NULL)
- return(NULL);
-
- size = 150;
- length = 0;
-
- while (1) {
- left = size - length;
- /* Try to print in the allocated space. */
- va_start(msg, ap);
- chars = vsnprintf(str + length, left, msg, ap);
- va_end(ap);
- /* If that worked, we're done. */
- if ((chars > -1) && (chars < left ))
+static void
+xmlReportError(xmlParserCtxtPtr ctxt, const char *str) {
+ char *file = NULL;
+ int line = 0;
+ int code = -1;
+ int domain;
+ xmlErrorLevel level;
+ xmlGenericErrorFunc channel;
+ xmlParserInputPtr input = NULL;
+ xmlParserInputPtr cur = NULL;
+ void *data;
+
+ if (ctxt == NULL) return;
+
+ channel = xmlGenericError;
+ data = xmlGenericErrorContext;
+ file = ctxt->lastError.file;
+ line = ctxt->lastError.line;
+ code = ctxt->lastError.code;
+ domain = ctxt->lastError.domain;
+ level = ctxt->lastError.level;
+
+ if (code == XML_ERR_OK)
+ return;
+
+ /*
+ * Maintain the compatibility with the legacy error handling
+ */
+ input = ctxt->input;
+ if ((input != NULL) && (input->filename == NULL) &&
+ (ctxt->inputNr > 1)) {
+ cur = input;
+ input = ctxt->inputTab[ctxt->inputNr - 2];
+ }
+ if (input != NULL) {
+ if (input->filename)
+ channel(data, "%s:%d: ", input->filename, input->line);
+ else
+ channel(data, "Entity: line %d: ", input->line);
+ }
+ if (code == XML_ERR_OK)
+ return;
+ switch (domain) {
+ case XML_FROM_PARSER:
+ channel(data, "parser ");
+ break;
+ case XML_FROM_NAMESPACE:
+ channel(data, "namespace ");
+ break;
+ case XML_FROM_DTD:
+ channel(data, "validity ");
+ break;
+ case XML_FROM_HTML:
+ channel(data, "HTML parser ");
+ break;
+ case XML_FROM_MEMORY:
+ channel(data, "memory ");
+ break;
+ case XML_FROM_OUTPUT:
+ channel(data, "output ");
+ break;
+ case XML_FROM_IO:
+ channel(data, "I/O ");
+ break;
+ case XML_FROM_XINCLUDE:
+ channel(data, "XInclude ");
+ break;
+ case XML_FROM_XPATH:
+ channel(data, "XPath ");
+ break;
+ case XML_FROM_XPOINTER:
+ channel(data, "parser ");
+ break;
+ case XML_FROM_REGEXP:
+ channel(data, "regexp ");
+ break;
+ case XML_FROM_SCHEMAS:
+ channel(data, "Schemas ");
+ break;
+ case XML_FROM_RELAXNG:
+ channel(data, "Relax-NG ");
+ break;
+ case XML_FROM_CATALOG:
+ channel(data, "Catalog ");
+ break;
+ case XML_FROM_C14N:
+ channel(data, "C14N ");
+ break;
+ case XML_FROM_XSLT:
+ channel(data, "XSLT ");
+ break;
+ default:
+ break;
+ }
+ if (code == XML_ERR_OK)
+ return;
+ switch (level) {
+ case XML_ERR_NONE:
+ channel(data, ": ");
break;
- /* Else try again with more space. */
- if (chars > -1) /* glibc 2.1 */
- size += chars + 1; /* precisely what is needed */
- else /* glibc 2.0 */
- size += 100;
- if ((larger = (char *) xmlRealloc(str, size)) == NULL) {
- xmlFree(str);
- return(NULL);
- }
- str = larger;
+ case XML_ERR_WARNING:
+ channel(data, "warning : ");
+ break;
+ case XML_ERR_ERROR:
+ channel(data, "error : ");
+ break;
+ case XML_ERR_FATAL:
+ channel(data, "error : ");
+ break;
+ }
+ if (code == XML_ERR_OK)
+ return;
+ if (str != NULL) {
+ channel(data, "%s", str);
+ } else {
+ channel(data, "%s", "out of memory error");
}
- return(str);
+ if (code == XML_ERR_OK)
+ return;
+
+ if (ctxt != NULL) {
+ xmlParserPrintFileContextInternal(input, channel, data);
+ if (cur != NULL) {
+ if (cur->filename)
+ channel(data, "%s:%d: \n", cur->filename, cur->line);
+ else
+ channel(data, "Entity: line %d: \n", cur->line);
+ xmlParserPrintFileContextInternal(cur, channel, data);
+ }
+ }
+}
+
+/**
+ * xmlRaiseError:
+ * @ctx: the parser context or NULL
+ * @domain: the domain for the error
+ * @code: the code for the error
+ * @level: the xmlErrorLevel for the error
+ * @file: the file source of the error (or NULL)
+ * @line: the line of the error or 0 if N/A
+ * @str1: extra string info
+ * @str2: extra string info
+ * @str3: extra string info
+ * @int1: extra int info
+ * @int2: extra int info
+ * @msg: the message to display/transmit
+ * @...: extra parameters for the message display
+ *
+ * Update teh appropriate global or contextual error structure,
+ * then forward the error message down the parser or generic
+ * error callback handler
+ */
+void
+xmlRaiseError(void *ctx, int domain, int code, xmlErrorLevel level,
+ const char *file, int line, const char *str1,
+ const char *str2, const char *str3, int int1, int int2,
+ const char *msg, ...)
+{
+ xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
+ char *str = NULL;
+ xmlParserInputPtr input = NULL;
+ xmlErrorPtr to = &xmlLastError;
+ xmlGenericErrorFunc channel;
+ void *data;
+
+ if (code == XML_ERR_OK)
+ return;
+ /*
+ * Formatting the message
+ */
+ if (msg == NULL) {
+ str = (char *) xmlStrdup(BAD_CAST "No error message provided");
+ } else {
+ XML_GET_VAR_STR(msg, str);
+ }
+
+ /*
+ * specific processing if a parser context is provided
+ */
+ if (ctxt != NULL) {
+ if (file == NULL) {
+ input = ctxt->input;
+ if ((input != NULL) && (input->filename == NULL) &&
+ (ctxt->inputNr > 1)) {
+ input = ctxt->inputTab[ctxt->inputNr - 2];
+ }
+ if (input != NULL) {
+ file = input->filename;
+ line = input->line;
+ }
+ }
+ to = &ctxt->lastError;
+ }
+
+ /*
+ * Save the informations about the error
+ */
+ xmlResetError(to);
+ to->domain = domain;
+ to->code = code;
+ to->message = str;
+ to->level = level;
+ if (file != NULL)
+ to->file = (char *) xmlStrdup((const xmlChar *) file);
+ to->line = line;
+ if (str1 != NULL)
+ to->str1 = (char *) xmlStrdup((const xmlChar *) str1);
+ if (str2 != NULL)
+ to->str2 = (char *) xmlStrdup((const xmlChar *) str2);
+ if (str3 != NULL)
+ to->str3 = (char *) xmlStrdup((const xmlChar *) str3);
+ to->int1 = int1;
+ to->int2 = int2;
+
+ /*
+ * Find the callback channel.
+ */
+ if (ctxt != NULL) {
+ if (level == XML_ERR_WARNING)
+ channel = ctxt->sax->warning;
+ else
+ channel = ctxt->sax->error;
+ data = ctxt;
+ } else {
+ channel = xmlGenericError;
+ data = xmlGenericErrorContext;
+ }
+ if (channel == NULL)
+ return;
+
+ if ((channel == xmlParserError) ||
+ (channel == xmlParserWarning) ||
+ (channel == xmlParserValidityError) ||
+ (channel == xmlParserValidityWarning))
+ xmlReportError(ctxt, str);
+ else
+ channel(data, "%s", str);
}
-#endif
/**
* xmlParserError:
@@ -416,3 +626,157 @@ xmlParserValidityWarning(void *ctx, const char *msg, ...)
}
+/************************************************************************
+ * *
+ * Extended Error Handling *
+ * *
+ ************************************************************************/
+
+/**
+ * xmlGetLastError:
+ *
+ * Get the last global error registered. This is per thread if compiled
+ * with thread support.
+ *
+ * Returns NULL if no error occured or a pointer to the error
+ */
+xmlErrorPtr
+xmlGetLastError(void)
+{
+ if (xmlLastError.code == XML_ERR_OK)
+ return (NULL);
+ return (&xmlLastError);
+}
+
+/**
+ * xmlResetError:
+ * @err: pointer to the error.
+ *
+ * Cleanup the error.
+ */
+void
+xmlResetError(xmlErrorPtr err)
+{
+ if (err == NULL)
+ return;
+ if (err->code == XML_ERR_OK)
+ return;
+ if (err->message != NULL)
+ xmlFree(err->message);
+ if (err->file != NULL)
+ xmlFree(err->file);
+ if (err->str1 != NULL)
+ xmlFree(err->str1);
+ if (err->str2 != NULL)
+ xmlFree(err->str2);
+ if (err->str3 != NULL)
+ xmlFree(err->str3);
+ memset(err, 0, sizeof(xmlError));
+ err->code = XML_ERR_OK;
+}
+
+/**
+ * xmlResetLastError:
+ *
+ * Cleanup the last global error registered. For parsing error
+ * this does not change the well-formedness result.
+ */
+void
+xmlResetLastError(void)
+{
+ if (xmlLastError.code == XML_ERR_OK)
+ return;
+ xmlResetError(&xmlLastError);
+}
+
+/**
+ * xmlCtxtGetLastError:
+ * @ctx: an XML parser context
+ *
+ * Get the last parsing error registered.
+ *
+ * Returns NULL if no error occured or a pointer to the error
+ */
+xmlErrorPtr
+xmlCtxtGetLastError(void *ctx)
+{
+ xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
+
+ if (ctxt == NULL)
+ return (NULL);
+ if (ctxt->lastError.code == XML_ERR_OK)
+ return (NULL);
+ return (&ctxt->lastError);
+}
+
+/**
+ * xmlCtxtResetLastError:
+ * @ctx: an XML parser context
+ *
+ * Cleanup the last global error registered. For parsing error
+ * this does not change the well-formedness result.
+ */
+void
+xmlCtxtResetLastError(void *ctx)
+{
+ xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
+
+ if (ctxt == NULL)
+ return;
+ if (ctxt->lastError.code == XML_ERR_OK)
+ return;
+ xmlResetError(&ctxt->lastError);
+}
+
+/**
+ * xmlCopyError:
+ * @from: a source error
+ * @to: a target error
+ *
+ * Save the original error to the new place.
+ *
+ * Returns 0 in case of success and -1 in case of error.
+ */
+int
+xmlCopyError(xmlErrorPtr from, xmlErrorPtr to) {
+ if ((from == NULL) || (to == NULL))
+ return(-1);
+ if (to->message != NULL)
+ xmlFree(to->message);
+ if (to->file != NULL)
+ xmlFree(to->file);
+ if (to->str1 != NULL)
+ xmlFree(to->str1);
+ if (to->str2 != NULL)
+ xmlFree(to->str2);
+ if (to->str3 != NULL)
+ xmlFree(to->str3);
+ to->domain = from->domain;
+ to->code = from->code;
+ to->level = from->level;
+ to->line = from->line;
+ to->int1 = from->int1;
+ to->int2 = from->int2;
+ if (from->message != NULL)
+ to->message = (char *) xmlStrdup((xmlChar *) from->message);
+ else
+ to->message = NULL;
+ if (from->file != NULL)
+ to->file = (char *) xmlStrdup((xmlChar *) from->file);
+ else
+ to->file = NULL;
+ if (from->str1 != NULL)
+ to->str1 = (char *) xmlStrdup((xmlChar *) from->str1);
+ else
+ to->str1 = NULL;
+ if (from->str2 != NULL)
+ to->str2 = (char *) xmlStrdup((xmlChar *) from->str2);
+ else
+ to->str2 = NULL;
+ if (from->str3 != NULL)
+ to->str3 = (char *) xmlStrdup((xmlChar *) from->str3);
+ else
+ to->str3 = NULL;
+ return(0);
+}
+
diff --git a/globals.c b/globals.c
index 140bc899..fd61cf41 100644
--- a/globals.c
+++ b/globals.c
@@ -121,7 +121,7 @@ xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc;
* Returns the copy of the string or NULL in case of error
*/
xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
-#endif
+#endif /* DEBUG_MEMORY_LOCATION || DEBUG_MEMORY */
#include <libxml/threads.h>
#include <libxml/globals.h>
@@ -150,6 +150,7 @@ xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
#undef xmlSubstituteEntitiesDefaultValue
#undef xmlRegisterNodeDefaultValue
#undef xmlDeregisterNodeDefaultValue
+#undef xmlLastError
#undef xmlFree
#undef xmlMalloc
@@ -293,6 +294,7 @@ static xmlGenericErrorFunc xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
*/
void *xmlGenericErrorContext = NULL;
static void *xmlGenericErrorContextThrDef = NULL;
+xmlError xmlLastError;
/*
* output defaults
@@ -524,6 +526,7 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef;
gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
+ memset(&gs->xmlLastError, 0, sizeof(xmlError));
xmlMutexUnlock(xmlThrDefMutex);
}
@@ -628,6 +631,15 @@ __htmlDefaultSAXHandler(void) {
}
#endif
+#undef xmlLastError
+xmlError *
+__xmlLastError(void) {
+ if (IS_MAIN_THREAD)
+ return (&xmlLastError);
+ else
+ return (&xmlGetGlobalState()->xmlLastError);
+}
+
/*
* Everything starting from the line below is
* Automatically generated by build_glob.py.
diff --git a/include/libxml/globals.h b/include/libxml/globals.h
index 6004269a..f380db1b 100644
--- a/include/libxml/globals.h
+++ b/include/libxml/globals.h
@@ -58,8 +58,9 @@ XMLPUBFUN void XMLCALL xmlCleanupGlobals(void);
#undef xmlRealloc
#undef xmlSaveNoEmptyTags
#undef xmlSubstituteEntitiesDefaultValue
-#undef xmlRegisterNodeDefaultValue
-#undef xmlDeregisterNodeDefaultValue
+#undef xmlRegisterNodeDefaultValue
+#undef xmlDeregisterNodeDefaultValue
+#undef xmlLastError
typedef void (*xmlRegisterNodeFunc) (xmlNodePtr node);
typedef void (*xmlDeregisterNodeFunc) (xmlNodePtr node);
@@ -105,6 +106,7 @@ struct _xmlGlobalState
xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue;
xmlMallocFunc xmlMallocAtomic;
+ xmlError xmlLastError;
};
#ifdef __cplusplus
@@ -203,6 +205,13 @@ XMLPUBVAR xmlSAXHandlerV1 htmlDefaultSAXHandler;
#endif
#endif
+XMLPUBFUN xmlError * XMLCALL __xmlLastError(void);
+#ifdef LIBXML_THREAD_ENABLED
+#define xmlLastError \
+(*(__xmlLastError()))
+#else
+XMLPUBVAR xmlError xmlLastError;
+#endif
/*
* Everything starting from the line below is
diff --git a/include/libxml/parser.h b/include/libxml/parser.h
index 911c634a..70ee4b7e 100644
--- a/include/libxml/parser.h
+++ b/include/libxml/parser.h
@@ -15,6 +15,7 @@
#include <libxml/hash.h>
#include <libxml/valid.h>
#include <libxml/entities.h>
+#include <libxml/xmlerror.h>
#ifdef __cplusplus
extern "C" {
@@ -272,6 +273,11 @@ struct _xmlParserCtxt {
xmlNodePtr freeElems; /* List of freed element nodes */
int freeAttrsNr; /* number of freed attributes nodes */
xmlAttrPtr freeAttrs; /* List of freed attributes nodes */
+
+ /*
+ * the complete error informations for the last error.
+ */
+ xmlError lastError;
};
/**
@@ -977,6 +983,8 @@ XMLPUBFUN int XMLCALL
/*
* Parser contexts handling.
*/
+XMLPUBFUN xmlParserCtxtPtr XMLCALL
+ xmlNewParserCtxt (void);
XMLPUBFUN int XMLCALL
xmlInitParserCtxt (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
diff --git a/include/libxml/parserInternals.h b/include/libxml/parserInternals.h
index 080b7284..e42ca396 100644
--- a/include/libxml/parserInternals.h
+++ b/include/libxml/parserInternals.h
@@ -212,8 +212,6 @@ XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlCreateMemoryParserCtxt(const char *buffer,
int size);
XMLPUBFUN xmlParserCtxtPtr XMLCALL
- xmlNewParserCtxt (void);
-XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlCreateEntityParserCtxt(const xmlChar *URL,
const xmlChar *ID,
const xmlChar *base);
diff --git a/include/libxml/xmlerror.h b/include/libxml/xmlerror.h
index 9e1a16dd..ebf6f536 100644
--- a/include/libxml/xmlerror.h
+++ b/include/libxml/xmlerror.h
@@ -7,6 +7,70 @@
extern "C" {
#endif
+/**
+ * xmlErrorLevel:
+ *
+ * Indicates the level of an error
+ */
+typedef enum {
+ XML_ERR_NONE = 0,
+ XML_ERR_WARNING = 1, /* A simple warning */
+ XML_ERR_ERROR = 2, /* A recoverable error */
+ XML_ERR_FATAL = 3 /* A fatal error */
+} xmlErrorLevel;
+
+/**
+ * xmlErrorDomain:
+ *
+ * Indicates where an error may have come from
+ */
+typedef enum {
+ XML_FROM_NONE = 0,
+ XML_FROM_PARSER, /* The XML parser */
+ XML_FROM_NAMESPACE, /* The XML Namespace module */
+ XML_FROM_DTD, /* The XML DTD validation */
+ XML_FROM_HTML, /* The HTML parser */
+ XML_FROM_MEMORY, /* The memory allocator */
+ XML_FROM_OUTPUT, /* The serialization code */
+ XML_FROM_IO, /* The Input/Output stack */
+ XML_FROM_XINCLUDE, /* The XInclude processing */
+ XML_FROM_XPATH, /* The XPath module */
+ XML_FROM_XPOINTER, /* The XPointer module */
+ XML_FROM_REGEXP, /* The regular expressions module */
+ XML_FROM_SCHEMAS, /* The W3C XML Schemas module */
+ XML_FROM_RELAXNG, /* The Relax-NG module */
+ XML_FROM_CATALOG, /* The Catalog module */
+ XML_FROM_C14N, /* The Canonicalization module */
+ XML_FROM_XSLT /* The XSLT engine from libxslt */
+} xmlErrorDomain;
+
+/**
+ * xmlError:
+ *
+ * An XML Error instance.
+ */
+
+typedef struct _xmlError xmlError;
+typedef xmlError *xmlErrorPtr;
+struct _xmlError {
+ int domain; /* What part of the library raised this error */
+ int code; /* The error code, e.g. an xmlParserError */
+ char *message;/* human-readable informative error message */
+ xmlErrorLevel level;/* how consequent is the error */
+ char *file; /* the filename */
+ int line; /* the line number if available */
+ char *str1; /* extra string information */
+ char *str2; /* extra string information */
+ char *str3; /* extra string information */
+ int int1; /* extra number information */
+ int int2; /* extra number information */
+};
+
+/**
+ * xmlParserError:
+ *
+ * This is an error that the XML (or HTML) parser can generate
+ */
typedef enum {
XML_ERR_OK = 0,
XML_ERR_INTERNAL_ERROR,
@@ -141,7 +205,11 @@ typedef enum {
XML_NS_ERR_QNAME,
XML_NS_ERR_ATTRIBUTE_REDEFINED,
XML_ERR_CONDSEC_INVALID_KEYWORD,
- XML_ERR_VERSION_MISSING
+ XML_ERR_VERSION_MISSING,
+ XML_DTD_MIXED_CORRUPT,
+ XML_DTD_NO_DOC,
+ XML_DTD_NO_ELEM_NAME,
+ XML_DTD_NOTATION_REDEFINED
} xmlParserErrors;
/**
@@ -192,6 +260,40 @@ XMLPUBFUN void XMLCALL
XMLPUBFUN void XMLCALL
xmlParserPrintFileContext (xmlParserInputPtr input);
+/*
+ * Extended error information routines
+ */
+XMLPUBFUN xmlErrorPtr XMLCALL
+ xmlGetLastError (void);
+XMLPUBFUN void XMLCALL
+ xmlResetLastError (void);
+XMLPUBFUN xmlErrorPtr XMLCALL
+ xmlCtxtGetLastError (void *ctx);
+XMLPUBFUN void XMLCALL
+ xmlCtxtResetLastError (void *ctx);
+XMLPUBFUN void XMLCALL
+ xmlResetError (xmlErrorPtr err);
+XMLPUBFUN int XMLCALL
+ xmlCopyError (xmlErrorPtr from,
+ xmlErrorPtr to);
+
+/*
+ * Intended for internal use mostly
+ */
+XMLPUBFUN void XMLCALL
+ xmlRaiseError (void *ctx,
+ int domain,
+ int code,
+ xmlErrorLevel level,
+ const char *file,
+ int line,
+ const char *str1,
+ const char *str2,
+ const char *str3,
+ int int1,
+ int int2,
+ const char *msg,
+ ...);
#ifdef __cplusplus
}
#endif
diff --git a/parser.c b/parser.c
index 0a9151a3..7b6c59ae 100644
--- a/parser.c
+++ b/parser.c
@@ -143,22 +143,14 @@ xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
ctxt->instate = XML_PARSER_EOF;
ctxt->disableSAX = 1;
}
- if ((ctxt != NULL) && (ctxt->sax != NULL)
- && (ctxt->sax->error != NULL)) {
- if (extra)
- ctxt->sax->error(ctxt->userData,
- "Memory allocation failed : %s\n", extra);
- else
- ctxt->sax->error(ctxt->userData,
- "Memory allocation failed !\n");
- } else {
- if (extra)
- xmlGenericError(xmlGenericErrorContext,
- "Memory allocation failed : %s\n", extra);
- else
- xmlGenericError(xmlGenericErrorContext,
- "Memory allocation failed !\n");
- }
+ if (extra)
+ xmlRaiseError(ctxt, XML_FROM_PARSER, XML_ERR_NO_MEMORY,
+ XML_ERR_FATAL, NULL, 0, extra, NULL, NULL, 0, 0,
+ "Memory allocation failed : %s\n", extra);
+ else
+ xmlRaiseError(ctxt, XML_FROM_PARSER, XML_ERR_NO_MEMORY,
+ XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0,
+ "Memory allocation failed\n");
}
/**
@@ -174,15 +166,15 @@ xmlErrAttributeDup(xmlParserCtxtPtr ctxt, const xmlChar * prefix,
const xmlChar * localname)
{
ctxt->errNo = XML_ERR_ATTRIBUTE_REDEFINED;
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) {
- if (prefix == NULL)
- ctxt->sax->error(ctxt->userData,
- "Attribute %s redefined\n", localname);
- else
- ctxt->sax->error(ctxt->userData,
- "Attribute %s:%s redefined\n", prefix,
- localname);
- }
+ if (prefix == NULL)
+ xmlRaiseError(ctxt, XML_FROM_PARSER, ctxt->errNo, XML_ERR_FATAL,
+ NULL, 0, (const char *) localname, NULL, NULL, 0, 0,
+ "Attribute %s redefined\n", localname);
+ else
+ xmlRaiseError(ctxt, XML_FROM_PARSER, ctxt->errNo, XML_ERR_FATAL,
+ NULL, 0, (const char *) prefix,
+ (const char *) localname, NULL, 0, 0,
+ "Attribute %s:%s redefined\n", prefix, localname);
ctxt->wellFormed = 0;
if (ctxt->recovery == 0)
ctxt->disableSAX = 1;
@@ -201,13 +193,6 @@ xmlFatalErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char * info)
{
const char *errmsg;
- if (ctxt == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlFatalErr: no context !\n");
- return;
- }
- if ((ctxt->sax == NULL) || (ctxt->sax->error == NULL))
- return;
switch (error) {
case XML_ERR_INVALID_HEX_CHARREF:
errmsg = "CharRef: invalid hexadecimal value\n";
@@ -386,11 +371,8 @@ xmlFatalErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char * info)
errmsg = "Unregistered error message\n";
}
ctxt->errNo = error;
- if (info == NULL) {
- ctxt->sax->error(ctxt->userData, errmsg);
- } else {
- ctxt->sax->error(ctxt->userData, "%s: %s", errmsg, info);
- }
+ xmlRaiseError(ctxt, XML_FROM_PARSER, error, XML_ERR_FATAL,
+ NULL, 0, info, NULL, NULL, 0, 0, errmsg, info);
ctxt->wellFormed = 0;
if (ctxt->recovery == 0)
ctxt->disableSAX = 1;
@@ -407,15 +389,9 @@ xmlFatalErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char * info)
static void
xmlFatalErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *msg)
{
- if (ctxt == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlFatalErr: no context !\n");
- return;
- }
ctxt->errNo = error;
- if ((ctxt->sax == NULL) || (ctxt->sax->error == NULL))
- return;
- ctxt->sax->error(ctxt->userData, msg);
+ xmlRaiseError(ctxt, XML_FROM_PARSER, error, XML_ERR_FATAL,
+ NULL, 0, NULL, NULL, NULL, 0, 0, msg);
ctxt->wellFormed = 0;
if (ctxt->recovery == 0)
ctxt->disableSAX = 1;
@@ -434,15 +410,9 @@ static void
xmlFatalErrMsgInt(xmlParserCtxtPtr ctxt, xmlParserErrors error,
const char *msg, int val)
{
- if (ctxt == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlFatalErr: no context !\n");
- return;
- }
ctxt->errNo = error;
- if ((ctxt->sax == NULL) || (ctxt->sax->error == NULL))
- return;
- ctxt->sax->error(ctxt->userData, msg, val);
+ xmlRaiseError(ctxt, XML_FROM_PARSER, error, XML_ERR_FATAL,
+ NULL, 0, NULL, NULL, NULL, val, 0, msg, val);
ctxt->wellFormed = 0;
if (ctxt->recovery == 0)
ctxt->disableSAX = 1;
@@ -461,15 +431,9 @@ static void
xmlFatalErrMsgStr(xmlParserCtxtPtr ctxt, xmlParserErrors error,
const char *msg, const xmlChar *val)
{
- if (ctxt == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlFatalErr: no context !\n");
- return;
- }
ctxt->errNo = error;
- if ((ctxt->sax == NULL) || (ctxt->sax->error == NULL))
- return;
- ctxt->sax->error(ctxt->userData, msg, val);
+ xmlRaiseError(ctxt, XML_FROM_PARSER, error, XML_ERR_FATAL,
+ NULL, 0, (const char *) val, NULL, NULL, 0, 0, msg, val);
ctxt->wellFormed = 0;
if (ctxt->recovery == 0)
ctxt->disableSAX = 1;
@@ -490,21 +454,11 @@ xmlNsErr(xmlParserCtxtPtr ctxt, xmlParserErrors error,
const char *msg,
const xmlChar *info1, const xmlChar *info2, const xmlChar *info3)
{
- if (ctxt == NULL)
- return;
- if ((ctxt->sax == NULL) || (ctxt->sax->error == NULL))
- return;
-
ctxt->errNo = error;
- if (info1 == NULL) {
- ctxt->sax->error(ctxt->userData, msg);
- } else if (info2 == NULL) {
- ctxt->sax->error(ctxt->userData, msg, info1);
- } else if (info3 == NULL) {
- ctxt->sax->error(ctxt->userData, msg, info1, info2);
- } else {
- ctxt->sax->error(ctxt->userData, msg, info1, info2, info3);
- }
+ xmlRaiseError(ctxt, XML_FROM_NAMESPACE, error, XML_ERR_ERROR,
+ NULL, 0, (const char *) info1, (const char *) info2,
+ (const char *) info3, 0, 0,
+ msg, info1, info2, info3);
ctxt->nsWellFormed = 0;
}
@@ -9411,6 +9365,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
break;
}
+ if (avail < 2)
+ goto done;
cur = ctxt->input->cur[0];
next = ctxt->input->cur[1];
if (cur == 0) {
@@ -12087,6 +12043,7 @@ xmlCleanupParser(void) {
#endif
xmlCleanupThreads();
xmlCleanupGlobals();
+ xmlResetLastError();
xmlParserInitialized = 0;
}
diff --git a/parserInternals.c b/parserInternals.c
index 7b2270c1..8966d8ad 100644
--- a/parserInternals.c
+++ b/parserInternals.c
@@ -2123,6 +2123,19 @@ xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
cur = next;
}
}
+ /*
+ * cleanup the error strings
+ */
+ if (ctxt->lastError.message != NULL)
+ xmlFree(ctxt->lastError.message);
+ if (ctxt->lastError.file != NULL)
+ xmlFree(ctxt->lastError.file);
+ if (ctxt->lastError.str1 != NULL)
+ xmlFree(ctxt->lastError.str1);
+ if (ctxt->lastError.str2 != NULL)
+ xmlFree(ctxt->lastError.str2);
+ if (ctxt->lastError.str3 != NULL)
+ xmlFree(ctxt->lastError.str3);
#ifdef LIBXML_CATALOG_ENABLED
if (ctxt->catalogs != NULL)
diff --git a/python/libxml2class.txt b/python/libxml2class.txt
index 0d1cd4bc..1c6e3985 100644
--- a/python/libxml2class.txt
+++ b/python/libxml2class.txt
@@ -208,6 +208,9 @@ registerDefaultInputCallbacks()
registerDefaultOutputCallbacks()
registerHTTPPostCallbacks()
+# functions from module xmlerror
+resetLastError()
+
# functions from module xmlreader
newTextReaderFilename()
diff --git a/result/VC/PENesting b/result/VC/PENesting
index 627ac317..966689ae 100644
--- a/result/VC/PENesting
+++ b/result/VC/PENesting
@@ -1,6 +1,6 @@
-./test/VC/PENesting:1: error: StartTag: invalid element name
+./test/VC/PENesting:1: parser error : StartTag: invalid element name
<!ENTITY % pe1 "EMPTY> <!ELEMENT e2 EMPTY>">
^
-./test/VC/PENesting:1: error: Extra content at the end of the document
+./test/VC/PENesting:1: parser error : Extra content at the end of the document
<!ENTITY % pe1 "EMPTY> <!ELEMENT e2 EMPTY>">
^
diff --git a/result/VC/PENesting2 b/result/VC/PENesting2
index 3a98366b..c53ead6a 100644
--- a/result/VC/PENesting2
+++ b/result/VC/PENesting2
@@ -1,6 +1,6 @@
-./test/VC/PENesting2:1: error: StartTag: invalid element name
+./test/VC/PENesting2:1: parser error : StartTag: invalid element name
<!ENTITY % p1 "(A|B">
^
-./test/VC/PENesting2:1: error: Extra content at the end of the document
+./test/VC/PENesting2:1: parser error : Extra content at the end of the document
<!ENTITY % p1 "(A|B">
^
diff --git a/result/ent7.sax b/result/ent7.sax
index 40395975..0d5befa8 100644
--- a/result/ent7.sax
+++ b/result/ent7.sax
@@ -1,3 +1,4 @@
+xmlSAXUserParseFile returned error 27
SAX.setDocumentLocator()
SAX.startDocument()
SAX.internalSubset(item, , )
diff --git a/result/namespaces/err_1.xml.err b/result/namespaces/err_1.xml.err
index 3c3918fe..77466cf3 100644
--- a/result/namespaces/err_1.xml.err
+++ b/result/namespaces/err_1.xml.err
@@ -1,3 +1,3 @@
-./test/namespaces/err_1.xml:1: error: Failed to parse QName 'xmlns:'
+./test/namespaces/err_1.xml:1: namespace error : Failed to parse QName 'xmlns:'
<foo xmlns:="http://example.com/"/>
^
diff --git a/result/namespaces/err_10.xml.err b/result/namespaces/err_10.xml.err
index 4e9d3481..a4a4b55e 100644
--- a/result/namespaces/err_10.xml.err
+++ b/result/namespaces/err_10.xml.err
@@ -1,3 +1,3 @@
-./test/namespaces/err_10.xml:1: error: Attribute xmlns redefined
+./test/namespaces/err_10.xml:1: parser error : Attribute xmlns redefined
<tst xmlns="http://example.com/" xmlns="http://example.com/"/>
^
diff --git a/result/namespaces/err_11.xml.err b/result/namespaces/err_11.xml.err
index 32acd938..619bc00d 100644
--- a/result/namespaces/err_11.xml.err
+++ b/result/namespaces/err_11.xml.err
@@ -1,3 +1,3 @@
-./test/namespaces/err_11.xml:1: error: Attribute xmlns:a redefined
+./test/namespaces/err_11.xml:1: parser error : Attribute xmlns:a redefined
<tst xmlns:a="http://example.com/" xmlns:a="http://example.com/"/>
^
diff --git a/result/namespaces/err_2.xml.err b/result/namespaces/err_2.xml.err
index 2619eb5e..031bcff0 100644
--- a/result/namespaces/err_2.xml.err
+++ b/result/namespaces/err_2.xml.err
@@ -1,3 +1,3 @@
-./test/namespaces/err_2.xml:1: error: Failed to parse QName ':'
+./test/namespaces/err_2.xml:1: namespace error : Failed to parse QName ':'
<:/>
^
diff --git a/result/namespaces/err_3.xml.err b/result/namespaces/err_3.xml.err
index 8a54afc0..a18fe9f7 100644
--- a/result/namespaces/err_3.xml.err
+++ b/result/namespaces/err_3.xml.err
@@ -1,3 +1,3 @@
-./test/namespaces/err_3.xml:1: error: Failed to parse QName ':foo'
+./test/namespaces/err_3.xml:1: namespace error : Failed to parse QName ':foo'
<:foo/>
^
diff --git a/result/namespaces/err_4.xml.err b/result/namespaces/err_4.xml.err
index 1fdbccc0..c9b0c02a 100644
--- a/result/namespaces/err_4.xml.err
+++ b/result/namespaces/err_4.xml.err
@@ -1,3 +1,3 @@
-./test/namespaces/err_4.xml:1: error: Failed to parse QName 'f:'
+./test/namespaces/err_4.xml:1: namespace error : Failed to parse QName 'f:'
<f: xmlns:f="http://example.com/foo"/>
^
diff --git a/result/namespaces/err_5.xml.err b/result/namespaces/err_5.xml.err
index 6d863be6..432a2e16 100644
--- a/result/namespaces/err_5.xml.err
+++ b/result/namespaces/err_5.xml.err
@@ -1,3 +1,3 @@
-./test/namespaces/err_5.xml:1: error: Failed to parse QName 'f:a:'
+./test/namespaces/err_5.xml:1: namespace error : Failed to parse QName 'f:a:'
<f:a: xmlns:f="http://example.com/foo"/>
^
diff --git a/result/namespaces/err_6.xml.err b/result/namespaces/err_6.xml.err
index 0bdfd2cd..47c14fde 100644
--- a/result/namespaces/err_6.xml.err
+++ b/result/namespaces/err_6.xml.err
@@ -1,3 +1,3 @@
-./test/namespaces/err_6.xml:1: error: Failed to parse QName 'f:a:'
+./test/namespaces/err_6.xml:1: namespace error : Failed to parse QName 'f:a:'
<f:a:b xmlns:f="http://example.com/foo"/>
^
diff --git a/result/namespaces/err_7.xml.err b/result/namespaces/err_7.xml.err
index 147fc3c6..e7ff95bc 100644
--- a/result/namespaces/err_7.xml.err
+++ b/result/namespaces/err_7.xml.err
@@ -1,3 +1,3 @@
-./test/namespaces/err_7.xml:1: error: Namespace prefix f on foo is not defined
+./test/namespaces/err_7.xml:1: namespace error : Namespace prefix f on foo is not defined
<f:foo/>
^
diff --git a/result/namespaces/err_8.xml.err b/result/namespaces/err_8.xml.err
index e5f44169..e6735d7b 100644
--- a/result/namespaces/err_8.xml.err
+++ b/result/namespaces/err_8.xml.err
@@ -1,3 +1,3 @@
-./test/namespaces/err_8.xml:1: error: xml namespace prefix mapped to wrong URI
+./test/namespaces/err_8.xml:1: namespace error : xml namespace prefix mapped to wrong URI
<tst xmlns:xml="http://example.com/"/>
^
diff --git a/result/namespaces/err_9.xml.err b/result/namespaces/err_9.xml.err
index 6a0d0892..d1837a12 100644
--- a/result/namespaces/err_9.xml.err
+++ b/result/namespaces/err_9.xml.err
@@ -1,3 +1,3 @@
-./test/namespaces/err_9.xml:2: error: Namespaced Attribute err in 'http://example.com/' redefined
+./test/namespaces/err_9.xml:2: namespace error : Namespaced Attribute err in 'http://example.com/' redefined
a:err="1" b:err="2"/>
^
diff --git a/result/valid/t4.dtd.err b/result/valid/t4.dtd.err
index 9705f10a..23a32588 100644
--- a/result/valid/t4.dtd.err
+++ b/result/valid/t4.dtd.err
@@ -1,6 +1,6 @@
-./test/valid/t4.dtd:1: error: StartTag: invalid element name
+./test/valid/t4.dtd:1: parser error : StartTag: invalid element name
<!ENTITY % percent "&#x25;">
^
-./test/valid/t4.dtd:1: error: Extra content at the end of the document
+./test/valid/t4.dtd:1: parser error : Extra content at the end of the document
<!ENTITY % percent "&#x25;">
^
diff --git a/result/valid/t4a.dtd.err b/result/valid/t4a.dtd.err
index 65546d6d..48cdd5f9 100644
--- a/result/valid/t4a.dtd.err
+++ b/result/valid/t4a.dtd.err
@@ -1,6 +1,6 @@
-./test/valid/t4a.dtd:1: error: StartTag: invalid element name
+./test/valid/t4a.dtd:1: parser error : StartTag: invalid element name
<!ENTITY % percent "&#x25;">
^
-./test/valid/t4a.dtd:1: error: Extra content at the end of the document
+./test/valid/t4a.dtd:1: parser error : Extra content at the end of the document
<!ENTITY % percent "&#x25;">
^
diff --git a/result/valid/t6.dtd.err b/result/valid/t6.dtd.err
index 29b171a2..6e84d68a 100644
--- a/result/valid/t6.dtd.err
+++ b/result/valid/t6.dtd.err
@@ -1,6 +1,6 @@
-./test/valid/t6.dtd:1: error: StartTag: invalid element name
+./test/valid/t6.dtd:1: parser error : StartTag: invalid element name
<!ENTITY % xdef "def">
^
-./test/valid/t6.dtd:1: error: Extra content at the end of the document
+./test/valid/t6.dtd:1: parser error : Extra content at the end of the document
<!ENTITY % xdef "def">
^
diff --git a/result/valid/t8.xml.err b/result/valid/t8.xml.err
index 63197829..fa563161 100644
--- a/result/valid/t8.xml.err
+++ b/result/valid/t8.xml.err
@@ -1,16 +1,15 @@
-Entity: line 1: error: internal error: xmlParseInternalSubset: error detected in Markup declaration
- %defroot;
+Entity: line 1: parser error : internal error %defroot;
^
Entity: line 1:
&lt;!ELEMENT root (middle) >
^
-Entity: line 1: error: DOCTYPE improperly terminated
+Entity: line 1: parser error : DOCTYPE improperly terminated
%defroot;
^
Entity: line 1:
&lt;!ELEMENT root (middle) >
^
-Entity: line 1: error: Start tag expected, '<' not found
+Entity: line 1: parser error : Start tag expected, '<' not found
%defroot;
^
Entity: line 1:
diff --git a/result/valid/t8a.xml.err b/result/valid/t8a.xml.err
index 63197829..fa563161 100644
--- a/result/valid/t8a.xml.err
+++ b/result/valid/t8a.xml.err
@@ -1,16 +1,15 @@
-Entity: line 1: error: internal error: xmlParseInternalSubset: error detected in Markup declaration
- %defroot;
+Entity: line 1: parser error : internal error %defroot;
^
Entity: line 1:
&lt;!ELEMENT root (middle) >
^
-Entity: line 1: error: DOCTYPE improperly terminated
+Entity: line 1: parser error : DOCTYPE improperly terminated
%defroot;
^
Entity: line 1:
&lt;!ELEMENT root (middle) >
^
-Entity: line 1: error: Start tag expected, '<' not found
+Entity: line 1: parser error : Start tag expected, '<' not found
%defroot;
^
Entity: line 1:
diff --git a/result/xml2.sax b/result/xml2.sax
index 04d7089b..e8484733 100644
--- a/result/xml2.sax
+++ b/result/xml2.sax
@@ -1,3 +1,4 @@
+xmlSAXUserParseFile returned error 27
SAX.setDocumentLocator()
SAX.startDocument()
SAX.internalSubset(test, , )
diff --git a/valid.c b/valid.c
index 7949fe9a..f8715320 100644
--- a/valid.c
+++ b/valid.c
@@ -37,12 +37,60 @@ static xmlElementPtr xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name,
"Unimplemented block at %s:%d\n", \
__FILE__, __LINE__);
+/************************************************************************
+ * *
+ * Error handling routines *
+ * *
+ ************************************************************************/
+
#define VERROR \
if ((ctxt != NULL) && (ctxt->error != NULL)) ctxt->error
#define VWARNING \
if ((ctxt != NULL) && (ctxt->warning != NULL)) ctxt->warning
+/**
+ * xmlErrMemory:
+ * @ctxt: an XML validation parser context
+ * @extra: extra informations
+ *
+ * Handle an out of memory error
+ */
+static void
+xmlErrMemory(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED, const char *extra)
+{
+ if (extra)
+ xmlRaiseError(NULL, XML_FROM_DTD, XML_ERR_NO_MEMORY,
+ XML_ERR_FATAL, NULL, 0, extra, NULL, NULL, 0, 0,
+ "Memory allocation failed : %s\n", extra);
+ else
+ xmlRaiseError(NULL, XML_FROM_DTD, XML_ERR_NO_MEMORY,
+ XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0,
+ "Memory allocation failed\n");
+}
+
+/**
+ * xmlErrValid:
+ * @ctxt: an XML validation parser context
+ * @
+ * @extra: extra informations
+ *
+ * Handle a validation error
+ */
+static void
+xmlErrValid(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlParserErrors error,
+ const char *msg, const char *extra)
+{
+ if (extra)
+ xmlRaiseError(NULL, XML_FROM_DTD, error,
+ XML_ERR_FATAL, NULL, 0, extra, NULL, NULL, 0, 0,
+ msg, extra);
+ else
+ xmlRaiseError(NULL, XML_FROM_DTD, error,
+ XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0,
+ msg);
+}
+
#ifdef LIBXML_REGEXP_ENABLED
/*
@@ -68,7 +116,7 @@ vstateVPush(xmlValidCtxtPtr ctxt, xmlElementPtr elemDecl, xmlNodePtr node) {
ctxt->vstateTab = (xmlValidState *) xmlMalloc(ctxt->vstateMax *
sizeof(ctxt->vstateTab[0]));
if (ctxt->vstateTab == NULL) {
- VERROR(ctxt->userData, "malloc failed !n");
+ xmlErrMemory(ctxt, "malloc failed");
return(-1);
}
}
@@ -79,7 +127,7 @@ vstateVPush(xmlValidCtxtPtr ctxt, xmlElementPtr elemDecl, xmlNodePtr node) {
tmp = (xmlValidState *) xmlRealloc(ctxt->vstateTab,
2 * ctxt->vstateMax * sizeof(ctxt->vstateTab[0]));
if (tmp == NULL) {
- VERROR(ctxt->userData, "realloc failed !n");
+ xmlErrMemory(ctxt, "realloc failed");
return(-1);
}
ctxt->vstateMax *= 2;
@@ -173,8 +221,7 @@ vstateVPush(xmlValidCtxtPtr ctxt, xmlElementContentPtr cont,
ctxt->vstateTab = (xmlValidState *) xmlMalloc(
ctxt->vstateMax * sizeof(ctxt->vstateTab[0]));
if (ctxt->vstateTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc failed !n");
+ xmlErrMemory(ctxt, "malloc failed");
return(-1);
}
}
@@ -184,8 +231,7 @@ vstateVPush(xmlValidCtxtPtr ctxt, xmlElementContentPtr cont,
tmp = (xmlValidState *) xmlRealloc(ctxt->vstateTab,
2 * ctxt->vstateMax * sizeof(ctxt->vstateTab[0]));
if (tmp == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "realloc failed !n");
+ xmlErrMemory(ctxt, "malloc failed");
return(-1);
}
ctxt->vstateMax *= 2;
@@ -233,7 +279,7 @@ nodeVPush(xmlValidCtxtPtr ctxt, xmlNodePtr value)
(xmlNodePtr *) xmlMalloc(ctxt->nodeMax *
sizeof(ctxt->nodeTab[0]));
if (ctxt->nodeTab == NULL) {
- xmlGenericError(xmlGenericErrorContext, "malloc failed !\n");
+ xmlErrMemory(ctxt, "malloc failed");
ctxt->nodeMax = 0;
return (0);
}
@@ -243,7 +289,7 @@ nodeVPush(xmlValidCtxtPtr ctxt, xmlNodePtr value)
tmp = (xmlNodePtr *) xmlRealloc(ctxt->nodeTab,
ctxt->nodeMax * 2 * sizeof(ctxt->nodeTab[0]));
if (tmp == NULL) {
- xmlGenericError(xmlGenericErrorContext, "realloc failed !\n");
+ xmlErrMemory(ctxt, "realloc failed");
return (0);
}
ctxt->nodeMax *= 2;
@@ -688,12 +734,13 @@ xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, xmlElementPtr elem) {
*
* Returns NULL if not, otherwise the new validation context structure
*/
-xmlValidCtxtPtr
-xmlNewValidCtxt(void) {
+xmlValidCtxtPtr xmlNewValidCtxt(void) {
xmlValidCtxtPtr ret;
- if ((ret = xmlMalloc(sizeof (xmlValidCtxt))) == NULL)
+ if ((ret = xmlMalloc(sizeof (xmlValidCtxt))) == NULL) {
+ xmlErrMemory(NULL, "malloc failed");
return (NULL);
+ }
(void) memset(ret, 0, sizeof (xmlValidCtxt));
@@ -729,27 +776,29 @@ xmlNewElementContent(const xmlChar *name, xmlElementContentType type) {
switch(type) {
case XML_ELEMENT_CONTENT_ELEMENT:
if (name == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewElementContent : name == NULL !\n");
+ xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR,
+ "xmlNewElementContent : name == NULL !\n",
+ NULL);
}
break;
case XML_ELEMENT_CONTENT_PCDATA:
case XML_ELEMENT_CONTENT_SEQ:
case XML_ELEMENT_CONTENT_OR:
if (name != NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewElementContent : name != NULL !\n");
+ xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR,
+ "xmlNewElementContent : name != NULL !\n",
+ NULL);
}
break;
default:
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewElementContent: unknown type %d\n", type);
+ xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR,
+ "Internal: ELEMENT content corrupted invalid type\n",
+ NULL);
return(NULL);
}
ret = (xmlElementContentPtr) xmlMalloc(sizeof(xmlElementContent));
if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewElementContent : out of memory!\n");
+ xmlErrMemory(NULL, "malloc failed");
return(NULL);
}
memset(ret, 0, sizeof(xmlElementContent));
@@ -784,8 +833,7 @@ xmlCopyElementContent(xmlElementContentPtr cur) {
if (cur == NULL) return(NULL);
ret = xmlNewElementContent((xmlChar *) cur->name, cur->type);
if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlCopyElementContent : out of memory\n");
+ xmlErrMemory(NULL, "malloc failed");
return(NULL);
}
if (cur->prefix != NULL)
@@ -816,8 +864,9 @@ xmlFreeElementContent(xmlElementContentPtr cur) {
case XML_ELEMENT_CONTENT_OR:
break;
default:
- xmlGenericError(xmlGenericErrorContext,
- "xmlFreeElementContent : type %d\n", cur->type);
+ xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR,
+ "Internal: ELEMENT content corrupted invalid type\n",
+ NULL);
return;
}
if (cur->c1 != NULL) xmlFreeElementContent(cur->c1);
@@ -877,9 +926,9 @@ xmlDumpElementContent(xmlBufferPtr buf, xmlElementContentPtr content, int glob)
xmlDumpElementContent(buf, content->c2, 0);
break;
default:
- xmlGenericError(xmlGenericErrorContext,
- "xmlDumpElementContent: unknown type %d\n",
- content->type);
+ xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR,
+ "Internal: ELEMENT content corrupted invalid type\n",
+ NULL);
}
if (glob)
xmlBufferWriteChar(buf, ")");
@@ -1077,47 +1126,48 @@ xmlAddElementDecl(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED,
xmlChar *ns, *uqname;
if (dtd == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddElementDecl: dtd == NULL\n");
return(NULL);
}
if (name == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddElementDecl: name == NULL\n");
return(NULL);
}
switch (type) {
case XML_ELEMENT_TYPE_EMPTY:
if (content != NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddElementDecl: content != NULL for EMPTY\n");
+ xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR,
+ "xmlAddElementDecl: content != NULL for EMPTY\n",
+ NULL);
return(NULL);
}
break;
case XML_ELEMENT_TYPE_ANY:
if (content != NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddElementDecl: content != NULL for ANY\n");
+ xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR,
+ "xmlAddElementDecl: content != NULL for ANY\n",
+ NULL);
return(NULL);
}
break;
case XML_ELEMENT_TYPE_MIXED:
if (content == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddElementDecl: content == NULL for MIXED\n");
+ xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR,
+ "xmlAddElementDecl: content == NULL for MIXED\n",
+ NULL);
return(NULL);
}
break;
case XML_ELEMENT_TYPE_ELEMENT:
if (content == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddElementDecl: content == NULL for ELEMENT\n");
+ xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR,
+ "xmlAddElementDecl: content == NULL for ELEMENT\n",
+ NULL);
return(NULL);
}
break;
default:
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddElementDecl: unknown type %d\n", type);
+ xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR,
+ "Internal: ELEMENT decl corrupted invalid type\n",
+ NULL);
return(NULL);
}
@@ -1137,8 +1187,8 @@ xmlAddElementDecl(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED,
dtd->elements = (void *) table;
}
if (table == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddElementDecl: Table creation failed!\n");
+ xmlErrMemory(ctxt,
+ "xmlAddElementDecl: Table creation failed!\n");
if (uqname != NULL)
xmlFree(uqname);
if (ns != NULL)
@@ -1182,8 +1232,7 @@ xmlAddElementDecl(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED,
} else {
ret = (xmlElementPtr) xmlMalloc(sizeof(xmlElement));
if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddElementDecl: out of memory\n");
+ xmlErrMemory(ctxt, "malloc failed");
if (uqname != NULL)
xmlFree(uqname);
if (ns != NULL)
@@ -1198,8 +1247,7 @@ xmlAddElementDecl(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED,
*/
ret->name = xmlStrdup(name);
if (ret->name == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddElementDecl: out of memory\n");
+ xmlErrMemory(ctxt, "malloc failed");
if (uqname != NULL)
xmlFree(uqname);
if (ns != NULL)
@@ -1281,8 +1329,7 @@ xmlCopyElement(xmlElementPtr elem) {
cur = (xmlElementPtr) xmlMalloc(sizeof(xmlElement));
if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlCopyElement: out of memory !\n");
+ xmlErrMemory(NULL, "malloc failed");
return(NULL);
}
memset(cur, 0, sizeof(xmlElement));
@@ -1370,9 +1417,9 @@ xmlDumpElementDecl(xmlBufferPtr buf, xmlElementPtr elem) {
xmlBufferWriteChar(buf, ">\n");
break;
default:
- xmlGenericError(xmlGenericErrorContext,
- "xmlDumpElementDecl: internal: unknown type %d\n",
- elem->etype);
+ xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR,
+ "Internal: ELEMENT struct corrupted invalid type\n",
+ NULL);
}
}
@@ -1404,9 +1451,7 @@ xmlCreateEnumeration(const xmlChar *name) {
ret = (xmlEnumerationPtr) xmlMalloc(sizeof(xmlEnumeration));
if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlCreateEnumeration : xmlMalloc(%ld) failed\n",
- (long)sizeof(xmlEnumeration));
+ xmlErrMemory(NULL, "malloc failed");
return(NULL);
}
memset(ret, 0, sizeof(xmlEnumeration));
@@ -1524,13 +1569,9 @@ xmlScanAttributeDecl(xmlDtdPtr dtd, const xmlChar *elem) {
xmlAttributeTablePtr table;
if (dtd == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlScanAttributeDecl: dtd == NULL\n");
return(NULL);
}
if (elem == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlScanAttributeDecl: elem == NULL\n");
return(NULL);
}
table = (xmlAttributeTablePtr) dtd->attributes;
@@ -1626,20 +1667,14 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED,
xmlElementPtr elemDef;
if (dtd == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddAttributeDecl: dtd == NULL\n");
xmlFreeEnumeration(tree);
return(NULL);
}
if (name == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddAttributeDecl: name == NULL\n");
xmlFreeEnumeration(tree);
return(NULL);
}
if (elem == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddAttributeDecl: elem == NULL\n");
xmlFreeEnumeration(tree);
return(NULL);
}
@@ -1670,8 +1705,9 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED,
case XML_ATTRIBUTE_NOTATION:
break;
default:
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddAttributeDecl: unknown type %d\n", type);
+ xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR,
+ "Internal: ATTRIBUTE struct corrupted invalid type\n",
+ NULL);
xmlFreeEnumeration(tree);
return(NULL);
}
@@ -1705,16 +1741,15 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED,
dtd->attributes = (void *) table;
}
if (table == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddAttributeDecl: Table creation failed!\n");
+ xmlErrMemory(ctxt,
+ "xmlAddAttributeDecl: Table creation failed!\n");
return(NULL);
}
ret = (xmlAttributePtr) xmlMalloc(sizeof(xmlAttribute));
if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddAttributeDecl: out of memory\n");
+ xmlErrMemory(ctxt, "malloc failed");
return(NULL);
}
memset(ret, 0, sizeof(xmlAttribute));
@@ -1837,8 +1872,7 @@ xmlCopyAttribute(xmlAttributePtr attr) {
cur = (xmlAttributePtr) xmlMalloc(sizeof(xmlAttribute));
if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlCopyAttribute: out of memory !\n");
+ xmlErrMemory(NULL, "malloc failed");
return(NULL);
}
memset(cur, 0, sizeof(xmlAttribute));
@@ -1925,9 +1959,9 @@ xmlDumpAttributeDecl(xmlBufferPtr buf, xmlAttributePtr attr) {
xmlDumpEnumeration(buf, attr->tree);
break;
default:
- xmlGenericError(xmlGenericErrorContext,
- "xmlDumpAttributeDecl: internal: unknown type %d\n",
- attr->atype);
+ xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR,
+ "Internal: ATTRIBUTE struct corrupted invalid type\n",
+ NULL);
}
switch (attr->def) {
case XML_ATTRIBUTE_NONE:
@@ -1942,9 +1976,9 @@ xmlDumpAttributeDecl(xmlBufferPtr buf, xmlAttributePtr attr) {
xmlBufferWriteChar(buf, " #FIXED");
break;
default:
- xmlGenericError(xmlGenericErrorContext,
- "xmlDumpAttributeDecl: internal: unknown default %d\n",
- attr->def);
+ xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR,
+ "Internal: ATTRIBUTE struct corrupted invalid def\n",
+ NULL);
}
if (attr->defaultValue != NULL) {
xmlBufferWriteChar(buf, " ");
@@ -2023,18 +2057,12 @@ xmlAddNotationDecl(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlDtdPtr dtd,
xmlNotationTablePtr table;
if (dtd == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddNotationDecl: dtd == NULL\n");
return(NULL);
}
if (name == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddNotationDecl: name == NULL\n");
return(NULL);
}
if ((PublicID == NULL) && (SystemID == NULL)) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddNotationDecl: no PUBLIC ID nor SYSTEM ID\n");
return(NULL);
}
@@ -2045,15 +2073,14 @@ xmlAddNotationDecl(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlDtdPtr dtd,
if (table == NULL)
dtd->notations = table = xmlCreateNotationTable();
if (table == NULL) {
- xmlGenericError(xmlGenericErrorContext,
+ xmlErrMemory(ctxt,
"xmlAddNotationDecl: Table creation failed!\n");
return(NULL);
}
ret = (xmlNotationPtr) xmlMalloc(sizeof(xmlNotation));
if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddNotationDecl: out of memory\n");
+ xmlErrMemory(ctxt, "malloc failed");
return(NULL);
}
memset(ret, 0, sizeof(xmlNotation));
@@ -2073,8 +2100,9 @@ xmlAddNotationDecl(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlDtdPtr dtd,
*/
if (xmlHashAddEntry(table, name, ret)) {
#ifdef LIBXML_VALID_ENABLED
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddNotationDecl: %s already defined\n", name);
+ xmlErrValid(NULL, XML_DTD_NOTATION_REDEFINED,
+ "xmlAddNotationDecl: %s already defined\n",
+ (const char *) name);
#endif /* LIBXML_VALID_ENABLED */
xmlFreeNotation(ret);
return(NULL);
@@ -2108,8 +2136,7 @@ xmlCopyNotation(xmlNotationPtr nota) {
cur = (xmlNotationPtr) xmlMalloc(sizeof(xmlNotation));
if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlCopyNotation: out of memory !\n");
+ xmlErrMemory(NULL, "malloc failed");
return(NULL);
}
if (nota->name != NULL)
@@ -2233,18 +2260,12 @@ xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value,
xmlIDTablePtr table;
if (doc == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddID: doc == NULL\n");
return(NULL);
}
if (value == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddID: value == NULL\n");
return(NULL);
}
if (attr == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddID: attr == NULL\n");
return(NULL);
}
@@ -2255,15 +2276,14 @@ xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value,
if (table == NULL)
doc->ids = table = xmlCreateIDTable();
if (table == NULL) {
- xmlGenericError(xmlGenericErrorContext,
+ xmlErrMemory(ctxt,
"xmlAddID: Table creation failed!\n");
return(NULL);
}
ret = (xmlIDPtr) xmlMalloc(sizeof(xmlID));
if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddID: out of memory\n");
+ xmlErrMemory(ctxt, "malloc failed");
return(NULL);
}
@@ -2419,12 +2439,10 @@ xmlGetID(xmlDocPtr doc, const xmlChar *ID) {
xmlIDPtr id;
if (doc == NULL) {
- xmlGenericError(xmlGenericErrorContext, "xmlGetID: doc == NULL\n");
return(NULL);
}
if (ID == NULL) {
- xmlGenericError(xmlGenericErrorContext, "xmlGetID: ID == NULL\n");
return(NULL);
}
@@ -2548,18 +2566,12 @@ xmlAddRef(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlDocPtr doc, const xmlChar *v
xmlListPtr ref_list;
if (doc == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddRef: doc == NULL\n");
return(NULL);
}
if (value == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddRef: value == NULL\n");
return(NULL);
}
if (attr == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddRef: attr == NULL\n");
return(NULL);
}
@@ -2570,15 +2582,14 @@ xmlAddRef(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlDocPtr doc, const xmlChar *v
if (table == NULL)
doc->refs = table = xmlCreateRefTable();
if (table == NULL) {
- xmlGenericError(xmlGenericErrorContext,
+ xmlErrMemory(ctxt,
"xmlAddRef: Table creation failed!\n");
return(NULL);
}
ret = (xmlRefPtr) xmlMalloc(sizeof(xmlRef));
if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddRef: out of memory\n");
+ xmlErrMemory(ctxt, "malloc failed");
return(NULL);
}
@@ -2607,14 +2618,16 @@ xmlAddRef(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlDocPtr doc, const xmlChar *v
if (NULL == (ref_list = xmlHashLookup(table, value))) {
if (NULL == (ref_list = xmlListCreate(xmlFreeRef, NULL))) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddRef: Reference list creation failed!\n");
+ xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR,
+ "xmlAddRef: Reference list creation failed!\n",
+ NULL);
return(NULL);
}
if (xmlHashAddEntry(table, value, ref_list) < 0) {
xmlListDelete(ref_list);
- xmlGenericError(xmlGenericErrorContext,
- "xmlAddRef: Reference list insertion failed!\n");
+ xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR,
+ "xmlAddRef: Reference list insertion failed!\n",
+ NULL);
return(NULL);
}
}
@@ -2739,12 +2752,10 @@ xmlGetRefs(xmlDocPtr doc, const xmlChar *ID) {
xmlRefTablePtr table;
if (doc == NULL) {
- xmlGenericError(xmlGenericErrorContext, "xmlGetRefs: doc == NULL\n");
return(NULL);
}
if (ID == NULL) {
- xmlGenericError(xmlGenericErrorContext, "xmlGetRefs: ID == NULL\n");
return(NULL);
}
@@ -2820,8 +2831,7 @@ xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name, int create) {
dtd->elements = (void *) table;
}
if (table == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlGetDtdElementDesc2: Table creation failed!\n");
+ xmlErrMemory(NULL, "element table allocation failed");
return(NULL);
}
}
@@ -2834,8 +2844,7 @@ xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name, int create) {
if ((cur == NULL) && (create)) {
cur = (xmlElementPtr) xmlMalloc(sizeof(xmlElement));
if (cur == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlGetDtdElementDesc2: out of memory\n");
+ xmlErrMemory(NULL, "malloc failed");
return(NULL);
}
memset(cur, 0, sizeof(xmlElement));
@@ -4842,8 +4851,7 @@ fail:
ctxt->vstateTab = (xmlValidState *) xmlMalloc(
ctxt->vstateMax * sizeof(ctxt->vstateTab[0]));
if (ctxt->vstateTab == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "malloc failed !n");
+ xmlErrMemory(ctxt, "malloc failed");
return(-1);
}
/*
@@ -4898,8 +4906,7 @@ fail:
*/
tmp = (xmlNodePtr) xmlMalloc(sizeof(xmlNode));
if (tmp == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlValidateElementContent : malloc failed\n");
+ xmlErrMemory(ctxt, "malloc failed");
xmlFreeNodeList(repl);
ret = -1;
goto done;
@@ -5117,9 +5124,9 @@ xmlValidateCheckMixed(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED,
} else if ((cont->type != XML_ELEMENT_CONTENT_OR) ||
(cont->c1 == NULL) ||
(cont->c1->type != XML_ELEMENT_CONTENT_PCDATA)){
- /* Internal error !!! */
- xmlGenericError(xmlGenericErrorContext,
- "Internal: MIXED struct bad\n");
+ xmlErrValid(NULL, XML_DTD_MIXED_CORRUPT,
+ "Internal: MIXED struct corrupted\n",
+ NULL);
break;
}
cont = cont->c2;
@@ -5141,9 +5148,9 @@ xmlValidateCheckMixed(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED,
} else if ((cont->type != XML_ELEMENT_CONTENT_OR) ||
(cont->c1 == NULL) ||
(cont->c1->type != XML_ELEMENT_CONTENT_PCDATA)){
- /* Internal error !!! */
- xmlGenericError(xmlGenericErrorContext,
- "Internal: MIXED struct bad\n");
+ xmlErrValid(ctxt, XML_DTD_MIXED_CORRUPT,
+ "Internal: MIXED struct corrupted\n",
+ NULL);
break;
}
cont = cont->c2;
@@ -5605,9 +5612,9 @@ xmlValidateOneElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
} else if ((cont->type != XML_ELEMENT_CONTENT_OR) ||
(cont->c1 == NULL) ||
(cont->c1->type != XML_ELEMENT_CONTENT_PCDATA)){
- /* Internal error !!! */
- xmlGenericError(xmlGenericErrorContext,
- "Internal: MIXED struct bad\n");
+ xmlErrValid(NULL, XML_DTD_MIXED_CORRUPT,
+ "Internal: MIXED struct corrupted\n",
+ NULL);
break;
}
cont = cont->c2;
@@ -5628,9 +5635,9 @@ xmlValidateOneElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
} else if ((cont->type != XML_ELEMENT_CONTENT_OR) ||
(cont->c1 == NULL) ||
(cont->c1->type != XML_ELEMENT_CONTENT_PCDATA)) {
- /* Internal error !!! */
- xmlGenericError(xmlGenericErrorContext,
- "Internal: MIXED struct bad\n");
+ xmlErrValid(ctxt, XML_DTD_MIXED_CORRUPT,
+ "Internal: MIXED struct corrupted\n",
+ NULL);
break;
}
cont = cont->c2;
@@ -6081,8 +6088,8 @@ xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt, xmlDocPtr doc) {
xmlRefTablePtr table;
if (doc == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlValidateDocumentFinal: doc == NULL\n");
+ xmlErrValid(ctxt, XML_DTD_NO_DOC,
+ "xmlValidateDocumentFinal: doc == NULL\n", NULL);
return(0);
}