CDATA and PCDATA

Discussion in 'XML' started by indo3, Aug 19, 2004.

  1. indo3

    indo3 Guest

    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
    indo3, Aug 19, 2004
    #1
    1. Advertising

  2. "indo3" <> wrote in message
    news:...

    --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
    Magnus Henriksson, Aug 19, 2004
    #2
    1. Advertising

  3. In article <>,
    indo3 <> 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
    Richard Tobin, Aug 19, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Davison
    Replies:
    1
    Views:
    580
    Hal Rosser
    Jul 7, 2004
  2. Mani
    Replies:
    0
    Views:
    1,445
  3. John-Orr
    Replies:
    1
    Views:
    406
    David Carlisle
    Mar 30, 2005
  4. Replies:
    3
    Views:
    749
    Joe Kesselman
    Mar 6, 2006
  5. gk

    whats is PCDATA ?

    gk, Sep 28, 2006, in forum: Java
    Replies:
    9
    Views:
    599
    Dag Sunde
    Sep 29, 2006
Loading...

Share This Page