MSXML implementing ISAXContentHandler, what on earth am I missing??
-
I've read the docs and a few online examples of how to implement the ISAXContentHandler interface. Simple enough. In my "stdafx.h" file, I make sure to add the following two lines. import using namespace MSXML2; Cool, I then created a class derived from ISAXContentHandler, call it ContentHandlerBase. I implemnted each of the ISAXContentHandler methods such that they all return S_OK. Then, I created a class that derived from ContentHandlerBase, call it ContentHandlerImpl. In this class I only implemented one method, say ISAXContentHandler::startElement for example. As soon as I tried to instantiate this class via ContentHandlerImpl* chi = new ContentHandlerImpl(), I got "Cannot Instantiate Abstract Class" along with a whole bunch of ... HRESULT MSXML2::ISAXContentHandler::raw_ignorableWhitespace(unsigned short *,int)' : pure virtual function was not defined for example, for each of the ISAXContentHandler methods even though they HAVE been implemented in the base class. I don't get, it. I downloaded an online sample and it compiled fine. Laboriously poring over the differences between my code and the sample code has proved fruitless as I can't see anything I did wrong :-( Anybody have any clues as to what might be the problem? Thanks. Senkwe Woke up this morning...and got myself a blog
-
I've read the docs and a few online examples of how to implement the ISAXContentHandler interface. Simple enough. In my "stdafx.h" file, I make sure to add the following two lines. import using namespace MSXML2; Cool, I then created a class derived from ISAXContentHandler, call it ContentHandlerBase. I implemnted each of the ISAXContentHandler methods such that they all return S_OK. Then, I created a class that derived from ContentHandlerBase, call it ContentHandlerImpl. In this class I only implemented one method, say ISAXContentHandler::startElement for example. As soon as I tried to instantiate this class via ContentHandlerImpl* chi = new ContentHandlerImpl(), I got "Cannot Instantiate Abstract Class" along with a whole bunch of ... HRESULT MSXML2::ISAXContentHandler::raw_ignorableWhitespace(unsigned short *,int)' : pure virtual function was not defined for example, for each of the ISAXContentHandler methods even though they HAVE been implemented in the base class. I don't get, it. I downloaded an online sample and it compiled fine. Laboriously poring over the differences between my code and the sample code has proved fruitless as I can't see anything I did wrong :-( Anybody have any clues as to what might be the problem? Thanks. Senkwe Woke up this morning...and got myself a blog
-
Try to use "raw_interfaces_only" attibute in import statement or rename methods in your implementation class ("raw_XXX"). Edward
Hi, thanksk alot for the response :-) Unfortunately, your suggestion doesn't seem to work. I've already tried including "raw_interfaces_only", didn't work I'm afraid. I've just now tried your "raw_XXX" suggestion and I still got the same compile error. Thanks again for the suggestions though :-) Woke up this morning...and got myself a blog
-
Hi, thanksk alot for the response :-) Unfortunately, your suggestion doesn't seem to work. I've already tried including "raw_interfaces_only", didn't work I'm afraid. I've just now tried your "raw_XXX" suggestion and I still got the same compile error. Thanks again for the suggestions though :-) Woke up this morning...and got myself a blog
-
That's strange. What's in *.tlh/*.tli files ? Your derived classes should match interfaces in the *.tlh files. Also try to remove all tlh and tli files and rebuild all. Edward
Hi Edward. Thanks for the reply again. I took a peek at the projects *.tlh file and my eyes glazed over so I deleted it and rebuilt all. Same thing happened. Looks like I'm going to have to dig into the file and look for anything odd. Thanks for your help :-) I'll post this problem to another newsgroup as I'm sure someone must have experienced this before. :-) Woke up this morning...and got myself a blog