1 #! /usr/bin/env python3
3 # ___\ \/ /_ __ __ _| |_
4 # / _ \\ /| '_ \ / _` | __|
5 # | __// \| |_) | (_| | |_
6 # \___/_/\_\ .__/ \__,_|\__|
9 # Copyright (c) 2019 Expat development team
10 # Licensed under the MIT license:
12 # Permission is hereby granted, free of charge, to any person obtaining
13 # a copy of this software and associated documentation files (the
14 # "Software"), to deal in the Software without restriction, including
15 # without limitation the rights to use, copy, modify, merge, publish,
16 # distribute, sublicense, and/or sell copies of the Software, and to permit
17 # persons to whom the Software is furnished to do so, subject to the
18 # following conditions:
20 # The above copyright notice and this permission notice shall be included
21 # in all copies or substantial portions of the Software.
23 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
26 # NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
27 # DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
28 # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
29 # USE OR OTHER DEALINGS IN THE SOFTWARE.
34 libexpat is software libre, licensed under the MIT license.
35 Please report bugs at https://github.com/libexpat/libexpat/issues. Thank you!
38 parser = argparse.ArgumentParser(prog='xmlwf', add_help=False,
39 description='xmlwf - Determines if an XML document is well-formed',
40 formatter_class=argparse.RawTextHelpFormatter,
43 input_related = parser.add_argument_group('input control arguments')
44 input_related.add_argument('-s', action='store_true', help='print an error if the document is not [s]tandalone')
45 input_related.add_argument('-n', action='store_true', help='enable [n]amespace processing')
46 input_related.add_argument('-p', action='store_true', help='enable processing external DTDs and [p]arameter entities')
47 input_related.add_argument('-x', action='store_true', help='enable processing of e[x]ternal entities')
48 input_related.add_argument('-e', action='store', metavar='ENCODING', help='override any in-document [e]ncoding declaration')
49 input_related.add_argument('-w', action='store_true', help='enable support for [W]indows code pages')
50 input_related.add_argument('-r', action='store_true', help='disable memory-mapping and use normal file [r]ead IO calls instead')
52 output_related = parser.add_argument_group('output control arguments')
53 output_related.add_argument('-d', action='store', metavar='DIRECTORY', help='output [d]estination directory')
54 output_mode = output_related.add_mutually_exclusive_group()
55 output_mode.add_argument('-c', action='store_true', help='write a [c]opy of input XML, not canonical XML')
56 output_mode.add_argument('-m', action='store_true', help='write [m]eta XML, not canonical XML')
57 output_mode.add_argument('-t', action='store_true', help='write no XML output for [t]iming of plain parsing')
58 output_related.add_argument('-N', action='store_true', help='enable adding doctype and [n]otation declarations')
60 parser.add_argument('files', metavar='FILE', nargs='*', help='files to process (default: STDIN)')
62 info = parser.add_argument_group('info arguments')
63 info = info.add_mutually_exclusive_group()
64 info.add_argument('-h', action='store_true', help='show this [h]elp message and exit')
65 info.add_argument('-v', action='store_true', help='show program\'s [v]ersion number and exit')
68 if __name__ == '__main__':