|
1 |
| -The [validator.nu][1] and [validator.w3.org/nu][2] services are built from code |
2 |
| -hosted at [bitbucket.org/validator][3]. |
| 1 | +# How to use the vnu.jar validator |
3 | 2 |
|
4 |
| - [1]: http://validator.nu/ |
| 3 | +The `vnu.jar` validator is a packaged standalone version of the |
| 4 | +[validator.nu][1] code. The [latest version][2] is available from the [validator |
| 5 | +area at github][3]. The following are instructions on how to use it to validate |
| 6 | +documents. |
5 | 7 |
|
6 |
| - [2]: http://validator.w3.org/nu/ |
| 8 | + [1]: http://about.validator.nu/ |
7 | 9 |
|
8 |
| - [3]: https://bitbucket.org/validator/ |
| 10 | + [2]: https://github.com/validator/validator.github.io/releases |
9 | 11 |
|
10 |
| -Here at [github.com/validator][4], there are read-only mirrors of those |
11 |
| -bitbucket sources, as well as: |
| 12 | + [3]: https://github.com/validator/validator.github.io/ |
12 | 13 |
|
13 |
| - [4]: https://github.com/validator/ |
| 14 | +Command-line: usage · options | Web-based: usage · client · options |
14 | 15 |
|
15 |
| - * some [related HTML5 and XHTML5 schemas][5] |
| 16 | +## Command-line usage |
16 | 17 |
|
17 |
| - * some [jar files][6] |
| 18 | +You can use the `vnu.jar` validator as an executable for command-line validation |
| 19 | +of HTML documents by invoking it like this: |
18 | 20 |
|
19 |
| - * a [validation how-to][7] that explains various ways to do validation of |
20 |
| -HTML5 and XHTML5 documents |
| 21 | + java -jar vnu.jar [--html] [--entities] [--schema URL] |
21 | 22 |
|
22 |
| - [5]: http://validator.github.com/schemas |
| 23 | + [--format gnu|xml|json|text] [--verbose] [--version] FILES |
23 | 24 |
|
24 |
| - [6]: http://validator.github.com/jars |
| 25 | +To validate one or more documents from the command line: |
25 | 26 |
|
26 |
| - [7]: http://validator.github.com/how-to.html |
| 27 | + java -jar vnu.jar FILE.html FILE2.html FILE3.HTML FILE4.html... |
| 28 | + |
| 29 | +To validate all HTML documents in a particular directory: |
| 30 | + |
| 31 | + java -jar vnu.jar some-directory-name/ |
| 32 | + |
| 33 | +To validate a Web document: |
| 34 | + |
| 35 | + java -jar vnu.jar http://example.com/foo |
| 36 | + |
| 37 | +### Command-line options |
| 38 | + |
| 39 | +When used from the command line as described in this section, the `vnu.jar` |
| 40 | +executable provides the following options: |
| 41 | + |
| 42 | +#### --entities |
| 43 | + |
| 44 | + Specifies that the XML parser must not load remote/external entities (such |
| 45 | + |
| 46 | + as DTDs) from the Internet. |
| 47 | + |
| 48 | + default: [unset; the XML parser will attempt to load external entities] |
| 49 | + |
| 50 | +#### --format format |
| 51 | + |
| 52 | + Specifies the output format for validation results. |
| 53 | + |
| 54 | + default: "gnu" |
| 55 | + |
| 56 | + possible values: "gnu", "xml", "json", "text" |
| 57 | + |
| 58 | + see also: |
| 59 | +[http://wiki.whatwg.org/wiki/Validator.nu_Common_Input_Parameters#out][4] |
| 60 | + |
| 61 | + [4]: http://wiki.whatwg.org/wiki/Validator.nu_Common_Input_Parameters#out |
| 62 | + |
| 63 | +#### --html |
| 64 | + |
| 65 | + Specifies that all documents must be parsed by the HTML parser as text/html |
| 66 | + |
| 67 | + (otherwise, *.xhtml documents are parsed by the XML parser). |
| 68 | + |
| 69 | + default: [unset; *.xhtml documents are parsed by the XML parser] |
| 70 | + |
| 71 | +#### --schema URL |
| 72 | + |
| 73 | + Specifies a URL for a known http://s.validator.nu/* schema to use for |
| 74 | + |
| 75 | + document validation. |
| 76 | + |
| 77 | + default: http://s.validator.nu/html5-all.rnc |
| 78 | + |
| 79 | +#### --verbose |
| 80 | + |
| 81 | + Specifies that the validator output should be "verbose". Currently this |
| 82 | + |
| 83 | + just means that the names of files being validated are written to stdout. |
| 84 | + |
| 85 | + default: [unset; output is not verbose] |
| 86 | + |
| 87 | +#### --version |
| 88 | + |
| 89 | + Shows validator version number. |
| 90 | + |
| 91 | +## Web-based usage |
| 92 | + |
| 93 | +The `vnu.jar` validator provides a way for you to validate HTML documents over |
| 94 | +the Web, in a Web browser, as an HTTP service—just as with |
| 95 | +[http://html5.validator.nu/][5] and [http://validator.w3.org/nu/][6]. |
| 96 | + |
| 97 | + [5]: http://html5.validator.nu/ |
| 98 | + |
| 99 | + [6]: http://validator.w3.org/nu/ |
| 100 | + |
| 101 | +To run the validator as an HTTP service, open a new terminal window and invoke |
| 102 | +`vnu.jar` like this: |
| 103 | + |
| 104 | + java -cp vnu.jar nu.validator.servlet.Main 8888 |
| 105 | + |
| 106 | +Then open [http://localhost:8888][7] in a browser. (To have the validator listen |
| 107 | +on a different port, replace `8888` with the port number.) |
| 108 | + |
| 109 | + [7]: http://localhost:8888 |
| 110 | + |
| 111 | +You’ll see a form similar to [http://validator.w3.org/nu/][8] that allows you to |
| 112 | +type in the URL of an HTML document and have the validation results for that |
| 113 | +document displayed in the browser. |
| 114 | + |
| 115 | + [8]: http://validator.w3.org/nu/ |
| 116 | + |
| 117 | +## HTTP client (for fast command-line validation) |
| 118 | + |
| 119 | +You can also use `vnu.jar` from the command line to send HTML documents to a |
| 120 | +locally-running instance of the HTTP service for validation. To validate |
| 121 | +documents in that way, do this: |
| 122 | + |
| 123 | + 1. Open a new terminal window and start up the validator as an HTTP service, |
| 124 | +as described in the Web-based usage section. |
| 125 | + |
| 126 | + 2. Open a second new terminal window and invoke `vnu.jar` like this: |
| 127 | + |
| 128 | + java -cp vnu.jar nu.validator.client.HttpClient FILE.html... |
| 129 | + |
| 130 | +### HTTP client options |
| 131 | + |
| 132 | +When using the `vnu.jar` for sending documents to a locally-running instance of |
| 133 | +the validator HTTP service for validation, you can set Java system properties to |
| 134 | +control configuration options for the validation behavior. |
| 135 | + |
| 136 | +For example, you can suppress warning-level validation messages and only show |
| 137 | +error-level ones by setting the value of the `nu.validator.client.level` system |
| 138 | +property to `error`, like this: |
| 139 | + |
| 140 | + java -Dnu.validator.client.level=error\ |
| 141 | + |
| 142 | + -cp vnu.jar nu.validator.client.HttpClient FILE.html... |
| 143 | + |
| 144 | +Most of the properties listed below map to the validator.nu common input |
| 145 | +parameters documented at |
| 146 | +[http://wiki.whatwg.org/wiki/Validator.nu_Common_Input_Parameters][9]. |
| 147 | + |
| 148 | + [9]: http://wiki.whatwg.org/wiki/Validator.nu_Common_Input_Parameters |
| 149 | + |
| 150 | +#### nu.validator.client.host |
| 151 | + |
| 152 | + Specifies the hostname of the validator for the client to connect to. |
| 153 | + |
| 154 | + default: "127.0.0.1" |
| 155 | + |
| 156 | +#### nu.validator.client.port |
| 157 | + |
| 158 | + Specifies the hostname of the validator for the client to connect to. |
| 159 | + |
| 160 | + default: "8888" |
| 161 | + |
| 162 | + example: java -Dnu.validator.client.port=8080 -jar vnu.jar FILE.html |
| 163 | + |
| 164 | +#### nu.validator.client.level |
| 165 | + |
| 166 | + Specifies the severity level of validation messages to report; to |
| 167 | + |
| 168 | + suppress warning-level messages, and only show error-level ones, set |
| 169 | + |
| 170 | + this property to "error". |
| 171 | + |
| 172 | + default: [unset] |
| 173 | + |
| 174 | + possible values: "error" |
| 175 | + |
| 176 | + example: java -Dnu.validator.client.level=error -jar vnu.jar FILE.html |
| 177 | + |
| 178 | +#### nu.validator.client.parser |
| 179 | + |
| 180 | + Specifies which parser to use. |
| 181 | + |
| 182 | + default: "html"; or, for *.xhtml input files, "xml" |
| 183 | + |
| 184 | + possible values: see |
| 185 | +[http://wiki.whatwg.org/wiki/Validator.nu_Common_Input_Parameters#parser][10] |
| 186 | + |
| 187 | + [10]: http://wiki.whatwg.org/wiki/Validator.nu_Common_Input_Parameters#parser |
| 188 | + |
| 189 | +#### nu.validator.client.charset |
| 190 | + |
| 191 | + Specifies the encoding of the input document. |
| 192 | + |
| 193 | + default: [unset] |
| 194 | + |
| 195 | +#### nu.validator.client.content-type |
| 196 | + |
| 197 | + Specifies the content-type of the input document. |
| 198 | + |
| 199 | + default: "text/html"; or, for *.xhtml files, "application/xhtml+xml" |
| 200 | + |
| 201 | +#### nu.validator.client.out |
| 202 | + |
| 203 | + Specifies the output format for validation messages. |
| 204 | + |
| 205 | + default: "gnu" |
| 206 | + |
| 207 | + possible values: see |
| 208 | +[http://wiki.whatwg.org/wiki/Validator.nu_Common_Input_Parameters#out][11] |
| 209 | + |
| 210 | + [11]: http://wiki.whatwg.org/wiki/Validator.nu_Common_Input_Parameters#out |
| 211 | + |
| 212 | +#### nu.validator.client.asciiquotes |
| 213 | + |
| 214 | + Specifies whether ASCII quotation marks are substituted for Unicode |
| 215 | + |
| 216 | + smart quotation marks in validation messages. |
| 217 | + |
| 218 | + default: "yes" |
| 219 | + |
| 220 | + possible values: "yes" or "no" |
| 221 | + |
| 222 | +For more information... sources bugz etc. |
27 | 223 |
|
0 commit comments