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