python xml dom help please

Andrew Clover and-google at doxdesk.com
Sat Nov 29 13:51:54 EST 2003


spam.meplease at ntlworld.com (deglog) wrote:

> actually i'm trying to change the relationship 'is next sibling of' to
> 'is child of' throughout a document

Well, the snippet in the posting above should do that well enough. What
happens to any existing nested children is not defined.

> How come the current node is back at the start atfter the loop has finished?

Bug. I've just submitted a patch to the PyXML tracker to address this issue.

(Note: earlier versions of TreeWalker - certainly 0.8.0 - have more significant
bugs, that can lead to infinite recursion.)

That said, I'm not sure how using a TreeWalker or walking backwards actually
helps you here! If you are just using it to filter out non-element children,
remember that moving the current node takes the position of the TreeWalker
with it. It's not like NodeIterator.

-- 
Andrew Clover
mailto:and at doxdesk.com
http://www.doxdesk.com/




More information about the Python-list mailing list