How to add custom validation using xsl with in Oxygen Author SDK

Post here questions and problems related to oXygen frameworks/document types.
roopesh79
Posts: 26
Joined: Fri Jul 29, 2022 9:55 am

How to add custom validation using xsl with in Oxygen Author SDK

Post by roopesh79 »

Hello Team,
I am trying to explore the Oxygen SDK java samples to create/customize a plugin which can validate against the topics and map in Oxygen Author.
1. Is it possible to add the the custom schematron file location using the framewrok plugin?(I can configure this manually with in Oxygen, but I want to do this programmatically)
1. Is it possible to add an xsl file within framework and trigger the xsl file from the framework plugin or any other sample plugin which is coming along with the SDK.

Thanks in advance
Roopesh
Radu
Posts: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Re: How to add custom validation using xsl with in Oxygen Author SDK

Post by Radu »

Hi Roopesh,
1. Is it possible to add the the custom schematron file location using the framewrok plugin?(I can configure this manually with in Oxygen, but I want to do this programmatically)
It is possible for example to create a framework extension (for the DITA framework for example) which provides an extra Schematron file which will be used for default validation of DITA topics:
https://blog.oxygenxml.com/topics/shari ... rules.html
And a framework extension folder can be distributed with a plugin.
https://www.oxygenxml.com/doc/versions/ ... nsion.html
1. Is it possible to add an xsl file within framework and trigger the xsl file from the framework plugin or any other sample plugin which is coming along with the SDK.
Trigger it at what moment? Is this question still about validation?
We also have the API to add a validation problems filter:
https://www.oxygenxml.com/InstData/Edit ... emsFilter-
which would allow you to participate when topics and maps are validated in Oxygen and use custom code to perform custom validation on the content and provide errors to Oxygen, errors which are later displayed by Oxygen to the end user.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
roopesh79
Posts: 26
Joined: Fri Jul 29, 2022 9:55 am

Re: How to add custom validation using xsl with in Oxygen Author SDK

Post by roopesh79 »

Hi Radu,
1. I have tried the option 1 and created the framework. What my understanding is , Even though I shared the framework to my users, still user need to manually configure the framework within oxygen Author, is this correct? What I am looking is a plug- and-play framework which user do not need to make any configuration. Please let me know if this is possible.
2. In the second question what I am trying is to create an oxygen plugin that can be triggered from the a custom plugin menu and validate against the open document and also validate against all the topics in a bookmap.

Regards,
Roopesh
Radu
Posts: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Re: How to add custom validation using xsl with in Oxygen Author SDK

Post by Radu »

Hi Roopesh,
So:
1. I have tried the option 1 and created the framework. What my understanding is , Even though I shared the framework to my users, still user need to manually configure the framework within oxygen Author, is this correct? What I am looking is a plug- and-play framework which user do not need to make any configuration. Please let me know if this is possible.
An Oxygen plugin can specify in the plugin.xml that it also contains a frameworks folder:
https://www.oxygenxml.com/doc/versions/ ... nsion.html

So once you install in Oxygen the plugin which contains inside a framework configuration folder, if you open XML files which are matched by Oxygen to that framework configuration, Oxygen should start validating those opened XML files with the validation scenarios specified in the framework configuration.
2. In the second question what I am trying is to create an oxygen plugin that can be triggered from the a custom plugin menu and validate against the open document and also validate against all the topics in a bookmap.
I assume you would want to create a plugin of type "Workspace Access Plugin Extension":
https://www.oxygenxml.com/doc/versions/ ... lugin.html

An opened document has the API "https://www.oxygenxml.com/InstData/Edit ... ditor.html"
This API allows you to create a reader based on its contents:
https://www.oxygenxml.com/InstData/Edit ... ntReader--
Once you have the contents, you can validate them in any way you want and then display the errors to the end user.
You can use our "ro.sync.exml.workspace.api.PluginWorkspaceProvider.getPluginWorkspace().getResultsManager()" API to show errors in Oxygen's Results view.
About validating all topics in a bookmap, if the bookmap is opened in the DITA Maps Manager view you can gain access to its root element and then use its methods to navigate through all elements and gather all references:

Code: Select all

    WSEditor openedMap = ro.sync.exml.workspace.api.PluginWorkspaceProvider.getPluginWorkspace().getCurrentEditorAccess(PluginWorkspace.DITA_MAPS_EDITING_AREA);
    WSDITAMapEditorPage editorPage = (WSDITAMapEditorPage) openedMap.getCurrentPage();
    AuthorElement mapRootElement = editorPage.getDocumentController().getAuthorDocumentNode().getRootElement();
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
roopesh79
Posts: 26
Joined: Fri Jul 29, 2022 9:55 am

Re: How to add custom validation using xsl with in Oxygen Author SDK

Post by roopesh79 »

Hi Radu,

Thank you so much for the detailed explanation.

Regards,
Roopesh
Post Reply