CDATA - XML - SCHEMA

Discussion in 'XML' started by pshymon123@yahoo.co.uk, Apr 26, 2005.

  1. Guest

    I would like to add an element with a CDATA in it but I cannot seem to
    add it.
    Firstly I add this to my XML Schema:-

    <xsd:element name="test" type="xsd:string"/>

    then I add to my XML document:-

    <test>
    <[CDATA[hello]]>
    </test>

    and when I try to validate it, I get that is should be a comment.

    Help!

    Simon.
     
    , Apr 26, 2005
    #1
    1. Advertisements

  2. "" <> writes:

    > I would like to add an element with a CDATA in it but I cannot seem to
    > add it.
    > Firstly I add this to my XML Schema:-
    >
    > <xsd:element name="test" type="xsd:string"/>
    >
    > then I add to my XML document:-
    >
    > <test>
    > <[CDATA[hello]]>
    > </test>
    >
    > and when I try to validate it, I get that is should be a comment.
    >
    > Help!
    >
    > Simon.


    The syntax for CDATA is <![ you are missing the ! But note that CDATA
    only affects the interpretation of the characters < and & so putting it
    around hello has no affect.

    <test>
    <![CDATA[hello]]>
    </test>

    Is the same to a schema validator (and most other XML applications) as

    <test>
    hello
    </test>

    in both cases the content of the element is
    newline h e l l o newline

    David
     
    David Carlisle, Apr 26, 2005
    #2
    1. Advertisements

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:
    887
    Hal Rosser
    Jul 7, 2004
  2. Markus
    Replies:
    1
    Views:
    1,936
    Markus
    Nov 23, 2005
  3. Fred Smith
    Replies:
    1
    Views:
    1,200
    Martin Honnen
    Feb 5, 2004
  4. Hari Om
    Replies:
    1
    Views:
    593
    Martin SChukrazy
    Mar 2, 2004
  5. X. Lee
    Replies:
    2
    Views:
    8,451
    Peter Flynn
    Nov 1, 2004
  6. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,573
    Stanimir Stamenkov
    Apr 25, 2005
  7. Replies:
    3
    Views:
    991
    Joe Kesselman
    Mar 6, 2006
  8. Replies:
    3
    Views:
    4,596
Loading...