xs:key/xs:keyref - editor showing incorrect choices

Oxygen general issues.
jacekrad
Posts: 2
Joined: Mon May 14, 2012 5:46 am

xs:key/xs:keyref - editor showing incorrect choices

Post by jacekrad »

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:

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>
Same problem in 12.2 standalone and 13.2 eclipse plugin
adrian
Posts: 2891
Joined: Tue May 17, 2005 4:01 pm

Re: xs:key/xs:keyref - editor showing incorrect choices

Post by adrian »

Hello,

It's difficult to follow the relationship and references of the elements without having the schema to look at.
Could you please send us the schema or an appropriate sample that covers both the ID/IDREF attributes and key/keyref definitions to: support AT oxygenxml DOT com ?

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
jacekrad
Posts: 2
Joined: Mon May 14, 2012 5:46 am

Re: xs:key/xs:keyref - editor showing incorrect choices

Post by jacekrad »

sent
adrian
Posts: 2891
Joined: Tue May 17, 2005 4:01 pm

Re: xs:key/xs:keyref - editor showing incorrect choices

Post by adrian »

Hello,

In case anyone else encounters this, the problem in this case was that the content completion mechanism provided by Oxygen is offering all the collected IDs (based on the xs:IDREF type of the attribute) and is unaware of a subsequent restriction on the IDs imposed by the xs:key/xs:keyref combination. As a result it proposes all collected IDs, even though only one part of them apply in that context.

I have logged this to our issue tracking tool and it will be analyzed and implemented in a future version of Oxygen.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply