Hi all

I'm looking for a shema solution since a while. The idea is to have one parent element which stores 2 elements of different name. At least one of them must occur, but it is not defined which. It must not be possible to repeat one element twice (child1 should occurs maximum once).

My idea is something like this:
<xs:element name="parent">
			<xs:choice maxOccurs="2">
				<xs:element name="child1" minOccurs="0"/>
				<xs:element name="child2" minOccurs="0"/>
Generating a sample xml with XMLSpy shows, that this doesn't work.
Wrong in the example xml is:
it is
  • possible to repeat child1 (or child2) two times
  • it is possible to declare a parent without child elements

Do you have an idea how to solve this problem?

Thank you.

Kind regards