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