示例#1
0
        /// <summary>
        /// Moves to the same position as the specified HtmlNavigator.
        /// </summary>
        /// <param name="other">The HtmlNavigator positioned on the node that you want to move to.</param>
        /// <returns>true if successful, otherwise false. If false, the position of the navigator is unchanged.</returns>
        public override bool MoveTo(XPathNavigator other)
        {
            HtmlNodeNavigator nav = other as HtmlNodeNavigator;

            if (nav == null)
            {
                this.InternalTrace(">false (nav is not an HtmlNodeNavigator)");
                return(false);
            }

            this.InternalTrace("moveto oid=" + nav.GetHashCode()
                               + ", n:" + nav._currentnode.Name
                               + ", a:" + nav._attindex);

            if (nav._doc == this._doc)
            {
                this._currentnode = nav._currentnode;
                this._attindex    = nav._attindex;
                this.InternalTrace(">true");
                return(true);
            }

            // we don't know how to handle that
            this.InternalTrace(">false (???)");
            return(false);
        }
        /// <summary>
        /// Moves to the same position as the specified HtmlNavigator.
        /// </summary>
        /// <param name="other">The HtmlNavigator positioned on the node that you want to move to.</param>
        /// <returns>true if successful, otherwise false. If false, the position of the navigator is unchanged.</returns>
        public override bool MoveTo(XPathNavigator other)
        {
            HtmlNodeNavigator nav = other as HtmlNodeNavigator;

            if (nav == null)
            {
                InternalTrace(">false (nav is not an HtmlNodeNavigator)");
                return(false);
            }
            InternalTrace("moveto oid=" + nav.GetHashCode()
                          + ", n:" + nav._currentnode.Name
                          + ", a:" + nav._attindex);

            if (nav._doc == _doc)
            {
                if (nav._attindex > -1)
                {
                    CurrentNode = nav._currentnode.Attributes[nav._attindex];
                    _attindex   = 0;
                }
                else
                {
                    CurrentNode = nav._currentnode;
                    _attindex   = nav._attindex;
                }
                InternalTrace(">true");
                return(true);
            }
            // we don't know how to handle that
            InternalTrace(">false (???)");
            return(false);
        }
示例#3
0
        /// <summary>
        /// Moves to the same position as the specified HtmlNavigator.
        /// </summary>
        /// <param name="other">The HtmlNavigator positioned on the node that you want to move to.</param>
        /// <returns>true if successful, otherwise false. If false, the position of the navigator is unchanged.</returns>
        public override bool MoveTo(XPathNavigator other)
        {
            HtmlNodeNavigator nav = other as HtmlNodeNavigator;

            if (nav == null)
            {
#if TRACE_NAVIGATOR
                InternalTrace(">false (nav is not an HtmlNodeNavigator)");
#endif
                return(false);
            }

#if TRACE_NAVIGATOR
            InternalTrace("moveto oid=" + nav.GetHashCode()
                          + ", n:" + nav._currentnode.Name
                          + ", a:" + nav._attindex);
#endif

            if (nav._doc == _doc)
            {
                _currentnode = nav._currentnode;
                _attindex    = nav._attindex;
#if TRACE_NAVIGATOR
                InternalTrace(">true");
#endif
                return(true);
            }

            // we don't know how to handle that
#if TRACE_NAVIGATOR
            InternalTrace(">false (???)");
#endif
            return(false);
        }