server-php-xml-class-schematron-class-schematron.htm / htm
<html> <head> <title>Schematron (class_schematron.php)</title> <link rel="stylesheet" href="main.css" type="text/css"> </head> <body> <div align="center"> <table border="0" width="80%" cellpadding="0" cellspacing="0"> <tr> <td bgcolor="#aaaaee" class="text" align="center"><a href="http://phpxmlclasses.sourceforge.net/">PHP XML Classes</a></td> </tr> </table> <table border="0" width="80%" cellpadding="0" cellspacing="0"> <tr> <td bgcolor="#aaaaee" class="textblbl" align="center">Schematron (class_schematron.php)</td> </tr> </table> <br/> <table border="0" width="80%"> <tr> <td bgcolor="#eeeeff" class="text">Description: This class implements the <a href="http://www.ascc.net/xml/resource/schematron/schematron.html">Schematron 1.5</a> language for XML validation. Schematron scripts can be used directly from XML or pre-compiled into an XSLT stylesheet for later usage. XML files to be validated can be read from disk files or php strings. </td> </tr> </table> <br/> <table border="0" bgcolor="ddddff" width="80%"> <tr> <td valign="top" class="text" width="50%"><b>NEWS:</b> <ul> <li> 05-15-02 First version of this class released. </ul> </td> <td valign="top" width="50%" class="text"> This class code as well as the documentation are hosted at <a href="http://www.sourceforge.net">SourceForge</a> please visit our <a href="http://phpxmlclasses.sourceforge.net/">SourceForge page</a> for releases, documentation, bug-tracking, support forums and mailing lists. </td> </tr> </table> <br/> <table border="0" width="80%" cellpadding="0" cellspacing="0"> <tr> <td class="textbl" bgcolor="aaaaee" width="50%">Resources</td> <td class="textbl" bgcolor="aaaaee" width="50%">Requirements</td> </tr> </table> <table border="1" width="80%" cellpadding="0" cellspacing="0"> <tr> <td valign="top" bgcolor="eeeeff" class="text" width="50%"> <ul> <li><a class="textbl" href="http://www.sourceforge.net/projects/phpxmlclasses">Downloads</a> <li><a class="textbl" href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/phpxmlclasses/schematron/">Browse CVS</a> <li><a class="textbl" href="http://sourceforge.net/tracker/?atid=470965&group_id=53613&func=browse">Report Bugs</a> </ul> </td> <td valign="top" bgcolor="eeeeff" class="text" width="50%"> <ul> <li>PHP 4.0.5+ <li>XSLT extension (Sablotron) </ul> </td> </tr> </table> <br/> <table border="0" width="80%" cellpadding="0" cellspacing="0"> <tr> <td class="textbl" bgcolor="aaaaee" width="50%">Features</td> <td class="textbl" bgcolor="aaaaee" width="50%">To-dos</td> </tr> </table> <table border="1" width="80%" cellpadding="0" cellspacing="0"> <tr> <td valign="top" bgcolor="eeeeff" class="text" width="50%"> <ul> <li> XML files to be validated can be read from PHP strings or files <li> Schematron scripts can be read from files or PHP strings <li> Schematron scripts can be used compiled or uncompiled <li> The class caches schematron compilations in order to prevent a schematron script from being compiled twice. <li> The Schematron 1.5 XSLT implementation is "inlined" in the class, no aditional files are needed. </ul> </td> <td valign="top" bgcolor="ddddff" class="text" width="50%"> <ul> <li> </ul> </td> </tr> </table> <br/> <table border="0" bgcolor="ddddff" width="80%"> <tr> <!-- <td valign="top" class="text" width="50%"><b>To-do/future releases:</b> <ul> <li>Class <li>Class <li>Class </ul> </td> --> <td valign="top" width="100%" class="text"> Contact: </td> </tr> </table> <br/> <table border="0" bgcolor="ddddff" width="80%"> <tr> <!-- <td valign="top" class="text" width="50%"><b>To-do/future releases:</b> <ul> <li>Class <li>Class <li>Class </ul> </td> --> <td valign="top" width="100%" class="text"> Detailed description and usage:<br/> <b>Using the class:</b><br/><br/> <b>Initialization:</b><br/> <pre>include_once("class_schematron.php"); </pre><br/> <b>Compiling a Schematron script (optional):</b><br/> <pre>s->compile_schematron_from_file("validation_sample1.xml"); // You can get the compiled schematron as a string s->get_compiled("validation_sample1.xml"); // Or you can save it as a file </pre><br/> <b>Running an uncompiled schematron script from a file to validate an XML file:</b><br/> <pre>ret=</pre><br/> <b>Running an uncompiled schematron script from mem to validate an XML file:</b><br/> <pre>ret=schematron);</pre><br/> <b>Running an uncompiled schematron from a file to validate an XML document in memory:</b><br/> <pre>s->schematron_validate_mem_using_file(</pre><br/> <b>Running an uncompiled schematron from mem to validate an XML document in memory:</b></br> <pre>ret=xml,</pre><br/> <b>Running an compiled schematron script from a file to validate an XML file:</b><br/> <pre>ret=</pre><br/> <b>Running an compiled schematron script from mem to validate an XML file:</b><br/> <pre>ret=schematron);</pre><br/> <b>Running an compiled schematron from a file to validate an XML document in memory:</b><br/> <pre>s->schematron_validate_mem_using_compiled_file(</pre><br/> <b>Running an compiled schematron from mem to validate an XML document in memory:</b><br/> <pre>ret=xml,</pre><br/> <br/> <h3>Documentation</h3> </div> <h2>Classes</h2> <ul> <li><a href="#class21">class_schematron</a></li> </ul> <a name="class21"></a> <h3>class_schematron</h3> Extends: None
Description: This class implements the Schematron 1.5 language allowing to validate XML files from PHP using Schematron.
<br> <!-- METHOD SUMMARY --> <A NAME="pDomNode_method_summary"><!-- --></A> <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TD COLSPAN=2><FONT SIZE="+2"> <B>Method Summary</B></FONT></TD> </TR> <!-- A ROW --> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="#class21method1">Schematron</A></B>()</CODE> <BR> Constructor</TD> </TR> <!-- A ROW --> <!-- A ROW --> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> string</CODE></FONT></TD> <TD><CODE><B><A HREF="#class21method2">compile_schematron_from_file</A></B>(string filename)</CODE> <BR> Compiles a schematron file to XSLT</TD> </TR> <!-- A ROW --> <!-- A ROW --> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> string</CODE></FONT></TD> <TD><CODE><B><A HREF="#class21method3">compile_schematron_from_mem</A></B>(string xml_filename)</CODE> <BR> Returns the compiled XSLT stylesheet for a Schematron script</TD> </TR> <!-- A ROW --> <!-- A ROW --> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> boolean</CODE></FONT></TD> <TD><CODE><B><A HREF="#class21method5">save_compiled</A></B>(string filename)</CODE> <BR> Saves a previously compiled Schematron script to a file</TD> </TR> <!-- A ROW --> <!-- A ROW --> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> string</CODE></FONT></TD> <TD><CODE><B><A HREF="#class21method6">validate_mem_using_mem</A></B>(string validation_string)</CODE> <BR> Validates an XML string using a Schematron script from a string.</TD> </TR> <!-- A ROW --> <!-- A ROW --> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> string</CODE></FONT></TD> <TD><CODE><B><A HREF="#class21method7">validate_mem_using_file</A></B>(string validation_filename)</CODE> <BR> Validates an XML document in a string using a Schematron script from a file</TD> </TR> <!-- A ROW --> <!-- A ROW --> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> string</CODE></FONT></TD> <TD><CODE><B><A HREF="#class21method8">validate_file_using_mem</A></B>(string validation_string)</CODE> <BR> Validates an XML document in a file using a Schematron script from a PHP string</TD> </TR> <!-- A ROW --> <!-- A ROW --> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> string</CODE></FONT></TD> <TD><CODE><B><A HREF="#class21method9">validate_file_using_file</A></B>(string validation_filename)</CODE> <BR> Validates an XML document in a file using a Schematron script from a file</TD> </TR> <!-- A ROW --> <!-- A ROW --> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> string</CODE></FONT></TD> <TD><CODE><B><A HREF="#class21method10">validate_mem_using_compiled_mem</A></B>(string validation_string)</CODE> <BR> Validates an XML document held in a PHP string using a compiled Schematron scrip</TD> </TR> <!-- A ROW --> <!-- A ROW --> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> string</CODE></FONT></TD> <TD><CODE><B><A HREF="#class21method11">validate_mem_using_compiled_file</A></B>(string validation_filename)</CODE> <BR> Validates an XML document held in memory using a compiled Schematron script from</TD> </TR> <!-- A ROW --> <!-- A ROW --> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> string</CODE></FONT></TD> <TD><CODE><B><A HREF="#class21method12">validate_file_using_compiled_mem</A></B>(string validation_string)</CODE> <BR> Validates an XML documen in a file using a compiled Schematron script from a PHP</TD> </TR> <!-- A ROW --> <!-- A ROW --> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> string</CODE></FONT></TD> <TD><CODE><B><A HREF="#class21method13">validate_file_using_compiled_file</A></B>(string validation_filename)</CODE> <BR> Validates an XML document in a file using a compiled Schematron script in a file</TD> </TR> <!-- A ROW --> </TABLE> <P> <!-- METHOD SUMMARY --> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TD COLSPAN=1><FONT SIZE="+2"> <B>Method Detail</B></FONT></TD> </TR> </TABLE> <!-- method --> <A NAME="class21method1"><!-- --></A> <H3>Schematron</H3> <PRE> void <B>Schematron</B>(string validation_filename)</PRE> <DL> <DD>This is the class constructor
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.