Schematron validation using context="/"
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 43
- Joined: Thu Feb 16, 2023 11:00 pm
Schematron validation using context="/"
Hello!
We are implementing schematron validation in our environment.
We noticed that when using the <sch:rule context="/"> instruction when there is an assert or a report, Oxygen is not pointing out where the error occurred.
Could you tell me if this is because the context is "/" or if it is a feature of Oxygen?
We noticed that when the context is "/" the "Location" is empty.
We would also like to know if it is possible to set a validation scenario dynamically via Java.
Best,
Audye
We are implementing schematron validation in our environment.
We noticed that when using the <sch:rule context="/"> instruction when there is an assert or a report, Oxygen is not pointing out where the error occurred.
Could you tell me if this is because the context is "/" or if it is a feature of Oxygen?
We noticed that when the context is "/" the "Location" is empty.
image.png
We would also like to know if it is possible to set a validation scenario dynamically via Java.
Best,
Audye
You do not have the required permissions to view the files attached to this post.
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Schematron validation using context="/"
Hi Audye,
The XPath "/" means the entire document node context (containing the root element and the possible comments/processing instructions before and after it), so it's not even the root element context. The root element xpath context is "/*". So this is probably why Oxygen does not handle this unusual case as usually the context is set to be the closest element on which the problem should be checked.
About this remark:
Also do you want the validation scenario to validate also with Schematron or to validate with your custom Java code?
Regards,
Radu
The XPath "/" means the entire document node context (containing the root element and the possible comments/processing instructions before and after it), so it's not even the root element context. The root element xpath context is "/*". So this is probably why Oxygen does not handle this unusual case as usually the context is set to be the closest element on which the problem should be checked.
About this remark:
Can you elaborate on why a framework configuration is not enough?We would also like to know if it is possible to set a validation scenario dynamically via Java.
Also do you want the validation scenario to validate also with Schematron or to validate with your custom Java code?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 43
- Joined: Thu Feb 16, 2023 11:00 pm
Re: Schematron validation using context="/"
Hello Radu!
I'm sorry for taking so long to respond.
Thank you very much for indicating the "/*" context, however, we tested and found that this way all errors are highlighted in the first element of the XML file.
We are working with S1000D and we noticed that some checks do not have a defined context, for example:. In this scenario we would like the error to be pointed out in the element that contains the "securityClassification" attribute and which is not the "security" element, however, as the context is "/*" the system is pointing to the element that starts the file.
We imagined that <sch:rule context> would serve to indicate what the context of the check is and that Oxygen would point <sch:report>/<sch:assert> to the element where the condition was affected.
Regarding the configuration of the framework, the company's internal engineering team requested the creation of 3 different validation scenarios. And they would like to choose the validation scenario before opening the file or while editing the file. Could you tell me if Oxygen Web has a mechanism for choosing a validation scenario?
We verified that Oxygen Desktop allows you to choose the validation scenario. There is the default scenario, but it contains a list of scenarios for the user to choose from. Is there something similar on Oxygen Web?
Maybe some user choice mechanism or some code that chooses the scenario when opening the file.
Best,
Audye
I'm sorry for taking so long to respond.
Thank you very much for indicating the "/*" context, however, we tested and found that this way all errors are highlighted in the first element of the XML file.
We are working with S1000D and we noticed that some checks do not have a defined context, for example:
Code: Select all
//*[not(self::security)]/@securityClassification
We imagined that <sch:rule context> would serve to indicate what the context of the check is and that Oxygen would point <sch:report>/<sch:assert> to the element where the condition was affected.
Regarding the configuration of the framework, the company's internal engineering team requested the creation of 3 different validation scenarios. And they would like to choose the validation scenario before opening the file or while editing the file. Could you tell me if Oxygen Web has a mechanism for choosing a validation scenario?
We verified that Oxygen Desktop allows you to choose the validation scenario. There is the default scenario, but it contains a list of scenarios for the user to choose from. Is there something similar on Oxygen Web?
Maybe some user choice mechanism or some code that chooses the scenario when opening the file.
Best,
Audye
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Schematron validation using context="/"
Hello Audye,
Here's an example XML document:
and Schematron schema to validate it with:
When I validate the XML document with the Schematron schema, only the "<abc " element is highlighted with an error.
If that does not work in your case maybe you can give me a similar example where this does not work.
Please see some more remarks below:
Regards,
Radu
Here's an example XML document:
Code: Select all
<root>
<abc securityClassification="zz"></abc>
<def></def>
</root>
Code: Select all
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2"
xmlns:sqf="http://www.schematron-quickfix.com/validator/process">
<sch:pattern>
<sch:rule context="*[not(self::security)]/@securityClassification">
<sch:report test="true()">REPORT ME</sch:report>
</sch:rule>
</sch:pattern>
</sch:schema>
If that does not work in your case maybe you can give me a similar example where this does not work.
Please see some more remarks below:
Usually Oxygen detects a framework configuration and uses its associated validation scenario depending on the XML contents. Can anything (maybe attribute set on root element) inside the XML document be used to auto detect the used Schematron schema?Regarding the configuration of the framework, the company's internal engineering team requested the creation of 3 different validation scenarios. And they would like to choose the validation scenario before opening the file or while editing the file.
The desktop application is more flexible as it covers also more expert XML developers.We verified that Oxygen Desktop allows you to choose the validation scenario. There is the default scenario, but it contains a list of scenarios for the user to choose from.
WebAuthor is mostly for people using visual editing and who do not know what Schematron is. Maybe somehow a GET parameter could be passed to determine the used Schematron schema but I'm not sure if this is possible, I will ask my colleagues from the WebAuthor team to help us with this one and reply on the thread further.Is there something similar on Oxygen Web?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Schematron validation using context="/"
Hi,
About the WebAuthor tool, all its possible GET parameters are listed here:
https://www.oxygenxml.com/doc/versions/ ... r-app.html
There is this parameter:
Regards,
Radu
About the WebAuthor tool, all its possible GET parameters are listed here:
https://www.oxygenxml.com/doc/versions/ ... r-app.html
There is this parameter:
which would mean that if inside the Schematron used for validation there would be multiple phases, each with its rules, this parameter could be used to impose a certain phase for validation.schematron.imposed.phase - This parameter can be used to impose the Schematron phase to use when validating with a Schematron file.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 43
- Joined: Thu Feb 16, 2023 11:00 pm
Re: Schematron validation using context="/"
Hi,
Thank you very much Radu for your recommendation.
Yesterday I spent the day testing some options.
We can join the three Schematrons we have into one and separate them using the <sch:phase> instruction. So when we open the XML for editing we can send the "schematron.imposed.phase" parameter via URL.
I have one last question, could we use the "ValidationScenarioInvoker" method from the "ro.sync.exml.workspace.api.editor.validation" package to programmatically run a validation scenario?
Best,
Audye
Thank you very much Radu for your recommendation.
Yesterday I spent the day testing some options.
We can join the three Schematrons we have into one and separate them using the <sch:phase> instruction. So when we open the XML for editing we can send the "schematron.imposed.phase" parameter via URL.
I have one last question, could we use the "ValidationScenarioInvoker" method from the "ro.sync.exml.workspace.api.editor.validation" package to programmatically run a validation scenario?
Best,
Audye
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Schematron validation using context="/"
Hi Audye,
About this question:
Regards,
Radu
About this question:
Right now the method "ValidationScenarioInvoker.runValidationScenarios(String[])" is implemented and works for the desktop Oxygen but from what I checked it does not work for Web Author.I have one last question, could we use the "ValidationScenarioInvoker" method from the "ro.sync.exml.workspace.api.editor.validation" package to programmatically run a validation scenario?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
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