PDA

View Full Version : How to parse xml from a http xml response?



dineshkumar
28th January 2011, 05:49
Hi all, i want a good example which parses the http xml response and display them?
Please help me!

Thankyou

Lykurg
28th January 2011, 06:42
E.g. use QNetworkAccessManager to download the file and then use QDomDocument. Example code can be found in the detailed descriptions.

dineshkumar
28th January 2011, 07:05
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:

void Sample::parseXml(QNetworkReply *reply)
{
qDebug()<<reply->readAll();
QDomDocument* doc = new QDomDocument();
if(doc->setContent(reply)){
QDomElement docElem =doc->documentElement();
QDomNode n = docElem.firstChild();
while(!n.isNull()) {
QDomElement e = n.toElement(); // try to convert the node to an element.
if(!e.isNull()) {
qDebug() << qPrintable(e.tagName())<< endl;// the node really is an element.
}
n = n.nextSibling();
}
}
}
Please help me.

asmncl
16th February 2011, 07:28
Hi,

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