Run a Schematron validation scenario programmatically
Are you missing a feature? Request its implementation here.
-
- Posts: 43
- Joined: Thu Feb 16, 2023 11:00 pm
Run a Schematron validation scenario programmatically
Good afternoon,
Based on ticket post74532.html#p74532, we understand that it is only possible to programmatically run a Schematron validation scenario in Oxygen Desktop.
We would like to request the implementation of this feature in Oxygen XML Editor Web.
We are working with S1000D, where each project has its own Schematron with specific rules. Since our framework is designed to serve the application as a whole, we face the challenge of validating BREX information via Schematron for each project.
To address this issue, we had to extend our ".framework". In this extension, we manually linked the validation scenario to the corresponding project. However, if we could programmatically select the validation scenario via Java or JavaScript, we wouldn’t need to create specific extensions for each project.
In ticket 74532, it was stated that the ValidationScenarioInvoker.ValidationScenarios() method works only in the Oxygen Desktop version. Therefore, our feature request is to enable this validation to be invoked via Java in the Web environment as well.
Thank you very much for your attention.
Based on ticket post74532.html#p74532, we understand that it is only possible to programmatically run a Schematron validation scenario in Oxygen Desktop.
We would like to request the implementation of this feature in Oxygen XML Editor Web.
We are working with S1000D, where each project has its own Schematron with specific rules. Since our framework is designed to serve the application as a whole, we face the challenge of validating BREX information via Schematron for each project.
To address this issue, we had to extend our ".framework". In this extension, we manually linked the validation scenario to the corresponding project. However, if we could programmatically select the validation scenario via Java or JavaScript, we wouldn’t need to create specific extensions for each project.
In ticket 74532, it was stated that the ValidationScenarioInvoker.ValidationScenarios() method works only in the Oxygen Desktop version. Therefore, our feature request is to enable this validation to be invoked via Java in the Web environment as well.
Thank you very much for your attention.
-
- Site Admin
- Posts: 233
- Joined: Wed Aug 30, 2023 2:33 pm
Re: Run a Schematron validation scenario programmatically
Hello,
Thank you for contacting us.
In response to your request, we would like to suggest an alternative approach using the schematron.imposed.phase URL parameter [1].
The schematron.imposed.phase URL parameter is used to specify a particular phase of a Schematron schema to be applied when validating a document in Oxygen XML Web Author. This allows you to control which parts of the Schematron rules are executed during validation.
Do you think this alternative meets your needs?
Best,
Cosmin
Thank you for contacting us.
In response to your request, we would like to suggest an alternative approach using the schematron.imposed.phase URL parameter [1].
The schematron.imposed.phase URL parameter is used to specify a particular phase of a Schematron schema to be applied when validating a document in Oxygen XML Web Author. This allows you to control which parts of the Schematron rules are executed during validation.
Do you think this alternative meets your needs?
Best,
Cosmin
Cosmin Eftenie
www.oxygenxml.com
www.oxygenxml.com
-
- Posts: 43
- Joined: Thu Feb 16, 2023 11:00 pm
Re: Run a Schematron validation scenario programmatically
Hello, Cosmin!
We are currently using your suggestion. We are sending the schematron.imposed.phase via URL and successfully validating the rules.
However, in our business, each model in S1000D uses at least three different Schematron files, each containing an average of 300 validations.
Initially, we compiled these three files into a single file and passed the phase via URL.
However, in the future, we will have around 20 different models, each with its own three Schematron files. If we consolidate all these validations into a single file, it might become so large that it won't even open, and it could potentially cause performance issues in the system.
Therefore, we believe it would be better to have the option to select the validation file directly via Java instead of just the phase. Additionally, it would be interesting if we could choose the Schematron validation file directly via URL instead of selecting only the phase. That would also address this issue.
We are currently using your suggestion. We are sending the schematron.imposed.phase via URL and successfully validating the rules.
However, in our business, each model in S1000D uses at least three different Schematron files, each containing an average of 300 validations.
Initially, we compiled these three files into a single file and passed the phase via URL.
However, in the future, we will have around 20 different models, each with its own three Schematron files. If we consolidate all these validations into a single file, it might become so large that it won't even open, and it could potentially cause performance issues in the system.
Therefore, we believe it would be better to have the option to select the validation file directly via Java instead of just the phase. Additionally, it would be interesting if we could choose the Schematron validation file directly via URL instead of selecting only the phase. That would also address this issue.
-
- Posts: 3
- Joined: Fri Dec 08, 2023 12:51 pm
Re: Run a Schematron validation scenario programmatically
Hi,
A possible workaround could be to use a validation scenario that points to a schema using editor variables:
You can create a custom handler that handles these requests and returns your desired schema:
Hope this helps,
Mircea
A possible workaround could be to use a validation scenario that points to a schema using editor variables:
example.png
In this example, ${cfdu} is resolved to the path of the curent file directory. You can create a custom handler that handles these requests and returns your desired schema:
Code: Select all
PluginWorkspaceProvider.getPluginWorkspace().getXMLUtilAccess().addPriorityURIResolver(
new URIResolver() {
@Override
public Source resolve(String href, String base) throws TransformerException {
if (href.endsWith("dynamic-schema.sch")) {
if (base.contains("project1")) {
// TODO: return schema for project 1
} else if (base.contains("project2")) {
// TODO: return schema for project 2
}
}
// Let another handler handle this
return null;
}
});
Hope this helps,
Mircea
You do not have the required permissions to view the files attached to this post.
-
- Posts: 4
- Joined: Mon Apr 28, 2025 7:11 pm
Re: Run a Schematron validation scenario programmatically
Hi Cosmin,
We have a very similar situation to handle. I read through your post and will give the same a try but one thing I cannot figure out is - How/where do you configure the custom handler so that it is used? Any light you can shed on this would be much appreciated.
Thanks,
Kelly
We have a very similar situation to handle. I read through your post and will give the same a try but one thing I cannot figure out is - How/where do you configure the custom handler so that it is used? Any light you can shed on this would be much appreciated.
Thanks,
Kelly
-
- Site Admin
- Posts: 172
- Joined: Tue Mar 20, 2018 5:28 pm
Re: Run a Schematron validation scenario programmatically
Post by Bogdan Dumitru »
Hello Kelly,
By "custom handler" I assume that you're referring to the URIResolver from Mircea's message, the one installed with PluginWorkspaceProvider.getPluginWorkspace().getXMLUtilAccess().addPriorityURIResolver.
To install the URI Resolver you have to execute the Java code that calls PluginWorkspaceProvider.getPluginWorkspace().getXMLUtilAccess().addPriorityURIResolver when applications starts in a plugin based on Oxygen SDK. You can define in plugin.xml an extension of type "WorkspaceAccess" that must refer to a class that implements ro.sync.exml.plugin.workspace.WorkspaceAccessPluginExtension interface from Oxygen SDK. On the WorkspaceAccessPluginExtension.applicationStarted implementation you should call addPriorityURIResolver.
Here are some useful links:
1. a sample plugin that uses "WorkspaceAccess" extension type https://github.com/oxygenxml/web-author ... ems-filter
2. Oxygen SDK page where you should find the JavaDoc of the above-mentioned classes: https://www.oxygenxml.com/oxygen_sdk.html
3. documentation page about Web Author plugins: https://www.oxygenxml.com/doc/versions/ ... ugins.html
By "custom handler" I assume that you're referring to the URIResolver from Mircea's message, the one installed with PluginWorkspaceProvider.getPluginWorkspace().getXMLUtilAccess().addPriorityURIResolver.
To install the URI Resolver you have to execute the Java code that calls PluginWorkspaceProvider.getPluginWorkspace().getXMLUtilAccess().addPriorityURIResolver when applications starts in a plugin based on Oxygen SDK. You can define in plugin.xml an extension of type "WorkspaceAccess" that must refer to a class that implements ro.sync.exml.plugin.workspace.WorkspaceAccessPluginExtension interface from Oxygen SDK. On the WorkspaceAccessPluginExtension.applicationStarted implementation you should call addPriorityURIResolver.
Here are some useful links:
1. a sample plugin that uses "WorkspaceAccess" extension type https://github.com/oxygenxml/web-author ... ems-filter
2. Oxygen SDK page where you should find the JavaDoc of the above-mentioned classes: https://www.oxygenxml.com/oxygen_sdk.html
3. documentation page about Web Author plugins: https://www.oxygenxml.com/doc/versions/ ... ugins.html
Bogdan Dumitru
http://www.oxygenxml.com
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service