Accessing DOM Model
Posted: Tue Oct 23, 2018 2:04 am
In JavaScript, I want to be able to get a handle on the root node, i.e. a DOM Level 1 Core node in a document tree, of a document for a given window being edited in Oxygen Author. I prefer being able to work in JavaScript and am used to facilitating work in a JavaScript environment using Java when necessary to implement a class.
I'm coming from Arbortext Editor where I have developed code using the Arbortext Command Language, aka "ACL", Java, and JavaScript. I have been reviewing the javadoc at https://www.oxygenxml.com/InstData/Editor/SDK/javadoc/ and I have reviewed all the topics in the SKD-API Forum that hint of being able to instantiate a DOM object and then walk through the nodes. Unfortunately, I do not seem to have come across examples I was hoping for.
For example, if I have an XML document opened in Editor named abc.xml in window1 and another efg.xml opened in window2, where can I determine what open windows there are in the Author editing session and then access the documents therein?
Once I have a document handle, I'd have a recursive function that would visit each and every node where I can then perform some checks. A real-life example would be to walk a document's nodes and populate a subset of elements with attributes, e.g. "PID", which is populated from an array I obtain from a database. I have the database connection worked out, it's the walk-through of an instantiated DOM that I am having trouble finding.
Could someone provide an example of querying what window is opened in a session, and then after selecting a window, e.g. the one holding abc.xml, getting a handle on the root node of the DOM therein? I'm assuming that once I have the handle on the root node, then the W3C DOM methods and properties are available to walk through and manipulate the model.
Thank you.
I'm coming from Arbortext Editor where I have developed code using the Arbortext Command Language, aka "ACL", Java, and JavaScript. I have been reviewing the javadoc at https://www.oxygenxml.com/InstData/Editor/SDK/javadoc/ and I have reviewed all the topics in the SKD-API Forum that hint of being able to instantiate a DOM object and then walk through the nodes. Unfortunately, I do not seem to have come across examples I was hoping for.
For example, if I have an XML document opened in Editor named abc.xml in window1 and another efg.xml opened in window2, where can I determine what open windows there are in the Author editing session and then access the documents therein?
Once I have a document handle, I'd have a recursive function that would visit each and every node where I can then perform some checks. A real-life example would be to walk a document's nodes and populate a subset of elements with attributes, e.g. "PID", which is populated from an array I obtain from a database. I have the database connection worked out, it's the walk-through of an instantiated DOM that I am having trouble finding.
Could someone provide an example of querying what window is opened in a session, and then after selecting a window, e.g. the one holding abc.xml, getting a handle on the root node of the DOM therein? I'm assuming that once I have the handle on the root node, then the W3C DOM methods and properties are available to walk through and manipulate the model.
Thank you.