Page 1 of 1

Set attribute value by web form query

Posted: Mon Apr 10, 2017 8:46 pm
by arcuous
I have a number of elements with @id and @label attributes, such as

<citation id='' label=''>
<link id='' label=''>

Valid values for the @id and corresponding @labels are stored in a SQL database.

My current editor, Altova Authentic, allows me to click a "search" button in a menu to open a custom web page with a form to query my database. After clicking the correct item in the web page, it assigns the selected XML element's @id and corresponding @label.

Can anyone recommend a way to do something similar with an oXygen framework?

I'd prefer to use JavaScript to keep the technology investment light, and avoid writing a plugin if possible.

Re: Set attribute value by web form query

Posted: Tue Apr 11, 2017 5:29 pm
by alex_jitianu

If you have Oxygen version 19 then you can use oxy_browser() form control to load an HTML page. From the Javascript loaded by the browser you can update the XML document using some global variables.

On GitHub we have a sample framework that uses this form control to load Google Maps and updates an attribute in the source XML whenever the marker is moved inside the map. To test it you can install it using the add-ons support:
- inside Oxygen v19 go to Help->Install new add-ons...
- inside the top text field paste: ... /addon.xml
- select and install the framework
- restart Oxygen

How to test it, after install:
- From the sample Oxygen project open the file form-controls/travel-guide/travel-guide.xml from Oxygen's samples directory.
- Scroll to the "Points of Interest" section.
- Each point of interest has an address. Next to each address there is an action (a small button). Click that button.
- A form control will appear and will present a marker on the map. Using right click you can move the marker and the address text and attributes will be updated automatically.

Best regards,

Re: Set attribute value by web form query

Posted: Fri Apr 28, 2017 9:05 pm
by arcuous
Thank you for the prompt reply, that sounds very promising. However, I've been unable to get it to work because Oxygen freezes and becomes unresponsive after right-clicking a new point on the map. I'm using the 2017042020 build on a Mac (10.11.16) and have jstack output if it would help to diagnose the problem. Pointers meanwhile?

Re: Set attribute value by web form query

Posted: Tue May 02, 2017 2:52 pm
by alex_jitianu

Thank you for reporting this issue. I've managed to reproduce it myself and it looks like it derives from this JVM issue:

So far, it appears that the only solution is to call our Java API in an asynchronous manner. Unfortunately, it requires some changes in our internal code so the fix will be included in a 19.0 maintenance build. I will let you know as soon as we release the fix.

If you can't wait for the fix (last week we released a maintenance build so it might take a couple of weeks before the next one is released) you could try a different approach, based on a JSOperation. There is also a project on GitHub that contains multiple JSOperation examples. What you could do:
1. Add a button form control bound to such a JSOperation
2. The Javascript will present a dialog (like in our sample) with the values (the values are perhaps obtained by connecting to a REST service) after which it will update the two attributes (@id and @label).

Please let me know how it all goes!

Best regards,

Re: Set attribute value by web form query

Posted: Fri Jul 14, 2017 12:10 pm
by ionela

Just to update the thread, this problem has been resolved in the latest maintenance build of Oxygen 19.0, 2017062918 (released on July 5th):
OS X/Author/Form controls: Interacting with the Oxygen XML Editor Workspace from a browser form control could result in a deadlock on OS X (because of

You can download it from our web site:

The list of bug-fixes can be found here:

You can follow the release/build RSS feed here:

Let us know if you encounter further problems with this new build. Please note that you will also have to update the addon (the one installed from: ... /addon.xml). The new version uses a newly added API to avoid the deadlock.