Re: Content Model for Restrictions

Hi Henry,

I have double checked and done some more tests with our schemas (with some
curious results)

Regards
Andrew

>From Henry

I'll try to get some MSoft people to look at this (but first, could
you please confirm that MSXML rejects _all_ your examples) -- as
Kasimir said, your first example is equivalent to a restriction of
anyType, and that should work for sure.

I have double checked this example :

Fails with MSXML Vers 4 SP2
Fails with MSXML Vers 4 SP1
Fails with XMLSpy Vers 5 Rel 3
Passes with XMLSpy Vers 5 Rel 2

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

*********************************************************************

This schema fails with XMLSpy Rel 5 Vers 3 (illegal restriction of content
model for EventPayload)

However it passes with MSXML Vers 4 SP2, MSXML Vers 4 SP1, XMLSpy Vers 5
Rel 2.

<xs:schema targetNamespace="urn:abs.gov.au/BusinessProcessManagement"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:admin="urn:abs.gov.au/BusinessAdministrationSystems"
xmlns:tns="urn:abs.gov.au/BusinessProcessManagement"
elementFormDefault="qualified" attributeFormDefault="unqualified">
      <xs:include schemaLocation="
http://redirectory/infra:Administration_Infrastructure-V00.50"/>
      <xs:import namespace="urn:abs.gov.au/BusinessAdministrationSystems"
schemaLocation="http://redirectory/schema:Administration-V00.50"/>
      <xs:complexType name="Administration_Generic_Request_Service-V00.50">
            <xs:complexContent>
                  <xs:restriction base="tns:Event">
                        <xs:sequence>
                              <xs:element name="EventDiscriminator"
type="xs:string"/>
                              <xs:element name="EventPublisher"
type="xs:string"/>
                              <xs:element name="EventPayload">
                                    <xs:complexType>
                                          <xs:complexContent>
                                                <xs:restriction
base="tns:EventPayload">
                                                      <xs:sequence>
                                                            <xs:element
ref="admin:Task"/>
                                                            <xs:element
ref="admin:Status" minOccurs="0"/>
                                                      </xs:sequence>
                                                </xs:restriction>
                                          </xs:complexContent>
                                    </xs:complexType>
                              </xs:element>
                        </xs:sequence>
                  </xs:restriction>
            </xs:complexContent>
      </xs:complexType>
      <xs:element name="Administration_Generic_Request_Service-V00.50"
type="tns:Administration_Generic_Request_Service-V00.50"
substitutionGroup="tns:Event"/>
</xs:schema>

it is restricting this fragment (and it needs to go through multiple
includes to get there)

....
<xs:complexType name="EventPayload">
            <xs:sequence>
                  <xs:any namespace="##any" processContents="lax"
minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
      </xs:complexType>
      <xs:element name="EventPayload" type="tns:EventPayload"/>
      <xs:complexType name="Event">
            <xs:sequence>
                  <xs:element name="EventDiscriminator" type="xs:string"/>
                  <xs:element name="EventPublisher" type="xs:string"/>
                  <xs:element ref="tns:EventPayload"/>
            </xs:sequence>
      </xs:complexType>
      <xs:element name="Event" type="tns:Event" abstract="true"/>
....


*********************************************************************


With a single include I get :

Fails with MSXML Vers 4 SP2
Fails with MSXML Vers 4 SP1
Fails with XMLSpy Vers 5 Rel 3
Passes with XMLSpy Vers 5 Rel 2

<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:include schemaLocation="c:\data\bpm\schemas\TestSpy2005
Test1.xsd"/>
      <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>

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


*********************************************************************


Some more tests


*********************************************************************


Fails with MSXML Vers 4 SP2
Fails with MSXML Vers 4 SP1
Fails with XMLSpy Vers 5 Rel 3
Passes with XMLSpy Vers 5 Rel 2

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



*********************************************************************


Passes with MSXML Vers 4 SP2
Passes with MSXML Vers 4 SP1
Passes with XMLSpy Vers 5 Rel 2
Passes with XMLSpy Vers 5 Rel 3


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


*********************************************************************


Fails with MSXML Vers 4 SP2
Fails with MSXML Vers 4 SP1
Fails with XMLSpy Vers 5 Rel 3
Passes with XMLSpy Vers 5 Rel 2

<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="test1"/>
                        </xs:sequence>
                  </xs:restriction>
            </xs:complexContent>
      </xs:complexType>
</xs:schema>


*********************************************************************


Fails with MSXML Vers 4 SP2
Fails with MSXML Vers 4 SP1
Passes with XMLSpy Vers 5 Rel 3
Passes with XMLSpy Vers 5 Rel 2


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


*********************************************************************


Passes with MSXML Vers 4 SP2
Passes with MSXML Vers 4 SP1
Passes with XMLSpy Vers 5 Rel 3
Passes with XMLSpy Vers 5 Rel 2

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





-----------------------------------------------
ABS Web Site:  www.abs.gov.au

Received on Thursday, 1 September 2005 05:44:01 UTC