Answer the question
In order to leave comments, you need to log in
How to remove using XPath?
Hello.
There was a question on Xpath. There is this code:
<span class="less-review">I visited this clinic as my wisdom tooth is growing horizontally resulting in bleeding gums,the doctor examined and said the tooth has to go out
<br/>it might result in the surrounding teeth's going bad she explained
<br/>everything in very layman terms as to why we would extracting it
<br/>have made reservations with them to get the tooth extracted,overall a nice experience,
<br/>
<br/></span>
Answer the question
In order to leave comments, you need to log in
hxs = HtmlXPathSelector(response)
data = hxs.xpath('/span/text()').extract()
I think you need to dig towards the normalize-space () function: stackoverflow.com/questions/11007527/xpath-to-get-...
Wouldn't it work similar to php?
$query = $xpath->query('//span[@class="less-review"]');
$query->item(0)->nodeValue; // тут уже чистый текст без лишних тегов.
I can't check, but I think it's necessary to take the parent tag for the block you specified and apply the text() function. For example, if the genus div tag, then the expression will take the form "//div/text()". The entire text of the block without tags should get into the variable.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question