Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to define CDATA type in the XML schema?

843834Jan 15 2009 — edited Aug 5 2009
Hello there,

How I can define a CDATA simpleType in the XML schema? I've looked around and can not fine any usefull answers.
Also solutions in this topic do not work either: http://forums.sun.com/thread.jspa?threadID=360343&start=0&tstart=0

I have set it up like this in the schema:
-----------------------
<xs:complexType name="ResultType">
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="1" name="data" type="cdata" />
</xs:sequence>
</xs:complexType>

<xs:simpleType name="cdata">
<xs:restriction base="xs:string">
<xs:pattern value="<![CDATA[]]" />
</xs:restriction>
</xs:simpleType>
----------------------

But got following error:
===================
parsing a schema...
[ERROR] InvalidRegex: Pattern value '<![CDATA[]]' is not a valid regular express
ion. The reported error was: ''[' is invalid in a character class. Write '\['.'
at column '8'.
===================


But without Pattern Value specified - I think this will be just a pure string and I need it to be a CDATA.

Thanks in advance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 2 2009
Added on Jan 15 2009
4 comments
3,268 views