Special characters within CDATA

Discussion in 'XML' started by raga, Jul 31, 2007.

  1. raga

    raga Guest

    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
    raga, Jul 31, 2007
    #1
    1. Advertising

  2. * 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.)
    --
    Björn Höhrmann · mailto: · http://bjoern.hoehrmann.de
    Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
    68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
    Bjoern Hoehrmann, Jul 31, 2007
    #2
    1. Advertising

  3. 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).


    --
    Joe Kesselman / Beware the fury of a patient man. -- John Dryden
    Joseph Kesselman, Jul 31, 2007
    #3
  4. raga

    Peter Flynn Guest

    raga wrote:
    > 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
    --
    XML FAQ: http://xml.silmaril.ie/
    Peter Flynn, Jul 31, 2007
    #4
    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:
    571
    Hal Rosser
    Jul 7, 2004
  2. Stefan Mueller
    Replies:
    3
    Views:
    32,958
    Stefan Mueller
    Jul 23, 2006
  3. Replies:
    3
    Views:
    738
    Joe Kesselman
    Mar 6, 2006
  4. Replies:
    2
    Views:
    1,073
    Ingo Menger
    May 31, 2007
  5. rvino
    Replies:
    0
    Views:
    4,637
    rvino
    Aug 14, 2007
Loading...

Share This Page