blob: 855eaf7663488ed6793d970473dcf7fb469e8040 [file] [log] [blame]
MST 2004 John Flecke42ae6f2004-02-27 03:26:30 +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.61.2"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"><a name="id2431614"></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] | [--nocdata] | [--nsclean] | [--noout] | [--htmlout] | [--nowrap] | [--valid] | [--postvalid] | [--dtdvalid <i class="replaceable"><tt>URL</tt></i>] | [--dtdvalidfpi <i class="replaceable"><tt>FPI</tt></i>] | [--timing] | [--repeat] | [--insert] | [--compress] | [--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>
MDT 2003 John Fleck2ae05c72003-07-23 01:43:53 +00002 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.
MST 2004 John Flecke42ae6f2004-02-27 03:26:30 +000029 </dd><dt><span class="term"><tt class="option">--nocdata</tt></span></dt><dd>
30 Substitute CDATA section by equivalent text nodes.
31 </dd><dt><span class="term"><tt class="option">--nsclean</tt></span></dt><dd>
32 Remove redundant namespace declarations.
MDT 2003 John Fleck2ae05c72003-07-23 01:43:53 +000033 </dd><dt><span class="term"><tt class="option">--noout</tt></span></dt><dd>
34 Suppress output. By default,
35 <span class="application">xmllint</span> outputs the result tree.
36 </dd><dt><span class="term"><tt class="option">--htmlout</tt></span></dt><dd>
37 Output results as an <span class="acronym">HTML</span>
38 file. This causes <span class="application">xmllint</span> to output
39 the necessary <span class="acronym">HTML</span> tags surrounding the result tree
40 output so the results can be displayed in a browser.
41 </dd><dt><span class="term"><tt class="option">--nowrap </tt></span></dt><dd>
42 Do not output HTML doc wrapper.
43 </dd><dt><span class="term"><tt class="option">--valid </tt></span></dt><dd>
44 Determine if the document is a valid instance
45 of the included Document Type Definition (<span class="acronym">DTD</span>). A
46 <span class="acronym">DTD</span> to be validated against also can be specified at
47 the command line using the <tt class="option">--dtdvalid</tt> option. By default,
48 <span class="application">xmllint</span> also checks to determine if the
49 document is well-formed.
50 </dd><dt><span class="term"><tt class="option">--postvalid</tt></span></dt><dd>
51 Validate after parsing is completed.
52 </dd><dt><span class="term"> <tt class="option">--dtdvalid</tt> <i class="replaceable"><tt>URL</tt></i></span></dt><dd>
53 Use the
54 <span class="acronym">DTD</span> specified by <i class="replaceable"><tt>URL</tt></i> for
55 validation.
MST 2004 John Flecke42ae6f2004-02-27 03:26:30 +000056 </dd><dt><span class="term"> <tt class="option">--dtdvalidfpi</tt> <i class="replaceable"><tt>FPI</tt></i></span></dt><dd>
57 Use the
58 <span class="acronym">DTD</span> specified by the Public Identifier
59 <i class="replaceable"><tt>FPI</tt></i> for validation, note that this
60 will require a Catalog exporting that Public Identifier to work.
MDT 2003 John Fleck2ae05c72003-07-23 01:43:53 +000061 </dd><dt><span class="term"><tt class="option">--timing</tt></span></dt><dd>
62 Output information about the time it takes
63 <span class="application">xmllint</span> to perform the various steps.
64 </dd><dt><span class="term"><tt class="option">--repeat</tt></span></dt><dd>
65 Repeat 100 times, for timing or profiling.
66 </dd><dt><span class="term"><tt class="option">--insert</tt></span></dt><dd>
67 Test for valid insertions.
68 </dd><dt><span class="term"><tt class="option">--compress</tt></span></dt><dd>
69 Turn on gzip compression of output.
Daniel Veillard1afc9f32003-09-13 12:44:05 +000070 </dd><dt><span class="term"><tt class="option">--html</tt></span></dt><dd>
MDT 2003 John Fleck2ae05c72003-07-23 01:43:53 +000071 Use the <span class="acronym">HTML</span> parser.
72 </dd><dt><span class="term"><tt class="option">--push</tt></span></dt><dd>
73 Use the push mode of the parser.
74 </dd><dt><span class="term"><tt class="option">--memory</tt></span></dt><dd>
75 Parse from memory.
76 </dd><dt><span class="term"><tt class="option">--nowarning</tt></span></dt><dd>
77 Do not emit warnings from the parser and/or validator.
78 </dd><dt><span class="term"><tt class="option">--noblanks</tt></span></dt><dd>
79 Drop ignorable blank spaces.
80 </dd><dt><span class="term"><tt class="option">--format</tt></span></dt><dd>
81 Reformat and reindent the output. The $XMLLINT_INDENT
82 environment variable controls the indentation (default
83 value is two spaces " ").
84 </dd><dt><span class="term"><tt class="option">--testIO</tt></span></dt><dd>
85 Test user input/output support.
86 </dd><dt><span class="term"><tt class="option">--encode</tt> <i class="replaceable"><tt>encoding</tt></i></span></dt><dd>
87 Output in the given encoding.
88 </dd><dt><span class="term"><tt class="option">--catalogs</tt></span></dt><dd>
89 Use the catalogs from $SGML_CATALOG_FILES. Otherwise /etc/xml/catalog
90 is used by default.
91 </dd><dt><span class="term"><tt class="option">--nocatalogs</tt></span></dt><dd>
92 Do not use any catalogs.
93 </dd><dt><span class="term"><tt class="option">--auto</tt></span></dt><dd>
94 Generate a small document for testing purposes.
95 </dd><dt><span class="term"><tt class="option">--xinclude</tt></span></dt><dd>
96 Do XInclude processing.
97 </dd><dt><span class="term"><tt class="option">--loaddtd</tt></span></dt><dd>
98 Fetch external DTD.
99 </dd><dt><span class="term"><tt class="option">--dtdattr</tt></span></dt><dd>
100 Fetch external DTD and populate the tree with inherited attributes.
101 </dd><dt><span class="term"><tt class="option">--dropdtd</tt></span></dt><dd>
102 Remove <span class="acronym">DTD</span> from output.
103 </dd><dt><span class="term"><tt class="option">--stream</tt></span></dt><dd>Use streaming API - useful when used in combination with
104 --relaxng or --valid options for validation of files that are
105 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
106 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
107 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">
108 <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>
109 <span class="application">xmllint</span> offers an interactive shell mode
110 invoked with the <tt class="option">--shell</tt> command. Available commands in
111 shell mode include:
112 </p><div class="variablelist"><dl><dt><span class="term"><tt class="option">base</tt></span></dt><dd>
113 display XML base of the node
114 </dd><dt><span class="term"><tt class="option">bye</tt></span></dt><dd>
115 leave shell
116 </dd><dt><span class="term"><tt class="option">cat <i class="replaceable"><tt>node</tt></i></tt></span></dt><dd>
117 Display node if given or current node.
118 </dd><dt><span class="term"><tt class="option">cd <i class="replaceable"><tt>path</tt></i></tt></span></dt><dd>
119 Change the current node to <i class="replaceable"><tt>path</tt></i> (if given
120 and unique) or root if no argument given.
121 </dd><dt><span class="term"><tt class="option">dir <i class="replaceable"><tt>path</tt></i></tt></span></dt><dd>
122 Dumps information about the node (namespace, attributes, content).
123 </dd><dt><span class="term"><tt class="option">du <i class="replaceable"><tt>path</tt></i></tt></span></dt><dd>
124 Show the structure of the subtree under path or the current node.
125 </dd><dt><span class="term"><tt class="option">exit</tt></span></dt><dd>
126 Leave the shell.
127 </dd><dt><span class="term"><tt class="option">help</tt></span></dt><dd>
128 Show this help.
129 </dd><dt><span class="term"><tt class="option">free</tt></span></dt><dd>
130 Display memory usage.
131 </dd><dt><span class="term"><tt class="option">load <i class="replaceable"><tt>name</tt></i></tt></span></dt><dd>
132 Load a new document with the given name.
133 </dd><dt><span class="term"><tt class="option">ls <i class="replaceable"><tt>path</tt></i></tt></span></dt><dd>
134 List contents of <i class="replaceable"><tt>path</tt></i> (if given) or the
135 current directory.
136 </dd><dt><span class="term"><tt class="option">pwd</tt></span></dt><dd>
137 Display the path to the current node.
138 </dd><dt><span class="term"><tt class="option">quit</tt></span></dt><dd>
139 Leave the shell.
140 </dd><dt><span class="term"><tt class="option">save <i class="replaceable"><tt>name</tt></i></tt></span></dt><dd>
141 Saves the current document to <i class="replaceable"><tt>name</tt></i> if
142 given or to the original name.
143 </dd><dt><span class="term"><tt class="option">validate</tt></span></dt><dd>
144 Check the document for error.
145 </dd><dt><span class="term"><tt class="option">write <i class="replaceable"><tt>name</tt></i></tt></span></dt><dd>
146 Write the current node to the given filename.
MST 2004 John Flecke42ae6f2004-02-27 03:26:30 +0000147 </dd></dl></div></div><div class="refsect1" lang="en"><h2>Catalogs</h2><p>Catalog behavior can be changed by redirecting
148 queries to the user's own set of catalogs. This can be done by setting the
149 <tt class="varname">XML_CATALOG_FILES</tt> environment variable to a list of
150 catalogs. An empty one should deactivate loading the default
151 <tt class="filename">/etc/xml/catalog</tt> default catalog.</p></div><div class="refsect1" lang="en"><h2>Debugging Catalogs</h2><p>Setting the environment variable <tt class="varname">XML_DEBUG_CATALOG</tt>
MDT 2003 John Fleck2ae05c72003-07-23 01:43:53 +0000152 using the command <b class="command">"export XML_DEBUG_CATALOG="</b>
153 outputs debugging information related to catalog operations.</p></div></div></body></html>