Ejemplo n.º 1
0
        private HtmlDocumentFragment LoadHtml(string html, HtmlReaderSettings settings)
        {
            settings = settings ?? HtmlReaderSettings.Default;

            var treeBuilder = settings.Mode.CreateTreeBuilder();

            BaseUri = settings.BaseUri;
            Append(treeBuilder.ParseFragment(
                       html,
                       settings.ContextElement,
                       settings.BaseUri,
                       HtmlParseErrorCollection.Tracking(settings.MaxErrors)
                       ));
            return(this);
        }
Ejemplo n.º 2
0
        private HtmlDocument LoadHtml(string html, HtmlReaderSettings settings)
        {
            settings = settings ?? HtmlReaderSettings.Default;

            var treeBuilder = settings.Mode.CreateTreeBuilder();

            treeBuilder.CreateDocument = uri => {
                BaseUri = uri;
                return(this);
            };

            treeBuilder.Parse(
                html,
                settings.BaseUri,
                HtmlParseErrorCollection.Tracking(settings.MaxErrors)
                );
            return(this);
        }
Ejemplo n.º 3
0
        public static HtmlDocument ParseXml(string html, Uri baseUri)
        {
            TreeBuilder treeBuilder = new XmlTreeBuilder();

            return(treeBuilder.Parse(html, baseUri, HtmlParseErrorCollection.NoTracking()));
        }