Exchangeable top-elements in XML Schema?

R

Richard Smol

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
 
P

Priscilla Walmsley

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,247
Members
46,844
Latest member
JudyGvh32

Latest Threads

Top