Exemplo n.º 1
0
        private void Init()
        {
            _nsManager = reader.NamespaceManager;
            if (_nsManager == null)
            {
                _nsManager = new XmlNamespaceManager(NameTable);
                _bManageNamespaces = true;
            }
            _validationStack = new HWStack(STACK_INCREMENT);
            textValue = new StringBuilder();
            _attPresence = new Hashtable();
            schemaInfo = new SchemaInfo();
            checkDatatype = false;
            _processContents = XmlSchemaContentProcessing.Strict;
            Push(XmlQualifiedName.Empty);

            //Add common strings to be compared to NameTable
            _nsXmlNs = NameTable.Add(XmlReservedNs.NsXmlNs);
            _nsXs = NameTable.Add(XmlReservedNs.NsXs);
            _nsXsi = NameTable.Add(XmlReservedNs.NsXsi);
            _xsiType = NameTable.Add("type");
            _xsiNil = NameTable.Add("nil");
            _xsiSchemaLocation = NameTable.Add("schemaLocation");
            _xsiNoNamespaceSchemaLocation = NameTable.Add("noNamespaceSchemaLocation");
            _xsdSchema = NameTable.Add("schema");
        }
Exemplo n.º 2
0
        private void Init()
        {
            _nsManager = reader.NamespaceManager !;
            if (_nsManager == null)
            {
                _nsManager         = new XmlNamespaceManager(NameTable);
                _bManageNamespaces = true;
            }

            _validationStack = new HWStack(STACK_INCREMENT);
            textValue        = new StringBuilder();
            _attPresence     = new Hashtable();
            schemaInfo       = new SchemaInfo();
            checkDatatype    = false;
            _processContents = XmlSchemaContentProcessing.Strict;
            Push(XmlQualifiedName.Empty);

            //Add common strings to be compared to NameTable
            _nsXmlNs                      = NameTable.Add(XmlReservedNs.NsXmlNs);
            _nsXs                         = NameTable.Add(XmlReservedNs.NsXs);
            _nsXsi                        = NameTable.Add(XmlReservedNs.NsXsi);
            _xsiType                      = NameTable.Add("type");
            _xsiNil                       = NameTable.Add("nil");
            _xsiSchemaLocation            = NameTable.Add("schemaLocation");
            _xsiNoNamespaceSchemaLocation = NameTable.Add("noNamespaceSchemaLocation");
            _xsdSchema                    = NameTable.Add("schema");
        }
