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:07:20 UTC