Nested Schematron: Simple automatic validation

This should cover W3C XML Schema, Relax NG and DTD related problems.
brueggpp
Posts: 4
Location: Switzerland

Nested Schematron: Simple automatic validation

Fri Jan 25, 2008 11:09 am

Hi everybody,

I'm using nested Schematron rules in a XML Schema to check the content of attributes. And this works fine with Oxygen as long as I specify

Code: Select all

<?oxygen SCHSchema="myXMLSchema.xsd"?>

in each XML File (And this occurs twice - because in the next line I specify again the same XML Schema to the XML File - because Schema and Schematron are the same!)!

Unfortunately I do have plenty of XML Files which should use those checks and I don't want to specify in each file <?oxygen ...>, because nobody should know what kind of editor I'm using.

So my question: Is there a way to bypass this <?oxygen/> tag but oxygen should still check the Schematron rules(which are already known - because they're nested in the XML Schema)?
Or are there possible settings in the program, so that nested schematron rules are automatically checked?

Thanks for your help
sorin_ristache
Posts: 4144

Fri Jan 25, 2008 7:17 pm

Hello,

Yes, that is possible if the XML Schema with embedded Schematron rules is a default schema for your XML document. You have to create a new document type from menu Options -> Preferences -- Document Type Association. In the Schema tab of the document type edit dialog you have to select the schema type called XML Schema + Schematron and you have to enter the URL of your schema in the Schema URI field. In the Rules tab of the dialog you have to enter one or more rules for matching this document type with an edited XML document, for example based on the local name of the root element, the file name or the namespace of the XML document. If there is no schema reference in the XML document (no oxygen/@SCHSchema processing instruction, no xsi:schemaLocation attribute) then oXygen tries to match the document to a document type and if there is a match it uses the schema of the document type for content completion and validation of the XML document.


Regards,
Sorin
brueggpp
Posts: 4
Location: Switzerland

Document Type

Mon Jan 28, 2008 10:34 am

Thanks Soring,
this is working like you said, but unfortunately I have a xsi:schemaLocation attribute, and this is used in other applications (and I would still have to remove all xsi:schemaLocation from each XMl either!).

Is there no other way just to tell Oxygen - "check also Schematron rules by default!" :?

Thanks for any hints
sorin_ristache
Posts: 4144

Mon Jan 28, 2008 11:12 am

Hello,

If you have an xsi:schemaLocation attribute the document types defined in the preferences are not checked so you have to specify in the XML document that the schema includes Schematron rules with an <?oxygen SCHSchema="..." ?> instruction. We will consider adding an option for applying the embedded Schematron rules without using an oxygen instruction.


Regards,
Sorin
brueggpp
Posts: 4
Location: Switzerland

Mon Jan 28, 2008 11:39 am

Ok - then I will have to search another solution (without Schematron). Is there maybe a possibilty to check other Schemas by default (because the W3C is sometimes limited)? Does the Relax NG requires also the <Oxygen> instruction?
Or an automatic check with XSL?

(by the way: what I'm checking is the content of some attributes: Example: If attribute a="false" then b has also to be "false" and vice versa. Sounds very simple - but difficult to do a model for that with existing XMLSchema and many XML instances.)

Samples of valid elements:

Code: Select all

<sampleElement a="false" b="false"/>
<sampleElement a="true" b="true"/>
<sampleElement a="false"/>
sorin_ristache
Posts: 4144

Mon Jan 28, 2008 12:03 pm

Yes, co-occurrence constraints are not supported in XML Schema so if you use XML Schema you need also the Schematron rules. You can define this type of constraints in Relax NG without additional Schematron rules but in your case ("If attribute a="false" then b has also to be "false" and vice versa") I think you need additional Schematron rules too. If you need to embed Schematron rules in your Relax NG schema you have to add an instruction <?oxygen SCHSchema="..." ?> in the XML document as in the case of XML Schema. The option for applying the embedded Schematron rules without using an oxygen instruction which I specified above will be applied to Relax NG schemas too.


Regards,
Sorin
brueggpp
Posts: 4
Location: Switzerland

Re: Nested Schematron: Simple automatic validation

Mon Feb 04, 2008 6:06 pm

Ok - for people who want to know if there finally is a solution for such a problem, the answer is no, or not so far!
Hopefully oxygen will introduce this functionality in a future release (A simple checkbox somewhere in the preferences would be enough!).
(Unfortunately I don't know if there is another xml-editor which is able to check nested schematron rules automatically, without an ugly <?oxygen/> or similar element in the beginning of each xml file). :?
yperiard
Posts: 3

Re: Nested Schematron: Simple automatic validation

Thu Aug 07, 2008 5:33 pm

Hi,

just saw this post, is there any news on the implementation of the automatic handling of embedded schematron rules from the preferences instead of using the processing instruction?

An update / expected release number would be great.


Thanks.
sorin_ristache
Posts: 4144

Re: Nested Schematron: Simple automatic validation

Thu Aug 07, 2008 5:49 pm

Hello,

Automatic handling of embedded Schematron rules without an <?oxygen ... ?> processing instruction in the XML instance document will be implemented probably in one of the versions that will be released in the next 6 months.


Regards,
Sorin
george
Site Admin
Posts: 2100

Re: Nested Schematron: Simple automatic validation

Tue Jul 20, 2010 3:44 pm

oXygen introduced some time ago the concept of validation scenarios, similar with the transformation scenarios. This allows to specify multiple validate actions to be performed as part of the validate command and more, these scenarios can be easily associated with a set of files from the contextual menu from the Project view.

Best Regards,
George
George Cristian Bina

Return to “XML Schemas”

Who is online

Users browsing this forum: No registered users and 1 guest