Results 1 to 4 of 4

Thread: Extracting links from a web page.

  1. #1
    Join Date
    Aug 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Extracting links from a web page.

    I was trying to write a web enabled app using QtWebKit. I couldn't really get from the examples how I could extract link elements from a web page. A small code snippet will be very helpful.

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Extracting links from a web page.

    Get the HTML of your site and then use a QRegExp to extract the links. There are may examples for the regular expression for extracting links on the web.

  3. #3
    Join Date
    Aug 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Extracting links from a web page.

    Thank you for the reply. Is it not possible to use any of the QtWebkit classes to achieve this? In the examples included with Qt Assistant they exhibit dom extraction techniques. I just couldn't figure out how I could use those to search for links on a page based on the text contained between <a> & </a>

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Extracting links from a web page.

    You also can use QWebFrame::findAllElements(). there are many ways.

Similar Threads

  1. How can I support page up/page down on QTextEdit
    By wesley in forum Qt Programming
    Replies: 7
    Last Post: 14th September 2010, 19:18
  2. Replies: 1
    Last Post: 11th November 2009, 16:43
  3. how can get all links with QT from a web page?
    By ChineseAlexander in forum Qt Programming
    Replies: 4
    Last Post: 17th April 2009, 06:41
  4. QTabWidget remove a page at the page's request
    By thomaspu in forum Qt Programming
    Replies: 2
    Last Post: 29th December 2007, 20:45
  5. Extracting current rotation
    By Gopala Krishna in forum Qt Programming
    Replies: 5
    Last Post: 13th May 2007, 11:29

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.