Reputation: 213
I need to write an XML Schema for this XML language:
<wfInfo>
<worflow name="wf1">
<action name="act1" role="seller"/>
<action name="act2" role="buyer"/>
...
</workflow>
<workflow name="wf2">
...
</workflow>
<process workflow="wf1">
<actionStatus action="act2" takenInCharge="true"/>
</process>
<process ...> ... </process>
...
</wfInfo>
I managed to write almost every part of the schema, including most key and keyref elements. Anyway, there's one constraint i don't seem to be able to write. I want to make the attribute "action" of the element actionStatus point to the correct action, not any action in the document. I mean, in this case, in the validation process, it should be verified that action "act2" exists in workflow "wf1", not in any workflow. is it possible using W3C XML Schema language?
Thanks, any answer will be much appreciated
Upvotes: 0
Views: 216
Reputation: 461
You may be able to use key/keyref - but this would probably get quite messy.
A better approach may be to use another technology in addition to W3C XML Schema. Schematron, for example, can be useful in conjunction with schemas and is easy to add on and understand. Alternatively it would be easy to implement this dependency in code.
Also, see: Restrict ID references to a particular element group
Upvotes: 1