Exemplo n.º 3
0
        //
        // Construction
        //

        private Processor(XPathNavigator doc, XsltArgumentList args, XmlResolver resolver, XslTransform transform)
        {
            transform.LoadCompiledStylesheet(out this.stylesheet, out this.queryList, out this.queryStore, out this.rootAction, doc);

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

            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 new XsltException(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);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
 private void Init() {
     Debug.Assert(reader != null);
     validationStack = new HWStack(STACK_INCREMENT);
     textValue = new StringBuilder();
     name = XmlQualifiedName.Empty;
     attPresence = new Hashtable();
     schemaInfo = new SchemaInfo();
     checkDatatype = false;
     Push(name);
 }
 private void Init()
 {
     this.validationStack = new HWStack(10);
     base.textValue       = new StringBuilder();
     this.name            = XmlQualifiedName.Empty;
     this.attPresence     = new Hashtable();
     base.schemaInfo      = new SchemaInfo();
     base.checkDatatype   = false;
     this.Push(this.name);
 }
Exemplo n.º 7
0
 private void Init()
 {
     Debug.Assert(reader != null);
     _validationStack = new HWStack(STACK_INCREMENT);
     textValue        = new StringBuilder();
     _name            = XmlQualifiedName.Empty;
     _attPresence     = new Hashtable();
     schemaInfo       = new SchemaInfo();
     checkDatatype    = false;
     Push(_name);
 }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
0
 private void Init() {
     nsManager = reader.NamespaceManager;
     if (nsManager == null) {
         nsManager = new XmlNamespaceManager(NameTable);
         isProcessContents = true;
     }
     validationStack = new HWStack(STACK_INCREMENT);
     textValue = new StringBuilder();
     name = XmlQualifiedName.Empty;
     attPresence = new Hashtable();
     Push(XmlQualifiedName.Empty);
     schemaInfo = new SchemaInfo();
     checkDatatype = false;
 }
Exemplo n.º 10
0
 private void Init()
 {
     _nsManager = reader.NamespaceManager;
     if (_nsManager == null)
     {
         _nsManager         = new XmlNamespaceManager(NameTable);
         _isProcessContents = true;
     }
     _validationStack = new HWStack(STACK_INCREMENT);
     textValue        = new StringBuilder();
     _name            = XmlQualifiedName.Empty;
     _attPresence     = new Hashtable();
     Push(XmlQualifiedName.Empty);
     schemaInfo    = new SchemaInfo();
     checkDatatype = false;
 }
 private void Init()
 {
     this.nsManager = base.reader.NamespaceManager;
     if (this.nsManager == null)
     {
         this.nsManager         = new XmlNamespaceManager(base.NameTable);
         this.isProcessContents = true;
     }
     this.validationStack = new HWStack(10);
     base.textValue       = new StringBuilder();
     this.name            = XmlQualifiedName.Empty;
     this.attPresence     = new Hashtable();
     this.Push(XmlQualifiedName.Empty);
     base.schemaInfo    = new SchemaInfo();
     base.checkDatatype = false;
 }
Exemplo n.º 12
0
        internal Validator(XmlNameTable nameTable, SchemaNames schemaNames, XmlValidatingReader reader) {
            this.nameTable = nameTable;
            this.schemaNames = schemaNames;
            this.reader = reader;
            positionInfo = PositionInfo.GetPositionInfo(reader);
            nsManager = reader.NamespaceManager;
            if (nsManager == null) {
                nsManager = new XmlNamespaceManager(nameTable);
                isProcessContents = true;
            }
            SchemaInfo = new SchemaInfo(schemaNames);

            validationStack = new HWStack(STACK_INCREMENT);
            textValue = new StringBuilder();
            this.name = XmlQualifiedName.Empty;
            attPresence = new Hashtable();
            context = null;
            attnDef = null;
        }
Exemplo n.º 13
0
        internal OutputScopeManager(XmlNameTable nameTable, OutKeywords atoms)
        {
            Debug.Assert(nameTable != null);
            Debug.Assert(atoms != null);

            _elementScopesStack = new HWStack(STACK_INCREMENT);
            _nameTable          = nameTable;
            _atoms     = atoms;
            _defaultNS = _atoms.Empty;

            // We always adding rootElementScope to garantee that CurrentElementScope != null
            // This context is active between PI and first element for example
            OutputScope rootElementScope = (OutputScope)_elementScopesStack.Push();

            if (rootElementScope == null)
            {
                rootElementScope = new OutputScope();
                _elementScopesStack.AddToTop(rootElementScope);
            }
            rootElementScope.Init(string.Empty, string.Empty, string.Empty, /*space:*/ XmlSpace.None, /*lang:*/ string.Empty, /*mixed:*/ false);
        }
Exemplo n.º 14
0
 private void Init()
 {
     this.nsManager = base.reader.NamespaceManager;
     if (this.nsManager == null)
     {
         this.nsManager         = new XmlNamespaceManager(base.NameTable);
         this.bManageNamespaces = true;
     }
     this.validationStack = new HWStack(10);
     base.textValue       = new StringBuilder();
     this.attPresence     = new Hashtable();
     base.schemaInfo      = new SchemaInfo();
     base.checkDatatype   = false;
     this.processContents = XmlSchemaContentProcessing.Strict;
     this.Push(XmlQualifiedName.Empty);
     this.NsXmlNs                      = base.NameTable.Add("http://www.w3.org/2000/xmlns/");
     this.NsXs                         = base.NameTable.Add("http://www.w3.org/2001/XMLSchema");
     this.NsXsi                        = base.NameTable.Add("http://www.w3.org/2001/XMLSchema-instance");
     this.XsiType                      = base.NameTable.Add("type");
     this.XsiNil                       = base.NameTable.Add("nil");
     this.XsiSchemaLocation            = base.NameTable.Add("schemaLocation");
     this.XsiNoNamespaceSchemaLocation = base.NameTable.Add("noNamespaceSchemaLocation");
     this.XsdSchema                    = base.NameTable.Add("schema");
 }
Exemplo n.º 15
0
        internal DtdParser(XmlScanner pScanner,
                           XmlReader reader,
                           XmlResolver res,
                           XmlNameTable nameTable,
                           ValidationEventHandler validationEventHandler,
                           bool namespaces) {
            _NameTable = nameTable;
            _SchemaNames = new SchemaNames(nameTable);
            _NsMgr = new XmlNamespaceManager(_NameTable);
            _Scanner = _XmlScanner = pScanner;
            _Scanner.InDTD = true;
            _XmlResolver = res;
            _Namespaces = namespaces;

            _Reader = reader;
            _ValidationEventHandler = validationEventHandler;
            _InternalValidationEventHandler = new ValidationEventHandler(InternalValidationCallback);
            _SchemaInfo = new SchemaInfo(_SchemaNames);
            _SchemaInfo.SchemaType = SchemaType.DTD;
            _DtdFuncIndex = DtdFunctionIndex.ParseDocTypeDecl;
            _IsInternal = true;
            _ParseStack = new HWStack(STACK_INCREMENT);
            _ScannerStack = new HWStack(STACK_INCREMENT);
            _GroupStack = new HWStack(STACK_INCREMENT);
            _StringBuilder = new StringBuilder();
            _L = -2;
            if (_XmlResolver != null && reader.BaseURI != string.Empty) {
                _BaseUri = _XmlResolver.ResolveUri(null, reader.BaseURI);
                _DocBaseUri = XmlUrlResolver.UnEscape(_BaseUri.ToString());
            }
            Push(DtdFunctionIndex.ParseDocTypeDecl);
        }
Exemplo n.º 16
0
 void Init() {
     this.state = State.Initial;
     this.stack = new HWStack(10);
     this.node = Push(null, XmlNodeType.Document, null);
     this.node.IsEmpty = false;
     this.sb = new StringBuilder();
     this.name = new StringBuilder();
     this.poptodepth = 0;
     this.current = null;
     this.partial = '\0';
     this.endTag = null;
     this.a = null;
     this.apos = 0;
     this.newnode = null;
     this.rootCount = 0;
     this.foundRoot = false;
 }
Exemplo n.º 17
0
 private void Init()
 {
     this.m_state = State.Initial;
     this.m_stack = new HWStack(10);
     this.m_node = Push(null, XmlNodeType.Document, null);
     this.m_node.IsEmpty = false;
     this.m_sb = new StringBuilder();
     this.m_name = new StringBuilder();
     this.m_poptodepth = 0;
     this.m_current = null;
     this.m_partial = '\0';
     this.m_endTag = null;
     this.m_a = null;
     this.m_apos = 0;
     this.m_newnode = null;
     this.m_rootCount = 0;
     this.m_foundRoot = false;
     this.unknownNamespaces.Clear();
 }
Exemplo n.º 18
0
 internal XsdBuilder( 
                    XmlReader reader,
                    XmlNamespaceManager curmgr, 
                    XmlSchema schema, 
                    XmlNameTable nameTable,
                    SchemaNames schemaNames,
                    ValidationEventHandler eventhandler
                    ) {
     this.reader = reader;
     this.xso = this.schema = schema;
     this.namespaceManager = new BuilderNamespaceManager(curmgr, reader);
     this.validationEventHandler = eventhandler;
     this.nameTable = nameTable;
     this.schemaNames = schemaNames;
     this.stateHistory = new HWStack(STACK_INCREMENT);
     this.currentEntry = SchemaEntries[0];
     positionInfo = PositionInfo.GetPositionInfo(reader);
 }
Exemplo n.º 19
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);
        }
