Jython

Issue1047

classification
Title: xml.dom.pulldom doesn't work
Type: behaviour Severity: normal
Components: None Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: leosoto, zyasoft
Priority: Keywords:

Created on 2008年06月06日.02:39:04 by leosoto, last changed 2008年09月14日.01:41:17 by zyasoft.

Messages
msg3228 (view) Author: Leonardo Soto (leosoto) Date: 2008年06月06日.02:38:59
Parsing with pulldom doesn't work on jython trunk:
>>> from xml.dom.pulldom import parseString
>>> list(parseString("<foo></foo>"))
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/home/lsoto/src/jython.doj/jython/dist/Lib/xml/dom/pulldom.py",
line 231, in next
 rc = self.getEvent()
 File "/home/lsoto/src/jython.doj/jython/dist/Lib/xml/dom/pulldom.py",
line 285, in _emit
 rc = self.pulldom.firstEvent[1][0]
TypeError: 'NoneType' object is unsubscriptable
msg3229 (view) Author: Leonardo Soto (leosoto) Date: 2008年06月06日.02:44:11
While I suspect that the root of the problem is the sax parser output
not conforming with what pulldom expects, changing DOMEventStream._emit
from:
 def _emit(self):
 """ Fallback replacement for getEvent() that emits
 the events that _slurp() read previously.
 """
 rc = self.pulldom.firstEvent[1][0]
 self.pulldom.firstEvent[1] = self.pulldom.firstEvent[1][1]
 return rc
To the following:
 def _emit(self):
 """ Fallback replacement for getEvent() that emits
 the events that _slurp() read previously.
 """
 if self.pulldom.firstEvent[1] is None:
 return None
 rc = self.pulldom.firstEvent[1][0]
 self.pulldom.firstEvent[1] = self.pulldom.firstEvent[1][1]
 return rc
*Seems* to work.
msg3317 (view) Author: Leonardo Soto (leosoto) Date: 2008年07月02日.03:32:35
Workaround applied on r4836.
I think this need further investigation, thought.
msg3574 (view) Author: Jim Baker (zyasoft) Date: 2008年09月14日.01:41:17
Fixed in 2.5
Tested in test_minidom.testSAX2DOM
History
Date User Action Args
2008年09月14日 01:41:17zyasoftsetstatus: open -> closed
resolution: fixed
messages: + msg3574
nosy: + zyasoft
2008年07月02日 03:32:35leosotosetmessages: + msg3317
2008年06月06日 02:44:12leosotosetmessages: + msg3229
2008年06月06日 02:39:04leosotocreate

Supported by Python Software Foundation,
Powered by Roundup

AltStyle によって変換されたページ (->オリジナル) /