blob: 4d26c6c5a62ab015bbf27ec1e402332838f3c020 [file] [log] [blame]
MDT 2003 John Fleck2ae05c72003-07-23 01:43:53 +00001<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>xmllint</title><meta name="generator" content="DocBook XSL Stylesheets V1.60.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"><a name="id2589902"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>Name</h2><p>xmllint &#8212; command line <span class="acronym">XML</span> tool</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><tt class="command">xmllint</tt> [[--version] | [--debug] | [--shell] | [--debugent] | [--copy] | [--recover] | [--noent] | [--noout] | [--htmlout] | [--nowrap] | [--valid] | [--postvalid] | [--dtdvalid <i class="replaceable"><tt>URL</tt></i>] | [--timing] | [--repeat] | [--insert] | [--compress] | [--sgml] | [--html] | [--push] | [--memory] | [--nowarning] | [--noblanks] | [--format] | [--testIO] | [--encode <i class="replaceable"><tt>encoding</tt></i>] | [--catalogs] | [--nocatalogs] | [--auto] | [--xinclude] | [--loaddtd] | [--dtdattr] | [--dropdtd] | [--stream] | [--chkregister] | [--relaxng] | [--schema] | [--nonet]] [<tt class="option"><i class="replaceable"><tt>xmlfile</tt></i></tt>]</p></div></div><div class="refsect1" lang="en"><a name="introduction"></a><h2>Introduction</h2><p>
2 The xmllint program parses one or more XML files, specified on the
3 command line as <i class="replaceable"><tt>xmlfile</tt></i>. It prints various
4 types of output, depending upon the options selected. It is useful for
5 detecting errors both in <span class="acronym">XML</span> code and in the
6 <span class="acronym">XML</span> parser itself.
7 </p><p>
8 It is included in <span class="application">libxml2</span>.
9 </p></div><div class="refsect1" lang="en"><a name="options"></a><h2>Options</h2><div class="variablelist"><dl><dt><span class="term"><tt class="option">--version</tt></span></dt><dd>
10 Display the version of
11 <span class="application">libxml2</span> used.
12 </dd><dt><span class="term"><tt class="option">--debug</tt></span></dt><dd>
13 Parse a file and output an annotated tree of the
14 in-memory version of the document.
15 </dd><dt><span class="term"><tt class="option">--shell</tt></span></dt><dd>
16 Run a navigating shell. Details on available commands in shell mode
17 are below.
18 </dd><dt><span class="term"><tt class="option">--debugent</tt></span></dt><dd>
19 Debug the entities defined in the document.
20 </dd><dt><span class="term"><tt class="option">--copy</tt> </span></dt><dd>
21 Test the internal copy implementation.
22 </dd><dt><span class="term"><tt class="option">--recover</tt></span></dt><dd>
23 Output any parsable portions of an invalid
24 document.
25 </dd><dt><span class="term"><tt class="option">--noent</tt></span></dt><dd>
26 Substitute entity values for entity
27 references. By default, <span class="application">xmllint</span> leaves entity
28 references in place.
29 </dd><dt><span class="term"><tt class="option">--noout</tt></span></dt><dd>
30 Suppress output. By default,
31 <span class="application">xmllint</span> outputs the result tree.
32 </dd><dt><span class="term"><tt class="option">--htmlout</tt></span></dt><dd>
33 Output results as an <span class="acronym">HTML</span>
34 file. This causes <span class="application">xmllint</span> to output
35 the necessary <span class="acronym">HTML</span> tags surrounding the result tree
36 output so the results can be displayed in a browser.
37 </dd><dt><span class="term"><tt class="option">--nowrap </tt></span></dt><dd>
38 Do not output HTML doc wrapper.
39 </dd><dt><span class="term"><tt class="option">--valid </tt></span></dt><dd>
40 Determine if the document is a valid instance
41 of the included Document Type Definition (<span class="acronym">DTD</span>). A
42 <span class="acronym">DTD</span> to be validated against also can be specified at
43 the command line using the <tt class="option">--dtdvalid</tt> option. By default,
44 <span class="application">xmllint</span> also checks to determine if the
45 document is well-formed.
46 </dd><dt><span class="term"><tt class="option">--postvalid</tt></span></dt><dd>
47 Validate after parsing is completed.
48 </dd><dt><span class="term"> <tt class="option">--dtdvalid</tt> <i class="replaceable"><tt>URL</tt></i></span></dt><dd>
49 Use the
50 <span class="acronym">DTD</span> specified by <i class="replaceable"><tt>URL</tt></i> for
51 validation.
52 </dd><dt><span class="term"><tt class="option">--timing</tt></span></dt><dd>
53 Output information about the time it takes
54 <span class="application">xmllint</span> to perform the various steps.
55 </dd><dt><span class="term"><tt class="option">--repeat</tt></span></dt><dd>
56 Repeat 100 times, for timing or profiling.
57 </dd><dt><span class="term"><tt class="option">--insert</tt></span></dt><dd>
58 Test for valid insertions.
59 </dd><dt><span class="term"><tt class="option">--compress</tt></span></dt><dd>
60 Turn on gzip compression of output.
61 </dd><dt><span class="term"><tt class="option">--sgml</tt></span></dt><dd>Use the DocBook <span class="acronym">SGML</span> parser. This allows
62 documents written in <span class="acronym">SGML</span> DocBook to be converted
63 into an in-memory tree and treated as if they were written in
64 <span class="acronym">XML</span>.</dd><dt><span class="term"><tt class="option">--html</tt></span></dt><dd>
65 Use the <span class="acronym">HTML</span> parser.
66 </dd><dt><span class="term"><tt class="option">--push</tt></span></dt><dd>
67 Use the push mode of the parser.
68 </dd><dt><span class="term"><tt class="option">--memory</tt></span></dt><dd>
69 Parse from memory.
70 </dd><dt><span class="term"><tt class="option">--nowarning</tt></span></dt><dd>
71 Do not emit warnings from the parser and/or validator.
72 </dd><dt><span class="term"><tt class="option">--noblanks</tt></span></dt><dd>
73 Drop ignorable blank spaces.
74 </dd><dt><span class="term"><tt class="option">--format</tt></span></dt><dd>
75 Reformat and reindent the output. The $XMLLINT_INDENT
76 environment variable controls the indentation (default
77 value is two spaces " ").
78 </dd><dt><span class="term"><tt class="option">--testIO</tt></span></dt><dd>
79 Test user input/output support.
80 </dd><dt><span class="term"><tt class="option">--encode</tt> <i class="replaceable"><tt>encoding</tt></i></span></dt><dd>
81 Output in the given encoding.
82 </dd><dt><span class="term"><tt class="option">--catalogs</tt></span></dt><dd>
83 Use the catalogs from $SGML_CATALOG_FILES. Otherwise /etc/xml/catalog
84 is used by default.
85 </dd><dt><span class="term"><tt class="option">--nocatalogs</tt></span></dt><dd>
86 Do not use any catalogs.
87 </dd><dt><span class="term"><tt class="option">--auto</tt></span></dt><dd>
88 Generate a small document for testing purposes.
89 </dd><dt><span class="term"><tt class="option">--xinclude</tt></span></dt><dd>
90 Do XInclude processing.
91 </dd><dt><span class="term"><tt class="option">--loaddtd</tt></span></dt><dd>
92 Fetch external DTD.
93 </dd><dt><span class="term"><tt class="option">--dtdattr</tt></span></dt><dd>
94 Fetch external DTD and populate the tree with inherited attributes.
95 </dd><dt><span class="term"><tt class="option">--dropdtd</tt></span></dt><dd>
96 Remove <span class="acronym">DTD</span> from output.
97 </dd><dt><span class="term"><tt class="option">--stream</tt></span></dt><dd>Use streaming API - useful when used in combination with
98 --relaxng or --valid options for validation of files that are
99 too large to be held in memory.</dd><dt><span class="term"><tt class="option">--chkregister</tt></span></dt><dd>Turn on node registration. Useful for developeres testing
100 libxml2 node tracking code.</dd><dt><span class="term"><tt class="option">--relaxng</tt> <i class="replaceable"><tt>schema</tt></i></span></dt><dd>Use RelaxNG file named <i class="replaceable"><tt>schema</tt></i> for
101 validation.</dd><dt><span class="term"><tt class="option">--schema</tt> <i class="replaceable"><tt>schema</tt></i></span></dt><dd>Use a W3C XML Schema file named <i class="replaceable"><tt>schema</tt></i> for validation.</dd><dt><span class="term">
102 <tt class="option">--nonet</tt></span></dt><dd>Do not use the Internet to fetch DTD's or entities.</dd></dl></div></div><div class="refsect1" lang="en"><a name="shell"></a><h2>Shell</h2><p>
103 <span class="application">xmllint</span> offers an interactive shell mode
104 invoked with the <tt class="option">--shell</tt> command. Available commands in
105 shell mode include:
106 </p><div class="variablelist"><dl><dt><span class="term"><tt class="option">base</tt></span></dt><dd>
107 display XML base of the node
108 </dd><dt><span class="term"><tt class="option">bye</tt></span></dt><dd>
109 leave shell
110 </dd><dt><span class="term"><tt class="option">cat <i class="replaceable"><tt>node</tt></i></tt></span></dt><dd>
111 Display node if given or current node.
112 </dd><dt><span class="term"><tt class="option">cd <i class="replaceable"><tt>path</tt></i></tt></span></dt><dd>
113 Change the current node to <i class="replaceable"><tt>path</tt></i> (if given
114 and unique) or root if no argument given.
115 </dd><dt><span class="term"><tt class="option">dir <i class="replaceable"><tt>path</tt></i></tt></span></dt><dd>
116 Dumps information about the node (namespace, attributes, content).
117 </dd><dt><span class="term"><tt class="option">du <i class="replaceable"><tt>path</tt></i></tt></span></dt><dd>
118 Show the structure of the subtree under path or the current node.
119 </dd><dt><span class="term"><tt class="option">exit</tt></span></dt><dd>
120 Leave the shell.
121 </dd><dt><span class="term"><tt class="option">help</tt></span></dt><dd>
122 Show this help.
123 </dd><dt><span class="term"><tt class="option">free</tt></span></dt><dd>
124 Display memory usage.
125 </dd><dt><span class="term"><tt class="option">load <i class="replaceable"><tt>name</tt></i></tt></span></dt><dd>
126 Load a new document with the given name.
127 </dd><dt><span class="term"><tt class="option">ls <i class="replaceable"><tt>path</tt></i></tt></span></dt><dd>
128 List contents of <i class="replaceable"><tt>path</tt></i> (if given) or the
129 current directory.
130 </dd><dt><span class="term"><tt class="option">pwd</tt></span></dt><dd>
131 Display the path to the current node.
132 </dd><dt><span class="term"><tt class="option">quit</tt></span></dt><dd>
133 Leave the shell.
134 </dd><dt><span class="term"><tt class="option">save <i class="replaceable"><tt>name</tt></i></tt></span></dt><dd>
135 Saves the current document to <i class="replaceable"><tt>name</tt></i> if
136 given or to the original name.
137 </dd><dt><span class="term"><tt class="option">validate</tt></span></dt><dd>
138 Check the document for error.
139 </dd><dt><span class="term"><tt class="option">write <i class="replaceable"><tt>name</tt></i></tt></span></dt><dd>
140 Write the current node to the given filename.
141 </dd></dl></div></div><div class="refsect1" lang="en"><h2>Debugging Catalogs</h2><p>Setting the environment variable <tt class="varname">XML_DEBUG_CATALOG</tt>
142 using the command <b class="command">"export XML_DEBUG_CATALOG="</b>
143 outputs debugging information related to catalog operations.</p></div></div></body></html>