在C#中辐射HTML文件 [英] Rading HTML File in C#

查看:69
本文介绍了在C#中辐射HTML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.

我需要在c#中读取HTML文件,然后将数据绑定到gridView.

我可以使用网络浏览器控件读取HTML文件的内容,
但数据为原始格式:( ..

有人可以建议一些方法来完成它吗?
我曾尝试为其寻找任何合适的资源,但未成功.

请有人帮助我解决此问题.

预先感谢.

Hi All.

I need to read a HTML file in c# and then bind the data to a gridView.

I am able to read the content of HTML file using a web-browser control,
but data is in raw format :( .

Can anybody suggest some way to get it done.
I had tried searching for any proper resource for it, but was unsuccessful.

Please somebody help me to resolve this issue.

Thank in advance.

推荐答案

您可以将其读取为XML.
You can read it as XML.
using System.Xml;

XmlDocument xd = new XmlDocument();

xd.LoadXml("FilePath");



本教程可能会有所帮助:在C#中读取和写入XML" .




This tutorial may help: "Reading and Writing XML in C#".



如果您可以表示自己的数据,我们可以清楚地知道,

但我发现此链接很有用
http://www.acruxsoftware.net/html-parser-csharp-vb. net-xpath/htmlparser.htm [ ^ ]
如果要解析HTML,或者可以对XML (尝试"google")使用Xpath Navigation.

如果有帮助,请 投票 接受答案 .
We can have the clear idea if you can represent your data,

but I found this link to be useful
http://www.acruxsoftware.net/html-parser-csharp-vb.net-xpath/htmlparser.htm[^]
If you want to parse HTML, or you could use Xpath Navigation for XML(try ''google'').

Please vote and Accept Answer if it Helped.


尝试使用linq到xml
很容易
[ ]
try to use the linq to xml
it is easy
[]


这篇关于在C#中辐射HTML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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