Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old August 30th, 2008, 09:05 AM
RolfK
Guest
 
Posts: n/a
Default 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
  #2  
Old August 30th, 2008, 12:35 PM
Martin Honnen
Guest
 
Posts: n/a
Default Re: XML W3C Schema, check excistence of attribute depending on otherattributes

RolfK wrote:
Quote:
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/
  #3  
Old September 10th, 2008, 03:25 PM
usenet@tech-know-ware.com
Guest
 
Posts: n/a
Default Re: XML W3C Schema, check excistence of attribute depending on otherattributes

On 30 Aug, 12:26, Martin Honnen <mahotr...@yahoo.dewrote:
Quote:
RolfK wrote:
Quote:
Case one:
Combination which may exists are A1,AA2,A3 or A1,A4,A5.
<E A1="" A2="" A3="">
<E A1="" *A4"" A5="">
>
Quote:
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
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles