Results 1 to 2 of 2

Thread: how to retrieve data from a html file using QWebView QT

  1. #1
    Join Date
    Mar 2015
    Qt products

    Unhappy how to retrieve data from a html file using QWebView QT

    Hello guys ,

    i am a beginner in QT (C++), i need to retrieve data from a html page and send it in a sql database . The data i am talking about is between html tags (in red) as shown below . I know how to send data in a database but i don't know how to retrieve the data from this in C++ , please help me as this is only a small part of the whole html page from which i am supposed to retrieve data . I really need a help and knowing you all are pro in C++ Qt i know you will be able to help me .

    Before posting this "help me" message i searched on the net and found some kind of similar cases as mine but as i am new i didn't understand the replies and didn't know how to adapt them wih my situation, please help i really need to do this as it is a school project.

    <div id="cross_rates_container" style="clear:both"><table id="cross_rate_1" border=0 class="ftq_4 ftq_5_1" style="width:497px;margin:0px;padding:0px;" cellspacing=0 cellpadding=0 id="curr_table"><tr class="arial_11_white_b ftq_5"><td class="ftqw2 ftqh ftqa11wb ftqac" nowrap><nobr>Nom</nobr></td><td class="ftqw2 ftqh ftqa11wb ftqac" nowrap>Achat</td><td class="ftqw2 ftqh ftqa11wb ftqac" nowrap>Vente</td><td class="ftqw2 ftqh ftqa11wb ftqac" nowrap>Cours</td><td class="ftqw2 ftqh ftqa11wb ftqac" nowrap>Ouverture</td><td class="ftqw2 ftqh ftqa11wb ftqac" nowrap>+ Haut</td><td class="ftqw2 ftqh ftqa11wb ftqac" nowrap>+ Bas</td><td class="ftqw2 ftqh ftqa11wb ftqac" nowrap>Var %</td></tr><tr id="pair_1" class="arial_11 ftqtr1" style="background-color:#F6F6F6;"><td class="ftqbb ftqw1 ftqrl" nowrap="nowrap"><nobr><span class="vertical arrow_red_down" title="_cross_rates_last_tick" style="margin-right:5px;">&nbsp;</span><span class="ftqa11bb arial_11_b">USD/JPY</span></td></nobr><td class="ftqbb ftqw2 pid-3-bid" style="direction:ltr;">119,13</td><td class="ftqbb ftqw2 pid-3-ask" style="direction:ltr;">119,15</td><td class="ftqbb ftqw2 pid-3-last" style="direction:ltr;">119,14</td><td class="ftqbb ftqw2" style="direction:ltr;">119,19</td><td class="ftqbb ftqw2 pid-3-high" style="direction:ltr;">119,50</td><td class="ftqbb ftqw2 pid-3-low" style="direction:ltr;">118,94</td>

  2. #2
    Join Date
    Mar 2009
    Brisbane, Australia
    Thanked 1,595 Times in 1,523 Posts
    Qt products
    Qt4 Qt5
    Unix/X11 Windows
    Wiki edits

    Default Re: how to retrieve data from a html file using QWebView QT

    In short, you:
    • Load the web page in QWebView or QWebPage,
    • Indentify the mainFrame() of the page, and
    • Use QWebFrame::findFirstElement() or QWebFrame::findAllElements() to identify the parts of the document you need, or
    • Get the documentElement() and use the functions of QWebElement to navigate the document.
    "We can't solve problems by using the same kind of thinking we used when we created them." -- Einstein
    If you are posting code then please use [code] [/code] tags around it - makes addressing the problem easier.

Similar Threads

  1. QWebView - How to get DOM HTML
    By lhg in forum Qt Programming
    Replies: 3
    Last Post: 23rd October 2011, 20:16
  2. problem while retrieve data from XML
    By asma_ramadan in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 26th July 2011, 12:30
  3. Display of HTML file in qt webkit using qwebview
    By darpan in forum Qt Programming
    Replies: 0
    Last Post: 16th February 2011, 10:35
  4. How to save a Qwebview as an html file
    By richardander in forum Qt Programming
    Replies: 2
    Last Post: 5th June 2009, 01:07
  5. Sql Server cannot retrieve data from select
    By Atomino in forum Qt Programming
    Replies: 10
    Last Post: 7th September 2006, 17:37

Tags for this Thread


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.