aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/py/javatoolkit/xml/SaxRewriter.py')
-rw-r--r--src/py/javatoolkit/xml/SaxRewriter.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/py/javatoolkit/xml/SaxRewriter.py b/src/py/javatoolkit/xml/SaxRewriter.py
index f9e224a..8d76de2 100644
--- a/src/py/javatoolkit/xml/SaxRewriter.py
+++ b/src/py/javatoolkit/xml/SaxRewriter.py
@@ -1,14 +1,17 @@
# -*- coding: UTF-8 -*-
-# Copyright 2004-2005 Gentoo Foundation
+# Copyright 2004-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
+import io
import os
import sys
-import io
+import xml.sax.handler
from xml.sax.saxutils import XMLGenerator
from xml.sax.saxutils import quoteattr
+import javatoolkit.xml.sax
+
class SaxRewriter(XMLGenerator):
"""
Using Sax gives us the support for writing back doctypes and all easily
@@ -124,8 +127,7 @@ class SaxRewriter(XMLGenerator):
def process(self, in_stream, callback):
self.startElement = callback
- from xml.sax import parseString
- parseString(in_stream.encode('UTF8'), self)
+ javatoolkit.xml.sax.parse_string(in_stream.encode('UTF8'), content_handler=self, features={xml.sax.handler.feature_external_ges: 1})
self.p('\n')
# vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap: