Re: Substitution Groups

> Ian Stokes-Rees wrote...
> 
> I am trying to make use of Substitution Groups and am having a bit of a
> problem identifying if the failure I am getting from the schema below is
> a result of Xerces or a result of bad syntax.
> 
> Can someone please confirm that the following is an acceptable schema
> and use of substitution groups:
> 
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema elementFormDefault="qualified" attributeFormDefault="unqualified"
>   targetNamespace="http://www.ara.com/animals"
>   xmlns="http://www.ara.com/animals"
>   xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> 
> 	<xsd:complexType name="AnimalType">
> 		<xsd:attribute name="name" type="xsd:string" use="required"/>
> 	</xsd:complexType>
> 
> 	<xsd:element name="Animal" type="AnimalType" abstract="true"/>
> 	<xsd:element name="Cat" type="AnimalType" substitutionGroup="Animal"/>
> 
> </xsd:schema>

This schema looks fine.

> 
> I am tending towards the idea that Xerces has a bug wherin it fails to
> identify that both Cat and Animal have the same type for the
> substitution group head.  Interestingly if an intermediate type CatType
> is introduced which derives from AnimalType and Cat is then of type
> CatType Xerces seems to be happy with it.

Sounds interesting. I tested your example with Xerces2Beta4 and also with the 
latest build from CVS. Somehow, I could not generate any error. Could you also 
post your instance file. BTW, which version of xerces are you using?.

Cheers,
Rahul.


> 
> Appreciate any comments on this.
> 
> Ian.
> 
> -- 
> Ian Stokes-Rees, Client Services      DecisionSoft Ltd.
> Telephone: +44-1865-203192            http://www.decisionsoft.com
> 

Received on Thursday, 24 January 2002 08:28:11 UTC