Exemplo n.º 20
0
        private    void PushAttValueScanner(XmlScanner scanner, SchemaEntity en) {
            if (_AttValueScannerStack == null) {
                _AttValueScannerStack = new HWStack(STACK_INCREMENT);
            }

            DtdScannerState s = (DtdScannerState)_AttValueScannerStack.Push();
            if (s == null) {
                s = new DtdScannerState();
                _AttValueScannerStack[_AttValueScannerStack.Length-1] = s;
            }
            s._Scanner = _Scanner;
            s._En = en;
            en.IsProcessed = true;
        }
Exemplo n.º 21
-1
 internal XdrBuilder(
                    XmlReader reader,
                    XmlNamespaceManager curmgr,
                    SchemaInfo sinfo,
                    string targetNamspace,
                    XmlNameTable nameTable,
                    SchemaNames schemaNames,
                    ValidationEventHandler eventhandler
                    )
 {
     _SchemaInfo = sinfo;
     _TargetNamespace = targetNamspace;
     _reader = reader;
     _CurNsMgr = curmgr;
     _validationEventHandler = eventhandler;
     _StateHistory = new HWStack(StackIncrement);
     _ElementDef = new ElementContent();
     _AttributeDef = new AttributeContent();
     _GroupStack = new HWStack(StackIncrement);
     _GroupDef = new GroupContent();
     _NameTable = nameTable;
     _SchemaNames = schemaNames;
     _CurState = s_schemaEntries[0];
     _positionInfo = PositionInfo.GetPositionInfo(_reader);
     _xmlResolver = null;
 }