PDA

View Full Version : problem in xml parsing



Shawn
27th May 2007, 14:56
code like this:


Paser::Paser(QObject *parent)
: QXmlDefaultHandler()


QXmlInputSource inputSource(&file);
QXmlSimpleReader reader;
Paser *handler;
reader.setContentHandler(handler);
reader.setErrorHandler(handler);
bool xx;
xx = reader.parse(inputSource);

I trace the steps when debugging, seems that the program never enter the "paser.cpp" file, what does that mean?

jacek
27th May 2007, 17:46
Where do you initialize "handler"?

Shawn
28th May 2007, 02:30
what should I do to initialize it ?

wysota
28th May 2007, 08:38
Create an object and assign it to the pointer. Thus far you only have a piece of memory that can point to a "Paser" object, but not the object itself.

Shawn
28th May 2007, 12:11
thank you very much, wysota!
now it works!

thank you.