當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。