final touch running DTD validation on the XmlTextReader added a specific

* valid.c xmlreader.c: final touch running DTD validation
  on the XmlTextReader
* python/tests/Makefile.am python/tests/reader2.py: added a
  specific run based on the examples from test/valid/*.xml
Daniel
diff --git a/valid.c b/valid.c
index 7fa634c..dcf72d4 100644
--- a/valid.c
+++ b/valid.c
@@ -100,7 +100,7 @@
 vstateVPop(xmlValidCtxtPtr ctxt) {
     xmlElementPtr elemDecl;
 
-    if (ctxt->vstateNr <= 1) return(-1);
+    if (ctxt->vstateNr < 1) return(-1);
     ctxt->vstateNr--;
     elemDecl = ctxt->vstateTab[ctxt->vstateNr].elemDecl;
     ctxt->vstateTab[ctxt->vstateNr].elemDecl = NULL;
@@ -250,6 +250,39 @@
     return (ret);
 }
 
+#if 0
+/**
+ * xmlFreeValidCtxt:
+ * @ctxt:  a validation context
+ *
+ * Free the memory allocated for a validation context
+ */
+void 
+xmlFreeValidCtxt(xmlValidCtxtPtr ctxt) {
+    if (ctxt == NULL)
+	return;
+#ifdef LIBXML_REGEXP_ENABLED
+    while (ctxt->vstateNr >= 0)
+	vstateVPop(ctxt);
+    if (ctxt->vstateNr <= 1) return(-1);
+    ctxt->vstateNr--;
+    elemDecl = ctxt->vstateTab[ctxt->vstateNr].elemDecl;
+    ctxt->vstateTab[ctxt->vstateNr].elemDecl = NULL;
+    ctxt->vstateTab[ctxt->vstateNr].node = NULL;
+    if ((elemDecl != NULL) && (elemDecl->etype == XML_ELEMENT_TYPE_ELEMENT)) {
+	xmlRegFreeExecCtxt(ctxt->vstateTab[ctxt->vstateNr].exec);
+    }
+    ctxt->vstateTab[ctxt->vstateNr].exec = NULL;
+    if (ctxt->vstateNr >= 1)
+	ctxt->vstate = &ctxt->vstateTab[ctxt->vstateNr - 1];
+    else
+	ctxt->vstate = NULL;
+    return(ctxt->vstateNr);
+#else /* ! LIBXML_REGEXP_ENABLED */
+#endif /* LIBXML_REGEXP_ENABLED */
+}
+#endif
+
 #ifdef DEBUG_VALID_ALGO
 static void
 xmlValidPrintNode(xmlNodePtr cur) {