本文整理汇总了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;
}
}
示例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;
}
示例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;
}
示例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();
}
}