如何使用C#获取标签和属性html [英] how to getting tag and attribute html using C#

查看:161
本文介绍了如何使用C#获取标签和属性html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好..对不起,如果我的英语不好..
我了解了解析的知识..但这还不够..我编写了代码,以从"
现在我想知道如何使用c#获取所有html标签和属性.在这种情况下,我想获取所有标签和属性而不是属性值.

例如:我要获取html,body,src,alt,widht,height等.

hi all..sorry if my english so bad..
i''ve learnt about parsing..but it was not enough..i''ve made a code to get value of attribute from "An Elementary HTML Parser"

and now i want to know how to get all html tags and attributes using c#..in this case i want get all tags and attributes not values of attributes..

ex: i want get html,body,src,alt,widht,height,etc.

thx before

推荐答案

之前thx,这是最好的开源HTML解析器:

http://htmlagilitypack.codeplex.com/ [ ^ ]

我强烈推荐它.我已经用过了,它动摇了!
This is the best open source HTML parser out there:

http://htmlagilitypack.codeplex.com/[^]

I strongly recommend it. I''ve used it, and it rocks!


基于xml元语言的html文档.我想使用System.XML命名空间来搜索文档中的元素或使用LINQ to XML来解决此问题
html documents based on xml meta languages . i think to solve this problem using System.XML namespace to search elements in document or using LINQ to XML


这篇关于如何使用C#获取标签和属性html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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