Checks and Constraints with XML Schema?
Posted: Thu May 19, 2005 12:24 pm
Hi,
I have the following 2 XML files:
-----
<test>
<type>car</type>
<vehicle>BMW</vehicle>
<vehicle>Audi</vehicle>
<vehicle>Rover</vehicle>
</test>
-----
and:
-----
<test>
<type>motorbike</type>
<vehicle>Honda</vehicle>
<vehicle>Kawasaki</vehicle>
</test>
-----
Is it possible to check the value of 'type' to restrict the possible values of 'vehicle' with XML Schema?
I'd like XML Schema to accept only the values 'BMW', 'Audi' and 'Rover' (and other out of a list) if the type is set to 'car' and different values, if the type is set to 'motorbike'.
Thanks for any help.
Regards,
Juergen
I have the following 2 XML files:
-----
<test>
<type>car</type>
<vehicle>BMW</vehicle>
<vehicle>Audi</vehicle>
<vehicle>Rover</vehicle>
</test>
-----
and:
-----
<test>
<type>motorbike</type>
<vehicle>Honda</vehicle>
<vehicle>Kawasaki</vehicle>
</test>
-----
Is it possible to check the value of 'type' to restrict the possible values of 'vehicle' with XML Schema?
I'd like XML Schema to accept only the values 'BMW', 'Audi' and 'Rover' (and other out of a list) if the type is set to 'car' and different values, if the type is set to 'motorbike'.
Thanks for any help.
Regards,
Juergen