W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2002

RE: Invalid particle derivation by restriction (XMLSpy vs. MSXML4 )

From: Dent, Andrew <aed5@cdc.gov>
Date: Thu, 28 Mar 2002 10:09:35 -0500 (EST)
Message-ID: <F0DEEE37B071D211AB210001FA12DAAF05412E59@mcdc-atl-50.cdc.gov>
To: "'Simon.Cox@csiro.au'" <Simon.Cox@csiro.au>, jeni@jenitennison.com
Cc: xmlschema-dev@w3.org
Hi Simon,

Thanks for the information. Will version 3 of GML use the latest w3 schema
specification?

Thanks,

Andy

-----Original Message-----
From: Simon.Cox@csiro.au [mailto:Simon.Cox@csiro.au]
Sent: Wednesday, March 27, 2002 8:13 PM
To: jeni@jenitennison.com; aed5@cdc.gov
Cc: xmlschema-dev@w3.org
Subject: RE: Invalid particle derivation by restriction (XMLSpy vs.
MSXML4 )


Andrew, Jeni - 

This is a known error in version 2 of Geography Markup Language.  
We are very close to releasing version 3 in which we hope to have eliminated
such mistakes.  

However, as some of my questions to this list may have hinted, 
we are not being helped by the approach to "derivation by restriction" 
applied by MSXML.  In some places it has helped us catch problems, 
but more recently MSXML has clearly been rejecting valid schema 
constructions - see for example:  

http://lists.w3.org/Archives/Public/xmlschema-dev/2002Mar/0177.html



_____
[This mail represents part of a discussion of work in progress 
and should not be used for any purpose without my permission.] 
_____
Simon.Cox@csiro.au  CSIRO Exploration & Mining
26 Dick Perry Avenue, Kensington WA 6151
PO Box 1130, Bentley WA 6102  AUSTRALIA
T: +61 (8) 6436 8639  F: +61 (8) 6436 8555  C: +61 (4) 0330 2672
http://www.csiro.au/page.asp?type=resume&id=CoxSimon

> -----Original Message-----
> From: Jeni Tennison [mailto:jeni@jenitennison.com]
> Sent: Wednesday, 27 March 2002 9:18 PM
> To: Dent, Andrew
> Cc: 'xmlschema-dev@w3.org'
> Subject: Re: Invalid particle derivation by restriction (XMLSpy vs.
> MSXML4)
> 
> 
> Hi Andrew,
> 
> > Quick question: The following code validates in XMLSpy, but using
> > MSXML4 (in VB) raises the following error:
> >
> > Invalid particle derivation by restriction
> > Base Type {http://www.opengis.org/gml}GeometryCollectionType
> > Derived Type {http://www.opengis.org/gml}MultiLineStringType
> 
> The relevant types from your code are:
> 
> <complexType name="MultiLineStringType">
>   <complexContent>
>     <restriction base="gml:GeometryCollectionType">
>       <sequence>
>         <element name="lineStringMember" maxOccurs="unbounded">
>           <complexType>
>             <sequence>
>               <element ref="gml:LineString"/>
>             </sequence>
>           </complexType>
>         </element>
>       </sequence>
>     </restriction>
>   </complexContent>
> </complexType>
> 
> and:
> 
> <complexType name="GeometryCollectionType">
>   <complexContent>
>     <extension base="gml:AbstractGeometryCollectionBaseType">
>       <sequence>
>         <element ref="gml:geometryMember" maxOccurs="unbounded"/>
>       </sequence>
>     </extension>
>   </complexContent>
> </complexType>
> 
> which is in turn based on:
> 
> <complexType name="AbstractGeometryCollectionBaseType" 
> abstract="true">
>   <complexContent>
>     <restriction base="gml:AbstractGeometryType">
>       <attribute name="gid" type="ID" use="optional"/>
>       <attribute name="srsName" type="anyURI" use="required"/>
>     </restriction>
>   </complexContent>
> </complexType>
> 
> The GeometryCollectionType therefore has a content of one or more
> gml:geometryMember elements.
> 
> You are attempting to derive this to a MultiLineStringType that
> contains one or more gml:lineStringMember elements.
> 
> The basic rule that you always have to follow when deriving by
> restriction is that an element that is valid according to the derived
> type *must* also be valid according to the base type. In other words,
> all the elements of the type MultiLineStringType must be valid
> according to the GeometryCollectionType.
> 
> But that's the not the case in your schema: an element that contains a
> gml:lineStringMember element isn't a valid GeometryCollectionType
> element. This is why the derivation by restriction is failing.
> 
> If you want the derivation by restriction to cause a change in the
> name of the child element, then you need to use substitution groups.
> The gml:geometryMember element needs to be declared at the top level
> of the schema (as it is already). The gml:lineStringMember element
> also needs to be declared at the top level of the schema, and
> reference the gml:geometryMember element to say that it is part of its
> substitution group:
> 
> <xs:element name="lineStringMember"
>             substitutionGroup="gml:geometryMember" ... />
> 
> Also note that to make this legal, the gml:lineStringMember element
> has to have a type that's an explicit restriction of the
> gml:geometryMember element's type.
> 
> Alternatively, if you don't want the types of gml:lineStringMember and
> gml:geometryMember to be related, you can declare the
> GeometryCollectionType to contain any elements in the GML namespace:
> 
> <complexType name="GeometryCollectionType">
>   <complexContent>
>     <extension base="gml:AbstractGeometryCollectionBaseType">
>       <sequence>
>         <any namespace="##targetNamespace" maxOccurs="unbounded" />
>       </sequence>
>     </extension>
>   </complexContent>
> </complexType>
> 
> though obviously that might cause problems elsewhere. Either way, your
> hierarchies probably need reworking a bit.
> 
> Cheers,
> 
> Jeni
> 
> ---
> Jeni Tennison
> http://www.jenitennison.com/
> 
Received on Saturday, 30 March 2002 07:31:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:30 GMT