Alternate to Sequence?

Discussion in 'XML' started by Sean Burns, Jan 23, 2006.

  1. Sean Burns

    Sean Burns Guest

    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
    Sean Burns, Jan 23, 2006
    #1
    1. Advertising

  2. 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

    "Sean Burns" <> wrote in message
    news:...
    > 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
    >
    Stan Kitsis [MSFT], Jan 23, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alfons Puig

    Alternate to HTTP Response Header Refresh

    Alfons Puig, Aug 28, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    599
    Charlie Nilsson [MSFT]
    Aug 30, 2003
  2. Replies:
    9
    Views:
    279
  3. Chris
    Replies:
    2
    Views:
    669
    Chris
    Mar 4, 2007
  4. stef mientki
    Replies:
    13
    Views:
    618
    stef mientki
    Oct 20, 2007
  5. Replies:
    10
    Views:
    326
    Sean O'Halpin
    Jul 17, 2006
Loading...

Share This Page