I’m trying to add extra validation to jdpl process-definition files using XSD.
We have a couple of rules we want to add; but the one that’s causing me problems is that there must exist one ‘node’ element with it’s ‘name’ attribute = ‘Problem’.
so this is valid:
<process-definition name='sample'> <node name='Problem'> </node> <node name='Do Work'> </node> </process-definition>
and this isn’t
<process-definition name='sample'> <node name='Do Work'> </node> </process-definition>
So, to summarise, the rules I need to enforce are
- node attribute having the value ‘Problem’
- existence of 1 node with name=’Problem’
- allowing any number of nodes with other names
Any ideas out there?
Sorry that’s not possible with XSD.
Due to performance reasons XML-Schema is designed to never look ahead and never look back beyond the current node. That means that it must always be defined where the validator is in the schema-tree. And that makes requirements like this impossible to define with XSD.