applied patch from Patrick Welche provided in bug #125432 , future

* libxml.m4: applied patch from Patrick Welche provided in
  bug #125432 , future proofing the .m4 file.
* parser.c: resetting the context should also reset the error
* TODO: problem of conformance w.r.t. E20 was raised in the
  XML Core telconf and libxml2 isn't conformant there.
Daniel
diff --git a/ChangeLog b/ChangeLog
index 24484cd..d85b25d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Fri Oct 24 23:08:17 CEST 2003 Daniel Veillard <daniel@veillard.com>
+
+	* libxml.m4: applied patch from Patrick Welche provided in
+	  bug #125432 , future proofing the .m4 file.
+	* parser.c: resetting the context should also reset the error
+	* TODO: problem of conformance w.r.t. E20 was raised in the
+	  XML Core telconf and libxml2 isn't conformant there.
+
 Wed Oct 22 14:33:05 CEST 2003 Daniel Veillard <daniel@veillard.com>
 
 	* xmlwriter.c: applied patch from Alfred Mickautsch fixing #125180
diff --git a/TODO b/TODO
index 7073493..69c0f15 100644
--- a/TODO
+++ b/TODO
@@ -17,6 +17,54 @@
 TODO:
 =====
 
+- E20
+[17:21:38] <PGrosso> DV, you have an action to Check what your parser does on E20. Have you done this?
+[17:22:42] <PGrosso> DV, ref: http://www.w3.org/XML/xml-V10-2e-errata#E20
+[17:39:07] <DV> paphio:~/XML -> cat tst.xml
+[17:39:07] <DV> <!DOCTYPE test [
+[17:39:07] <DV> <!ELEMENT test EMPTY>
+[17:39:07] <DV> <!ATTLIST test attr1 NMTOKENS #IMPLIED>
+[17:39:07] <DV> <!ATTLIST test attr2 NMTOKENS #IMPLIED>
+[17:39:07] <DV> <!ATTLIST test attr3 NMTOKENS #IMPLIED>
+[17:39:07] <DV> ]>
+[17:39:07] <DV> <test
+[17:39:07] <DV>    attr1=" a b "
+[17:39:07] <DV>    attr2=" a&#x20;b "
+[17:39:07] <DV>    attr3=" a&#x9;b "
+[17:39:07] <DV>    />
+[17:39:07] <DV> paphio:~/XML -> xmllint --valid tst.xml
+[17:39:07] <DV> <?xml version="1.0"?>
+[17:39:07] <DV> <!DOCTYPE test [
+[17:39:07] <DV> <!ELEMENT test EMPTY>
+[17:39:07] <DV> <!ATTLIST test attr1 NMTOKENS #IMPLIED>
+[17:39:07] <DV> <!ATTLIST test attr2 NMTOKENS #IMPLIED>
+[17:39:07] <DV> <!ATTLIST test attr3 NMTOKENS #IMPLIED>
+[17:39:07] <DV> ]>
+[17:39:07] <DV> <test attr1="a b" attr2="a b" attr3="a&#9;b"/>
+[17:39:07] <DV> paphio:~/XML ->
+[17:39:16] <DV> I think it's okay
+[17:40:28] <PGrosso> DV, so you're saying that your parser implements E20 correctly, right?
+[17:40:48] <DV> assuming I understood E20 point correctly, yes
+[17:41:15] <DV> and that's because I'm unsure taht I pasted the est document and result
+[17:41:25] <DV> s/ est/ test/
+[17:48:56] <richard> does your parser say that document is invalid?
+[17:49:03] <DV> richard: did I understood it ?
+[17:49:11] <DV> richard: no it considers it valid
+[17:49:16] <richard> that document is invalid
+[17:49:47] <DV> ah , well it's unclear 
+[17:50:03] <richard> the normalized value is a-tab-b, which you are correctly serializing as a&#9;b, but it is invalid
+[17:50:11] <DV> richard: okay
+[17:50:23] <DV> that should be really easy to fix
+[17:50:39] <richard> the validity check should require a single space between tokens
+[17:51:03] <DV> no leading and no trailing either
+[17:51:07] <richard> right
+[17:51:18] <DV> which makes sense
+[17:52:42] <richard> a&#32;b is valid, because it turns into a-space-b anyway without any normalization
+[17:54:31] <DV> okay that's attr2 attr2=" a&#x20;b "
+[17:54:44] * DV tends to still think in hexa
+[17:55:59] <DV> richard: and attr2="a&#x20; b" would lead to a validity error too then, if I understand correctly
+[17:56:37] <richard> attr2 is valid
+[17:57:11] <richard> the normalized value is a space b
 - XInclude at the SAX level (libSRVG)
 - fix the C code prototype to bring back doc/libxml-undocumented.txt
   to a reasonable level
diff --git a/libxml.m4 b/libxml.m4
index afffd39..4655dca 100644
--- a/libxml.m4
+++ b/libxml.m4
@@ -7,7 +7,7 @@
 dnl AM_PATH_XML([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
 dnl Test for XML, and define XML_CFLAGS and XML_LIBS
 dnl
-AC_DEFUN(AM_PATH_XML,[ 
+AC_DEFUN([AM_PATH_XML],[ 
 AC_ARG_WITH(xml-prefix,
             [  --with-xml-prefix=PFX   Prefix where libxml is installed (optional)],
             xml_config_prefix="$withval", xml_config_prefix="")
@@ -202,7 +202,7 @@
 dnl AM_PATH_XML2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
 dnl Test for XML, and define XML_CFLAGS and XML_LIBS
 dnl
-AC_DEFUN(AM_PATH_XML2,[ 
+AC_DEFUN([AM_PATH_XML2],[ 
 AC_ARG_WITH(xml-prefix,
             [  --with-xml-prefix=PFX   Prefix where libxml is installed (optional)],
             xml_config_prefix="$withval", xml_config_prefix="")
diff --git a/parser.c b/parser.c
index 9d6db09..21d1b89 100644
--- a/parser.c
+++ b/parser.c
@@ -12108,6 +12108,8 @@
     if (ctxt->catalogs != NULL)
 	xmlCatalogFreeLocal(ctxt->catalogs);
 #endif
+    if (ctxt->lastError.code != XML_ERR_OK)
+        xmlResetError(&ctxt->lastError);
 }
 
 /**