sl******@21cn.com (slimzhao) wrote:
<title>
<A ID="ID_1"/>
<B ID="ID_2"/>
<SomeThingElse ID="ID_1000"/>
</title>
What I want to do is to write a schema for <title>'s children, which
element type is restricted to <xs:attribute name="ID" type="ID">, but
it's name is variable.
You might consider using substitutionGroup, e.g.
<xs:element name="id-elem" abstract="true">
<xs:complexType>
<xs:attribute name="ID" type="ID"/>
</xs:complexType>
</xs:element>
<xs:element name="A" substitutionGroup="id-elem">
....
</xs:element>
<xs:element name="B" substitutionGroup="id-elem">
....
</xs:element>
<xs:element name="SomeThingElse" substitutionGroup="id-elem">
....
</xs:element>
<xs:element name="title">
<xs:complexType>
<xs:element ref="id-elem" maxOccurs="unbounded"/>
</xs:complexType>
</xs:element>
Cheers
Jens
--
(Intentionally left blank.)