A little help here with QtNetwork
I'm writing a program that customers get tax information from a web portal., I give them a part of my code:
@void RIF::replyFinished(QNetworkReply *reply)
QByteArray data = reply->readAll();
qDebug() << str;
QNetworkAccessManager manager = new QNetworkAccessManager(this);
manager->get(QNetworkRequest(QUrl("http://somepage.com/getrif?rif=" + RIF::_rif())));
which I get the following information:
@"<?xml version="1.0" encoding="ISO-8859-1"?>
<rif:Rif xmlns:rif="rif" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" rif:numeroRif="V1X5XX60XX">rif:NombreCUSTOMER NAME</rif:Nombre>rif:AgenteRetencionIVANO</rif:AgenteRetencionIVA>rif:ContribuyenteIVASI</rif:ContribuyenteIVA>rif:Tasa75</rif:Tasa></rif:Rif>
This XML string only has two lines
How I can access a particular record, for example, rif:Nombre (this is the legal name of the client) or any records started like (rif:)?
Thanking your support and attention
Sorry for my bad english, I translate this with google translator :)
Hi and welcome to devnet,
You can use Qt's XML/ XML patterns modules to parse your data.
Be aware that you have a problem with your code here. Each time you call on_queryButton_clicked you create a new QNAM which is not needed. Just create it once as a member variable and re-use it to make your queries.