Good old cycle: new release, new bug reports, new fixes ...
- HTMLtree.c HTMLtree.h : closing #53402 i.e. output of
  PIs when using xsl:output
- valid.c: closing #53537 some case generate segfaults if there
  is validity errors
Daniel
diff --git a/ChangeLog b/ChangeLog
index 0e9ae52..8c8e348 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Tue Apr 24 17:36:35 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
+
+	* HTMLtree.c HTMLtree.h : closing #53402 i.e. output of
+	  PIs when using xsl:output
+	* valid.c: closing #53537 some case generate segfaults if there
+	  is validity errors
+
 Tue Apr 24 15:19:53 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
 
 	* SAX.c testDocbook.c DOCBparser.c: more work on the support
diff --git a/HTMLtree.c b/HTMLtree.c
index 5c18a9d..51a72f9 100644
--- a/HTMLtree.c
+++ b/HTMLtree.c
@@ -515,6 +515,18 @@
 	}
 	return;
     }
+    if (cur->type == HTML_PI_NODE) {
+	if (cur->content != NULL) {
+	    xmlBufferWriteChar(buf, "<?");
+#ifndef XML_USE_BUFFER_CONTENT
+	    xmlBufferWriteCHAR(buf, cur->content);
+#else
+	    xmlBufferWriteCHAR(buf, xmlBufferContent(cur->content));
+#endif
+	    xmlBufferWriteChar(buf, ">");
+	}
+	return;
+    }
     if (cur->type == HTML_ENTITY_REF_NODE) {
         xmlBufferWriteChar(buf, "&");
 	xmlBufferWriteCHAR(buf, cur->name);
@@ -867,6 +879,19 @@
 	}
 	return;
     }
+    if (cur->type == HTML_PI_NODE) {
+	if (cur->content != NULL) {
+	    xmlOutputBufferWriteString(buf, "<?");
+#ifndef XML_USE_BUFFER_CONTENT
+	    xmlOutputBufferWriteString(buf, (const char *)cur->content);
+#else
+	    xmlOutputBufferWriteString(buf, (const char *)
+		                       xmlBufferContent(cur->content));
+#endif
+	    xmlOutputBufferWriteString(buf, ">");
+	}
+	return;
+    }
     if (cur->type == HTML_ENTITY_REF_NODE) {
         xmlOutputBufferWriteString(buf, "&");
 	xmlOutputBufferWriteString(buf, (const char *)cur->name);
diff --git a/HTMLtree.h b/HTMLtree.h
index 543d693..3888f7c 100644
--- a/HTMLtree.h
+++ b/HTMLtree.h
@@ -23,6 +23,7 @@
 #define HTML_ENTITY_REF_NODE	XML_ENTITY_REF_NODE
 #define HTML_COMMENT_NODE	XML_COMMENT_NODE
 #define HTML_PRESERVE_NODE	XML_CDATA_SECTION_NODE
+#define HTML_PI_NODE		XML_PI_NODE
 
 htmlDocPtr	htmlNewDoc		(const xmlChar *URI,
 					 const xmlChar *ExternalID);
diff --git a/error.c b/error.c
index 81d722d..0bb3a84 100644
--- a/error.c
+++ b/error.c
@@ -132,7 +132,7 @@
 		cur--;
 	}
     n = 0;
-	ctnt = content;
+    ctnt = content;
     while ((n++ < 79) && (cur > base) && (*cur != '\n') && (*cur != '\r')) {
 	*ctnt++ = ' ';
 	cur--;
diff --git a/include/libxml/HTMLtree.h b/include/libxml/HTMLtree.h
index 543d693..3888f7c 100644
--- a/include/libxml/HTMLtree.h
+++ b/include/libxml/HTMLtree.h
@@ -23,6 +23,7 @@
 #define HTML_ENTITY_REF_NODE	XML_ENTITY_REF_NODE
 #define HTML_COMMENT_NODE	XML_COMMENT_NODE
 #define HTML_PRESERVE_NODE	XML_CDATA_SECTION_NODE
+#define HTML_PI_NODE		XML_PI_NODE
 
 htmlDocPtr	htmlNewDoc		(const xmlChar *URI,
 					 const xmlChar *ExternalID);
diff --git a/valid.c b/valid.c
index fe13778..f6590cc 100644
--- a/valid.c
+++ b/valid.c
@@ -3286,7 +3286,7 @@
 	return(1);
     }
     if (CONT == NULL) return(-1);
-    if (NODE->type == XML_ENTITY_REF_NODE)
+    if ((NODE != NULL) && (NODE->type == XML_ENTITY_REF_NODE))
 	return(-2);
 
     /*
@@ -3643,7 +3643,7 @@
 
 static int
 xmlValidateElementContent(xmlValidCtxtPtr ctxt, xmlNodePtr child,
-		   xmlElementContentPtr cont, int warn) {
+		   xmlElementContentPtr cont, int warn, const xmlChar *name) {
     int ret;
     xmlNodePtr repl = NULL, last = NULL, cur, tmp;
 
@@ -3757,10 +3757,10 @@
 	else
 	    xmlSprintfElements(list, child, 1);
 
-	if ((child->parent != NULL) && (child->parent->name != NULL)) {
+	if (name != NULL) {
 	    VERROR(ctxt->userData,
    "Element %s content doesn't follow the Dtd\nExpecting %s, got %s\n",
-	       child->parent->name, expr, list);
+	       name, expr, list);
 	} else {
 	    VERROR(ctxt->userData,
        "Element content doesn't follow the Dtd\nExpecting %s, got %s\n",
@@ -3996,7 +3996,7 @@
         case XML_ELEMENT_TYPE_ELEMENT:
 	    child = elem->children;
 	    cont = elemDecl->content;
-	    ret = xmlValidateElementContent(ctxt, child, cont, 1);
+	    ret = xmlValidateElementContent(ctxt, child, cont, 1, elem->name);
 	    break;
     }