public override bool IsSamePosition(XPathNavigator other) { HtmlNodeNavigator navigator = other as HtmlNodeNavigator; if (navigator == null) { this.InternalTrace(">false"); return(false); } this.InternalTrace(">" + (navigator._currentnode == this._currentnode)); return(navigator._currentnode == this._currentnode); }
private HtmlNodeNavigator(HtmlNodeNavigator nav) { this._doc = new HtmlDocument(); this._nametable = new HtmlNameTable(); if (nav == null) { throw new ArgumentNullException("nav"); } this.InternalTrace(null); this._doc = nav._doc; this._currentnode = nav._currentnode; this._attindex = nav._attindex; this._nametable = nav._nametable; }
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); }
public override bool MoveTo(XPathNavigator other) { HtmlNodeNavigator navigator = other as HtmlNodeNavigator; if (navigator == null) { this.InternalTrace(">false (nav is not an HtmlNodeNavigator)"); return(false); } this.InternalTrace(string.Concat(new object[] { "moveto oid=", navigator.GetHashCode(), ", n:", navigator._currentnode.Name, ", a:", navigator._attindex })); if (navigator._doc == this._doc) { this._currentnode = navigator._currentnode; this._attindex = navigator._attindex; this.InternalTrace(">true"); return(true); } this.InternalTrace(">false (???)"); return(false); }