Re: [xml] two Patches regarding HTMLtree.c



On Tue, Apr 10, 2001 at 12:56:56PM +0200, paul-libxml sponagl de wrote:
hi,

maybe someone had those probs too with
dumping trees in memory and corrupting docs
(e.g. Javascripts)

  Please explain what it is supposed to do !

--- HTMLtree.c.orig   Wed Apr  4 14:06:33 2001
+++ HTMLtree.c        Wed Apr  4 14:03:01 2001
@@ -499,6 +499,16 @@
         xmlBufferWriteChar(buf, ";");
      return;
     }
+    if (cur->type == HTML_PRESERVE_NODE) {
+       if (cur->content != NULL) {
+#ifndef XML_USE_BUFFER_CONTENT
+        xmlBufferWriteCHAR(buf, (const char *)cur->content);
+#else
+        xmlBufferWriteCHAR(buf, (const char *) xmlBufferContent(cur->content));
+#endif
+       }
+       return;
+    }

  I assume it's to avoid doing escaping in scripts 

     /*
      * Get specific HTmL info for taht node.
@@ -565,17 +575,6 @@
      xmlBufferWriteCHAR(buf, cur->name);
      xmlBufferWriteChar(buf, ">");
     }
-#if 0
-    if (!htmlIsAutoClosed(doc, cur)) {
-     xmlBufferWriteChar(buf, "</");
-     xmlBufferWriteCHAR(buf, cur->name);
-     xmlBufferWriteChar(buf, ">");
-    }

  Hum, I decided on purpose to retain this code around, any reason why
to want to remove it ?

-#else
-    xmlBufferWriteChar(buf, "</");
-    xmlBufferWriteCHAR(buf, cur->name);
-    xmlBufferWriteChar(buf, ">");
-#endif

  Can you explain the reason why closing tag should be removed ?

     if (cur->next != NULL) {
         if ((cur->next->type != HTML_TEXT_NODE) &&
          (cur->next->type != HTML_ENTITY_REF_NODE))
@@ -927,17 +926,9 @@
          (cur->children != cur->last))
          xmlOutputBufferWriteString(buf, "\n");
     }
-#if 0
-    if (!htmlIsAutoClosed(doc, cur)) {
-     xmlOutputBufferWriteString(buf, "</");
-     xmlOutputBufferWriteString(buf, (const char *)cur->name);
-     xmlOutputBufferWriteString(buf, ">");
-    }
-#else
     xmlOutputBufferWriteString(buf, "</");
     xmlOutputBufferWriteString(buf, (const char *)cur->name);
     xmlOutputBufferWriteString(buf, ">");
-#endif


  Again this removes uncompiled code left around on purpose, but this
won't fix anything.

     if (cur->next != NULL) {
         if ((cur->next->type != HTML_TEXT_NODE) &&
          (cur->next->type != HTML_ENTITY_REF_NODE))


  Please send some explanations, I will then look at integrating your
patch.

Daniel

-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
veillard redhat com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]