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: <>
To: W3C XML Schema Comments list <www-xml-schema-comments@w3.org>

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"/>

<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"/>

otherwise, is there a way to do this ?


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

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:50:00 UTC