CDATA vs character DATA

Discussion in 'XML' started by Jimmy zhang, Aug 8, 2004.

  1. Jimmy zhang

    Jimmy zhang Guest

    Are they teh same thing in xml 1.0?
    Jimmy zhang, Aug 8, 2004
    #1
    1. Advertising

  2. Jimmy zhang wrote:
    > Are they teh same thing in xml 1.0?


    There are to different things called CDATA in XML 1.0:

    CDATA Section: they are used to escape blocks of text containing
    characters which would otherwise be recognized as markup. CDATA sections
    begin with the string "<![CDATA[" and end with the string "]]>":]

    CDATA Attribute Type: this is the string type of the three attribute
    types in a DTD. For example:
    <!ATTLIST termdef
    name CDATA #IMPLIED>

    Peter
    Peter Gerstbach, Aug 16, 2004
    #2
    1. Advertising

  3. Jimmy zhang

    Peter Flynn Guest

    Peter Gerstbach wrote:

    > Jimmy zhang wrote:
    >> Are they teh same thing in xml 1.0?

    >
    > There are to different things called CDATA in XML 1.0:
    >
    > CDATA Section: they are used to escape blocks of text containing
    > characters which would otherwise be recognized as markup. CDATA sections
    > begin with the string "<![CDATA[" and end with the string "]]>":]
    >
    > CDATA Attribute Type: this is the string type of the three attribute
    > types in a DTD. For example:
    > <!ATTLIST termdef
    > name CDATA #IMPLIED>


    That doesn't answer the question, though.
    The OP asked if CDATA and "character data" were the same thing.
    No, they're not.

    CDATA, as Peter rightly says, is an attribute type specifier.
    It means your attribute can contain text or character entity
    references, but not element markup, so if bar is declared as
    a CDATA attribute on the element type foo,

    <foo bar="blort"/>
    and
    <foo bar="bl&ocirc;rt"/>

    are well-formed, but

    <foo bar="blo<br/>rt">

    is not.

    Character Data is the generic term for the text content of a document.
    It's what gets parsed to see if it contains any [more] markup (whence
    the term Parsed Character Data or PCDATA). The term is more commonly
    used to mean "unmarked text".

    ///Peter
    --
    "The cat in the box is both a wave and a particle"
    -- Terry Pratchett, introducing quantum physics in _The Authentic Cat_
    Peter Flynn, Aug 17, 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. Velvet
    Replies:
    9
    Views:
    14,774
    Joerg Jooss
    Jan 19, 2006
  2. John Davison
    Replies:
    1
    Views:
    570
    Hal Rosser
    Jul 7, 2004
  3. raavi
    Replies:
    2
    Views:
    900
    raavi
    Mar 2, 2006
  4. cgbusch
    Replies:
    6
    Views:
    7,466
    Mike Brown
    Sep 2, 2003
  5. Replies:
    3
    Views:
    737
    Joe Kesselman
    Mar 6, 2006
Loading...

Share This Page