xmlwf.1 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. .\" This manpage has been automatically generated by docbook2man
  2. .\" from a DocBook document. This tool can be found at:
  3. .\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
  4. .\" Please send any bug reports, improvements, comments, patches,
  5. .\" etc. to Steve Cheng <steve@ggi-project.org>.
  6. .TH "XMLWF" "1" "24 January 2003" "" ""
  7. .SH NAME
  8. xmlwf \- Determines if an XML document is well-formed
  9. .SH SYNOPSIS
  10. \fBxmlwf\fR [ \fB-s\fR] [ \fB-n\fR] [ \fB-p\fR] [ \fB-x\fR] [ \fB-e \fIencoding\fB\fR] [ \fB-w\fR] [ \fB-d \fIoutput-dir\fB\fR] [ \fB-c\fR] [ \fB-m\fR] [ \fB-r\fR] [ \fB-t\fR] [ \fB-v\fR] [ \fBfile ...\fR]
  11. .SH "DESCRIPTION"
  12. .PP
  13. \fBxmlwf\fR uses the Expat library to
  14. determine if an XML document is well-formed. It is
  15. non-validating.
  16. .PP
  17. If you do not specify any files on the command-line, and you
  18. have a recent version of \fBxmlwf\fR, the
  19. input file will be read from standard input.
  20. .SH "WELL-FORMED DOCUMENTS"
  21. .PP
  22. A well-formed document must adhere to the
  23. following rules:
  24. .TP 0.2i
  25. \(bu
  26. The file begins with an XML declaration. For instance,
  27. <?xml version="1.0" standalone="yes"?>.
  28. \fBNOTE:\fR
  29. \fBxmlwf\fR does not currently
  30. check for a valid XML declaration.
  31. .TP 0.2i
  32. \(bu
  33. Every start tag is either empty (<tag/>)
  34. or has a corresponding end tag.
  35. .TP 0.2i
  36. \(bu
  37. There is exactly one root element. This element must contain
  38. all other elements in the document. Only comments, white
  39. space, and processing instructions may come after the close
  40. of the root element.
  41. .TP 0.2i
  42. \(bu
  43. All elements nest properly.
  44. .TP 0.2i
  45. \(bu
  46. All attribute values are enclosed in quotes (either single
  47. or double).
  48. .PP
  49. If the document has a DTD, and it strictly complies with that
  50. DTD, then the document is also considered \fBvalid\fR.
  51. \fBxmlwf\fR is a non-validating parser --
  52. it does not check the DTD. However, it does support
  53. external entities (see the \fB-x\fR option).
  54. .SH "OPTIONS"
  55. .PP
  56. When an option includes an argument, you may specify the argument either
  57. separately ("\fB-d\fR output") or concatenated with the
  58. option ("\fB-d\fRoutput"). \fBxmlwf\fR
  59. supports both.
  60. .TP
  61. \fB-c\fR
  62. If the input file is well-formed and \fBxmlwf\fR
  63. doesn't encounter any errors, the input file is simply copied to
  64. the output directory unchanged.
  65. This implies no namespaces (turns off \fB-n\fR) and
  66. requires \fB-d\fR to specify an output file.
  67. .TP
  68. \fB-d output-dir\fR
  69. Specifies a directory to contain transformed
  70. representations of the input files.
  71. By default, \fB-d\fR outputs a canonical representation
  72. (described below).
  73. You can select different output formats using \fB-c\fR
  74. and \fB-m\fR.
  75. The output filenames will
  76. be exactly the same as the input filenames or "STDIN" if the input is
  77. coming from standard input. Therefore, you must be careful that the
  78. output file does not go into the same directory as the input
  79. file. Otherwise, \fBxmlwf\fR will delete the
  80. input file before it generates the output file (just like running
  81. cat < file > file in most shells).
  82. Two structurally equivalent XML documents have a byte-for-byte
  83. identical canonical XML representation.
  84. Note that ignorable white space is considered significant and
  85. is treated equivalently to data.
  86. More on canonical XML can be found at
  87. http://www.jclark.com/xml/canonxml.html .
  88. .TP
  89. \fB-e encoding\fR
  90. Specifies the character encoding for the document, overriding
  91. any document encoding declaration. \fBxmlwf\fR
  92. supports four built-in encodings:
  93. US-ASCII,
  94. UTF-8,
  95. UTF-16, and
  96. ISO-8859-1.
  97. Also see the \fB-w\fR option.
  98. .TP
  99. \fB-m\fR
  100. Outputs some strange sort of XML file that completely
  101. describes the input file, including character positions.
  102. Requires \fB-d\fR to specify an output file.
  103. .TP
  104. \fB-n\fR
  105. Turns on namespace processing. (describe namespaces)
  106. \fB-c\fR disables namespaces.
  107. .TP
  108. \fB-p\fR
  109. Tells xmlwf to process external DTDs and parameter
  110. entities.
  111. Normally \fBxmlwf\fR never parses parameter
  112. entities. \fB-p\fR tells it to always parse them.
  113. \fB-p\fR implies \fB-x\fR.
  114. .TP
  115. \fB-r\fR
  116. Normally \fBxmlwf\fR memory-maps the XML file
  117. before parsing; this can result in faster parsing on many
  118. platforms.
  119. \fB-r\fR turns off memory-mapping and uses normal file
  120. IO calls instead.
  121. Of course, memory-mapping is automatically turned off
  122. when reading from standard input.
  123. Use of memory-mapping can cause some platforms to report
  124. substantially higher memory usage for
  125. \fBxmlwf\fR, but this appears to be a matter of
  126. the operating system reporting memory in a strange way; there is
  127. not a leak in \fBxmlwf\fR.
  128. .TP
  129. \fB-s\fR
  130. Prints an error if the document is not standalone.
  131. A document is standalone if it has no external subset and no
  132. references to parameter entities.
  133. .TP
  134. \fB-t\fR
  135. Turns on timings. This tells Expat to parse the entire file,
  136. but not perform any processing.
  137. This gives a fairly accurate idea of the raw speed of Expat itself
  138. without client overhead.
  139. \fB-t\fR turns off most of the output options
  140. (\fB-d\fR, \fB-m\fR, \fB-c\fR,
  141. \&...).
  142. .TP
  143. \fB-v\fR
  144. Prints the version of the Expat library being used, including some
  145. information on the compile-time configuration of the library, and
  146. then exits.
  147. .TP
  148. \fB-w\fR
  149. Enables support for Windows code pages.
  150. Normally, \fBxmlwf\fR will throw an error if it
  151. runs across an encoding that it is not equipped to handle itself. With
  152. \fB-w\fR, xmlwf will try to use a Windows code
  153. page. See also \fB-e\fR.
  154. .TP
  155. \fB-x\fR
  156. Turns on parsing external entities.
  157. Non-validating parsers are not required to resolve external
  158. entities, or even expand entities at all.
  159. Expat always expands internal entities (?),
  160. but external entity parsing must be enabled explicitly.
  161. External entities are simply entities that obtain their
  162. data from outside the XML file currently being parsed.
  163. This is an example of an internal entity:
  164. .nf
  165. <!ENTITY vers '1.0.2'>
  166. .fi
  167. And here are some examples of external entities:
  168. .nf
  169. <!ENTITY header SYSTEM "header-&vers;.xml"> (parsed)
  170. <!ENTITY logo SYSTEM "logo.png" PNG> (unparsed)
  171. .fi
  172. .TP
  173. \fB--\fR
  174. (Two hyphens.)
  175. Terminates the list of options. This is only needed if a filename
  176. starts with a hyphen. For example:
  177. .nf
  178. xmlwf -- -myfile.xml
  179. .fi
  180. will run \fBxmlwf\fR on the file
  181. \fI-myfile.xml\fR.
  182. .PP
  183. Older versions of \fBxmlwf\fR do not support
  184. reading from standard input.
  185. .SH "OUTPUT"
  186. .PP
  187. If an input file is not well-formed,
  188. \fBxmlwf\fR prints a single line describing
  189. the problem to standard output. If a file is well formed,
  190. \fBxmlwf\fR outputs nothing.
  191. Note that the result code is \fBnot\fR set.
  192. .SH "BUGS"
  193. .PP
  194. According to the W3C standard, an XML file without a
  195. declaration at the beginning is not considered well-formed.
  196. However, \fBxmlwf\fR allows this to pass.
  197. .PP
  198. \fBxmlwf\fR returns a 0 - noerr result,
  199. even if the file is not well-formed. There is no good way for
  200. a program to use \fBxmlwf\fR to quickly
  201. check a file -- it must parse \fBxmlwf\fR's
  202. standard output.
  203. .PP
  204. The errors should go to standard error, not standard output.
  205. .PP
  206. There should be a way to get \fB-d\fR to send its
  207. output to standard output rather than forcing the user to send
  208. it to a file.
  209. .PP
  210. I have no idea why anyone would want to use the
  211. \fB-d\fR, \fB-c\fR, and
  212. \fB-m\fR options. If someone could explain it to
  213. me, I'd like to add this information to this manpage.
  214. .SH "ALTERNATIVES"
  215. .PP
  216. Here are some XML validators on the web:
  217. .nf
  218. http://www.hcrc.ed.ac.uk/~richard/xml-check.html
  219. http://www.stg.brown.edu/service/xmlvalid/
  220. http://www.scripting.com/frontier5/xml/code/xmlValidator.html
  221. http://www.xml.com/pub/a/tools/ruwf/check.html
  222. .fi
  223. .SH "SEE ALSO"
  224. .PP
  225. .nf
  226. The Expat home page: http://www.libexpat.org/
  227. The W3 XML specification: http://www.w3.org/TR/REC-xml
  228. .fi
  229. .SH "AUTHOR"
  230. .PP
  231. This manual page was written by Scott Bronson <bronson@rinspin.com> for
  232. the Debian GNU/Linux system (but may be used by others). Permission is
  233. granted to copy, distribute and/or modify this document under
  234. the terms of the GNU Free Documentation
  235. License, Version 1.1.