summaryrefslogtreecommitdiffstats
path: root/Lib/xml/sax/saxutils.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/xml/sax/saxutils.py')
-rw-r--r--Lib/xml/sax/saxutils.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/Lib/xml/sax/saxutils.py b/Lib/xml/sax/saxutils.py
index 1fb3743..5d784bd 100644
--- a/Lib/xml/sax/saxutils.py
+++ b/Lib/xml/sax/saxutils.py
@@ -12,7 +12,7 @@ _StringTypes = [types.StringType, types.UnicodeType]
def escape(data, entities={}):
"""Escape &, <, and > in a string of data.
- You can escape other strings of data by passing a dictionary as
+ You can escape other strings of data by passing a dictionary as
the optional entities parameter. The keys and values must all be
strings; each key will be replaced with its corresponding value.
"""
@@ -20,7 +20,7 @@ def escape(data, entities={}):
data = data.replace("<", "&lt;")
data = data.replace(">", "&gt;")
for chars, entity in entities.items():
- data = data.replace(chars, entity)
+ data = data.replace(chars, entity)
return data
@@ -57,7 +57,7 @@ class XMLGenerator(handler.ContentHandler):
for (name, value) in attrs.items():
self._out.write(' %s="%s"' % (name, escape(value)))
self._out.write('>')
-
+
def endElement(self, name):
self._out.write('</%s>' % name)
@@ -73,7 +73,7 @@ class XMLGenerator(handler.ContentHandler):
for pair in self._undeclared_ns_maps:
self._out.write(' xmlns:%s="%s"' % pair)
self._undeclared_ns_maps = []
-
+
for (name, value) in attrs.items():
name = self._current_context[name[0]] + ":" + name[1]
self._out.write(' %s="%s"' % (name, escape(value)))
@@ -85,7 +85,7 @@ class XMLGenerator(handler.ContentHandler):
else:
name = self._current_context[name[0]] + ":" + name[1]
self._out.write('</%s>' % name)
-
+
def characters(self, content):
self._out.write(escape(content))
@@ -107,7 +107,7 @@ class XMLFilterBase(xmlreader.XMLReader):
def __init__(self, parent = None):
xmlreader.XMLReader.__init__(self)
self._parent = parent
-
+
# ErrorHandler methods
def error(self, exception):
@@ -210,7 +210,7 @@ class XMLFilterBase(xmlreader.XMLReader):
def prepare_input_source(source, base = ""):
"""This function takes an InputSource and an optional base URL and
returns a fully resolved InputSource object ready for reading."""
-
+
if type(source) in _StringTypes:
source = xmlreader.InputSource(source)
elif hasattr(source, "read"):
@@ -229,7 +229,7 @@ def prepare_input_source(source, base = ""):
else:
source.setSystemId(urlparse.urljoin(base, sysid))
f = urllib.urlopen(source.getSystemId())
-
+
source.setByteStream(f)
-
+
return source