chiark / gitweb /
man,journal: add note about sd_journal_get_cutoff_monotonic_usec return value
[elogind.git] / tools / xml_helper.py
index 0d91a17..e87126f 100644 (file)
@@ -24,22 +24,11 @@ class CustomResolver(tree.Resolver):
         if 'custom-entities.ent' in url:
             return self.resolve_filename('man/custom-entities.ent', context)
 
-try:
-    _parser = tree.XMLParser()
-    _parser.resolvers.add(CustomResolver())
-    def xml_parse(page):
-        doc = tree.parse(page, _parser)
-        doc.xinclude()
-        return doc
-    def xml_print(xml):
-        return tree.tostring(xml, pretty_print=True, encoding='utf-8')
-
-except ImportError:
-    import xml.etree.ElementTree as tree
-    import re as _re
-    import io as _io
-
-    def xml_parse(page):
-        s = _re.sub(b'&[a-zA-Z0-9_]+;', b'', open(page, 'rb').read())
-        return tree.parse(_io.BytesIO(s))
-    xml_print = lambda xml: tree.tostring(xml, encoding='utf-8')
+_parser = tree.XMLParser()
+_parser.resolvers.add(CustomResolver())
+def xml_parse(page):
+    doc = tree.parse(page, _parser)
+    doc.xinclude()
+    return doc
+def xml_print(xml):
+    return tree.tostring(xml, pretty_print=True, encoding='utf-8')