[Templates] template-toolkit and GD

Mark Mills mark@xodiax.com
Wed, 6 Nov 2002 17:51:18 -0500


> Maybe I'm missing something here ... The XML spec.=20
>=20
>   http://www.w3.org/TR/REC-xml#sec-cdata-sect
>=20
> says this in section 2.7:
>=20
>   Within a CDATA section, only the CDEnd string is recognized as=20
>   markup, so that left angle brackets and ampersands may occur in=20
>   their literal form; they need not (and cannot) be escaped using=20
>   "<" and "&". CDATA sections cannot nest. =20
>=20
> In practice here, we've parsed many many XML documents using=20
> XML::Parser and related tools that accept this.
>=20
> My apologies if I missed context here ...

You are missing something there. A CDATA in the DTD simply means that =
the tag contains arbitrary text, that might include markup. It is just =
the name for "chracter data". CDATA just means that almost anything =
could be in that field.=20

The <![CDATA[... blah blah ...]]> marked section allows unescaped data =
to pass without being parsed as XML. See =
http://www.w3.org/TR/xml-c14n#Example-Chars and =
http://www.w3.org/TR/xhtml1/#C_12 and =
http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-E067D597=20

This is all XTHML's CDATA gains you, putting markup characters in stream =
without escaping them individually:=20
<a =
href=3D"http://www.exam.ple/whatever.xhtml"><![CDATA[>><<<&&&>>><<]]></a>=


One is a type, the other is markup. The range of data allowed in CDATA =
is basically all of ascii and unicode, but doesn't imply that it won't =
be parsed, only that the tag doesn't restrict the content beyond the =
fully-formed requirement of XML itself. The CDATA markup can set aside a =
passage to be treated as text data without parsing.

The CDATA markup section isn't allowed in the URI field of the href =
attribute, either... sorry. It is treated like a tag, in essence.

Someone else could probably explain that better but that is all gots in =
me. :)
--mark