libxml2-schematron.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  5. <title>schematron: XML Schemastron implementation</title>
  6. <meta name="generator" content="Libxml2 devhelp stylesheet"/>
  7. <link rel="start" href="index.html" title="libxml2 Reference Manual"/>
  8. <link rel="up" href="general.html" title="API"/>
  9. <link rel="stylesheet" href="style.css" type="text/css"/>
  10. <link rel="chapter" href="general.html" title="API"/>
  11. </head>
  12. <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
  13. <table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
  14. <tr valign="middle">
  15. <td>
  16. <a accesskey="p" href="libxml2-schemasInternals.html">
  17. <img src="left.png" width="24" height="24" border="0" alt="Prev"/>
  18. </a>
  19. </td>
  20. <td>
  21. <a accesskey="u" href="general.html">
  22. <img src="up.png" width="24" height="24" border="0" alt="Up"/>
  23. </a>
  24. </td>
  25. <td>
  26. <a accesskey="h" href="index.html">
  27. <img src="home.png" width="24" height="24" border="0" alt="Home"/>
  28. </a>
  29. </td>
  30. <td>
  31. <a accesskey="n" href="libxml2-threads.html">
  32. <img src="right.png" width="24" height="24" border="0" alt="Next"/>
  33. </a>
  34. </td>
  35. <th width="100%" align="center">libxml2 Reference Manual</th>
  36. </tr>
  37. </table>
  38. <h2>
  39. <span class="refentrytitle">schematron</span>
  40. </h2>
  41. <p>schematron - XML Schemastron implementation</p>
  42. <p>interface to the XML Schematron validity checking. </p>
  43. <p>Author(s): Daniel Veillard </p>
  44. <div class="refsynopsisdiv">
  45. <h2>Synopsis</h2>
  46. <pre class="synopsis">typedef struct _xmlSchematronValidCtxt <a href="#xmlSchematronValidCtxt">xmlSchematronValidCtxt</a>;
  47. typedef enum <a href="#xmlSchematronValidOptions">xmlSchematronValidOptions</a>;
  48. typedef <a href="libxml2-schematron.html#xmlSchematron">xmlSchematron</a> * <a href="#xmlSchematronPtr">xmlSchematronPtr</a>;
  49. typedef struct _xmlSchematronParserCtxt <a href="#xmlSchematronParserCtxt">xmlSchematronParserCtxt</a>;
  50. typedef struct _xmlSchematron <a href="#xmlSchematron">xmlSchematron</a>;
  51. typedef <a href="libxml2-schematron.html#xmlSchematronValidCtxt">xmlSchematronValidCtxt</a> * <a href="#xmlSchematronValidCtxtPtr">xmlSchematronValidCtxtPtr</a>;
  52. typedef <a href="libxml2-schematron.html#xmlSchematronParserCtxt">xmlSchematronParserCtxt</a> * <a href="#xmlSchematronParserCtxtPtr">xmlSchematronParserCtxtPtr</a>;
  53. int <a href="#xmlSchematronValidateDoc">xmlSchematronValidateDoc</a> (<a href="libxml2-schematron.html#xmlSchematronValidCtxtPtr">xmlSchematronValidCtxtPtr</a> ctxt, <br/> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> instance);
  54. void <a href="#xmlSchematronFreeParserCtxt">xmlSchematronFreeParserCtxt</a> (<a href="libxml2-schematron.html#xmlSchematronParserCtxtPtr">xmlSchematronParserCtxtPtr</a> ctxt);
  55. <a href="libxml2-schematron.html#xmlSchematronParserCtxtPtr">xmlSchematronParserCtxtPtr</a> <a href="#xmlSchematronNewMemParserCtxt">xmlSchematronNewMemParserCtxt</a> (const char * buffer, <br/> int size);
  56. typedef void <a href="#xmlSchematronValidityErrorFunc">xmlSchematronValidityErrorFunc</a> (void * ctx, <br/> const char * msg, <br/> ... ...);
  57. <a href="libxml2-schematron.html#xmlSchematronParserCtxtPtr">xmlSchematronParserCtxtPtr</a> <a href="#xmlSchematronNewParserCtxt">xmlSchematronNewParserCtxt</a> (const char * URL);
  58. typedef void <a href="#xmlSchematronValidityWarningFunc">xmlSchematronValidityWarningFunc</a> (void * ctx, <br/> const char * msg, <br/> ... ...);
  59. void <a href="#xmlSchematronFree">xmlSchematronFree</a> (<a href="libxml2-schematron.html#xmlSchematronPtr">xmlSchematronPtr</a> schema);
  60. void <a href="#xmlSchematronSetValidStructuredErrors">xmlSchematronSetValidStructuredErrors</a> (<a href="libxml2-schematron.html#xmlSchematronValidCtxtPtr">xmlSchematronValidCtxtPtr</a> ctxt, <br/> <a href="libxml2-xmlerror.html#xmlStructuredErrorFunc">xmlStructuredErrorFunc</a> serror, <br/> void * ctx);
  61. void <a href="#xmlSchematronFreeValidCtxt">xmlSchematronFreeValidCtxt</a> (<a href="libxml2-schematron.html#xmlSchematronValidCtxtPtr">xmlSchematronValidCtxtPtr</a> ctxt);
  62. <a href="libxml2-schematron.html#xmlSchematronPtr">xmlSchematronPtr</a> <a href="#xmlSchematronParse">xmlSchematronParse</a> (<a href="libxml2-schematron.html#xmlSchematronParserCtxtPtr">xmlSchematronParserCtxtPtr</a> ctxt);
  63. <a href="libxml2-schematron.html#xmlSchematronParserCtxtPtr">xmlSchematronParserCtxtPtr</a> <a href="#xmlSchematronNewDocParserCtxt">xmlSchematronNewDocParserCtxt</a> (<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc);
  64. <a href="libxml2-schematron.html#xmlSchematronValidCtxtPtr">xmlSchematronValidCtxtPtr</a> <a href="#xmlSchematronNewValidCtxt">xmlSchematronNewValidCtxt</a> (<a href="libxml2-schematron.html#xmlSchematronPtr">xmlSchematronPtr</a> schema, <br/> int options);
  65. </pre>
  66. </div>
  67. <div class="refsect1" lang="en">
  68. <h2>Description</h2>
  69. </div>
  70. <div class="refsect1" lang="en">
  71. <h2>Details</h2>
  72. <div class="refsect2" lang="en">
  73. <div class="refsect2" lang="en"><h3><a name="xmlSchematron">Structure </a>xmlSchematron</h3><pre class="programlisting">struct _xmlSchematron {
  74. The content of this structure is not made public by the API.
  75. } xmlSchematron;
  76. </pre><p/>
  77. </div>
  78. <hr/>
  79. <div class="refsect2" lang="en"><h3><a name="xmlSchematronParserCtxt">Structure </a>xmlSchematronParserCtxt</h3><pre class="programlisting">struct _xmlSchematronParserCtxt {
  80. The content of this structure is not made public by the API.
  81. } xmlSchematronParserCtxt;
  82. </pre><p/>
  83. </div>
  84. <hr/>
  85. <div class="refsect2" lang="en"><h3><a name="xmlSchematronParserCtxtPtr">Typedef </a>xmlSchematronParserCtxtPtr</h3><pre class="programlisting"><a href="libxml2-schematron.html#xmlSchematronParserCtxt">xmlSchematronParserCtxt</a> * xmlSchematronParserCtxtPtr;
  86. </pre><p/>
  87. </div>
  88. <hr/>
  89. <div class="refsect2" lang="en"><h3><a name="xmlSchematronPtr">Typedef </a>xmlSchematronPtr</h3><pre class="programlisting"><a href="libxml2-schematron.html#xmlSchematron">xmlSchematron</a> * xmlSchematronPtr;
  90. </pre><p/>
  91. </div>
  92. <hr/>
  93. <div class="refsect2" lang="en"><h3><a name="xmlSchematronValidCtxt">Structure </a>xmlSchematronValidCtxt</h3><pre class="programlisting">struct _xmlSchematronValidCtxt {
  94. The content of this structure is not made public by the API.
  95. } xmlSchematronValidCtxt;
  96. </pre><p/>
  97. </div>
  98. <hr/>
  99. <div class="refsect2" lang="en"><h3><a name="xmlSchematronValidCtxtPtr">Typedef </a>xmlSchematronValidCtxtPtr</h3><pre class="programlisting"><a href="libxml2-schematron.html#xmlSchematronValidCtxt">xmlSchematronValidCtxt</a> * xmlSchematronValidCtxtPtr;
  100. </pre><p/>
  101. </div>
  102. <hr/>
  103. <div class="refsect2" lang="en"><h3><a name="xmlSchematronValidOptions">Enum </a>xmlSchematronValidOptions</h3><pre class="programlisting">enum <a href="#xmlSchematronValidOptions">xmlSchematronValidOptions</a> {
  104. <a name="XML_SCHEMATRON_OUT_QUIET">XML_SCHEMATRON_OUT_QUIET</a> = 1 /* quiet no report */
  105. <a name="XML_SCHEMATRON_OUT_TEXT">XML_SCHEMATRON_OUT_TEXT</a> = 2 /* build a textual report */
  106. <a name="XML_SCHEMATRON_OUT_XML">XML_SCHEMATRON_OUT_XML</a> = 4 /* output SVRL */
  107. <a name="XML_SCHEMATRON_OUT_ERROR">XML_SCHEMATRON_OUT_ERROR</a> = 8 /* output via xmlStructuredErrorFunc */
  108. <a name="XML_SCHEMATRON_OUT_FILE">XML_SCHEMATRON_OUT_FILE</a> = 256 /* output to a file descriptor */
  109. <a name="XML_SCHEMATRON_OUT_BUFFER">XML_SCHEMATRON_OUT_BUFFER</a> = 512 /* output to a buffer */
  110. <a name="XML_SCHEMATRON_OUT_IO">XML_SCHEMATRON_OUT_IO</a> = 1024 /* output to I/O mechanism */
  111. };
  112. </pre><p/>
  113. </div>
  114. <hr/>
  115. <div class="refsect2" lang="en"><h3><a name="xmlSchematronValidityErrorFunc"/>Function type xmlSchematronValidityErrorFunc</h3><pre class="programlisting">void xmlSchematronValidityErrorFunc (void * ctx, <br/> const char * msg, <br/> ... ...)<br/>
  116. </pre><p>Signature of an error callback from a Schematron validation</p>
  117. <div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the validation context</td></tr><tr><td><span class="term"><i><tt>msg</tt></i>:</span></td><td>the message</td></tr><tr><td><span class="term"><i><tt>...</tt></i>:</span></td><td>extra arguments</td></tr></tbody></table></div></div>
  118. <hr/>
  119. <div class="refsect2" lang="en"><h3><a name="xmlSchematronValidityWarningFunc"/>Function type xmlSchematronValidityWarningFunc</h3><pre class="programlisting">void xmlSchematronValidityWarningFunc (void * ctx, <br/> const char * msg, <br/> ... ...)<br/>
  120. </pre><p>Signature of a warning callback from a Schematron validation</p>
  121. <div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the validation context</td></tr><tr><td><span class="term"><i><tt>msg</tt></i>:</span></td><td>the message</td></tr><tr><td><span class="term"><i><tt>...</tt></i>:</span></td><td>extra arguments</td></tr></tbody></table></div></div>
  122. <hr/>
  123. <div class="refsect2" lang="en"><h3><a name="xmlSchematronFree"/>xmlSchematronFree ()</h3><pre class="programlisting">void xmlSchematronFree (<a href="libxml2-schematron.html#xmlSchematronPtr">xmlSchematronPtr</a> schema)<br/>
  124. </pre><p>Deallocate a Schematron structure.</p>
  125. <div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>schema</tt></i>:</span></td><td>a schema structure</td></tr></tbody></table></div></div>
  126. <hr/>
  127. <div class="refsect2" lang="en"><h3><a name="xmlSchematronFreeParserCtxt"/>xmlSchematronFreeParserCtxt ()</h3><pre class="programlisting">void xmlSchematronFreeParserCtxt (<a href="libxml2-schematron.html#xmlSchematronParserCtxtPtr">xmlSchematronParserCtxtPtr</a> ctxt)<br/>
  128. </pre><p>Free the resources associated to the schema parser context</p>
  129. <div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the schema parser context</td></tr></tbody></table></div></div>
  130. <hr/>
  131. <div class="refsect2" lang="en"><h3><a name="xmlSchematronFreeValidCtxt"/>xmlSchematronFreeValidCtxt ()</h3><pre class="programlisting">void xmlSchematronFreeValidCtxt (<a href="libxml2-schematron.html#xmlSchematronValidCtxtPtr">xmlSchematronValidCtxtPtr</a> ctxt)<br/>
  132. </pre><p>Free the resources associated to the schema validation context</p>
  133. <div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the schema validation context</td></tr></tbody></table></div></div>
  134. <hr/>
  135. <div class="refsect2" lang="en"><h3><a name="xmlSchematronNewDocParserCtxt"/>xmlSchematronNewDocParserCtxt ()</h3><pre class="programlisting"><a href="libxml2-schematron.html#xmlSchematronParserCtxtPtr">xmlSchematronParserCtxtPtr</a> xmlSchematronNewDocParserCtxt (<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc)<br/>
  136. </pre><p>Create an XML Schematrons parse context for that document. NB. The document may be modified during the parsing process.</p>
  137. <div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>doc</tt></i>:</span></td><td>a preparsed document tree</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the parser context or NULL in case of error</td></tr></tbody></table></div></div>
  138. <hr/>
  139. <div class="refsect2" lang="en"><h3><a name="xmlSchematronNewMemParserCtxt"/>xmlSchematronNewMemParserCtxt ()</h3><pre class="programlisting"><a href="libxml2-schematron.html#xmlSchematronParserCtxtPtr">xmlSchematronParserCtxtPtr</a> xmlSchematronNewMemParserCtxt (const char * buffer, <br/> int size)<br/>
  140. </pre><p>Create an XML Schematrons parse context for that memory buffer expected to contain an XML Schematrons file.</p>
  141. <div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>buffer</tt></i>:</span></td><td>a pointer to a char array containing the schemas</td></tr><tr><td><span class="term"><i><tt>size</tt></i>:</span></td><td>the size of the array</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the parser context or NULL in case of error</td></tr></tbody></table></div></div>
  142. <hr/>
  143. <div class="refsect2" lang="en"><h3><a name="xmlSchematronNewParserCtxt"/>xmlSchematronNewParserCtxt ()</h3><pre class="programlisting"><a href="libxml2-schematron.html#xmlSchematronParserCtxtPtr">xmlSchematronParserCtxtPtr</a> xmlSchematronNewParserCtxt (const char * URL)<br/>
  144. </pre><p>Create an XML Schematrons parse context for that file/resource expected to contain an XML Schematrons file.</p>
  145. <div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>URL</tt></i>:</span></td><td>the location of the schema</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the parser context or NULL in case of error</td></tr></tbody></table></div></div>
  146. <hr/>
  147. <div class="refsect2" lang="en"><h3><a name="xmlSchematronNewValidCtxt"/>xmlSchematronNewValidCtxt ()</h3><pre class="programlisting"><a href="libxml2-schematron.html#xmlSchematronValidCtxtPtr">xmlSchematronValidCtxtPtr</a> xmlSchematronNewValidCtxt (<a href="libxml2-schematron.html#xmlSchematronPtr">xmlSchematronPtr</a> schema, <br/> int options)<br/>
  148. </pre><p>Create an XML Schematrons validation context based on the given schema.</p>
  149. <div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>schema</tt></i>:</span></td><td>a precompiled XML Schematrons</td></tr><tr><td><span class="term"><i><tt>options</tt></i>:</span></td><td>a set of <a href="libxml2-schematron.html#xmlSchematronValidOptions">xmlSchematronValidOptions</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the validation context or NULL in case of error</td></tr></tbody></table></div></div>
  150. <hr/>
  151. <div class="refsect2" lang="en"><h3><a name="xmlSchematronParse"/>xmlSchematronParse ()</h3><pre class="programlisting"><a href="libxml2-schematron.html#xmlSchematronPtr">xmlSchematronPtr</a> xmlSchematronParse (<a href="libxml2-schematron.html#xmlSchematronParserCtxtPtr">xmlSchematronParserCtxtPtr</a> ctxt)<br/>
  152. </pre><p>parse a schema definition resource and build an internal XML Shema struture which can be used to validate instances.</p>
  153. <div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>a schema validation context</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the internal XML Schematron structure built from the resource or NULL in case of error</td></tr></tbody></table></div></div>
  154. <hr/>
  155. <div class="refsect2" lang="en"><h3><a name="xmlSchematronSetValidStructuredErrors"/>xmlSchematronSetValidStructuredErrors ()</h3><pre class="programlisting">void xmlSchematronSetValidStructuredErrors (<a href="libxml2-schematron.html#xmlSchematronValidCtxtPtr">xmlSchematronValidCtxtPtr</a> ctxt, <br/> <a href="libxml2-xmlerror.html#xmlStructuredErrorFunc">xmlStructuredErrorFunc</a> serror, <br/> void * ctx)<br/>
  156. </pre><p>Set the structured error callback</p>
  157. <div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>a Schematron validation context</td></tr><tr><td><span class="term"><i><tt>serror</tt></i>:</span></td><td>the structured error function</td></tr><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the functions context</td></tr></tbody></table></div></div>
  158. <hr/>
  159. <div class="refsect2" lang="en"><h3><a name="xmlSchematronValidateDoc"/>xmlSchematronValidateDoc ()</h3><pre class="programlisting">int xmlSchematronValidateDoc (<a href="libxml2-schematron.html#xmlSchematronValidCtxtPtr">xmlSchematronValidCtxtPtr</a> ctxt, <br/> <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> instance)<br/>
  160. </pre><p>Validate a tree instance against the schematron</p>
  161. <div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the schema validation context</td></tr><tr><td><span class="term"><i><tt>instance</tt></i>:</span></td><td>the document instace tree</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 in case of internal error and an error count otherwise.</td></tr></tbody></table></div></div>
  162. <hr/>
  163. </div>
  164. </div>
  165. </body>
  166. </html>