Message6566

Author pekka.klarck
Recipients pekka.klarck
Date 2011-07-11.22:45:32
SpamBayes Score 1.3699653e-11
Marked as misclassified No
Message-id <1310424333.12.0.381524191089.issue1768@psf.upfronthosting.co.za>
In-reply-to
Content
When using sax.parse, attributes passed to startElement are broken if an element has an attribute with name 'id'. This can be demonstrated with the attached script. Below is the output I get with Jython 2.5.2:

$ jython saxbug.py 
attr  : idx
value : 1
attr  : (u'i', u'd')
value :
Traceback (most recent call last):
  File "saxbug.py", line 11, in <module>
    sax.parse(StringIO('<tag id="1"/>'), Handler())
  File "/home/peke/Prog/jython2.5.2/Lib/xml/sax/__init__.py", line 34, in parse
    parser.parse(source)
  File "/home/peke/Prog/jython2.5.2/Lib/xml/sax/drivers2/drv_javasax.py", line 146, in parse
    self._parser.parse(JyInputSourceWrapper(source))
  File "/home/peke/Prog/jython2.5.2/Lib/xml/sax/drivers2/drv_javasax.py", line 187, in startElement
    self._cont_handler.startElement(qname, self._attrs)
  File "saxbug.py", line 8, in startElement
    print 'value :', attrs.values()[0]
  File "/home/peke/Prog/jython2.5.2/Lib/xml/sax/drivers2/drv_javasax.py", line 311, in values
    return map(self.getValue, self.getNames())
  File "/home/peke/Prog/jython2.5.2/Lib/xml/sax/drivers2/drv_javasax.py", line 266, in getValue
    value = self._attrs.getValue(_makeJavaNsTuple(name))
TypeError: getValue(): 1st arg can't be coerced to String, int
History
Date User Action Args
2011-07-11 22:45:33pekka.klarcksetrecipients: + pekka.klarck
2011-07-11 22:45:33pekka.klarcksetmessageid: <1310424333.12.0.381524191089.issue1768@psf.upfronthosting.co.za>
2011-07-11 22:45:33pekka.klarcklinkissue1768 messages
2011-07-11 22:45:32pekka.klarckcreate