id/idref autocompletion fails for constrained anyURI

pstadler
Posts: 2
Joined: Tue May 17, 2022 1:50 pm

id/idref autocompletion fails for constrained anyURI

Post by pstadler »

So, the TEI just recently introduced (in version 4.4.0) a constraint on their teidata.anyURI datatype to disallow whitespace. In the resulting RelaxNG this looks like

Code: Select all

<list>
   <oneOrMore>
      <data type="anyURI">
         <param name="pattern">\S+</param>
      </data>
   </oneOrMore>
</list>
This seems to break the nice Oxygen editor autocompletion feature for id/idrefs, e.g. I get no suggestions for @ref attribute values although @xml:ids are present in the document.
NB, since Oxygen still ships with v4.3.0 of the TEI schemas etc. this only occurs in customisations right now or when you force Oxygen editor to use the new schemas.

Is there anything I'm missing or is there something that can be done?
george
Site Admin
Posts: 2103
Joined: Thu Jan 09, 2003 2:58 pm

Re: id/idref autocompletion fails for constrained anyURI

Post by george »

Hi,

Oxygen identifies anyURI data types and offers #id as possible completion proposals. However, when you alter the anyURI with additional constraints, that is not detected anymore as anyURI, and it is in fact a different type. The additional constraint may filter out some of the ID values for example, so in order to offer proposals in this case the #id values need to be tested to see which are still valid under the specified constraints and only those should be presented to the user.

One possible solution is to leverage the cc_config content completion configuration file for the TEI framework to specify there the content completion proposals for the attributes that use these constrained data types. You can match on an attribute from an element and then specify an XSLT that will basically process the document and return what values should be used as content completion proposals. In this XSLT you can construct the #id proposals when you match any element that has an @id attribute. See more about cc_config file at https://www.oxygenxml.com/doc/versions/ ... osals.html..

Best Regards,
George
George Cristian Bina
Radu
Posts: 8014
Joined: Fri Jul 09, 2004 5:18 pm

Re: id/idref autocompletion fails for constrained anyURI

Post by Radu »

Hi,

In addition to what George said, taking into account the impact on our TEI community of this change I added an internal issue on our side to see if we can fix this in a future Oxygen version without the need for extra framework customizations:

EXM-50553 id/idref autocompletion fails for constrained anyURI

If we manage to fix this in a future version, we'll update this forum thread.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
pstadler
Posts: 2
Joined: Tue May 17, 2022 1:50 pm

Re: id/idref autocompletion fails for constrained anyURI

Post by pstadler »

Thanks Radu and George for the quick and helpful reply!
For the record, there's also an open issue at https://github.com/TEIC/TEI/issues/2296 which I hadn't noticed.
Post Reply