Good There is a following code:

QString tmpres; qDebug() << "----------"; qDebug() << xmlReader.name(); tmpres=xmlReader.readElementText(); qDebug() << "tmpres:"+tmpres; qDebug() << "readElementText:"+xmlReader.readElementText(); 

In the console displays:

 "sbss_new_me" "tmpres:30" "readElementText:" 

I do not understand where the value of xmlReader.readElementText () has gone, the line above was equal to 30 ??

    1 answer 1

    I do not understand where the value of xmlReader.readElementText () has gone, the line above was equal to 30 ??

    It seems that the readElementText function read the current element, returned it, and passed to the next one. Or already finished the document and there is nothing to read.

    Check the reader for xmlReader.atEnd () . You can also check the current token via xmlReader.tokenType () or xmlReader.tokenString () to understand when the parser has finished.