-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathREADME.txt
152 lines (105 loc) · 4.54 KB
/
README.txt
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
XmlValidate is a quick & flexible XML validator capable of performing
bulk validation of XML documents against XML Schemas as defined
in the XML documents or forcing another schema target.
Setup
=====
From the command-line run gradle test command to build the project
and run the tests.
> gradle test
Several .bat files are provided to run XmlValidate with various
pre-defined options. These are located in the 'bin' directory.
To run these .bat files you must first run the following command:
> gradle install
This copies dependent .jar to build/libs folder which is used for the
classpath in each of the .bat files (e.g. bin/xv.bat).
To test installation of XmlValidate run the run.bat script
at the top-level of the distribution.
If the output matches the following then the jars, test data,
schemas, and batch files are in the correct locations.
== run.bat output ==
This test batch file shows several typical ways
to use XmlValidate with the sample XML data
located in data directory, schemas in schemas/,
and wrapper .bat files in /bin.
==========================================
Validate CoT XML document with non-namespace schema
> bin\xv -schema=schemas\Event.xsd -v data\cot.xml
Check: data\cot.xml
*OK*
Errors: 0 Warnings: 0 Files: 1 Time: 250 ms
Valid files 1/1 (100%)
==========================================
Validate all KML/KMZ documents against KML 2.1 Schema
> bin\kml21 -kmz data
Errors: 0 Warnings: 0 Files: 5 Time: 328 ms
Valid files 3/3 (100%)
Same as running the following:
> bin\xv -kmz -ns=http://earth.google.com/kml/2.1 -schema=schemas\kml21.xsd data
==========================================
Validate all GPX/KML/KMZ documents
> bin\xv.bat -v -kmz -x=gpx data/xml data/kml data/kmz
dir: data\xml
Check: data\xml\mystic_basin_trail.gpx
*OK*
dir: data\kml
Check: data\kml\data-ext-atom.kml
assign Namespace http://www.w3.org/2005/Atom -> file:/C:/projects/xmlValidate/temp/XmlValidate/schemas/atom.xsd
*OK*
Check: data\kml\earth-google-com-kml-21.kml
*OK*
Check: data\kml\earth-google-com-kml-22.kml
*OK*
Check: data\kml\no-namespace.kml
INFO: no root namespace
*OK*
Check: data\kml\nonkmlroot.kml
*OK*
Check: data\kml\placemark.kml
*OK*
Check: data\kml\tessellate-orig.kml
http://www.opengis.net/kml/2.2
ERROR: SAXParseException org.xml.sax.SAXParseException; lineNumber: 27; columnNumber: 13; cvc-complex-type.2.4.a: Invalid content was found starting with element 'tilt'. One of '{"http://www.opengis.net/kml/2.2":altitudeModeGroup, "http://www.opengis.net/kml/2.2":LookAtSimpleExtensionGroup, "http://www.opengis.net/kml/2.2":LookAtObjectExtensionGroup}' is expected.
Line: 27, column: 13
27: <tilt>***62.04855796276328</tilt>
Check: data\kml\tessellate21.kml
*OK*
Check: data\kml\tessellate22.kml
*OK*
dir: data\kmz
Check: data\kmz\big.kmz
*OK*
Check: data\kmz\nested.kmz
*OK*
Errors: 1 Warnings: 0 Files: 12 Time: 895 ms
Valid files 11/12 (92%)
Notice the tessellate-orig.kml example has the wrong namespace
and fails to validate against the specified schema namespace.
==========================================
Running
=======
Next run XmlValidate on your own XML documents using appropriate
.bat file (xv.bat, kml22.bat, etc.).
Run xv.bat on your favorite XML files by filename, directory, or URL.
Configuration
=============
The file ns.map provides the namespace and locations of the target
XML schemas intially populated with a set of common schemas
(e.g. KML, GPX). You can add additional XML Schemas to the ns.map
file as needed by URL or absolute file location.
For example if you wanted to validate the web.xml file deployed in a Java web
application WAR file assuming the web.xml file starts like this:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
...
Add this entry to your ns.map file to validate such files.
http://java.sun.com/xml/ns/javaee=http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd
If you want to make local copies of the XML Schemas then you can add them to
your XmlValidate/schemas directory as reference them like this:
http://java.sun.com/xml/ns/javaee=${XV_HOME}/schemas/web-app_2_5.xsd
or add any directory of your choosing and reference with an absolute path:
http://java.sun.com/xml/ns/javaee=C:/xml/schemas/web-app_2_5.xsd
If you want to make a one-time mapping to XML Schema or override the mappings then use
-schemaLocation command-line argument.
Example usage:
xv -schemaLocation=http://java.sun.com/xml/ns/javaee=C:/xml/schemas/web-app_2_5.xsd web.xml
--