Alternate to Sequence?

S

Sean Burns

Hello,

I am busy creating my first XSD and folloing the examples and tutorials
from "everywhere" I came up with an xsd that does the job, but I need a
alternate to "sequence" because I do not want the XML tags to be in a
specific sequence. (ALL and OPTION do not work for me either)


Some XML test data

<Holder Version="5.0.1">
<Sub1>text</Sub1>
<Sub2>text</Sub2>
<Sub3>text</Sub3>
<Sub4>text</Sub4>
<Sub1>text</Sub1>
<Sub2>text</Sub2>
<Sub3>text</Sub3>
<Sub4>text</Sub4>
<Sub4>text</Sub4>
<Sub4>text</Sub4>
<Sub1>text</Sub1>
</Holder>


The Schema I have created is:

<?xml version='1.0' encoding='UTF-8'?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<xsd:element name="Holder">
<xsd:complexType>
<xsd:sequence>
<xsd:element type="xsd:string" name="Sub1" minOccurs="2"
maxOccurs="5"/>
<xsd:element type="xsd:string" name="Sub2" minOccurs="2"
maxOccurs="5" />
<xsd:element type="xsd:string" name="Sub3"
minOccurs="2" maxOccurs="5" />
<xsd:element type="xsd:string" name="Sub4"
minOccurs="2" maxOccurs="5" />
</xsd:sequence>

<xsd:attribute name="Version" type="xsd:string" use="required"
/>
</xsd:complexType>
</xsd:element>
</xsd:schema>


Can Anyone Help Me?

Thanks
Sean
 
S

Stan Kitsis [MSFT]

Hi Sean,

Depending on your constraints, you might be able to use <xs:chocie
maxOccurs="unbounded">

--
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top