xs:key/xs:keyref - editor showing incorrect choices
Posted: Mon May 14, 2012 6:26 am
Hi All,
I have been using oXygen for many years now and to be frank can't imagine life without it. I have returned to XML work after a 3 year break and found that am still having the same problem with xs:key/xs:keyref I've been having back 3 years ago in whatever version I was using then.
I have various elements with id attributes of xs:ID type and one of them is t:glossary-entry. I have an element t:gref with attribute target of type xs:IDREF which is used for cross referencing glossary entries. I have a set of key/keyref entries in my schema (shown below) which constraint the t:gref so it can only point to t:glossary-entry and no other element with xs:ID attribute. When it comes to validating the document everything works well. If my t:gref element points to t:glossary-entry then document is valid and if it points to say t:section than I correctly get a validation error: "[Xerces] cvc-identity-constraint.4.3: Key 'glossary-targets' with value 'sect-intro' not found for identity constraint of element 'website'."
The problem that I am having is that when I insert t:gref element into the document and oXygen shows me a list of choices for the target attribute, the list contains all xs:IDs from the document and not just those from t:glossary-entry element. So, basically it gives me invalid choices as well as those which are valid. I can select one of those invalid choices and my document becomes invalid. Am I doing something stupid or is oXygen simply ignoring the key constraints when presenting the choice for the target?
They key/keref defined in my root element in the schema:
Same problem in 12.2 standalone and 13.2 eclipse plugin
I have been using oXygen for many years now and to be frank can't imagine life without it. I have returned to XML work after a 3 year break and found that am still having the same problem with xs:key/xs:keyref I've been having back 3 years ago in whatever version I was using then.
I have various elements with id attributes of xs:ID type and one of them is t:glossary-entry. I have an element t:gref with attribute target of type xs:IDREF which is used for cross referencing glossary entries. I have a set of key/keyref entries in my schema (shown below) which constraint the t:gref so it can only point to t:glossary-entry and no other element with xs:ID attribute. When it comes to validating the document everything works well. If my t:gref element points to t:glossary-entry then document is valid and if it points to say t:section than I correctly get a validation error: "[Xerces] cvc-identity-constraint.4.3: Key 'glossary-targets' with value 'sect-intro' not found for identity constraint of element 'website'."
The problem that I am having is that when I insert t:gref element into the document and oXygen shows me a list of choices for the target attribute, the list contains all xs:IDs from the document and not just those from t:glossary-entry element. So, basically it gives me invalid choices as well as those which are valid. I can select one of those invalid choices and my document becomes invalid. Am I doing something stupid or is oXygen simply ignoring the key constraints when presenting the choice for the target?
They key/keref defined in my root element in the schema:
Code: Select all
<xs:key name="glossary-item-id">
<xs:selector xpath=".//t:glossary-entry"/>
<xs:field xpath="@id"/>
</xs:key>
<xs:keyref name="glossary-targets" refer="glossary-item-id">
<xs:selector xpath=".//t:gref"/>
<xs:field xpath="@target"/>
</xs:keyref>