Is there a way to allow the 'this' attribute or the "this other" attribute, but not both?
I am trying to resolve two attribute values ββfor one element. This is how I did it now, but I only want 1 of 2, but not both.
<contact phoneH="cell">8025550000</contact>
<contact phoneW="work"> 8025550094</contact>
I want to do something like this:
<xsd:attribute name="phoneH|phoneW" type="xsd:string" />
Is there a way to use a constraint element with attributes?
Thanks,
Levy
source to share
I do not believe that restricting an attribute is possible with XML Schema.
You can apply additional validation mechanisms (like schematron ) or use a different schema implementation (i.e. Relax-NG )
http://lists.xml.org/archives/xml-dev/200107/msg00070.html
Unfortunately, you cannot do this with the W3C XML Schema. As I see it, you have two options:
1) Switch to another dialect schema (I think RELAX-NG supports this functionality) 2) Express you joint constraint using the built-in schema rule
These constraints can be checked with Topologi's new Schematron validator. The tool is free and can be downloaded from www.topologi.com.
source to share