用DOM实现文章采集--通过jquery语法式的方法采集指定对象的文本(2)
来源:未知 责任编辑:责任编辑 发表时间:2014-04-20 03:40 点击:次
}
}
return hnList;
}
/// <summary>
/// 查找节点,并直接返回InnerHtml
/// </summary>
/// <param name="_HtmlDocument"></param>
/// <param name="selector"></param>
/// <returns></returns>
public string SingleGetInnerHtml(HtmlDocument _HtmlDocument, string selector)
{
HtmlNode hn = SingleGet(_HtmlDocument, selector);
if (hn == null)
return null;
else
return hn.InnerHtml;
}
/// <summary>
/// 查找节点,并直接返回InnerText
/// </summary>
/// <param name="_HtmlDocument"></param>
/// <param name="selector"></param>
/// <returns></returns>
public string SingleGetInnerText(HtmlDocument _HtmlDocument, string selector)
{
HtmlNode hn = SingleGet(_HtmlDocument, selector);
if (hn == null)
return null;
else
return hn.InnerText.Trim();
}
/// <summary>
/// 查找节点
/// </summary>
/// <param name="_HtmlDocument"></param>
/// <param name="selector"></param>
/// <returns></returns>
public HtmlNode SingleGet(HtmlDocument _HtmlDocument, string selector)
{
IList<HtmlNode> hnList = Get(_HtmlDocument, selector);
if (hnList.Count == 0)
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>