Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
 /// <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;
 }
Exemplo n.º 3
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;
     _nodeType        = XPathNodeType.All;
     _nodeState       = NodeState.ObjectNotKnown;
     _attributesCount = -1;
     _elementsCount   = -1;
 }
Exemplo n.º 4
0
        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
            }

            _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;
 }