tags:

views:

3221

answers:

2

How can I represent the following in XSD.

<price-update>
    <![CDATA[
      arbitrary data goes here
    ]]>
</price-update>
+6  A: 

A CDATA tag is merely a means of escaping data as a text node. Therefore you cannot stipulate that you require a CDATA node.

From a DOM perspective, the following documents are identical:

<doc>value</doc>

and

<doc><![CDATA[value]]></doc>
Oliver Hallam
SO how would you recommend that i writ ethe XSD?Like this?<element name="price-update" type="string"></element>
Declan Shanaghy
I think type="string" is about as close as you can get.
Oliver Hallam
You might consider defining your own type using a regex pattern, but I don't think that would work as the XSD processing doesn't "see" the CDATA part actually apply the pattern (not definite though).
Jeff Yates
+2  A: 
<element name="price-update" type="string"></element>

is about as close as you can get.

(I thought it best to move the answer out of the comments and into an actual answer).

James Curran