PDA

View Full Version : Bug in Qt4.3.3 QXmlSimpleReader::reset() ?



Shawn
8th December 2007, 13:44
I first post a thread here: http://www.qtcentre.org/forum/f-qt-programming-2/t-xml-parsing-problem-using-sax2-7517.html

I just compiled Qt 4.3.3 open source edition with Visual C++ 2005 Express. I tried a small "hello world" example and it works fine.

But when I tried to compile my previous project using qt4.2.2 commercial with MSVS2005, I run into a problem exactly in the above thread.

Parser error at line 1, column 1: unexpected end of file.

I have used QXmlSimpleReader::reset() before the second parsing, seems it doesn't work.
Then I tried QFile::seek(0), it turns out fine.

pretty strange, it is a bug in qt4.3.3 ?:confused::confused::confused:

Shawn
27th February 2008, 22:29
Any body answer this question ?

jacek
27th February 2008, 22:50
Could that be another reincarnation of bug #166278 (http://trolltech.com/developer/task-tracker/index_html?method=entry&id=166278)?

Shawn
27th February 2008, 23:00
Could that be another reincarnation of bug #166278 (http://trolltech.com/developer/task-tracker/index_html?method=entry&id=166278)?

Yes I think so:(

jacek
27th February 2008, 23:44
Could you prepare a small compilable example that reproduces the problem?

Shawn
28th February 2008, 09:30
Could you prepare a small compilable example that reproduces the problem?

Attatched is a small example reproduces the problem ;)

part of it

QFile file("Resources/book.xml");
QXmlInputSource inputSource(&file);
QXmlSimpleReader reader;
Parser1 handler1;
reader.setContentHandler(&handler1);
reader.setErrorHandler(&handler1);
reader.parse(inputSource);

// QXMLSimpleReader::reset() dosen't work
//inputSource.reset();

//while QFile::seek(0) works
file.seek(0);

Parser2 handler2;
reader.setContentHandler(&handler2);
reader.setErrorHandler(&handler2);
reader.parse(inputSource);

jacek
28th February 2008, 14:18
I've just tested it and indeed it doesn't work on Qt 4.3.3. Please send that to the Trolls (qt-bugs @ ... ), so that they can fix it (I would just add a small comment that working version doesn't output anything and the broken one displays a message box).

Shawn
28th February 2008, 14:23
I've just tested it and indeed it doesn't work on Qt 4.3.3. Please send that to the Trolls (qt-bugs @ ... ), so that they can fix it (I would just add a small comment that working version doesn't output anything and the broken one displays a message box).

Thank you. Do you think the example is clear enough to confirm that it is a bug?

jacek
28th February 2008, 14:43
Do you think the example is clear enough to confirm that it is a bug?
Well... you could minimize it a bit further.

I've just made a simple test and changed main.cpp like this:

{ // <--- added {
Parser1 handler1;
reader.setContentHandler(&handler1);
reader.setErrorHandler(&handler1);
reader.parse(inputSource);
} // <--- added }

and the problem still occurs.

reset() looks like this:
void QXmlInputSource::reset()
{
d->nextReturnedEndOfData = false;
d->pos = 0;
}
so obviosly it doesn't touch the file.

Shawn
3rd March 2008, 09:14
Sorry for late but I just found some time ...
I've report it as a bug to Trolltech.:)