RE: Particle Restriction Elt:Elt -- NameAndTypeOK

You are getting an error since the type of the local particle
EmployerClass is not a valid restriction of the type of the globally
declared element EmployerClass. Even though they are both derived from
xs:int , it still does not make one valid restriction of the other. Your
solution of creating base and derived simple types works since it
follows the rules of valid type derivation.

 

Thanks.

 

 

________________________________

From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org]
On Behalf Of Koen Van Oost
Sent: Wednesday, October 04, 2006 11:30 AM
To: xmlschema-dev@w3.org
Subject: Particle Restriction Elt:Elt -- NameAndTypeOK

 

Hi,

 

I have an invalid XSD schema due to an incorrect particle restriction.

Still I cannot explain why this is.

Can somebody help me.

 

We need to modify the EmployerClass definition since it changed.

(In the real live the EmployerClass definition is included in another
xsd)

 

I manage to get it right if I create a EmployerClass simpleType and then
restrict this.

Is there no other way?

 

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">

            <xs:complexType name="EmployerType">

                        <xs:annotation>

                                   <xs:documentation
xml:lang="FR">Employeur</xs:documentation>

                                   <xs:documentation
xml:lang="NL">Werkgever</xs:documentation>

                        </xs:annotation>

                        <xs:sequence>

                                   <xs:element ref="EmployerID"/>

                                   <xs:element ref="EmployerClass"
minOccurs="0"/>

                        </xs:sequence>

            </xs:complexType>

            <xs:element name="EmployerClass">

                        <xs:annotation>

                                   <xs:documentation
xml:lang="FR">Categorie de l'employeur</xs:documentation>

                                   <xs:documentation
xml:lang="NL">Werkgevercategorie</xs:documentation>

                                   <xs:documentation
source="KszBcssGlossary">120001</xs:documentation>

                        </xs:annotation>

                        <xs:simpleType>

                                   <xs:restriction base="xs:int">

                                               <xs:minInclusive
value="0"/>

                                               <xs:maxInclusive
value="9999"/>

                                   </xs:restriction>

                        </xs:simpleType>

            </xs:element>

            <xs:complexType name="EmployerIDType">

                        <xs:sequence>

                                   <xs:element
name="NOSSRegistrationNbr" minOccurs="0"/>

                        </xs:sequence>

            </xs:complexType>

            <xs:element name="EmployerID" type="EmployerIDType">

                        <xs:annotation>

                                   <xs:documentation
xml:lang="FR">Identification de l'employeur</xs:documentation>

                                   <xs:documentation
xml:lang="NL">Identificatie van het werkgever</xs:documentation>

                                   <xs:documentation
source="KszBcssGlossary">121000</xs:documentation>

                        </xs:annotation>

            </xs:element>

            <xs:element name="Test">

                        <xs:complexType>

                                   <xs:sequence>

                                               <xs:element
name="Activity" minOccurs="0" maxOccurs="5">

 
<xs:complexType>

 
<xs:sequence>

 
<xs:element name="Employer" minOccurs="0">

 
<xs:complexType>

 
<xs:complexContent>

 
<xs:restriction base="EmployerType">

 
<xs:sequence>

 
<xs:element ref="EmployerID"/>

 
<xs:element name="EmployerClass" minOccurs="0">

 
<xs:annotation>

 
<xs:documentation>Categorie de l employeur</xs:documentation>

 
</xs:annotation>

 
<xs:simpleType>

 
<xs:restriction base="xs:int">

 
<xs:minInclusive value="0"/>

 
<xs:maxInclusive value="999"/>

 
</xs:restriction>

 
</xs:simpleType>

 
</xs:element>

 
</xs:sequence>

 
</xs:restriction>

 
</xs:complexContent>

 
</xs:complexType>

 
</xs:element>

 
</xs:sequence>

 
</xs:complexType>

                                               </xs:element>

                                   </xs:sequence>

                        </xs:complexType>

            </xs:element>

</xs:schema>

 

Thanks,

Koen

Received on Monday, 9 October 2006 20:19:56 UTC