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. Visual Basic
  4. how to compare the text of two html pages

how to compare the text of two html pages

Scheduled Pinned Locked Moved Visual Basic
htmltutorial
6 Posts 2 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.
  • M Offline
    M Offline
    Mohsen Saad
    wrote on last edited by
    #1

    Hi , I want to compare the text of two html pages and then highlight the changed text.Do you have any idea on how to do this

    C 1 Reply Last reply
    0
    • M Mohsen Saad

      Hi , I want to compare the text of two html pages and then highlight the changed text.Do you have any idea on how to do this

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Are the pages similar ? That is, do they have the same layout except for the text ? Perhaps you can just load one, then compare the two as strings, and do an insert where text is different to make a new composite document ? Is it XHTML ? If it is, then you can do it by comparing XML nodes, and building a new document that highlights in one colour for stuff only in the first document, and another for stuff only in the second. The XML way is definately cleaner, if it's possible. Christian Graus - Microsoft MVP - C++

      M 1 Reply Last reply
      0
      • C Christian Graus

        Are the pages similar ? That is, do they have the same layout except for the text ? Perhaps you can just load one, then compare the two as strings, and do an insert where text is different to make a new composite document ? Is it XHTML ? If it is, then you can do it by comparing XML nodes, and building a new document that highlights in one colour for stuff only in the first document, and another for stuff only in the second. The XML way is definately cleaner, if it's possible. Christian Graus - Microsoft MVP - C++

        M Offline
        M Offline
        Mohsen Saad
        wrote on last edited by
        #3

        actually I need to check a two versions of the same page but if I compared the two versions as text I will not get an accurate result for instance maybe a picture has been changed and even the font size might change I just want to highlight the changed text

        C 1 Reply Last reply
        0
        • M Mohsen Saad

          actually I need to check a two versions of the same page but if I compared the two versions as text I will not get an accurate result for instance maybe a picture has been changed and even the font size might change I just want to highlight the changed text

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Then, is it XHTML ? Can you make it XHTML ? XHTML is HTML that is valid XML, it means you could load it into an XML document and compare it as XML. Christian Graus - Microsoft MVP - C++

          M 1 Reply Last reply
          0
          • C Christian Graus

            Then, is it XHTML ? Can you make it XHTML ? XHTML is HTML that is valid XML, it means you could load it into an XML document and compare it as XML. Christian Graus - Microsoft MVP - C++

            M Offline
            M Offline
            Mohsen Saad
            wrote on last edited by
            #5

            Thank you for your response. actually the page is a regular html page .DO you have any suggestions on how to highlight the changed text only.

            C 1 Reply Last reply
            0
            • M Mohsen Saad

              Thank you for your response. actually the page is a regular html page .DO you have any suggestions on how to highlight the changed text only.

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              Mohsen Saad wrote: actually the page is a regular html page Can you convert it to XHTML ? All you need to do is make sure that the nodes match ( which they probably do ) and turn tags like <br&gr; into <br/&gr;. Otherwise, you're going to be parsing the nodes as well as the text. Christian Graus - Microsoft MVP - C++

              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