[Qt-interest] "Premature end of document" error while reading xml file

Rohan McGovern rohan.mcgovern at nokia.com
Tue Aug 11 04:54:00 CEST 2009


On Tuesday 11 August 2009, ext Xinyi Li wrote:
> Dear list
>
> I'm new to XML
>
> I'm just running some sample code to read a xml file but got the
> "Premature end of document " error and I don't know why
>

> And here's my Code:
>
>

>
> QFile file("node.xml");
>
> QXmlStreamReader reader(&file);
>
>
> while( !reader.atEnd() ) {

You must open the file (and check for errors) before trying to read 
from it.

-- 
Rohan McGovern
Qt Development Frameworks QA, Nokia
http://qt.nokia.com/



More information about the Qt-interest-old mailing list