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

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -