2 <!-- Fill in your name for FIRSTNAME and SURNAME. -->
3 <!ENTITY dhfirstname "<firstname>Scott</firstname>">
4 <!ENTITY dhsurname "<surname>Bronson</surname>">
5 <!-- Please adjust the date whenever revising the manpage. -->
6 <!ENTITY dhdate "<date>March 11, 2016</date>">
7 <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
8 allowed: see man(7), man(1). -->
9 <!ENTITY dhsection "<manvolnum>1</manvolnum>">
10 <!ENTITY dhemail "<email>bronson@rinspin.com</email>">
11 <!ENTITY dhusername "Scott Bronson">
12 <!ENTITY dhucpackage "<refentrytitle>XMLWF</refentrytitle>">
13 <!ENTITY dhpackage "xmlwf">
15 <!ENTITY debian "<productname>Debian GNU/Linux</productname>">
16 <!ENTITY gnu "<acronym>GNU</acronym>">
30 <holder>&dhusername;</holder>
40 <refname>&dhpackage;</refname>
42 <refpurpose>Determines if an XML document is well-formed</refpurpose>
46 <command>&dhpackage;</command>
47 <arg><option>-s</option></arg>
48 <arg><option>-n</option></arg>
49 <arg><option>-p</option></arg>
50 <arg><option>-x</option></arg>
52 <arg><option>-e <replaceable>encoding</replaceable></option></arg>
53 <arg><option>-w</option></arg>
55 <arg><option>-d <replaceable>output-dir</replaceable></option></arg>
56 <arg><option>-c</option></arg>
57 <arg><option>-m</option></arg>
59 <arg><option>-r</option></arg>
60 <arg><option>-t</option></arg>
61 <arg><option>-N</option></arg>
63 <arg><option>-v</option></arg>
70 <title>DESCRIPTION</title>
73 <command>&dhpackage;</command> uses the Expat library to
74 determine if an XML document is well-formed. It is
79 If you do not specify any files on the command-line, and you
80 have a recent version of <command>&dhpackage;</command>, the
81 input file will be read from standard input.
87 <title>WELL-FORMED DOCUMENTS</title>
90 A well-formed document must adhere to the
96 The file begins with an XML declaration. For instance,
97 <literal><?xml version="1.0" standalone="yes"?></literal>.
98 <emphasis>NOTE:</emphasis>
99 <command>&dhpackage;</command> does not currently
100 check for a valid XML declaration.
103 Every start tag is either empty (<tag/>)
104 or has a corresponding end tag.
107 There is exactly one root element. This element must contain
108 all other elements in the document. Only comments, white
109 space, and processing instructions may come after the close
113 All elements nest properly.
116 All attribute values are enclosed in quotes (either single
122 If the document has a DTD, and it strictly complies with that
123 DTD, then the document is also considered <emphasis>valid</emphasis>.
124 <command>&dhpackage;</command> is a non-validating parser --
125 it does not check the DTD. However, it does support
126 external entities (see the <option>-x</option> option).
131 <title>OPTIONS</title>
134 When an option includes an argument, you may specify the argument either
135 separately ("<option>-d</option> output") or concatenated with the
136 option ("<option>-d</option>output"). <command>&dhpackage;</command>
143 <term><option>-c</option></term>
146 If the input file is well-formed and <command>&dhpackage;</command>
147 doesn't encounter any errors, the input file is simply copied to
148 the output directory unchanged.
149 This implies no namespaces (turns off <option>-n</option>) and
150 requires <option>-d</option> to specify an output directory.
156 <term><option>-d output-dir</option></term>
159 Specifies a directory to contain transformed
160 representations of the input files.
161 By default, <option>-d</option> outputs a canonical representation
163 You can select different output formats using <option>-c</option>,
164 <option>-m</option> and <option>-N</option>.
167 The output filenames will
168 be exactly the same as the input filenames or "STDIN" if the input is
169 coming from standard input. Therefore, you must be careful that the
170 output file does not go into the same directory as the input
171 file. Otherwise, <command>&dhpackage;</command> will delete the
172 input file before it generates the output file (just like running
173 <literal>cat < file > file</literal> in most shells).
176 Two structurally equivalent XML documents have a byte-for-byte
177 identical canonical XML representation.
178 Note that ignorable white space is considered significant and
179 is treated equivalently to data.
180 More on canonical XML can be found at
181 http://www.jclark.com/xml/canonxml.html .
187 <term><option>-e encoding</option></term>
190 Specifies the character encoding for the document, overriding
191 any document encoding declaration. <command>&dhpackage;</command>
192 supports four built-in encodings:
193 <literal>US-ASCII</literal>,
194 <literal>UTF-8</literal>,
195 <literal>UTF-16</literal>, and
196 <literal>ISO-8859-1</literal>.
197 Also see the <option>-w</option> option.
203 <term><option>-m</option></term>
206 Outputs some strange sort of XML file that completely
207 describes the input file, including character positions.
208 Requires <option>-d</option> to specify an output file.
214 <term><option>-n</option></term>
217 Turns on namespace processing. (describe namespaces)
218 <option>-c</option> disables namespaces.
224 <term><option>-N</option></term>
227 Adds a doctype and notation declarations to canonical XML output.
228 This matches the example output used by the formal XML test cases.
229 Requires <option>-d</option> to specify an output file.
235 <term><option>-p</option></term>
238 Tells xmlwf to process external DTDs and parameter
242 Normally <command>&dhpackage;</command> never parses parameter
243 entities. <option>-p</option> tells it to always parse them.
244 <option>-p</option> implies <option>-x</option>.
250 <term><option>-r</option></term>
253 Normally <command>&dhpackage;</command> memory-maps the XML file
254 before parsing; this can result in faster parsing on many
256 <option>-r</option> turns off memory-mapping and uses normal file
258 Of course, memory-mapping is automatically turned off
259 when reading from standard input.
262 Use of memory-mapping can cause some platforms to report
263 substantially higher memory usage for
264 <command>&dhpackage;</command>, but this appears to be a matter of
265 the operating system reporting memory in a strange way; there is
266 not a leak in <command>&dhpackage;</command>.
272 <term><option>-s</option></term>
275 Prints an error if the document is not standalone.
276 A document is standalone if it has no external subset and no
277 references to parameter entities.
283 <term><option>-t</option></term>
286 Turns on timings. This tells Expat to parse the entire file,
287 but not perform any processing.
288 This gives a fairly accurate idea of the raw speed of Expat itself
289 without client overhead.
290 <option>-t</option> turns off most of the output options
291 (<option>-d</option>, <option>-m</option>, <option>-c</option>, ...).
297 <term><option>-v</option></term>
300 Prints the version of the Expat library being used, including some
301 information on the compile-time configuration of the library, and
308 <term><option>-w</option></term>
311 Enables support for Windows code pages.
312 Normally, <command>&dhpackage;</command> will throw an error if it
313 runs across an encoding that it is not equipped to handle itself. With
314 <option>-w</option>, &dhpackage; will try to use a Windows code
315 page. See also <option>-e</option>.
321 <term><option>-x</option></term>
324 Turns on parsing external entities.
327 Non-validating parsers are not required to resolve external
328 entities, or even expand entities at all.
329 Expat always expands internal entities (?),
330 but external entity parsing must be enabled explicitly.
333 External entities are simply entities that obtain their
334 data from outside the XML file currently being parsed.
337 This is an example of an internal entity:
339 <!ENTITY vers '1.0.2'>
343 And here are some examples of external entities:
346 <!ENTITY header SYSTEM "header-&vers;.xml"> (parsed)
347 <!ENTITY logo SYSTEM "logo.png" PNG> (unparsed)
355 <term><option>--</option></term>
359 Terminates the list of options. This is only needed if a filename
360 starts with a hyphen. For example:
363 &dhpackage; -- -myfile.xml
366 will run <command>&dhpackage;</command> on the file
367 <filename>-myfile.xml</filename>.
374 Older versions of <command>&dhpackage;</command> do not support
375 reading from standard input.
380 <title>OUTPUT</title>
382 If an input file is not well-formed,
383 <command>&dhpackage;</command> prints a single line describing
384 the problem to standard output. If a file is well formed,
385 <command>&dhpackage;</command> outputs nothing.
386 Note that the result code is <emphasis>not</emphasis> set.
393 <command>&dhpackage;</command> returns a 0 - noerr result,
394 even if the file is not well-formed. There is no good way for
395 a program to use <command>&dhpackage;</command> to quickly
396 check a file -- it must parse <command>&dhpackage;</command>'s
400 The errors should go to standard error, not standard output.
403 There should be a way to get <option>-d</option> to send its
404 output to standard output rather than forcing the user to send
408 I have no idea why anyone would want to use the
409 <option>-d</option>, <option>-c</option>, and
410 <option>-m</option> options. If someone could explain it to
411 me, I'd like to add this information to this manpage.
416 <title>ALTERNATIVES</title>
418 Here are some XML validators on the web:
421 http://www.hcrc.ed.ac.uk/~richard/xml-check.html
422 http://www.stg.brown.edu/service/xmlvalid/
423 http://www.scripting.com/frontier5/xml/code/xmlValidator.html
424 http://www.xml.com/pub/a/tools/ruwf/check.html
431 <title>SEE ALSO</title>
435 The Expat home page: http://www.libexpat.org/
436 The W3 XML specification: http://www.w3.org/TR/REC-xml
443 <title>AUTHOR</title>
445 This manual page was written by &dhusername; &dhemail; for
446 the &debian; system (but may be used by others). Permission is
447 granted to copy, distribute and/or modify this document under
448 the terms of the <acronym>GNU</acronym> Free Documentation
449 License, Version 1.1.