如何将html标记内容转换为字符串 [英] How to convert html tag contents to a string
本文介绍了如何将html标记内容转换为字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我需要在html中的标签中获取特定数据并将其转换为字符串,然后
将其显示为标签。
我正在制作一个程序,可以从网站上获取数据。
说你去了谷歌和打字的苹果
i需要它说部分在哪里说出了多少结果。 (不是我真的需要,但很好的例子)
我已经有一个表格的网页浏览器,我需要标签信息
从......来。
(我需要使用webbrowser)
So I need to get specific data in the tags within html and convert that to a string, then
display that as a label.
I am making a program that gives you data from a website.
say you went to google and typed apple
i need it to say the part where is says how many results came up. (not really what I need but good example)
I already have a webbrowser in a form that is where I need the tag information
to come from.
(webbrowser is needed for my use)
推荐答案
你可以像这样用来提取源码一个网页:
You can use like this to extract source of a web page:
Dim inputUrl As String = "http://google.com/"
Dim stream As System.IO.Stream
Dim myRequest As System.Net.WebRequest = System.Net.WebRequest.Create(str1)
Dim resp As System.Net.WebResponse = myRequest.GetResponse
stream = resp.GetResponseStream
srRead = New System.IO.StreamReader(stream)
Dim outputHtml As String = srRead.ReadToEnd
查看我的文章 StringParser [ ^ ]。
/ ravi
See my article StringParser[^].
/ravi
听起来像是在寻找 HTML Agility Pack [ ^ ]。
Sounds like you're looking for the HTML Agility Pack[^].
这篇关于如何将html标记内容转换为字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文