changeset 306:556dbf79394a 0.5.x

Ported [317] to 0.5.x.
author cmlenz
date Fri, 18 Nov 2005 12:44:29 +0000
parents a89b9d945136
children 1df44410c40a
files bitten/util/xmlio.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/bitten/util/xmlio.py
+++ b/bitten/util/xmlio.py
@@ -190,8 +190,8 @@
 
     def __init__(self, node):
         self._node = node
-        self.attr = dict([(name.encode(), value.encode()) for name, value
-                          in node.attributes.items()])
+        self.attr = dict([(name.encode('utf-8'), value.encode('utf-8'))
+                          for name, value in node.attributes.items()])
 
     name = property(fget=lambda self: self._node.localName)
     namespace = property(fget=lambda self: self._node.namespaceURI)
@@ -215,7 +215,8 @@
         This concatenates the values of all text nodes that are immediate
         children of this element.
         """
-        return ''.join([c.nodeValue or '' for c in self._node.childNodes])
+        return ''.join([c.nodeValue.encode('utf-8')
+                        for c in self._node.childNodes if c.nodeType == 3])
 
     def write(self, out, newlines=False):
         """Serializes the element and writes the XML to the given output
Copyright (C) 2012-2017 Edgewall Software