- From: Mukul Gandhi <gandhi.mukul@gmail.com>
- Date: Fri, 26 Feb 2016 16:42:35 +0530
- To: "Costello, Roger L." <costello@mitre.org>
- Cc: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
- Message-ID: <CABuuzNOCEsx4b8W=+6Dc4qzkJT==TA3E_mNrVg3Je5UE8vWzug@mail.gmail.com>
Hi Roger,
First of all, this is the part where I haven't contributed much within
Xerces. But this is an important and interesting aspect of XML Schema
language.
You have provided a pretty advanced example of XSD complex type
restriction. But looking at your example carefully, it looks like a useful
and correct XSD document (may be incorrect according to XSD 1.0, if Xerces
is correct in reporting it). Here's what I further think about this
example, and points about XSD 1.0 and 1.1.
1) The elements A and B are equivalent, from the point of view of
validating XML instance elements A and B. This is due to the substitution
group syntax.
2) The complex type "derived" is the correct restriction derivation of
complex type "base". This is because,
B can substitute A, and
The "derived" type works on a lesser cardinality of B (which is essentially
a synonym of A).
I think, XML Schema 1.1 specification makes complex type restriction rules
easier to understand.
On 25 February 2016 at 19:50, 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>
>
>
--
Regards,
Mukul Gandhi
Received on Friday, 26 February 2016 11:13:22 UTC