W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > July to September 2002

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

From: by way of <raja.cherukuri@telera.com>
Date: Mon, 08 Jul 2002 11:39:24 -0600
Message-Id: <5.1.0.14.1.20020708113920.02714bd8@localhost>
To: W3C XML Schema Comments list <www-xml-schema-comments@w3.org>




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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:13:01 GMT