Example #1
0
        public ReaderOutput StartReader()
        {
            ReaderOutput output = new ReaderOutput(this);

            _builder = new RecordBuilder(output, _nameTable);
            return(output);
        }
Example #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);
            {
                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);
        }
Example #3
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);
        }
Example #4
0
        public void Execute(TextWriter writer)
        {
            IRecordOutput?recOutput = null;

            switch (_output.Method)
            {
            case XsltOutput.OutputMethod.Text:
                recOutput = new TextOnlyOutput(this, writer);
                break;

            case XsltOutput.OutputMethod.Xml:
            case XsltOutput.OutputMethod.Html:
            case XsltOutput.OutputMethod.Other:
            case XsltOutput.OutputMethod.Unknown:
                recOutput = new TextOutput(this, writer);
                break;
            }
            _builder = new RecordBuilder(recOutput !, _nameTable);
            Execute();
        }
Example #5
0
 public void Execute(XmlWriter writer)
 {
     _builder = new RecordBuilder(new WriterOutput(this, writer), _nameTable);
     Execute();
 }