I have an XML that looks like this:
<Artifacts count="2">
<Artifact>
...
</Artifact>
<Artifact>
...
</Artifact>
</Artifacts>
I am looking for a way to enforce that the number of Artifact
elements contained in Artifact
s shall be equal to the value of the "count" attribute by using an XSD schema.
Even though I found possible ways to achieve this by using the XSD 1.1 specification, I wonder if it is at all possible without it, i.e based on the XSD 1.0 specification.
Edit: I will try to provide a little more context to the question in order to be more precise.
The XML file will be provided as input to a C++ application. The problem is that the development environment enforces the usage of the Xerces v. 2.8.0 library for parsing. To my understanding this version does not support the XSD 1.1 standard.
Of course, I can add extra code in order to check for the correct number of occurrences of Artifact
elements after the XSD validation. I was hoping that there would be a way to avoid the extra code segment and completely validate the input file based on the XSD alone.