-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathcommandline.html
226 lines (207 loc) · 9.54 KB
/
commandline.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<!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 MSV 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>Multi-Schema XML Validator (MSV)</h1>
</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 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 > z > 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><anyOtherAttribute></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>