[issue13551] pulldom doesn't populate DOM tree
Achim Gaedke achim.gae...@physik.tu-darmstadt.de added the comment: Potentially both: The xml.dom.pulldom documentation is not really there. Maybe the PullDOM builds a partial tree, not caring about nested nodes. In contrast to SAX2DOM, which seems to fill the DOM tree completely. I tried to figure out, what the programmer intended to do: Obviously SAX2DOM extends the behaviour of PullDOM. The documentation (online V3.2, retrieved today) does state: PullDOM allows building only selected portions of a Document Object Model representation Does that mean, one would derive a customized class from PullDOM, implement methods like SAX2DOM, but control the construction with conditions? For example: class MyDOM(PullDOM): def startElement(self, name, attrs): PullDOM.startElement(self, name, attrs) if name[:3]==my_: curNode = self.elementStack[-1] parentNode = self.elementStack[-2] parentNode.appendChild(curNode) When someone says YEAH, MATE, ABSOLUTELY, YOU GOT IT!, I might be able fill some of the documentation gaps. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13551 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13551] pulldom doesn't populate DOM tree
New submission from Achim Gaedke achim.gae...@physik.tu-darmstadt.de: Hi! I tried to use the more general xml.dom interface, no longer defaulting to minidom straight away (or using etree). The DOM tree gained with PullDOM seem to be incomplete. Here is the output of the program attached. $ python pulldom_test.py with pulldom (xml.dom.minidom.Document instance at 0xb722962c, []) with minidom (xml.dom.minidom.Document instance at 0xb72459ac, [DOM Text node u'\n', DOM Element: a at 0xb71cb74c, DOM Text node u'\n', DOM Element: b at 0xb71cb7ac, DOM Text node u'\n', DOM Element: c at 0xb71cb80c, DOM Text node u'\n']) I'd expect the same result for both ways of populating the minidom DOM implementation. Thanks Cheers, Achim -- components: XML files: pulldom_test.py messages: 149006 nosy: AchimGaedke priority: normal severity: normal status: open title: pulldom doesn't populate DOM tree type: behavior versions: Python 3.2 Added file: http://bugs.python.org/file23872/pulldom_test.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13551 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13551] pulldom doesn't populate DOM tree
Achim Gaedke achim.gae...@physik.tu-darmstadt.de added the comment: sorry, the output given before was generated with python2.7 changing the line xml.sax.parseString(xml_data, d_handler) to xml.sax.parseString(bytes(xml_data, utf-8), d_handler) makes it working for python 3.2, result the same: $ python3.2 pulldom_test.py with pulldom xml.dom.minidom.Document object at 0x9bf9f2c [] with minidom xml.dom.minidom.Document object at 0x9c2fccc [DOM Text node '\n', DOM Element: a at 0x9c3850c, DOM Text node '\n', DOM Element: b at 0x9c3856c, DOM Text node '\n', DOM Element: c at 0x9c385cc, DOM Text node '\n'] Both test were done on debian testing/wheezy. $ python3.2 -V Python 3.2.2rc1 $ python -V Python 2.7.2+ -- versions: +Python 2.7 Added file: http://bugs.python.org/file23874/pulldom_test.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13551 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1778] SyntaxError.offset sometimes wrong
Achim Gaedke added the comment: sometimes offset is None... Example: def blub(bla, blub=None, blabla): bla causes: non-default argument follows default argument Added file: http://bugs.python.org/file9150/compile_test.py __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1778 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1778] SyntaxError.offset sometimes wrong
New submission from Achim Gaedke: The value SyntaxError.offset is for most SyntaxErrors an offset from beginning of line SyntaxError.lineno. In case of an triple-quoted string which is not at all closed, offset seems to be the offset from beginning of the buffer. -- components: Interpreter Core files: compile_test.py messages: 59634 nosy: AchimGaedke severity: normal status: open title: SyntaxError.offset sometimes wrong type: behavior versions: Python 2.4, Python 2.5 Added file: http://bugs.python.org/file9116/compile_test.py __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1778 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1499] failure behaviour of compile() is missing
New submission from Achim Gaedke: Regarding the compile() function in html/lib/built-in-funcs.html: Please add a note about the exceptions raised by this function. -- components: Documentation messages: 57850 nosy: AchimGaedke severity: minor status: open title: failure behaviour of compile() is missing versions: Python 2.4, Python 2.5 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1499 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1137] pyexpat patch for changing buffer_size
New submission from Achim Gaedke: Hello! Sometimes people have big amounts of text/data in xml files. To make processing more effective, they should be able to change the buffer size for collecting character data in one string. Here comes a patch that applies necessary changes in setattr method. It handles reallocation sufficiently efficient without introducing extra variables to the parser class. Also a documentation patch and some test cases are available. These patches and tests were done with debian etch python2.5, which is python-2.5.1 . This patch also works on python2.4 . -- components: XML files: pyexpat_c_patch messages: 55767 nosy: AchimGaedke severity: normal status: open title: pyexpat patch for changing buffer_size versions: Python 2.5 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1137 __ pyexpat_c_patch Description: Binary data ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1137] pyexpat patch for changing buffer_size
Changes by Achim Gaedke: __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1137 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1137] pyexpat patch for changing buffer_size
Changes by Achim Gaedke: __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1137 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com