Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8790633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:42:31+00:00 2026-06-13T22:42:31+00:00

i am using a stream reader to get the HTML of some page, but

  • 0

i am using a stream reader to get the HTML of some page, but there are lines that i want to ignore, such as if a line starts with <span> 

any advice?
Here is my function

Public Function GetPageHTMLReaderNoPrx(ByVal address As Uri) As StreamReader
  Dim request As HttpWebRequest
  Dim response As HttpWebResponse = Nothing
  Dim reader As StreamReader

  Try
    request = DirectCast(WebRequest.Create(address), HttpWebRequest)
    response = DirectCast(request.GetResponse(), HttpWebResponse)

    Select Case CType(response, Net.HttpWebResponse).StatusCode
      Case 200
        reader = New StreamReader(response.GetResponseStream(), Encoding.Default)

      Case Else
        MsgBox(CType(response, Net.HttpWebResponse).StatusCode)
    End Select
  Catch
    If Not response Is Nothing Then response.Close()
  End Try
  Return reader
End Function

this is how the HTML looks like

<tr>Text
<span>show all</span>
</tr>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:42:32+00:00Added an answer on June 13, 2026 at 10:42 pm

    If you insist on using strings, you could do something like this:

    Do
      Dim line As String = reader.ReadLine()
      If line Is Nothing Then Exit Do 'end of stream
      If line.StarsWith("<span>") Then Exit Do 'ignore this line
      'otherwise do some processing here
      '...
    Loop
    

    But this approach is not stable – any minor change in the input HTML can break your flow.

    More elegant solution would be using XElement:

    Dim xml = <tr>Text
                <span>show all</span>
              </tr>
    xml.<span>.Remove()
    MsgBox(xml.Value.Trim)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got the following code that I'm using to get a html page. Make
I want to get HTML using the HTTPWEBREQUEST for the following page: http://inkdispatch.com/brother Currently
Usually I was doing something like that (just a example): using (Stream xmlStream =
I am reading a large data stream using lazy bytestrings, and want to know
i want to get HTML output in http://www.belmondo.si/turisticna-ponudba/pocitnice/kratkirezultati?cid=ID&cityid=DPS&izhid=&trajanjeid=&oskrbaid=&kategorijaid=&ooseb=2&otrok=0&lasten=1&prvic=1&rid=0-1&subtemplate=eksotika but i always get HTTPWEBRESPONSE The
I'm trying to get HTML code from a specific webpage, but when I do
I have some pages that I want to save the PRINT version of the
I am tying to get xslt2 transformation using XQSharp, but i get an exception
In getting some random spanish newspaper's index I don't get the diacriticals properly using
Consider the following scenario: http://www.restserver.com/example.php returns some content that I want to work with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.