예제 #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;
		}