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

Re: question about restrictions


brent worden
I believe you found the cause in your explanation below - the
restriction is not actually a restriction. You would have to - for
example - change one of the maxOccurs facets from "unbounded" to "5" (or
anything other than "unbounded").

Kind Regards,
Joe Chiusano
Booz | Allen | Hamilton
Strategy and Technology Consultants to the World

Brent Worden wrote:
> 
> I have a question regarding the following schema:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema targetNamespace="urn:example" xmlns="urn:example"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
> attributeFormDefault="unqualified">
> 
>   <xsd:element name="Root" type="RestrictedType"/>
> 
>   <xsd:complexType name="RestrictedType">
>     <xsd:complexContent>
>       <xsd:restriction base="BaseType">
>         <xsd:sequence>
>           <xsd:element name="FirstElement">
>             <xsd:complexType>
>               <xsd:choice>
>                 <xsd:element name="FirstChoice" type="xsd:string"
> maxOccurs="unbounded"/>
>                 <xsd:element name="SecondChoice" type="xsd:string"
> maxOccurs="unbounded"/>
>               </xsd:choice>
>             </xsd:complexType>
>           </xsd:element>
>           <xsd:element name="SecondElement" type="xsd:string" minOccurs="0"
> maxOccurs="unbounded"/>
>         </xsd:sequence>
>       </xsd:restriction>
>     </xsd:complexContent>
>   </xsd:complexType>
> 
>   <xsd:complexType name="BaseType">
>     <xsd:sequence>
>       <xsd:element name="FirstElement">
>         <xsd:complexType>
>           <xsd:choice>
>             <xsd:element name="FirstChoice" type="xsd:string"
> maxOccurs="unbounded"/>
>             <xsd:element name="SecondChoice" type="xsd:string"
> maxOccurs="unbounded"/>
>           </xsd:choice>
>         </xsd:complexType>
>       </xsd:element>
>       <xsd:element name="SecondElement" type="xsd:string" minOccurs="0"
> maxOccurs="unbounded"/>
>     </xsd:sequence>
>   </xsd:complexType>
> 
> </xsd:schema>
> 
> When I try validating a simple XML document using Xerces with full schema
> checking enabled, I get the following error message:
> Error for type 'RestrictedType'.  The particle of the type is not a valid
> restriction of the particle of the base.
> 
> Through the process of elimination, I've determined the trouble lies in
> FirstElement found in the two types.  I've looked at the schema contraints
> at http://www.w3.org/TR/xmlschema-1/#derivation-ok-restriction that I
> believe govern this issue.  With reading those and since, FirstElement is a
> verbatium copy from BaseType to RestrictedType I've been unable to determine
> the cause for the invalid restriction message.
> 
> Can someone give me some insight into the cause of the violation?
> 
> Thanks,
> 
> Brent Worden
> 
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
> 
> The list archives are at http://lists.xml.org/archives/xml-dev/
> 
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://www.oasis-open.org/mlmanage/index.php>

-- 
Kind Regards,
Joseph Chiusano
Associate
Booz | Allen | Hamilton

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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-2013 All Rights Reserved.