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. Web Development
  3. ASP.NET
  4. Read data from html file

Read data from html file

Scheduled Pinned Locked Moved ASP.NET
htmlhelptutorialquestion
5 Posts 3 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.
  • S Offline
    S Offline
    Satish Developer
    wrote on last edited by
    #1

    Hi, i want to read data from the source file of 3rd party website. The page is not in my control. Here i need to do two things. a. I just read the html content of that page in to string first b. and later i want to retrive some specific data from that string. the first option is ok. The second option i am not getting how to retive the data.

    <tr>
    <th>First Name</th>
    <td width="100%"><input name="p_first_name" type="text" id="f-first-name" value="JEAN" /></td>
    </tr>
    <tr class="tr-back">
    <th class="tr-back">Last Name</th>
    <td><input name="p_last_name" type="text" id="f-last-name" value="AAREN" /></td>
    </tr>
    <tr>
    <th>Occupation</th>
    <td width="100%"><input name="o_occ" type="text" id="f-occ" value="UNKNOWN" /></td>
    </tr>

    In the above code i want to retrive the values first name, middle name and lastname. i.e JEAN, AAREN, UNKNOWN Can any one help me how to retrive this code once reading all this html in to string..? or any other way

    N A 2 Replies Last reply
    0
    • S Satish Developer

      Hi, i want to read data from the source file of 3rd party website. The page is not in my control. Here i need to do two things. a. I just read the html content of that page in to string first b. and later i want to retrive some specific data from that string. the first option is ok. The second option i am not getting how to retive the data.

      <tr>
      <th>First Name</th>
      <td width="100%"><input name="p_first_name" type="text" id="f-first-name" value="JEAN" /></td>
      </tr>
      <tr class="tr-back">
      <th class="tr-back">Last Name</th>
      <td><input name="p_last_name" type="text" id="f-last-name" value="AAREN" /></td>
      </tr>
      <tr>
      <th>Occupation</th>
      <td width="100%"><input name="o_occ" type="text" id="f-occ" value="UNKNOWN" /></td>
      </tr>

      In the above code i want to retrive the values first name, middle name and lastname. i.e JEAN, AAREN, UNKNOWN Can any one help me how to retrive this code once reading all this html in to string..? or any other way

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      If you are sure that the resultant string is in valid XML format, just load it to XmlDocument and use XPath to get the required values. Other option is to use regular expression and look for the text.

      Best wishes, Navaneeth

      S 1 Reply Last reply
      0
      • N N a v a n e e t h

        If you are sure that the resultant string is in valid XML format, just load it to XmlDocument and use XPath to get the required values. Other option is to use regular expression and look for the text.

        Best wishes, Navaneeth

        S Offline
        S Offline
        Satish Developer
        wrote on last edited by
        #3

        how to load that string in to xmldocument?

        G. Satish

        N 1 Reply Last reply
        0
        • S Satish Developer

          how to load that string in to xmldocument?

          G. Satish

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          Work with XmlDocument.LoadXml(string xml)[^] overload.

          Best wishes, Navaneeth

          1 Reply Last reply
          0
          • S Satish Developer

            Hi, i want to read data from the source file of 3rd party website. The page is not in my control. Here i need to do two things. a. I just read the html content of that page in to string first b. and later i want to retrive some specific data from that string. the first option is ok. The second option i am not getting how to retive the data.

            <tr>
            <th>First Name</th>
            <td width="100%"><input name="p_first_name" type="text" id="f-first-name" value="JEAN" /></td>
            </tr>
            <tr class="tr-back">
            <th class="tr-back">Last Name</th>
            <td><input name="p_last_name" type="text" id="f-last-name" value="AAREN" /></td>
            </tr>
            <tr>
            <th>Occupation</th>
            <td width="100%"><input name="o_occ" type="text" id="f-occ" value="UNKNOWN" /></td>
            </tr>

            In the above code i want to retrive the values first name, middle name and lastname. i.e JEAN, AAREN, UNKNOWN Can any one help me how to retrive this code once reading all this html in to string..? or any other way

            A Offline
            A Offline
            Abhishek Sur
            wrote on last edited by
            #5

            If you place a wrapper to all the tr's it will load easily in XMLDocument / XDocument. Just take the table tag which wrap around all the entries. Use XElement.Load(your html string) to get the xml loaded. Now search the elements using Linq to XML. Cheers...

            Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


            My Latest Articles-->** Simplify Code Using NDepend
            Basics of Bing Search API using .NET
            Microsoft Bing MAP using Javascript

            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