MDT 2001 John Fleck | fd32de6 | 2001-10-27 20:14:01 +0000 | [diff] [blame] | 1 | <?xml version="1.0"?> |
| 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" |
| 3 | "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [ |
| 4 | ]> |
| 5 | <refentry> |
| 6 | <refentryinfo> |
| 7 | <title>xmllint Manual</title> |
| 8 | <copyright> |
| 9 | <year>2001</year> |
| 10 | </copyright> |
| 11 | <author> |
| 12 | <firstname>John</firstname> |
| 13 | <surname>Fleck</surname> |
| 14 | </author> |
| 15 | <address><email>jfleck@inkstain.net</email></address> |
| 16 | <author> |
| 17 | <firstname>Ziying</firstname> |
| 18 | <surname>Sherwin</surname> |
| 19 | </author> |
| 20 | <address><email>sherwin@nlm.nih.gov</email></address> |
MST 2001 John Fleck | 4230404 | 2001-11-18 00:18:06 +0000 | [diff] [blame] | 21 | <author> |
| 22 | <firstname>Heiko</firstname> |
| 23 | <surname>Rupp</surname> |
| 24 | </author> |
| 25 | <address><email>hwr@pilhuhn.de</email></address> |
MST 2001 John Fleck | 3fc555e | 2001-12-11 04:41:24 +0000 | [diff] [blame] | 26 | |
| 27 | <releaseinfo>This is release 0.2 of the xmllint Manual.</releaseinfo> |
MDT 2001 John Fleck | fd32de6 | 2001-10-27 20:14:01 +0000 | [diff] [blame] | 28 | </refentryinfo> |
| 29 | |
| 30 | <refmeta> |
| 31 | <refentrytitle>xmllint</refentrytitle> |
| 32 | <manvolnum>1</manvolnum> |
| 33 | </refmeta> |
| 34 | |
| 35 | <refnamediv> |
| 36 | <refname>xmllint</refname> |
| 37 | <refpurpose>command line <acronym>XML</acronym> tool</refpurpose> |
| 38 | </refnamediv> |
| 39 | |
| 40 | <refsynopsisdiv> |
| 41 | <cmdsynopsis> |
| 42 | <command>xmllint</command> |
| 43 | <group> |
| 44 | <arg>--version</arg> |
| 45 | <arg>--debug</arg> |
| 46 | <arg>--shell</arg> |
| 47 | <arg>--debugent</arg> |
| 48 | <arg>--copy</arg> |
| 49 | <arg>--recover</arg> |
| 50 | <arg>--noent</arg> |
| 51 | <arg>--noout</arg> |
| 52 | <arg>--htmlout</arg> |
| 53 | <arg>--nowrap</arg> |
| 54 | <arg>--valid</arg> |
| 55 | <arg>--postvalid</arg> |
| 56 | <arg>--dtdvalid <replaceable>URL</replaceable></arg> |
| 57 | <arg>--timing</arg> |
| 58 | <arg>--repeat</arg> |
| 59 | <arg>--insert</arg> |
| 60 | <arg>--compress</arg> |
John Fleck | 027edfb | 2001-11-04 20:13:58 +0000 | [diff] [blame] | 61 | <arg>--sgml</arg> |
MDT 2001 John Fleck | fd32de6 | 2001-10-27 20:14:01 +0000 | [diff] [blame] | 62 | <arg>--html</arg> |
| 63 | <arg>--push</arg> |
| 64 | <arg>--memory</arg> |
| 65 | <arg>--nowarning</arg> |
| 66 | <arg>--noblanks</arg> |
| 67 | <arg>--format</arg> |
| 68 | <arg>--testIO</arg> |
| 69 | <arg>--encode <replaceable>encoding</replaceable></arg> |
| 70 | <arg>--catalogs</arg> |
| 71 | <arg>--nocatalogs</arg> |
| 72 | <arg>--auto</arg> |
| 73 | <arg>--xinclude</arg> |
| 74 | <arg>--loaddtd</arg> |
| 75 | <arg>--dtdattr</arg> |
MST 2001 John Fleck | 2323ac2 | 2001-12-14 04:24:50 +0000 | [diff] [blame] | 76 | <arg>--dropdtd</arg> |
MST 2003 John Fleck | 7e54be1 | 2003-01-07 03:54:25 +0000 | [diff] [blame] | 77 | <arg>--stream</arg> |
| 78 | <arg>--chkregister</arg> |
MDT 2001 John Fleck | fd32de6 | 2001-10-27 20:14:01 +0000 | [diff] [blame] | 79 | </group> |
| 80 | <arg><option><replaceable>xmlfile</replaceable></option></arg> |
| 81 | </cmdsynopsis> |
| 82 | </refsynopsisdiv> |
| 83 | |
| 84 | <refsect1 id="introduction"> |
| 85 | <title>Introduction</title> |
| 86 | <para> |
| 87 | The xmllint program parses one or more XML files, specified on the |
| 88 | command line as <replaceable>xmlfile</replaceable>. It prints various |
| 89 | types of output, depending upon the options selected. It is useful for |
| 90 | detecting errors both in <acronym>XML</acronym> code and in the |
| 91 | <acronym>XML</acronym> parser itself. |
| 92 | </para> |
| 93 | |
| 94 | <para> |
| 95 | It is included in <application>libxml2</application>. |
| 96 | </para> |
| 97 | </refsect1> |
| 98 | <refsect1 id="options"> |
| 99 | <title>Options</title> |
| 100 | <variablelist> |
| 101 | <varlistentry> |
| 102 | <term><option>--version</option></term> |
| 103 | <listitem> |
| 104 | <simpara> |
| 105 | Display the version of |
| 106 | <application>libxml2</application> used. |
| 107 | </simpara> |
| 108 | </listitem> |
| 109 | </varlistentry> |
| 110 | |
| 111 | <varlistentry> |
| 112 | <term><option>--debug</option></term> |
| 113 | <listitem> |
| 114 | <simpara> |
| 115 | Parse a file and output an annotated tree of the |
| 116 | in-memory version of the document. |
| 117 | </simpara> |
| 118 | </listitem> |
| 119 | </varlistentry> |
| 120 | |
| 121 | <varlistentry> |
| 122 | <term><option>--shell</option></term> |
| 123 | <listitem> |
| 124 | <simpara> |
MST 2001 John Fleck | 4230404 | 2001-11-18 00:18:06 +0000 | [diff] [blame] | 125 | Run a navigating shell. Details on available commands in shell mode |
| 126 | are below. |
MDT 2001 John Fleck | fd32de6 | 2001-10-27 20:14:01 +0000 | [diff] [blame] | 127 | </simpara> |
| 128 | </listitem> |
| 129 | </varlistentry> |
| 130 | |
| 131 | <varlistentry> |
| 132 | <term><option>--debugent</option></term> |
| 133 | <listitem> |
| 134 | <simpara> |
| 135 | Debug the entities defined in the document. |
| 136 | </simpara> |
| 137 | </listitem> |
| 138 | </varlistentry> |
| 139 | |
| 140 | <varlistentry> |
| 141 | <term><option>--copy</option> </term> |
| 142 | <listitem> |
| 143 | <simpara> |
| 144 | Test the internal copy implementation. |
| 145 | </simpara> |
| 146 | </listitem> |
| 147 | </varlistentry> |
| 148 | |
| 149 | |
| 150 | <varlistentry> |
| 151 | <term><option>--recover</option></term> |
| 152 | <listitem> |
| 153 | <simpara> |
| 154 | Output any parsable portions of an invalid |
| 155 | document. |
| 156 | </simpara> |
| 157 | </listitem> |
| 158 | </varlistentry> |
| 159 | |
| 160 | <varlistentry> |
| 161 | <term><option>--noent</option></term> |
| 162 | <listitem> |
| 163 | <simpara> |
| 164 | Substitute entity values for entity |
| 165 | references. By default, <application>xmllint</application> leaves entity |
| 166 | references in place. |
| 167 | </simpara> |
| 168 | </listitem> |
| 169 | </varlistentry> |
| 170 | |
| 171 | <varlistentry> |
| 172 | <term><option>--noout</option></term> |
| 173 | <listitem> |
| 174 | <simpara> |
| 175 | Suppress output. By default, |
| 176 | <application>xmllint</application> outputs the result tree. |
| 177 | </simpara> |
| 178 | </listitem> |
| 179 | </varlistentry> |
| 180 | |
| 181 | <varlistentry> |
| 182 | <term><option>--htmlout</option></term> |
| 183 | <listitem> |
| 184 | <simpara> |
| 185 | Output results as an <acronym>HTML</acronym> |
| 186 | file. This causes <application>xmllint</application> to output |
| 187 | the necessary <acronym>HTML</acronym> tags surrounding the result tree |
| 188 | output so the results can be displayed in a browser. |
| 189 | </simpara> |
| 190 | </listitem> |
| 191 | </varlistentry> |
| 192 | |
| 193 | <varlistentry> |
| 194 | <term><option>--nowrap </option></term> |
| 195 | <listitem> |
| 196 | <simpara> |
| 197 | Do not output HTML doc wrapper. |
| 198 | </simpara> |
| 199 | </listitem> |
| 200 | </varlistentry> |
| 201 | |
| 202 | <varlistentry> |
| 203 | <term><option>--valid </option></term> |
| 204 | <listitem> |
| 205 | <simpara> |
| 206 | Determine if the document is a valid instance |
| 207 | of the included Document Type Definition (<acronym>DTD</acronym>). A |
| 208 | <acronym>DTD</acronym> to be validated against also can be specified at |
| 209 | the command line using the <option>--dtdvalid</option> option. By default, |
| 210 | <application>xmllint</application> also checks to determine if the |
| 211 | document is well-formed. |
| 212 | </simpara> |
| 213 | </listitem> |
| 214 | </varlistentry> |
| 215 | |
| 216 | <varlistentry> |
| 217 | <term><option>--postvalid</option></term> |
| 218 | <listitem> |
| 219 | <simpara> |
| 220 | Validate after parsing is completed. |
| 221 | </simpara> |
| 222 | </listitem> |
| 223 | </varlistentry> |
| 224 | |
| 225 | <varlistentry> |
| 226 | <term> <option>--dtdvalid</option> <replaceable>URL</replaceable></term> |
| 227 | <listitem> |
| 228 | <simpara> |
| 229 | Use the |
| 230 | <acronym>DTD</acronym> specified by <replaceable>URL</replaceable> for |
| 231 | validation. |
| 232 | </simpara> |
| 233 | </listitem> |
| 234 | </varlistentry> |
| 235 | |
| 236 | <varlistentry> |
| 237 | <term><option>--timing</option></term> |
| 238 | <listitem> |
| 239 | <simpara> |
| 240 | Output information about the time it takes |
| 241 | <application>xmllint</application> to perform the various steps. |
| 242 | </simpara> |
| 243 | </listitem> |
| 244 | </varlistentry> |
| 245 | |
| 246 | <varlistentry> |
| 247 | <term><option>--repeat</option></term> |
| 248 | <listitem> |
| 249 | <simpara> |
| 250 | Repeat 100 times, for timing or profiling. |
| 251 | </simpara> |
| 252 | </listitem> |
| 253 | </varlistentry> |
| 254 | |
| 255 | <varlistentry> |
| 256 | <term><option>--insert</option></term> |
| 257 | <listitem> |
| 258 | <simpara> |
| 259 | Test for valid insertions. |
| 260 | </simpara> |
| 261 | </listitem> |
| 262 | </varlistentry> |
| 263 | |
| 264 | <varlistentry> |
| 265 | <term><option>--compress</option></term> |
| 266 | <listitem> |
| 267 | <simpara> |
| 268 | Turn on gzip compression of output. |
| 269 | </simpara> |
| 270 | </listitem> |
| 271 | </varlistentry> |
| 272 | |
John Fleck | 027edfb | 2001-11-04 20:13:58 +0000 | [diff] [blame] | 273 | <varlistentry> |
| 274 | <term><option>--sgml</option></term> |
| 275 | <listitem> |
| 276 | <simpara>Use the DocBook <acronym>SGML</acronym> parser. This allows |
| 277 | documents written in <acronym>SGML</acronym> DocBook to be converted |
| 278 | into an in-memory tree and treated as if they were written in |
| 279 | <acronym>XML</acronym>.</simpara> |
| 280 | </listitem> |
| 281 | </varlistentry> |
| 282 | |
MDT 2001 John Fleck | fd32de6 | 2001-10-27 20:14:01 +0000 | [diff] [blame] | 283 | <varlistentry> |
| 284 | <term><option>--html</option></term> |
| 285 | <listitem> |
| 286 | <simpara> |
| 287 | Use the <acronym>HTML</acronym> parser. |
| 288 | </simpara> |
| 289 | </listitem> |
| 290 | </varlistentry> |
| 291 | |
| 292 | <varlistentry> |
| 293 | <term><option>--push</option></term> |
| 294 | <listitem> |
| 295 | <simpara> |
| 296 | Use the push mode of the parser. |
| 297 | </simpara> |
| 298 | </listitem> |
| 299 | </varlistentry> |
| 300 | |
| 301 | |
| 302 | <varlistentry> |
| 303 | <term><option>--memory</option></term> |
| 304 | <listitem> |
| 305 | <simpara> |
| 306 | Parse from memory. |
| 307 | </simpara> |
| 308 | </listitem> |
| 309 | </varlistentry> |
| 310 | |
| 311 | <varlistentry> |
| 312 | <term><option>--nowarning</option></term> |
| 313 | <listitem> |
| 314 | <simpara> |
| 315 | Do not emit warnings from the parser and/or validator. |
| 316 | </simpara> |
| 317 | </listitem> |
| 318 | </varlistentry> |
| 319 | |
| 320 | <varlistentry> |
| 321 | <term><option>--noblanks</option></term> |
| 322 | <listitem> |
| 323 | <simpara> |
| 324 | Drop ignorable blank spaces. |
| 325 | </simpara> |
| 326 | </listitem> |
| 327 | </varlistentry> |
| 328 | |
| 329 | <varlistentry> |
| 330 | <term><option>--format</option></term> |
| 331 | <listitem> |
| 332 | <simpara> |
| 333 | Reformat and reindent the output. |
| 334 | </simpara> |
| 335 | </listitem> |
| 336 | </varlistentry> |
| 337 | |
| 338 | <varlistentry> |
| 339 | <term><option>--testIO</option></term> |
| 340 | <listitem> |
| 341 | <simpara> |
| 342 | Test user input/output support. |
| 343 | </simpara> |
| 344 | </listitem> |
| 345 | </varlistentry> |
| 346 | |
| 347 | <varlistentry> |
| 348 | <term><option>--encode</option> <replaceable>encoding</replaceable></term> |
| 349 | <listitem> |
| 350 | <simpara> |
| 351 | Output in the given encoding. |
| 352 | </simpara> |
| 353 | </listitem> |
| 354 | </varlistentry> |
| 355 | |
| 356 | <varlistentry> |
| 357 | <term><option>--catalogs</option></term> |
| 358 | <listitem> |
| 359 | <simpara> |
| 360 | Use the catalogs from $SGML_CATALOG_FILES. Otherwise /etc/xml/catalog |
| 361 | is used by default. |
| 362 | </simpara> |
| 363 | </listitem> |
| 364 | </varlistentry> |
| 365 | |
| 366 | <varlistentry> |
| 367 | <term><option>--nocatalogs</option></term> |
| 368 | <listitem> |
| 369 | <simpara> |
| 370 | Do not use any catalogs. |
| 371 | </simpara> |
| 372 | </listitem> |
| 373 | </varlistentry> |
| 374 | |
| 375 | <varlistentry> |
| 376 | <term><option>--auto</option></term> |
| 377 | <listitem> |
| 378 | <simpara> |
| 379 | Generate a small document for testing purposes. |
| 380 | </simpara> |
| 381 | </listitem> |
| 382 | </varlistentry> |
| 383 | |
| 384 | <varlistentry> |
| 385 | <term><option>--xinclude</option></term> |
| 386 | <listitem> |
| 387 | <simpara> |
| 388 | Do XInclude processing. |
| 389 | </simpara> |
| 390 | </listitem> |
| 391 | </varlistentry> |
| 392 | <varlistentry> |
| 393 | <term><option>--loaddtd</option></term> |
| 394 | <listitem> |
| 395 | <simpara> |
| 396 | Fetch external DTD. |
| 397 | </simpara> |
| 398 | </listitem> |
| 399 | </varlistentry> |
| 400 | |
| 401 | <varlistentry> |
| 402 | <term><option>--dtdattr</option></term> |
| 403 | <listitem> |
| 404 | <simpara> |
| 405 | Fetch external DTD and populate the tree with inherited attributes. |
| 406 | </simpara> |
| 407 | </listitem> |
| 408 | </varlistentry> |
MST 2001 John Fleck | 2323ac2 | 2001-12-14 04:24:50 +0000 | [diff] [blame] | 409 | <varlistentry> |
| 410 | <term><option>--dropdtd</option></term> |
| 411 | <listitem> |
| 412 | <simpara> |
| 413 | Remove <acronym>DTD</acronym> from output. |
| 414 | </simpara> |
| 415 | </listitem> |
| 416 | </varlistentry> |
MST 2003 John Fleck | 7e54be1 | 2003-01-07 03:54:25 +0000 | [diff] [blame] | 417 | <varlistentry> |
| 418 | <term><option>--stream</option></term> |
| 419 | <listitem> |
| 420 | <simpara>Use streaming API - useful for validation of files that are |
| 421 | too large to be held in memory.</simpara> |
| 422 | </listitem> |
| 423 | </varlistentry> |
| 424 | <varlistentry> |
| 425 | <term><option>--chkregister</option></term> |
| 426 | <listitem> |
| 427 | <simpara>Turn on node registration. Useful for developeres testing |
| 428 | libxml2 node tracking code.</simpara> |
| 429 | </listitem> |
| 430 | </varlistentry> |
MDT 2001 John Fleck | fd32de6 | 2001-10-27 20:14:01 +0000 | [diff] [blame] | 431 | </variablelist> |
| 432 | </refsect1> |
MST 2001 John Fleck | 4230404 | 2001-11-18 00:18:06 +0000 | [diff] [blame] | 433 | |
| 434 | <refsect1 id="shell"> |
| 435 | <title>Shell</title> |
| 436 | <para> |
| 437 | <application>xmllint</application> offers an interactive shell mode |
| 438 | invoked with the <option>--shell</option> command. Available commands in |
| 439 | shell mode include: |
| 440 | </para> |
| 441 | <variablelist> |
| 442 | <varlistentry> |
| 443 | <term><option>base</option></term> |
| 444 | <listitem> |
| 445 | <simpara> |
| 446 | display XML base of the node |
| 447 | </simpara> |
| 448 | </listitem> |
| 449 | </varlistentry> |
| 450 | <varlistentry> |
| 451 | <term><option>bye</option></term> |
| 452 | <listitem> |
| 453 | <simpara> |
| 454 | leave shell |
| 455 | </simpara> |
| 456 | </listitem> |
| 457 | </varlistentry> |
| 458 | <varlistentry> |
| 459 | <term><option>cat <replaceable>node</replaceable></option></term> |
| 460 | <listitem> |
| 461 | <simpara> |
| 462 | Display node if given or current node. |
| 463 | </simpara> |
| 464 | </listitem> |
| 465 | </varlistentry> |
| 466 | <varlistentry> |
| 467 | <term><option>cd <replaceable>path</replaceable></option></term> |
| 468 | <listitem> |
| 469 | <simpara> |
| 470 | Change the current node to <replaceable>path</replaceable> (if given |
| 471 | and unique) or root if no argument given. |
| 472 | </simpara> |
| 473 | </listitem> |
| 474 | </varlistentry> |
| 475 | <varlistentry> |
| 476 | <term><option>dir <replaceable>path</replaceable></option></term> |
| 477 | <listitem> |
| 478 | <simpara> |
| 479 | Dumps information about the node (namespace, attributes, content). |
| 480 | </simpara> |
| 481 | </listitem> |
| 482 | </varlistentry> |
| 483 | <varlistentry> |
| 484 | <term><option>du <replaceable>path</replaceable></option></term> |
| 485 | <listitem> |
| 486 | <simpara> |
| 487 | Show the structure of the subtree under path or the current node. |
| 488 | </simpara> |
| 489 | </listitem> |
| 490 | </varlistentry> |
| 491 | <varlistentry> |
| 492 | <term><option>exit</option></term> |
| 493 | <listitem> |
| 494 | <simpara> |
| 495 | Leave the shell. |
| 496 | </simpara> |
| 497 | </listitem> |
| 498 | </varlistentry> |
| 499 | <varlistentry> |
| 500 | <term><option>help</option></term> |
| 501 | <listitem> |
| 502 | <simpara> |
| 503 | Show this help. |
| 504 | </simpara> |
| 505 | </listitem> |
| 506 | </varlistentry> |
| 507 | <varlistentry> |
| 508 | <term><option>free</option></term> |
| 509 | <listitem> |
| 510 | <simpara> |
| 511 | Display memory usage. |
| 512 | </simpara> |
| 513 | </listitem> |
| 514 | </varlistentry> |
| 515 | <varlistentry> |
| 516 | <term><option>load <replaceable>name</replaceable></option></term> |
| 517 | <listitem> |
| 518 | <simpara> |
| 519 | Load a new document with the given name. |
| 520 | </simpara> |
| 521 | </listitem> |
| 522 | </varlistentry> |
| 523 | <varlistentry> |
| 524 | <term><option>ls <replaceable>path</replaceable></option></term> |
| 525 | <listitem> |
| 526 | <simpara> |
| 527 | List contents of <replaceable>path</replaceable> (if given) or the |
| 528 | current directory. |
| 529 | </simpara> |
| 530 | </listitem> |
| 531 | </varlistentry> |
| 532 | <varlistentry> |
| 533 | <term><option>pwd</option></term> |
| 534 | <listitem> |
| 535 | <simpara> |
| 536 | Display the path to the current node. |
| 537 | </simpara> |
| 538 | </listitem> |
| 539 | </varlistentry> |
| 540 | <varlistentry> |
| 541 | <term><option>quit</option></term> |
| 542 | <listitem> |
| 543 | <simpara> |
| 544 | Leave the shell. |
| 545 | </simpara> |
| 546 | </listitem> |
| 547 | </varlistentry> |
| 548 | <varlistentry> |
| 549 | <term><option>save <replaceable>name</replaceable></option></term> |
| 550 | <listitem> |
| 551 | <simpara> |
| 552 | Saves the current document to <replaceable>name</replaceable> if |
| 553 | given or to the original name. |
| 554 | </simpara> |
| 555 | </listitem> |
| 556 | </varlistentry> |
| 557 | <varlistentry> |
| 558 | <term><option>validate</option></term> |
| 559 | <listitem> |
| 560 | <simpara> |
| 561 | Check the document for error. |
| 562 | </simpara> |
| 563 | </listitem> |
| 564 | </varlistentry> |
| 565 | <varlistentry> |
| 566 | <term><option>write <replaceable>name</replaceable></option></term> |
| 567 | <listitem> |
| 568 | <simpara> |
| 569 | Write the current node to the given filename. |
| 570 | </simpara> |
| 571 | </listitem> |
| 572 | </varlistentry> |
MST 2001 John Fleck | 2323ac2 | 2001-12-14 04:24:50 +0000 | [diff] [blame] | 573 | |
MST 2001 John Fleck | 4230404 | 2001-11-18 00:18:06 +0000 | [diff] [blame] | 574 | </variablelist> |
| 575 | </refsect1> |
MST 2002 John Fleck | 6647aed | 2002-12-26 02:23:24 +0000 | [diff] [blame] | 576 | <refsect1> |
| 577 | <title>Debugging Catalogs</title> |
| 578 | <para>Setting the environment variable <varname>XML_DEBUG_CATALOG</varname> |
| 579 | using the command <command>"export XML_DEBUG_CATALOG="</command> |
| 580 | outputs debugging information related to catalog operations.</para> |
| 581 | </refsect1> |
MST 2001 John Fleck | 4230404 | 2001-11-18 00:18:06 +0000 | [diff] [blame] | 582 | </refentry> |