Esempio n. 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);
     }
 }
Esempio n. 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.");
			}		    		    
		}
Esempio n. 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.");
            }
        }
Esempio n. 4
0
 internal XmlNodeNavigator(NavigatorState state)
 {
     _state = new NavigatorState(state);
 }
Esempio n. 5
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 public NavigatorState(NavigatorState state)
 {
     Navigator    = state.Navigator.Clone();
     AtRoot       = state.AtRoot;
     DocumentNode = state.DocumentNode;
 }
Esempio n. 6
0
		internal XmlNodeNavigator(NavigatorState state) 
		{
			_state = new NavigatorState(state);
		}
Esempio n. 7
0
		/// <summary>
		/// Copy constructor.
		/// </summary>        
		public NavigatorState(NavigatorState state) 
		{
			Navigator = state.Navigator.Clone();
			AtRoot = state.AtRoot;
			DocumentNode = state.DocumentNode;
		}
Esempio n. 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;
		}