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

  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. 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. Replies:
    0
    Views:
    575
  2. Kevin Spencer

    Re: Simple Simple question!!!

    Kevin Spencer, Jun 25, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    677
    Kevin Spencer
    Jun 25, 2004
  3. Daniel Frey

    Simple Question - Simple Answer?

    Daniel Frey, Dec 28, 2004, in forum: XML
    Replies:
    4
    Views:
    855
    Daniel Frey
    Jan 12, 2005
  4. Oli

    simple simple question

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

    simple, simple array question

    Peter Bailey, Apr 8, 2008, in forum: Ruby
    Replies:
    7
    Views:
    219
    Peter Bailey
    Apr 8, 2008
Loading...

Share This Page