Schema attribute help

I normally do loose schema with extra validation after the fact, but it would be
nice to have automated validation per the schema. Things I'm trying to do individually (not all at once!):

<xs:element name="row" minOccurs="0" maxOccurs="unbounded">
<xs:attribute name="id" type="xs:long" use="required"/>
<xs:attribute name="a_id" type="xs:long"/>
<xs:attribute name="b_id" type="xs:long"/>
<xs:attribute name="c_id" type="xs:long"/>
</xs:element>
(abstracted)

1. Have one attribute allowed only if another is allowed.
eg. have c_id only if b_id is there.
Would return invalid only if c_id existed and b_id did not.

2. Have one attribute out of a set.
eg. only have one of a_id, b_id, c_id.

3. Require one attribute missing out of a set.
eg. Be missing either a_id, b_id, c_id, but not 2 or 3.

4. Require all or none.
Either have all of a_id, b_id, c_id, or have none of them.

Can't seem to figure out how to use attribute groups to do this, or if any of these are even possible. Tried <xs:choice> but that only seems to work with elements. Any schema experts out there?
[1241 byte] By [jkmyoung] at [2007-11-19 3:22:55]