RE: Content Model for Restrictions

Saxon accepts all these schemas as valid.

Saxon isn't testing for valid restrictions according to the algorithm in the
1.0 spec (which is known to be incorrect, in the sense that it doesn't meet
the stated objective of ensuring that a restriction is valid iff it allows a
subset of the instances permitted by the base type). Rather, it implements
the Thompson/Tobin algorithm published at XML Europe 2003, which reflects
what we expect to see in the XML 1.1 spec.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: xmlschema-dev-request@w3.org 
> [mailto:xmlschema-dev-request@w3.org] On Behalf Of 
> andrew.hodge@abs.gov.au
> Sent: 29 August 2005 02:31
> To: xmlschema-dev@w3.org
> Cc: BPM_WDB@abs.gov.au
> Subject: Content Model for Restrictions
> 
> 
> Hi,
>     my name is Andrew Hodge and I am an IT Architecture 
> consultant for the
> Australian Bureau of Statistics.  We have recently found some 
> issues with
> our use of restrictions when we have moved to using a new 
> suite of schema
> validators.  We have a federated hierarchical schema model to support
> Business Process Management.  Below are some simple test cases we have
> constructed to illustrate the issues we have come across.  I 
> had a look at
> Schemas Part 0 and Part 1 but did not see any obvious 
> guidance on these
> issues.  I was wondering if anyone could point me to an 
> information source
> or comment on aspects of the content model for these types of 
> restrictions.
> Regards
> Andrew Hodge
> Australian Bureau of Statistics
> email - andrew.hodge@abs.gov.au
> 
> This is an example of a case that has been working but now validation
> fails.
> 
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:admin="
> urn:abs.gov.au/BusinessAdministrationSystems" xmlns:tns="
> urn:abs.gov.au/BusinessProcessManagement" targetNamespace="
> urn:abs.gov.au/BusinessProcessManagement" 
> elementFormDefault="qualified"
> attributeFormDefault="unqualified">
>       <xs:complexType name="TestEventPayload">
>             <xs:sequence>
>                   <xs:any namespace="##any" processContents="lax"
> minOccurs="0" maxOccurs="unbounded"/>
>             </xs:sequence>
>       </xs:complexType>
>       <xs:complexType name="RestTestEventPayload">
>             <xs:complexContent>
>                   <xs:restriction base="tns:TestEventPayload">
>                         <xs:sequence>
>                               <xs:element name="test1"/>
>                            <xs:element name="test2"/>
>                         </xs:sequence>
>                   </xs:restriction>
>             </xs:complexContent>
>       </xs:complexType>
> </xs:schema>plexType>
> </xs:schema>
> 
> It now fails with "The content model of complex type 
> tns:RestEventPayload
> is not a vaild restriction of the content model tns:TestEventPayload"
> 
> The following also fails.
> 
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:admin="
> urn:abs.gov.au/BusinessAdministrationSystems" xmlns:tns="
> urn:abs.gov.au/BusinessProcessManagement" targetNamespace="
> urn:abs.gov.au/BusinessProcessManagement" 
> elementFormDefault="qualified"
> attributeFormDefault="unqualified">
>       <xs:complexType name="TestEventPayload">
>             <xs:sequence    minOccurs="0" maxOccurs="unbounded">
>                   <xs:any namespace="##any" processContents="lax"/>
>             </xs:sequence>
>       </xs:complexType>
>       <xs:complexType name="RestTestEventPayload">
>             <xs:complexContent>
>                   <xs:restriction base="tns:TestEventPayload">
>                         <xs:sequence>
>                               <xs:element name="test1"/>
>                            <xs:element name="test2"/>
>                         </xs:sequence>
>                   </xs:restriction>
>             </xs:complexContent>
>       </xs:complexType>
> </xs:schema>plexType>
> </xs:schema>
> 
> If I comment out element test2 the validation passes
> 
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:admin="
> urn:abs.gov.au/BusinessAdministrationSystems" xmlns:tns="
> urn:abs.gov.au/BusinessProcessManagement" targetNamespace="
> urn:abs.gov.au/BusinessProcessManagement" 
> elementFormDefault="qualified"
> attributeFormDefault="unqualified">
>       <xs:complexType name="TestEventPayload">
>             <xs:sequence>
>                   <xs:any namespace="##any" processContents="lax"
> minOccurs="0" maxOccurs="unbounded"/>
>             </xs:sequence>
>       </xs:complexType>
>       <xs:complexType name="RestTestEventPayload">
>             <xs:complexContent>
>                   <xs:restriction base="tns:TestEventPayload">
>                         <xs:sequence>
>                               <xs:element name="test1"/>
>                            <!-- <xs:element name="test2"/>  -->
>                         </xs:sequence>
>                   </xs:restriction>
>             </xs:complexContent>
>       </xs:complexType>
> </xs:schema>
> 
> Interestingly if I change the schema to using choice instead 
> of sequence in
> TestEventPayload then it passes.
> 
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:admin="
> urn:abs.gov.au/BusinessAdministrationSystems" xmlns:tns="
> urn:abs.gov.au/BusinessProcessManagement" targetNamespace="
> urn:abs.gov.au/BusinessProcessManagement" 
> elementFormDefault="qualified"
> attributeFormDefault="unqualified">
>       <xs:complexType name="TestEventPayload">
>             <xs:choice  minOccurs="0" maxOccurs="unbounded">
>                   <xs:any namespace="##any" processContents="lax"/>
>             </xs:choice>
>       </xs:complexType>
>       <xs:complexType name="RestTestEventPayload">
>             <xs:complexContent>
>                   <xs:restriction base="tns:TestEventPayload">
>                         <xs:sequence>
>                               <xs:element name="test1"/>
>                               <xs:element name="test2"/>
> 
>                         </xs:sequence>
>                   </xs:restriction>
>             </xs:complexContent>
>       </xs:complexType>
> </xs:schema>
> 
> But it appears that this is not processed consistently in a 
> hierarchical
> schema structure.
> 
> 
> 
> 
> 
> 
> -----------------------------------------------
> ABS Web Site:  www.abs.gov.au
> 
> 
> 
> 

Received on Tuesday, 30 August 2005 09:09:49 UTC