mirror of https://github.com/python/cpython
Merged revisions 86348 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ 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. ........
This commit is contained in:
parent
d67b6786ba
commit
80860381a5
|
@ -1101,6 +1101,11 @@ def qname():
|
||||||
>>> elem = ET.Element(ET.QName("uri", "tag"))
|
>>> elem = ET.Element(ET.QName("uri", "tag"))
|
||||||
>>> serialize(elem) # 1.3
|
>>> serialize(elem) # 1.3
|
||||||
'<ns0:tag xmlns:ns0="uri" />'
|
'<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
|
2) decorated attributes
|
||||||
|
|
||||||
|
|
|
@ -871,8 +871,9 @@ def _namespaces(elem, encoding, default_namespace=None):
|
||||||
iterate = elem.getiterator # cET compatibility
|
iterate = elem.getiterator # cET compatibility
|
||||||
for elem in iterate():
|
for elem in iterate():
|
||||||
tag = elem.tag
|
tag = elem.tag
|
||||||
if isinstance(tag, QName) and tag.text not in qnames:
|
if isinstance(tag, QName):
|
||||||
add_qname(tag.text)
|
if tag.text not in qnames:
|
||||||
|
add_qname(tag.text)
|
||||||
elif isinstance(tag, basestring):
|
elif isinstance(tag, basestring):
|
||||||
if tag not in qnames:
|
if tag not in qnames:
|
||||||
add_qname(tag)
|
add_qname(tag)
|
||||||
|
|
Loading…
Reference in New Issue