473,507 Members | 2,460 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sequence - no, all - no, choice - no

Sorry if this question or a similar one was already submitted into
this newsgroup, but my investigations on this topic were not
successfull.

An external application that is not under my control generates an XML
documents with 5 fields. 3 of them (f1, f3, f5) are mandatory, 2 of
them (f2 and f4) are optionals. The field order is unpredictable. A
couple of examples follow.

<?xml version="1.0"?>
<thedocument>
<f1>11</f1>
<f3>13</f3>
<f5>14</f5>
<f2>15</f2>
</thedocument>

<?xml version="1.0"?>
<thedocument>
<f4>11</f4>
<f1>12</f1>
<f5>13</f5>
<f3>14</f3>
</thedocument>

I'm trying to define an XSD for this legacy document, but
- sequence does not work, since the order is not fixed
- all does not work, since some of elements are optional
- sequence of choice does not work

Do you have any suggestion for solving this problem?

Thanks

pierre
Jul 20 '05 #1
3 1100
Hi Pierre,

"all" should work for what you want. You can make the elements in an
all group optional, as in:

<xs:all>
<xs:element name="f1"/>
<xs:element name="f2" minOccurs="0"/>
<xs:element name="f3"/>
<xs:element name="f4" minOccurs="0"/>
<xs:element name="f5"/>
</xs:all>

Hope that helps,
Priscilla

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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #2
Thanks a lot, Priscilla, it worked. Part of my understanding on "all" was wrong.
pierre

Priscilla Walmsley <no****@datypic.com> wrote in message news:<42**********@127.0.0.1>...
Hi Pierre,

"all" should work for what you want. You can make the elements in an
all group optional, as in:

<xs:all>
<xs:element name="f1"/>
<xs:element name="f2" minOccurs="0"/>
<xs:element name="f3"/>
<xs:element name="f4" minOccurs="0"/>
<xs:element name="f5"/>
</xs:all>

Hope that helps,
Priscilla

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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 20 '05 #3
Hi, I have a similar dilema, however the elements f1,f2,f3... as well as
appearing in any order, can also appear any number of times. e.g.

<?xml version="1.0"?>
<thedocument>
<f1>11</f1>
<f1>12</f1>
<f1>16</f1>
<f3>13</f3>
<f5>14</f5>
<f2>15</f2>
<f3>21</f3>
<f3>22</f3>
</thedocument>

I understand 'all' can only occur 0 or 1 times, this is no good.
sequence is no good because of the order. What else can I do?
melograno wrote:
Thanks a lot, Priscilla, it worked. Part of my understanding on "all" was wrong.
pierre

Priscilla Walmsley <no****@datypic.com> wrote in message news:<42**********@127.0.0.1>...
Hi Pierre,

"all" should work for what you want. You can make the elements in an
all group optional, as in:

<xs:all>
<xs:element name="f1"/>
<xs:element name="f2" minOccurs="0"/>
<xs:element name="f3"/>
<xs:element name="f4" minOccurs="0"/>
<xs:element name="f5"/>
</xs:all>

Hope that helps,
Priscilla

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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 20 '05 #4

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

Similar topics

0
1263
by: Anders Ljusberg | last post by:
Hi! I have a problem.. I'm trying to get the XML from a dataset to conform to an XSD, but it keeps rearranging some elements. Try this schema: &lt;xs:schema id="test"...
2
4331
by: Sergey Poberezovskiy | last post by:
Hi, If I define my schema as <xs:choice> <xs:sequence> <xs:element ref="el_1" /> <xs:element ref="el_2" /> </xs:sequence> <xs:sequence>
3
4677
by: kevin | last post by:
Is that even possible? I am creating a web service in .NET to expose some already created .NET programs to other groups. One group is writing the client in PERL, and thus wishes the wsdl schema...
2
2770
by: shumaker | last post by:
I designed a schema in VS C# 2005 Express and am wondering why it chooses to place a sequence tag around the elements of a table. And additionally, if I move the elements around within the table,...
2
1342
by: cmay | last post by:
I am beginning to wonder if it is not possible to get this working. I am trying to do: <root> <a/> <b/> <c/> </root>
2
6922
by: klikic | last post by:
Hi. How can create a unordered sequence with defined elements that can occur ones and "other" elements that are ignored. Example: XML: <Recur> <ignoredElement>saasda</ignoredElement>...
6
7152
by: Defcon2030 | last post by:
<bHey, can someone help me with this? I've been working on it for a few days now, and my head's starting to spin... </b> // FILE:ex1_imp.cxx // // // // CLASS IMPLEMENTED: sequence (see ex1.h...
0
1533
by: rval | last post by:
I have this schema while teh following sequence <complexType name="SetOfTasks" mixed="true"> <sequence> <choice minOccurs="1" maxOccurs="unbounded"> <element minOccurs="0"...
1
1883
by: s123 | last post by:
Hi, I am using the sequence tag under the choice tag. the code part of this is : <xs:choice> <xs:sequence> <xs:element name="values" type="ValuesType" minOccurs="0"...
0
7223
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
7314
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,...
1
7030
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5041
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.