Simple question

Discussion in 'XML' started by Volker Zink, Aug 12, 2004.

  1. Volker Zink

    Volker Zink Guest

    I am writing my first schema and have 3 complex types which represent
    "top level objects":

    <complex type name="A1">
    ....
    </complex type>

    <complex type name="A2">
    ....
    </complex type>

    <complex type name="A3">
    ....
    </complex type>


    In the XML-Document i want that there may be any number of
    corresponding elements in any order. I.e.

    <A1></A1>
    <A2></A2>
    <A1></A1>
    <A3></A3>
    <A1></A1>
    <A2></A2>

    How do i model that in the schema?

    I can't use the union, because these are complex types, and all is not
    possible too because the number is unbounded. Is there a simple
    solution to this simple problem?

    Thanks

    Volker
     
    Volker Zink, Aug 12, 2004
    #1
    1. Advertisements

  2. Volker Zink wrote:
    > In the XML-Document i want that there may be any number of
    > corresponding elements in any order. I.e.
    >
    > <A1></A1>
    > <A2></A2>
    > <A1></A1>
    > <A3></A3>
    > <A1></A1>
    > <A2></A2>
    >
    > How do i model that in the schema?


    Declare an unbounded choice element in your schema, e.g.:

    <xs:element name="root">
    <xs:complexType name="rootType">
    <xs:choice maxOccurs="unbounded">
    <xs:element name="A1"/>
    <xs:element name="A2"/>
    <xs:element name="A3"/>
    </xs:choice>
    </xs:complexType>
    </xs:element>

    Try it out! I hope this is what you where looking for.

    Peter
     
    Peter Gerstbach, Aug 12, 2004
    #2
    1. Advertisements

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. Dave E
    Replies:
    7
    Views:
    926
    Josh Twist
    Jan 11, 2006
  2. Daniel Frey

    Simple Question - Simple Answer?

    Daniel Frey, Dec 28, 2004, in forum: XML
    Replies:
    4
    Views:
    1,096
    Daniel Frey
    Jan 12, 2005
  3. Replies:
    7
    Views:
    854
    Stig Brautaset
    Jul 23, 2003
  4. Eric
    Replies:
    2
    Views:
    538
    kbutterly
    Dec 7, 2006
  5. Oli

    simple simple question

    Oli, Jan 26, 2004, in forum: ASP General
    Replies:
    10
    Views:
    593
    Roland Hall
    Jan 26, 2004
  6. Peter Bailey

    simple, simple array question

    Peter Bailey, Apr 8, 2008, in forum: Ruby
    Replies:
    7
    Views:
    465
    Peter Bailey
    Apr 8, 2008
  7. Kirk

    Simple Question = simple answer?

    Kirk, Sep 23, 2003, in forum: Javascript
    Replies:
    1
    Views:
    270
    Martin Honnen
    Sep 23, 2003
  8. db
    Replies:
    7
    Views:
    417
Loading...