Check Relax NG Grammar with Schematron?
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 87
- Joined: Tue Jan 01, 2013 3:19 pm
Check Relax NG Grammar with Schematron?
Hi,
i have a Relax NG Schema, that is, a grammr Element in the http://relaxng.org/ns/structure/1.0 namespace. I would like to check wheter al elements defined in this grammar are properly documented. So i wrote a schematron Schema which reports all elements without a a:documentation child.
However, i was unable to assign the schematron schema to the Relax NG Document. The Menu Item for "Assign Schema" is grayed out. So i wrote a xml-model instruction like this (it was copy-pasted from a normal XML Document, where the schematron file was assigned to without any problems):
But this does not work either. It seems to me that this PI is completely ignored when validating the Relax NG Document.
To conclude: my question is, is there a way to check semantic constraints on RELAX NG grammars with self-defined Schematron rules?
Sincerely,
Frank
i have a Relax NG Schema, that is, a grammr Element in the http://relaxng.org/ns/structure/1.0 namespace. I would like to check wheter al elements defined in this grammar are properly documented. So i wrote a schematron Schema which reports all elements without a a:documentation child.
However, i was unable to assign the schematron schema to the Relax NG Document. The Menu Item for "Assign Schema" is grayed out. So i wrote a xml-model instruction like this (it was copy-pasted from a normal XML Document, where the schematron file was assigned to without any problems):
Code: Select all
<?xml-model href="constraint.sch" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
To conclude: my question is, is there a way to check semantic constraints on RELAX NG grammars with self-defined Schematron rules?
Sincerely,
Frank
-
- Posts: 404
- Joined: Thu Aug 21, 2003 11:36 am
- Location: Craiova
- Contact:
Re: Check Relax NG Grammar with Schematron?
Post by radu_pisoi »
Hi Frank,
However, if you want to validate your RNG document as a regular XML document then you could open it as an XML document(from the Project view you have to use the contextual action "Open with" -> "Internal editor". This action will display a dialog in which you should select the "XML document" entry). The RNG document will be opened with the XML editor that allows you to associate and validate the edited document with an external schema.
Next, I will give you two ways to define a validation scenario and you have to choose one depending on your needs.
1. The first and fastest solution is to create and associate a validation scenario for the edited RNG document. This assumes that the RNG document is already opened in the application.
* To create a new validatin scenario click the 'Configure the validation Scenario(s)' action from the toolbar. This action will display an dialog that allows you to manage the validation scenarios.
* Create a new one by clicking the New button. In the new displayed dialog you will define your validation scenario by specifying two validation units:
** the first validation unit will validate your document as a normal RNG document;
** the second validation unit will validate your document as an XML document against your Schematron schema.
* After you have defined the validation units press OK to confirm the new created scenario.
* To use it, you should associate it with the edited document (the checkbox from the right side of the scenario name should be checked).
Press 'Apply associated' and your document will be validated twice: first as an RNG document and second with the specified Schematron schema.
More about validation scenarios could be found here:
http://www.oxygenxml.com/doc/ug-editor/ ... nario.html
2. If you want to impose these rules to any RNG document (elements from any RNG document should been documented), you could define a default validation scenario for the 'Relax NG' document type. In this case, when you validate a RNG document it will be validated also against the rules defined in the Schematron schema.
To edit the Relax NG document type in order to add a new default validation scenario you have to follow this procedure:
* Open the Preferences dialog by using the menu action: Options/Preferences
* Find the 'Document Type Association' options page, the easiest way is to write 'Document Type Association' in the quick filter;
3. Find and edit the 'Relax NG' document type
4. In the 'Document Type' dialog select the Validation tab
5. Define a new validation scenario similar with the one created above;
6. To make it the default validation scenario you have to select it in 'Validation' tab
Please see more details here:
http://www.oxygenxml.com/doc/ug-editor/ ... arios.html
Do not hesitate to contact us if you have additional questions.
This action was disabled deliberately because there are some situations when it could be used erroneously. For instance, I think there is no reason to associate a DTD schema or another RNG schema with the current edited RNG document.fsteimke wrote: However, i was unable to assign the schematron schema to the Relax NG Document. The Menu Item for "Assign Schema" is grayed out.
However, if you want to validate your RNG document as a regular XML document then you could open it as an XML document(from the Project view you have to use the contextual action "Open with" -> "Internal editor". This action will display a dialog in which you should select the "XML document" entry). The RNG document will be opened with the XML editor that allows you to associate and validate the edited document with an external schema.
In my opinion, the best solution is to create a validation scenario for the RNG document. This allows you to edit it as a normal RNG document and also to check it against a Schematron schema.fsteimke wrote: To conclude: my question is, is there a way to check semantic constraints on RELAX NG grammars with self-defined Schematron rules?
Next, I will give you two ways to define a validation scenario and you have to choose one depending on your needs.
1. The first and fastest solution is to create and associate a validation scenario for the edited RNG document. This assumes that the RNG document is already opened in the application.
* To create a new validatin scenario click the 'Configure the validation Scenario(s)' action from the toolbar. This action will display an dialog that allows you to manage the validation scenarios.
* Create a new one by clicking the New button. In the new displayed dialog you will define your validation scenario by specifying two validation units:
** the first validation unit will validate your document as a normal RNG document;
** the second validation unit will validate your document as an XML document against your Schematron schema.
* After you have defined the validation units press OK to confirm the new created scenario.
* To use it, you should associate it with the edited document (the checkbox from the right side of the scenario name should be checked).
Press 'Apply associated' and your document will be validated twice: first as an RNG document and second with the specified Schematron schema.
More about validation scenarios could be found here:
http://www.oxygenxml.com/doc/ug-editor/ ... nario.html
2. If you want to impose these rules to any RNG document (elements from any RNG document should been documented), you could define a default validation scenario for the 'Relax NG' document type. In this case, when you validate a RNG document it will be validated also against the rules defined in the Schematron schema.
To edit the Relax NG document type in order to add a new default validation scenario you have to follow this procedure:
* Open the Preferences dialog by using the menu action: Options/Preferences
* Find the 'Document Type Association' options page, the easiest way is to write 'Document Type Association' in the quick filter;
3. Find and edit the 'Relax NG' document type
4. In the 'Document Type' dialog select the Validation tab
5. Define a new validation scenario similar with the one created above;
6. To make it the default validation scenario you have to select it in 'Validation' tab
Please see more details here:
http://www.oxygenxml.com/doc/ug-editor/ ... arios.html
Do not hesitate to contact us if you have additional questions.
Radu Pisoi
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 482
- Joined: Thu Jan 23, 2014 2:29 pm
- Location: Hamburg
- Contact:
Re: Check Relax NG Grammar with Schematron?
Post by Frank Ralf »
Hi Radu,
Thanks for these thorough instructions!
I had the problem that my RNG files wouldn't validate and noticed after some investigation that the RELAX NG document type doesn't have a default validation scenario activated as for example the DITA document types. Is there a reason for this?
Kind regards,
Frank
Thanks for these thorough instructions!
I had the problem that my RNG files wouldn't validate and noticed after some investigation that the RELAX NG document type doesn't have a default validation scenario activated as for example the DITA document types. Is there a reason for this?
Kind regards,
Frank
Frank Ralf
parson AG
www.parson-europe.com
parson AG
www.parson-europe.com
-
- Posts: 482
- Joined: Thu Jan 23, 2014 2:29 pm
- Location: Hamburg
- Contact:
Re: Check Relax NG Grammar with Schematron?
Post by Frank Ralf »
I forgot to mention that I'm using oXygen Author at the moment so this might be different with the full fledged oXygen Editor version.
Kind regards,
Frank
PS:
The same goes for Schematron files, there is no (default) validation scenario associated with the document type.
Kind regards,
Frank
PS:
The same goes for Schematron files, there is no (default) validation scenario associated with the document type.
Frank Ralf
parson AG
www.parson-europe.com
parson AG
www.parson-europe.com
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: Check Relax NG Grammar with Schematron?
Hello,
Oxygen only provides validation scenarios for some XML document types (where necessary), but in general none for schemas. With regard to schemas Oxygen XML Editor (and also Developer) provides for each type of schema a specialized editor (in some cases with a diagram) that handles validation with specific engines, content completion and various helpers (Outline, locate declarations, references, etc).
On the other hand, Oxygen XML Author does not have any of these specialized schema editors, nor does it provide validation for schemas (which is bound to the type of editor). So, if you open any type of schema in Author, it is treated as vanilla XML.
Regards,
Adrian
Oxygen only provides validation scenarios for some XML document types (where necessary), but in general none for schemas. With regard to schemas Oxygen XML Editor (and also Developer) provides for each type of schema a specialized editor (in some cases with a diagram) that handles validation with specific engines, content completion and various helpers (Outline, locate declarations, references, etc).
On the other hand, Oxygen XML Author does not have any of these specialized schema editors, nor does it provide validation for schemas (which is bound to the type of editor). So, if you open any type of schema in Author, it is treated as vanilla XML.
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ 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