/// <summary>
        /// See <see cref="System.Xml.XPath.XPathNavigator.MoveTo" /> for details.
        /// </summary>
        public override bool MoveTo(XPathNavigator other)
        {
            var otherNav = other as ObjectXPathNavigator;

            if (otherNav == null)
            {
                return(false);
            }

            _context = otherNav._context;
            _root    = otherNav._root;
            _node    = otherNav._node;
            if (otherNav._childNav != null)
            {
                _childNav      = otherNav._childNav.Clone();
                _childNavDepth = otherNav._childNavDepth;
            }
            else
            {
                _childNav = null;
            }

#if DEBUG
            Trace(() => string.Format("MoveTo( N#{0} )", other.GetHashCode()));
#endif

            if (_context.DetectLoops)
            {
                _navigationStack = (Stack)otherNav._navigationStack.Clone();
            }

            return(true);
        }
 /// <summary>
 /// Creates a copy of given context. Contexts shares the same name table,
 /// namespace manager, and factories.
 /// </summary>
 /// <param name="other">An instance of <see cref="ObjectXPathContext"/> to
 /// copy.</param>
 private ObjectXPathContext(ObjectXPathContext other) :
     this((XmlNamespaceManager)null)
 {
     _nameTable         = other.NameTable;
     _namespaceManager  = other.NamespaceManager;
     _nodePolicyFactory = other._nodePolicyFactory;
     _converterFactory  = other._converterFactory;
 }
		/// <summary>
		/// Creates a copy of given context. Contexts shares the same name table,
		/// namespace manager, and factories.
		/// </summary>
		/// <param name="other">An instance of <see cref="ObjectXPathContext"/> to 
		/// copy.</param>
		private ObjectXPathContext( ObjectXPathContext other ) : 
			this( (XmlNamespaceManager)null )
		{
			_nameTable = other.NameTable;
			_namespaceManager = other.NamespaceManager;
			_nodePolicyFactory = other._nodePolicyFactory;
			_converterFactory = other._converterFactory;
		}
Exemple #4
0
 /// <summary>
 /// Creates a new <see cref="Node"/> instance.
 /// </summary>
 /// <param name="context">Context this node belongs to.</param>
 /// <param name="policy">The node policy.</param>
 public Node(ObjectXPathContext context, INodePolicy policy)
 {
     _context    = context;
     _nodePolicy = policy;
     // _parent = null;
     //_index = 0;
     //_name = null;
     //_namespace = null;
     _nodeType = XPathNodeType.All;
     //_targetObject = null;
     _nodeState = NodeState.ObjectNotKnown;
     //_targetObjectType = null;
     //_isTransparent = false;
     //_knowTransparent = false;
     //_value = null;
     _attributesCount = -1;
     _elementsCount   = -1;
 }
        internal ObjectXPathNavigator(object obj, ObjectXPathContext context)
        {
            _context = context;

            _root = new Node(_context, new RootNodePolicy(obj));
            _node = _root;

            if (_context.DetectLoops)
            {
                _navigationStack = new Stack();
                _navigationStack.Push(_root);                   // Push dummy root object
                //_navigationStack.Push(_node.Object);

                //Trace( String.Format( "Ctor1: Pushedg {0} {1}", _node.Object, StackList ) );
            }

            _lang = _context.NameTable.Add("");
        }
Exemple #6
0
		/// <summary>
		/// Creates a new <see cref="Node"/> instance.
		/// </summary>
		/// <param name="context">Context this node belongs to.</param>
		/// <param name="policy">The node policy.</param>
		public Node( ObjectXPathContext context, INodePolicy policy )
		{
			_context = context;
			_nodePolicy = policy;
			// _parent = null;
			//_index = 0;
			//_name = null;
			//_namespace = null;
			_nodeType = XPathNodeType.All;
			//_targetObject = null;
			_nodeState = NodeState.ObjectNotKnown;
			//_targetObjectType = null;
			//_isTransparent = false;
			//_knowTransparent = false;
			//_value = null;
			_attributesCount = -1;
			_elementsCount = -1;
		}
		internal ObjectXPathNavigator(object obj, ObjectXPathContext context)
		{

			_context = context;

			_root = new Node(_context, new RootNodePolicy(obj));
			_node = _root;

			if (_context.DetectLoops)
			{
				_navigationStack = new Stack();
				_navigationStack.Push( _root ); // Push dummy root object
				//_navigationStack.Push(_node.Object);

				//Trace( String.Format( "Ctor1: Pushedg {0} {1}", _node.Object, StackList ) );
			}

			_lang = _context.NameTable.Add("");
		}
		/// <summary>
		/// Creates a new <see cref="NodePolicyFactory"/> instance.
		/// </summary>
		/// <param name="context">Context to which this factory will belong.</param>
		public NodePolicyFactory( ObjectXPathContext context )
		{
			_typePolicy = new Hashtable();
			_context = context;
		}
Exemple #9
0
 /// <summary>
 /// Creates a new <see cref="NodePolicyFactory"/> instance.
 /// </summary>
 /// <param name="context">Context to which this factory will belong.</param>
 public NodePolicyFactory(ObjectXPathContext context)
 {
     _typePolicy = new Hashtable();
     _context    = context;
 }
		/// <summary>
		/// See <see cref="System.Xml.XPath.XPathNavigator.MoveTo" /> for details.
		/// </summary>
		public override bool MoveTo(XPathNavigator other)
		{

			var otherNav = other as ObjectXPathNavigator;
			if( otherNav == null )
			{
				return false;
			}

			_context = otherNav._context;
			_root = otherNav._root;
			_node = otherNav._node;
			if( otherNav._childNav != null )
			{
				_childNav = otherNav._childNav.Clone();
				_childNavDepth = otherNav._childNavDepth;
			}
			else
				_childNav = null;

#if DEBUG
			Trace( () => string.Format( "MoveTo( N#{0} )", other.GetHashCode() ) );
#endif

			if( _context.DetectLoops )
			{
				_navigationStack = (Stack) otherNav._navigationStack.Clone();
			}

			return true;
		}