HtmlAgilityPack using Linq for windows phone 8.1 platform

后端 未结 2 978
猫巷女王i
猫巷女王i 2020-12-10 20:19

As HtmlAgilityPack is yet not supported in windows phone 8.1,referencing manually in the project was a trick solution. But this is not the only problem. I could use XP

2条回答
  •  感动是毒
    2020-12-10 20:47

    You can do it using the Element/s method:

            HtmlDocument doc = new HtmlDocument();
            doc.LoadHtml(htmlString);
            var h6Nodes = from h6element in doc.DocumentNode.Element("body").Element("center").Elements("h6")
                          where h6element.Attributes["class"].Value.Equals("songs-list")                      
                          select h6element;
    

    This is assuming you have something like

    string htmlString = @"
    
    
    Hello
    World!
    Insert that one song here
    "

    and that will get the

    node with class songs-list.

提交回复
热议问题