XML Schema: If one of the attributes is present then another should be compulsory else both must be optional



let's say I've following content in XML;



<shape type="rectangle" fontSize="14.11" width="10" height="5" />
<shape type="roundedrectangle" fontSize="16" />
<shape type="circle" fontSize="12" />
<shape type="roundedrectangle" fontSize="11" width="10" height="5" />


I want to create an XSD which validates if "width" is present as an attribute then "height" must be present in that element and vice verse.


Prompt help is highly appreciated. Thanks in advance.


No comments:

Post a Comment