/// <summary>
 /// copy constructor.
 /// </summary>
 /// <param name="other">navigator to be copied</param>
 public XPathObjectNavigator(XPathObjectNavigator other)
 {
     _context = other._context;
     _state   = other._state;
     _root    = other._root;
     _lang    = other._lang;
 }
 /// <summary>
 /// Create a new navigator for the object graph
 /// starting at node. The node's name is nodeName.
 /// </summary>
 /// <param name="node">root</param>
 /// <param name="nodeName">root's name</param>
 public XPathObjectNavigator(object node, string nodeName)
 {
     _context = new ObjectNavigationContext();
     _context.NameTable.Add(string.Empty);
     _root  = new ObjectNavigatorStateRoot(_context, node, nodeName);
     _state = _root.MoveToFirstChild();
     _lang  = _context.NameTable.Add("en-US");
 }
 /// <summary>
 /// See <see cref="System.Xml.XPath.XPathNavigator.MoveToParent" /> for details.
 /// </summary>
 public override bool MoveToParent()
 {
     Trace("MoveToParent");
     if (null != _state.Parent)
     {
         _state = _state.Parent;
         return(true);
     }
     return(false);
 }
        /// <summary>
        /// See <see cref="System.Xml.XPath.XPathNavigator.MoveToNext" /> for details.
        /// </summary>
        public override bool MoveToNext()
        {
            Trace("MoveToNext");
            ObjectNavigatorState newstate = _state.MoveToNext();

            if (null != newstate)
            {
                _state = newstate;
                return(true);
            }
            return(false);
        }
        /// <summary>
        /// See <see cref="System.Xml.XPath.XPathNavigator.MoveToFirstChild" /> for details.
        /// </summary>
        public override bool MoveToFirstChild()
        {
            Trace("MoveToFirstChild");
            ObjectNavigatorState newstate = _state.MoveToFirstChild();

            if (null == newstate)
            {
                return(false);
            }
            _state = newstate;
            return(true);
        }
        /// <summary>
        /// See <see cref="System.Xml.XPath.XPathNavigator.MoveTo" /> for details.
        /// </summary>
        public override bool MoveTo(System.Xml.XPath.XPathNavigator other)
        {
            Trace("MoveTo");
            XPathObjectNavigator navigator = other as XPathObjectNavigator;

            if (null == other)
            {
                return(false);
            }
            _state   = navigator._state;
            _root    = navigator._root;
            _context = navigator._context;
            return(true);
        }
 /// <summary>
 /// See <see cref="System.Xml.XPath.XPathNavigator.MoveToRoot" /> for details.
 /// </summary>
 public override void MoveToRoot()
 {
     Trace("MoveToRoot");
     _state = _root;
 }