Mark Thomas wrote: > here's how you would do it in lxml (http://codespeak.net/ > lxml/index.html), a library which supports XPath: > > from lxml import etree > tree = etree.fromstring('<highlight><ref>Bar</ref>:</highlight>') > print ' '.join(tree.xpath('//text()'))
If you want to use XPath, try this: print tree.xpath('string()') or if you want to use it in real code: get_tree_text = etree.XPath('string()') print get_tree_text(tree) or just use print etree.tostring(tree, method="text") Stefan -- http://mail.python.org/mailman/listinfo/python-list