/// <summary> /// Parses the given source and creates the document. /// </summary> /// <param name="options">The options to use for parsing.</param> public Document Parse(XmlParserOptions options) { var token = default(XmlToken); do { token = _tokenizer.Get(); Consume(token); }while (token.Type != XmlTokenType.EndOfFile); return(_document); }
internal async static Task<IDocument> LoadAsync(IBrowsingContext context, CreateDocumentOptions options, CancellationToken cancelToken) { var parserOptions = new XmlParserOptions { }; var document = new XmlDocument(context, options.Source); var parser = new XmlDomBuilder(document); document.Setup(options); context.NavigateTo(document); context.Fire(new HtmlParseEvent(document, completed: false)); await parser.ParseAsync(default(XmlParserOptions), cancelToken).ConfigureAwait(false); context.Fire(new HtmlParseEvent(document, completed: true)); return document; }
/// <summary> /// Parses the given source and creates the document. /// </summary> /// <param name="options">The options to use for parsing.</param> public Document Parse(XmlParserOptions options) { var token = default(XmlToken); _options = options; _tokenizer.IsSuppressingErrors = options.IsSuppressingErrors; do { token = _tokenizer.Get(); Consume(token); }while (token.Type != XmlTokenType.EndOfFile); return(_document); }
/// <summary> /// Parses the given source asynchronously and creates the document. /// </summary> /// <param name="options">The options to use for parsing.</param> /// <param name="cancelToken">The cancellation token to use.</param> public async Task<Document> ParseAsync(XmlParserOptions options, CancellationToken cancelToken) { var source = _document.Source; var token = default(XmlToken); do { if (source.Length - source.Index < 1024) await source.Prefetch(8192, cancelToken).ConfigureAwait(false); token = _tokenizer.Get(); Consume(token); } while (token.Type != XmlTokenType.EndOfFile); return _document; }
/// <summary> /// Parses the given source asynchronously and creates the document. /// </summary> /// <param name="options">The options to use for parsing.</param> /// <param name="cancelToken">The cancellation token to use.</param> public async Task <Document> ParseAsync(XmlParserOptions options, CancellationToken cancelToken) { var source = _document.Source; var token = default(XmlToken); _options = options; do { if (source.Length - source.Index < 1024) { await source.Prefetch(8192, cancelToken).ConfigureAwait(false); } token = _tokenizer.Get(); Consume(token); }while (token.Type != XmlTokenType.EndOfFile); return(_document); }
/// <summary> /// Parses the given source and creates the document. /// </summary> /// <param name="options">The options to use for parsing.</param> public Document Parse(XmlParserOptions options) { var token = default(XmlToken); do { token = _tokenizer.Get(); Consume(token); } while (token.Type != XmlTokenType.EndOfFile); return _document; }
/// <summary> /// Creates a new parser with the custom options and the given context. /// </summary> /// <param name="options">The options to use.</param> /// <param name="context">The context to use.</param> public XmlParser(XmlParserOptions options, IBrowsingContext context) { _options = options; _context = context; }
/// <summary> /// Creates a new parser with the custom options and configuration. /// </summary> /// <param name="options">The options to use.</param> /// <param name="configuration">The configuration to use.</param> public XmlParser(XmlParserOptions options, IConfiguration configuration) : this(options, BrowsingContext.New(configuration)) { }
/// <summary> /// Creates a new parser with the custom options. /// </summary> /// <param name="options">The options to use.</param> public XmlParser(XmlParserOptions options) : this(options, Configuration.Default) { }
/// <summary> /// Parses the given source and creates the document. /// </summary> /// <param name="options">The options to use for parsing.</param> public Document Parse(XmlParserOptions options) { var token = default(XmlToken); _options = options; _tokenizer.IsSuppressingErrors = options.IsSuppressingErrors; do { token = _tokenizer.Get(); Consume(token); } while (token.Type != XmlTokenType.EndOfFile); return _document; }
/// <summary> /// Creates a new parser with the custom options and the given context. /// </summary> /// <param name="options">The options to use.</param> /// <param name="context">The context to use.</param> public XmlParser(XmlParserOptions options, IBrowsingContext context) { _options = options; _context = context; }
/// <summary> /// Creates a new parser with the custom options and configuration. /// </summary> /// <param name="options">The options to use.</param> /// <param name="configuration">The configuration to use.</param> public XmlParser(XmlParserOptions options, IConfiguration configuration) : this(options, BrowsingContext.New(configuration)) { }
/// <summary> /// Creates a new parser with the custom options. /// </summary> /// <param name="options">The options to use.</param> public XmlParser(XmlParserOptions options) : this(options, Configuration.Default) { }