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

Simple question about xml schema

Hi all,

I want to write a schema for the following example xml file:

<Items>
<ItemA>hehe</ItemB>
<ItemB>haha</ItemB>
</Items>

So far as my knowledge about xml schema, I can write the following
schema:

<element name="Items">
<complexType>
<sequence>
<element name="ItemA" type="string"/>
<element name="ItemB" type="string"/>
</sequence>
</complexType>
</element>

The problem is that, in this definition, the order of ItemA and
ItemB is fixed. If I want to make the order make no sense, in another
words, ItemB is allowed to appear before ItemA, how can I define the
schema?

This seems a simple question, but I really get confused. Thanks
for suggestion.

Dec 29 '05 #1
1 1195
> I want to write a schema for the following example xml file:

<Items>
<ItemA>hehe</ItemB>
<ItemB>haha</ItemB>
</Items> <sequence>
<element name="ItemA" type="string"/>
<element name="ItemB" type="string"/>
</sequence>
The problem is that, in this definition, the order of ItemA and
ItemB is fixed. If I want to make the order make no sense, in another
words, ItemB is allowed to appear before ItemA, how can I define the
schema?


Use <all> instead of <sequence>.

See the W3C XML Schema Primer [1].

ht

[1] http://www.w3.org/TR/xmlschema-0/#groups
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
Dec 29 '05 #2

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

Similar topics

1
by: Jiho Han | last post by:
I have a type in a schema: <xs:complexType name="SimpleExt"> <xs:simpleContent> <xs:extension base="xs:int"> <xs:attribute name="name" type="xs:string" /> </xs:extension> </xs:simpleContent>...
6
by: Mark Jerde | last post by:
We have developed about 80 XML documents, each probably 150 lines long, that are all supposed to conform to a schema. My understanding is the way to show that an XML document conforms to a schema...
0
by: Pete Beech | last post by:
Hi, I've looked all over for any information about this, and either this is a bug that I cannot find reported or I've misunderstood something. Lets say, in the XML Designer in VS.NET 2003, you...
1
by: Chris Lieb | last post by:
I am new to XML Schema and am running into a bit of a snag. I have defined an XML-based scripting language for an updater program that I am working on. I would like to make a schema for this...
1
by: Ganesh Muthuvelu | last post by:
Hello, I have a simple schema as shown below. When I validate it, I get the error "Type 'http://www.w3.org/2001/XMLSchema:emptype' is not declared. An error occurred at , (6, 12)." ...
10
by: John Baima | last post by:
Okay, so I know that there is probably not a "simple" XML editor, but I would like something fairly lightweight that I can buy for someone else so that they can edit an XML text that I've created...
3
by: Eric Lilja | last post by:
Hello, this is an xml-file with a nested DTD. It validates, test-1- with-dtd.xml: <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE persons > <persons> <person name="Eric Lilja" /> </persons>
2
by: olympus_mons | last post by:
Hi, I'm just discovering the power of xsd.exe, so maybe I'm doing something wrong. schema files describing requests and responses. So there is an extra xsd file for each response and each...
3
by: hitch4hike | last post by:
I am relatively new to XML Schema and have a question about validation. I want to create a Schema to validate a huge customer XML files that we get. I do not have control over the entire XML...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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.