i have following HTML code:-
<table class="results">
<tr>
<td>
<a href="..">link</a><span>2nd Mar 2011</span><br>XYZ Consultancy Ltd<br>
<div>....</div>
</td>
</tr>
</table>
I am using lxml+python code to parse above HTML file. I want to retrieve "XYZ Consultancy Ltd" but I am not able to find out how to do this. So far my code is as follows:-
import lxml.html
for el in root.cssselect("table.results"):
for el2 in el: #tr tags
for e13 in el2:#td tags
for e14 in e13:
if ( e14.tag == 'a') :
print "keyword: ",e14.text_content()
if (e14.tag == 'span'):
print "date: ",e14.text_content()