2 <?xml-stylesheet type="text/xsl"
3 href="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"?>
4 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
5 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
9 <title>xmllint Manual</title>
14 <firstname>John</firstname>
15 <surname>Fleck</surname>
17 <address><email>jfleck@inkstain.net</email></address>
19 <firstname>Ziying</firstname>
20 <surname>Sherwin</surname>
22 <address><email>sherwin@nlm.nih.gov</email></address>
24 <firstname>Heiko</firstname>
25 <surname>Rupp</surname>
27 <address><email>hwr@pilhuhn.de</email></address>
29 <releaseinfo>This is release 0.2 of the xmllint Manual.</releaseinfo>
33 <refentrytitle>xmllint</refentrytitle>
34 <manvolnum>1</manvolnum>
38 <refname>xmllint</refname>
39 <refpurpose>command line <acronym>XML</acronym> tool</refpurpose>
44 <command>xmllint</command>
57 <arg>--postvalid</arg>
58 <arg>--dtdvalid <replaceable>URL</replaceable></arg>
67 <arg>--nowarning</arg>
71 <arg>--encode <replaceable>encoding</replaceable></arg>
73 <arg>--nocatalogs</arg>
80 <arg>--chkregister</arg>
85 <arg><option><replaceable>xmlfile</replaceable></option></arg>
89 <refsect1 id="introduction">
90 <title>Introduction</title>
92 The xmllint program parses one or more XML files, specified on the
93 command line as <replaceable>xmlfile</replaceable>. It prints various
94 types of output, depending upon the options selected. It is useful for
95 detecting errors both in <acronym>XML</acronym> code and in the
96 <acronym>XML</acronym> parser itself.
100 It is included in <application>libxml2</application>.
103 <refsect1 id="options">
104 <title>Options</title>
107 <term><option>--version</option></term>
110 Display the version of
111 <application>libxml2</application> used.
117 <term><option>--debug</option></term>
120 Parse a file and output an annotated tree of the
121 in-memory version of the document.
127 <term><option>--shell</option></term>
130 Run a navigating shell. Details on available commands in shell mode
137 <term><option>--debugent</option></term>
140 Debug the entities defined in the document.
146 <term><option>--copy</option> </term>
149 Test the internal copy implementation.
156 <term><option>--recover</option></term>
159 Output any parsable portions of an invalid
166 <term><option>--noent</option></term>
169 Substitute entity values for entity
170 references. By default, <application>xmllint</application> leaves entity
177 <term><option>--noout</option></term>
180 Suppress output. By default,
181 <application>xmllint</application> outputs the result tree.
187 <term><option>--htmlout</option></term>
190 Output results as an <acronym>HTML</acronym>
191 file. This causes <application>xmllint</application> to output
192 the necessary <acronym>HTML</acronym> tags surrounding the result tree
193 output so the results can be displayed in a browser.
199 <term><option>--nowrap </option></term>
202 Do not output HTML doc wrapper.
208 <term><option>--valid </option></term>
211 Determine if the document is a valid instance
212 of the included Document Type Definition (<acronym>DTD</acronym>). A
213 <acronym>DTD</acronym> to be validated against also can be specified at
214 the command line using the <option>--dtdvalid</option> option. By default,
215 <application>xmllint</application> also checks to determine if the
216 document is well-formed.
222 <term><option>--postvalid</option></term>
225 Validate after parsing is completed.
231 <term> <option>--dtdvalid</option> <replaceable>URL</replaceable></term>
235 <acronym>DTD</acronym> specified by <replaceable>URL</replaceable> for
242 <term><option>--timing</option></term>
245 Output information about the time it takes
246 <application>xmllint</application> to perform the various steps.
252 <term><option>--repeat</option></term>
255 Repeat 100 times, for timing or profiling.
261 <term><option>--insert</option></term>
264 Test for valid insertions.
270 <term><option>--compress</option></term>
273 Turn on gzip compression of output.
279 <term><option>--sgml</option></term>
281 <simpara>Use the DocBook <acronym>SGML</acronym> parser. This allows
282 documents written in <acronym>SGML</acronym> DocBook to be converted
283 into an in-memory tree and treated as if they were written in
284 <acronym>XML</acronym>.</simpara>
289 <term><option>--html</option></term>
292 Use the <acronym>HTML</acronym> parser.
298 <term><option>--push</option></term>
301 Use the push mode of the parser.
308 <term><option>--memory</option></term>
317 <term><option>--nowarning</option></term>
320 Do not emit warnings from the parser and/or validator.
326 <term><option>--noblanks</option></term>
329 Drop ignorable blank spaces.
335 <term><option>--format</option></term>
338 Reformat and reindent the output. The $XMLLINT_INDENT
339 environment variable controls the indentation (default
340 value is two spaces " ").
346 <term><option>--testIO</option></term>
349 Test user input/output support.
355 <term><option>--encode</option> <replaceable>encoding</replaceable></term>
358 Output in the given encoding.
364 <term><option>--catalogs</option></term>
367 Use the catalogs from $SGML_CATALOG_FILES. Otherwise /etc/xml/catalog
374 <term><option>--nocatalogs</option></term>
377 Do not use any catalogs.
383 <term><option>--auto</option></term>
386 Generate a small document for testing purposes.
392 <term><option>--xinclude</option></term>
395 Do XInclude processing.
400 <term><option>--loaddtd</option></term>
409 <term><option>--dtdattr</option></term>
412 Fetch external DTD and populate the tree with inherited attributes.
417 <term><option>--dropdtd</option></term>
420 Remove <acronym>DTD</acronym> from output.
425 <term><option>--stream</option></term>
427 <simpara>Use streaming API - useful when used in combination with
428 --relaxng or --valid options for validation of files that are
429 too large to be held in memory.</simpara>
433 <term><option>--chkregister</option></term>
435 <simpara>Turn on node registration. Useful for developeres testing
436 libxml2 node tracking code.</simpara>
440 <term><option>--relaxng</option> <replaceable>schema</replaceable></term>
442 <simpara>Use RelaxNG file named <replaceable>schema</replaceable> for
443 validation.</simpara>
447 <term><option>--schema</option> <replaceable>schema</replaceable></term>
449 <simpara>Use a W3C XML Schema file named <replaceable>schema</replaceable> for validation.</simpara>
454 <option>--nonet</option></term>
456 <simpara>Do not use the Internet to fetch DTD's or entities.</simpara>
462 <refsect1 id="shell">
465 <application>xmllint</application> offers an interactive shell mode
466 invoked with the <option>--shell</option> command. Available commands in
471 <term><option>base</option></term>
474 display XML base of the node
479 <term><option>bye</option></term>
487 <term><option>cat <replaceable>node</replaceable></option></term>
490 Display node if given or current node.
495 <term><option>cd <replaceable>path</replaceable></option></term>
498 Change the current node to <replaceable>path</replaceable> (if given
499 and unique) or root if no argument given.
504 <term><option>dir <replaceable>path</replaceable></option></term>
507 Dumps information about the node (namespace, attributes, content).
512 <term><option>du <replaceable>path</replaceable></option></term>
515 Show the structure of the subtree under path or the current node.
520 <term><option>exit</option></term>
528 <term><option>help</option></term>
536 <term><option>free</option></term>
539 Display memory usage.
544 <term><option>load <replaceable>name</replaceable></option></term>
547 Load a new document with the given name.
552 <term><option>ls <replaceable>path</replaceable></option></term>
555 List contents of <replaceable>path</replaceable> (if given) or the
561 <term><option>pwd</option></term>
564 Display the path to the current node.
569 <term><option>quit</option></term>
577 <term><option>save <replaceable>name</replaceable></option></term>
580 Saves the current document to <replaceable>name</replaceable> if
581 given or to the original name.
586 <term><option>validate</option></term>
589 Check the document for error.
594 <term><option>write <replaceable>name</replaceable></option></term>
597 Write the current node to the given filename.
605 <title>Debugging Catalogs</title>
606 <para>Setting the environment variable <varname>XML_DEBUG_CATALOG</varname>
607 using the command <command>"export XML_DEBUG_CATALOG="</command>
608 outputs debugging information related to catalog operations.</para>