W3C home > Mailing lists > Public > xmlschema-dev@w3.org > December 2001

Re: SubstitutionGroup / Derivation Clarification

From: Eddie Robertsson <eddie@allette.com.au>
Date: Tue, 04 Dec 2001 09:58:32 +1100
Message-ID: <3C0C0398.1F611BCC@allette.com.au>
To: xsd@themartian.com
CC: xmlschema-dev@w3.org
> Just a clarification on these (not for me):
>
> Do these three parts of the schema work together?  In particular can the role, remark, and
> accept elements legally be in a substitutionGroup with the contextElement as its head
> (even though their types are not derived from contextType)?

No, elements declared to be in the substitutionGroup of another element (the head element)
must have the same type or a type that is derived from the type of the head element. See [1]

Cheers,
/Eddie

[1] http://www.w3.org/TR/xmlschema-0/#SubsGroups

>
>
> <xsd:complexType name="contextType">
>   <xsd:choice minOccurs="0" maxOccurs="unbounded">
>     <xsd:element ref="context" minOccurs="0" maxOccurs="unbounded"/>
>     <xsd:element ref="contextElement" minOccurs="0" maxOccurs="unbounded"/>
>   </xsd:choice>
>   <xsd:attributeGroup ref="IDGroup"/>
> </xsd:complexType>
>
> <xsd:element name="context" type="contextType"/>
>
> <xsd:element name="contextElement" type="contextType"/>
>
> <xsd:element name="role" substitutionGroup="contextElement">
>   <xsd:complexType>
>     <xsd:simpleContent>
>       <xsd:extension base="xsd:string">
>         <xsd:attribute name="idscheme" use="optional">
>           <xsd:simpleType>
>             <xsd:restriction base="xsd:NMTOKEN">
>               <xsd:enumeration value="MARC"/>
>               <xsd:enumeration value="ONIX"/>
>               <xsd:enumeration value="MPEG7"/>
>             </xsd:restriction>
>           </xsd:simpleType>
>         </xsd:attribute>
>       </xsd:extension>
>     </xsd:simpleContent>
>   </xsd:complexType>
> </xsd:element>
>
> <xsd:element name="remark" type="xsd:string" substitutionGroup="contextElement"/>
>
> <xsd:element name="accept" substitutionGroup="contextElement"/>
>
> Thanks in advance.
> From: xsd@themartian.com
> To: xmlschema-dev@w3.org
> Subject: SubstitutionGroup / Derivation Clarification
>
> Just a clarification on these (not for me):
>
> Do these three parts of the schema work together?  In particular can the role, remark, and
> accept elements legally be in a substitutionGroup with the contextElement as its head
> (even though their types are not derived from contextType)?
>
> <xsd:complexType name="contextType">
>   <xsd:choice minOccurs="0" maxOccurs="unbounded">
>     <xsd:element ref="context" minOccurs="0" maxOccurs="unbounded"/>
>     <xsd:element ref="contextElement" minOccurs="0" maxOccurs="unbounded"/>
>   </xsd:choice>
>   <xsd:attributeGroup ref="IDGroup"/>
> </xsd:complexType>
>
> <xsd:element name="context" type="contextType"/>
>
> <xsd:element name="contextElement" type="contextType"/>
>
> <xsd:element name="role" substitutionGroup="contextElement">
>   <xsd:complexType>
>     <xsd:simpleContent>
>       <xsd:extension base="xsd:string">
>         <xsd:attribute name="idscheme" use="optional">
>           <xsd:simpleType>
>             <xsd:restriction base="xsd:NMTOKEN">
>               <xsd:enumeration value="MARC"/>
>               <xsd:enumeration value="ONIX"/>
>               <xsd:enumeration value="MPEG7"/>
>             </xsd:restriction>
>           </xsd:simpleType>
>         </xsd:attribute>
>       </xsd:extension>
>     </xsd:simpleContent>
>   </xsd:complexType>
> </xsd:element>
>
> <xsd:element name="remark" type="xsd:string" substitutionGroup="contextElement"/>
>
> <xsd:element name="accept" substitutionGroup="contextElement"/>
>
> Thanks in advance.
Received on Monday, 3 December 2001 17:51:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:25 GMT