HTML敏捷包问题 [英] HTML Agility Pack Issue

查看:90
本文介绍了HTML敏捷包问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设用户给出的left1值为54.00,那么我该如何获取.pstyle251x63值作为输出?

HTML档案,

Suppose the user is giving the left1 value as 54.00 means, How can i get this .pstyle251x63 value as a output?

Html File like,

<style>
.pstyle251x63{text-indent: 0; marginsizeleft: 0;marginsizefirst: 0;marginsizeright: 0;Leading: 22.5;position1: absolute; left1: 54.00; top1: 47.80; width1: 58.84; height1: 22.50; z-index1: 10063;pagewidth1: 343.00; pageheight1:552.00;}
</style>



使用 HTML Agility Pack ,我需要获取此.pstyle251x63值?



Using HTML Agility pack, i need to get this .pstyle251x63 value?

推荐答案

静态void Main(string [] args)
{
HtmlAgilityPack.HtmlWeb web =新的HtmlWeb();
HtmlAgilityPack.HtmlDocument doc = web.Load("http://www.google.com");
//System.Console.WriteLine(doc.DocumentNode.SelectSingleNode("//*[@id=\"lst-ib\"]").Id); //这不能正常工作
foreach(doc.DocumentNode.SelectNodes("//* [@ id = \" gbw \]")中的HtmlNode链接))
{
HtmlAttribute att = link.Attributes ["id"];

System.Console.Write(att.Value);

}
System.Console.ReadKey();


}
static void Main(string[] args)
{
HtmlAgilityPack.HtmlWeb web = new HtmlWeb();
HtmlAgilityPack.HtmlDocument doc = web.Load("http://www.google.com");
//System.Console.WriteLine(doc.DocumentNode.SelectSingleNode("//*[@id=\"lst-ib\"]").Id); //This is not working as well
foreach (HtmlNode link in doc.DocumentNode.SelectNodes("//*[@id=\"gbw\"]"))
{
HtmlAttribute att = link.Attributes["id"];

System.Console.Write(att.Value);

}
System.Console.ReadKey();


}


这篇关于HTML敏捷包问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