Schematron

The Schematron is a schema language for validation of content and structure of XML documents. The implementation of the language is implemented through XSL transformations, so does not require any specific implementation, such as is the case with most other document structure definition language.

Schematron was developed by Rick Jelliffe at the Academia Sinica Computing Centre in Taipei, Taiwan in 1999. Since May 2006 Schematron 1.6 is registered as an official ISO / IEC 19757-3:2006 standard under the number ( called ISO Schematron ).

Introduction

Unlike, for example DTD or XML schema Schematron not used to define, but for validation of content in XML documents. It does not use a formal grammar, but finds patterns in the document structure. Thereby, it is possible to define rules which would not be possible with conventional schema languages ​​that are based on grammars. However, Schematron should be understood primarily as a supplement, not as a competitor to other schema languages.

Possible applications include complex rules that express dependencies between different parts of the document tree or require dynamic calculations.

Concept and syntax

A Schematron schema consists essentially of an XML document with different validation rules, in each of which a context node is determined, on which representations and reports formulated to be tested later.

The following example shows a Schematron 1.5 schema:

   A Schematron schema for Mini Schematron </ title>    <ns prefix="sch" uri="http://www.ascc.net/xml/schematron" />    <pattern name="Schematron Basic Structure">      <rule context="sch:schema">        <assert test="sch:pattern"> A schematic contains patterns.        </ assert >        <assert test="sch:pattern/sch:rule[@context]"> A pattern is composed of rules. These rules shouldhave context attributes.        </ assert >        <assert test="sch:pattern/sch:rule/sch:assert[@test] or sch:pattern/sch:rule/sch:report[@test]"> A rule is composed of the assert and report statements. These rules shouldhave a test attribute.        </ assert >      </ rule>    < / pattern> </ schema> This mini - scheme, which allows a rudimentary examination of a Schematron 1.5 schema consists of the following elements: </p> <ul> <li></li> <li>An optional element <title> describing the schema </li> <li>Any number of < ns prefix = "? *? *? " uri = "? *? *? " / > Elements where namespace (uri ) and their prefixes ( prefix ) for use in XPath expressions are declared, </li> <li><pattern name="?*?*?"> as a container with a description (name) for more </li> <li><rule context="?*?*?"> - elements, context, an XPath expression is used to define the environment in which the following two elements are executed: </li> <li><assert test="?*?*?"> to formulate an assurance, together with an error message for the case that the in test formulated using XPath test fails, or </li> <li>( in the example does not use ) <report test="?*?*?"> to formulate an assurance, together with a message text in the event that the test is successful. </li> </ul> <p> Basically you put in Schematron determine the success or failure messages themselves, which appear at the end as a result of the validation. </p> <h2> Operation </h2> <p> Formulated in the scheme for carrying out the tests, it is necessary to use a Schematron implementation. One possible implementation is an XSL stylesheet, which in turn generates an XSL stylesheet from the given scheme, with which then the document to be tested is transformed: </p> <p> At the end, depending on the type of Schematron implementation used, a text or XML document that contains the results of the test ( reports of successful <report> tests and failed <assert> tests). This result can be displayed to the user in a Validator program, for example. </p> <p> The reference implementation is specifically designed modularly, so that one can use, for example, one of the standard text style sheets to create a simple text output. The Schematron "core" is only designed to search error and to collect success stories. A separate extended stylesheet could then, for example, create a self -defined XML format with error messages, which is processed by a software first, to determine whether validation errors have occurred at all, before they are automatically recorded and displayed to the user. </p> </section> <section class="relLinks"> <a href="/document-schema-definition-languages.html">Document Schema Definition Languages</a> <a href="/international-electrotechnical-commission.html">International Electrotechnical Commission</a> <a href="/document-structure-description.html">Document Structure Description</a> <a href="/integrated-authority-file.html">Integrated Authority File</a> </section> <div class="comments"> </div> <section> </section> <span style="font-size:.5em">712805</span> <div class="share_buttons"> <div class="addthis_sharing_toolbox"></div> </div> </main> </div> </td></tr><tr><td id="footer"> <div class="aligner"> <footer class="mainHolder" style="text-align:center;"> <!--LiveInternet counter--><script type="text/javascript"><!-- document.write("<a href='http://www.liveinternet.ru/click' "+ "target=_blank rel=nofollow><img src='//counter.yadro.ru/hit?t18.5;r"+ escape(document.referrer)+((typeof(screen)=="undefined")?"": ";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth? screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+ ";"+Math.random()+ "' alt='' title='LiveInternet' "+ "border='0' width='88' height='31'><\/a>") //--></script><!--/LiveInternet--> <br /> memim.com 2021<br /> All rights reserved<br /> <span style='font-size:0.5em'>Page generated in 0.0226<br /></span> <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5093bb6e1c1ddca0"></script> <script> function jr(ready){ if(window.jQuery){ //ready(); }else{ setTimeout(jr,100,ready); } } jr(function() { $(".imagesHolder img").each(function () { var i=$(this); console.log(i.attr('src')+' '+i.width()+' '+i.readyState); //$(this).remove(); }); }); </script> </footer> </div> </td></tr></table> <span style="font-size:.3em">de</span> </body> </html>