示例#1
0
        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);
        }
示例#2
0
 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;
 }
示例#3
0
文件: HtmlNode.cs 项目: ttrr1/Midea
        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);
        }
示例#4
0
文件: HtmlNode.cs 项目: ttrr1/Midea
        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);
        }
示例#5
0
        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);
        }