This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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
 
 
subject: validate an element for unique value in multiple occuranes
 
Similar Threads
how to move items in between two select lists using javascript ???
Castor: Mapping Element not included in Java Class
Can we use multiple Controllers in a single web-application?
Response header
Error Page