【发布时间】:2010-09-10 22:39:23
【问题描述】:
我试图在没有换行符的网页上检索此文本:
<span class="listingTitle">888-I-AM-JUNK. Canada's most trusted BIG LOAD junk removal<br />specialist!</span></a>
我该怎么做?
这是我目前的代码,我使用的是 vb。
Dim content As String = ""
Dim doc As New HtmlAgilityPack.HtmlDocument()
doc.Load(WebBrowser1.DocumentStream)
Dim hnc As HtmlAgilityPack.HtmlNodeCollection = doc.DocumentNode.SelectNodes("//span[@class='listingTitle']")
For Each link As HtmlAgilityPack.HtmlNode In hnc
Dim replaceUnwanted As String = ""
replaceUnwanted = link.InnerText.Replace("&", "&") '
replaceUnwanted = replaceUnwanted.Replace("'", "'")
replaceUnwanted = replaceUnwanted.Replace("See full business details", "")
content &= replaceUnwanted & vbNewLine
Next
RichTextBox1.Text = content
Me.RichTextBox1.Lines = Me.RichTextBox1.Text.Split(New Char() {ControlChars.Lf}, _
StringSplitOptions.RemoveEmptyEntries)
我需要删除<br />
【问题讨论】: