[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Particle Restriction Elt:Elt -- NameAndTypeOK

From: Zafar Abbas <Zafar.Abbas@microsoft.com>
Date: Mon, 9 Oct 2006 12:23:07 -0700
Message-ID: <81BA5E955D6B4B4DB2F05075C345A5DE08394D10@RED-MSG-42.redmond.corp.microsoft.com>
To: Koen Van Oost <koen.vanoost@online.be>, <xmlschema-dev@w3.org>
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 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.