File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes xsd unique identity constraint (parent and child) 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 "xsd unique identity constraint (parent and child)" Watch "xsd unique identity constraint (parent and child)" New topic

xsd unique identity constraint (parent and child)

Daniel Bittner

Joined: Jan 11, 2007
Posts: 4
Fellow ranchers,

I'm trying to develop an xsd that describes java classes and their member fields. The xml content files that use this xsd will be created by other development teams, and I want to use features of xml schema to ensure that their content makes sense. In specific, a class should only be defined once, and a field should only be defined once per class.

I was able to specify classname as a key, but I am having trouble writing the xpath expressions to enforce the uniqueness of a field relative to its containing class element.

Does anyone know or have any ideas about how to do this?

Below are simplified xsd and xml for this problem.

I agree. Here's the link:
subject: xsd unique identity constraint (parent and child)
Similar Threads
Help in creating XML Schema
jaxb binding rror confused
xml validation failure
Question using XSD with JAXB
schema key/keyref