Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xml-dev] XSD: Problems with restrictions and substitution groups

From: <Nicholas.Ardlie@--.---.-->
To: <j.avery@--------.---.-->, <xml-dev@-----.---.--->
Date: 12/4/2006 3:34:00 AM
Right,
And if you find that it is valid according to Saxon then there's a good
chance you are experiencing Xerces issue 1281. 
(See https://issues.apache.org/jira/browse/XERCESC-1281).

Versions of GML prior to 3.0 have exactly the same problem.
GML Version 2.1.2 and 2.1.1 validate in Saxon (but not Xerces).
Version 2.0.0 does not validate in either but, as Michael suggests, the Saxon
error messages is more useful. For example:

[Xerces Message]
Error for type 'MultiPointType'.  The particle of the type is not a valid
restriction of the particle of the base.

[Saxon Message]
The content model of the complex type MultiPointType is not a valid
restriction of the content model of the type GeometryCollectionType.
Restricted type allows element pointMember where the base type does not.

Regards,
Nick Ardlie
Geoscience Australia
nicholas.ardlie@g...


-----Original Message-----
From: Michael Kay [mailto:mike@s...] 
Sent: Friday, 1 December 2006 8:55 PM
To: 'John Avery'; xml-dev@l...
Subject: RE: [xml-dev] XSD: Problems with restrictions and substitution
groups

I think you've hit one of those cases where your content model ought to be
allowed, but isn't under the rules of the 1.0 spec. I suspect that Saxon
will allow it, because it uses the approach adopted in XML Schema 1.1 which
defines the validity of a restriction in a different way. (1.0 defines a
specific algorithm, and the algorithm has bugs; 1.1 defines the rules
declaratively.)

In cases where your restriction is indeed invalid, I think you will find the
Saxon schema processor gives you much better explanations of why it's
invalid than you get from Xerces. Give it a try.

Michael Kay
http://www.saxonica.com/


> -----Original Message-----
> From: John Avery [mailto:j.avery@b...] 
> Sent: 01 December 2006 01:52
> To: xml-dev@l...
> Subject: [xml-dev] XSD: Problems with restrictions and 
> substitution groups
> 
> I am extending an exisitng schema for a medical messaging 
> paradigm, to define a more contrained version of the schema 
> for a specific type of message.
> 
> The oringal schema contains the following elemnt OBX:
> 
> 
> 
> And I have created several substitutions for an element 
> called OBX, these substitutions are restrictions of the OBX 
> element and work fine:
> 
> <xsd:complexType name="OBX.PD.NeedHelpToCommunicate.CONTENT">
> 		<xsd:complexContent>
> 			<xsd:restriction base="OBX.CONTENT">
> 				<xsd:sequence>
> 					<xsd:element ref="OBX.1"
> minOccurs="0"/>
> 					<xsd:element
> ref="OBX.2.PD.NeedHelpToCommunicate"/>
> 					<xsd:element
> ref="OBX.3.PD.NeedHelpToCommunicate"/>
> 					<xsd:element ref="OBX.5"
> maxOccurs="unbounded"/>
> 					<xsd:element ref="OBX.11"/>
> 				</xsd:sequence>
> 			</xsd:restriction>
> 		</xsd:complexContent>
> 	</xsd:complexType>
> <xsd:element name="OBX.PD.NeedHelpToCommunicate"
> type="OBX.PD.NeedHelpToCommunicate.CONTENT" substitutionGroup="OBX"/>
> 
> <xsd:complexType name="OBX.PD.LanguageSpokenAtHome.CONTENT">
> 		<xsd:complexContent>
> 			<xsd:restriction base="OBX.CONTENT">
> 				<xsd:sequence>
> 					<xsd:element ref="OBX.1"
> minOccurs="0"/>
> 					<xsd:element
> ref="OBX.2.PD.LanguageSpokenAtHome"/>
> 					<xsd:element
> ref="OBX.3.PD.LanguageSpokenAtHome"/>
> 					<xsd:element ref="OBX.5"
> maxOccurs="unbounded"/>
> 					<xsd:element ref="OBX.11"/>
> 				</xsd:sequence>
> 			</xsd:restriction>
> 		</xsd:complexContent>
> 	</xsd:complexType>
> <xsd:element name="OBX.PD.LanguageSpokenAtHome"
> type="OBX.PD.LanguageSpokenAtHome.CONTENT" substitutionGroup="OBX"/>
> 
> I now want to restrict the CLINICAL_OBSERVATION element:
> 
>   <xsd:complexType name="REF_I12.CLINICAL_OBSERVATION.CONTENT">
>     <xsd:sequence>
>       <xsd:element ref="OBR" minOccurs="1" maxOccurs="1" />
>       <xsd:element ref="OBX" minOccurs="0" maxOccurs="unbounded" />
>     </xsd:sequence>
>   </xsd:complexType>
>   <xsd:element name="REF_I12.CLINICAL_OBSERVATION"
> type="REF_I12.CLINICAL_OBSERVATION.CONTENT"/>
> 
> To be like this:
> 
>   <xsd:complexType name="REF_I12.CLINICAL_OBSERVATION.EONI.CONTENT">
>     <xsd:complexContent>
>       <xsd:restriction base="REF_I12.CLINICAL_OBSERVATION.CONTENT">
>         <xsd:sequence>
>             <xsd:element ref="OBR" minOccurs="1" maxOccurs="1" />
>             <xsd:element ref="OBX.PD.NeedHelpToCommunicate" 
> minOccurs = "0"/>
>             <xsd:element ref="OBX.PD.LanguageSpokenAtHome" 
> minOccurs = "0"/>
>           </xsd:sequence>
>         </xsd:restriction>
>     </xsd:complexContent>
>   </xsd:complexType>
>   <xsd:element name="REF_I12.CLINICAL_OBSERVATION.EONIi"
> type="REF_I12.CLINICAL_OBSERVATION.EONI.CONTENT"
> substitutionGroup="REF_I12.CLINICAL_OBSERVATION"/>
> 
> Certainly on the surface that seems to be a valid restricition of:
> 
> <xsd:sequence>
>       <xsd:element ref="OBR" minOccurs="1" maxOccurs="1" />
>       <xsd:element ref="OBX" minOccurs="0" 
> maxOccurs="unbounded" /> </xsd:sequence>
> 
> However I get the rcase-Recurse.2 error "There is not a 
> complete functional mapping beyween the particles". I believe 
> it has something to do with the way the substitutiongroups of 
> OBX are expanded to a choice group, and then validated 
> against my restriction, but I have tried all kinds of ways of 
> wrapping the sequence in choice and sequence tags to no avail.
> 
> Any help would be much appreciated ... even a link to some 
> software that can show the expansions or give me a more 
> detailed error message would be very useful.
> 
> ______________________________________________________________
> _________
> 
> XML-DEV is a publicly archived, unmoderated list hosted by 
> OASIS to support XML implementation and development. To 
> minimize spam in the archives, you must subscribe before posting.
> 
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@l...
> subscribe: xml-dev-subscribe@l... List archive: 
> http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
> 


_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: xml-dev-unsubscribe@l...
subscribe: xml-dev-subscribe@l...
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent