-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathREADME.html
413 lines (380 loc) · 14.9 KB
/
README.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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
<?xml version="1.0" encoding="windows-1252"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<title>XmlValidate</title>
<style type="text/css">
<!--
body.main { background: #445569; color: #242A35 }
div.author { width: 30%; margin-left: 70% }
div.header { height: 100px; width: 90%; background: #989990; margin: 0 auto; margin-top: 25px; border: 1px solid #242A35 }
div.hidden { visibility: hidden }
div.main { height: 90%; width: 90%; background: #E0E0E0; margin: 0 auto; padding-top: 15px; margin-bottom: 25px; border: 1px solid #242A35 }
dl.probs { margin-left: 16px; margin-right: 16px }
dl.probs dt { margin-top: .25em }
dl.probs dd br { margin-top: .25em }
h1 { text-align: center; vertical-align: middle; margin-top: 30px }
h2 { margin: 20px 10px 10px 10px; border: 1px solid #242A35; padding: 5px 10% 5px 5px; background: #B9BAAF }
h3 { margin: 1em 16px .5em 16px}
p.normal { margin: 5px 16px }
p.example { margin: .5em 5em }
table.cont { margin: 0 auto; margin-top: 15px; margin-bottom: 15px; border-collapse:collapse }
table.cont td { padding: 2px 5px }
table.ct { border: 1px solid #242A35; margin: 15px 16px; border-collapse:collapse; background: #D0D0D0 }
table.ct td { border: 1px solid #242A35; padding: 2px 5px; vertical-align: top }
table.ct td.type { text-align: center }
table.ct th { border: 1px solid #242A35; padding: 2px 5px; text-align: center }
table.ct tr.header { background: #989990 }
table.rel { border: 1px solid #242A35; margin: 0 auto; margin-top: 15px; margin-bottom: 15px; border-collapse:collapse; background: #D0D0D0 }
table.rel td { border: 1px solid #242A35; padding: 2px 5px }
table.rel td.version { text-align: center; vertical-align: top }
table.rel th { border: 1px solid #242A35; padding: 2px 5px; text-align: center }
table.rel tr.header { background: #989990 }
table.res { border: 1px solid #242A35; margin: 15px 16px; border-collapse:collapse; background: #D0D0D0 }
table.res td { border: 1px solid #242A35; padding: 2px 5px; vertical-align: top }
table.res td.type { text-align: center }
table.res td.value { text-align: center }
table.res td.write { text-align: center }
table.res th { border: 1px solid #242A35; padding: 2px 5px; text-align: center }
table.res tr.header { background: #989990 }
ul.changes { list-style-type: none; margin: 0px }
-->
</style>
</head>
<body class="main">
<div class="header">
<h1>XmlValidate</h1>
</div>
<div class="main">
<h2>Introduction</h2>
<p class="normal">
<em>XmlValidate</em> is a quick & flexible XML validator capable of performing bulk
validation of XML documents against <a href="http://www.w3.org/TR/xmlschema-0/" target="_blank">XML Schemas</a>
as defined in the XML documents or forcing another schema target.
</p>
<br/>
<p class="normal">
<em>XmlValidate</em> validates individual XML documents by filename or URL
or recursively searching directories with a list of target file
extensions. First documents are checked as being well-formed XML.
If parsing XML with non-validating parser fails then validation for that
file stops.
</p>
<br/>
<p class="normal">
Here are three ways to validate XML documents using <em>XmlValidate</em>:
</p>
<br/>
<ol>
<li>
<p class="normal">
The <em>-map</em> option maps schema namespaces to given target schema locations.
It rewrites XML with location of schema instance document then validates against
target schema. If schema namespace is not found then it does not validate
the document. This validates the document against the actual schema namespace
defined in the document as opposed to the other approaches that rewrite
the XML documents to any target schema.
</p>
<pre>
<strong>old:</strong> <kml xmlns="http://earth.google.com/kml/2.1">
<strong>new:</strong> <kml xmlns="http://earth.google.com/kml/2.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://earth.google.com/kml/2.1 file:/C:/xml/kml21.xsd">
</pre>
<p>Note if root element is "kml" and no namespace is specified then KML 2.0 namespace is used to validate document.</p>
</li>
<li>
<p class="normal">
Specifing a schema without a namespace implies <em>noNamespaceSchemaLocation</em>
attribute should be added to all XML documents and validate against that schema.
</p>
<pre>
<strong>no namespace schema:</strong>
<event xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="C:/cot/schema/Event.xsd">
</pre>
</li>
<li>
<p class="normal">
And finally specify <em>-ns</em> and <em>-schema</em> options to provide a target namespace URI
and schema location. All XML documents specified in search location(s)
will be rewritten and the target schemaLocation will be used regardless
of the default namespace of that document. So for example KML 2.1 documents
can be validated against the 2.2 schema, and vice versa.
</p>
<pre>
<strong>old:</strong> <kml xmlns="http://earth.google.com/kml/2.1">
<strong>new:</strong> <kml xmlns="http://www.opengis.net/kml/2.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/kml/2.2 file:/C:/xml/kml22.xsd">
</pre>
</li>
</ol>
<p class="normal">
Note that XML is reformatted so errors/warnings with line/column numbers are respect to
the reformatted content not the original so context is printed at that line/column number
after each error in order that errors can be tracked down and corrected in original
XML document. If you want the reformatted XML document printed then use <em>-dump</em> mode.
If the error is in the XML Schema not the instance document then the context will not be printed.
</p>
<h2>Contents</h2>
<p class="normal">This distribution contains the following files:
<table class="cont" summary="Distribution Contents">
<tr>
<td>README.html</td>
<td>This documentation file</td>
</tr>
<tr>
<td>ns.map</td>
<td>Namespace mapping file associated with provided schemas used with -map option</td>
</tr>
<tr>
<td>build.gradle</td>
<td>Gradle build file</td>
</tr>
</table>
</p>
<h2>Installation</h2>
<p class="normal">
This standalone Java application requires a <a href="http://java.sun.com/javase/downloads/index.jsp" target="_blank">Java Runtime Environment (JRE)</a> installation of version 1.6 or later.
</p>
<p class="normal">
<br/>
Type: ./gradlew clean test install
<br/>
Downloaded files (including the Gradle distribution itself) will be stored in the <a href="http://www.gradle.org">Gradle</a> user home directory (typically "<user_home>/.gradle").
</p>
<p class="normal">
<br/>
XmlValidate is pre-loaded with a number of common XML schemas (KML, GPX).
To install this application, copy the xmlValidate folder along with the batch files
[ bin/kml21.bat + bin/kml22.bat + bin/xv.bat ]. Next edit <em>ns.map</em> file to add new XML schemas to validate
other XML documents. XML Schemas can be added by URL, absolute path, or add to schemas folder and prefix schema with
${XV_HOME}.
</p>
<h2>Usage</h2>
<p class="normal">
<blockquote>
Usage: <em>XmlValidate</em> [options] [-map=file] | [-schema=file (-ns=uri)] <xml-document file, URL, or directory...>
</blockquote>
</p>
<p class="normal">
<Strong>Options:</Strong>
<table class="res">
<tr>
<td>-map=<schema-property-file></td><td> Schema map properties: namespace to file/URL mappings.<p/>
Note if root element is "kml" and no namespace is specified then KML 2.0 namespace is used.
</td></tr>
<tr>
<td>-schema=<path-to-xml-schema></td><td> Set target schema location (file path or URL).<p/>
If validating many XML documents recommend make local copies of XML Schemas and refer to the local
file name rather than having to fetch Schema by URL for each document.
</td></tr>
<tr>
<td>-schemaLocation=<namespace=location></td><td> Add explicit namespace with target schema location (file path or URL).<p/>
This will appear in the xsi:schemaLocation element if the target namespace is referenced in the XML document.
</td></tr>
<tr>
<td>-ns=<schemaLocation-namespace></td><td> Set namespace defined in <em>schemaLocation</em> attribute (e.g. http://earth.google.com/kml/2.1)<p/>
Without setting this the target schema is assumed to have no namespace and <em>noNamespaceSchemaLocation</em>
attribute is declared in XML instances.
</td></tr>
<tr>
<td>-dump[=n]</td><td>
Print reformatted XML documents based on dump level:<p/>
0: no output [default],<br/>
1: print KML on errors only,<br/>
2: print all inputs<p/>
If number not specified with <em>-dump</em> argument then 1 is assumed otherwise 0
if <em>-dump</em> argument is not used.<br/>
Note the line and column numbers in errors are with respect to these formatted XML documents.
</td></tr>
<tr>
<td>-maxdump=n</td><td>Set max length (in bytes) of XML output used for each document in dump.
</td></tr>
<tr>
<td>-K</td><td> KML mode for extra KML validation.
</td></tr>
<tr>
<td>-Z</td><td> KMZ mode checks and validates all kml files inside KMZ files.
Default mode only checks the first kml file.
</td></tr>
<tr>
<td>-kml</td><td> Validate .kml files only (default=xml)<p/> This overrides and replaces
the default XML target with KML when searching for files in directories.
</td></tr>
<tr>
<td>-kmz</td><td> Validate .kml and .kmz files only (default=xml)<p/> This overrides and replaces
the default XML target with KML amnd KMZ when searching for files in directories.
</td></tr>
<tr>
<td>-x=ExtensionList</td><td> Add additional file extensions to list (default=xml)<br/>
extensions separated by ':' (e.g. -x=gpx:x3d:svg)
</td></tr>
<tr>
<td>-S</td>
<td>Enable summary mode to only show the final total counts (default=false).<BR/>
This is helpful when validating large collection of files where output would be huge.
</td></tr>
<tr>
<td>Enable verbose mode (default=false).
<td>-v[=true]</td>
</td></tr>
<tr>
<td>-debug</td>
<td>Enable debug mode to print exception stack traces (default=false).</td>
</tr>
</table>
<Strong>Examples:</Strong>
</p>
<ol>
<li>
To check all .kml files against target KML 2.2 schema regardless of default schema used:
<blockquote>
<em>xv</em> -kml -schema=C:/pathToXsd/kml22.xsd -ns=http://www.opengis.net/kml/2.2 C:/pathToMyKmlFiles
</blockquote>
</li>
<li>
To check all CoT .xml files against CoT Schema:
<blockquote>
<em>xv</em> -schema=C:/pathToXsd/event.xsd C:/pathToData/cot.xml
</blockquote>
</li>
<li>
To check kml and kmz files against local schemas as defined in KML files:
<blockquote>
<em>xv</em> -map=ns.map C:/pathToMyKmlFiles
</blockquote>
</li>
<li>
Validate by URL for KML and target schema and print KML content<br/>
if any errors are found but limit size of each file printed to first 4K:
<blockquote>
<em>xv</em> -dump -maxDump=4096 -ns=http://earth.google.com/kml/2.1
-schema=http://code.google.com/apis/kml/schema/kml21.xsd
http://kml-samples.googlecode.com/svn/trunk/kml/kmz/simple/big.kmz
</blockquote>
</li>
<li>
Validate by XML document with explicit schema location<br/>
<blockquote>
<em>xv</em> -schemaLocation=http://myExtension=ext.xsd example.xml
</blockquote>
</li>
</ol>
<blockquote>
<Strong>Note:</Strong> <em>xv</em> command in examples above is a short-cut to the executable
command using java and XmlValidate.jar on the CLASSPATH or by using the equivalent batch file/shell script.
See xv.bat, kml21.bat, and kml22.bat for example usage.
</blockquote>
<h2>Release History</h2>
<p class="normal">
<table class="rel" summary="Release History">
<tr class="header">
<th>Version</th>
<th>Release date</th>
<th>Description</th>
</tr>
<tr class="entry">
<td class="version">1.0.2</td>
<td class="version">07/01/14</td>
<td><ul class="changes">
<li>Added KmzMode to allow validation of all .kml files inside KMZ files</li>
<li>Add -schemaLocation argument to add individual namespace-to-schema mappings</li>
<li>Update Xerces to 2.11.0</li>
<li>Update JDOM to 2.0.6</li>
</ul>
</td>
</tr>
<tr class="entry">
<td class="version">1.0.1</td>
<td class="version">11/14/13</td>
<td><ul class="changes">
<li>Migrate JDOM from 1.1.3 to 2.0.5</li>
</ul>
</td>
</tr>
<tr class="entry">
<td class="version">1.0.0</td>
<td class="version">04/27/12</td>
<td><ul class="changes">
<li>Public version with minor cleanup and gradle build</li>
</ul>
</td>
</tr>
<tr class="entry">
<td class="version">0.4.2</td>
<td class="version">03/23/11</td>
<td><ul class="changes">
<li>Added summary mode (-S) to suppress printing most details per file<BR>
and dump at end the summary with counts for each error/warning<BR>
including counts for given root element and default namespace.
</li>
</ul>
</td>
</tr>
<tr class="entry">
<td class="version">0.4.1</td>
<td class="version">08/23/10</td>
<td><ul class="changes">
<li>Added assignment of namespace locations to non-root elements in -map mode</li>
</ul>
</td>
</tr>
<tr class="entry">
<td class="version">0.4.0</td>
<td class="version">03/23/09</td>
<td><ul class="changes">
<li>Suppress printing error context for XML Schema errors as opposed
to validation errors in the target XML source.</li>
<li>Added -debug argument</li>
<li>Load all validation targets into list processing after all options are set</li>
<li>If target file does not exist then try to fetch as a URL.</li>
</ul>
</td>
</tr>
<tr class="entry">
<td class="version">0.3.0</td>
<td class="version">02/13/09</td>
<td><ul class="changes">
<li>Added additional namespace locations in schemaLocation if locations defined in map</li>
<li>Added -kml, -kmz and -x options to look for files other than .xml</li>
<li>Added support for KMZ files</li>
<li>Added support to validate URLs</li>
<li>Created README documentation</li>
</ul>
</td>
</tr>
<tr class="entry">
<td class="version">0.2.0</td>
<td class="version">02/01/09</td>
<td><ul class="changes">
<li>Added support for Schema namespaces</li>
<li>Added context in output for errors/warnings</li>
<li>Added -map option</li>
<li>Upgrade JDOM to 1.1</li>
<li>Upgrade Xerces to 2.9.1</li>
</ul>
</td>
</tr>
<tr>
<td class="version">0.1.0</td>
<td class="version">04/17/08</td>
<td><ul class="changes">
<li>Initial Beta release</li>
<li>Validates target XML documents against target nonSchemaLocation schemas (e.g. CoT)</li>
</ul>
</td>
</tr>
</table>
</p>
<div class="author">
<div class="vcard">
<div class="fn">Author: Jason Mathews</div>
<div class="org hidden">The MITRE Corporation</div>
</div>
</div>
</div>
</body>
</html>