CDATA and XSD

Discussion in 'XML' started by Kenny, Jun 5, 2007.

  1. Kenny

    Kenny Guest

    Hey,
    Is there some way to CDATA an element in an XSD? I'm having an
    incredibly hard time finding a solution.

    -Kenny
     
    Kenny, Jun 5, 2007
    #1
    1. Advertising

  2. * Kenny wrote in comp.text.xml:
    >Is there some way to CDATA an element in an XSD? I'm having an
    >incredibly hard time finding a solution.


    I am not sure what you are asking. If you mean to declare an element as
    having a CDATA content model like you could in SGML, then that is not
    possible. If you are looking for a #PCDATA content model (what is called
    a CDATA content model for attributes), then that is just any xsd:string.
    If you mean that the element must use <![CDATA[...]]> constructs, then
    that is neither a reasonable constraint nor possible.
    --
    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, Jun 5, 2007
    #2
    1. Advertising

  3. Kenny wrote:
    > Is there some way to CDATA an element in an XSD?


    I'm not sure what you mean. If you're referring to <![[CDATA]]>
    sections, that's entirely an instance-document feature, as an
    alternative to escaping individual characters; it can't be required *or*
    forbidden by the schema.

    There is no way to make an element be interpreted as if it was
    implicitly a <![[CDATA]]> section.

    > I'm having an incredibly hard time finding a solution.


    Probably because you're trying to do the wrong thing. XML is XML. You
    need to respect XML syntax or it isn't XML. That may mean restating the
    problem.

    Rather than jump to a possibly inappropriate solution, why not tell us
    what your real problem is, so we can tell you how we'd solve it?

    --
    Joe Kesselman / Beware the fury of a patient man. -- John Dryden
     
    Joseph Kesselman, Jun 5, 2007
    #3
  4. Kenny wrote:
    > Hey,
    > Is there some way to CDATA an element in an XSD? I'm having an
    > incredibly hard time finding a solution.
    >
    > -Kenny
    >

    If by that you mean declare an element as CDATA, then no (and there is
    no such declaration in XML DTD either) SGML DTD have a CDATA element
    declaration but there is no such element type in XML. (Which is why for
    example <script> is declared as CDATA in the (SGML) HTML DTD but just as
    a normal (PCDATA) element in the (XML) XHTML DTD.

    David

    --
    http://dpcarlisle.blogspot.com
     
    David Carlisle, Jun 6, 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:
    587
    Hal Rosser
    Jul 7, 2004
  2. Markus
    Replies:
    1
    Views:
    1,112
    Markus
    Nov 22, 2005
  3. Rick Razzano

    XSD document for XSD defintion

    Rick Razzano, Sep 26, 2003, in forum: XML
    Replies:
    1
    Views:
    499
    C. M. Sperberg-McQueen
    Sep 26, 2003
  4. Bernd Oninger
    Replies:
    1
    Views:
    529
    Henry S. Thompson
    Jun 30, 2004
  5. Replies:
    3
    Views:
    759
    Joe Kesselman
    Mar 6, 2006
Loading...

Share This Page