Re: [xml] Patch for HTML SCRIPT

Date view Thread view Subject view Author view

From: Bjorn Reese (breese@mail1.stofanet.dk)
Date: Sun Oct 15 2000 - 09:40:50 EDT


Daniel Veillard wrote:

> I have applied the patch. However I had to change the function
> using CUR_PTR is really not safe in this context. I also had to add
> the cdata (that was a good idea to use it in this case!) callback
> in the default HTML SAx block and handle this case for the push

Whoops, I forgot to include the patch for SAX.c. I suspect that my
patches wouldn't work without it. Thanks for fixing it.

> parser. Added Style support since it could be merged, included your
> example and updated testHTML to show cdata. Then updated the test
> results.
> So it really took longer than expected, but it's nice to have this
> fixed :-)

Indeed.

I looked at the attribute problem today, and made the attached patches.

The change to HTMLtree.c prevents HTML attributes from being encoded
when they are output. I have not found any justification for (or
against) this in the HTML specification, but the change makes sense
considering that one can embed code in attributes. Maybe this should
be limited to event attributes?

The change to SAX.c normalizes the HTML attributes. The normalization
scheme mentioned in http://www.w3.org/TR/html4/types.html#h-6.2 looks
suspiciously like that of XML attribute normalization.

*** ../libxml2-2.2.5/HTMLtree.c Wed Oct 11 01:12:56 2000
--- HTMLtree.c Sun Oct 15 15:03:42 2000
***************
*** 703,709 ****
      xmlOutputBufferWriteString(buf, " ");
      xmlOutputBufferWriteString(buf, (const char *)cur->name);
      if (cur->children != NULL) {
! value = xmlNodeListGetString(doc, cur->children, 0);
          if (value) {
              xmlOutputBufferWriteString(buf, "=");
              xmlBufferWriteQuotedString(buf->buffer, value);
--- 703,709 ----
      xmlOutputBufferWriteString(buf, " ");
      xmlOutputBufferWriteString(buf, (const char *)cur->name);
      if (cur->children != NULL) {
! value = xmlNodeListGetString(doc, cur->children, 1);
          if (value) {
              xmlOutputBufferWriteString(buf, "=");
              xmlBufferWriteQuotedString(buf->buffer, value);
  

*** ../libxml2-2.2.5/SAX.c Wed Oct 11 01:12:56 2000
--- SAX.c Sun Oct 15 15:17:58 2000
***************
*** 742,752 ****
      /*
       * Do the last stave of the attribute normalization
       */
! if (ctxt->html)
! nval = NULL;
! else
! nval = xmlValidNormalizeAttributeValue(ctxt->myDoc,
! ctxt->node, fullname, value);
      if (nval != NULL)
          value = nval;
  
--- 742,749 ----
      /*
       * Do the last stave of the attribute normalization
       */
! nval = xmlValidNormalizeAttributeValue(ctxt->myDoc, ctxt->node,
! fullname, value);
      if (nval != NULL)
          value = nval;
  

----
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 : Sun Oct 15 2000 - 09:43:26 EDT