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