Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. Html Parsing with QtWebEngine
Forum Updated to NodeBB v4.3 + New Features

Html Parsing with QtWebEngine

Scheduled Pinned Locked Moved Unsolved QtWebEngine
6 Posts 3 Posters 3.6k 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.
  • A Offline
    A Offline
    aysenur
    wrote on last edited by
    #1

    Hello,
    I want to parse html of a web site and use necessary parts of it in my qt application. In VS.net there is Html Agility Pack nuget package for parsing the code. Is there any equivalent library in Qt?
    Thank you.

    1 Reply Last reply
    0
    • JohanSoloJ Offline
      JohanSoloJ Offline
      JohanSolo
      wrote on last edited by
      #2

      If the site use XHTML you can use the XML classes to achieve what you want.

      `They did not know it was impossible, so they did it.'
      -- Mark Twain

      A 1 Reply Last reply
      0
      • JohanSoloJ JohanSolo

        If the site use XHTML you can use the XML classes to achieve what you want.

        A Offline
        A Offline
        aysenur
        wrote on last edited by
        #3

        @JohanSolo thank you for your answer. The document type of the web site is HTML. There is a library QXMLStreamReader to read XML files but I think this is not the library I need.

        JohanSoloJ 1 Reply Last reply
        0
        • A aysenur

          @JohanSolo thank you for your answer. The document type of the web site is HTML. There is a library QXMLStreamReader to read XML files but I think this is not the library I need.

          JohanSoloJ Offline
          JohanSoloJ Offline
          JohanSolo
          wrote on last edited by
          #4

          @aysenur Sorry but for non XHTML I have no idea. Maybe in the QtWebEngine module you can find something...

          `They did not know it was impossible, so they did it.'
          -- Mark Twain

          1 Reply Last reply
          0
          • A Offline
            A Offline
            aysenur
            wrote on last edited by
            #5

            Hello,
            QNetworkAccessManager, QNetworkRequest, QNetworkReply libraries can be used for getting the content of a web page as I have seen from the web. By the help of them I could get the source of the web page into a QString object. But I want to get the button of a web page into my application. (May be this can be similar to parse the title of a web page from the source and show it on the app) How can I parse the source according to tag names? Thank you in advance.

            JonBJ 1 Reply Last reply
            0
            • A aysenur

              Hello,
              QNetworkAccessManager, QNetworkRequest, QNetworkReply libraries can be used for getting the content of a web page as I have seen from the web. By the help of them I could get the source of the web page into a QString object. But I want to get the button of a web page into my application. (May be this can be similar to parse the title of a web page from the source and show it on the app) How can I parse the source according to tag names? Thank you in advance.

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @aysenur
              Parsing HTML (not XHTML) is notoriously difficult. There is not a built-in Qt offering.

              However, see the discussion and posted answer at https://forum.qt.io/topic/74485/is-there-a-clear-way-to-parse-html-in-qt-5-7/14. It appears there is a QGumboParser (https://github.com/lagner/QGumboParser) which someone is reporting success with under Qt.

              Otherwise, you'll have to see whether your particular use case can be addressed to your limited satisfaction via Regular Expression parsing from Qt.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved