QDomDocument or QXmlStreamReader
I've got an XML response, and I'm wondering which method is best to use to obtain the required information I need. I want to run through the XML, looking for specific elements and checking the text within.
Current code:
Code:
QXmlStreamReader sr(response);
while (!sr.atEnd())
{
sr.readNext();
if(sr.name() == "FeedSubmissionId")
{
QByteArray FeedSubmissionID
= sr.
readElementText().
toUtf8();
GetFeedSubmissionList(FeedSubmissionID);
}
}
if (sr.hasError())
{
qDebug() << err;
}
Any advice would be much appreciated.
Regards,
Richard
Re: QDomDocument or QXmlStreamReader
If you are only interested in certain parts then I'd say QXmlStreamReader.
It lets you skip whatever you are not interested in.
QDomDocument needs to parse the whole XML document into an internal memory tree.
Cheers,
_
Re: QDomDocument or QXmlStreamReader