Python libxml2 not quite threadsafe, use lxml instead for xpathing!

Python libxml2 not quite threadsafe, use lxml instead for xpathing! although lxml is just a wrapper for the same libxml2 library that python's libxml2 module (python-libxml2) uses, it will act very strange when you're calling parseDoc in a loop in your threads.

text() is a special xpath function in lxml

import lxml.etree as etree
f = StringIO.StringIO('<hours>anytime</hours>')
tree = etree.parse(f)
res = tree.xpath('//hours/text()')
print res[0]

0
Your rating: None