C# 如何使用c在HTML中获取特定文本?
如何从下面的HTML中获取文本吸引力C# 如何使用c在HTML中获取特定文本?,c#,asp.net,.net,C#,Asp.net,.net,如何从下面的HTML中获取文本吸引力 <li class="product"> <strong> <a href="http://[SITENAME]/id=23423">Attractions</a> </strong> <span></span> </li> 我该怎么做 Result = htmlDocument.DocumentNode.SelectS
<li class="product">
<strong>
<a href="http://[SITENAME]/id=23423">Attractions</a>
</strong>
<span></span>
</li>
我该怎么做
Result = htmlDocument.DocumentNode.SelectSingleNode("//li[@class='product']/strong/a").InnerText;
您还可以使用SelectNodes进行foreach操作,就像您在上面所做的一样。难道您不知道如何提问吗?
Result = htmlDocument.DocumentNode.SelectSingleNode("//li[@class='product']/strong/a").InnerText;