elcuco
26th May 2010, 19:01
In the aplication I am writing, I get a TCP socket connected to a remote serverm and trough that socket the remote site sends me a series of XML.
I used a piece of code similar to this:
void readData( QTcpSocket *socket )
{
QXmlStreamReader (socket);
xml.readNextStartElement();
xml.readNextStartElement();
QString s = xml.name().toString();
if (s.toLower() != "root_element"){
return;
}
while (xml.readNextStartElement()) {
s = xml.name().toString();
/// more code
}
}
The problem is that the first XML gets read perfectly, the second XML sent is just get borked: with the remote server I get the 2nd XML borked (I trubcated XML tags). When I cat several XMLs trough "nc localhost 4444", the second XML does not even get to the application.
Can anyone help me?
I used a piece of code similar to this:
void readData( QTcpSocket *socket )
{
QXmlStreamReader (socket);
xml.readNextStartElement();
xml.readNextStartElement();
QString s = xml.name().toString();
if (s.toLower() != "root_element"){
return;
}
while (xml.readNextStartElement()) {
s = xml.name().toString();
/// more code
}
}
The problem is that the first XML gets read perfectly, the second XML sent is just get borked: with the remote server I get the 2nd XML borked (I trubcated XML tags). When I cat several XMLs trough "nc localhost 4444", the second XML does not even get to the application.
Can anyone help me?