History | Edit


Is it possible to get Oxygen XML Editor to update the revised date on a DITA document when it's saved?


The Plugins SDK: https://www.oxygenxml.com/oxygen_sdk.html#Developer_Plugins contains a sample plugin type called WorkspaceAccess.Such a plugin is notified when the application starts.

You can add a listener that notifies you before the user saves an XML document. Then if the XML document is opened in the Author visual editing mode you can use our Author API to change attributes before the save takes place:
      public void applicationStarted
(final StandalonePluginWorkspace pluginWorkspaceAccess) {
(new WSEditorChangeListener(){
         //An editor was opened
        public void editorOpened(URL editorLocation) {
          final WSEditor editorAccess = pluginWorkspaceAccess.getEditorAccess
(editorLocation, PluginWorkspace.MAIN_EDITING_AREA);
          if(editorAccess != null){
(new ro.sync.exml.workspace.api.listeners.WSEditorListener(){
              //Editor is about to be saved
              public boolean editorAboutToBeSavedVeto(int operationType) {
                  WSAuthorEditorPage authorPage = 
(WSAuthorEditorPage) editorAccess.getCurrentPage();
                  AuthorDocumentController controller = 
                  try {
                    //Find the revised element
                    AuthorNode[] nodes = controller.findNodesByXPath
("//revised", true, true, true);
                    if(nodes != null && nodes.length > 0){
                      AuthorElement revised = (AuthorElement) nodes[0];
                      //Set the modified attribute to it...
new AttrValue(new Date().toString()), revised);
                  } catch (AuthorOperationException e) {
                //And let the save continue.. 
                return true;
       }, PluginWorkspace.MAIN_EDITING_AREA);