示例#1
0
 /// <summary>See <see cref="XPathNavigator.MoveTo"/></summary>
 public override bool MoveTo(XPathNavigator other)
 {
     if (other != null && other is XmlNodeNavigator)
     {
         XmlNodeNavigator otherNav = (XmlNodeNavigator)other;
         if (otherNav.State.DocumentNode != _state.DocumentNode)
         {
             return(false);
         }
         _state = new NavigatorState(otherNav.State);
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#2
0
		/// <summary>
		/// Creates XmlNodeNavigator over given XmlNode.
		/// </summary>
		/// <param name="node">Root node for the navigator.</param>
		public XmlNodeNavigator(XmlNode node) 
		{
			if (node == null)
				throw new NullReferenceException("Node to navigate over cannot be null");                          
			switch (node.NodeType) 
			{
				case XmlNodeType.Element:
				case XmlNodeType.Comment:
				case XmlNodeType.ProcessingInstruction:
				case XmlNodeType.CDATA:
				case XmlNodeType.Text:
				case XmlNodeType.Whitespace:
				case XmlNodeType.SignificantWhitespace:
					_state = new NavigatorState(node);
					break;
				default:
					throw new NotSupportedException("Given node to navigate over must be Element, Comment, PI or text node.");
			}		    		    
		}
示例#3
0
        /// <summary>
        /// Creates XmlNodeNavigator over given XmlNode.
        /// </summary>
        /// <param name="node">Root node for the navigator.</param>
        public XmlNodeNavigator(XmlNode node)
        {
            if (node == null)
            {
                throw new NullReferenceException("Node to navigate over cannot be null");
            }
            switch (node.NodeType)
            {
            case XmlNodeType.Element:
            case XmlNodeType.Comment:
            case XmlNodeType.ProcessingInstruction:
            case XmlNodeType.CDATA:
            case XmlNodeType.Text:
            case XmlNodeType.Whitespace:
            case XmlNodeType.SignificantWhitespace:
                _state = new NavigatorState(node);
                break;

            default:
                throw new NotSupportedException("Given node to navigate over must be Element, Comment, PI or text node.");
            }
        }
示例#4
0
 internal XmlNodeNavigator(NavigatorState state)
 {
     _state = new NavigatorState(state);
 }
示例#5
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 public NavigatorState(NavigatorState state)
 {
     Navigator    = state.Navigator.Clone();
     AtRoot       = state.AtRoot;
     DocumentNode = state.DocumentNode;
 }
示例#6
0
		internal XmlNodeNavigator(NavigatorState state) 
		{
			_state = new NavigatorState(state);
		}
示例#7
0
		/// <summary>
		/// Copy constructor.
		/// </summary>        
		public NavigatorState(NavigatorState state) 
		{
			Navigator = state.Navigator.Clone();
			AtRoot = state.AtRoot;
			DocumentNode = state.DocumentNode;
		}
示例#8
0
		/// <summary>See <see cref="XPathNavigator.MoveTo"/></summary>
		public override bool MoveTo(XPathNavigator other) 
		{
			if (other != null && other is XmlNodeNavigator) 
			{
				XmlNodeNavigator otherNav = (XmlNodeNavigator)other;
				if (otherNav.State.DocumentNode != _state.DocumentNode)
					return false;
				_state = new NavigatorState(otherNav.State);
				return true;
			} 
			else            		
				return false;
		}