diff options
author | Georg Brandl <georg@python.org> | 2009-10-11 15:06:44 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-10-11 15:06:44 (GMT) |
commit | 32855b6dcd04dffe6a3e9705afcced6cbcb95bef (patch) | |
tree | 28f1f0543329d4b750a7074e04fd99573c77065e /Demo/xml/roundtrip.py | |
parent | b3f9d66ca327b80cc05d79a9b6e6b030a75dc28b (diff) | |
download | cpython-32855b6dcd04dffe6a3e9705afcced6cbcb95bef.zip cpython-32855b6dcd04dffe6a3e9705afcced6cbcb95bef.tar.gz cpython-32855b6dcd04dffe6a3e9705afcced6cbcb95bef.tar.bz2 |
Overhaul of Demo/xml.
Diffstat (limited to 'Demo/xml/roundtrip.py')
-rw-r--r-- | Demo/xml/roundtrip.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Demo/xml/roundtrip.py b/Demo/xml/roundtrip.py index 8d7d437..801c009 100644 --- a/Demo/xml/roundtrip.py +++ b/Demo/xml/roundtrip.py @@ -3,7 +3,7 @@ A simple demo that reads in an XML document and spits out an equivalent, but not necessarily identical, document. """ -import sys, string +import sys from xml.sax import saxutils, handler, make_parser @@ -11,7 +11,7 @@ from xml.sax import saxutils, handler, make_parser class ContentGenerator(handler.ContentHandler): - def __init__(self, out = sys.stdout): + def __init__(self, out=sys.stdout): handler.ContentHandler.__init__(self) self._out = out @@ -40,6 +40,7 @@ class ContentGenerator(handler.ContentHandler): # --- The main program -parser = make_parser() -parser.setContentHandler(ContentGenerator()) -parser.parse(sys.argv[1]) +if __name__ == '__main__': + parser = make_parser() + parser.setContentHandler(ContentGenerator()) + parser.parse(sys.argv[1]) |