XML Schema Question

R

Raphael A. Bauer

Hi!

I have the folwing problem with my xml schema. I want the xml file to
look like:


<elementONE>
...
</elementONE>

---OR----

<elementTWO>
...
</elementTWO>


The problem is that I don't know how to formulate this "OR" within the
XML Schema. I think about using something like
<xs:complexType>
<xs:choice>
<xs:element name="elementONE">
...
</xs:element>
<xs:element name="elementTWO">
...
</xs:element>
</xs:choice>
</xs:complexType>


But that doesn't work out because for that I would imho need a
surrounding named element, but I don't want a new surrounding element.
I just want something like
xs:element name="elementONE"|name="elementTWO"
- to say - in fact the elementONE and elementTWO contain the same
content, but they differ only in the name because of "historical" reasons...

Any hints for a frustrated schema (re)maker?

Many thanks in advance,

Raph
 
S

szomiz

w said:
I just want something like
xs:element name="elementONE"|name="elementTWO"
- to say - in fact the elementONE and elementTWO contain the same
content, but they differ only in the name because of "historical"
reasons...

<xs:schema ...>
...
<xs:element name="elementONE" type="OneTwoElem"/>
<xs:element name="elementTwo" type="OneTwoElem"/>
...
<xs:complexType name="OneTwoElem">
...
</xs:complexType>
</xs:schema>

sz.
 

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

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top