- From: <Mike_Leditschke@nemmco.com.au>
- Date: Sat, 19 May 2001 02:13:35 +1000
- To: xmlschema-dev@w3.org
The schema below validates ok with XMLSpy, and allows the "subelement" to
have variable
content (string/date/number).
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" targetNamespace
="test" xmlns="test">
<xsd:group name="group1">
<xsd:sequence>
<xsd:element name="subelement" type="xsd:string"/>
</xsd:sequence>
</xsd:group>
<xsd:group name="group2">
<xsd:sequence>
<xsd:element name="subelement" type="xsd:number"/>
</xsd:sequence>
</xsd:group>
<xsd:group name="group3">
<xsd:sequence>
<xsd:element name="subelement" type="xsd:date"/>
</xsd:sequence>
</xsd:group>
<xsd:element name="test">
<xsd:complexType>
<xsd:choice>
<xsd:group ref="group1"/>
<xsd:group ref="group2"/>
<xsd:group ref="group3"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Is this a valid schema? Will it validate all the following instances ok
(ignoring namespace stuff)?
<test>
<subelement>abc</subelement>
</test>
OR
<test>
<subelement>2001-05-18</subelement>
</test>
OR
<test>
<subelement>125</subelement>
</test>
If so, does a group definition provide some type of "local" scoping of the
subelement content model such that the above doesn't cause conflicts?
It just didn't look/feel right to me.
Thanks
Michael
Received on Friday, 18 May 2001 12:14:16 UTC