
Année 2013, mardi 05 novembre, vers 13:50, Stefan Behnel écrivait:
You could try either of the following: title = document.xpath("./tr/td/span[@class = 'Title']//text()")
Exactly what I was looking for.
title = document.xpath("string(./tr/td/span[@class = 'Title'])")
Works fine (I just have to add .encode('UTF-8') at the end.
or even
text = etree.tostring( document.xpath("./tr/td/span[@class = 'Title']")[0], method='text')
Many thanks for all these solution. I know better understand how it works.
depending on what exactly you want as a result.
Sure!
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 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) Many thanks for your help, -- Alexandre Delanoë