Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setting up a rule involving 2 or more elements within an XSD file

Status
Not open for further replies.

varocho

Programmer
Dec 4, 2000
238
US
Is there a way to set up a rule involving 2 or more elements within an XSD file? Some examples of the kinds of rules I mean:

'element2' is required is 'element1' has a value of 1

The value of 'element2' is in the range 100-200 if the value of 'element1' is 'A', 'B' or 'C'.
 
I think the only way to do this is use a choice and put all the possible arrangements into it.

Something along the lines of:

choice
<element1>1</element1>
<element2/>
or
<element1>not 1</element1>

Jon

"I don't regret this, but I both rue and lament it.
 
How would I set up validations for the following?

<fld fld_id='1'>
<fld_val>100</fld_val>
</fld>
<fld fld_id='2'>
<fld_val>Yes</fld_val>
</fld>

where 'fld_val' has to be between 50 and 150 when 'fld_id'='1' and 'fld_val' has to be either 'Yes' or 'No' when 'fld_id'='2'.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top