 |
 |
 |
I wish to create an XML document in which one of its elements must be
defined with one of two known attributes, but not both.
For example, I would like to define a "socketHandler" element as follows:
<xs:element name="socketHandler">
<xs:complexType>
<xs:attribute name="hostName" type="xs:string"/>
<xs:attribute name="hostAddress" type="xs:string"/>
<xs:attribute name="port" type="xs:int" use="required"/>
</xs:complexType>
</xs:element>
but I only want a user to be able to define either a hostName attribute
(e.g., hostName="<servername>") or a hostAddress (e.g.,
hostAddress="<IP_address>") attribute, but not both. It appears that the
<xs:choice> construct accomplishes this for elements. Is there a
functional
equivalent for attributes, or is there a better way to approach this?
--
View this message in context: http://www.nabble.com/XML-Schema-question%3A-A-%3Cxs%3Achoice%3E-equivalent-for-attributes--tp25164500p25164500.html
Sent from the w3.org - xmlschema-dev mailing list archive at Nabble.com.
|
 | 

|  |
These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.
|  |
| |
 |
 |
 |