In XSD i have one element x which takes values (a,b)
There is another element y
Is there any way using XSD so that i can make y as mandatory when value of x is b and optional if value of x is a
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Have a look at XML Schema Part 0: Primer Second Edition, section 2.2.1 Occurrence Constraints.
It says:
Because an attribute value cannot be deduced from other schema content in XML Schema, what you want to achieve is impossible (with XML Schema).
(I don’t know if Relax NG can do this, but you may investigate if it supports such content-dependent definitions.)