Take a look at the following XML doc:
<main>
<a>
<element>123</element>
</a>
<b>
<element>abc</element>
</b>
<c>
<element>true </element>
</c>
</main>
With this document, is it possible to create an XSD schema with
restrictions for the element "element" depending on its ancestor?
/main/a/element must be an integer containing only three digits.
/main/b/element must be a string containing only three characters.
/main/c/element must be a boolean.
I can define this in a schema if the elements had different names, but
I do not see a way to do it with the same name of element.
Thanks.
<main>
<a>
<element>123</element>
</a>
<b>
<element>abc</element>
</b>
<c>
<element>true </element>
</c>
</main>
With this document, is it possible to create an XSD schema with
restrictions for the element "element" depending on its ancestor?
/main/a/element must be an integer containing only three digits.
/main/b/element must be a string containing only three characters.
/main/c/element must be a boolean.
I can define this in a schema if the elements had different names, but
I do not see a way to do it with the same name of element.
Thanks.
Comment