Hi Elsa,
XML Schema 1.0 disallows many restrictions which intuitively look valid.
This appears to be one of them.
If you follow the MapAndSum constraint [1] in the Structures spec you'll
find that in order for your type to be a valid restriction, the product of
maxOccurs of the sequence in the derived type and the number of particles
in the sequence in the derived type must be less than or equal to the
maxOccurs of the choice on the base type. That isn't satisfied here
([R.maxOccurs = 1] * [R.particles.count = 2] > [B.maxOccurs = 1]). Perhaps
the tools you've used aren't checking this constraint to the letter of the
spec.
Thanks.
[1] http://www.w3.org/TR/xmlschema-1/#rcase-MapAndSum
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org
Elsa YaƱez Morante <elsa.yanez@catastro.meh.es> wrote on 06/11/2007
07:07:39 AM:
> Hello,
>
> We are working with XML Schemas and we have detected that, using
> Xerces? validation, there are some errors that don?t appear if we
> use other tools to validate our schemas.
>
> Errors happen when we have a base type that contains a choice
> particle followed by sequence or choice particles and we want to
> define a restricted type. Xerces only allow one element in those
> sequence or choice particles. But all the elements should be allowed.
>
> This is an example:
>
> - This is the base type, that contains a choice particle
> followed by two sequence particles:
>
> <xsd:complexType name="base">
> <xsd:choice>
> <xsd:sequence
> minOccurs="0">
> <xsd:element name="a" type="xsd:string"
> minOccurs="0"/>
> <xsd:element name="b" type="xsd:string"
> minOccurs="0"/>
> <xsd:element name="c" type="xsd:string"
> minOccurs="0"/>
> <xsd:element name="d" type="xsd:string"
> minOccurs="0"/>
> <xsd:element name="e" type="xsd:string"
> minOccurs="0"/>
> <xsd:element name="f" type="xsd:string"
> minOccurs="0"/>
> <xsd:element name="g" type="xsd:string"
> minOccurs="0"/>
> <xsd:element name="h" type="xsd:string"
> minOccurs="0"/>
> <xsd:element name="i" type="xsd:string"
> minOccurs="0"/>
> </xsd:sequence>
> <xsd:sequence
> minOccurs="0">
> <xsd:element name="j" type="xsd:string"
> minOccurs="0"/>
> <xsd:element name="k" type="xsd:string"
> minOccurs="0"/>
> </xsd:sequence>
> </xsd:choice>
> </xsd:complexType>
>
>
>
> - This is a restricted type that contains the same choice
> particle followed only by one of the sequence particles. Xerces find
> errors at this type.
>
> <xsd:complexType name="restricted1">
> <xsd:complexContent>
> <xsd:restriction base="base">
> <xsd:choice>
> <xsd:sequence>
> <xsd:element name="j" type="xsd:string"/>
> <xsd:element name="k" type="xsd:string"/>
> </xsd:sequence>
> </xsd:choice>
> </xsd:restriction>
> </xsd:complexContent>
> </xsd:complexType>
>
> These are the errors that Xerces find:
> rcase-MapAndSum.2: Group's occurrence range, (2,2), is not a valid
> restriction of base group's occurrence range, (1,1).
>
> derivation-ok-restriction.5.4.2: Error for type 'restricted1'. The
> particle of the type is not a valid restriction of the particle of the
base.
>
>
> - This is another restricted type. Xerces doesn?t find
> errors at it because the sequence particle only contains one element.
>
> <xsd:complexType name="restricted2">
> <xsd:complexContent>
> <xsd:restriction base="base">
> <xsd:choice>
> <xsd:sequence>
> <xsd:element name="j" type="xsd:
> string"/>
> </xsd:sequence>
> </xsd:choice>
> </xsd:restriction>
> </xsd:complexContent>
> </xsd:complexType>
>
>
>
> We believe this is caused by a Xerces? bug because we think that our
> schema is valid according to W3C Recommendation (http://www.w3.
> org/TR/xmlschema-1/). Could you tell us if we are right?
>
> Thank you very much.
> P Antes de imprimir este e-mail piense bien si es necesario hacerlo:
> El medioambiente es cosa de todos
> Before printing this email, assess if it is really needed.
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
|