Senthil Kumaran avatar Senthil Kumaran committed b347b5c

Merged revisions 86348 via svnmerge from

r86348 | senthil.kumaran | 2010-11-09 10:36:59 +0800 (Tue, 09 Nov 2010) | 3 lines

Fix Issue10205 - XML QName error when different tags have same QName.

Comments (0)

Files changed (2)


     >>> elem = ET.Element(ET.QName("uri", "tag"))
     >>> serialize(elem) # 1.3
     '<ns0:tag xmlns:ns0="uri" />'
+    >>> elem = ET.Element(ET.QName("uri", "tag"))
+    >>> subelem = ET.SubElement(elem, ET.QName("uri", "tag1"))
+    >>> subelem = ET.SubElement(elem, ET.QName("uri", "tag2"))
+    >>> serialize(elem) # 1.4
+    '<ns0:tag xmlns:ns0="uri"><ns0:tag1 /><ns0:tag2 /></ns0:tag>'
     2) decorated attributes


         iterate = elem.getiterator # cET compatibility
     for elem in iterate():
         tag = elem.tag
-        if isinstance(tag, QName) and tag.text not in qnames:
-            add_qname(tag.text)
+        if isinstance(tag, QName):
+            if tag.text not in qnames:
+                add_qname(tag.text)
         elif isinstance(tag, basestring):
             if tag not in qnames:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.