OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] question about restrictions

[ Lists Home | Date Index | Thread Index ]

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




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS