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

RE: XSD: Problems with restrictions and substitution groups

  • From: "Michael Kay" <mike@s...>
  • To: "'John Avery'" <j.avery@b...>,<xml-dev@l...>
  • Date: Fri, 1 Dec 2006 09:54:43 -0000

substitution groups xsd
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:  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
> 



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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.