Re: [xml] xhtml1 test case



On Fri, Oct 28, 2005 at 02:52:45PM -0700, Jain, Nilesh wrote:
 The parser is adding the tag to avoid problem with escaping at the
XML
level and the script content.

"Wrapping the content of the script or style element within a CDATA
marked section avoids the expansion of these entities". so also mean if
script data is not wrapped up in the CDATA tag it will be expand the
entities. Which parser is doing, but after doing that it adds CDATA tag.
Why? 

  Okay, I don't understand your sentence, and I'm afraid you didn't understood
mine. So I will recap for my last mail on that topic:

  if (a & b) is in the script and CDATA is not used this will be a fatal error
  if (a < b) is in the script and CDATA is not used this will be a fatal error

  => this is not XML this can't be parsed.

if enclosed in CDATA this can be parsed as-is
if not enclosed in CDATA this would have to be saved as
    (a &amp; b)
  or
    (a &lt; b)
which makes the script language simply very hard to read and prone to break.
That's why libxml2 when saving a script or style element from and XHTML
document do enclose the content in CDATA, the change in recent version is
that it does this only if & or < is found in the content of the script or
style element.

Daniel

-- 
Daniel Veillard      | Red Hat http://redhat.com/
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]