473,387 Members | 1,582 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.

In Schema, how to say "If one element exist, another element must exist"?

Hello All,

I have the following schema:
....
<xs:element name="data_type_id" type="xs:unsignedShort" />
<xs:element name="data_value" type="xs:anyType" />
....

What I want to do is to specify that "If 'data_value' element exists,
'data_type_id' element MUST exist".

How do I do that?

Thanks very much
Jul 20 '05 #1
3 2068
Y.S. schrieb:
Hello All,

I have the following schema:
...
<xs:element name="data_type_id" type="xs:unsignedShort" />
<xs:element name="data_value" type="xs:anyType" />
...

What I want to do is to specify that "If 'data_value' element exists,
'data_type_id' element MUST exist".

How do I do that?

Thanks very much


Hi,

you should consider to embed data-value inside data_type_id either by
attribute
<data_type_id value="somewhat"/>
or by element
<data_type_id>
<data_value/>
</data_type_id>

That's wy xml is structured. I cannot imagine that these kind of checks
are possible with xml schemas but of cause I maybe wrong....

Hope I could help you

Thomas Scheffler

Jul 20 '05 #2
Y.S. wrote:
Hello All,

I have the following schema:
...
<xs:element name="data_type_id" type="xs:unsignedShort" />
<xs:element name="data_value" type="xs:anyType" />
...

What I want to do is to specify that "If 'data_value' element exists,
'data_type_id' element MUST exist".

How do I do that?

Thanks very much

Use <sequence>
<xs:sequence minoccurs="0">
<xs:element name="data_type_id" type="xs:unsignedShort" />
<xs:element name="data_value" type="xs:anyType" />
</xs:sequence>

--
J. D. Addison
email pu**@theaddisons.demon.co.uk

Jul 20 '05 #3
Include both the elements within a sequence like the following:
=========
<xs:sequence minOccurs="0" maxOccurs="1">
<xs:element name="data_type_id" type="xs:unsignedShort" />
<xs:element name="data_value" type="xs:anyType" />
</xs:sequence>
==========

Regards.
"Y.S." <st************@yahoo.com> wrote in message
news:b9**************************@posting.google.c om...
Hello All,

I have the following schema:
...
<xs:element name="data_type_id" type="xs:unsignedShort" />
<xs:element name="data_value" type="xs:anyType" />
...

What I want to do is to specify that "If 'data_value' element exists,
'data_type_id' element MUST exist".

How do I do that?

Thanks very much

Jul 20 '05 #4

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

Similar topics

0
by: ReignMan | last post by:
I'm running JDK 1.4.0_01, Xalan2.5.1 and Tomcat 4.1.27. XSL transformations work, yet when running in debug mode (Eclipse IDE), I get the following: 990S2html.xsl:3:80: Element type...
1
by: Mark Richards | last post by:
The solutions for the following problems seems to be simple but I did not found a (convenient) solution: Assume we have a number of elements of the same type under a common parent e.g. <person...
0
by: Dirk Försterling | last post by:
Hi all, a few days ago, I upgraded from PostgreSQL 7.2.1 to 7.4, following the instructions in the INSTALL file, including dump and restore. All this worked fine without any error (message). ...
35
by: David Cleaver | last post by:
Hello all, I was wondering if there were some sort of limitations on the "if" statement? I'm writing a program which needs to check a bunch of conditions all at the same time (basically). And...
2
by: mark | last post by:
How do I detect that a particular form element is a file upload or if the file upload has worked? In the Python cgi module documentation I found suggested code... form = cgi.FieldStorage()...
1
by: tankbattle | last post by:
That is, what's the difference between <complexType name="Address" final="restriction"> <sequence> <element name="name" type="string"/> <element name="street" type="string"/> <element...
6
by: Lord0 | last post by:
Hi there, How do I define in a schema that an element (<element>) may have any content i.e. text, other elements, partial elements, angle brackets etc? So all of the following would be valid:...
7
by: Zhang Weiwu | last post by:
Dear all How does javascript realiablily tell if a variable is a reference to an HTML Element "<select>", without causing browser to pop up error message? if (variable.constructor ==...
3
by: moltendorf | last post by:
I copied the files from my "test" database on my old server (MySQL was not running) to my new server ("./mysql/data/test" folder), and after starting the server, SHOW TABLES; shows all of the tables...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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.