HtmlAgilityPack SelectNode 不适用于 WP8.1
HtmlAgilityPack SelectNode doesn't works on WP8.1
在我的控制台项目中,它运行良好...但是当我在 windows phone 8.1 上运行时,它不起作用。有什么问题?
HtmlNodeCollection NoAltElements = HD.DocumentNode.SelectNodes("//div[@class='f2p-card']//div[@class='champion-info']//a[@href]");
HtmlNodeCollection NoAltElements = HD.DocumentNode.SelectNodes("//div[@class='white-stone']//a[@href]");
"im trying to make .SelectsNodes() on WP8.1, but cant understand how can i do this if XPath doesnt support on WP8.1"
当 HtmlAgilityPack (HAP) XPath API 不可用时,常见的替代方法是 LINQ API,例如:
IEnumerable<HtmlNode> NoAltElements =
HD.DocumentNode
.Descendants("div")
.Where(o => o.GetAttributeValue("class", "") == "f2p-card")
.SelectMany(o => o.Descendants("div"))
.Where(o => o.GetAttributeValue("class", "") == "champion-info")
.SelectMany(o => o.Descendants("a"))
.Where(o => o.GetAttributeValue("href", null) != null);
IEnumerable<HtmlNode> NoAltElements =
HD.DocumentNode
.Descendants("div")
.Where(o => o .GetAttributeValue("class","") == "white-stone")
.SelectMany(o => o.Descendants("a"))
.Where(o => o .GetAttributeValue("href",null) != null);
在我的控制台项目中,它运行良好...但是当我在 windows phone 8.1 上运行时,它不起作用。有什么问题?
HtmlNodeCollection NoAltElements = HD.DocumentNode.SelectNodes("//div[@class='f2p-card']//div[@class='champion-info']//a[@href]");
HtmlNodeCollection NoAltElements = HD.DocumentNode.SelectNodes("//div[@class='white-stone']//a[@href]");
"im trying to make .SelectsNodes() on WP8.1, but cant understand how can i do this if XPath doesnt support on WP8.1"
当 HtmlAgilityPack (HAP) XPath API 不可用时,常见的替代方法是 LINQ API,例如:
IEnumerable<HtmlNode> NoAltElements =
HD.DocumentNode
.Descendants("div")
.Where(o => o.GetAttributeValue("class", "") == "f2p-card")
.SelectMany(o => o.Descendants("div"))
.Where(o => o.GetAttributeValue("class", "") == "champion-info")
.SelectMany(o => o.Descendants("a"))
.Where(o => o.GetAttributeValue("href", null) != null);
IEnumerable<HtmlNode> NoAltElements =
HD.DocumentNode
.Descendants("div")
.Where(o => o .GetAttributeValue("class","") == "white-stone")
.SelectMany(o => o.Descendants("a"))
.Where(o => o .GetAttributeValue("href",null) != null);