public HtmlNode SelectSingleNode(string xpath) { if (xpath == null) { throw new ArgumentNullException("xpath"); } XPathNodeIterator iterator = new HtmlNodeNavigator(this._ownerdocument, this).Select(xpath); if (!iterator.MoveNext()) { return(null); } HtmlNodeNavigator current = (HtmlNodeNavigator)iterator.Current; return(current.CurrentNode); }
public HtmlNodeCollection SelectNodes(string xpath) { HtmlNodeCollection nodes = new HtmlNodeCollection(null); XPathNodeIterator iterator = new HtmlNodeNavigator(this._ownerdocument, this).Select(xpath); while (iterator.MoveNext()) { HtmlNodeNavigator current = (HtmlNodeNavigator)iterator.Current; nodes.Add(current.CurrentNode); } if (nodes.Count == 0) { return(null); } return(nodes); }