I am using XPath to query into HTML document where there is following div has text:
<div class="h1">2008 Honda Accord Coupe<small> — Wuse II</small></div>
I wanted to fetch only the inner text of the <div class="h1">2008 Honda Accord Coupe
and not include the <small>inner text</small>
I am making following XPath query: //div[@class='h1']
which is definitely returning entire <div>...</div>
node.
How can I only fetch portion without <small>...</small>
Use the text()
function:
//div[@class='h1']/text()