Click here to Skip to main content
15,903,385 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi I have a an complex element something like this

HTML
<someValue tag="" value1="" value2=""/>

and

XML
<someValue to="" value1="" value2=""/>



the attributes "value1" and "value2" are optional however either one of the attributes "tag" or "to" need to be present.

so can I write a xsd for the above as


<xs:complexType name="someValueType">
   <choice>
     <xs:attribute name="tag" type="xs:nonNegativeInteger" use="required"/>
     <xs:attribute name="to" type="xs:nonNegativeInteger" use="required"/>
   </choice>
   <xs:attribute name="value1" type="xs:nonNegativeInteger" use="optional"/>
   <xs:attribute name="value2" type="xs:nonNegativeInteger" use="optional"/>
</xs:complexType>
Posted
Comments
Sergey Alexandrovich Kryukov 10-Dec-13 2:35am    
Not clear. What indicator?
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900