I have next part of html code:
<div class="resum_card">
<p><a href="#opyt" class="no_decore">Experience:</a> 5 years</p>
</div>
And what i try inside the code:
nodeValue = hd.DocumentNode.SelectSingleNode("//div[@class='resum_card']//p//a[@class='no_decore']//following-sibling::a");
But it return me null, can anybody help me?
You can try this XPath to get text node after <a>
element :
nodeValue = hd.DocumentNode
.SelectSingleNode("//div[@class='resum_card']/p/a/following-sibling::text()");
Note: simply use single slash ( /
) instead of double ( //
) to select element that is direct child of current element. It is better performance wise.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.