HtmlAgilityPack using Linq for windows phone 8.1 platform

后端 未结 2 980
猫巷女王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:37

    If you meant to translate your current code which using XPath to be using LINQ, then this will do :

    HtmlNode parent = document.DocumentNode
                              .Descendants("ul")
                              .FirstOrDefault(o => o.GetAttributeValue("class", "") 
                                                       == "songs-list1")
    HtmlNodeCollection x = parent.ChildNodes;
    

    But if you expect to find methods that accept XPath in HtmlAgilityPack version for Windows Phone 8.1 universal apps or Windows RT ("I'm seeking for a block of code which will work like SelectNodes, SelectNode"), you better don't : HtmlAgilityPack & Windows 8 Metro Apps (answer by the author of HAP).

提交回复
热议问题