Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to Convert HtmlData to String

How to Convert HtmlData to String

Scheduled Pinned Locked Moved C#
csharphtmlhelptutorial
9 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VenkataRamana Gali
    wrote on last edited by
    #1

    Hello all, I am using C# 2.0, in my winApp. I am getting the HTML Data. I need this in string format. I don't want to use browser control. how to achieve this. anybody any sounds plz help me regards GV Ramana

    J R 2 Replies Last reply
    0
    • V VenkataRamana Gali

      Hello all, I am using C# 2.0, in my winApp. I am getting the HTML Data. I need this in string format. I don't want to use browser control. how to achieve this. anybody any sounds plz help me regards GV Ramana

      J Offline
      J Offline
      Judah Gabriel Himango
      wrote on last edited by
      #2

      How are you receiving the HTML data? If it's a stream, you can convert that to a string using some of the encoder classes in System.Text namespace.

      Tech, life, family, faith: Give me a visit. I'm currently blogging about: Is Jesus the Jewish Messiah? The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

      V 1 Reply Last reply
      0
      • J Judah Gabriel Himango

        How are you receiving the HTML data? If it's a stream, you can convert that to a string using some of the encoder classes in System.Text namespace.

        Tech, life, family, faith: Give me a visit. I'm currently blogging about: Is Jesus the Jewish Messiah? The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

        V Offline
        V Offline
        VenkataRamana Gali
        wrote on last edited by
        #3

        thx for reply my application is mail reading appliclation, so mails will come in the form of html. this html i want to convert to normal data(string) how to do this regards GV Ramana

        J T 2 Replies Last reply
        0
        • V VenkataRamana Gali

          thx for reply my application is mail reading appliclation, so mails will come in the form of html. this html i want to convert to normal data(string) how to do this regards GV Ramana

          J Offline
          J Offline
          Judah Gabriel Himango
          wrote on last edited by
          #4

          The question is, how is the HTML data formatted? What type is the HTML data, in your .NET code? If it's binary, you'll need to convert it from byte[] to string using System.Text.Decoder and its derivatives.

          Tech, life, family, faith: Give me a visit. I'm currently blogging about: Is Jesus the Jewish Messiah? The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

          1 Reply Last reply
          0
          • V VenkataRamana Gali

            Hello all, I am using C# 2.0, in my winApp. I am getting the HTML Data. I need this in string format. I don't want to use browser control. how to achieve this. anybody any sounds plz help me regards GV Ramana

            R Offline
            R Offline
            Ravi Bhavnani
            wrote on last edited by
            #5

            StringParser.removeHtml()[^] is your friend. :) /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com

            V 1 Reply Last reply
            0
            • V VenkataRamana Gali

              thx for reply my application is mail reading appliclation, so mails will come in the form of html. this html i want to convert to normal data(string) how to do this regards GV Ramana

              T Offline
              T Offline
              Tom Larsen
              wrote on last edited by
              #6

              Your problem is you are interpting the "normal data" to mean "string" which if it is in the form of Html *is not* string at all. After all, this page is all Html and it has far more stuff than just "string". So what is it that you are really after? If you just want to do raw text processing you might want to look at WebRequest/WebResponse instead.

              1 Reply Last reply
              0
              • R Ravi Bhavnani

                StringParser.removeHtml()[^] is your friend. :) /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com

                V Offline
                V Offline
                VenkataRamana Gali
                wrote on last edited by
                #7

                Hi, StringParser is very good. but there is no constant html data. html data will comes differently. how to convet this. regards GV Ramana

                R 1 Reply Last reply
                0
                • V VenkataRamana Gali

                  Hi, StringParser is very good. but there is no constant html data. html data will comes differently. how to convet this. regards GV Ramana

                  R Offline
                  R Offline
                  Ravi Bhavnani
                  wrote on last edited by
                  #8

                  I don't understand the sentence "there is no constant html data. html data will comes differently". But if you want an HTML-free version of a string that contains HTML, do this:

                  string strWithHtml = "...";
                  string strWithoutHtml = StringParser.removeHtml (strWithHtml);

                  /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com

                  V 1 Reply Last reply
                  0
                  • R Ravi Bhavnani

                    I don't understand the sentence "there is no constant html data. html data will comes differently". But if you want an HTML-free version of a string that contains HTML, do this:

                    string strWithHtml = "...";
                    string strWithoutHtml = StringParser.removeHtml (strWithHtml);

                    /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com

                    V Offline
                    V Offline
                    VenkataRamana Gali
                    wrote on last edited by
                    #9

                    sounds good. ravi, really ur parser is very good. plz send me links of other articles by you. regards GV Ramana

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups