I have "Premateure end of document" error in at line 1 column 0 of my file, when try to validate it with XSD schema. I've tried to validate it in different software and online validators and they told me, that everything correct. So I decide, that file wasn't read correct, but it can't be cos I use it after validation. So maybe scheme wasn't reade correct? Please help me to find error.

it's part of constructor:
Qt Code:
  1. QFile tmlFile("..\\tml.xsd");
  2. if (!tmlFile.open(QIODevice::ReadOnly))
  3. {
  4. Message::sendMessage(ERROR, "Can't find validation scheme!", "check if it's on it's place", true);
  5. return;
  6. }
  7. mTmlSchema = new QXmlSchema();
  8. if (!mTmlSchema->load(&tmlFile))
  9. {
  10. tmlFile.close();
  11. Message::sendMessage(ERROR, "Validation scheme is'n valid", "use some software like Liquid XML studio to validate scheme and fix errors", true);
  12. return;
  13. }
  14.  
  15. ScanForObjects();
  16. ScanForLevels();
  17.  
  18. tmlFile.close();
To copy to clipboard, switch view to plain text mode 

ScanForObjects method code:
Qt Code:
  1. void
  2. XmlLoader::ScanForObjects()
  3. {
  4. ScanXMLForObjects("..\\Resources\\Objects.xml", &mMapsMap[GLOBAL]);
  5. ScanXMLForObjects("..\\Resources\\LogicalObjects.xml", &mMapsMap[LOGICAL]);
  6. ScanXMLForObjects("..\\Resources\\PhysicalObjects.xml", &mMapsMap[PHYSICAL]);
  7. ScanXMLForObjects("..\\Resources\\GraphicalObjects.xml", &mMapsMap[GRAPHICAL]);
  8. }
To copy to clipboard, switch view to plain text mode 

ScanXMLForObjects method code where bool isValid return false:
Qt Code:
  1. void
  2. XmlLoader::ScanXMLForObjects(QString filename, elementsMap* mapToFill)
  3. {
  4. QXmlSchemaValidator objectsTmlValidator(*mTmlSchema);
  5. objectsTmlValidator.setMessageHandler(this);
  6.  
  7. QDomDocument objectsDocument("Objects");
  8. QFile objectsFile(filename);
  9. if (!objectsFile.open(QIODevice::ReadWrite))
  10. {
  11. return;
  12. }
  13. if (!objectsDocument.setContent(&objectsFile))
  14. {
  15. objectsFile.close();
  16. return;
  17. }
  18. bool isValid = objectsTmlValidator.validate(&objectsFile, QUrl::fromLocalFile(objectsFile.fileName()));
  19. objectsFile.close();
  20.  
  21. QDomElement currentObjectElement =
  22. objectsDocument.documentElement().firstChildElement().firstChildElement("Object");
  23. while (!currentObjectElement.isNull())
  24. {
  25. (*mapToFill)[currentObjectElement.attribute("name").toStdString()] = currentObjectElement;
  26. currentObjectElement = currentObjectElement.nextSiblingElement("Object");
  27. }
  28. }
To copy to clipboard, switch view to plain text mode