How can I represent the following in XSD.
<price-update> <![CDATA[ arbitrary data goes here ]]> </price-update>
There is no datatype called xsd:CDATA. A CDATA section is a means to escape the String from parsing. You should declare the field as xsd:string. If you are using a reasonable xml serializer it will automatically escape the characters if there is a need to do so.
Each element definition within the XSD must have a 'name' property, which is the tag name that will appear in the XML document. The 'type' property provides the description of what type of data can be contained within the element when it appears in the XML document.
A CDATA section is used to mark a section of an XML document, so that the XML parser interprets it only as character data, and not as markup. It comes handy when one XML data need to be embedded within another XML document.
A CDATA section begins with the character sequence <! [CDATA[ and ends with the character sequence ]]>. Between the two character sequences, an XML processor ignores all markup characters such as <, >, and &. The only markup an XML pro-cessor recognizes inside a CDATA section is the closing character sequence ]>.
<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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With