Ejemplo n.º 1
0
        public static void LinqCompare(XmlDocument doc, string html, ParserOptions options = null)
        {
#if !net20
            // Linq check
            XDocument xdoc         = XHtmlLoaderX.LoadHtml(html, options);
            string    xdocOuterXml = xdoc.ToString(SaveOptions.DisableFormatting);
            Console.WriteLine(xdocOuterXml);
            Assert.AreEqual(doc.OuterXml, xdocOuterXml);
#endif
        }
Ejemplo n.º 2
0
        static string[] XHtmlKit_Linq_ParseAndSearch(string html, string xpath = null)
        {
            List <string> searchResults = new List <string>();
            XDocument     doc           = XHtmlLoaderX.LoadHtml(html);

            if (xpath != null)
            {
                var results = doc.XPathSelectElements(xpath);
                foreach (XElement node in results)
                {
                    string result = node.Value;
                    searchResults.Add(result);
                }
            }
            return(searchResults.ToArray());
        }
Ejemplo n.º 3
0
 public static void LoadHtmlFragment(this XNode node, string html)
 {
     XHtmlLoaderX.LoadHtmlFragment(node, new StringReader(html), new ParserOptions());
 }
Ejemplo n.º 4
0
 public static async Task LoadWebPageAsync(this XDocument doc, string url)
 {
     await XHtmlLoaderX.LoadWebPageAsync(doc, url, new LoaderOptions());
 }
Ejemplo n.º 5
0
 public static void LoadHtml(this XDocument doc, string html)
 {
     XHtmlLoaderX.LoadHtml(doc, new StringReader(html), new ParserOptions());
 }