
Problem 2: I want also to extract "Some texttext" just after the span class. Then, I have to trigger an event in an SAX like method. If you agree with with how I could do such trick if I am already working in
Hi, "lxml" <lxml-bounces@lxml.de> schrieb am 05.11.2013 17:00:48: the
TREE.xpath('/html/body/table') ?
Again, multiple ways to do it.
I was thinking about this one:
Or iterate over the children until you find the right <br> and read its tail.
But what is the syntaxe with the example I gave you ? (Sorry but I better understand now thanks to your example with the exact syntaxe)
Already delete your original mail but this might get you going:
tree = etree.fromstring('<root><mixed>mixed text<x>x text</x>x tail</mixed></root>') print etree.tostring(tree, pretty_print=True) <root> <mixed>mixed text<x>x text</x>x tail</mixed> </root>
for elem in tree.iter(): ... if elem.tail: # use appropriate condition here to select your elements ... print elem, elem.tail ... <Element x at 0x3a2d78> x tail
Holger Landesbank Baden-Wuerttemberg Anstalt des oeffentlichen Rechts Hauptsitze: Stuttgart, Karlsruhe, Mannheim, Mainz HRA 12704 Amtsgericht Stuttgart