T
Tony Prichard
Hi
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
ServiceResponse.xsd
--------------------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="serviceResponse" type="ServiceResponse"/>
<xs:complexType name="ServiceResponse">
<xs:sequence>
<xs:element name="anXMLDocument" type="xs:string"/>
<xs:element name="someOtherData" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
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
question.
If we can't use an inline CDATA wrapper is there an alternative way of
achieving the same effect?
Many thanks
Tony Prichard
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
ServiceResponse.xsd
--------------------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="serviceResponse" type="ServiceResponse"/>
<xs:complexType name="ServiceResponse">
<xs:sequence>
<xs:element name="anXMLDocument" type="xs:string"/>
<xs:element name="someOtherData" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
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
question.
If we can't use an inline CDATA wrapper is there an alternative way of
achieving the same effect?
Many thanks
Tony Prichard