aspose file tools*
The moose likes XML and Related Technologies and the fly likes validate an element for unique value in multiple occuranes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "validate an element for unique value in multiple occuranes" Watch "validate an element for unique value in multiple occuranes" New topic
Author

validate an element for unique value in multiple occuranes

Priti Shah
Ranch Hand

Joined: May 10, 2005
Posts: 43
Hi,

I have this xml which allows multiple occurences of log file locations.

<some-element>
<log>log location 1</log>
<log>log location 2</log>
<log>log location 3</log>
<log>log location 4</log>
</some-element>

Now in my schema I want to check for max occurances 4 which I can do using 'maxOccur' attribute. But I also want to make sure that all 4 elements should have different values.
How can I do that ?

Thanks in advance.
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
Welcome to Javaranch.
[Sorry about the delayed reply, I had to dust-off my XSD book to answer this.]

The construct you are looking for is xsd:unique.

Use something like -



You need to place this in the context in which you want to impose the uniqueness constraint. More homework to do.......

- m


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: validate an element for unique value in multiple occuranes