Say you have the following in a schema:
<xsd:complexType name="shape"/>
<xsd:complexType name="circle">
<xsd:complexContent>
<xsd:extension base="shape">
<xsd:attribute name="radius" type="xsd:double"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="arc">
<xsd:complexContent>
<xsd:extension base="circle">
<xsd:attribute name="startAngle" type="xsd:double"/>
<xsd:attribute name="endAngle" type="xsd:double"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
It is then possible to add a substitution group like this
<xsd:element name="shape" type="shape" abstract="true"/>
<xsd:element name="circle" type="circle" substitutionGroup="shape"/>
<xsd:element name="arc" type="arc" substitutionGroup="shape"/>
and then take in any of those types by referencing the group like:
<xsd:element ref="shape"/>
That part isn't a problem.
But what if I also want to be able to allow (in another section) just circle and its subtype?
Is it possible to add multiple substitutiongroups in order to emulate proper inheritance in a schema? I tried adding another element type like:
<xsd:element name="shape" type="shape" abstract="true"/>
<xsd:element name="circle" type="circle" substitutionGroup="shape"/>
<xsd:element name="arc" type="arc" substitutionGroup="shape"/>
<xsd:element name="arc2" type="arc" substitutionGroup="circle"/>
But I'd rather not have to change the name of the expected element depending on what I'm expecting.
Is there a better way to do this?