【问题标题】:HtmlAgilityPack selecting nodes with end differentHtmlAgilityPack 选择以不同结尾的节点
【发布时间】:2011-02-17 02:37:45
【问题描述】:

我有这个代码...

<td class="alt1" id="td_threadtitle_335784">
<td class="alt1" id="td_threadtitle_342222">
<td class="alt1" id="td_threadtitle_554213">
<td class="alt1" id="td_threadtitle_31226">
<td class="alt1" id="td_threadtitle_9442">

问题是……

如何使用 selectnodes 或其他功能来选择 ID...

我试试-

foreach (HtmlNode n in doc.DocumentNode.SelectNodes("//a[@id='td_threadtitle_']"))

但是最后的数字是$%@# Everthing...

[]的

【问题讨论】:

  • 你能解释一下你的问题吗?你想选择什么? “td_threadtitle_335784”,“td_threadtitle_342222”,...?还是只有数字?

标签: html-agility-pack nodes selectnodes


【解决方案1】:

[已解决] 我只想选择 td_threadtitle_

然后我用这个...

  `("//a[starts-with(@id,'thread_title_')]")`

效果很好!

我在这里也看到了这段代码..

谢谢

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多