XSD sequence

Discussion in 'XML' started by =?ISO-8859-1?Q?L=FCpher_Cypher?=, Dec 27, 2005.

  1. Hi,
    I'm trying to have a sequence which will validate both of the following
    XMLs:

    <root>
    <a>text</a>
    <b>text</b>

    <c>text</c>
    <c>text</c>
    ...
    <c>text</c>

    <d>text</d>
    <d>text</d>
    ...
    <d>text</d>

    <e>...</e>
    </root>

    and

    <root>
    <a>text</a>
    <b>text</b>

    <d>text</d>
    <d>text</d>
    ...
    <d>text</d>

    <c>text</c>
    <c>text</c>
    ...
    <c>text</c>

    <e>...</e>
    </root>

    So, I have

    <xs:element name="root">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="a" type="xs:string" />
    <xs:element name="b" type="xs:string" />
    ???
    <xs:element name="e" type="sometype" />
    </xs:sequence>
    </xs:complexType>
    </xs:element>

    Is there a way to say that each of <c> and <d> can appear a number of
    times (like in <xs:sequence><xs:elem name="c" minOccurs="0"
    maxOccurs="unbounded" /></xs:sequence>) but the order in which they
    appear does not matter? In other words, there may be zero or more <c>
    tags followed by zero or more <d> tags, or zero or more <d> tags
    followed by zero or more <c> tags.

    Thanks,
    luph
     
    =?ISO-8859-1?Q?L=FCpher_Cypher?=, Dec 27, 2005
    #1
    1. Advertising

  2. Your question boils down to converting a content model which one might
    start by writing as

    (a*,b*,((c*,d*)|(d*,c*)),e*)

    into a form which is legal.

    This is an FAQ, to which the answer is

    (a*,b*,((c+,d*)|(d+,c*))?,e*)

    ht
    --
    Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
    Half-time member of W3C Team
    2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
    Fax: (44) 131 650-4587, e-mail:
    URL: http://www.ltg.ed.ac.uk/~ht/
    [mail really from me _always_ has this .sig -- mail without it is forged spam]
     
    Henry S. Thompson, Dec 29, 2005
    #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. klikic
    Replies:
    2
    Views:
    2,528
    George Bina
    Jan 15, 2007
  2. Replies:
    4
    Views:
    2,090
  3. stef mientki
    Replies:
    13
    Views:
    664
    stef mientki
    Oct 20, 2007
  4. eephyne
    Replies:
    2
    Views:
    950
    Alain Ketterlin
    Mar 18, 2011
  5. eephyne
    Replies:
    1
    Views:
    937
    Martin Honnen
    Mar 18, 2011
Loading...

Share This Page