[SOLVED] QTextStream problem !
- 
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. 
- 
Hi, A shot in the dark but, since the validator must read the file in order to do the validation, the current file position might be at the end. Try to add @file.seek(0);@ before creating the QTextStream. Also since you are reading all the file anyway, why not read it all in a QByteArray, then validate that array ? 
