473,386 Members | 1,766 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,386 software developers and data experts.

xsd definition

Hi,

I want to write one element definition which can contain any number of "A"
or "B" subelements in the XML file in any order.
e.g. the following xml should be allowed

<rootelement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="file.xsd">
<A/>
<A/>
<B/>
<A/>
<B/>
<B/>
</rootelement>

How do i write a .xsd to validate this form of XML

<xs:element name="rootelement">
<xs:complexType>
<xs:????? minOccurs="0" maxOccurs="unbounded">
<xs:element ref="A"/>
<xs:element ref="B"/>
</xs:?????>
</xs:complexType>
</xs:element>
Aug 2 '05 #1
4 1340

Sandy a écrit :
Hi,

I want to write one element definition which can contain any number of "A"
or "B" subelements in the XML file in any order.
e.g. the following xml should be allowed

<rootelement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="file.xsd">
<A/>
<A/>
<B/>
<A/>
<B/>
<B/>
</rootelement>

How do i write a .xsd to validate this form of XML

<xs:element name="rootelement">
<xs:complexType>
<xs:????? minOccurs="0" maxOccurs="unbounded">
<xs:element ref="A"/>
<xs:element ref="B"/>
</xs:?????>
</xs:complexType>
</xs:element>

Have a look here:
http://www.w3schools.com/schema/default.asp

Aug 2 '05 #2
It depends on who validates.

Do you sign a contract ?

Do you use your or the other party's scheme.

-------------------------------------------------------------------

Simply, I dont understand your mental bottleneck.


"Sandy" <a@a.com> wrote in message news:dc********@netnews.net.lucent.com...
Hi,

I want to write one element definition which can contain any number of "A"
or "B" subelements in the XML file in any order.
e.g. the following xml should be allowed

<rootelement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="file.xsd">
<A/>
<A/>
<B/>
<A/>
<B/>
<B/>
</rootelement>

How do i write a .xsd to validate this form of XML

<xs:element name="rootelement">
<xs:complexType>
<xs:????? minOccurs="0" maxOccurs="unbounded">
<xs:element ref="A"/>
<xs:element ref="B"/>
</xs:?????>
</xs:complexType>
</xs:element>


Aug 2 '05 #3
Use xs:choice.

Hope that helps,
Priscilla

----------------------------------
Priscilla Walmsley
Author, Definitive XML Schema
http://www.datypic.com
----------------------------------

*** Sent via Developersdex http://www.developersdex.com ***
Aug 2 '05 #4
Thanks,
It worked :-)
"Priscilla Walmsley" <no****@datypic.com> wrote in message
news:X3***************@news.uswest.net...
Use xs:choice.

Hope that helps,
Priscilla

----------------------------------
Priscilla Walmsley
Author, Definitive XML Schema
http://www.datypic.com
----------------------------------

*** Sent via Developersdex http://www.developersdex.com ***

Aug 2 '05 #5

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

Similar topics

9
by: Dave H | last post by:
Hello, I have a query regarding definition lists. Is it good practice semantically to use the dt and dd elements to mark up questions and answers in a frequently asked questions list, or FAQ? ...
7
by: Neil Zanella | last post by:
Hello, I have posted the following message before but got no replies... I am trying to format an HTML definition list with CSS so that it appears as follows, but am having the following problem:...
14
by: Mike Hewson | last post by:
Have been researching as to why: <example 1> class ABC { static const float some_float = 3.3f; }; <end example 1>
19
by: J. J. Farrell | last post by:
After many years of dealing with definition and linkage issues in ways that I know to be safe, I've decided it's time to try to understand this area properly. Consider a header file with the file...
4
by: Ced | last post by:
Hi, i'm not an expert in C but i try to compile BTNG software under linux kernel 2.4.2-2. I get these errors at the very first stage. Does someone could have a rapid look on this and tell me...
10
by: Kobu | last post by:
My question is about the use and meaning of the terms "declaration" and "definition" as it pertains to the C language. I've read sources that mix the two up when talking about such things as...
18
by: shaanxxx | last post by:
I have following code . #include<stdio.h> int i; int i; int i; int main() { printf("%d",i); return 0;
9
by: Jess | last post by:
Hello, I was told that if I declare a static class constant like this: class A{ static const int x = 10; }; then the above statement is a declaration rather than a definition. As I've...
15
by: vaib | last post by:
hi to all.i'd like to know the actual difference between variable declaration and definition.it would be very helpful if anyone out there wud help me out with this thing.i'm writing here after here...
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
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: 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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.