This is what I want - if the parent attribute (attr) is true, then I want to require that child element <childB> be filled out (childA is always filled out). If the parent attribute is false, then I do not want <childB> to be filled out. How do I accomplish this conditional situation with XSD? Thanks.
The short answer is no, xsd is not expressive enough (like it or not) for that kind of constraint.
Joined: Apr 05, 2009
Thanks g tsuji,
Rethinking the issue - I think the best way to solve the example I gave is to remove "attr=true|false". Then set the childB element to optional using minoccurs=0. ChildB's presence indicates true and absence indicates false.
subject: XSD: Can I require a child element based on a parent attribute value?