Re: multiple xsd:attributes problem

Hi Marcus,

> I'm trying to implement a solution using xml schemas. The problem I
> am having is one concerend with xsd:attributes. I would like to know
> how, if possible you can declare two attributes but only require one
> or other but not both.

I'm afraid that you can't do this using XML Schema without using a
workaround such as saying that the elements with different attributes
are of different types, and using xsi:type in the instance document to
say which of the two they actually are. (Let us know if you want to
see that in action.)

Your best bet is to switch to RELAX NG [1] instead, where you can just
use a <choice> between the two attributes, or to combine your XML
Schema schema with some Schematron rules [2] that test whether both
attributes are present.

Cheers,

Jeni

[1] http://www.relaxng.org/
[2] http://www.topologi.com/public/Schtrn_XSD/Paper.html

---
Jeni Tennison
http://www.jenitennison.com/

Received on Tuesday, 29 October 2002 10:34:36 UTC