[XML-SIG] [ pyxml-Bugs-446436 ] Nested xmlns='' declarations break

noreply@sourceforge.net noreply@sourceforge.net
Tue, 31 Jul 2001 08:23:14 -0700


Bugs item #446436, was opened at 2001-07-31 08:23
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=106473&aid=446436&group_id=6473

Category: expat
Group: None
Status: Open
Resolution: None
Priority: 7
Submitted By: Rich Salz (rsalz)
Assigned to: Nobody/Anonymous (nobody)
Summary: Nested xmlns='' declarations break

Initial Comment:
Nested declarations of the default namespace raise an
exception:
eg3 = """<outer xmlns="">
   <inner xmlns="http://www.ietf.org"/>
</outer>"""

from xml.dom.ext.reader import PyExpat
dom = PyExpat.Reader().fromString(eg3)

Traceback (most recent call last):
  File "x.py", line 7, in ?
    dom = PyExpat.Reader().fromString(eg3)
  File
"/usr/local/lib/python2.0/site-packages/_xmlplus/dom/ext/reader/__init__.py",
line 63, in fromString
    return self.fromStream(stream, ownerDoc)
  File
"/usr/local/lib/python2.0/site-packages/_xmlplus/dom/ext/reader/PyExpat.py",
line 65, in fromStream
    success = self.parser.ParseFile(stream)
  File
"/usr/local/lib/python2.0/site-packages/_xmlplus/dom/ext/reader/PyExpat.py",
line 134, in startElement
    del self._namespaces[prefix]
KeyError

This seems like a good fix.  Line 130 of PyExpat, in
startElement, add "or prefix == ''"
   if (prefix or prefix == '' or value):


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=106473&aid=446436&group_id=6473