I have strange issue with Qt QXmlStreamReader. I'am trying to parse simple document (note: it is generated using QXmlStreamWriter):
<?xml version="1.0" encoding="UTF-8"?>
<tex>
    <used_by/>
    <facade>
        <tags>
            <town_related></town_related>
            <zone_related></zone_related>
            <visual_related></visual_related>
            <kind_related></kind_related>
            <other>flamingo</other>
        </tags>
        <additional_textures>
            <id>flamingo_top.psd</id>
        </additional_textures>
    </facade>
</tex>
Using this code:
QFile file(filename);
if (file.open(QFile::ReadOnly | QFile::Text))
{
    QXmlStreamReader xmlReader(&file);
    while (xmlReader.readNextStartElement())
    {
        /* same issue when uncommented: 
        if (xmlReader.name() == "tex")
            t->readXml(xmlReader);//parse texture
        else*/
            xmlReader.skipCurrentElement();
    }
    if (xmlReader.hasError())
        emit reportError(xmlReader.errorString());
}
...
And it always reports error "Premature end of document". Why? When debbuging, it seems, to all elements are parsed or skipped correctly.