usage of "Choice" Compositor with Attributes/attribute

K

kosaraju.puneeth

I want an element that must have either attribute A or B.


<Thing1 A="aaa"/> <Thing1 B="bbb"/>


I want to enforce this in my schema . If A and B were
elements, I could use choice.


<xs:attribute name="A"/>
<xs:attribute name="B"/>


<xs:element name="Thing1">
<xs:complexType>
<xs:choice >
<xs:element ref="A"/>
<xs:element ref="B"/>
</xs:choice>
</xs:complexType>
</xs:element>


But choice only works for elements, and I am stuck.
Is there a way to do "choice" for attributes?
And if so, how about for attributeGroups too?


Making both attributes optional would accept valid input
but not reject all invalid input. I am hoping for better.


Thanks!
 
S

Stan Kitsis [MSFT]

No, XSD does not support this.

--
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top