Allow xsd:choice element to specify choices among attributes...

Hi,
I have an XML element that has 3 or 4 attributes.
All of them are optional.
But if "attrib1" is present then "attrib2" must not be there and vice-versa.
This is a requirement.
How can this be achieved with current schema recommendation ?

valid :
<myelement attrib1="test" attrib3="te" attrib4="mm"/>
<myelement attrib2="test" attrib3="te" attrib4="mm"/>

in-valid:
<myelement attrib1="test" attrib2="test" attrib3="te" attrib4="mm"/>

IF "choice" is allows me to specify a choice for attributes , I can do that
<xsd:choice minOccurs="0" maxOccurs="1">
<xsd:attribute name="attrib1" type="xsd:string"/>
<xsd:attribute name="attrib2" type="xsd:string"/>
</xsd:choice>

otherwise, is there a way to do this ?


Regards

Raja 

Received on Monday, 8 July 2002 13:50:37 UTC