Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old March 9th, 2006, 03:35 PM
Lemon Tree
Guest
 
Posts: n/a
Default XSD Uniqueness constraint on several attributes.

Hello everybody.

I would like to set an uniqueness constraint by checking more than one
attribute.
So:
....
<foo a1="a" a2="a"/>
<foo a1="a" a2="b"/>
<foo a1="a" a2="c"/>

Should be ok.
But:
....
<foo a1="a" a2="a"/>
<foo a1="a" a2="b"/>
<foo a1="a" a2="a"/>

Shouldn't.

How should I write my constraint?

I tried
<xs:unique name="U1">
<xs:selector xpath="tn:foo"/>
<xs:field xpath="@a1"/>
<xs:field xpath="@a2"/>
</xs:unique>

but it doesn't work. Any hint?

Thank you

  #2  
Old March 10th, 2006, 08:05 AM
Henry S. Thompson
Guest
 
Posts: n/a
Default Re: XSD Uniqueness constraint on several attributes.

Lemon Tree writes:
[color=blue]
> I would like to set an uniqueness constraint by checking more than one
> attribute.
> So:
> ...
> <foo a1="a" a2="a"/>
> <foo a1="a" a2="b"/>[/color]
[color=blue]
> Should be ok, but:
> ...
> <foo a1="a" a2="a"/>
> <foo a1="a" a2="b"/>
> <foo a1="a" a2="a"/>
>
> Shouldn't.
>
> I tried
> <xs:unique name="U1">
> <xs:selector xpath="tn:foo"/>
> <xs:field xpath="@a1"/>
> <xs:field xpath="@a2"/>
> </xs:unique>[/color]

That looks correct to me as far as it goes -- did you add the above
xs:unique to an element which will end up with tn:foo children?

You need to show us more of the schema, more of the instance, and tell
us what validator you're using.

ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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