So, in the above XML structure, my requirement is that atleast one of AccountNumber, UserName, AppName must be supplied by the user. So, we need to validate it using XSD. Can you please suggest if there is any way to validate it through XSD? We need to create the XSD for this.
Within w3c schema language, you put cardinality facet minOccurs="0" to all of the elements AccountNumber, UserName and AppName making them all optional. But then it leaves one edge case of all of them being absent. However small and however so commonly conceivable use case it may be, w3c schema language v1.0 is not expressive enough for this edge case. If you are using v1.0, you have not much choice but to add a little routine, after validation being done, in your application code to further control the existence of at least one child element of Required_Field element. If the control is negative, throw an exception for the purpose.
In w3c schema language v1.1, a whole class of cases previously cannot be handled in v1.0 including this one can be done in a homogeneous fashion all inside the schema. The support of v1.1 is expanding and improving over time. If you are not yet ready for that, do what I have suggested above.
It is no measure of health to be well adjusted to a profoundly sick society. -Krishnamurti Tiny ad:
a bit of art, as a gift, the permaculture playing cards