Checks and Constraints with XML Schema?

This should cover W3C XML Schema, Relax NG and DTD related problems.
Posts: 1
Joined: Thu May 19, 2005 12:18 pm

Checks and Constraints with XML Schema?

Post by Juergen.Birkle » Thu May 19, 2005 12:24 pm


I have the following 2 XML files:


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.


Site Admin
Posts: 2102
Joined: Thu Jan 09, 2003 2:58 pm

Post by george » Fri May 20, 2005 4:22 pm

Hi Juergen,

This is generally called coocurance constraint and it is not possible with XML Schema alone.
Your example can be handled with XML Schema plus Schematron for instance or with Relax NG. All these are supported by oXygen.

Best Regards,

Post Reply