xmllint.1 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. .\" ** You probably do not want to edit this file directly **
  2. .\" It was generated using the DocBook XSL Stylesheets (version 1.69.1).
  3. .\" Instead of manually editing it, you probably should edit the DocBook XML
  4. .\" source for it and then use the DocBook XSL Stylesheets to regenerate it.
  5. .TH "XMLLINT" "1" "$Date$" "libxml2" ""
  6. .\" disable hyphenation
  7. .nh
  8. .\" disable justification (adjust text to left margin only)
  9. .ad l
  10. .SH "NAME"
  11. xmllint \- command line XML tool
  12. .SH "SYNOPSIS"
  13. .HP 8
  14. \fBxmllint\fR [\fB\-\-version\fR \fB\-\-debug\fR \fB\-\-shell\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... \-}
  15. .HP 8
  16. \fBxmllint\fR \fB\-\-help\fR
  17. .SH "DESCRIPTION"
  18. .PP
  19. The
  20. \fBxmllint\fR
  21. program parses one or more
  22. XML
  23. files, specified on the command line as
  24. \fIXML\-FILE\fR
  25. (or the standard input if the filename provided is
  26. \fB\-\fR
  27. ). It prints various types of output, depending upon the options selected. It is useful for detecting errors both in
  28. XML
  29. code and in the
  30. XML
  31. parser itself.
  32. .PP
  33. \fBxmllint\fR
  34. is included in
  35. \fBlibxml\fR(3).
  36. .SH "OPTIONS"
  37. .PP
  38. \fBxmllint\fR
  39. accepts the following options (in alphabetical order):
  40. .TP
  41. \fB\-\-auto\fR
  42. Generate a small document for testing purposes.
  43. .TP
  44. \fB\-\-catalogs\fR
  45. Use the
  46. SGML
  47. catalog(s) from
  48. \fBSGML_CATALOG_FILES\fR. Otherwise
  49. XML
  50. catalogs starting from
  51. \fI/etc/xml/catalog\fR
  52. are used by default.
  53. .TP
  54. \fB\-\-chkregister\fR
  55. Turn on node registration. Useful for developers testing
  56. \fBlibxml\fR(3)
  57. node tracking code.
  58. .TP
  59. \fB\-\-compress\fR
  60. Turn on
  61. \fBgzip\fR(1)
  62. compression of output.
  63. .TP
  64. \fB\-\-copy\fR
  65. Test the internal copy implementation.
  66. .TP
  67. \fB\-\-c14n\fR
  68. Use the W3C
  69. XML
  70. Canonicalisation (C14N) to serialize the result of parsing to
  71. \fIstdout\fR. It keeps comments in the result.
  72. .TP
  73. \fB\-\-dtdvalid \fR\fB\fIURL\fR\fR
  74. Use the
  75. DTD
  76. specified by an
  77. \fIURL\fR
  78. for validation.
  79. .TP
  80. \fB\-\-dtdvalidfpi \fR\fB\fIFPI\fR\fR
  81. Use the
  82. DTD
  83. specified by a Formal Public Identifier
  84. \fIFPI\fR
  85. for validation, note that this will require a catalog exporting that Formal Public Identifier to work.
  86. .TP
  87. \fB\-\-debug\fR
  88. Parse a file and output an annotated tree of the in\-memory version of the document.
  89. .TP
  90. \fB\-\-debugent\fR
  91. Debug the entities defined in the document.
  92. .TP
  93. \fB\-\-dropdtd\fR
  94. Remove
  95. DTD
  96. from output.
  97. .TP
  98. \fB\-\-dtdattr\fR
  99. Fetch external
  100. DTD
  101. and populate the tree with inherited attributes.
  102. .TP
  103. \fB\-\-encode \fR\fB\fIENCODING\fR\fR
  104. Output in the given encoding.
  105. .TP
  106. \fB\-\-format\fR
  107. Reformat and reindent the output. The
  108. \fBXMLLINT_INDENT\fR
  109. environment variable controls the indentation. The default value is two spaces " ").
  110. .TP
  111. \fB\-\-help\fR
  112. Print out a short usage summary for
  113. \fBxmllint\fR.
  114. .TP
  115. \fB\-\-html\fR
  116. Use the
  117. HTML
  118. parser.
  119. .TP
  120. \fB\-\-htmlout\fR
  121. Output results as an
  122. HTML
  123. file. This causes
  124. \fBxmllint\fR
  125. to output the necessary
  126. HTML
  127. tags surrounding the result tree output so the results can be displayed/viewed in a browser.
  128. .TP
  129. \fB\-\-insert\fR
  130. Test for valid insertions.
  131. .TP
  132. \fB\-\-loaddtd\fR
  133. Fetch an external
  134. DTD.
  135. .TP
  136. \fB\-\-load\-trace\fR
  137. Display all the documents loaded during the processing to
  138. \fIstderr\fR.
  139. .TP
  140. \fB\-\-maxmem \fR\fB\fINNBYTES\fR\fR
  141. Test the parser memory support.
  142. \fINNBYTES\fR
  143. is the maximum number of bytes the library is allowed to allocate. This can also be used to make sure batch processing of
  144. XML
  145. files will not exhaust the virtual memory of the server running them.
  146. .TP
  147. \fB\-\-memory\fR
  148. Parse from memory.
  149. .TP
  150. \fB\-\-noblanks\fR
  151. Drop ignorable blank spaces.
  152. .TP
  153. \fB\-\-nocatalogs\fR
  154. Do not use any catalogs.
  155. .TP
  156. \fB\-\-nocdata\fR
  157. Substitute CDATA section by equivalent text nodes.
  158. .TP
  159. \fB\-\-noent\fR
  160. Substitute entity values for entity references. By default,
  161. \fBxmllint\fR
  162. leaves entity references in place.
  163. .TP
  164. \fB\-\-nonet\fR
  165. Do not use the Internet to fetch
  166. DTDs or entities.
  167. .TP
  168. \fB\-\-noout\fR
  169. Suppress output. By default,
  170. \fBxmllint\fR
  171. outputs the result tree.
  172. .TP
  173. \fB\-\-nowarning\fR
  174. Do not emit warnings from the parser and/or validator.
  175. .TP
  176. \fB\-\-nowrap\fR
  177. Do not output
  178. HTML
  179. doc wrapper.
  180. .TP
  181. \fB\-\-noxincludenode\fR
  182. Do XInclude processing but do not generate XInclude start and end nodes.
  183. .TP
  184. \fB\-\-nsclean\fR
  185. Remove redundant namespace declarations.
  186. .TP
  187. \fB\-\-output \fR\fB\fIFILE\fR\fR
  188. Define a file path where
  189. \fBxmllint\fR
  190. will save the result of parsing. Usually the programs build a tree and save it on
  191. \fIstdout\fR, with this option the result
  192. XML
  193. instance will be saved onto a file.
  194. .TP
  195. \fB\-\-path "\fR\fB\fIPATH(S)\fR\fR\fB"\fR
  196. Use the (space\- or colon\-separated) list of filesystem paths specified by
  197. \fIPATHS\fR
  198. to load
  199. DTDs or entities. Enclose space\-separated lists by quotation marks.
  200. .TP
  201. \fB\-\-pattern \fR\fB\fIPATTERNVALUE\fR\fR
  202. 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.
  203. .TP
  204. \fB\-\-postvalid\fR
  205. Validate after parsing has completed.
  206. .TP
  207. \fB\-\-push\fR
  208. Use the push mode of the parser.
  209. .TP
  210. \fB\-\-recover\fR
  211. Output any parsable portions of an invalid document.
  212. .TP
  213. \fB\-\-relaxng \fR\fB\fISCHEMA\fR\fR
  214. Use RelaxNG file named
  215. \fISCHEMA\fR
  216. for validation.
  217. .TP
  218. \fB\-\-repeat\fR
  219. Repeat 100 times, for timing or profiling.
  220. .TP
  221. \fB\-\-schema \fR\fB\fISCHEMA\fR\fR
  222. Use a W3C
  223. XML
  224. Schema file named
  225. \fISCHEMA\fR
  226. for validation.
  227. .TP
  228. \fB\-\-shell\fR
  229. Run a navigating shell. Details on available commands in shell mode are below (see
  230. the section called \(lqSHELL COMMANDS\(rq).
  231. .TP
  232. \fB\-\-stream\fR
  233. Use streaming
  234. API
  235. \- useful when used in combination with
  236. \fB\-\-relaxng\fR
  237. or
  238. \fB\-\-valid\fR
  239. options for validation of files that are too large to be held in memory.
  240. .TP
  241. \fB\-\-testIO\fR
  242. Test user input/output support.
  243. .TP
  244. \fB\-\-timing\fR
  245. Output information about the time it takes
  246. \fBxmllint\fR
  247. to perform the various steps.
  248. .TP
  249. \fB\-\-valid\fR
  250. Determine if the document is a valid instance of the included Document Type Definition (DTD). A
  251. DTD
  252. to be validated against also can be specified at the command line using the
  253. \fB\-\-dtdvalid\fR
  254. option. By default,
  255. \fBxmllint\fR
  256. also checks to determine if the document is well\-formed.
  257. .TP
  258. \fB\-\-version\fR
  259. Display the version of
  260. \fBlibxml\fR(3)
  261. used.
  262. .TP
  263. \fB\-\-walker\fR
  264. Test the walker module, which is a reader interface but for a document tree, instead of using the reader
  265. API
  266. on an unparsed document it works on an existing in\-memory tree. Used for debugging.
  267. .TP
  268. \fB\-\-xinclude\fR
  269. Do XInclude processing.
  270. .TP
  271. \fB\-\-xmlout\fR
  272. Used in conjunction with
  273. \fB\-\-html\fR. Usually when
  274. HTML
  275. is parsed the document is saved with the
  276. HTML
  277. serializer. But with this option the resulting document is saved with the
  278. XML
  279. serializer. This is primarily used to generate
  280. XHTML
  281. from
  282. HTML
  283. input.
  284. .SH "SHELL COMMANDS"
  285. .PP
  286. \fBxmllint\fR
  287. offers an interactive shell mode invoked with the
  288. \fB\-\-shell\fR
  289. command. Available commands in shell mode include (in alphabetical order):
  290. .TP
  291. \fBbase\fR
  292. Display
  293. XML
  294. base of the node.
  295. .TP
  296. \fBbye\fR
  297. Leave the shell.
  298. .TP
  299. \fBcat \fR\fB\fINODE\fR\fR
  300. Display the given node or the current one.
  301. .TP
  302. \fBcd \fR\fB\fIPATH\fR\fR
  303. Change the current node to the given path (if unique) or root if no argument is given.
  304. .TP
  305. \fBdir \fR\fB\fIPATH\fR\fR
  306. Dumps information about the node (namespace, attributes, content).
  307. .TP
  308. \fBdu \fR\fB\fIPATH\fR\fR
  309. Show the structure of the subtree under the given path or the current node.
  310. .TP
  311. \fBexit\fR
  312. Leave the shell.
  313. .TP
  314. \fBhelp\fR
  315. Show this help.
  316. .TP
  317. \fBfree\fR
  318. Display memory usage.
  319. .TP
  320. \fBload \fR\fB\fIFILENAME\fR\fR
  321. Load a new document with the given filename.
  322. .TP
  323. \fBls \fR\fB\fIPATH\fR\fR
  324. List contents of the given path or the current directory.
  325. .TP
  326. \fBpwd\fR
  327. Display the path to the current node.
  328. .TP
  329. \fBquit\fR
  330. Leave the shell.
  331. .TP
  332. \fBsave \fR\fB\fIFILENAME\fR\fR
  333. Save the current document to the given filename or to the original name.
  334. .TP
  335. \fBvalidate\fR
  336. Check the document for errors.
  337. .TP
  338. \fBwrite \fR\fB\fIFILENAME\fR\fR
  339. Write the current node to the given filename.
  340. .SH "ENVIRONMENT"
  341. .TP
  342. \fBSGML_CATALOG_FILES\fR
  343. SGML
  344. catalog behavior can be changed by redirecting queries to the user's own set of catalogs. This can be done by setting the
  345. \fBSGML_CATALOG_FILES\fR
  346. environment variable to a list of catalogs. An empty one should deactivate loading the default
  347. \fI/etc/sgml/catalog\fR
  348. catalog.
  349. .TP
  350. \fBXML_CATALOG_FILES\fR
  351. XML
  352. catalog behavior can be changed by redirecting queries to the user's own set of catalogs. This can be done by setting the
  353. \fBXML_CATALOG_FILES\fR
  354. environment variable to a list of catalogs. An empty one should deactivate loading the default
  355. \fI/etc/xml/catalog\fR
  356. catalog.
  357. .TP
  358. \fBXML_DEBUG_CATALOG\fR
  359. Setting the environment variable
  360. \fBXML_DEBUG_CATALOG\fR
  361. to
  362. \fInon\-zero\fR
  363. using the
  364. \fBexport\fR
  365. command outputs debugging information related to catalog operations.
  366. .TP
  367. \fBXMLLINT_INDENT\fR
  368. Setting the environment variable
  369. \fBXMLLINT_INDENT\fR
  370. controls the indentation. The default value is two spaces " ".
  371. .SH "DIAGNOSTICS"
  372. .PP
  373. \fBxmllint\fR
  374. return codes provide information that can be used when calling it from scripts.
  375. .TP
  376. \fB0\fR
  377. No error
  378. .TP
  379. \fB1\fR
  380. Unclassified
  381. .TP
  382. \fB2\fR
  383. Error in
  384. DTD
  385. .TP
  386. \fB3\fR
  387. Validation error
  388. .TP
  389. \fB4\fR
  390. Validation error
  391. .TP
  392. \fB5\fR
  393. Error in schema compilation
  394. .TP
  395. \fB6\fR
  396. Error writing output
  397. .TP
  398. \fB7\fR
  399. Error in pattern (generated when
  400. \fB\-\-pattern\fR
  401. option is used)
  402. .TP
  403. \fB8\fR
  404. Error in Reader registration (generated when
  405. \fB\-\-chkregister\fR
  406. option is used)
  407. .TP
  408. \fB9\fR
  409. Out of memory error
  410. .SH "SEE ALSO"
  411. .PP
  412. \fBlibxml\fR(3)
  413. .PP
  414. More information can be found at
  415. .TP 3
  416. \(bu
  417. \fBlibxml\fR(3)
  418. web page
  419. \fI\%http://www.xmlsoft.org/\fR
  420. .TP
  421. \(bu
  422. W3C
  423. XSLT
  424. page
  425. \fI\%http://www.w3.org/TR/xslt\fR
  426. .SH "AUTHOR"
  427. John Fleck <jfleck@inkstain.net>, Ziying Sherwin <sherwin@nlm.nih.gov>, Heiko Rupp <hwr@pilhuhn.de>.