Re: [xml] two Patches regarding HTMLtree.c



Hi Daniel,

+    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 

Scripts won't be processed 'preserved' without the patch, so
e.g. Javascripts will be processed as text to escape. the thing i did
was a diff between nodeDump and nodeDumpOutput.  (There are a view
more inconsistencies between those functions, but i had not the time
to track further on)


     /*
      * 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 ?

dumping to memory delivered _two_ closing tags

-#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.

I had the problem that the #if 0 was ignored by gcc at this time.
(Please don't ask why - i'm still wondering - the preparsing-output
showed that it's still in the code) - so i decided to remove all the
stuff - Maybe the bad weather that day ;)

bye
Paul






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