Executing ACL commands (Javascript)
I have what may be an easy question here about document manipulation using the DOM and AOM and executing Arbortext commands.
To briefly describe my goal: I'm trying to add a namespace declaration to all XML files that are referenced in a .dita file (ditamap file) via a custom Arbortext menu tool (javascript). This ditamap contains XML elements that describe the URI locations of XML files.
Since the ditamap file is what is opened in Arbortext, I'm trying to find a way to set the DOM/AOM to point to the URI location of the individual XML files referenced in the ditamap. This way I can run a simple Arbortext command on them to add the namespace to each XML file.
Javascript code sample below:
AddNamespace function() {
var actDoc = Application.activeDocument; // set the DOM to the active document open in Arbortext
var uri = actDoc.getElementsByAttribute("XMLfileURI", "", 0); // grab XML file URI's and store in array
var i;
for (i = 0; i < uri.length; i++) {
var curDoc = Application.openDocument(uri); // open the document at the URI
Acl.execute('modify_tag root xmlns:mine="http://myCustomNamespacehere.com"'); //add namespace declaration to "root" element
curDoc.save(); //save the document
}
Right now, the "modify_tag" Arbortext command is breaking because it is still running the command on the ditamap file (the Application.activeDocument). Is it possible to point activeDocument to the newly opened curDoc document? If that isn't possible what would I need to do to run the Arbortext command on a document that isn't the current Application.activeDocument?
Thank you in advance.

