Re: 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)?

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 UTC