This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Do XSD/DTD allow validation based on the conditional appearance of attribute values?
I want a validation rule such that: 1) If the value of provider is "Me", the attribute quality is not required, maybe because I trust my own quality for example. 2) If the value of provider is "John", then the attribute quality is required because I may not trust everything John gives me as valid.
Can XSD define this type of rule? If not, are there good alternatives for validating XML based on this type of attribute value sensitive rule? [ August 09, 2006: Message edited by: Scott Selikoff ]
Any logic based on the value of an attribue seems like "business specific" logic more than a schema rule.
Personally, I would like my application to make that decision rather than in an XSD. So, if I were to write the rule I will expect everyone to have a quality attribute and leave it to the application to make sense of it.
All providers must provide a quality and then have a seperate list of trusted-providers. If a provider is in the trusted-provider list, ignore the quality. This is how I would do it in the application.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Joined: Jun 03, 2000
I am a bit confused about your post. If not attributes are you suggesting that it should be an element ?
Just trying to understand the pros / cons. Thanks.