Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > CDATA and PCDATA

Reply
Thread Tools

CDATA and PCDATA

 
 
indo3
Guest
Posts: n/a
 
      08-19-2004
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
 
Reply With Quote
 
 
 
 
Magnus Henriksson
Guest
Posts: n/a
 
      08-19-2004
"indo3" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...

--snip--

> so what makes the difference if you define the value type of
> an attribute as CDATA or PCDATA?


An attribute cannot be of type PCDATA (see
http://www.w3.org/TR/REC-xml/#sec-attribute-types).


// Magnus


 
Reply With Quote
 
 
 
 
Richard Tobin
Guest
Posts: n/a
 
      08-19-2004
In article <(E-Mail Removed) >,
indo3 <(E-Mail Removed)> wrote:

>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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
whats is PCDATA ? gk Java 9 09-29-2006 11:24 AM
Can I un-CDATA my CDATA section and elaborate a transformation for the contained data? troppfigo@excite.it XML 3 03-06-2006 03:01 AM
Recursive, Dynamic element tags with type for PCDATA John-Orr XML 1 03-30-2005 01:49 PM
Extracting CDATA Text without CDATA Tags??? John Davison Java 1 07-06-2004 11:00 PM
usage of #PCDATA shows invalid content model in MSXML Mani XML 0 07-16-2003 03:02 PM



Advertisments