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

XML W3C Schema, check excistence of attribute depending on otherattributes

Dear ALL,

I creating an XML which holds elements which optional attributes.
So-far no problem, I just set the "optional" value in the "required"
attribute of my schema.
But how to check for such situations (I omitted the attribute values
for the sake of short text here)

A1 is always there, all other attributes are optional.

Case one:
Combination which may exists are A1,AA2,A3 or A1,A4,A5.
<E A1="" A2="" A3="">
<E A1="" A4"" A5="">

Case two:
The existance of an attribute depnds on a the VALUE of another
attribute
A1=a ==A1,A2,A3
A1=b ==A1,A4,A5
A1=c ==A1,A6,A7

<E A1="a" A2="" A3="">
<E A1="b" A4="" A5="">
<E A1="c" A6="" A7="">

May be there is a standard solution for this two cases.
Thanks a lot
Rolfk
Aug 30 '08 #1
2 1700
RolfK wrote:
Case one:
Combination which may exists are A1,AA2,A3 or A1,A4,A5.
<E A1="" A2="" A3="">
<E A1="" A4"" A5="">

Case two:
The existance of an attribute depnds on a the VALUE of another
attribute
A1=a ==A1,A2,A3
A1=b ==A1,A4,A5
A1=c ==A1,A6,A7
I don't think such restrictions can be modelled with the W3C XML schema
language.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 30 '08 #2
On 30 Aug, 12:26, Martin Honnen <mahotr...@yahoo.dewrote:
RolfK wrote:
Case one:
Combination which may exists are A1,AA2,A3 or A1,A4,A5.
<E A1="" A2="" A3="">
<E A1="" *A4"" A5="">
Case two:
The existance of an attribute depnds on a the VALUE of another
attribute
A1=a ==A1,A2,A3
A1=b ==A1,A4,A5
A1=c ==A1,A6,A7

I don't think such restrictions can be modelled with the W3C XML schema
language.

--

* * * * Martin Honnen
* * * *http://JavaScript.FAQTs.com/
I agree Martin. People recommend using things like Schematron or
Relax-NG for this type of thing.

FWIW XSD 1.1 looks like it will include functionality for this sort of
thing in the way of schematron like assertions (xs:assert). For those
interested last call for the current draft of XSD 1.1 ends this Friday
12th Sept! How long it will take before you can assume the additional
functionality is in your tools is anyones guess!

HTH,

Pete Cordell
Codalogic Ltd
Interface XML to C++ the easy way using XML C++
data binding to convert XSD schemas to C++ classes.
Visit http://www.codalogic.com/lmx/ for more info
Sep 10 '08 #3

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

Similar topics

1
by: Mike | last post by:
Note: My XML experience to date has (unfortunately) been limited to reading and thinking, rather than implementation. Anyway, I am in the process of trying to figure out the most efficient way...
4
by: Gordon Dickens | last post by:
I have target xml to generate from schema. All of the XML instances have the same global element i.e. <base>. I would like to combine all of the schemas into a single schema where I could...
3
by: kelvSYC | last post by:
Is it possible to make an attribute required, optional, or forbidden depending on the value of another attribute? How about changing element content based on an attribute? -- I am only a...
2
by: Shailendra Batham | last post by:
Hello Gurus, I want to put some restrictions on my attribute tag in my XML Schema, anyone out there have any idea how to do that. here is my XML and the XML Schema <?xml version="1.0"...
3
by: Shailendra Batham | last post by:
hi guys I need your suggestions / opinion for doing this the right way. I have a XML and a Schema for the same What I want is when its validated against the schema, it should give custom...
4
by: craig.wagner | last post by:
I have a situation where I need to carry additional information in an XML Schema. What I've found to appear to work is doing something like the following: <xs:schema xmlns:xs="...
0
by: Derek | last post by:
I am creating an intranet using Visual Web Developer Express Edition. Everything has been working OK until yesterday when I started getting 62 messages all beginning "Could not find schema...
5
by: Grant Robertson | last post by:
I am only just learning about schema basics. I am trying to understand some fundamental principles about what can be specified within a schema. If I define an enumerated list of values for an...
3
by: Robert Dailey | last post by:
Take the following XML: <Frame type="Image" id="frame1"> <Draw/> </Frame> <Frame type="Text" id="frame2"> <Print/> </Frame>
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...
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...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.