Results 1 to 4 of 4

Thread: How to parse xml from a http xml response?

  1. #1
    Join Date
    Jan 2011
    Location
    Nagercoil,Tamilnadu,India
    Posts
    12
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default How to parse xml from a http xml response?

    Hi all, i want a good example which parses the http xml response and display them?
    Please help me!

    Thankyou

  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: How to parse xml from a http xml response?

    E.g. use QNetworkAccessManager to download the file and then use QDomDocument. Example code can be found in the detailed descriptions.

  3. #3
    Join Date
    Jan 2011
    Location
    Nagercoil,Tamilnadu,India
    Posts
    12
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to parse xml from a http xml response?

    Hi, After reply from the network access manager i have to do the following but it doesn't show the response content. Is any problem with my code.

    This is my Qt code:
    Qt Code:
    1. void Sample::parseXml(QNetworkReply *reply)
    2. {
    3. qDebug()<<reply->readAll();
    4. QDomDocument* doc = new QDomDocument();
    5. if(doc->setContent(reply)){
    6. QDomElement docElem =doc->documentElement();
    7. QDomNode n = docElem.firstChild();
    8. while(!n.isNull()) {
    9. QDomElement e = n.toElement(); // try to convert the node to an element.
    10. if(!e.isNull()) {
    11. qDebug() << qPrintable(e.tagName())<< endl;// the node really is an element.
    12. }
    13. n = n.nextSibling();
    14. }
    15. }
    16. }
    To copy to clipboard, switch view to plain text mode 
    Please help me.
    Last edited by dineshkumar; 28th January 2011 at 08:19.
    M Dineshkumar,
    Project Trainee,
    Cape Consultancy Services
    (http://www.capeconsultancy.com)
    India.

  4. #4
    Join Date
    Dec 2010
    Posts
    6
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60

    Default Re: How to parse xml from a http xml response?

    Hi,

    If you get any solution plz help me and more.
    the same problem im facing

Similar Threads

  1. Reqest and Response in XML
    By srohit24 in forum Qt Programming
    Replies: 28
    Last Post: 4th July 2009, 07:57
  2. parse xml
    By rmagro in forum Qt Programming
    Replies: 2
    Last Post: 2nd July 2009, 22:27
  3. QHTTP does not see tunneled TCP HTTP OK authentication response
    By SailingDreams in forum Qt Programming
    Replies: 6
    Last Post: 23rd May 2009, 09:39
  4. XML parse
    By arunredi in forum Newbie
    Replies: 2
    Last Post: 27th April 2008, 01:22
  5. Best way to parse a string
    By Lele in forum Qt Programming
    Replies: 3
    Last Post: 20th August 2007, 12:33

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.