I would like to specify an XML schema that would allow an XML document
to be included within another XML document. The following example
schema gives an idea of what we're trying to achieve
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs=" http://www.yqcomputer.com/ "
<xs:element name="serviceResponse" type="ServiceResponse"/>
<xs:element name="anXMLDocument" type="xs:string"/>
<xs:element name="someOtherData" type="xs:string"/>
The element anXMLDocument would contain an XML data string that would
be parsed against a different XML Schema. The identity of the XML
Schema for parsing anXMLDocument is not known at the time the
ServiceResponse XML is parsed.
Previously when we used DTDs we used inline CDATA wrappers around the
contained XML document to avoid it being parsed. Can we still continue
to use inline CDATA wrappers around the XML data when we parse against
XML schemas? I've tried looking into the XML Schema specs but the
mention of CDATA seems a bit sparse and doesn't seem to answer the
If we can't use an inline CDATA wrapper is there an alternative way of
achieving the same effect?