473,385 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

usage of "Choice" Compositor with Attributes/attribute

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!

Oct 26 '05 #1
3 1522
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
<ko**************@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr 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!

Oct 26 '05 #2
Stan Kitsis [MSFT] wrote:
No, XSD does not support this.


SGML does :-)
Well, sorta.

///Peter

Oct 26 '05 #3
Thnx guys for your response :)

Oct 28 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Anthony Baxter | last post by:
To go along with the 2.4a3 release, here's an updated version of the decorator PEP. It describes the state of decorators as they are in 2.4a3. PEP: 318 Title: Decorators for Functions and...
8
by: Hostile17 | last post by:
Consider the following HTML. ---------- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> <html> <head> <meta...
6
by: TS | last post by:
Hi, i have a problem validating xml against schema. I used http://apps.gotdotnet.com/xmltools/xsdvalidator/Default.aspx validator and it says it is fine. Can you tell me why this doesn't work? ...
145
by: Sidney Cadot | last post by:
Hi all, In a discussion with Tak-Shing Chan the question came up whether the as-if rule can cover I/O functions. Basically, he maintains it can, and I think it doesn't. Consider two...
1
by: D.M. | last post by:
Hi, One of the people here at work has designed a database that students will be using to enter data. She has Yes/No selection buttons, which start out grayed out with no value. If a student...
37
by: Jan Wagner | last post by:
Hi, can't figure this one out, what's the CSS way to specify the language? In HTML it would be simply an lang="xx" attribute, or XHTML xml:lang="xx", but, how about in CSS? This would be...
3
by: Sebastian Stein | last post by:
Hi, I have the following XSD file (XML Schema 1.0): <xs:element maxOccurs="1" minOccurs="1" name="header"> <xs:complexType> <xs:sequence> <xs:element name="id" type="xs:positiveInteger"/>...
2
by: puffy | last post by:
Hi, Everyone! I'd need a little help. I understand this is not valid, but is there an (easy) way to make it valid? <xs:complexType name="control_Type"> <xs:sequence> <xs:element name="id"...
0
by: jeoffh | last post by:
Background: I am trying to "merge" some attributes into an existing XML column in my MS SQL 2005 database. The general idea is that I have an XML column in a table and I would like to update/delete...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.