xmllint.xml revision 877a7bd6a35fae1dddb88bfb7af838ed8c369498
1<?xml version="1.0"?>
2<?xml-stylesheet type="text/xsl"
3   href="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"?>
4<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
5    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
6]>
7<refentry>
8  <refentryinfo>
9    <title>xmllint Manual</title>
10    <copyright>
11      <year>2001</year>
12    </copyright>
13    <author>
14      <firstname>John</firstname>
15      <surname>Fleck</surname>
16    </author>
17    <address><email>jfleck@inkstain.net</email></address>
18    <author>
19      <firstname>Ziying</firstname>
20      <surname>Sherwin</surname>
21    </author>
22    <address><email>sherwin@nlm.nih.gov</email></address>
23    <author>
24      <firstname>Heiko</firstname>
25      <surname>Rupp</surname>
26    </author>
27    <address><email>hwr@pilhuhn.de</email></address>
28    
29    <releaseinfo>This is release 0.2 of the xmllint Manual.</releaseinfo>
30  </refentryinfo>
31
32  <refmeta>
33    <refentrytitle>xmllint</refentrytitle>
34    <manvolnum>1</manvolnum>
35  </refmeta>
36
37  <refnamediv>
38    <refname>xmllint</refname>
39    <refpurpose>command line <acronym>XML</acronym> tool</refpurpose>
40  </refnamediv>
41
42  <refsynopsisdiv>
43    <cmdsynopsis>
44      <command>xmllint</command>
45      <group>
46	<arg>--version</arg>
47	<arg>--debug</arg>
48	<arg>--shell</arg>
49	<arg>--debugent</arg>
50	<arg>--copy</arg>
51	<arg>--recover</arg>
52	<arg>--noent</arg>
53	<arg>--noout</arg>
54	<arg>--htmlout</arg>
55	<arg>--nowrap</arg>
56	<arg>--valid</arg>
57	<arg>--postvalid</arg>
58	<arg>--dtdvalid <replaceable>URL</replaceable></arg>
59	<arg>--dtdvalidfpi <replaceable>FPI</replaceable></arg>
60	<arg>--timing</arg>
61	<arg>--repeat</arg>
62	<arg>--insert</arg>
63	<arg>--compress</arg>
64	<arg>--html</arg>
65	<arg>--push</arg>
66	<arg>--memory</arg>
67	<arg>--nowarning</arg>
68	<arg>--noblanks</arg>
69	<arg>--format</arg>
70	<arg>--testIO</arg>
71	<arg>--encode <replaceable>encoding</replaceable></arg>
72	<arg>--catalogs</arg>
73	<arg>--nocatalogs</arg>
74	<arg>--auto</arg>
75	<arg>--xinclude</arg>
76	<arg>--loaddtd</arg>
77	<arg>--dtdattr</arg>
78	<arg>--dropdtd</arg>
79	<arg>--stream</arg>
80	<arg>--chkregister</arg>
81	<arg>--relaxng</arg>
82	<arg>--schema</arg>
83	<arg>--nonet</arg>
84      </group>
85      <arg><option><replaceable>xmlfile</replaceable></option></arg>
86  </cmdsynopsis>
87  </refsynopsisdiv>
88
89  <refsect1 id="introduction">
90    <title>Introduction</title>
91    <para>
92      The xmllint program parses one or more XML files, specified on the
93      command line as <replaceable>xmlfile</replaceable>. It prints various
94      types of output, depending upon the options selected. It is useful for
95      detecting errors both in <acronym>XML</acronym> code and in the
96      <acronym>XML</acronym> parser itself.
97    </para>
98
99    <para>
100      It is included in <application>libxml2</application>.
101    </para>
102  </refsect1>
103  <refsect1 id="options">
104    <title>Options</title>
105    <variablelist>
106      <varlistentry>
107	<term><option>--version</option></term>
108	<listitem>
109	  <simpara>
110	    Display the version of
111	    <application>libxml2</application> used.
112	  </simpara>
113	</listitem>
114      </varlistentry>
115
116      <varlistentry>
117	<term><option>--debug</option></term>
118	<listitem>
119	  <simpara>
120	    Parse a file and output an annotated tree of the
121	    in-memory version of the document.
122	  </simpara>
123	</listitem>
124      </varlistentry>
125
126      <varlistentry>
127	<term><option>--shell</option></term>
128	<listitem>
129	  <simpara>
130	    Run a navigating shell. Details on available commands in shell mode
131	    are below.
132	  </simpara>
133	</listitem>
134      </varlistentry>
135
136      <varlistentry>
137	<term><option>--debugent</option></term>
138	<listitem>
139	  <simpara>
140	    Debug the entities defined in the document.
141	  </simpara>
142	</listitem>
143      </varlistentry>
144
145      <varlistentry>
146	<term><option>--copy</option> </term>
147	<listitem>
148	  <simpara>
149	    Test the internal copy implementation.
150	  </simpara>
151	</listitem>
152      </varlistentry>
153    
154      
155      <varlistentry>
156	<term><option>--recover</option></term>
157	<listitem>
158	  <simpara>
159	    Output any parsable portions of an invalid
160	    document.
161	  </simpara>
162	</listitem>
163      </varlistentry>
164
165      <varlistentry>
166	<term><option>--noent</option></term>
167	<listitem>
168	  <simpara>
169	    Substitute entity values for entity
170	    references. By default, <application>xmllint</application> leaves entity
171	    references in place.
172	  </simpara>
173	</listitem>
174      </varlistentry>
175   
176      <varlistentry>
177	<term><option>--noout</option></term>
178	<listitem>
179	  <simpara>
180	    Suppress output. By default,
181	    <application>xmllint</application> outputs the result tree.
182	  </simpara>
183	</listitem>
184      </varlistentry>
185
186    <varlistentry>
187	<term><option>--htmlout</option></term>
188	<listitem>
189	  <simpara>
190	    Output results as an <acronym>HTML</acronym>
191	    file. This causes <application>xmllint</application> to output
192	    the necessary <acronym>HTML</acronym> tags surrounding the result tree
193	    output so the results can be displayed in a browser. 
194	  </simpara>
195	</listitem>
196      </varlistentry>
197
198    <varlistentry>
199	<term><option>--nowrap </option></term>
200	<listitem>
201	  <simpara>
202	    Do not output HTML doc wrapper.
203	  </simpara>
204	</listitem>
205      </varlistentry>
206
207<varlistentry>
208	<term><option>--valid </option></term>
209	<listitem>
210	  <simpara>
211	    Determine if the document is a valid instance
212	    of the included Document Type Definition (<acronym>DTD</acronym>). A
213	    <acronym>DTD</acronym> to be validated against also can be specified at
214	    the command line using the <option>--dtdvalid</option> option. By default,
215	    <application>xmllint</application> also checks to determine if the
216	    document is well-formed.
217	  </simpara>
218	</listitem>
219      </varlistentry>
220   
221 <varlistentry>
222	<term><option>--postvalid</option></term>
223	<listitem>
224	  <simpara>
225	    Validate after parsing is completed.
226	  </simpara>
227	</listitem>
228      </varlistentry>
229   
230    <varlistentry>
231	<term> <option>--dtdvalid</option> <replaceable>URL</replaceable></term>
232	<listitem>
233	  <simpara>
234	    Use the
235      <acronym>DTD</acronym> specified by <replaceable>URL</replaceable> for
236      validation.
237	  </simpara>
238	</listitem>
239      </varlistentry>
240   
241    <varlistentry>
242	<term> <option>--dtdvalidfpi</option> <replaceable>FPI</replaceable></term>
243	<listitem>
244	  <simpara>
245	    Use the
246      <acronym>DTD</acronym> specified by the Public Identifier
247      <replaceable>FPI</replaceable> for validation, note that this
248      will require a Catalog exporting that Public Identifier to work.
249	  </simpara>
250	</listitem>
251      </varlistentry>
252   
253     <varlistentry>
254	<term><option>--timing</option></term>
255	<listitem>
256	  <simpara>
257	    Output information about the time it takes
258	    <application>xmllint</application> to perform the various steps.
259	  </simpara>
260	</listitem>
261      </varlistentry>
262
263   <varlistentry>
264	<term><option>--repeat</option></term>
265	<listitem>
266	  <simpara>
267	    Repeat 100 times, for timing or profiling.
268	  </simpara>
269	</listitem>
270      </varlistentry>
271   
272    <varlistentry>
273	<term><option>--insert</option></term>
274	<listitem>
275	  <simpara>
276	    Test for valid insertions.
277	  </simpara>
278	</listitem>
279      </varlistentry>
280
281      <varlistentry>
282	<term><option>--compress</option></term>
283	<listitem>
284	  <simpara>
285	    Turn on gzip compression of output.
286	  </simpara>
287	</listitem>
288      </varlistentry>
289   
290    <varlistentry>
291	<term><option>--html</option></term>
292	<listitem>
293	  <simpara>
294	    Use the <acronym>HTML</acronym> parser.
295	  </simpara>
296	</listitem>
297      </varlistentry>
298   
299    <varlistentry>
300	<term><option>--push</option></term>
301	<listitem>
302	  <simpara>
303	    Use the push mode of the parser.
304	  </simpara>
305	</listitem>
306      </varlistentry>
307   
308
309    <varlistentry>
310	<term><option>--memory</option></term>
311	<listitem>
312	  <simpara>
313	   Parse from memory.
314	  </simpara>
315	</listitem>
316      </varlistentry>
317
318    <varlistentry>
319	<term><option>--nowarning</option></term>
320	<listitem>
321	  <simpara>
322	   Do not emit warnings from the parser and/or validator.
323	  </simpara>
324	</listitem>
325      </varlistentry>
326
327    <varlistentry>
328	<term><option>--noblanks</option></term>
329	<listitem>
330	  <simpara>
331	   Drop ignorable blank spaces.
332	  </simpara>
333	</listitem>
334      </varlistentry>
335
336    <varlistentry>
337	<term><option>--format</option></term>
338	<listitem>
339	  <simpara>
340	   Reformat and reindent the output. The $XMLLINT_INDENT
341	   environment variable controls the indentation (default 
342	   value is two spaces &quot;  &quot;).
343	  </simpara>
344	</listitem>
345      </varlistentry>
346
347    <varlistentry>
348	<term><option>--testIO</option></term>
349	<listitem>
350	  <simpara>
351	   Test user input/output support.
352	  </simpara>
353	</listitem>
354      </varlistentry>
355
356    <varlistentry>
357      <term><option>--encode</option> <replaceable>encoding</replaceable></term>
358	<listitem>
359	  <simpara>
360	   Output in the given encoding.
361	  </simpara>
362	</listitem>
363      </varlistentry>
364    
365    <varlistentry>
366	<term><option>--catalogs</option></term>
367	<listitem>
368	  <simpara>
369	   Use the catalogs from $SGML_CATALOG_FILES. Otherwise /etc/xml/catalog
370	   is used by default.
371	  </simpara>
372	</listitem>
373      </varlistentry>
374
375    <varlistentry>
376	<term><option>--nocatalogs</option></term>
377	<listitem>
378	  <simpara>
379	   Do not use any catalogs.
380	  </simpara>
381	</listitem>
382      </varlistentry>
383    
384    <varlistentry>
385	<term><option>--auto</option></term>
386	<listitem>
387	  <simpara>
388	   Generate a small document for testing purposes.
389	  </simpara>
390	</listitem>
391      </varlistentry>
392
393    <varlistentry>
394	<term><option>--xinclude</option></term>
395	<listitem>
396	  <simpara>
397	   Do XInclude processing.
398	  </simpara>
399	</listitem>
400      </varlistentry>
401    <varlistentry>
402	<term><option>--loaddtd</option></term>
403	<listitem>
404	  <simpara>
405	   Fetch external DTD.
406	  </simpara>
407	</listitem>
408      </varlistentry>
409    
410    <varlistentry>
411	<term><option>--dtdattr</option></term>
412	<listitem>
413	  <simpara>
414	   Fetch external DTD and populate the tree with inherited attributes.
415	  </simpara>
416	</listitem>
417      </varlistentry>
418      <varlistentry>
419	<term><option>--dropdtd</option></term>
420	<listitem>
421	  <simpara>
422	    Remove <acronym>DTD</acronym> from output.
423	  </simpara>
424	</listitem>
425      </varlistentry>
426      <varlistentry>
427	<term><option>--stream</option></term>
428	<listitem>
429	  <simpara>Use streaming API - useful when  used  in combination with
430              --relaxng or --valid options for validation of files that are
431	    too large to be held in memory.</simpara> 
432	</listitem>
433      </varlistentry>
434      <varlistentry>
435	<term><option>--chkregister</option></term>
436	<listitem>
437	  <simpara>Turn on node registration. Useful for developeres testing
438	  libxml2 node tracking code.</simpara>
439	</listitem>
440      </varlistentry>
441      <varlistentry>
442	<term><option>--relaxng</option> <replaceable>schema</replaceable></term>
443	<listitem>
444	  <simpara>Use RelaxNG file named <replaceable>schema</replaceable> for
445	  validation.</simpara>
446	</listitem>
447      </varlistentry>
448      <varlistentry>
449	<term><option>--schema</option> <replaceable>schema</replaceable></term>
450	<listitem>
451	  <simpara>Use a W3C XML Schema file named <replaceable>schema</replaceable> for validation.</simpara>
452	</listitem>
453      </varlistentry>
454      <varlistentry>
455	<term>
456      <option>--nonet</option></term>
457	<listitem>
458	  <simpara>Do not use the Internet to fetch DTD's or entities.</simpara>
459	</listitem>
460      </varlistentry>
461    </variablelist>
462  </refsect1>
463
464  <refsect1 id="shell">
465    <title>Shell</title>
466    <para>
467      <application>xmllint</application> offers an interactive shell mode
468      invoked with the <option>--shell</option> command. Available commands in
469      shell mode include:
470    </para>
471    <variablelist>
472      <varlistentry>
473	<term><option>base</option></term>
474	<listitem>
475	  <simpara>
476	    display XML base of the node
477	  </simpara>
478	</listitem>
479      </varlistentry>
480      <varlistentry>
481	<term><option>bye</option></term>
482	<listitem>
483	  <simpara>
484	    leave shell
485	  </simpara>
486	</listitem>
487      </varlistentry>
488      <varlistentry>
489	<term><option>cat <replaceable>node</replaceable></option></term>
490	<listitem>
491	  <simpara>
492	    Display node if given or current node.
493	  </simpara>
494	</listitem>
495      </varlistentry>
496      <varlistentry>
497	<term><option>cd <replaceable>path</replaceable></option></term>
498	<listitem>
499	  <simpara>
500	    Change the current node to <replaceable>path</replaceable> (if given
501	    and unique) or root if no argument given.
502	  </simpara>
503	</listitem>
504      </varlistentry>
505      <varlistentry>
506	<term><option>dir <replaceable>path</replaceable></option></term>
507	<listitem>
508	  <simpara>
509	    Dumps information about the node (namespace, attributes, content).
510	  </simpara>
511	</listitem>
512      </varlistentry>
513      <varlistentry>
514	<term><option>du <replaceable>path</replaceable></option></term>
515	<listitem>
516	  <simpara>
517	    Show the structure of the subtree under path or the current node.
518	  </simpara>
519	</listitem>
520      </varlistentry>
521      <varlistentry>
522	<term><option>exit</option></term>
523	<listitem>
524	  <simpara>
525	    Leave the shell.
526	  </simpara>
527	</listitem>
528      </varlistentry>
529      <varlistentry>
530	<term><option>help</option></term>
531	<listitem>
532	  <simpara>
533	    Show this help.
534	  </simpara>
535	</listitem>
536      </varlistentry>
537      <varlistentry>
538	<term><option>free</option></term>
539	<listitem>
540	  <simpara>
541	    Display memory usage.
542	  </simpara>
543	</listitem>
544      </varlistentry>
545      <varlistentry>
546	<term><option>load <replaceable>name</replaceable></option></term>
547	<listitem>
548	  <simpara>
549	    Load a new document with the given name.
550	  </simpara>
551	</listitem>
552      </varlistentry>
553      <varlistentry>
554	<term><option>ls <replaceable>path</replaceable></option></term>
555	<listitem>
556	  <simpara>
557	    List contents of <replaceable>path</replaceable> (if given) or the
558	    current directory.
559	  </simpara>
560	</listitem>
561      </varlistentry>
562      <varlistentry>
563	<term><option>pwd</option></term>
564	<listitem>
565	  <simpara>
566	    Display the path to the current node.
567	  </simpara>
568	</listitem>
569      </varlistentry>
570      <varlistentry>
571	<term><option>quit</option></term>
572	<listitem>
573	  <simpara>
574	    Leave the shell.
575	  </simpara>
576	</listitem>
577      </varlistentry>
578      <varlistentry>
579	<term><option>save <replaceable>name</replaceable></option></term>
580	<listitem>
581	  <simpara>
582	    Saves the current document to <replaceable>name</replaceable> if
583	    given or to the original name.
584	  </simpara>
585	</listitem>
586      </varlistentry>
587      <varlistentry>
588	<term><option>validate</option></term>
589	<listitem>
590	  <simpara>
591	    Check the document for error.
592	  </simpara>
593	</listitem>
594      </varlistentry>
595      <varlistentry>
596	<term><option>write <replaceable>name</replaceable></option></term>
597	<listitem>
598	  <simpara>
599	    Write the current node to the given filename.
600	  </simpara>
601	</listitem>
602      </varlistentry>
603     
604    </variablelist>
605  </refsect1>
606  <refsect1>
607    <title>Debugging Catalogs</title>
608    <para>Setting the environment variable <varname>XML_DEBUG_CATALOG</varname>
609    using the command <command>&quot;export XML_DEBUG_CATALOG=&quot;</command>
610    outputs debugging information related to catalog operations.</para>
611  </refsect1>
612</refentry>
613