[Petal] <![CDATA[ ... ]]> and HTML Elements

Fergal Daly fergal at esatclear.ie
Mon Nov 8 13:05:51 GMT 2004


On Sat, Nov 06, 2004 at 03:05:19PM -0600, Warren Smith wrote:
> Is there a fix to get the Petal parser to respect <![CDATA[ ... ]]> and
> HTML Elements?
> 
> Petal seems hell-bent on removing any CDATA tags and parsing data inside
> these supposedly "Protected Areas" and converting <,>,& and friends into
> &amp;lt;,&amp;gt;,&amp;amp. I can't for the life of me figure this one
> out.

Can you give an example of what goes in and what comes out. I think a CDATA
section is only "protected" in the sense that it's not necessary to escape
&s and <s so

<tag>[![CDATA[hello & good evening]]]</tag>

is equivalent to

<tag>hello &amp; good evening</tag>

At the end of the day a CDATA sections just makes it easy to insert a chunk
of text without having to worry about escaping it. They are for the
convenience of someone generating XML, they have no special meaning and the
parser has no obligation to tell the application that this text here was
originally a CDATA and this one wasn't,

http://www.w3c.org/TR/2004/REC-xml-20040204/#sec-cdata-sect

Fergal


More information about the Petal mailing list