Page 1 of 1
					
				Nested Schematron: Simple automatic validation
				Posted: Fri Jan 25, 2008 11:09 am
				by brueggpp
				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
 
			
					
				
				Posted: Fri Jan 25, 2008 7:17 pm
				by sorin_ristache
				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
 
			
					
				Document Type
				Posted: Mon Jan 28, 2008 10:34 am
				by brueggpp
				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
 
			
					
				
				Posted: Mon Jan 28, 2008 11:12 am
				by sorin_ristache
				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
			 
			
					
				
				Posted: Mon Jan 28, 2008 11:39 am
				by brueggpp
				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"/>
 
			
					
				
				Posted: Mon Jan 28, 2008 12:03 pm
				by sorin_ristache
				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
 
			
					
				Re: Nested Schematron: Simple automatic validation
				Posted: Mon Feb 04, 2008 6:06 pm
				by brueggpp
				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).  

 
			
					
				Re: Nested Schematron: Simple automatic validation
				Posted: Thu Aug 07, 2008 5:33 pm
				by yperiard
				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.
			 
			
					
				Re: Nested Schematron: Simple automatic validation
				Posted: Thu Aug 07, 2008 5:49 pm
				by sorin_ristache
				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
			 
			
					
				Re: Nested Schematron: Simple automatic validation
				Posted: Tue Jul 20, 2010 3:44 pm
				by george
				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