Re: Content Model for Restrictions

Hi,

I just tried to test your cases with Xerces-J 2.7.1 and XSV 2.10.

On Mon, 2005-08-29 at 11:30 +1000, andrew.hodge@abs.gov.au wrote:
> 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"

Xerces and XSV: no errors.

TestEventPayload looks exactly the same as the definition of the
xs:anyType; so I would expect to be able to restrict this
definition in _any_ way, without bothering to think about the rules
here.

> 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>

XSV: no errors

Xerces:
aussie-2.xsd:13,51: (Error) rcase-Recurse.2: There is not a complete
functional mapping between the particles.
aussie-2.xsd:13,51: (Error) derivation-ok-restriction.5.4.2: Error for
type 'RestTestEventPayload'.  The particle of the type is not a valid
restriction of the particle of the base.

Although TestEventPayload actually still defines an equal content
model at the FSA level, it seems to hit the particle mapping
constraint at the component level. Is this intended by the spec?

> 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>

XSV and Xerces: no errors

> 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>

XSV and Xerces: no errors

> But it appears that this is not processed consistently in a hierarchical
> schema structure.

Regards,

Kasimier

Received on Monday, 29 August 2005 10:04:18 UTC