xml - If one of the attributes is present then another should be required else both must be optional -
Assume that I have followed the content in the XML:
& lt; Size type = "rectangle" font size = "14.11" width = "10" height = "5" /> & Lt; Shape type = "rounded length" font size = "16" /> & Lt; Size type = "circle" font size = "12" /> & Lt; Shape type = "roundedcutangel" font size = "11" width = "10" height = "5" /> I want to create an XSD which validates that if "width" exists as a feature, then that element should have "height" and vice versa.
xsd 1.0
should be done in the code.
XSD 1.1
can be done by one:
& Lt; Xs: attribute name = "width" type = "x :: int" /> & Lt; Xs: test = "(@ height and @wide) or (not (@hite) and no (@with))" /> & lt; / XS: complexType & gt; & Lt; / XS: element & gt; & Lt; / XS: Schema & gt;
Comments
Post a Comment