Exchangeable top-elements in XML Schema?

Discussion in 'XML' started by Richard Smol, Jun 6, 2005.

  1. Richard Smol

    Richard Smol Guest

    How can I describe in an XML Schema definition that there are
    several top-elemt names possible? IK mean something like
    this:

    <SomeTopElement>
    <!-- rest goes here -->
    </SomeTopElement>

    or:

    <OtherTopElement>
    <!-- rest goes here -->
    <OtherTopElement>

    I looked at unions but get the idea that those only
    work with enclosing elements. Is that true?

    Thanks in advance for any input.

    RS
     
    Richard Smol, Jun 6, 2005
    #1
    1. Advertising

  2. Hi,

    Any element declaration that is global (i.e. the direct child of the
    xs:schema element) can be used as the root element.

    So, you don't have to do anything special to indicate that an element
    can be the root, just declare both SomeTopElement and OtherTopElement
    globally. If they both contain the same content, you can give them the
    same type.

    Hope that helps,
    Priscilla

    ----------------------------------
    Priscilla Walmsley
    Author, Definitive XML Schema
    http://www.datypic.com
    ----------------------------------

    *** Sent via Developersdex http://www.developersdex.com ***
     
    Priscilla Walmsley, Jun 6, 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. Markus
    Replies:
    1
    Views:
    1,611
    Markus
    Nov 23, 2005
  2. Fred Smith
    Replies:
    1
    Views:
    967
    Martin Honnen
    Feb 5, 2004
  3. Hari Om
    Replies:
    1
    Views:
    470
    Martin SChukrazy
    Mar 2, 2004
  4. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,295
    Stanimir Stamenkov
    Apr 25, 2005
  5. Replies:
    3
    Views:
    2,949
Loading...

Share This Page