Exemplo n.º 1
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.º 2
0
        /// <summary>
        /// Creates a new <see cref="ObjectXPathContext"/> instance with given
        /// namespace manager.
        /// </summary>
        /// <param name="nsmgr">A namespace manager that will be used to
        /// resolve elements' namespace to a prefix.</param>
        public ObjectXPathContext(XmlNamespaceManager nsmgr)
        {
            _nodePolicyFactory = new NodePolicyFactory(this);
            _converterFactory  = new ConverterFactory();

            if (NamespaceManager != null)
            {
                _namespaceManager = nsmgr;
                _nameTable        = NamespaceManager.NameTable;
            }
            else
            {
                _nameTable        = new NameTable();
                _namespaceManager = new XmlNamespaceManager(_nameTable);
            }
            _namespaceManager.AddNamespace("xsi", Xsi);
            _detectLoops = false;
        }