1XMLLINT(1) XMLLINT(1)
2
3
4
6 xmllint - command line XML tool
7
9 xmllint [--version --debug --shell --debugent --copy --recover --noent
10 --noout --nonet --path "PATH(S)" --load-trace --htmlout
11 --nowrap --valid --postvalid --dtdvalid URL --dtdvalidfpi FPI
12 --timing --output FILE --repeat --insert --compress --html
13 --xmlout --push --memory --maxmem NBBYTES --nowarning
14 --noblanks --nocdata --format --encode ENCODING --dropdtd
15 --nsclean --testIO --catalogs --nocatalogs --auto --xinclude
16 --noxincludenode --loaddtd --dtdattr --stream --walker
17 --pattern PATTERNVALUE --chkregister --relaxng SCHEMA
18 --schema SCHEMA --c14n] {XML-FILE(S)... -}
19
20 xmllint --help
21
23 The xmllint program parses one or more XML files, specified on the
24 command line as XML-FILE (or the standard input if the filename
25 provided is - ). It prints various types of output, depending upon the
26 options selected. It is useful for detecting errors both in XML code
27 and in the XML parser itself.
28
29 xmllint is included in libxml(3).
30
32 xmllint accepts the following options (in alphabetical order):
33
34 --auto Generate a small document for testing purposes.
35
36 --catalogs
37 Use the SGML catalog(s) from SGML_CATALOG_FILES. Otherwise XML
38 catalogs starting from /etc/xml/catalog are used by default.
39
40 --chkregister
41 Turn on node registration. Useful for developers testing
42 libxml(3) node tracking code.
43
44 --compress
45 Turn on gzip(1) compression of output.
46
47 --copy Test the internal copy implementation.
48
49 --c14n Use the W3C XML Canonicalisation (C14N) to serialize the result
50 of parsing to stdout. It keeps comments in the result.
51
52 --dtdvalid URL
53 Use the DTD specified by an URL for validation.
54
55 --dtdvalidfpi FPI
56 Use the DTD specified by a Formal Public Identifier FPI for
57 validation, note that this will require a catalog exporting that
58 Formal Public Identifier to work.
59
60 --debug
61 Parse a file and output an annotated tree of the in-memory
62 version of the document.
63
64 --debugent
65 Debug the entities defined in the document.
66
67 --dropdtd
68 Remove DTD from output.
69
70 --dtdattr
71 Fetch external DTD and populate the tree with inherited
72 attributes.
73
74 --encode ENCODING
75 Output in the given encoding.
76
77 --format
78 Reformat and reindent the output. The XMLLINT_INDENT environment
79 variable controls the indentation. The default value is two
80 spaces " ").
81
82 --help Print out a short usage summary for xmllint.
83
84 --html Use the HTML parser.
85
86 --htmlout
87 Output results as an HTML file. This causes xmllint to output
88 the necessary HTML tags surrounding the result tree output so
89 the results can be displayed/viewed in a browser.
90
91 --insert
92 Test for valid insertions.
93
94 --loaddtd
95 Fetch an external DTD.
96
97 --load-trace
98 Display all the documents loaded during the processing to
99 stderr.
100
101 --maxmem NNBYTES
102 Test the parser memory support. NNBYTES is the maximum number
103 of bytes the library is allowed to allocate. This can also be
104 used to make sure batch processing of XML files will not exhaust
105 the virtual memory of the server running them.
106
107 --memory
108 Parse from memory.
109
110 --noblanks
111 Drop ignorable blank spaces.
112
113 --nocatalogs
114 Do not use any catalogs.
115
116 --nocdata
117 Substitute CDATA section by equivalent text nodes.
118
119 --noent
120 Substitute entity values for entity references. By default,
121 xmllint leaves entity references in place.
122
123 --nonet
124 Do not use the Internet to fetch DTDs or entities.
125
126 --noout
127 Suppress output. By default, xmllint outputs the result tree.
128
129 --nowarning
130 Do not emit warnings from the parser and/or validator.
131
132 --nowrap
133 Do not output HTML doc wrapper.
134
135 --noxincludenode
136 Do XInclude processing but do not generate XInclude start and
137 end nodes.
138
139 --nsclean
140 Remove redundant namespace declarations.
141
142 --output FILE
143 Define a file path where xmllint will save the result of
144 parsing. Usually the programs build a tree and save it on
145 stdout, with this option the result XML instance will be saved
146 onto a file.
147
148 --path "PATH(S)"
149 Use the (space- or colon-separated) list of filesystem paths
150 specified by PATHS to load DTDs or entities. Enclose
151 space-separated lists by quotation marks.
152
153 --pattern PATTERNVALUE
154 Used to exercise the pattern recognition engine, which can be
155 used with the reader interface to the parser. It allows to
156 select some nodes in the document based on an XPath (subset)
157 expression. Used for debugging.
158
159 --postvalid
160 Validate after parsing has completed.
161
162 --push Use the push mode of the parser.
163
164 --recover
165 Output any parsable portions of an invalid document.
166
167 --relaxng SCHEMA
168 Use RelaxNG file named SCHEMA for validation.
169
170 --repeat
171 Repeat 100 times, for timing or profiling.
172
173 --schema SCHEMA
174 Use a W3C XML Schema file named SCHEMA for validation.
175
176 --shell
177 Run a navigating shell. Details on available commands in shell
178 mode are below (see the section called “SHELL COMMANDS”).
179
180 --stream
181 Use streaming API - useful when used in combination with
182 --relaxng or --valid options for validation of files that are
183 too large to be held in memory.
184
185 --testIO
186 Test user input/output support.
187
188 --timing
189 Output information about the time it takes xmllint to perform
190 the various steps.
191
192 --valid
193 Determine if the document is a valid instance of the included
194 Document Type Definition (DTD). A DTD to be validated against
195 also can be specified at the command line using the --dtdvalid
196 option. By default, xmllint also checks to determine if the
197 document is well-formed.
198
199 --version
200 Display the version of libxml(3) used.
201
202 --walker
203 Test the walker module, which is a reader interface but for a
204 document tree, instead of using the reader API on an unparsed
205 document it works on an existing in-memory tree. Used for
206 debugging.
207
208 --xinclude
209 Do XInclude processing.
210
211 --xmlout
212 Used in conjunction with --html. Usually when HTML is parsed the
213 document is saved with the HTML serializer. But with this option
214 the resulting document is saved with the XML serializer. This is
215 primarily used to generate XHTML from HTML input.
216
218 xmllint offers an interactive shell mode invoked with the --shell
219 command. Available commands in shell mode include (in alphabetical
220 order):
221
222 base Display XML base of the node.
223
224 bye Leave the shell.
225
226 cat NODE
227 Display the given node or the current one.
228
229 cd PATH
230 Change the current node to the given path (if unique) or root if
231 no argument is given.
232
233 dir PATH
234 Dumps information about the node (namespace, attributes,
235 content).
236
237 du PATH
238 Show the structure of the subtree under the given path or the
239 current node.
240
241 exit Leave the shell.
242
243 help Show this help.
244
245 free Display memory usage.
246
247 load FILENAME
248 Load a new document with the given filename.
249
250 ls PATH
251 List contents of the given path or the current directory.
252
253 pwd Display the path to the current node.
254
255 quit Leave the shell.
256
257 save FILENAME
258 Save the current document to the given filename or to the
259 original name.
260
261 validate
262 Check the document for errors.
263
264 write FILENAME
265 Write the current node to the given filename.
266
268 SGML_CATALOG_FILES
269 SGML catalog behavior can be changed by redirecting queries to
270 the user's own set of catalogs. This can be done by setting the
271 SGML_CATALOG_FILES environment variable to a list of catalogs.
272 An empty one should deactivate loading the default
273 /etc/sgml/catalog catalog.
274
275 XML_CATALOG_FILES
276 XML catalog behavior can be changed by redirecting queries to
277 the user's own set of catalogs. This can be done by setting the
278 XML_CATALOG_FILES environment variable to a list of catalogs. An
279 empty one should deactivate loading the default /etc/xml/catalog
280 catalog.
281
282 XML_DEBUG_CATALOG
283 Setting the environment variable XML_DEBUG_CATALOG to non-zero
284 using the export command outputs debugging information related
285 to catalog operations.
286
287 XMLLINT_INDENT
288 Setting the environment variable XMLLINT_INDENT controls the
289 indentation. The default value is two spaces " ".
290
292 xmllint return codes provide information that can be used when calling
293 it from scripts.
294
295 0 No error
296
297 1 Unclassified
298
299 2 Error in DTD
300
301 3 Validation error
302
303 4 Validation error
304
305 5 Error in schema compilation
306
307 6 Error writing output
308
309 7 Error in pattern (generated when --pattern option is used)
310
311 8 Error in Reader registration (generated when --chkregister
312 option is used)
313
314 9 Out of memory error
315
317 libxml(3)
318
319 More information can be found at
320
321 · libxml(3) web page http://www.xmlsoft.org/
322
323 · W3C XSLT page http://www.w3.org/TR/xslt
324
326 John Fleck <jfleck@inkstain.net>, Ziying Sherwin <sherwin@nlm.nih.gov>,
327 Heiko Rupp <hwr@pilhuhn.de>.
328
329
330
331libxml2 $Date$ XMLLINT(1)