- release 1.8.2 - HTML handling improvement - new tree handling functions

- release 1.8.2
- HTML handling improvement
- new tree handling functions
- default namespace on attribute bug fixed
- libxml use for C++ fixed (for good this time !)
Daniel
diff --git a/HTMLtree.c b/HTMLtree.c
index 4b24f7d..1265a0a 100644
--- a/HTMLtree.c
+++ b/HTMLtree.c
@@ -244,9 +244,11 @@
 	    (cur->childs != cur->last))
 	    xmlBufferWriteChar(buf, "\n");
     }
-    xmlBufferWriteChar(buf, "</");
-    xmlBufferWriteCHAR(buf, cur->name);
-    xmlBufferWriteChar(buf, ">");
+    if (!htmlIsAutoClosed(doc, cur)) {
+	xmlBufferWriteChar(buf, "</");
+	xmlBufferWriteCHAR(buf, cur->name);
+	xmlBufferWriteChar(buf, ">");
+    }
     if (cur->next != NULL) {
         if ((cur->next->type != HTML_TEXT_NODE) &&
 	    (cur->next->type != HTML_ENTITY_REF_NODE))
@@ -263,12 +265,25 @@
  */
 static void
 htmlDocContentDump(xmlBufferPtr buf, xmlDocPtr cur) {
+    int type;
+
+    /*
+     * force to output the stuff as HTML, especially for entities
+     */
+    type = cur->type;
+    cur->type = XML_HTML_DOCUMENT_NODE;
     if (cur->intSubset != NULL)
         htmlDtdDump(buf, cur);
+    else {
+	/* Default to HTML-4.0 transitionnal @@@@ */
+	xmlBufferWriteChar(buf, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/REC-html40/loose.dtd\">");
+
+    }
     if (cur->root != NULL) {
         htmlNodeListDump(buf, cur, cur->root);
     }
     xmlBufferWriteChar(buf, "\n");
+    cur->type = type;
 }
 
 /**