CDATA and PCDATA

I

indo3

I know one can define
CDATA text by

<![CDATA[<bla> &bla;]]>

which is the same as PCDATA:

&lt;bla&gt; &amp;bla;

But if you define an attribute in a DTD
to be CDATA or PCDATA, isnt it the same value space
since both CDATA and PCDATA are equivalent?
And: everywhere where PCDATA is allowed, CDATA sections are allowed, too,
so what makes the difference if you define the value type of
an attribute as CDATA or PCDATA?


THANKS
 
R

Richard Tobin

indo3 said:
But if you define an attribute in a DTD
to be CDATA or PCDATA, isnt it the same value space
since both CDATA and PCDATA are equivalent?

But you *can't* define an attribute to be of type PCDATA!

In any case I think it's a mistake to look for a consistent
interpretation of the term "CDATA" in XML. As an attribute type it
means, roughly, plain text; in content it's just part of the
<![CDATA[...]]> construct. The more general "marked sections" of SGML
are not available in XML so its significance is lost.

The "P" in PCDATA stands for parsed, and that fits with the fact that
"<" is significant in PCDATA and not CDATA, but "&" is significant
in CDATA attributes but not in CDATA sections.

-- Richard
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top