Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i designate in XSD that an element only contains CDATA?

Tags:

xml

xsd

How can I represent the following in XSD.

<price-update>     <![CDATA[       arbitrary data goes here     ]]> </price-update> 
like image 423
Declan Shanaghy Avatar asked Oct 06 '08 18:10

Declan Shanaghy


People also ask

How does XSD define CDATA?

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.

How an element can be defined within as XSD?

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.

What does <![ CDATA in XML mean?

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.

How do I use CDATA in XML?

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 ]>.


1 Answers

<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).

like image 199
James Curran Avatar answered Nov 10 '22 20:11

James Curran