python xml dom help please
Miklós
nospam at nowhere.hu
Sun Nov 23 12:51:20 EST 2003
Without having any thorough look at your (recursive)'deepen' function, I can
see there's no termination condition for the recursion....
So that's one reason this won't work the way you want it to.
Miklós
deglog <spam.meplease at ntlworld.com> wrote in message
news:f78fb98.0311230813.3ab7cfd4 at posting.google.com...
>
> ---------------
> #!/usr/bin/env python
>
> from xml.dom.ext.reader import PyExpat
> from xml.dom.ext import PrettyPrint
>
> import sys
>
> def deepen(nodeList):
> for node in nodeList:
> print(node.nodeName)
> if node.previousSibling != None:
> if node.previousSibling.nodeType == node.ELEMENT_NODE:
> if node.previousSibling.hasChildNodes():
> print("has children")
> node.previousSibling.lastChild.appendChild(node)
> else:
> node.previousSibling.appendChild(node)
> deepen(node.childNodes)
>
More information about the Python-list
mailing list