Get element value with javascript

Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
NicoAMP
Posts: 77
Joined: Tue Mar 06, 2018 2:07 pm
Contact:

Get element value with javascript

Post by NicoAMP »

Hello,

In my custom framework, with javascript, I would like to get attibute value of a specific element of my opened XHTML document.
How can I do that?

Thanks a lot.
Nicolas Delobel
Acolad Digital
nicolas.delobel at acolad.com
mihai_coanda
Posts: 60
Joined: Wed Jul 20, 2016 8:22 am

Re: Get element value with javascript

Post by mihai_coanda »

Hello,
To get an attribute of a node you will need to obtain a reference to an XML element[1] js instance which has a getAttribute(name) method.
You can obtain such an instance from a Selection [2] instance which in turn can be obtained from a SelectionManager[3] instance.
The SelectionManager instance can be obtained from an EditingSupport[3] instance.
You can obtain an EditingSupport instance using the sync.api.Editor.getEditingSupport [4] method.
An instance of the Editor class can be obtained by listening on the EDITOR_LOADED event whose listener is called with an instance of Workspace.EditorLifecycleEvent.[5].

Best Regards,
Michael

1. https://www.oxygenxml.com/maven/com/oxy ... ement.html
2. https://www.oxygenxml.com/maven/com/oxy ... et__anchor
3. https://www.oxygenxml.com/maven/com/oxy ... er__anchor
4. https://www.oxygenxml.com/maven/com/oxy ... rt__anchor
5. https://www.oxygenxml.com/maven/com/oxy ... Event.html
Michael

https://www.oxygenxml.com
NicoAMP
Posts: 77
Joined: Tue Mar 06, 2018 2:07 pm
Contact:

Re: Get element value with javascript

Post by NicoAMP »

Hi Michael,
Thanks a lot for these informations.
Regards,
Nicolas
Nicolas Delobel
Acolad Digital
nicolas.delobel at acolad.com
Post Reply