/// <summary> /// Creates the default document loader with the stored requesters. /// </summary> /// <param name="context">The context to use.</param> /// <returns>The instantiated default document loader.</returns> public virtual IDocumentLoader CreateDocumentLoader(IBrowsingContext context) { if (IsNavigationEnabled == false) return null; return new DocumentLoader(_requesters, context, Filter); }
public MainViewModel() { var events = new EventAggregator(); var config = new Configuration(events: events).WithCss().WithDefaultLoader(m => { m.IsNavigationEnabled = true; m.IsResourceLoadingEnabled = true; }); context = BrowsingContext.New(config); profiler = new ProfilerViewModel(events); errors = new ErrorsViewModel(events); dom = new DOMViewModel(); query = new QueryViewModel(); repl = new ReplViewModel(); settings = new SettingsViewModel(); statistics = new StatisticsViewModel(); tree = new TreeViewModel(); sheets = new SheetViewModel(); cts = new CancellationTokenSource(); views = new ITabViewModel[] { dom, query, repl, statistics, tree, sheets }; logs = new IEventViewModel[] { profiler, errors }; }
public HtmlIFrameElement(Document owner, String prefix = null) : base(owner, Tags.Iframe, prefix, NodeFlags.LiteralText) { _context = owner.NewChildContext(Sandboxes.None); RegisterAttributeObserver(AttributeNames.Src, UpdateSource); RegisterAttributeObserver(AttributeNames.SrcDoc, UpdateSource); }
/// <summary> /// Creates a new resource loader. /// </summary> /// <param name="context">The context to use.</param> /// <param name="filter">The optional request filter to use.</param> public BaseLoader(IBrowsingContext context, Predicate<IRequest> filter) { _context = context; _filter = filter ?? (_ => true); _downloads = new List<IDownload>(); MaxRedirects = 50; }
/// <summary> /// Creates the default resource loader with the stored requesters. /// </summary> /// <param name="context">The context to use.</param> /// <returns>The instantiated default resource loader.</returns> public virtual IResourceLoader CreateResourceLoader(IBrowsingContext context) { if (!IsResourceLoadingEnabled) { return null; } return new ResourceLoader(_requesters, context.Configuration, Filter); }
/// <summary> /// Creates the default document loader with the stored requesters. /// </summary> /// <param name="context">The context to use.</param> /// <returns>The instantiated default document loader.</returns> public virtual IDocumentLoader CreateDocumentLoader(IBrowsingContext context) { if (!IsNavigationEnabled) { return null; } return new DocumentLoader(_requesters, context.Configuration, Filter); }
public static List <string> GetJobLinksInPage(IBrowsingContext context, string pageUrl) { var document = context.OpenAsync(pageUrl).Result; var links = document.QuerySelectorAll <IHtmlAnchorElement>(".joblink") .Select(x => x.Href) .ToList(); return(links); }
async Task <Calendar> DownloadCalendar(IBrowsingContext context, Uri baseUri, int year) { var document = await context.OpenAsync(baseUri.ToString() + year); if (document.StatusCode != HttpStatusCode.OK) { throw new AocCommuncationError("Could not fetch calendar", document.StatusCode, document.TextContent); } return(Calendar.Parse(year, document)); }
/// <inheritdoc /> public Task Initialize(CancellationToken token) { context = BrowsingContext.New(Configuration.Default .WithDefaultLoader() .WithDefaultCookies()); logger = LogManager.GetLogger(GetType().FullName); return(Task.CompletedTask); }
public ProcessViewModel(IBrowsingContext context) { //_context = context; _parseResult = new BlockingCollection <ResultItem>(); _parseProcess = new ObservableCollection <ProcessItem>(); Register <CssErrorEvent>(m => App.Current.Dispatcher.Invoke(() => Message(string.Format("Ссылка {1} Ошибка стилей страницы: {0} ", m.Message, ((BrowsingContext)m.CurrentTarget).Active.Domain)))); Register <HtmlErrorEvent>(m => App.Current.Dispatcher.Invoke(() => Message(string.Format("Ссылка {1} Ошибка HTML кода страницы: {0} ", m.Message, ((BrowsingContext)m.CurrentTarget).Active.Domain)))); }
private static async Task <string> GetTitleAsync(string address, TimeSpan delay) { IConfiguration config = Configuration.Default.WithDefaultLoader(); IBrowsingContext context = BrowsingContext.New(config); IDocument document = await context.OpenAsync(address); await Task.Delay(delay); return(document.Title); }
public FixtureScraperService( IDeletableEntityRepository <Fixture> fixtureRepo, IDeletableEntityRepository <Club> clubRepo) { var config = Configuration.Default.WithDefaultLoader(); this.context = BrowsingContext.New(config); this.fixtureRepo = fixtureRepo; this.clubRepo = clubRepo; }
public void GetHtmlTableNode_HtmlWithSingleTable_ShouldReturnTableHtmlNode() { string htmlWithTable = "<div><table><thead></thead><tbody></tbody></table></div>"; IBrowsingContext ctx = BrowsingContext.New(Configuration.Default.WithDefaultLoader()); var doc = ctx.OpenAsync(r => r.Content(htmlWithTable)).Result; IElement element = new AngleSharpUtilities().GetHtmlTableNode(doc.DocumentElement); Assert.IsTrue(element != null && element.NodeName.Equals("table", StringComparison.InvariantCultureIgnoreCase)); }
/// <summary> /// Opens a new document created from the response asynchronously in /// the given context. /// </summary> /// <param name="context">The browsing context to use.</param> /// <param name="response">The response to examine.</param> /// <param name="cancel">The cancellation token.</param> /// <returns>The task that creates the document.</returns> public static Task <IDocument> OpenAsync(this IBrowsingContext context, IResponse response, CancellationToken cancel = default) { response = response ?? throw new ArgumentNullException(nameof(response)); context ??= BrowsingContext.New(); var encoding = context.GetDefaultEncoding(); var factory = context.GetFactory <IDocumentFactory>(); var options = new CreateDocumentOptions(response, encoding); return(factory.CreateAsync(context, options, cancel)); }
private static int GetPages(IBrowsingContext context) { const string jobCountSelector = "#search_results_div > table > tbody > tr > td > table > tbody > tr:nth-child(3) > td:nth-child(1)"; var document = context.OpenAsync(GetPageUrl(0)).Result; var jobsOnPage = document.QuerySelector(jobCountSelector).TextContent; var jobs = int.Parse(Regex.Matches(jobsOnPage, @"\d+").Cast <Match>().Last().Value); var pages = (int)Math.Ceiling(jobs / (double)JobsPerPage); return(pages); }
/// <summary> /// Gets the culture from the language string (or the current culture). /// </summary> /// <param name="context">The current context.</param> /// <param name="language">The ISO culture name.</param> /// <returns> /// The culture info representing the language or the current culture. /// </returns> public static CultureInfo GetCultureFrom(this IBrowsingContext context, String language) { try { return(new CultureInfo(language)); } catch (CultureNotFoundException) { return(context.GetCulture()); } }
public FetchService(Database database) { var config = new LoaderOptions(); IConfiguration configuration = Configuration.Default .With(new DefaultHttpRequester()) .With <IDocumentLoader>(ctx => new CrabtopusDocumentLoader(ctx, config.Filter)) .With <IResourceLoader>(ctx => new DefaultResourceLoader(ctx, config.Filter)); _context = BrowsingContext.New(configuration); _database = database; }
/// <summary> /// Gets the history tracker for the given context, by creating it if /// possible. /// </summary> /// <param name="context">The context that needs to be tracked.</param> /// <returns>An history object or null.</returns> public static IHistory CreateHistory(this IBrowsingContext context) { var service = context.Configuration.GetService <IHistoryService>(); if (service == null) { return(null); } return(service.CreateHistory(context)); }
public static async Task <IDocument> OpenPageAsync(this IBrowsingContext browsingContext, string path) { var z = IsLocalPath(path); if (IsLocalPath(path)) { return(await browsingContext.OpenAsync(req => req.Content(File.ReadAllText(path)))); } return(await browsingContext.OpenAsync(path)); }
/// <summary> /// Creates the specified target browsing context. /// </summary> /// <param name="context">The current context.</param> /// <param name="target">The specified target name.</param> /// <returns>The new context.</returns> public static IBrowsingContext CreateChildFor(this IBrowsingContext context, String target) { var security = Sandboxes.None; if (target.Is("_blank")) { target = null; } return(context.CreateChild(target, security)); }
public ProfilerViewModel(IBrowsingContext context) { _time = new Stopwatch(); _tracker = new Dictionary <Object, TimeSpan>(); _context = context; _model = CreateModel(); _context.AddEventListener(EventNames.Parsing, TrackParsing); _context.AddEventListener(EventNames.Parsed, TrackParsed); _context.AddEventListener(EventNames.Requesting, TrackRequesting); _context.AddEventListener(EventNames.Requested, TrackRequested); }
internal static async Task <IDocument> StringToHtmlDocument(string html) { if (string.IsNullOrEmpty(html)) { return(null); } IBrowsingContext context = BrowsingContext.New(); return(await context.OpenAsync(req => req.Content(html)).ConfigureAwait(false)); }
private async Task <IDocument> LoadDocumentAsync(IBrowsingContext context, string filename) { var content = this.LoadContent(filename, this.encoding).Replace("; charset=iso-8859-1", string.Empty, StringComparison.InvariantCultureIgnoreCase); if (content == null) { return(null); } return(await context.OpenAsync(req => req.Content(content)).ConfigureAwait(false)); }
internal static CssProperty CreateProperty(this IBrowsingContext context, String propertyName) { var info = context.GetDeclarationInfo(propertyName); if (context.AllowsDeclaration(info)) { return(new CssProperty(propertyName, info.Converter, info.Flags)); } return(null); }
/// <summary> /// Gets the document loader for the given context, by creating it if /// possible. /// </summary> /// <param name="context">The context that hosts the loader.</param> /// <returns>A document loader or null.</returns> public static IDocumentLoader CreateLoader(this IBrowsingContext context) { var service = context.Configuration.GetService <ILoaderService>(); if (service == null) { return(null); } return(service.CreateDocumentLoader(context)); }
/// <summary> /// Creates a new selector parser using the different factories. /// </summary> internal CssSelectorParser(IBrowsingContext context) { if (context == null) { context = BrowsingContext.NewFrom <ICssSelectorParser>(this); } _attribute = context.GetFactory <IAttributeSelectorFactory>(); _pseudoClass = context.GetFactory <IPseudoClassSelectorFactory>(); _pseudoElement = context.GetFactory <IPseudoElementSelectorFactory>(); }
/// <summary> /// Creates an instance of the parser with a AngleSharp context /// without a <see cref="TestRenderer"/> registered. /// </summary> public TestHtmlParser() { var config = Configuration.Default .WithCss() .With(new HtmlComparer()) .With(this); _context = BrowsingContext.New(config); _htmlParser = _context.GetService <IHtmlParser>(); _document = _context.OpenNewAsync().Result; }
public DepartmentScraper( IBrowsingContext browsingContext, IEntityScraper <Store> storeScraper, ICacheStorage <string, Department> cacheStorage, ICookiesAwareHttpClientFactory cookiesAwareHttpClientFactory) { this.browsingContext = browsingContext; this.storeScraper = storeScraper; this.cacheStorage = cacheStorage; this.cookiesAwareHttpClientFactory = cookiesAwareHttpClientFactory; }
public GelbeSeitenSpider() { Title = "BOT - gelbeseiten.de Firmensuche"; ExportFileName = "gelbeseiten-export.csv"; _bundesLänder = new BundesLänder(); var config = Configuration.Default.WithDefaultLoader(); Browser = BrowsingContext.New(config); }
/// <summary> /// Navigates to the given document. Includes the document in the /// session history and sets it as the active document. /// </summary> /// <param name="context">The browsing context to use.</param> /// <param name="document">The new document.</param> public static void NavigateTo(this IBrowsingContext context, IDocument document) { var history = context.SessionHistory; if (history != null) { history.PushState(document, document.Title, document.Url); } context.Active = document; }
public GotvachBgScrapperService(IDeletableEntityRepository <Category> categoryRepository, IDeletableEntityRepository <Ingredient> ingredientRepository, IDeletableEntityRepository <Recipe> recipeRepository, IRepository <RecipeIngredient> recipeIngredientRepository, IRepository <Image> imageRepository) { this.config = Configuration.Default.WithDefaultLoader(); this.context = BrowsingContext.New(this.config); this.categoryRepository = categoryRepository; this.ingredientRepository = ingredientRepository; this.recipeRepository = recipeRepository; this.recipeIngredientRepository = recipeIngredientRepository; this.imageRepository = imageRepository; }
static void CreateCssSelectorTest(IBrowsingContext context, String url, List<String> methods) { Console.Write("Loading " + url + " ... "); var document = context.OpenAsync(url).Result; var title = Sanatize(document.GetElementsByTagName("title")[0].TextContent); var content = document.GetElementsByTagName("content")[0].InnerHtml.Trim().Replace("\"", "\"\""); var styling = document.GetElementsByTagName("css")[0].TextContent; var parser = new CssParser(); var sheet = parser.ParseStylesheet(styling); var selectors = new StringBuilder(); var i = 1; if (methods.Contains(title)) { var ltr = 'A'; while (methods.Contains(title + ltr)) ltr = (Char)(ltr + 1); title += ltr.ToString(); } foreach (var rule in sheet.Rules) { if (rule is ICssStyleRule) { selectors.Append(@" var selectorINDEX = doc.QuerySelectorAll(""SELECTOR""); Assert.AreEqual(0, selectorINDEX.Length);" .Replace("SELECTOR", ((ICssStyleRule)rule).SelectorText) .Replace("INDEX", i.ToString())); i++; } } File.AppendAllText("test.cs", @" /// <summary> /// Test taken from URL /// </summary> public void TITLE() { var source = @""HTML""; var doc = DocumentBuilder.Html(source); SELECTORS } " .Replace("URL", url) .Replace("TITLE", title) .Replace("HTML", content) .Replace("SELECTORS", selectors.ToString()) ); Console.WriteLine("success."); methods.Add(title); }
public StoreScraper( IBrowsingContext browsingContext, ICacheStorage <string, Store> cacheStorage, IOfficialStoreInfoService officialStoreInfoService, ICookiesAwareHttpClientFactory cookiesAwareHttpClientFactory) { this.browsingContext = browsingContext; this.cacheStorage = cacheStorage; this.officialStoreInfoService = officialStoreInfoService; this.cookiesAwareHttpClientFactory = cookiesAwareHttpClientFactory; }
public ProfilerViewModel(IBrowsingContext context) { _time = new Stopwatch(); _tracker = new Dictionary <Object, TimeSpan>(); _context = context; _model = CreateModel(); _context.Parsing += TrackParsing; _context.Parsed += TrackParsed; _context.Requesting += TrackRequesting; _context.Requested += TrackRequested; }
internal static async Task <HtmlDocumentResponse> Create([NotNull] StreamResponse streamResponse) { if (streamResponse == null) { throw new ArgumentNullException(nameof(streamResponse)); } IBrowsingContext context = BrowsingContext.New(Configuration.Default.WithXPath()); IDocument document = await context.OpenAsync(req => req.Content(streamResponse.Content, true)).ConfigureAwait(false); return(new HtmlDocumentResponse(streamResponse, 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; }
async Task <Problem> DownloadProblem(IBrowsingContext context, Uri baseUri, int year, int day) { var problemStatement = await context.OpenAsync(baseUri + $"{year}/day/{day}"); var input = await context.GetService <IDocumentLoader>().FetchAsync( new DocumentRequest(new Url(baseUri + $"{year}/day/{day}/input"))).Task; return(Problem.Parse( year, day, baseUri + $"{year}/day/{day}", problemStatement, new StreamReader(input.Content).ReadToEnd() )); }
/// <summary> /// Opens a new document loaded from a virtual response that can be /// filled via the provided callback. /// </summary> /// <param name="context">The browsing context to use.</param> /// <param name="request">Callback with the response to setup.</param> /// <param name="cancel">The cancellation token.</param> /// <returns>The task that creates the document.</returns> public static async Task <IDocument> OpenAsync(this IBrowsingContext context, Action <VirtualResponse> request, CancellationToken cancel) { if (request == null) { throw new ArgumentNullException("request"); } using (var response = VirtualResponse.Create(request)) { return(await context.OpenAsync(response, cancel).ConfigureAwait(false)); } }
/// <summary> /// Loads the document in the provided context from the given response. /// </summary> /// <param name="context">The browsing context.</param> /// <param name="response">The response to consider.</param> /// <param name="source">The source to use.</param> /// <param name="cancelToken">Token for cancellation.</param> /// <returns>The task that builds the document.</returns> internal async static Task<SvgDocument> LoadAsync(IBrowsingContext context, IResponse response, TextSource source, CancellationToken cancelToken) { var contentType = response.Headers.GetOrDefault(HeaderNames.ContentType, MimeTypes.Svg); var document = new SvgDocument(context, source); var parser = new XmlDomBuilder(document); document.ContentType = contentType; document.Referrer = response.Headers.GetOrDefault(HeaderNames.Referer, String.Empty); document.DocumentUri = response.Address.Href; document.Cookie = response.Headers.GetOrDefault(HeaderNames.SetCookie, String.Empty); document.ReadyState = DocumentReadyState.Loading; await parser.ParseAsync(default(XmlParserOptions), cancelToken).ConfigureAwait(false); return document; }
/// <summary> /// Loads the document in the provided context from the given response. /// </summary> /// <param name="context">The browsing context.</param> /// <param name="options">The creation options to consider.</param> /// <param name="cancelToken">Token for cancellation.</param> /// <returns>The task that builds the document.</returns> internal async static Task<IDocument> LoadAsync(IBrowsingContext context, CreateDocumentOptions options, CancellationToken cancelToken) { var document = new SvgDocument(context, options.Source); var evt = new HtmlParseStartEvent(document); var events = context.Configuration.Events; var parser = new XmlDomBuilder(document); document.Setup(options); context.NavigateTo(document); if (events != null) events.Publish(evt); await parser.ParseAsync(default(XmlParserOptions), cancelToken).ConfigureAwait(false); evt.FireEnd(); return document; }
internal async static Task<IDocument> LoadTextAsync(IBrowsingContext context, CreateDocumentOptions options, CancellationToken cancelToken) { var scripting = context.Configuration.IsScripting(); var parserOptions = new HtmlParserOptions { IsScripting = scripting }; var document = new HtmlDocument(context, options.Source); document.Setup(options); context.NavigateTo(document); var root = document.CreateElement(TagNames.Html); var head = document.CreateElement(TagNames.Head); var body = document.CreateElement(TagNames.Body); var pre = document.CreateElement(TagNames.Pre); document.AppendChild(root); root.AppendChild(head); root.AppendChild(body); body.AppendChild(pre); pre.SetAttribute(AttributeNames.Style, "word-wrap: break-word; white-space: pre-wrap;"); await options.Source.PrefetchAllAsync(cancelToken).ConfigureAwait(false); pre.TextContent = options.Source.Text; return document; }
/// <summary> /// Loads the document in the provided context from the given response. /// </summary> /// <param name="context">The browsing context.</param> /// <param name="response">The response to consider.</param> /// <param name="source">The source to use.</param> /// <param name="cancelToken">Token for cancellation.</param> /// <returns>The task that builds the document.</returns> internal async static Task<SvgDocument> LoadAsync(IBrowsingContext context, IResponse response, TextSource source, CancellationToken cancelToken) { var document = new SvgDocument(context, source); var evt = new HtmlParseStartEvent(document); var events = context.Configuration.Events; var parser = new XmlDomBuilder(document); document.ContentType = response.Headers.GetOrDefault(HeaderNames.ContentType, MimeTypes.Svg); document.Referrer = response.Headers.GetOrDefault(HeaderNames.Referer, String.Empty); document.DocumentUri = response.Address.Href; document.Cookie = response.Headers.GetOrDefault(HeaderNames.SetCookie, String.Empty); document.ReadyState = DocumentReadyState.Loading; context.NavigateTo(document); if (events != null) events.Publish(evt); await parser.ParseAsync(default(XmlParserOptions), cancelToken).ConfigureAwait(false); evt.FireEnd(); return document; }
/// <summary> /// Loads the document in the provided context from the given response. /// </summary> /// <param name="context">The browsing context.</param> /// <param name="response">The response to consider.</param> /// <param name="source">The source to use.</param> /// <param name="cancelToken">Token for cancellation.</param> /// <returns>The task that builds the document.</returns> internal async static Task<HtmlDocument> LoadAsync(IBrowsingContext context, IResponse response, TextSource source, CancellationToken cancelToken) { var document = new HtmlDocument(context, source); using (var evt = new HtmlParseStartEvent(document)) { var config = context.Configuration; var events = config.Events; var parser = new HtmlDomBuilder(document); document.ContentType = response.Headers.GetOrDefault(HeaderNames.ContentType, MimeTypes.Html); document.Referrer = response.Headers.GetOrDefault(HeaderNames.Referer, String.Empty); document.DocumentUri = response.Address.Href; document.Cookie = response.Headers.GetOrDefault(HeaderNames.SetCookie, String.Empty); document.ReadyState = DocumentReadyState.Loading; if (events != null) events.Publish(evt); var options = new HtmlParserOptions { IsScripting = config.IsScripting() }; await parser.ParseAsync(options, cancelToken).ConfigureAwait(false); } return document; }
private async Task CreateSheetAsync(IStyleEngine engine, IBrowsingContext context) { var cancel = CancellationToken.None; var response = VirtualResponse.Create(res => res.Content(TextContent).Address(default(Url))); var options = new StyleOptions(context) { Element = this, IsDisabled = IsDisabled, IsAlternate = false }; var task = engine.ParseStylesheetAsync(response, options, cancel); _sheet = await task.ConfigureAwait(false); }
/// <summary> /// Creates new style options for the given context. /// </summary> /// <param name="context">The context to use.</param> public StyleOptions(IBrowsingContext context) { Context = context; }
/// <summary> /// Creates a new document loader. /// </summary> /// <param name="requesters">The requesters to use.</param> /// <param name="context">The context for the document loader.</param> public DocumentLoader(IEnumerable<IRequester> requesters, IBrowsingContext context) { _requesters = requesters; _context = context; }
internal SvgDocument(IBrowsingContext context, TextSource source) : base(context ?? BrowsingContext.New(), source) { ContentType = MimeTypes.Svg; }
/// <summary> /// Creates a new document loader. /// </summary> /// <param name="context">The context to use.</param> /// <param name="filter">The optional request filter to use.</param> public DocumentLoader(IBrowsingContext context, Predicate<IRequest> filter = null) : base(context, filter) { }
internal XmlDocument(IBrowsingContext context = null) : this(context, new TextSource(String.Empty)) { }
static PirateRequest() { var config = Configuration.Default.WithDefaultLoader(); Context = BrowsingContext.New(config); }
/// <summary> /// Creates a new named browsing context as child of the given parent. /// </summary> /// <param name="parent">The parent context.</param> /// <param name="name">The name of the child context.</param> /// <param name="security">The security flags to apply.</param> /// <returns></returns> public IBrowsingContext Create(IBrowsingContext parent, String name, Sandboxes security) { var context = new BrowsingContext(parent, security); _cache[name] = new WeakReference<IBrowsingContext>(context); return context; }
/// <summary> /// Creates a new document node. /// </summary> /// <param name="context">The context of the document.</param> /// <param name="source">The underlying source.</param> internal Document(IBrowsingContext context, TextSource source) : base(null, "#document", NodeType.Document) { _async = true; _designMode = false; _firedUnload = false; _salvageable = true; _shown = false; _preferredStyleSheetSet = String.Empty; _context = context ?? BrowsingContext.New(); _source = source; _referrer = String.Empty; _contentType = MimeTypes.ApplicationXml; _ready = DocumentReadyState.Loading; _sandbox = Sandboxes.None; _quirksMode = QuirksMode.Off; _tasks = new CancellableTasks(); _mutations = new MutationHost(Options); _loadingScripts = new Queue<HtmlScriptElement>(); _location = new Location(AboutBlank); _ranges = new List<WeakReference<Range>>(); _location.Changed += LocationChanged; _styleSheets = this.CreateStyleSheets(); _view = this.CreateWindow(); _loader = this.CreateLoader(); }
internal HtmlDocument(IBrowsingContext context, TextSource source) : base(context, source) { ContentType = MimeTypes.Html; }
internal BrowsingContext(IBrowsingContext parent, Sandboxes security) : this(parent.Configuration, security) { _parent = parent; _creator = _parent.Active; }
/// <summary> /// Creates a new resource loader. /// </summary> /// <param name="context">The context to use.</param> /// <param name="filter">The optional request filter to use.</param> public ResourceLoader(IBrowsingContext context, Predicate<IRequest> filter = null) : base(context, filter) { }
public FrameElementRequest(Document document, HtmlFrameElementBase element, IBrowsingContext context, String htmlContent, String requestUrl) { _document = document; _element = element; _context = context; _htmlContent = htmlContent; _requestUrl = requestUrl; _cts = new CancellationTokenSource(); }
internal XmlDocument(IBrowsingContext context, TextSource source) : base(context ?? BrowsingContext.New(), source) { ContentType = MimeTypeNames.Xml; }
/// <summary> /// Creates a new document loader. /// </summary> /// <param name="requesters">The requesters to use.</param> /// <param name="context">The context for the document loader.</param> /// <param name="filter">The optional request filter to use.</param> public DocumentLoader(IEnumerable<IRequester> requesters, IBrowsingContext context, Predicate<IRequest> filter = null) { _requesters = requesters; _context = context; _filter = filter ?? (_ => true); }
/// <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 HtmlParser(HtmlParserOptions options, IBrowsingContext context) { _options = options; _context = context; }
public MarkdownDocument(IBrowsingContext context, TextSource source) : base(context, source) { }