ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gordon Tyler" <gordon.ty...@sitraka.com>
Subject Re: [OFF-TOPIC] XML Question
Date Mon, 12 Aug 2002 22:12:46 GMT
From: "Dominique Devienne" <DDevienne@lgc.com>

> Can someone explain me the difference between the two lines of XML below:
>
> <sometag><![CDATA[some textual content]]></sometag>
> <sometag>[CDATA[some textual content]]</sometag>

See http://www.w3.org/TR/2000/REC-xml-20001006#sec-cdata-sect.

The first line describes an element "sometag" which has a CDATA section
child containing "some textual content". The second line describes an
element "sometag" which has a text child containing "[CDATA[some textual
content]]". In other words, the first line is the correct way to use a CDATA
section.

CDATA sections allow you to escape text that would otherwise be interpreted
as markup (e.g. <foo>).

> What the difference? Does it matter for the DTD?
> I use <!ELEMENT sometag (#PCDATA)> for that element.

Normal text and CDATA sections both qualify as PCDATA. However, you may need
to treat CDATA sections specially depending on the parser and API you use.

> PS: The XML spec is a little obtuse to me... And I did look at it!

It is rather. I have to read very slowly and carefully ;)

Ciao,
Gordon



--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message