[xml] patch for tree.c



There are a few locations where libxml2 isn't honoring a TEXT node's name being xmlStringTextNoenc. Here's a patch to fix the problem. It's on a slightly older version of the code, but I haven't had time to update my application to the new code.

One other problem I had was with htmlNodeDumpFormatOutput not honoring all the instances of xmlStringTextNoenc. I changed the comparison to use xmlStrEqual instead of a pointer because I'd like to mark some nodes I add (such as for PHP code) to not be encoded when output. A much better solution, I think, would be to add an API to get/set if a text node is to be encoded.



*** ../x/libxml2-2.5.11/tree.c  Tue Sep  9 06:02:48 2003
--- ./tree.c    Thu Oct  9 17:25:00 2003
***************
*** 2869,2875 ****

      xmlUnlinkNode(elem);

!     if ((cur->type == XML_TEXT_NODE) && (elem->type == XML_TEXT_NODE)) {
        xmlNodeAddContent(cur, elem->content);
        xmlFreeNode(elem);
        return(cur);
--- 2869,2877 ----

      xmlUnlinkNode(elem);

!     if ((cur->type == XML_TEXT_NODE) && (elem->type == XML_TEXT_NODE) &&
!               (cur->name == elem->name))
!       {
        xmlNodeAddContent(cur, elem->content);
        xmlFreeNode(elem);
        return(cur);
***************
*** 3009,3014 ****
--- 3011,3017 ----
      if (cur->type == XML_TEXT_NODE) {
        if ((parent->type == XML_TEXT_NODE) &&
            (parent->content != NULL) &&
+           (parent->name == cur->name) &&
            (parent != cur)) {
            xmlNodeAddContent(parent, cur->content);
            xmlFreeNode(cur);

--
__________________________________________________________________________
                                  "They that can give up essential liberty
Mark J. Lilback                    to obtain a little temporary safety
<mark lilback com>                 deserve neither liberty or safety."
http://www.lilback.com/                               -- Benjamin Franklin



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