Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > usage of "Choice" Compositor with Attributes/attribute

Reply
Thread Tools

usage of "Choice" Compositor with Attributes/attribute

 
 
kosaraju.puneeth@gmail.com
Guest
Posts: n/a
 
      10-26-2005
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!

 
Reply With Quote
 
 
 
 
Stan Kitsis [MSFT]
Guest
Posts: n/a
 
      10-26-2005
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
<> wrote in message
news: oups.com...
>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!
>



 
Reply With Quote
 
 
 
 
Peter Flynn
Guest
Posts: n/a
 
      10-26-2005
Stan Kitsis [MSFT] wrote:

> No, XSD does not support this.


SGML does
Well, sorta.

///Peter

 
Reply With Quote
 
kosaraju.puneeth@gmail.com
Guest
Posts: n/a
 
      10-28-2005
Thnx guys for your response

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
retrieving CPU Usage and Memory Usage information in JAVA hvt Java 0 03-13-2007 01:07 PM
about the compositor in schema news XML 0 11-17-2004 03:19 AM
Webchecker Usage - a problem with local usage Colin J. Williams Python 1 02-26-2004 12:28 AM
Project of an Audio editor & compositor in Java... Multicoder4002 Java 1 02-13-2004 07:09 PM
Need help on memory usage VS PF usage metfan Java 2 10-21-2003 01:58 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57