data += ""; #include #include #include #include #include #include int main(int argc, char ** argv) { QCoreApplication app(argc,argv); QByteArray data; QBuffer buffer(&data); buffer.open(QIODevice::ReadOnly); QXmlInputSource source(&buffer); // Any none empty string will do the job. data += ""; QXmlSimpleReader reader; bool success = reader.parse(&source, true); if (!success) { qDebug() << "parsing failed!"; } else { qDebug() << "parsing successful."; } buffer.close(); return 0; }