[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: 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: 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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|