Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > CDATA - XML - SCHEMA

Reply
Thread Tools

CDATA - XML - SCHEMA

 
 
pshymon123@yahoo.co.uk
Guest
Posts: n/a
 
      04-26-2005
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.

 
Reply With Quote
 
 
 
 
David Carlisle
Guest
Posts: n/a
 
      04-26-2005
"(E-Mail Removed)" <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
web.xml / XML schema issue, why do some XML schema attributes disappear asciz@starmail.com Java 3 02-20-2007 09:56 AM
Can I un-CDATA my CDATA section and elaborate a transformation for the contained data? troppfigo@excite.it XML 3 03-06-2006 03:01 AM
[XML Schema] Including a schema document with absent target namespace to a schema with specified target namespace Stanimir Stamenkov XML 3 04-25-2005 09:59 AM
add CDATA element to an xml schema? X. Lee XML 2 11-01-2004 10:48 PM
Extracting CDATA Text without CDATA Tags??? John Davison Java 1 07-06-2004 11:00 PM



Advertisments