- From: Costello, Roger L. <costello@mitre.org>
- Date: Thu, 25 Feb 2016 17:01:52 +0000
- To: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
> The different behavior between Saxon and Xerces for type derivation
> is known and it comes from the different algorithm used to check
> restrictions, Xerces implements the algorithm included in the XML
> Schema 1.0 specification while Saxon uses a different algorithm
Thank you very much George!
So, the question is ........ Is Xerces correct in reporting an error? ...... or ...... Is Saxon correct in not reporting an error?
Furthermore ....... Does Xerces have a bug or does Saxon have a bug?
Given that both Xerces and Saxon report that the schema is valid when XSD 1.1 is used, I am inclined to believe that Xerces has a bug. Do you agree?
/Roger
-----Original Message-----
From: George Bina [mailto:george@oxygenxml.com]
Sent: Thursday, February 25, 2016 11:23 AM
To: Costello, Roger L. <costello@mitre.org>; xmlschema-dev@w3.org
Subject: Re: Xerces developers - there's a bug in Xerces schema validation
Hi Roger,
The different behavior between Saxon and Xerces for type derivation is
known and it comes from the different algorithm used to check
restrictions, Xerces implements the algorithm included in the XML Schema
1.0 specification while Saxon uses a different algorithm, I think that
is this one:
http://www.ltg.ed.ac.uk/~ht/XML_Europe_2003.html
The XML Schema 1.0 algorithm gives in many cases unintuitive results,
thus it is very difficult to understand the error, unless you follow the
exact steps of the algorithm. FWIW, it complains about
https://www.w3.org/TR/xmlschema-1/#rcase-RecurseLax
point 2
and
https://www.w3.org/TR/xmlschema-1/#derivation-ok-restriction
point 5.4.2
and the issue may be caused because the ref to A is probably expanded as
a choice between A and its subsctitution group members - but I have not
followed the algorithm from the spec to check exactly where it finds an
issue.
For XML Schema 1.1 there is no algorithm specified anymore and this is
not reported as an error in Xerces if you specify XML Schema 1.1, for
example:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" vc:minVersion="1.1">
<xs:element name="A" type="xs:double" />
<xs:element name="B" substitutionGroup="A" type="xs:double" />
<xs:complexType name="base">
<xs:sequence>
<xs:element ref="A" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="derived">
<xs:complexContent>
<xs:restriction base="base">
<xs:sequence>
<xs:element ref="B" minOccurs="0" />
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:schema>
Best Regards,
George
--
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
On 25/02/16 16:41, Costello, Roger L. wrote:
>> Give us a clue - what's the error?
>
> No idea. Here's the error message that is generated:
>
> derivation-ok-restriction.5.4.2: Error for type 'derived'.
> The particle of the type is not a valid restriction of the
> particle of the base.
>
> Note: the secret sauce that I used to generate the error message was to use minOccurs="0" maxOccurs="unbounded" with the element in the base type and minOccurs="0" with the element in the derived-by-restriction type. Without that, I couldn't generate the error.
>
> /Roger
>
> -----Original Message-----
> From: Michael Kay [mailto:mike@saxonica.com]
> Sent: Thursday, February 25, 2016 9:34 AM
> To: Costello, Roger L. <costello@mitre.org>
> Cc: xmlschema-dev@w3.org
> Subject: Re: Xerces developers - there's a bug in Xerces schema validation
>
> Give us a clue - what's the error?
>
>> On 25 Feb 2016, at 14:20, Costello, Roger L. <costello@mitre.org> wrote:
>>
>> Hi Folks,
>>
>> Hopefully there are some Xerces developers on this mailing list (hey Mukul).
>>
>> The below schema validates fine in Saxon but Xerces throws an error. /Roger
>>
>> ----------------------------------------------------------------------------------
>> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>>
>> <xs:element name="A" type="xs:double" />
>> <xs:element name="B" substitutionGroup="A" type="xs:double" />
>>
>> <xs:complexType name="base">
>> <xs:sequence>
>> <xs:element ref="A" minOccurs="0" maxOccurs="unbounded" />
>> </xs:sequence>
>> </xs:complexType>
>>
>> <xs:complexType name="derived">
>> <xs:complexContent>
>> <xs:restriction base="base">
>> <xs:sequence>
>> <xs:element ref="B" minOccurs="0" />
>> </xs:sequence>
>> </xs:restriction>
>> </xs:complexContent>
>> </xs:complexType>
>> </xs:schema>
>>
>
>
>
Received on Thursday, 25 February 2016 17:02:24 UTC