473,506 Members | 17,176 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSD One Multiple element question

Hi,

I am trying to define a Key element for a vehicle schema. I have three ways
to uniquely identify a vehicle such as URN, UnitID and Vin.

I'd like to make a rule that ensures that at least one of the three is
present, but 2 or all 3 can be present. I tried something like below, but it
does not seem valid.

Thanks in advance for any assistance anyone may be able to provide. Portion
of schema is posted below. Hopefully it gives some idea as to what I am
trying to accomplish.

Best regards,

Victor

<xs:complexType name="VehKeyType">
<xs:choice>
<xs:sequence>
<!--Choice 1 URN Type is present-->
<xs:element name="URN" type="URNType">
</xs:element>
<xs:element name="UnitId" type="UnitIdType" minOccurs="0">
</xs:element>
<xs:element name="Vin" type="VinType" minOccurs="0">
</xs:element>
</xs:sequence>
<xs:sequence>
<!--Choice 2 Unit ID is present-->
<xs:element name="URN" type="URNType" minOccurs="0">
</xs:element>
<xs:element name="UnitId" type="UnitIdType">
</xs:element>
<xs:element name="Vin" type="VinType" minOccurs="0">
</xs:element>
</xs:sequence>
<xs:sequence>
<!--Choice 3 Vin is present. -->
<xs:element name="URN" type="URNType" minOccurs="0">
</xs:element>
<xs:element name="UnitId" type="UnitIdType" minOccurs="0">
</xs:element>
<xs:element name="Vin" type="VinType">
</xs:element>
</xs:sequence>
</xs:choice>
</xs:complexType>
Mar 22 '06 #1
1 1281
XML Schema does not allow ambiguous content so you need to be careful
when you write that. The simplest approach will be to use a relaxed
content in the XML Schema and use Schematron embedded rules to check
the constraints.
If you want an XML Schema only solution then that is possible. Imagine
you have two elements, then you will have

(a, b?) | (b, a?)

If you add another element then you will have

(a, ((b, c?) | (c, b?)) ?) | (b, ((c, a?) | (a, c?)) ?) | (c, ((a, b?)
| (b, a?)) ?)

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Mar 23 '06 #2

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

Similar topics

0
1268
by: Adam Smith | last post by:
Hello. I've got a total of 5 schemas. They are: 1 - 1.xsd - a description of a city 2 - 2.xsd - a description of a town 3 - CityHall.xsd - a description of a cityhall-meant to be part of a...
5
10497
by: BPearson | last post by:
Hello I would like to have several sites share a single web.config file. To accomplish this, I would point the root of these sites to the same folder. Is there any reason why I might not want to...
5
5375
by: Jeff | last post by:
We are using .Net and the wsdl Utility to generate proxies to consume web services built using the BEA toolset. The data architects on the BEA side create XML schemas with various entities in...
2
3630
by: areef.islam | last post by:
Hi, I am kinda new to javascript and I am having this problem with selecting multiple options from a select tag. Hope someone can help me out here. here is my code...
5
4936
by: paul_zaoldyeck | last post by:
does anyone know how to validate an xml file against multiple defined schema? can you show me some examples? i'm making here an xml reader.. thank you
5
14104
by: c676228 | last post by:
Hi everyone, my colleagues are thinking about have three insurance plans on one asp page: I simplify the plan as follow: text box:number of people plan1 plan2 plan3
5
3297
by: Neil | last post by:
"lyle" <lyle.fairfield@gmail.comwrote in message news:48c3dde7-07bd-48b8-91c3-e157b703f92b@f3g2000hsg.googlegroups.com... Question for you. I'm doing something similar, only, instead of opening...
4
2282
by: arnaudk | last post by:
I am trying to come up with a class design to deal with asynchronous data to be stored and analyzed over multiple time frames and could really use some design input. This is a rather long question...
5
1714
by: Michael.Ruehling | last post by:
Hi, I've got another question. My Code works fine now and I've tried some other functions. XSLT-Code is now: <!DOCTYPE BUCH > Like on the Book the MULTIPLE says "Allow Multiple Tags of...
0
7218
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
7307
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
7370
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...
1
7021
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
7478
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...
0
5614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5035
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
4701
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
3177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.