G
Grant Robertson
If I use the 'any' element in my schema to allow elements from another
schema to be used in instance documents based on my schema, is there a
way to force that the contents of that element must be an entire,
complete instance document for that other schema?
Let's say I have the following schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="BogusElement" type="BogusType"/>
<xs:complexType name="BogusType">
<xs:sequence>
<xs:any namespace="http://www.w3.org/1999/xhtml"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
It has only the one element BogusElement and it can contain only the one
child element from the XHTML schema. Does this force the BogusElement
element in the instance document to contain a complete XHTML document
including headers or would
<?xml version="1.0" encoding="UTF-8"?>
<BogusElement
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="Untitled1.xsd"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<xhtml:strong>Bolded Text.</xhtml:strong>
</BogusElement>
be a valid document under the above schema?
How can I make it so that the contents of the BogusElement element in the
instance document must be a complete XHTML document in order to be valid?
Or would I just have to make that a verbal rule, not expressed in the
schema?
To complicate things further: Let's say I wanted that element to contain
only one of a list of valid, complete documents such as either a complete
html document OR a complete XHTML document OR a complete DocBook
document, all with headers. How would I do that?
Basically, I am trying to build a standard that acts as an envelope
around complete documents which can be of various different text-based
formats.
schema to be used in instance documents based on my schema, is there a
way to force that the contents of that element must be an entire,
complete instance document for that other schema?
Let's say I have the following schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="BogusElement" type="BogusType"/>
<xs:complexType name="BogusType">
<xs:sequence>
<xs:any namespace="http://www.w3.org/1999/xhtml"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
It has only the one element BogusElement and it can contain only the one
child element from the XHTML schema. Does this force the BogusElement
element in the instance document to contain a complete XHTML document
including headers or would
<?xml version="1.0" encoding="UTF-8"?>
<BogusElement
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="Untitled1.xsd"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<xhtml:strong>Bolded Text.</xhtml:strong>
</BogusElement>
be a valid document under the above schema?
How can I make it so that the contents of the BogusElement element in the
instance document must be a complete XHTML document in order to be valid?
Or would I just have to make that a verbal rule, not expressed in the
schema?
To complicate things further: Let's say I wanted that element to contain
only one of a list of valid, complete documents such as either a complete
html document OR a complete XHTML document OR a complete DocBook
document, all with headers. How would I do that?
Basically, I am trying to build a standard that acts as an envelope
around complete documents which can be of various different text-based
formats.