1: '\" t
2: .\" Title: xmllint
3: .\" Author: John Fleck <jfleck@inkstain.net>
4: .\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
5: .\" Date: $Date: 2014/06/15 19:53:35 $
6: .\" Manual: xmllint Manual
7: .\" Source: libxml2
8: .\" Language: English
9: .\"
10: .TH "XMLLINT" "1" "$Date: 2014/06/15 19:53:35 $" "libxml2" "xmllint Manual"
11: .\" -----------------------------------------------------------------
12: .\" * Define some portability stuff
13: .\" -----------------------------------------------------------------
14: .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15: .\" http://bugs.debian.org/507673
16: .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17: .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18: .ie \n(.g .ds Aq \(aq
19: .el .ds Aq '
20: .\" -----------------------------------------------------------------
21: .\" * set default formatting
22: .\" -----------------------------------------------------------------
23: .\" disable hyphenation
24: .nh
25: .\" disable justification (adjust text to left margin only)
26: .ad l
27: .\" -----------------------------------------------------------------
28: .\" * MAIN CONTENT STARTS HERE *
29: .\" -----------------------------------------------------------------
30: .SH "NAME"
31: xmllint \- command line XML tool
32: .SH "SYNOPSIS"
33: .HP \w'\fBxmllint\fR\ 'u
34: \fBxmllint\fR [\fB\-\-version\fR | \fB\-\-debug\fR | \fB\-\-shell\fR | \fB\-\-xpath\ "\fR\fB\fIXPath_expression\fR\fR\fB"\fR | \fB\-\-debugent\fR | \fB\-\-copy\fR | \fB\-\-recover\fR | \fB\-\-noent\fR | \fB\-\-noout\fR | \fB\-\-nonet\fR | \fB\-\-path\ "\fR\fB\fIPATH(S)\fR\fR\fB"\fR | \fB\-\-load\-trace\fR | \fB\-\-htmlout\fR | \fB\-\-nowrap\fR | \fB\-\-valid\fR | \fB\-\-postvalid\fR | \fB\-\-dtdvalid\ \fR\fB\fIURL\fR\fR | \fB\-\-dtdvalidfpi\ \fR\fB\fIFPI\fR\fR | \fB\-\-timing\fR | \fB\-\-output\ \fR\fB\fIFILE\fR\fR | \fB\-\-repeat\fR | \fB\-\-insert\fR | \fB\-\-compress\fR | \fB\-\-html\fR | \fB\-\-xmlout\fR | \fB\-\-push\fR | \fB\-\-memory\fR | \fB\-\-maxmem\ \fR\fB\fINBBYTES\fR\fR | \fB\-\-nowarning\fR | \fB\-\-noblanks\fR | \fB\-\-nocdata\fR | \fB\-\-format\fR | \fB\-\-encode\ \fR\fB\fIENCODING\fR\fR | \fB\-\-dropdtd\fR | \fB\-\-nsclean\fR | \fB\-\-testIO\fR | \fB\-\-catalogs\fR | \fB\-\-nocatalogs\fR | \fB\-\-auto\fR | \fB\-\-xinclude\fR | \fB\-\-noxincludenode\fR | \fB\-\-loaddtd\fR | \fB\-\-dtdattr\fR | \fB\-\-stream\fR | \fB\-\-walker\fR | \fB\-\-pattern\ \fR\fB\fIPATTERNVALUE\fR\fR | \fB\-\-chkregister\fR | \fB\-\-relaxng\ \fR\fB\fISCHEMA\fR\fR | \fB\-\-schema\ \fR\fB\fISCHEMA\fR\fR | \fB\-\-c14n\fR] {\fIXML\-FILE(S)\fR... | \-}
35: .HP \w'\fBxmllint\fR\ 'u
36: \fBxmllint\fR \fB\-\-help\fR
37: .SH "DESCRIPTION"
38: .PP
39: The
40: \fBxmllint\fR
41: program parses one or more
42: XML
43: files, specified on the command line as
44: \fIXML\-FILE\fR
45: (or the standard input if the filename provided is
46: \fB\-\fR
47: )\&. It prints various types of output, depending upon the options selected\&. It is useful for detecting errors both in
48: XML
49: code and in the
50: XML
51: parser itself\&.
52: .PP
53: \fBxmllint\fR
54: is included in
55: \fBlibxml\fR(3)\&.
56: .SH "OPTIONS"
57: .PP
58:
59: \fBxmllint\fR
60: accepts the following options (in alphabetical order):
61: .PP
62: \fB\-\-auto\fR
63: .RS 4
64: Generate a small document for testing purposes\&.
65: .RE
66: .PP
67: \fB\-\-catalogs\fR
68: .RS 4
69: Use the
70: SGML
71: catalog(s) from
72: \fBSGML_CATALOG_FILES\fR\&. Otherwise
73: XML
74: catalogs starting from
75: /etc/xml/catalog
76: are used by default\&.
77: .RE
78: .PP
79: \fB\-\-chkregister\fR
80: .RS 4
81: Turn on node registration\&. Useful for developers testing
82: \fBlibxml\fR(3)
83: node tracking code\&.
84: .RE
85: .PP
86: \fB\-\-compress\fR
87: .RS 4
88: Turn on
89: \fBgzip\fR(1)
90: compression of output\&.
91: .RE
92: .PP
93: \fB\-\-copy\fR
94: .RS 4
95: Test the internal copy implementation\&.
96: .RE
97: .PP
98: \fB\-\-c14n\fR
99: .RS 4
100: Use the W3C
101: XML
102: Canonicalisation (C14N) to serialize the result of parsing to
103: stdout\&. It keeps comments in the result\&.
104: .RE
105: .PP
106: \fB\-\-dtdvalid \fR\fB\fIURL\fR\fR
107: .RS 4
108: Use the
109: DTD
110: specified by an
111: \fIURL\fR
112: for validation\&.
113: .RE
114: .PP
115: \fB\-\-dtdvalidfpi \fR\fB\fIFPI\fR\fR
116: .RS 4
117: Use the
118: DTD
119: specified by a Formal Public Identifier
120: \fIFPI\fR
121: for validation, note that this will require a catalog exporting that Formal Public Identifier to work\&.
122: .RE
123: .PP
124: \fB\-\-debug\fR
125: .RS 4
126: Parse a file and output an annotated tree of the in\-memory version of the document\&.
127: .RE
128: .PP
129: \fB\-\-debugent\fR
130: .RS 4
131: Debug the entities defined in the document\&.
132: .RE
133: .PP
134: \fB\-\-dropdtd\fR
135: .RS 4
136: Remove
137: DTD
138: from output\&.
139: .RE
140: .PP
141: \fB\-\-dtdattr\fR
142: .RS 4
143: Fetch external
144: DTD
145: and populate the tree with inherited attributes\&.
146: .RE
147: .PP
148: \fB\-\-encode \fR\fB\fIENCODING\fR\fR
149: .RS 4
150: Output in the given encoding\&.
151: .RE
152: .PP
153: \fB\-\-format\fR
154: .RS 4
155: Reformat and reindent the output\&. The
156: \fBXMLLINT_INDENT\fR
157: environment variable controls the indentation\&. The default value is two spaces " ")\&.
158: .RE
159: .PP
160: \fB\-\-help\fR
161: .RS 4
162: Print out a short usage summary for
163: \fBxmllint\fR\&.
164: .RE
165: .PP
166: \fB\-\-html\fR
167: .RS 4
168: Use the
169: HTML
170: parser\&.
171: .RE
172: .PP
173: \fB\-\-htmlout\fR
174: .RS 4
175: Output results as an
176: HTML
177: file\&. This causes
178: \fBxmllint\fR
179: to output the necessary
180: HTML
181: tags surrounding the result tree output so the results can be displayed/viewed in a browser\&.
182: .RE
183: .PP
184: \fB\-\-insert\fR
185: .RS 4
186: Test for valid insertions\&.
187: .RE
188: .PP
189: \fB\-\-loaddtd\fR
190: .RS 4
191: Fetch an external
192: DTD\&.
193: .RE
194: .PP
195: \fB\-\-load\-trace\fR
196: .RS 4
197: Display all the documents loaded during the processing to
198: stderr\&.
199: .RE
200: .PP
201: \fB\-\-maxmem \fR\fB\fINNBYTES\fR\fR
202: .RS 4
203: Test the parser memory support\&.
204: \fINNBYTES\fR
205: is the maximum number of bytes the library is allowed to allocate\&. This can also be used to make sure batch processing of
206: XML
207: files will not exhaust the virtual memory of the server running them\&.
208: .RE
209: .PP
210: \fB\-\-memory\fR
211: .RS 4
212: Parse from memory\&.
213: .RE
214: .PP
215: \fB\-\-noblanks\fR
216: .RS 4
217: Drop ignorable blank spaces\&.
218: .RE
219: .PP
220: \fB\-\-nocatalogs\fR
221: .RS 4
222: Do not use any catalogs\&.
223: .RE
224: .PP
225: \fB\-\-nocdata\fR
226: .RS 4
227: Substitute CDATA section by equivalent text nodes\&.
228: .RE
229: .PP
230: \fB\-\-noent\fR
231: .RS 4
232: Substitute entity values for entity references\&. By default,
233: \fBxmllint\fR
234: leaves entity references in place\&.
235: .RE
236: .PP
237: \fB\-\-nonet\fR
238: .RS 4
239: Do not use the Internet to fetch
240: DTDs or entities\&.
241: .RE
242: .PP
243: \fB\-\-noout\fR
244: .RS 4
245: Suppress output\&. By default,
246: \fBxmllint\fR
247: outputs the result tree\&.
248: .RE
249: .PP
250: \fB\-\-nowarning\fR
251: .RS 4
252: Do not emit warnings from the parser and/or validator\&.
253: .RE
254: .PP
255: \fB\-\-nowrap\fR
256: .RS 4
257: Do not output
258: HTML
259: doc wrapper\&.
260: .RE
261: .PP
262: \fB\-\-noxincludenode\fR
263: .RS 4
264: Do XInclude processing but do not generate XInclude start and end nodes\&.
265: .RE
266: .PP
267: \fB\-\-nsclean\fR
268: .RS 4
269: Remove redundant namespace declarations\&.
270: .RE
271: .PP
272: \fB\-\-output \fR\fB\fIFILE\fR\fR
273: .RS 4
274: Define a file path where
275: \fBxmllint\fR
276: will save the result of parsing\&. Usually the programs build a tree and save it on
277: stdout, with this option the result
278: XML
279: instance will be saved onto a file\&.
280: .RE
281: .PP
282: \fB\-\-path "\fR\fB\fIPATH(S)\fR\fR\fB"\fR
283: .RS 4
284: Use the (space\- or colon\-separated) list of filesystem paths specified by
285: \fIPATHS\fR
286: to load
287: DTDs or entities\&. Enclose space\-separated lists by quotation marks\&.
288: .RE
289: .PP
290: \fB\-\-pattern \fR\fB\fIPATTERNVALUE\fR\fR
291: .RS 4
292: Used to exercise the pattern recognition engine, which can be used with the reader interface to the parser\&. It allows to select some nodes in the document based on an XPath (subset) expression\&. Used for debugging\&.
293: .RE
294: .PP
295: \fB\-\-postvalid\fR
296: .RS 4
297: Validate after parsing has completed\&.
298: .RE
299: .PP
300: \fB\-\-push\fR
301: .RS 4
302: Use the push mode of the parser\&.
303: .RE
304: .PP
305: \fB\-\-recover\fR
306: .RS 4
307: Output any parsable portions of an invalid document\&.
308: .RE
309: .PP
310: \fB\-\-relaxng \fR\fB\fISCHEMA\fR\fR
311: .RS 4
312: Use RelaxNG file named
313: \fISCHEMA\fR
314: for validation\&.
315: .RE
316: .PP
317: \fB\-\-repeat\fR
318: .RS 4
319: Repeat 100 times, for timing or profiling\&.
320: .RE
321: .PP
322: \fB\-\-schema \fR\fB\fISCHEMA\fR\fR
323: .RS 4
324: Use a W3C
325: XML
326: Schema file named
327: \fISCHEMA\fR
328: for validation\&.
329: .RE
330: .PP
331: \fB\-\-shell\fR
332: .RS 4
333: Run a navigating shell\&. Details on available commands in shell mode are below (see
334: the section called \(lqSHELL COMMANDS\(rq)\&.
335: .RE
336: .PP
337: \fB\-\-xpath "\fR\fB\fIXPath_expression\fR\fR\fB"\fR
338: .RS 4
339: Run an XPath expression given as argument and print the result\&. In case of a nodeset result, each node in the node set is serialized in full in the output\&. In case of an empty node set the "XPath set is empty" result will be shown and an error exit code will be returned\&.
340: .RE
341: .PP
342: \fB\-\-stream\fR
343: .RS 4
344: Use streaming
345: API
346: \- useful when used in combination with
347: \fB\-\-relaxng\fR
348: or
349: \fB\-\-valid\fR
350: options for validation of files that are too large to be held in memory\&.
351: .RE
352: .PP
353: \fB\-\-testIO\fR
354: .RS 4
355: Test user input/output support\&.
356: .RE
357: .PP
358: \fB\-\-timing\fR
359: .RS 4
360: Output information about the time it takes
361: \fBxmllint\fR
362: to perform the various steps\&.
363: .RE
364: .PP
365: \fB\-\-valid\fR
366: .RS 4
367: Determine if the document is a valid instance of the included Document Type Definition (DTD)\&. A
368: DTD
369: to be validated against also can be specified at the command line using the
370: \fB\-\-dtdvalid\fR
371: option\&. By default,
372: \fBxmllint\fR
373: also checks to determine if the document is well\-formed\&.
374: .RE
375: .PP
376: \fB\-\-version\fR
377: .RS 4
378: Display the version of
379: \fBlibxml\fR(3)
380: used\&.
381: .RE
382: .PP
383: \fB\-\-walker\fR
384: .RS 4
385: Test the walker module, which is a reader interface but for a document tree, instead of using the reader
386: API
387: on an unparsed document it works on an existing in\-memory tree\&. Used for debugging\&.
388: .RE
389: .PP
390: \fB\-\-xinclude\fR
391: .RS 4
392: Do XInclude processing\&.
393: .RE
394: .PP
395: \fB\-\-xmlout\fR
396: .RS 4
397: Used in conjunction with
398: \fB\-\-html\fR\&. Usually when
399: HTML
400: is parsed the document is saved with the
401: HTML
402: serializer\&. But with this option the resulting document is saved with the
403: XML
404: serializer\&. This is primarily used to generate
405: XHTML
406: from
407: HTML
408: input\&.
409: .RE
410: .SH "SHELL COMMANDS"
411: .PP
412:
413: \fBxmllint\fR
414: offers an interactive shell mode invoked with the
415: \fB\-\-shell\fR
416: command\&. Available commands in shell mode include (in alphabetical order):
417: .PP
418: \fBbase\fR
419: .RS 4
420: Display
421: XML
422: base of the node\&.
423: .RE
424: .PP
425: \fBbye\fR
426: .RS 4
427: Leave the shell\&.
428: .RE
429: .PP
430: \fBcat \fR\fB\fINODE\fR\fR
431: .RS 4
432: Display the given node or the current one\&.
433: .RE
434: .PP
435: \fBcd \fR\fB\fIPATH\fR\fR
436: .RS 4
437: Change the current node to the given path (if unique) or root if no argument is given\&.
438: .RE
439: .PP
440: \fBdir \fR\fB\fIPATH\fR\fR
441: .RS 4
442: Dumps information about the node (namespace, attributes, content)\&.
443: .RE
444: .PP
445: \fBdu \fR\fB\fIPATH\fR\fR
446: .RS 4
447: Show the structure of the subtree under the given path or the current node\&.
448: .RE
449: .PP
450: \fBexit\fR
451: .RS 4
452: Leave the shell\&.
453: .RE
454: .PP
455: \fBhelp\fR
456: .RS 4
457: Show this help\&.
458: .RE
459: .PP
460: \fBfree\fR
461: .RS 4
462: Display memory usage\&.
463: .RE
464: .PP
465: \fBload \fR\fB\fIFILENAME\fR\fR
466: .RS 4
467: Load a new document with the given filename\&.
468: .RE
469: .PP
470: \fBls \fR\fB\fIPATH\fR\fR
471: .RS 4
472: List contents of the given path or the current directory\&.
473: .RE
474: .PP
475: \fBpwd\fR
476: .RS 4
477: Display the path to the current node\&.
478: .RE
479: .PP
480: \fBquit\fR
481: .RS 4
482: Leave the shell\&.
483: .RE
484: .PP
485: \fBsave \fR\fB\fIFILENAME\fR\fR
486: .RS 4
487: Save the current document to the given filename or to the original name\&.
488: .RE
489: .PP
490: \fBvalidate\fR
491: .RS 4
492: Check the document for errors\&.
493: .RE
494: .PP
495: \fBwrite \fR\fB\fIFILENAME\fR\fR
496: .RS 4
497: Write the current node to the given filename\&.
498: .RE
499: .SH "ENVIRONMENT"
500: .PP
501: \fBSGML_CATALOG_FILES\fR
502: .RS 4
503: SGML
504: catalog behavior can be changed by redirecting queries to the user\*(Aqs own set of catalogs\&. This can be done by setting the
505: \fBSGML_CATALOG_FILES\fR
506: environment variable to a list of catalogs\&. An empty one should deactivate loading the default
507: /etc/sgml/catalog
508: catalog\&.
509: .RE
510: .PP
511: \fBXML_CATALOG_FILES\fR
512: .RS 4
513: XML
514: catalog behavior can be changed by redirecting queries to the user\*(Aqs own set of catalogs\&. This can be done by setting the
515: \fBXML_CATALOG_FILES\fR
516: environment variable to a list of catalogs\&. An empty one should deactivate loading the default
517: /etc/xml/catalog
518: catalog\&.
519: .RE
520: .PP
521: \fBXML_DEBUG_CATALOG\fR
522: .RS 4
523: Setting the environment variable
524: \fBXML_DEBUG_CATALOG\fR
525: to
526: \fInon\-zero\fR
527: using the
528: \fBexport\fR
529: command outputs debugging information related to catalog operations\&.
530: .RE
531: .PP
532: \fBXMLLINT_INDENT\fR
533: .RS 4
534: Setting the environment variable
535: \fBXMLLINT_INDENT\fR
536: controls the indentation\&. The default value is two spaces " "\&.
537: .RE
538: .SH "DIAGNOSTICS"
539: .PP
540:
541: \fBxmllint\fR
542: return codes provide information that can be used when calling it from scripts\&.
543: .PP
544: \fB0\fR
545: .RS 4
546: No error
547: .RE
548: .PP
549: \fB1\fR
550: .RS 4
551: Unclassified
552: .RE
553: .PP
554: \fB2\fR
555: .RS 4
556: Error in
557: DTD
558: .RE
559: .PP
560: \fB3\fR
561: .RS 4
562: Validation error
563: .RE
564: .PP
565: \fB4\fR
566: .RS 4
567: Validation error
568: .RE
569: .PP
570: \fB5\fR
571: .RS 4
572: Error in schema compilation
573: .RE
574: .PP
575: \fB6\fR
576: .RS 4
577: Error writing output
578: .RE
579: .PP
580: \fB7\fR
581: .RS 4
582: Error in pattern (generated when
583: \fB\-\-pattern\fR
584: option is used)
585: .RE
586: .PP
587: \fB8\fR
588: .RS 4
589: Error in Reader registration (generated when
590: \fB\-\-chkregister\fR
591: option is used)
592: .RE
593: .PP
594: \fB9\fR
595: .RS 4
596: Out of memory error
597: .RE
598: .SH "SEE ALSO"
599: .PP
600: \fBlibxml\fR(3)
601: .PP
602: More information can be found at
603: .sp
604: .RS 4
605: .ie n \{\
606: \h'-04'\(bu\h'+03'\c
607: .\}
608: .el \{\
609: .sp -1
610: .IP \(bu 2.3
611: .\}
612: \fBlibxml\fR(3)
613: web page
614: \m[blue]\fB\%http://www.xmlsoft.org/\fR\m[]
615: .RE
616: .sp
617: .RS 4
618: .ie n \{\
619: \h'-04'\(bu\h'+03'\c
620: .\}
621: .el \{\
622: .sp -1
623: .IP \(bu 2.3
624: .\}
625: W3C
626: XSLT
627: page
628: \m[blue]\fB\%http://www.w3.org/TR/xslt\fR\m[]
629: .RE
630: .sp
631: .SH "AUTHORS"
632: .PP
633: \fBJohn Fleck\fR <\&jfleck@inkstain\&.net\&>
634: .RS 4
635: Author.
636: .RE
637: .PP
638: \fBZiying Sherwin\fR <\&sherwin@nlm\&.nih\&.gov\&>
639: .RS 4
640: Author.
641: .RE
642: .PP
643: \fBHeiko Rupp\fR <\&hwr@pilhuhn\&.de\&>
644: .RS 4
645: Author.
646: .RE
647: .SH "COPYRIGHT"
648: .br
649: Copyright \(co 2001, 2004
650: .br
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>