1XMLLINT(1)                      xmllint Manual                      XMLLINT(1)
2
3
4

NAME

6       xmllint - command line XML tool
7

SYNOPSIS

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

DESCRIPTION

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

OPTIONS

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. Note that this works for full
80           document not fragments or result from XPath queries.
81
82       --format
83           Reformat and reindent the output. The XMLLINT_INDENT environment
84           variable controls the indentation. The default value is two spaces
85           " ").
86
87       --help
88           Print out a short usage summary for xmllint.
89
90       --html
91           Use the HTML parser.
92
93       --htmlout
94           Output results as an HTML file. This causes xmllint to output the
95           necessary HTML tags surrounding the result tree output so the
96           results can be displayed/viewed in a browser.
97
98       --insert
99           Test for valid insertions.
100
101       --loaddtd
102           Fetch an external DTD.
103
104       --load-trace
105           Display all the documents loaded during the processing to stderr.
106
107       --maxmem NNBYTES
108           Test the parser memory support.  NNBYTES is the maximum number of
109           bytes the library is allowed to allocate. This can also be used to
110           make sure batch processing of XML files will not exhaust the
111           virtual memory of the server running them.
112
113       --memory
114           Parse from memory.
115
116       --noblanks
117           Drop ignorable blank spaces.
118
119       --nocatalogs
120           Do not use any catalogs.
121
122       --nocdata
123           Substitute CDATA section by equivalent text nodes.
124
125       --noent
126           Substitute entity values for entity references. By default, xmllint
127           leaves entity references in place.
128
129       --nonet
130           Do not use the Internet to fetch DTDs or entities.
131
132       --noout
133           Suppress output. By default, xmllint outputs the result tree.
134
135       --nowarning
136           Do not emit warnings from the parser and/or validator.
137
138       --nowrap
139           Do not output HTML doc wrapper.
140
141       --noxincludenode
142           Do XInclude processing but do not generate XInclude start and end
143           nodes.
144
145       --nsclean
146           Remove redundant namespace declarations.
147
148       --output FILE
149           Define a file path where xmllint will save the result of parsing.
150           Usually the programs build a tree and save it on stdout, with this
151           option the result XML instance will be saved onto a file.
152
153       --path "PATH(S)"
154           Use the (space- or colon-separated) list of filesystem paths
155           specified by PATHS to load DTDs or entities. Enclose
156           space-separated lists by quotation marks.
157
158       --pattern PATTERNVALUE
159           Used to exercise the pattern recognition engine, which can be used
160           with the reader interface to the parser. It allows to select some
161           nodes in the document based on an XPath (subset) expression. Used
162           for debugging.
163
164       --postvalid
165           Validate after parsing has completed.
166
167       --push
168           Use the push mode of the parser.
169
170       --recover
171           Output any parsable portions of an invalid document.
172
173       --relaxng SCHEMA
174           Use RelaxNG file named SCHEMA for validation.
175
176       --repeat
177           Repeat 100 times, for timing or profiling.
178
179       --schema SCHEMA
180           Use a W3C XML Schema file named SCHEMA for validation.
181
182       --shell
183           Run a navigating shell. Details on available commands in shell mode
184           are below (see the section called “SHELL COMMANDS”).
185
186       --xpath "XPath_expression"
187           Run an XPath expression given as argument and print the result. In
188           case of a nodeset result, each node in the node set is serialized
189           in full in the output. In case of an empty node set the "XPath set
190           is empty" result will be shown and an error exit code will be
191           returned.
192
193       --stream
194           Use streaming API - useful when used in combination with --relaxng
195           or --valid options for validation of files that are too large to be
196           held in memory.
197
198       --testIO
199           Test user input/output support.
200
201       --timing
202           Output information about the time it takes xmllint to perform the
203           various steps.
204
205       --valid
206           Determine if the document is a valid instance of the included
207           Document Type Definition (DTD). A DTD to be validated against also
208           can be specified at the command line using the --dtdvalid option.
209           By default, xmllint also checks to determine if the document is
210           well-formed.
211
212       --version
213           Display the version of libxml(3) used.
214
215       --walker
216           Test the walker module, which is a reader interface but for a
217           document tree, instead of using the reader API on an unparsed
218           document it works on an existing in-memory tree. Used for
219           debugging.
220
221       --xinclude
222           Do XInclude processing.
223
224       --xmlout
225           Used in conjunction with --html. Usually when HTML is parsed the
226           document is saved with the HTML serializer. But with this option
227           the resulting document is saved with the XML serializer. This is
228           primarily used to generate XHTML from HTML input.
229

