blob: d6f795bd4d87cb8633ef900e57bf0a9def86fac5 [file] [log] [blame]
Daniel Veillard1afc9f32003-09-13 12:44:05 +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] | [--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.
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.
Daniel Veillard1afc9f32003-09-13 12:44:05 +000061 </dd><dt><span class="term"><tt class="option">--html</tt></span></dt><dd>
MDT 2003 John Fleck2ae05c72003-07-23 01:43:53 +000062 Use the <span class="acronym">HTML</span> parser.
63 </dd><dt><span class="term"><tt class="option">--push</tt></span></dt><dd>
64 Use the push mode of the parser.
65 </dd><dt><span class="term"><tt class="option">--memory</tt></span></dt><dd>
66 Parse from memory.
67 </dd><dt><span class="term"><tt class="option">--nowarning</tt></span></dt><dd>
68 Do not emit warnings from the parser and/or validator.
69 </dd><dt><span class="term"><tt class="option">--noblanks</tt></span></dt><dd>
70 Drop ignorable blank spaces.
71 </dd><dt><span class="term"><tt class="option">--format</tt></span></dt><dd>
72 Reformat and reindent the output. The $XMLLINT_INDENT
73 environment variable controls the indentation (default
74 value is two spaces " ").
75 </dd><dt><span class="term"><tt class="option">--testIO</tt></span></dt><dd>
76 Test user input/output support.
77 </dd><dt><span class="term"><tt class="option">--encode</tt> <i class="replaceable"><tt>encoding</tt></i></span></dt><dd>
78 Output in the given encoding.
79 </dd><dt><span class="term"><tt class="option">--catalogs</tt></span></dt><dd>
80 Use the catalogs from $SGML_CATALOG_FILES. Otherwise /etc/xml/catalog
81 is used by default.
82 </dd><dt><span class="term"><tt class="option">--nocatalogs</tt></span></dt><dd>
83 Do not use any catalogs.
84 </dd><dt><span class="term"><tt class="option">--auto</tt></span></dt><dd>
85 Generate a small document for testing purposes.
86 </dd><dt><span class="term"><tt class="option">--xinclude</tt></span></dt><dd>
87 Do XInclude processing.
88 </dd><dt><span class="term"><tt class="option">--loaddtd</tt></span></dt><dd>
89 Fetch external DTD.
90 </dd><dt><span class="term"><tt class="option">--dtdattr</tt></span></dt><dd>
91 Fetch external DTD and populate the tree with inherited attributes.
92 </dd><dt><span class="term"><tt class="option">--dropdtd</tt></span></dt><dd>
93 Remove <span class="acronym">DTD</span> from output.
94 </dd><dt><span class="term"><tt class="option">--stream</tt></span></dt><dd>Use streaming API - useful when used in combination with
95 --relaxng or --valid options for validation of files that are
96 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
97 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
98 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">
99 <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>
100 <span class="application">xmllint</span> offers an interactive shell mode
101 invoked with the <tt class="option">--shell</tt> command. Available commands in
102 shell mode include:
103 </p><div class="variablelist"><dl><dt><span class="term"><tt class="option">base</tt></span></dt><dd>
104 display XML base of the node
105 </dd><dt><span class="term"><tt class="option">bye</tt></span></dt><dd>
106 leave shell
107 </dd><dt><span class="term"><tt class="option">cat <i class="replaceable"><tt>node</tt></i></tt></span></dt><dd>
108 Display node if given or current node.
109 </dd><dt><span class="term"><tt class="option">cd <i class="replaceable"><tt>path</tt></i></tt></span></dt><dd>
110 Change the current node to <i class="replaceable"><tt>path</tt></i> (if given
111 and unique) or root if no argument given.
112 </dd><dt><span class="term"><tt class="option">dir <i class="replaceable"><tt>path</tt></i></tt></span></dt><dd>
113 Dumps information about the node (namespace, attributes, content).
114 </dd><dt><span class="term"><tt class="option">du <i class="replaceable"><tt>path</tt></i></tt></span></dt><dd>
115 Show the structure of the subtree under path or the current node.
116 </dd><dt><span class="term"><tt class="option">exit</tt></span></dt><dd>
117 Leave the shell.
118 </dd><dt><span class="term"><tt class="option">help</tt></span></dt><dd>
119 Show this help.
120 </dd><dt><span class="term"><tt class="option">free</tt></span></dt><dd>
121 Display memory usage.
122 </dd><dt><span class="term"><tt class="option">load <i class="replaceable"><tt>name</tt></i></tt></span></dt><dd>
123 Load a new document with the given name.
124 </dd><dt><span class="term"><tt class="option">ls <i class="replaceable"><tt>path</tt></i></tt></span></dt><dd>
125 List contents of <i class="replaceable"><tt>path</tt></i> (if given) or the
126 current directory.
127 </dd><dt><span class="term"><tt class="option">pwd</tt></span></dt><dd>
128 Display the path to the current node.
129 </dd><dt><span class="term"><tt class="option">quit</tt></span></dt><dd>
130 Leave the shell.
131 </dd><dt><span class="term"><tt class="option">save <i class="replaceable"><tt>name</tt></i></tt></span></dt><dd>
132 Saves the current document to <i class="replaceable"><tt>name</tt></i> if
133 given or to the original name.
134 </dd><dt><span class="term"><tt class="option">validate</tt></span></dt><dd>
135 Check the document for error.
136 </dd><dt><span class="term"><tt class="option">write <i class="replaceable"><tt>name</tt></i></tt></span></dt><dd>
137 Write the current node to the given filename.
138 </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>
139 using the command <b class="command">"export XML_DEBUG_CATALOG="</b>
140 outputs debugging information related to catalog operations.</p></div></div></body></html>