aspose file tools*
The moose likes XML and Related Technologies and the fly likes XML-unique 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 "XML-unique" Watch "XML-unique" New topic
Author

XML-unique

Abhi Venu
Ranch Hand

Joined: Jul 09, 2009
Posts: 73
<Address>
<country>India</country>
</Address>

<Address>
<country>India</country>
</Address>

I need to create an XML with following restriction .It can have multiple address elements; inside each address there will be a element country

The country name under each Address block should be unique. it should not get repeated i.e No two address Block can have same country field

I used <xs:unique name="Country_name">
<xs:selector xpath="Address /country">
<xs:field xpath="." />
</xs:unique>

but it will impose restriction only on a Address block and not in two different address blocks
















A table, a chair, a bowl of fruit and a violin; what else does a man need to be happy?:Einstein
Venkata Kumar
Ranch Hand

Joined: Apr 16, 2008
Posts: 110

<xs:selector xpath="Address /country">
<xs:field xpath="." />


You may try this


SCJP 5.0, SCWCD 5, preparing for SCDJWS
 
 
subject: XML-unique