Sophie

Sophie

distrib > Fedora > 14 > i386 > by-pkgid > 7f7c01e85ae5bab3fb1deda72d3a9c7a > files > 13

msv-manual-2009.1-3.fc14.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="CONTENT-TYPE" content="text/html; charset=iso-8859-1">
	<title>Usage Guide For Sun Multi-Schema Validator</title>
<style type="text/css">
<!--
pre {  background-color: #eeeeee; color: #000099}
code {  color: #000099}
h1 {  color: #000099}
h2 {  color: #000099; font-style: italic}
h3 {  font-style: italic; color: #000099; text-decoration: underline}
h4 {  font-style: italic; color: #000099}
-->
</style>
</head>
<body bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#dddddd">
   <tr>
      <td align="center" valign="middle">
         <table width="100%" border="1" cellspacing="3" cellpadding="3">
            <tr>
               <td valign="top" bgcolor="#FFFFFF">
                  <h1>Sun Multi-Schema XML Validator</h1>
               </td>
               <td rowspan="2" align="center" valign="middle" bgcolor="#dddddd">
                  <p><strong>version @@VERSION@@</strong></p>
                  <p><a href="mailto:kohsuke.kawaguchi@eng.sun.com"><strong>Kohsuke KAWAGUCHI</strong></a></p>
               </td>
               <td rowspan="2" align="right" valign="middle" bgcolor="#FFFFFF" nowrap><small><em>Copyright &copy; 2001-@@YEAR@@</em></small><br>
      <small><em>Sun Microsystems, Inc.</em></small><br>
      <small><em>All Rights Reserved</em></small></td>
            </tr>
            <tr>
               <td align="left" valign="top" bgcolor="#FFFFFF">
                  <h2><em>Command Line Usage Guide</em></h2>
               </td>
            </tr>
         </table>
      </td>
   </tr>
</table>
<blockquote>
<p>The Sun Multi-Schema Validator(MSV) is  a Java<small><sup>TM</sup></small> technology tool to validate XML documents against a variety of XML schemata. It supports RELAX Namespace, RELAX Core, RELAX NG, TREX, XML DTDs, and a subset of W3C XML Schema Part 1.</p>
</blockquote>

<h2>Usage</h2>

<blockquote>
<p>To validate XML documents with a RELAX grammar/module, enter a command of the following form:</p>

<hr>
<table border="0" cellspacing="5" cellpadding="5" bgcolor="#eeeeee">
	<tr>
		<td bgcolor="#eeeeee">
<pre>$ java -jar msv.jar MySchema.rxg MyDocument1.xml MyDocument2.xml ...</pre>
		</td>
	</tr>
</table>
<hr>
<p>If you'd like to use TREX, enter a command of the form:</p>
<hr>
<table border="0" cellspacing="5" cellpadding="5" bgcolor="#eeeeee">
	<tr>
		<td bgcolor="#eeeeee">
<pre>$ java -jar msv.jar MySchema.trex MyDocument1.xml MyDocument2.xml ...</pre>
		</td>
	</tr>
</table>
<hr>
<p>Or if you'd like to use W3C XML Schema, enter the command:</p>
<hr>
<table border="0" cellspacing="5" cellpadding="5" bgcolor="#eeeeee">
	<tr>
		<td bgcolor="#eeeeee">
<pre>$ java -jar msv.jar MySchema.xsd MyDocument1.xml MyDocument2.xml ...</pre>
		</td>
	</tr>
</table>
<hr>
<p>MSV will detect the schema language regardless of its file extension if the schema is written in XML syntax.</p>
<p>However, DTD is only one exception. MSV relies on the file extension ".dtd" to detect XML DTDs. That means you have to have the ".dtd" extension for your DTDs. To validate XMLs with a DTD, enter the command:</p>
<hr>
<table border="0" cellspacing="5" cellpadding="5" bgcolor="#eeeeee">
	<tr>
		<td bgcolor="#eeeeee">
<pre>$ java -jar msv.jar my.dtd MyDocument1.xml MyDocument2.xml ...</pre>
		</td>
	</tr>
</table>
<hr>
<p>Some environments support wild cards for filenames, while others (e.g., "jview" VM from Microsoft) don't. You can also use a URL instead of a filename.</p>
<p>If the schema contains errors, you will see messages like this.</p>
<hr>
<table border="0" cellspacing="5" cellpadding="5" bgcolor="#eeeeee">
	<tr>
		<td bgcolor="#eeeeee">
<pre>
start parsing a grammar.
the following hedgeRules form an infinite recursion ( y &gt; z &gt; y )
  18:23@file:///c:/work/relax/relax024.e.rlx
  14:23@file:///c:/work/relax/relax024.e.rlx
failed to load a grammar.
</pre>
		</td>
	</tr>
</table>
<hr>
<p><code>18:23@XYZ</code> indicates that the error is located at line 18, column 23 of file XYZ.</p>
<p>If the document and the schema are both valid, you will see messages like this:</p>
<hr>
<table border="0" cellspacing="5" cellpadding="5" bgcolor="#eeeeee">
	<tr>
		<td bgcolor="#eeeeee">
<pre>
start parsing a grammar.
validating c:\work\relax\relax001.v00.xml
the document is valid.
</pre>
		</td>
	</tr>
</table>
<hr>
<p>If the schema is valid but the document has errors, you will see messages like this:</p>
<hr>
<table border="0" cellspacing="5" cellpadding="5" bgcolor="#eeeeee">
	<tr>
		<td bgcolor="#eeeeee">
<pre>
start parsing a grammar.
validating c:\work\relax\relax001.n02.xml
Error at line:5, column:5 of file:///c:/work/relax/relax001.n02.xml
  tag name "q" is not allowed. possible tag names are:

the document is NOT valid.
</pre>
		</td>
	</tr>
</table>
<hr>
<p>Please note that line/column infomation is sometimes inaccurate, and one tab char is counted as one character, not 4 or 8. So you might want to look around to find the actual error.</p>
</blockquote>

<h2>Options</h2>
<blockquote>
<p>The command line tool has several other options. You can see the list of available options by invoking MSV without any arguments.</p>
<hr>
<table border="0" cellspacing="5" cellpadding="5" bgcolor="#eeeeee">
	<tr>
		<td bgcolor="#eeeeee">
<pre>$ java -jar msv.jar</pre>
		</td>
	</tr>
</table>
<hr>

<p>
	Here are some notable ones that require some explanations.
<dl>
	<dt>
		<code><b>-catalog</b></code>
	<dd>
		This option will enable the catalog support, which allows you to resolve external references to schemas/DTDs to your local copies. This can be used to avoid costly network operations to obtain a standard schema, for example.<br>
		To use this option, you have to download <code>resolver.jar</code> from <a href="http://xml.apache.org/commons/">http://xml.apache.org/commons/</a> and place it in the same directory as <code>msv.jar</code> (or make it somehow available to the classpath.)<br>
		For detailed instruction regarding how to use/configure catalogs, refer to <a href="http://wwws.sun.com/software/xml/developers/resolver/article/">the documentation of the entity resolver</a>.
			
</dl>
</blockquote>

<h2>Known Limitations</h2>

<h3>DTD</h3>
<blockquote>
<ol>
	<li><p>Attribute declarations of the form of <code>xmlns:***</code> are ignored. All namespace declarations within the instance document are also ignored.</p></li>
	<li><p>The detection of XML DTD is based on the file extension. This causes a problem when you are using MSV through JARV or <code>GrammarLoader</code>. For details, see <a href="JARV.html#dtddetect">this</a>.
	</p></li>
	<li><p>In general, MSV handles XML namespaces differently from most DTD validators. As a result, MSV may validate documents that other DTD validators reject. When this is the case, MSV always issues a warning.</p></li>
	<li><p>Strictly speaking, MSV cannot replace XML parser's DTD validation because DTD validation affects lot of other things. For example, DTD validation in XML parser can expand entity references and provides default attribute values; DTD validation by MSV doesn't do those things.
</ol>
</blockquote>

<h3>TREX</h3>
<blockquote>
<p>This implementation fully conforms to the <a href="http://thaiopensource.com/trex/spec.html">current specification (2001-02-13 version).</a> </p>
</blockquote>

<h3>RELAX NG</h3>
<blockquote>
<p>This implementation is intended to almost fully implement the spec (Aug,11,2001 version) except the followings:</p>
<ul>
	<li><p>recursive self reference check is performed after <code>notAllowed</code> is expanded. Therefore MSV fails to catch some of the error. (section 4.18 of the spec.)</p></li>
</ul>

<p>
	MSV supports <a href="http://www.oasis-open.org/committees/relax-ng/compatibility-20010907.html">RELAX NG DTD Compatibility Spec (2001/09/07)</a>. MSV implements all three features and all of them conform to level 1 (everything except infoset modification.)
</p>

<p>
	MSV supports
	<a href="http://sourceforge.net/projects/relaxng">
	a vendor-independent Java interface for RELAX NG datatype libraries</a>.
	
	MSV can work with any datatype library that implements this interface. For more information, see <a href="RNGDatatypeLibrary.html">RNGDatatypeLibrary.html</a>.
</p>
</blockquote>

<h3>RELAX Core</h3>
<blockquote>
<p>This implementation fully conforms to the current JIS TR specification. (<a href="http://www.egroups.co.jp/files/reldeve/JISTRtranslation.pdf"> English </a>, <a href="http://www.y-adagio.com/public/standards/tr_relax_c/toc.htm"> Japanese </a>) </p>
</blockquote>

<h3>RELAX Namespace</h3>

<blockquote>
<p><code>&lt;anyOtherAttribute&gt;</code> is not implemented.</p>
</blockquote>

<h3>W3C XML Schema Part 1</h3>
<blockquote>
<ol>
	<li><p><a href="http://www.w3.org/TR/xmlschema-1/#concepts-schemaConstraints"> "Schema component constraints" and "Schema representation constraints" </a> are not fully enforced. In other words, MSV may accept schemas that are rejected by other conforming processors.</p><p>Unimplemented checks include (but not limited to) <a href="http://www.w3.org/TR/xmlschema-1/#cos-nonambig">"UPA constraint"</a> and <a href="http://www.w3.org/TR/xmlschema-1/#cos-particle-restrict">"Particle Valid Restriction"</a></li>
	<li><p><a href="http://www.w3.org/TR/xmlschema-1/#conformance-missing"> "Missing sub-components" </a> are treated as immediate errors. This behavior better serves the majority of users.</p></li>
	<li><p>Default values are ignored. In fact, no infoset contribution is supported: MSV validates documents, but it doesn't augment them. Post Schema-Validation Infoset (PSVI) is also not supported.</p></li>
</ol>
</blockquote>

<h2>Further Reading</h2>
<blockquote>
<p>To learn RELAX, <a href="http://www.xml.gr.jp/relax/">"How to RELAX"</a> is a good starter. To learn TREX, there is the <a href="http://thaiopensource.com/trex/tutorial.html">"TREX tutorial"</a>. RELAX NG also has its own <a href="http://www.oasis-open.org/committees/relax-ng/tutorial.html">tutorial</a>. For W3C XML Schema Part 2, see <a href="http://www.w3.org/TR/2001/PR-xmlschema-0-20010316/#CreatDt">section 2.3 of XML Schema Part 0: Primer</a>.</p>
</blockquote>
</body>
</html>