Special characters within CDATA

R

raga

Hi

Could you please let me know

When i specify an attribute of an XML Tag as CDATA in DTD , can i use
& straight away within the value of that attribute (instead of using
& AMP ;) . If we cant use what is the purpose of specifying an
attribute as CDATA in DTD?

any help is appreciated
Thanks
 
B

Bjoern Hoehrmann

* raga wrote in comp.text.xml:
When i specify an attribute of an XML Tag as CDATA in DTD , can i use
& straight away within the value of that attribute (instead of using
& AMP ;) . If we cant use what is the purpose of specifying an
attribute as CDATA in DTD?

You have to escape them regardless. Its primary use is to specify a type
when none of the other types suits your needs (which is often the case.)
 
J

Joseph Kesselman

There are two different things called CDATA in XML, with different
behavior: the CDATA datatype (character data, used for otherwise-untyped
attribute values) and the CDATA Section (using <[CDATA[]]> as an
alternative to escaping individual characters).
 
P

Peter Flynn

raga said:
Hi

Could you please let me know

When i specify an attribute of an XML Tag as CDATA in DTD , can i use
& straight away within the value of that attribute (instead of using
& AMP ;)
No.

If we cant use what is the purpose of specifying an
attribute as CDATA in DTD?

It's a historical relic: SGML had many other datatypes, but only some
were retained in XML. In any case, as Joe has explained, CDATA in an
attribute declaration is handled differently from CDATA in a marked
section, for unrelated and irrelevant historical reasons ;-)

///Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top