- From: Forge <forge@neonics.com>
- Date: Wed, 28 Mar 2001 19:19:43 +0000 (UTC)
- To: xmlschema-dev@w3.org
Hi there,
Normally the substitutiongroups look at the element name.
Is it also possible to make it look at some attribute name?
I have an element as such:
<status report-type="xxx">
<options>...</options>
<!-- some other elements, depending on the "xxx' above -->
</status>
I have made the following schema:
<xsd:element name="status-report" type="statusReport" abstract="true"/>
<!-- 'base class' -->
<xsd:complexType name="statusReport">
<xsd:sequence>
<xsd:element name="options" type="options" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="report-type" type="xsd:string" use="required"/>
</xsd:complexType>
<!-- instance for report-type="a" -->
<xsd:element name="status" substitutionGroup="status-report">
<xsd:complexType>
<xsd:complexContent>
<xsd:restriction base="statusReport">
<!-- add the 'payment-clusters' element -->
<xsd:sequence>
<xsd:element name="payment-clusters" type="paymentClusters"
minOccurs="1"/>
</xsd:sequence>
<!-- fix the attribute to 'a' -->
<xsd:attribute name="report-type">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="a"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
and something like that for "b". The only difference between the two is
the attribute's value and there is another element (not payment-clusters
but something else).
XMLSpy gives me the (correct) error that there are multiple declarations
of element 'status'.
Can this be done? Maybe with "xsd:choice", if so, how? I'd like
to keep the 'subclassing' in since I don't want to keep copying
everything :)
Thanks for your efforts!
Greetings,
Kenney Westerhof
Received on Wednesday, 28 March 2001 12:11:47 UTC