Jump to content

Is this schema constraint possible?


Recommended Posts

Consider this XML:

<root>	 <element>		  <foo>CAKE</foo>		  <bar>42</bar>	 </element>	 <element>		  <foo>CAKE</foo>		  <bar>69</bar>	 </element></root>

I want the above XML to be invalid. Is it possible for a schema to require that elements can have duplicate values of "foo" only if they also have duplicate values of "bar"?Or would I have to refactor my data, e.g., specify a set of "foobar" elements and require that my elements above reference them? (I don't know exactly how to do that, either...)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...