diff emeraldtree/ElementTree.py @ 26:eeb0eb69c1da

Fix namespace uri in XML parser. * emeraldtree/ElementTree.py - Add QName.__repr__. - Use namespace uri correctly in QName generation. * emeraldtree/tests/test_ElementTree.py: Use different strings for all elements.
author Bastian Blank <bblank@thinkmo.de>
date Sun, 08 Jun 2008 12:40:21 +0200
parents 47ae505e63ea
children 4dc29d2eac0e
line wrap: on
line diff
--- a/emeraldtree/ElementTree.py	Sun Jun 08 12:09:33 2008 +0200
+++ b/emeraldtree/ElementTree.py	Sun Jun 08 12:40:21 2008 +0200
@@ -486,6 +486,9 @@
             text = text[i + 1:]
         self.name, self.uri = text, uri
 
+    def __repr__(self):
+        return '%s(%r, %r)' % (self.__class__.__name__, self.name, self.uri)
+
     def __str__(self):
         return self.text
 
@@ -1329,7 +1332,8 @@
         if key in self._names:
             return self._names[key].copy()
         if '}' in key:
-            name = QName(*key.split('}', 1))
+            uri, name = key.split('}', 1)
+            name = QName(name, uri)
         else:
             name = QName(key)
         self._names[key] = name