Exemplo n.º 1
0
        //
        // Constructor
        //
        internal NavigatorInput(XPathNavigator navigator, string baseUri, InputScope rootScope)
        {
            if (navigator == null)
            {
                throw new ArgumentNullException("navigator");
            }
            if (baseUri == null)
            {
                throw new ArgumentNullException("baseUri");
            }
            Debug.Assert(navigator.NameTable != null);
            _Next  = null;
            _Href  = baseUri;
            _Atoms = new Keywords(navigator.NameTable);
            _Atoms.LookupKeywords();
            _Navigator    = navigator;
            _Manager      = new InputScopeManager(_Navigator, rootScope);
            _PositionInfo = PositionInfo.GetPositionInfo(_Navigator);

            /*BeginReading:*/
            AssertInput();
            if (NodeType == XPathNodeType.Root)
            {
                _Navigator.MoveToFirstChild();
            }
        }
Exemplo n.º 2
0
 public BaseValidator(XmlValidatingReaderImpl reader, XmlSchemaCollection schemaCollection, IValidationEventHandling eventHandling)
 {
     Debug.Assert(schemaCollection == null || schemaCollection.NameTable == reader.NameTable);
     this.reader       = reader;
     _schemaCollection = schemaCollection;
     _eventHandling    = eventHandling;
     _nameTable        = reader.NameTable;
     _positionInfo     = PositionInfo.GetPositionInfo(reader);
     elementName       = new XmlQualifiedName();
 }
Exemplo n.º 3
0
        internal void StartParsing(XmlReader reader, string targetNamespace, SchemaInfo schemaInfo)
        {
            this.reader           = reader;
            positionInfo          = PositionInfo.GetPositionInfo(reader);
            this.namespaceManager = reader.NamespaceManager;
            if (this.namespaceManager == null)
            {
                this.namespaceManager    = new XmlNamespaceManager(this.nameTable);
                this.isProcessNamespaces = true;
            }
            else
            {
                this.isProcessNamespaces = false;
            }
            while (this.reader.NodeType != XmlNodeType.Element && this.reader.Read())
            {
            }

            this.markupDepth    = int.MaxValue;
            this.schemaXmlDepth = reader.Depth;
            XmlQualifiedName qname = new XmlQualifiedName(this.reader.LocalName, XmlSchemaDatatype.XdrCanonizeUri(this.reader.NamespaceURI, this.nameTable, this.schemaNames));

            if (this.schemaNames.IsXDRRoot(qname))
            {
                Debug.Assert(schemaInfo != null);
                schemaInfo.SchemaType             = SchemaType.XDR;
                this.schema                       = null;
                this.builder                      = new XdrBuilder(reader, this.namespaceManager, schemaInfo, targetNamespace, this.nameTable, this.schemaNames, this.validationEventHandler);
                ((XdrBuilder)builder).XmlResolver = xmlResolver;
            }
            else if (this.schemaNames.IsXSDRoot(qname))
            {
                if (schemaInfo != null)
                {
                    schemaInfo.SchemaType = SchemaType.XSD;
                }
                this.schema         = new XmlSchema();
                this.schema.BaseUri = reader.BaseURI;
                this.builder        = new XsdBuilder(reader, this.namespaceManager, this.schema, this.nameTable, this.schemaNames, this.validationEventHandler);
            }
            else
            {
                throw new XmlSchemaException(Res.Sch_SchemaRootExpected, reader.BaseURI, positionInfo.LineNumber, positionInfo.LinePosition);
            }
        }
Exemplo n.º 4
0
        public void StartParsing(XmlReader reader, string targetNamespace)
        {
            this.reader      = reader;
            positionInfo     = PositionInfo.GetPositionInfo(reader);
            namespaceManager = reader.NamespaceManager;
            if (namespaceManager == null)
            {
                namespaceManager    = new XmlNamespaceManager(nameTable);
                isProcessNamespaces = true;
            }
            else
            {
                isProcessNamespaces = false;
            }
            while (reader.NodeType != XmlNodeType.Element && reader.Read())
            {
            }

            markupDepth    = int.MaxValue;
            schemaXmlDepth = reader.Depth;
            SchemaType rootType = schemaNames.SchemaTypeFromRoot(reader.LocalName, reader.NamespaceURI);

            string code;

            if (!CheckSchemaRoot(rootType, out code))
            {
                throw new XmlSchemaException(code, reader.BaseURI, positionInfo.LineNumber, positionInfo.LinePosition);
            }

            if (schemaType == SchemaType.XSD)
            {
                schema         = new XmlSchema();
                schema.BaseUri = new Uri(reader.BaseURI, UriKind.RelativeOrAbsolute);
                builder        = new XsdBuilder(reader, namespaceManager, schema, nameTable, schemaNames, eventHandler);
            }
            else
            {
                Debug.Assert(schemaType == SchemaType.XDR);
                xdrSchema            = new SchemaInfo();
                xdrSchema.SchemaType = SchemaType.XDR;
                builder = new XdrBuilder(reader, namespaceManager, xdrSchema, targetNamespace, nameTable, schemaNames, eventHandler);
                ((XdrBuilder)builder).XmlResolver = xmlResolver;
            }
        }
Exemplo n.º 5
0
        public async Task StartParsingAsync(XmlReader reader, string targetNamespace)
        {
            _reader           = reader;
            _positionInfo     = PositionInfo.GetPositionInfo(reader);
            _namespaceManager = reader.NamespaceManager;
            if (_namespaceManager == null)
            {
                _namespaceManager    = new XmlNamespaceManager(_nameTable);
                _isProcessNamespaces = true;
            }
            else
            {
                _isProcessNamespaces = false;
            }
            while (reader.NodeType != XmlNodeType.Element && await reader.ReadAsync().ConfigureAwait(false))
            {
            }

            _markupDepth    = int.MaxValue;
            _schemaXmlDepth = reader.Depth;
            SchemaType rootType = _schemaNames.SchemaTypeFromRoot(reader.LocalName, reader.NamespaceURI);

            string code;

            if (!CheckSchemaRoot(rootType, out code))
            {
                throw new XmlSchemaException(code, reader.BaseURI, _positionInfo.LineNumber, _positionInfo.LinePosition);
            }

            if (_schemaType == SchemaType.XSD)
            {
                _schema         = new XmlSchema();
                _schema.BaseUri = new Uri(reader.BaseURI, UriKind.RelativeOrAbsolute);
                _builder        = new XsdBuilder(reader, _namespaceManager, _schema, _nameTable, _schemaNames, _eventHandler);
            }
            else
            {
                Debug.Assert(_schemaType == SchemaType.XDR);
                _xdrSchema            = new SchemaInfo();
                _xdrSchema.SchemaType = SchemaType.XDR;
                _builder = new XdrBuilder(reader, _namespaceManager, _xdrSchema, targetNamespace, _nameTable, _schemaNames, _eventHandler);
                ((XdrBuilder)_builder).XmlResolver = _xmlResolver;
            }
        }
Exemplo n.º 6
0
        //
        // Constructor
        //
        internal NavigatorInput(XPathNavigator navigator, string baseUri, InputScope?rootScope)
        {
            ArgumentNullException.ThrowIfNull(navigator);
            ArgumentNullException.ThrowIfNull(baseUri);

            Debug.Assert(navigator.NameTable != null);
            _Next         = null;
            _Href         = baseUri;
            _Atoms        = new KeywordsTable(navigator.NameTable);
            _Navigator    = navigator;
            _Manager      = new InputScopeManager(_Navigator, rootScope);
            _PositionInfo = PositionInfo.GetPositionInfo(_Navigator);

            /*BeginReading:*/
            AssertInput();
            if (NodeType == XPathNodeType.Root)
            {
                _Navigator.MoveToFirstChild();
            }
        }
Exemplo n.º 7
0
        public void StartParsing(XmlReader reader, string targetNamespace)
        {
            string str;

            this.reader           = reader;
            this.positionInfo     = PositionInfo.GetPositionInfo(reader);
            this.namespaceManager = reader.NamespaceManager;
            if (this.namespaceManager == null)
            {
                this.namespaceManager    = new XmlNamespaceManager(this.nameTable);
                this.isProcessNamespaces = true;
            }
            else
            {
                this.isProcessNamespaces = false;
            }
            while ((reader.NodeType != XmlNodeType.Element) && reader.Read())
            {
            }
            this.markupDepth    = 0x7fffffff;
            this.schemaXmlDepth = reader.Depth;
            SchemaType rootType = this.schemaNames.SchemaTypeFromRoot(reader.LocalName, reader.NamespaceURI);

            if (!this.CheckSchemaRoot(rootType, out str))
            {
                throw new XmlSchemaException(str, reader.BaseURI, this.positionInfo.LineNumber, this.positionInfo.LinePosition);
            }
            if (this.schemaType == SchemaType.XSD)
            {
                this.schema         = new System.Xml.Schema.XmlSchema();
                this.schema.BaseUri = new Uri(reader.BaseURI, UriKind.RelativeOrAbsolute);
                this.builder        = new XsdBuilder(reader, this.namespaceManager, this.schema, this.nameTable, this.schemaNames, this.eventHandler);
            }
            else
            {
                this.xdrSchema            = new SchemaInfo();
                this.xdrSchema.SchemaType = SchemaType.XDR;
                this.builder = new XdrBuilder(reader, this.namespaceManager, this.xdrSchema, targetNamespace, this.nameTable, this.schemaNames, this.eventHandler);
                ((XdrBuilder)this.builder).XmlResolver = this.xmlResolver;
            }
        }