예제 #1
0
		/// <summary>
		/// Creates a new navigator positioned at the same node as other navigator.
		/// </summary>
		/// <param name="other">Navigator to be copied</param>
		private ObjectXPathNavigator(ObjectXPathNavigator other)
		{
			if (other._context.DetectLoops)
				_navigationStack = new Stack();
			//Trace("Ctor2");
			MoveTo(other);
		}
예제 #2
0
 /// <summary>
 /// Creates a new navigator positioned at the same node as other navigator.
 /// </summary>
 /// <param name="other">Navigator to be copied</param>
 private ObjectXPathNavigator(ObjectXPathNavigator other)
 {
     if (other._context.DetectLoops)
     {
         _navigationStack = new Stack();
     }
     //Trace("Ctor2");
     MoveTo(other);
 }
예제 #3
0
        /// <summary>
        /// See <see cref="System.Xml.XPath.XPathNavigator.ComparePosition" /> for details.
        /// </summary>
        public override XmlNodeOrder ComparePosition(XPathNavigator nav)
        {
            ObjectXPathNavigator other = nav as ObjectXPathNavigator;

            if (other == null)
            {
                return(XmlNodeOrder.Unknown);
            }

            if (_childNav == null && other._childNav == null)
            {
                if (_node == other._node)
                {
                    return(XmlNodeOrder.Same);
                }

                Node parent      = GetNonTransparentParent(_node);
                Node otherParent = GetNonTransparentParent(other._node);
                if (parent == otherParent)
                {
                    if (_node.NodeType == XPathNodeType.Attribute)
                    {
                        if (other._node.NodeType == XPathNodeType.Attribute)
                        {
                            if (_node.Index < other._node.Index)
                            {
                                return(XmlNodeOrder.Before);
                            }
                            else
                            {
                                return(XmlNodeOrder.After);
                            }
                        }
                        else
                        {
                            return(XmlNodeOrder.Before);
                        }
                    }
                }
            }
            XmlNodeOrder position = base.ComparePosition(nav);

            return(position);
        }
예제 #4
0
        /// <summary>
        /// See <see cref="System.Xml.XPath.XPathNavigator.IsSamePosition" /> for details.
        /// </summary>
        /// <returns>Returns <see langword="true"/> if this navigator is positioned
        /// at the same node as other navigator, and <see langword="false"/>
        /// otherwise.</returns>
        public override bool IsSamePosition(XPathNavigator other)
        {
#if DEBUG
            Trace(() => string.Format("IsSamePosition( N#{0} )", other.GetHashCode()));
#endif
            ObjectXPathNavigator x = other as ObjectXPathNavigator;
            if (x == null)
            {
                return(false);
            }

            if (_context != x._context)
            {
                return(false);
            }

            // Compare child navigators
            if (_childNav != null)
            {
                if (x._childNav != null)
                {
                    // Both child navigators are not null
                    return(_childNav.IsSamePosition(x._childNav));
                }
                else
                {
                    // Our navigator is not null, but other is null;
                    return(false);
                }
            }
            else if (x._childNav != null)
            {
                // In case if our navigator is null and other is not.
                return(false);
            }

            if (_node != x._node)
            {
                return(false);
            }

            return(true);
        }
예제 #5
0
		/// <summary>
		/// Creates a new <see cref="LoopDetectionEventArgs"/> instance.
		/// </summary>
		/// <param name="navigator"><see cref="ObjectXPathNavigator"/> Navigator object</param>
		/// <param name="node"><see cref="Node"/> Node that caused loop appearance</param>
		public LoopDetectionEventArgs( ObjectXPathNavigator navigator, Node node )
		{
			_navigator = navigator;
			_node = node;
			_ignoreLoop = false;
		}
예제 #6
0
 /// <summary>
 /// Creates a new <see cref="LoopDetectionEventArgs"/> instance.
 /// </summary>
 /// <param name="navigator"><see cref="ObjectXPathNavigator"/> Navigator object</param>
 /// <param name="node"><see cref="Node"/> Node that caused loop appearance</param>
 public LoopDetectionEventArgs(ObjectXPathNavigator navigator, Node node)
 {
     _navigator  = navigator;
     _node       = node;
     _ignoreLoop = false;
 }