XML::Twig-like module wanted
Fredrik Lundh
fredrik at pythonware.com
Fri Jul 19 04:40:16 EDT 2002
Henrik Motakef wrote:
> Does anybody know about something similar to XML::Twig (see
> <http://www.xmltwig.com>) for Python?
from your description, it sounds like the "pulldom" standard
module is what you want:
from xml.dom import pulldom
source = pulldom.parse("somefile.xml")
for event, node in source:
# node is now a dom node without child elements
if event == "START_ELEMENT" and node.tagName == "record":
# make sure we have all child elements
source.expandNode(node)
process(node)
</F>
More information about the Python-list
mailing list