A custom attribute editor for Oxygen XML Editor

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

A custom attribute editor for Oxygen XML Editor

Alex Jitianu

Hello everyone,

For quite some time, Oxygen XML editor has offered support for configuring the proposals for attribute values through a configuration file [1]. In this configuration file you can either explicitly specify the values

<match attributeName="type">
    <items>
        <item value="stanza"/>
        <item value="refrain"/>
    </items>
</match>

or you can specify an XSLT script that will be executed and will return these values:

<match attributeName="type">
	<xslt href="get_values_from_database.xsl" action="replace"/>
</match>

The XSLT mechanism in particular found was quite used (by our users in general and by the TEI community in particular) to retrieve values from external data sources: local configuration files, XML databases etc. One complaint that we received was that in many situations the possible values aren't human readable, they are just codes. The human readable information was present in the annotation associated with each value but the user still had to manually navigate through the values and inspect the annotations, in search of the desired value.

T offer a solution to this problem I've used one of Oxygen's extension points to implement a custom attribute value editor. This editor is invoked when you try to edit an attribute inside the Attributes View. It shows a dialog that presents the possible values together with their annotations and a search field that can be used to locate a particular value. I guess this search field is the important feature because it searches in the annotations as well.

If you are interested in this, here is how you can install it (as prerequisites, you must have Oxygen v16 or later and a TEI framework):

1. download the TEI extension framework from:

        https://github.com/AlexJitianu/oXygen-XML-editor-attribute-editor/raw/master/build/tei/attribute-editor-framework.zip

2. unzip it inside {oxygenInstallDir}/frameworks . Please make sure you don't create any additional directories in the process. After unzipping, the file structure should look like this:
{oxygenInstallDir}
----frameworks
------attribute-editor-framework
--------tei_p5_-_attribute_value_editor.framework

3. edit attribute-editor-framework/config_attribute_editor.txt . This is the configuration file in which you specify the element and the attribute that should be edited using this specialized dialog. It accepts pairs like this:

elementLocalName1, attributeLocalName1
elementLocalName2, attributeLocalName2

The default configuration will activate this editor for the @part attribute  on a <p> element. So if you just want a quick test, skip step 3. and just try and edit this attribute in the Attributes View.

The source code is open source and available on the same GitHub project. As always, all feedback is much appreciated!


[1] https://oxygenxml.com/doc/versions/18.0/ug-editor/topics/configuring-content-completion-proposals.html

Best regards,
Alex
-- 
Alex Jitianu
<oXygen/>  XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com 
Loading...