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

Reply via email to