Attribute groups

I'm trying to see if something like this is possible-

Given the following (example only):

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:element name="elementOne">
		<xs:annotation>
			<xs:documentation>Comment describing your root
element</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:simpleContent>
				<xs:extension base="xs:string">
					<xs:attribute name="type"
type="xs:string"/>
					<xs:attributeGroup
ref="TestAttrGroup"/>
				</xs:extension>
			</xs:simpleContent>
		</xs:complexType>
	</xs:element>

	<xs:attribute name="attrOne" type="xs:string"/>
	<xs:attribute name="attrTwo" type="xs:string"/>

	<xs:attributeGroup name="TestAttrGroup">
		<xs:attribute ref="attrOne" use="required"/>
		<xs:attribute ref="attrTwo" use="optional"/>
	</xs:attributeGroup>

</xs:schema>

With this schema, I believe that any document valid for this schema will
have to have a top-level "elementOne" element and this element will at least
have a "type" attribute and a "attrOne" attribute. The "attrTwo" attribute
is optional-

Example:

<elementOne type="typeval" attrOne="Some Value" attrTwo="Optional Value"/>

This is the behavior I would LIKE to have:

What I'd like to be able to do is make the attribute *group* optional, based
on whether one of the attributes in the group (the required one) is
supplied- in other words, if the attrOne attribute is supplied, an attrTwo
attribute may optionally be supplied. If attrOne is not supplied, attrTwo
CANNOT be supplied, but the document remains valid if neither is supplied.
So under the behavior I would like to achive:

<elementOne type="sometype"/> <== Valid
<elementOne type="sometype" attrOne="val" attrTwo="otherval"/>  <==Also
valid
<elementOne type="sometype" attrTwo="val"/> <== Invalid, because there is no
"attrOne" attribute.

Can this be done? Any suggestions? Thanks in advance, and if I need to
clarify this please let me know. I've searched Google and dug through some
of my references, but haven't had any luck yet. I'm not sure if there's a
better way to accomplish this.

Corey Snow

#########################################################
The information contained in this e-mail and subsequent attachments may be privileged, 
confidential and protected from disclosure.  This transmission is intended for the sole 
use of the individual and entity to whom it is addressed.  If you are not the intended 
recipient, any dissemination, distribution or copying is strictly prohibited.  If you 
think that you have received this message in error, please e-mail the sender at the above 
e-mail address.
#########################################################

Received on Thursday, 14 March 2002 17:31:45 UTC