- From: Neill, Andrew <andy.neill@siemens.com>
- Date: Thu, 8 Oct 2009 12:12:26 +0200
- To: George Cristian Bina <george@oxygenxml.com>
- CC: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Hi George, Thanks for that. I have been looking at this schema too long and missed that. Thanks for your help. Andy -----Original Message----- From: George Cristian Bina [mailto:george@oxygenxml.com] Sent: 08 October 2009 11:07 To: Neill, Andrew Cc: xmlschema-dev@w3.org Subject: Re: xsd ambigious Hi Andy, You can have a first any of a, b, c any number of times and then follow them optionally with d followed by any of a, b, c, e, f any number of times: <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="element"> <xsd:complexType> <xsd:sequence> <xsd:choice maxOccurs="unbounded" minOccurs="0"> <xsd:element ref="a"/> <xsd:element ref="b"/> <xsd:element ref="c"/> </xsd:choice> <xsd:sequence minOccurs="0"> <xsd:element ref="d"/> <xsd:choice maxOccurs="unbounded" minOccurs="0"> <xsd:element ref="a"/> <xsd:element ref="b"/> <xsd:element ref="c"/> <xsd:element ref="e"/> <xsd:element ref="f"/> </xsd:choice> </xsd:sequence> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="a"/> <xsd:element name="b"/> <xsd:element name="c"/> <xsd:element name="d"/> <xsd:element name="e"/> <xsd:element name="f"/> </xsd:schema> Best Regards, George -- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com Neill, Andrew wrote: > Can anyone help with this XSD please? It doesnt seem to work? > Essentially i want to ensure that if "E" or "F" are populated then "D" > is populated before them. The rest of the elements can appear in any > order and any amount of times. > > <?xml version="1.0" encoding="UTF-8"?> > <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> > <xsd:element name="element"> > <xsd:complexType> > <xsd:choice maxOccurs="unbounded"> > <xsd:element ref="a" minOccurs="0"/> > <xsd:element ref="b" minOccurs="0"/> > <xsd:element ref="c" minOccurs="0"/> > <xsd:sequence> > <xsd:element ref="d"/> > <xsd:element ref="e"/> > </xsd:sequence> > <xsd:sequence> > <xsd:element ref="d"/> > <xsd:element ref="f"/> > </xsd:sequence> > </xsd:choice> > </xsd:complexType> > </xsd:element> > <xsd:element name="a"/> > <xsd:element name="b"/> > <xsd:element name="c"/> > <xsd:element name="d"/> > <xsd:element name="e"/> > <xsd:element name="f"/> > </xsd:schema> > > Many Thanks, > Andy
Received on Thursday, 8 October 2009 10:12:59 UTC