[xml] SCRIPT patch for HTMLtree.c

Date view Thread view Subject view Author view

From: Bjorn Reese (breese@mail1.stofanet.dk)
Date: Wed Jan 24 2001 - 13:22:40 EST


I have attached a patch against version 2-2.2.11 of HTMLtree.c.

The patch removes erroneous empty tags inside the SCRIPT element, for example
the 2nd and 4th line in:

  <script language="javascript">
    <>
      function mystuff();
    </>
  </script>

(I also "beautified" the code a bit, by using switch instead of multiple if
 statements)

*** libxml2-2.2.11/HTMLtree.c Fri Jan 5 07:39:25 2001
--- libxml2-2.2.11-breese/HTMLtree.c Wed Jan 24 19:11:55 2001
***************
*** 458,464 ****
          htmlDocContentDump(buf, (xmlDocPtr) cur);
          return;
      }
! if (cur->type == HTML_TEXT_NODE) {
          if (cur->content != NULL) {
              xmlChar *buffer;
  
--- 458,465 ----
          htmlDocContentDump(buf, (xmlDocPtr) cur);
          return;
      }
! switch (cur->type) {
! case HTML_TEXT_NODE:
          if (cur->content != NULL) {
              xmlChar *buffer;
  
***************
*** 474,481 ****
              }
          }
          return;
! }
! if (cur->type == HTML_COMMENT_NODE) {
          if (cur->content != NULL) {
              xmlBufferWriteChar(buf, "<!--");
  #ifndef XML_USE_BUFFER_CONTENT
--- 475,482 ----
              }
          }
          return;
!
! case HTML_COMMENT_NODE:
          if (cur->content != NULL) {
              xmlBufferWriteChar(buf, "<!--");
  #ifndef XML_USE_BUFFER_CONTENT
***************
*** 486,497 ****
              xmlBufferWriteChar(buf, "-->");
          }
          return;
! }
! if (cur->type == HTML_ENTITY_REF_NODE) {
          xmlBufferWriteChar(buf, "&");
          xmlBufferWriteCHAR(buf, cur->name);
          xmlBufferWriteChar(buf, ";");
          return;
      }
  
      /*
--- 487,506 ----
              xmlBufferWriteChar(buf, "-->");
          }
          return;
!
! case HTML_PRESERVE_NODE:
! if (cur->content)
! xmlBufferWriteCHAR(buf, cur->content);
! return;
!
! case HTML_ENTITY_REF_NODE:
          xmlBufferWriteChar(buf, "&");
          xmlBufferWriteCHAR(buf, cur->name);
          xmlBufferWriteChar(buf, ";");
          return;
+
+ default:
+ break;
      }
  
      /*

----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Jan 24 2001 - 14:45:12 EST