SHELL COMMANDS

231       xmllint offers an interactive shell mode invoked with the --shell
232       command. Available commands in shell mode include (in alphabetical
233       order):
234
235       base
236           Display XML base of the node.
237
238       bye
239           Leave the shell.
240
241       cat NODE
242           Display the given node or the current one.
243
244       cd PATH
245           Change the current node to the given path (if unique) or root if no
246           argument is given.
247
248       dir PATH
249           Dumps information about the node (namespace, attributes, content).
250
251       du PATH
252           Show the structure of the subtree under the given path or the
253           current node.
254
255       exit
256           Leave the shell.
257
258       help
259           Show this help.
260
261       free
262           Display memory usage.
263
264       load FILENAME
265           Load a new document with the given filename.
266
267       ls PATH
268           List contents of the given path or the current directory.
269
270       pwd
271           Display the path to the current node.
272
273       quit
274           Leave the shell.
275
276       save FILENAME
277           Save the current document to the given filename or to the original
278           name.
279
280       validate
281           Check the document for errors.
282
283       write FILENAME
284           Write the current node to the given filename.
285

ENVIRONMENT

287       SGML_CATALOG_FILES
288           SGML catalog behavior can be changed by redirecting queries to the
289           user's own set of catalogs. This can be done by setting the
290           SGML_CATALOG_FILES environment variable to a list of catalogs. An
291           empty one should deactivate loading the default /etc/sgml/catalog
292           catalog.
293
294       XML_CATALOG_FILES
295           XML catalog behavior can be changed by redirecting queries to the
296           user's own set of catalogs. This can be done by setting the
297           XML_CATALOG_FILES environment variable to a space-separated list of
298           catalogs. Use percent-encoding to escape spaces or other
299           characters. An empty variable should deactivate loading the default
300           /etc/xml/catalog catalog.
301
302       XML_DEBUG_CATALOG
303           Setting the environment variable XML_DEBUG_CATALOG to non-zero
304           using the export command outputs debugging information related to
305           catalog operations.
306
307       XMLLINT_INDENT
308           Setting the environment variable XMLLINT_INDENT controls the
309           indentation. The default value is two spaces " ".
310

DIAGNOSTICS

312       xmllint return codes provide information that can be used when calling
313       it from scripts.
314
315       0
316           No error
317
318       1
319           Unclassified
320
321       2
322           Error in DTD
323
324       3
325           Validation error
326
327       4
328           Validation error
329
330       5
331           Error in schema compilation
332
333       6
334           Error writing output
335
336       7
337           Error in pattern (generated when --pattern option is used)
338
339       8
340           Error in Reader registration (generated when --chkregister option
341           is used)
342
343       9
344           Out of memory error
345
346       10
347           XPath evaluation error
348

SEE ALSO

350       libxml(3)
351
352       More information can be found at
353
354       •   libxml(3) web page https://gitlab.gnome.org/GNOME/libxml2
355
356

AUTHORS

358       John Fleck <jfleck@inkstain.net>
359           Author.
360
361       Ziying Sherwin <sherwin@nlm.nih.gov>
362           Author.
363
364       Heiko Rupp <hwr@pilhuhn.de>
365           Author.
366
368       Copyright © 2001, 2004
369
370
371
372libxml2                           08/17/2022                        XMLLINT(1)
Impressum