How to create a XSD which differs in validation on attribute value?

akif72

New Member
I have been searching for a while now, and came to the conclusion it may not be possible to change the validation per value of an attribute.For example I have two "action" nodes, both with a "type" attribute and two elements ("name" and "description")Only when the value of the "type" attribute is "1" it has an "a" element with "abc" child elements and when the "type" attibute is "2" it has a "bla" element with "yet" child elements.Example of type 1\[code\]<action type="1"> <name>yup</name> <description>yyy</description> <a> <abc>false</abc> </a></action>\[/code\]Example of type 2\[code\]<action type="2"> <name>yup2</name> <description>RRR</description> <bla> <yet /> </bla></action>\[/code\]I want to create one XSD* who whould check both types, is this possible? And if so, how?
  • It has to be one XSD because I want to put the XSD on a XML column of a table of a MSSQL database.
 
Back
Top