internal XmlReader CreateReader(TextReader input, string?baseUriString, XmlParserContext?inputContext) { if (input == null) { throw new ArgumentNullException(nameof(input)); } if (baseUriString == null) { baseUriString = string.Empty; } // create xml text reader XmlReader reader = new XmlTextReaderImpl(input, this, baseUriString, inputContext); // wrap with validating reader if (this.ValidationType != ValidationType.None) { reader = AddValidation(reader); } if (_useAsync) { reader = XmlAsyncCheckReader.CreateAsyncCheckWrapper(reader); } return(reader); }
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() ?? new XmlUrlResolver(); // 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); }
// Initializes a new instance of XmlValidatingReaderImpl class for parsing fragments with the specified stream, fragment type and parser context // This constructor is used when creating XmlValidatingReaderImpl for V1 XmlValidatingReader // SxS: This method resolves an Uri but does not expose it to the caller. It's OK to suppress the SxS warning. internal XmlValidatingReaderImpl(Stream xmlFragment, XmlNodeType fragType, XmlParserContext?context) : this(new XmlTextReader(xmlFragment, fragType, context)) { if (_coreReader.BaseURI !.Length > 0) { _validator.BaseUri = GetResolver() !.ResolveUri(null, _coreReader.BaseURI); } if (context != null) { _parsingFunction = ParsingFunction.ParseDtdFromContext; _parserContext = context; } }
public XmlTextReader(string xmlFragment, XmlNodeType fragType, XmlParserContext?context) { _impl = new XmlTextReaderImpl(xmlFragment, fragType, context); _impl.OuterReader = this; }
public XmlTextReader([StringSyntax(StringSyntaxAttribute.Xml)] string xmlFragment, XmlNodeType fragType, XmlParserContext?context) { _impl = new XmlTextReaderImpl(xmlFragment, fragType, context); _impl.OuterReader = this; }