Quantcast
Channel: Installation and Deployment
Viewing all articles
Browse latest Browse all 22112

QTextStream problem !

$
0
0
hi, I am using this piece of code to validate an XML file against an XML scheam. Once the XML file is valide, I use QTextStream to read the file content as QString then display it on the terminal :  // open file  QFile file(filename);  if(!file.open(QIODevice::ReadOnly | QIODevice::Text))   {      qDebug() << "Cannot open file ";      return;   }    // validate file against XML schema  QXmlSchemaValidator validator(schema);    if(!validator.validate(&file, QUrl::fromLocalFile(file.fileName())))   {     file.close();     qDebug() << "instance document is invalid";     return;   }      //display    QTextStream textstream(&file);    QString xmlContent = textstream.readAll();    qDebug()<<xmlContent;    file.close(); But, the qDebug() function display an empty string (“”) ! Any idea ? thanks in advance.

Viewing all articles
Browse latest Browse all 22112

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>