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

Defining relations in XML Schema

Hi,

I have a question related to the XML-Schema definition. Is it posible to
define relations between elements? The following is my XML Schema:

<xs:element name="root">

<xs:complexType>

<xs:sequence>

<xs:element name="Country" type="Countries"/>

<xs:element name="USZipCode" type="xs:string"/>

<xs:element name="Adress" type="xs:string"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:simpleType name="Countries">

<xs:restriction base="xs:string">

<xs:enumeration value="USA"/>

<xs:enumeration value="FRA"/>

<xs:enumeration value="GER"/>

</xs:restriction>

</xs:simpleType>

Now, if an instance of this Schema, an XML file, contains the country USA in
the element "County" then the element "USZipCode" must also be defined in
the xml file. If the "Country" element is FRA then the "USZipCode" is not
required, and should not be present.

Is it posible to define in the XML Schema such a relation/case ?

Thanks,

George.

Nov 12 '05 #1
1 1181
Such co occurence contraints can not be defined in Xml Schema.

"George Homorozeanu" <ge****************@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP15.phx.gbl...
Hi,

I have a question related to the XML-Schema definition. Is it posible to
define relations between elements? The following is my XML Schema:

<xs:element name="root">

<xs:complexType>

<xs:sequence>

<xs:element name="Country" type="Countries"/>

<xs:element name="USZipCode" type="xs:string"/>

<xs:element name="Adress" type="xs:string"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:simpleType name="Countries">

<xs:restriction base="xs:string">

<xs:enumeration value="USA"/>

<xs:enumeration value="FRA"/>

<xs:enumeration value="GER"/>

</xs:restriction>

</xs:simpleType>

Now, if an instance of this Schema, an XML file, contains the country USA in the element "County" then the element "USZipCode" must also be defined in
the xml file. If the "Country" element is FRA then the "USZipCode" is not
required, and should not be present.

Is it posible to define in the XML Schema such a relation/case ?

Thanks,

George.

Nov 12 '05 #2

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

Similar topics

1
by: Woody Splawn | last post by:
I don't mean to crosspost but I really don't know where questions on yellow view Schema window in VS belong. If someone has a better suggestion for a newsgroup please let me know. All I do...
0
by: Bob Rundle | last post by:
I'm using the XML Schema Designer to create a dataset. I can't get the relationships to work from the XML. To get them to work, I have to explicitly code them in. What's wrong here? Here is...
4
by: Alfetta159 | last post by:
I've been setting up a schema with the XML Designer in VS .NET 2003. The designer lets me set up a lot of things including a complex type that contains an unnamed complex type called modified. ...
2
by: Joe | last post by:
Hi I am going to receive a dataset downstream and I will not know the the fields number of field relations number of relations So I have to be flexible to take unknown data and be able to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.