more work on the conformance suite. Took the step to finally block

* SAX.c parserInternals.c valid.c: more work on the conformance
  suite. Took the step to finally block documents with encoding
  errors. It's a fatal error per the spec, people should have fixed
  their documents by now.
Daniel
diff --git a/SAX.c b/SAX.c
index ae31245..5604caf 100644
--- a/SAX.c
+++ b/SAX.c
@@ -640,6 +640,8 @@
 	    "SAX.unparsedEntityDecl(%s, %s, %s, %s)\n",
             name, publicId, systemId, notationName);
 #endif
+#if 0
+    Done in xmlValidateDtdFinal now.
     if (ctxt->validate && ctxt->wellFormed && ctxt->myDoc) {
 	int ret;
 	ret = xmlValidateNotationUse(&ctxt->vctxt, ctxt->myDoc,
@@ -649,6 +651,7 @@
 	    ctxt->valid = 0;
 	}
     }
+#endif
     if (ctxt->inSubset == 1) {
 	ent = xmlAddDocEntity(ctxt->myDoc, name,
 			XML_EXTERNAL_GENERAL_UNPARSED_ENTITY,
@@ -1220,7 +1223,13 @@
      * check the document root element for validity
      */
     if ((ctxt->validate) && (ctxt->vctxt.finishDtd == 0)) {
-	ctxt->valid &= xmlValidateDtdFinal(&ctxt->vctxt, ctxt->myDoc);
+	int chk;
+
+	chk = xmlValidateDtdFinal(&ctxt->vctxt, ctxt->myDoc);
+	if (chk <= 0)
+	    ctxt->valid = 0;
+	if (chk < 0)
+	    ctxt->wellFormed = 0;
 	ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc);
 	ctxt->vctxt.finishDtd = 1;
     }