Altova Mailing List Archives>Archive Index >xmlschema-dev Archive Home >Recent entries >Thread Prev - xsd ambigious >Thread Next - RE: xsd ambigious Re: xsd ambigiousTo: "Neill, Andrew" <andy.neill@-------.---> Date: 10/8/2009 10:08:00 AM 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
www.---.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
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
