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.5k 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 21 Sept 2017, 12:26 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
    • J Offline
      J Offline
      JohanSolo
      wrote on 21 Sept 2017, 12:34 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 21 Sept 2017, 13:55
      0
      • J JohanSolo
        21 Sept 2017, 12:34

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

        A Offline
        A Offline
        aysenur
        wrote on 21 Sept 2017, 13:55 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.

        J 1 Reply Last reply 21 Sept 2017, 14:03
        0
        • A aysenur
          21 Sept 2017, 13:55

          @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.

          J Offline
          J Offline
          JohanSolo
          wrote on 21 Sept 2017, 14:03 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 27 Sept 2017, 08:07 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.

            J 1 Reply Last reply 27 Sept 2017, 09:21
            0
            • A aysenur
              27 Sept 2017, 08:07

              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.

              J Offline
              J Offline
              JonB
              wrote on 27 Sept 2017, 09:21 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

              1/6

              21 Sept 2017, 12:26

              • Login

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