当前位置: 首页>>代码示例>>C#>>正文


C# Xml.XmlTextReaderImpl类代码示例

本文整理汇总了C#中System.Xml.XmlTextReaderImpl的典型用法代码示例。如果您正苦于以下问题:C# XmlTextReaderImpl类的具体用法?C# XmlTextReaderImpl怎么用?C# XmlTextReaderImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XmlTextReaderImpl类属于System.Xml命名空间,在下文中一共展示了XmlTextReaderImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateInnerXmlReader

 private XmlReader CreateInnerXmlReader(string xmlFragment, XmlNodeType nt, XmlParserContext context, XmlDocument doc)
 {
     XmlNodeType fragType = nt;
     switch (fragType)
     {
         case XmlNodeType.Entity:
         case XmlNodeType.EntityReference:
             fragType = XmlNodeType.Element;
             break;
     }
     XmlTextReaderImpl reader = new XmlTextReaderImpl(xmlFragment, fragType, context) {
         XmlValidatingReaderCompatibilityMode = true
     };
     if (doc.HasSetResolver)
     {
         reader.XmlResolver = doc.GetResolver();
     }
     if (!doc.ActualLoadingStatus)
     {
         reader.DisableUndeclaredEntityCheck = true;
     }
     XmlDocumentType documentType = doc.DocumentType;
     if (documentType != null)
     {
         reader.Namespaces = documentType.ParseWithNamespaces;
         if (documentType.DtdSchemaInfo != null)
         {
             reader.SetDtdInfo(documentType.DtdSchemaInfo);
         }
         else
         {
             IDtdParser parser = DtdParser.Create();
             XmlTextReaderImpl.DtdParserProxy adapter = new XmlTextReaderImpl.DtdParserProxy(reader);
             IDtdInfo newDtdInfo = parser.ParseFreeFloatingDtd(context.BaseURI, context.DocTypeName, context.PublicId, context.SystemId, context.InternalSubset, adapter);
             documentType.DtdSchemaInfo = newDtdInfo as SchemaInfo;
             reader.SetDtdInfo(newDtdInfo);
         }
     }
     if ((nt == XmlNodeType.Entity) || (nt == XmlNodeType.EntityReference))
     {
         reader.Read();
         reader.ResolveEntity();
     }
     return reader;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:45,代码来源:XmlLoader.cs

示例2: CreateReader

        public XmlReader CreateReader(Stream stream, string baseUri) {
            XmlReader reader;
            if (xmlReaderSettings != null) {
                reader = XmlTextReader.Create(stream, xmlReaderSettings, baseUri);
            } else {
                XmlTextReaderImpl readerImpl = new XmlTextReaderImpl(baseUri, stream, xmlNameTable);
                readerImpl.EntityHandling = entityHandling;
                readerImpl.Namespaces = namespaces;
                readerImpl.Normalization = normalization;
                readerImpl.DtdProcessing = prohibitDtd ? DtdProcessing.Prohibit : DtdProcessing.Parse;
                readerImpl.WhitespaceHandling = whitespaceHandling;
                readerImpl.XmlResolver = xmlResolver;
                reader = readerImpl;
            }
            if (validatingReader) {
#pragma warning disable 618
                reader = new XmlValidatingReader(reader);
#pragma warning restore 618
            }
            return reader;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:21,代码来源:QueryReaderSettings.cs

示例3: XmlTextReader

 public XmlTextReader( string url, TextReader input ) { 
     impl = new XmlTextReaderImpl( url, input );
     impl.OuterReader = this;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:4,代码来源:XmlTextReader.cs

示例4: CreateSqlReader

 internal static XmlReader CreateSqlReader(Stream input, XmlReaderSettings settings, XmlParserContext inputContext)
 {
     XmlReader reader;
     int num2;
     if (input == null)
     {
         throw new ArgumentNullException("input");
     }
     if (settings == null)
     {
         settings = new XmlReaderSettings();
     }
     byte[] buffer = new byte[CalcBufferSize(input)];
     int offset = 0;
     do
     {
         num2 = input.Read(buffer, offset, buffer.Length - offset);
         offset += num2;
     }
     while ((num2 > 0) && (offset < 2));
     if (((offset >= 2) && (buffer[0] == 0xdf)) && (buffer[1] == 0xff))
     {
         if (inputContext != null)
         {
             throw new ArgumentException(Res.GetString("XmlBinary_NoParserContext"), "inputContext");
         }
         reader = new XmlSqlBinaryReader(input, buffer, offset, string.Empty, settings.CloseInput, settings);
     }
     else
     {
         reader = new XmlTextReaderImpl(input, buffer, offset, settings, null, string.Empty, inputContext, settings.CloseInput);
     }
     if (settings.ValidationType != ValidationType.None)
     {
         reader = settings.AddValidation(reader);
     }
     return reader;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:38,代码来源:XmlReader.cs

示例5: CreateSqlReader

        // !!!!!!
        // NOTE: This method is called via reflection from System.Data.dll and from Analysis Services in Yukon. 
        // Do not change its signature without notifying the appropriate teams!
        // !!!!!!
        internal static XmlReader CreateSqlReader(Stream input, XmlReaderSettings settings, XmlParserContext inputContext) {
            if (input == null) {
                throw new ArgumentNullException("input");
            }
            if (settings == null) {
                settings = new XmlReaderSettings();
            }

            XmlReader reader;

            // allocate byte buffer
            byte[] bytes = new byte[CalcBufferSize(input)];

#if false
            {
                // catch the binary XML input and dump it into a local file (for debugging and testing purposes)

                // create dump file name
                string dumpFileNameBase = "~CreateSqlReaderInputDump";
                string dumpFileName;
                int i = 0;
                do {
                    i++;
                    dumpFileName = Path.GetFullPath(string.Concat(dumpFileNameBase, i.ToString(), ".bmx"));
                } while (File.Exists(dumpFileName));

                // dump the input into the file
                FileStream fs = new FileStream(dumpFileName, FileMode.Create, FileAccess.ReadWrite);
                byte[] buffer = new byte[4096];
                int bytesRead;
                while ((bytesRead = input.Read(buffer, 0, buffer.Length)) > 0) {
                    fs.Write(buffer, 0, bytesRead);
                }
                fs.Seek(0, SeekOrigin.Begin);

                // make sure it will get closed
                if (settings.CloseInput) {
                    input.Close();
                }
                input = fs;
                settings = settings.Clone();
                settings.CloseInput = true;
            }
#endif
            int byteCount = 0;
            int read;
            do {
                read = input.Read(bytes, byteCount, bytes.Length - byteCount);
                byteCount += read;
            } while (read > 0 && byteCount < 2);

            // create text or binary XML reader depenting on the stream first 2 bytes
            if (byteCount >= 2 && (bytes[0] == 0xdf && bytes[1] == 0xff)) {
                if ( inputContext != null )
                    throw new ArgumentException(Res.GetString(Res.XmlBinary_NoParserContext), "inputContext");
                reader = new XmlSqlBinaryReader(input, bytes, byteCount, string.Empty, settings.CloseInput, settings);
            }
            else {
                reader = new XmlTextReaderImpl(input, bytes, byteCount, settings, null, string.Empty, inputContext, settings.CloseInput);
            }
            
            // wrap with validating reader
            if ( settings.ValidationType != ValidationType.None ) {
                reader = settings.AddValidation( reader );
            }

            if (settings.Async) {
                reader = XmlAsyncCheckReader.CreateAsyncCheckWrapper(reader);
            }

            return reader;
        }
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:76,代码来源:XmlReader.cs

示例6: CreateReader

        internal XmlReader CreateReader(String inputUri, XmlParserContext inputContext)
        {
            if (inputUri == null)
            {
                throw new ArgumentNullException(nameof(inputUri));
            }
            if (inputUri.Length == 0)
            {
                throw new ArgumentException(SR.XmlConvert_BadUri, nameof(inputUri));
            }

            // resolve and open the url
            XmlResolver tmpResolver = this.GetXmlResolver();
            if (tmpResolver == null)
            {
                tmpResolver = CreateDefaultResolver();
            }

            // create text XML reader
            XmlReader reader = new XmlTextReaderImpl(inputUri, this, inputContext, tmpResolver);

            // wrap with validating reader
            if (this.ValidationType != ValidationType.None)
            {
                reader = AddValidation(reader);
            }

            if (_useAsync)
            {
                reader = XmlAsyncCheckReader.CreateAsyncCheckWrapper(reader);
            }

            return reader;
        }
开发者ID:chcosta,项目名称:corefx,代码行数:34,代码来源:XmlReaderSettings.cs

示例7: LoadDocument

        //
        // Input documents management
        //

        internal static XPathDocument LoadDocument(XmlTextReaderImpl reader)
        {
            reader.EntityHandling = EntityHandling.ExpandEntities;
            reader.XmlValidatingReaderCompatibilityMode = true;
            try
            {
                return new XPathDocument(reader, XmlSpace.Preserve);
            }
            finally
            {
                reader.Close();
            }
        }
开发者ID:geoffkizer,项目名称:corefx,代码行数:17,代码来源:Compiler.cs

示例8: XmlValidatingReaderImpl

        // Initializes a new instance of XmlValidatingReaderImpl class with the specified arguments.
        // This constructor is used when creating XmlValidatingReaderImpl reader via "XmlReader.Create(..)"
        internal XmlValidatingReaderImpl( XmlReader reader, ValidationEventHandler settingsEventHandler, bool processIdentityConstraints) {
            XmlAsyncCheckReader asyncCheckReader = reader as XmlAsyncCheckReader;
            if (asyncCheckReader != null) {
                reader = asyncCheckReader.CoreReader;
            }
            outerReader = this;
            coreReader = reader;
            coreReaderImpl = reader as XmlTextReaderImpl;
            if ( coreReaderImpl == null ) {
                XmlTextReader tr = reader as XmlTextReader;
                if ( tr != null ) {
                    coreReaderImpl = tr.Impl;
                }
            }
            if ( coreReaderImpl == null ) {
                throw new ArgumentException( Res.GetString( Res.Arg_ExpectingXmlTextReader ), "reader" );
            }
            coreReaderImpl.XmlValidatingReaderCompatibilityMode = true;
            coreReaderNSResolver = reader as IXmlNamespaceResolver;
            this.processIdentityConstraints = processIdentityConstraints;

#pragma warning disable 618

            schemaCollection = new XmlSchemaCollection( coreReader.NameTable );

#pragma warning restore 618

            schemaCollection.XmlResolver = GetResolver();
            
            eventHandling = new ValidationEventHandling(this);
            if (settingsEventHandler != null) {
                eventHandling.AddHandler(settingsEventHandler);
            }
            coreReaderImpl.ValidationEventHandling = eventHandling;
            coreReaderImpl.OnDefaultAttributeUse = new XmlTextReaderImpl.OnDefaultAttributeUseDelegate(ValidateDefaultAttributeOnUse);

            validationType = ValidationType.DTD;
            SetupValidation( ValidationType.DTD );
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:41,代码来源:XmlValidatingReaderImpl.cs

示例9: XmlTextReader

 public XmlTextReader(string url, Stream input)
 {
     _impl = new XmlTextReaderImpl(url, input);
     _impl.OuterReader = this;
 }
开发者ID:Corillian,项目名称:corefx,代码行数:5,代码来源:XmlTextReader.cs

示例10: XmlValidatingReaderImpl

        //
        // Constructors
        //
        // Initializes a new instance of XmlValidatingReaderImpl class with the specified XmlReader.
        // This constructor is used when creating XmlValidatingReaderImpl for V1 XmlValidatingReader
        internal XmlValidatingReaderImpl(XmlReader reader)
        {
            XmlAsyncCheckReader asyncCheckReader = reader as XmlAsyncCheckReader;
            if (asyncCheckReader != null)
            {
                reader = asyncCheckReader.CoreReader;
            }
            _outerReader = this;
            _coreReader = reader;
            _coreReaderNSResolver = reader as IXmlNamespaceResolver;
            _coreReaderImpl = reader as XmlTextReaderImpl;
            if (_coreReaderImpl == null)
            {
                XmlTextReader tr = reader as XmlTextReader;
                if (tr != null)
                {
                    _coreReaderImpl = tr.Impl;
                }
            }
            if (_coreReaderImpl == null)
            {
                throw new ArgumentException(SR.Arg_ExpectingXmlTextReader, nameof(reader));
            }
            _coreReaderImpl.EntityHandling = EntityHandling.ExpandEntities;
            _coreReaderImpl.XmlValidatingReaderCompatibilityMode = true;
            _processIdentityConstraints = true;

#pragma warning disable 618
            _schemaCollection = new XmlSchemaCollection(_coreReader.NameTable);
            _schemaCollection.XmlResolver = GetResolver();

            _eventHandling = new ValidationEventHandling(this);
            _coreReaderImpl.ValidationEventHandling = _eventHandling;
            _coreReaderImpl.OnDefaultAttributeUse = new XmlTextReaderImpl.OnDefaultAttributeUseDelegate(ValidateDefaultAttributeOnUse);

            _validationType = ValidationType.Auto;
            SetupValidation(ValidationType.Auto);
#pragma warning restore 618

        }
开发者ID:alessandromontividiu03,项目名称:corefx,代码行数:45,代码来源:XmlValidatingReaderImpl.cs

示例11: SetupReader

 private XmlTextReaderImpl SetupReader(XmlTextReaderImpl reader)
 {
     reader.EntityHandling = EntityHandling.ExpandEntities;
     reader.XmlValidatingReaderCompatibilityMode = true;
     return reader;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:6,代码来源:XPathDocument.cs

示例12: Parse

 static internal SchemaInfo Parse( XmlTextReaderImpl tr, string baseUri, string docTypeName, string publicId, string systemId, string internalSubset ) {
     XmlTextReaderImpl.DtdParserProxy dtdParserProxy = new XmlTextReaderImpl.DtdParserProxy( baseUri, docTypeName, publicId, systemId, internalSubset, tr ); 
     dtdParserProxy.Parse( false );
     return dtdParserProxy.DtdSchemaInfo;
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:5,代码来源:dtdparser.cs

示例13: CreateReader

        internal XmlReader CreateReader(Stream input, Uri baseUri, string baseUriString, XmlParserContext inputContext) {
            if (input == null) {
                throw new ArgumentNullException("input");
            }
            if (baseUriString == null) {
                if (baseUri == null) {
                    baseUriString = string.Empty;
                }
                else {
                    baseUriString = baseUri.ToString();
                }
            }

            // create text XML reader
            XmlReader reader = new XmlTextReaderImpl(input, null, 0, this, baseUri, baseUriString, inputContext, closeInput);

#if !SILVERLIGHT
            // wrap with validating reader
            if (this.ValidationType != ValidationType.None) {
                reader = AddValidation(reader);
            }
#endif

#if ASYNC
            if (useAsync) {
                reader = XmlAsyncCheckReader.CreateAsyncCheckWrapper(reader);
            }
#endif

            return reader;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:31,代码来源:XmlReaderSettings.cs

示例14: ValidateDefaultAttributeOnUse

        internal void ValidateDefaultAttributeOnUse(IDtdDefaultAttributeInfo defaultAttribute, XmlTextReaderImpl coreReader) {
            SchemaAttDef attdef = defaultAttribute as SchemaAttDef;
            if (attdef == null) {
                return;
            }

            if (!attdef.DefaultValueChecked) {
                SchemaInfo schemaInfo = coreReader.DtdInfo as SchemaInfo;
                if (schemaInfo == null) {
                    return;
                }
                DtdValidator.CheckDefaultValue(attdef, schemaInfo, eventHandling, coreReader.BaseURI);
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:14,代码来源:XmlValidatingReaderImpl.cs

示例15: CreateReaderImpl

        private static XmlReader CreateReaderImpl(Stream input, XmlReaderSettings settings, Uri baseUri, string baseUriStr,
                                                   XmlParserContext inputContext, bool closeInput) {
            if (input == null) {
                throw new ArgumentNullException("input");
            }
            if (baseUriStr == null) {
                Debug.Assert(baseUri == null);
                baseUriStr = string.Empty;
            }

            // create text XML reader
            XmlReader reader = new XmlTextReaderImpl(input, null, 0, settings, baseUri, baseUriStr, inputContext, closeInput);

            // wrap with validating reader
            if ( settings.ValidationType != ValidationType.None ) {
                reader = AddValidation(reader, settings);
            }
            return reader;
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:19,代码来源:xmlreader.cs


注:本文中的System.Xml.XmlTextReaderImpl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。