[xsd-users] Need schema suggestions

Boris Kolpackov boris at codesynthesis.com
Thu May 29 09:01:55 EDT 2008


Hi Manav,

Manav Rathi <manav.rathi at incainformatics.com> writes:

> I wish to create a schema that will allow me to use both the following XML:
> 
> 1)
> <foo>
>  <bar>
>   <x />
>   <y />
>  </bar>
> </foo>
> 
> 2)
> <foo>
>  <bar>
>   <a />
>   <b />
>  </bar>
> </foo>
> 
> Any XSD schema design suggestions? 

This one should be pretty straightforward to handle with the choice
compositor:

<complexType name="bar">
  <choice>
    <sequence>
      <element name="x" type="..."/>
      <element name="y" type="..."/>
    </sequence>
    <sequence>
      <element name="a" type="..."/>
      <element name="b" type="..."/>
    </sequence>
  </choice>
</complexType>

Also note that this is a wrong list to ask general schema design
questions. A better place would be the xml-dev and xmlschema-dev
mailing lists:

http://xml.org/xml/xmldev.shtml

http://lists.w3.org/Archives/Public/xmlschema-dev/

As well as the comp.text.xml newsgroup.

Boris




More information about the xsd-users mailing list