Page 1 of 1

Trying to define multi-level enumeration restrictions

Posted: Tue Nov 01, 2005 12:57 am
by vernon
Hi all,

I have XML as follows:

<FieldConfig Group="MAIN" FieldName="OrderNumber"/>
<FieldConfig Group="MAIN" FieldName="Customer"/>
<FieldConfig Group="MAIN" FieldName="Address"/>
<FieldConfig Group="DETAIL" FieldName="Customer"/>
<FieldConfig Group="DETAIL" FieldName="JobDesc"/>
etc.

What I want to do is restrict the FieldName attribute to a different set of values for each possible Group value.

For example, valid Group values are: MAIN, DETAIL, PAYMENT.
In Group MAIN, valid FieldName values are OrderNumber, Customer, Address, Phone.
In Group DETAIL, valid FieldName values are Customer, StartDate, JobDesc.

What is the best way to set up the restrictions in the XSD? Thanks in advance,

Vernon

Posted: Tue Nov 01, 2005 11:05 am
by george
Hi Vernon,

These are called co-occurance constraints and are not supported by XML Schema. You have as options:
* enforce them at application level
* use XML Schema with Schematron embedded rules (oXygen supports this and you can even validate against both the XML Schema and the Schematron rules in one action).
* use Relax NG schemas

Best Regards,
George