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


C# XmlReaderSettings.GetXmlResolver方法代码示例

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


在下文中一共展示了XmlReaderSettings.GetXmlResolver方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: XmlTextReaderImpl

        // Initializes a new instance of the XmlTextReaderImpl class with the specified arguments.
        // This constructor is used when creating XmlTextReaderImpl via XmlReader.Create
        internal XmlTextReaderImpl(Stream stream, byte[] bytes, int byteCount, XmlReaderSettings settings, Uri baseUri, string baseUriStr,
                                    XmlParserContext context, bool closeInput)
            : this(settings.GetXmlResolver(), settings, context)
        {
            // get BaseUri from XmlParserContext
            if (context != null)
            {
                if (context.BaseURI != null && context.BaseURI.Length > 0 &&
                    !UriEqual(baseUri, baseUriStr, context.BaseURI, settings.GetXmlResolver()))
                {
                    if (baseUriStr.Length > 0)
                    {
                        Throw(SR.Xml_DoubleBaseUri);
                    }
                    Debug.Assert(baseUri == null);
                    baseUriStr = context.BaseURI;
                }
            }

            _reportedBaseUri = baseUriStr;
            _closeInput = closeInput;

            _laterInitParam = new LaterInitParam();
            _laterInitParam.inputStream = stream;
            _laterInitParam.inputBytes = bytes;
            _laterInitParam.inputByteCount = byteCount;
            _laterInitParam.inputbaseUri = baseUri;
            _laterInitParam.inputContext = context;

            _laterInitParam.initType = InitInputType.Stream;
            if (!settings.Async)
            {
                //if not set Async flag, finish the init in create stage.
                FinishInitStream();
            }
            else
            {
                _laterInitParam.useAsync = true;
            }
        }
开发者ID:chcosta,项目名称:corefx,代码行数:42,代码来源:XmlTextReaderImpl.cs

示例2: CreateReaderImpl

        private static XmlReader CreateReaderImpl(XmlReader baseReader, XmlReaderSettings settings) {
            Debug.Assert(baseReader != null);
            Debug.Assert(settings != null);

            XmlReader reader = baseReader;

            // wrap with DTD validating reader
            if (settings.ValidationType == ValidationType.DTD) {
                reader = CreateDtdValidatingReader(reader, settings);
            }
            // add conformance checking (must go after DTD validation because XmlValidatingReader works only on XmlTextReader),
            // but before XSD validation because of typed value access
            reader = AddWrapper(reader, settings, reader.Settings);

            if (settings.ValidationType == ValidationType.Schema) {
                reader = new XsdValidatingReader(reader, settings.GetXmlResolver(), settings);
            }
            return reader;
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:19,代码来源:xmlreader.cs

示例3: AddValidation

 private static XmlReader AddValidation( XmlReader reader, XmlReaderSettings settings ) {
     if (settings.ValidationType == ValidationType.Schema) {
         reader = new XsdValidatingReader(reader, settings.GetXmlResolver(), settings);
     }
     else if (settings.ValidationType == ValidationType.DTD) {
         reader = CreateDtdValidatingReader(reader, settings);
     }
     return reader;
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:9,代码来源:xmlreader.cs

示例4: XmlTextReaderImpl

        // Initializes a new instance of the XmlTextReaderImpl class with the specified arguments.
        // This constructor is used when creating XmlTextReaderImpl via XmlReader.Create
        internal XmlTextReaderImpl( TextReader input, XmlReaderSettings settings, string baseUriStr, XmlParserContext context ) 
            : this( settings.GetXmlResolver(), settings, context ) {

            // get BaseUri from XmlParserContext
            if ( context != null ) {
                Debug.Assert( baseUriStr == string.Empty, "BaseURI can come either from XmlParserContext or from the constructor argument, not from both" );
                if ( context.BaseURI != null ) {
                    baseUriStr = context.BaseURI;
                }
            }

            // init ParsingState
            InitTextReaderInput( baseUriStr, input );

            this.closeInput = settings.CloseInput;

            reportedBaseUri = ps.baseUriStr;
            reportedEncoding = ps.encoding;

            // parse DTD
            if ( context != null && context.HasDtdInfo ) {
                if ( prohibitDtd ) {
                    ThrowWithoutLineInfo( Res.Xml_DtdIsProhibitedEx, string.Empty );
                }
                ParseDtdFromParserContext();
            }
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:29,代码来源:xmltextreaderimpl.cs


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