Ejemplo n.º 1
0
        //
        // Construction
        //
        public Processor(
            XPathNavigator doc, XsltArgumentList args, XmlResolver resolver,
            Stylesheet stylesheet, List <TheQuery> queryStore, RootAction rootAction,
            IXsltDebugger debugger
            )
        {
            _stylesheet = stylesheet;
            _queryStore = queryStore;
            _rootAction = rootAction;
            _queryList  = new Query[queryStore.Count];
            {
                for (int i = 0; i < queryStore.Count; i++)
                {
                    _queryList[i] = Query.Clone(queryStore[i].CompiledQuery.QueryTree);
                }
            }

            _xsm         = new StateMachine();
            _document    = doc;
            _builder     = null;
            _actionStack = new HWStack(StackIncrement);
            _output      = _rootAction.Output;
            _resolver    = resolver ?? XmlNullResolver.Singleton;
            _args        = args ?? new XsltArgumentList();
            _debugger    = debugger;
            if (_debugger != null)
            {
                _debuggerStack  = new HWStack(StackIncrement, /*limit:*/ 1000);
                _templateLookup = new TemplateLookupActionDbg();
            }

            // Clone the compile-time KeyList
            if (_rootAction.KeyList != null)
            {
                _keyList = new Key[_rootAction.KeyList.Count];
                for (int i = 0; i < _keyList.Length; i++)
                {
                    _keyList[i] = _rootAction.KeyList[i].Clone();
                }
            }

            _scriptExtensions = new Hashtable(_stylesheet.ScriptObjectTypes.Count);
            {
                foreach (DictionaryEntry entry in _stylesheet.ScriptObjectTypes)
                {
                    string namespaceUri = (string)entry.Key;
                    if (GetExtensionObject(namespaceUri) != null)
                    {
                        throw XsltException.Create(SR.Xslt_ScriptDub, namespaceUri);
                    }
                    _scriptExtensions.Add(namespaceUri, Activator.CreateInstance((Type)entry.Value,
                                                                                 BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, null, null));
                }
            }

            this.PushActionFrame(_rootAction, /*nodeSet:*/ null);
        }
Ejemplo n.º 2
0
        //
        // Construction
        //
        public Processor(
            XPathNavigator doc, XsltArgumentList?args, XmlResolver?resolver,
            Stylesheet stylesheet, List <TheQuery> queryStore, RootAction rootAction,
            IXsltDebugger?debugger
            )
        {
            _stylesheet = stylesheet;
            _queryStore = queryStore;
            _rootAction = rootAction;
            _queryList  = new Query[queryStore.Count];
            {
                for (int i = 0; i < queryStore.Count; i++)
                {
                    _queryList[i] = Query.Clone(queryStore[i].CompiledQuery.QueryTree);
                }
            }

            _xsm         = new StateMachine();
            _document    = doc;
            _builder     = null;
            _actionStack = new HWStack(StackIncrement);
            _output      = _rootAction.Output;
            _resolver    = resolver ?? XmlNullResolver.Singleton;
            _args        = args ?? new XsltArgumentList();
            _debugger    = debugger;
            if (_debugger != null)
            {
                _debuggerStack  = new HWStack(StackIncrement, /*limit:*/ 1000);
                _templateLookup = new TemplateLookupActionDbg();
            }

            // Clone the compile-time KeyList
            if (_rootAction.KeyList != null)
            {
                _keyList = new Key[_rootAction.KeyList.Count];
                for (int i = 0; i < _keyList.Length; i++)
                {
                    _keyList[i] = _rootAction.KeyList[i].Clone();
                }
            }

            _scriptExtensions = new Hashtable(_stylesheet.ScriptObjectTypes.Count);
            {
                // Scripts are not supported on stylesheets
                if (_stylesheet.ScriptObjectTypes.Count > 0)
                {
                    throw new PlatformNotSupportedException(SR.CompilingScriptsNotSupported);
                }
            }

            this.PushActionFrame(_rootAction, /*nodeSet:*/ null);
        }
Ejemplo n.º 3
0
        //
        // Construction
        //
        public Processor(
            XPathNavigator doc, XsltArgumentList args, XmlResolver resolver,
            Stylesheet stylesheet, List<TheQuery> queryStore, RootAction rootAction,
            IXsltDebugger debugger
        ) {
            this.stylesheet = stylesheet;
            this.queryStore = queryStore;
            this.rootAction = rootAction;
            this.queryList  = new Query[queryStore.Count]; {
                for(int i = 0; i < queryStore.Count; i ++) {
                    queryList[i] = Query.Clone(queryStore[i].CompiledQuery.QueryTree);
                }
            }

            this.xsm                 = new StateMachine();
            this.document            = doc;
            this.builder             = null;
            this.actionStack         = new HWStack(StackIncrement);
            this.output              = this.rootAction.Output;
            this.permissions         = this.rootAction.permissions;
            this.resolver            = resolver ?? XmlNullResolver.Singleton;
            this.args                = args     ?? new XsltArgumentList();
            this.debugger            = debugger;
            if (this.debugger != null) {
                this.debuggerStack = new HWStack(StackIncrement, /*limit:*/1000);
                templateLookup     = new TemplateLookupActionDbg();
            }

            // Clone the compile-time KeyList
            if (this.rootAction.KeyList != null) {
                this.keyList = new Key[this.rootAction.KeyList.Count];
                for (int i = 0; i < this.keyList.Length; i ++) {
                    this.keyList[i] = this.rootAction.KeyList[i].Clone();
                }
            }

            this.scriptExtensions = new Hashtable(this.stylesheet.ScriptObjectTypes.Count); {
                foreach(DictionaryEntry entry in this.stylesheet.ScriptObjectTypes) {
                    string namespaceUri = (string)entry.Key;
                    if (GetExtensionObject(namespaceUri) != null) {
                        throw XsltException.Create(Res.Xslt_ScriptDub, namespaceUri);
                    }
                    scriptExtensions.Add(namespaceUri, Activator.CreateInstance((Type)entry.Value,
                        BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.CreateInstance, null, null, null));
                }
            }

            this.PushActionFrame(this.rootAction, /*nodeSet:*/null);
        }