I am using lxml\'s xpath function to retrieve parts of a webpage. I am trying to get contents of a tag, which includes html tags of its own. If I u
I'm not sure I understand -- is this close to what you are looking for?
import lxml.etree as le
import cStringIO
content='''\
inside something
'''
doc=le.parse(cStringIO.StringIO(content))
xpath='//font[@face="verdana" and @color="#ffffff" and @size="2"]/child::*'
x=doc.xpath(xpath)
print(map(le.tostring,x))
# ['inside something']