MSXML SAX use from VIP 7.3 (7302)

Discussions related to Visual Prolog
Olivier HAAS
Posts: 11
Joined: 8 Jan 2003 0:01

MSXML SAX use from VIP 7.3 (7302)

Unread post by Olivier HAAS » 8 Aug 2010 5:23

Hi All,

I'm trying to use MSXML/SAX under VIP 7.3 and i get exception on the first step, that is :
Reader = the_SAXXMLReader::new(),

(I have followed the examples provided by Pepe Samos and read the several posts treating the subject.)

Thanks for help.
Kind Regards.

User avatar
Thomas Linder Puls
VIP Member
Posts: 2438
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 8 Aug 2010 9:47

Which exception?
Regards Thomas Linder Puls
PDC

Olivier HAAS
Posts: 11
Joined: 8 Jan 2003 0:01

Unread post by Olivier HAAS » 9 Aug 2010 0:33

Sorry ; here is the dump for the exception :

========================================
Dump: 2010/08/09 00:23:30
----------------------------------------
Exception: co_e_notinitialized_exception (com/visual-prolog/com/exceptionHandling/exceptionHandling_exception)

CoInitialize has not been called

HRESULT code = 2147746288
HRESULT hex code = 800401F0
hresultDescription = CoInitialize has not been called
Predicate name = createInstance
Component class identifier = {079AA557-4A18-424A-8EEE-E39F0A8D41B9}
Pointer to iUnknown interface = 00000000
List of class contexts = 5
Interface identifier = {8C033CAA-6CD6-4F73-B728-4531AF74945F}

raised() 2010/08/09 00:23:27
ThreadId=8276
ClassInfo: com/visual-prolog/com/comCreation $JustDate: 2009-02-27 $$Revision: 6 $


c:\\program files (x86)\\visual prolog 7.3\\pfc\\exception\\exception.pro(180)
C:\\_Installes\\o_GLOBAL_EXE_1\\VIP7Kernel.dll (0x14009864)
c:\\program files (x86)\\visual prolog 7.3\\pfc\\exception\\exception.pro(180)
c:\\program files (x86)\\visual prolog 7.3\\pfc\\com\\exceptionhandling\\comexceptioncheck.pro(415)
c:\\program files (x86)\\visual prolog 7.3\\pfc\\com\\exceptionhandling\\comexceptioncheck.pro(355)
c:\\program files (x86)\\visual prolog 7.3\\pfc\\com\\exceptionhandling\\comexceptioncheck.pro(344)
c:\\program files (x86)\\visual prolog 7.3\\pfc\\com\\exceptionhandling\\comexceptioncheck.pro(335)
c:\\program files (x86)\\visual prolog 7.3\\pfc\\com\\comsupport\\comcreation.pro(45)
c:\\program files (x86)\\visual prolog 7.3\\pfc\\windowsapi\\msxml_api\\msxml_sax_api\\import\\ivbsaxxmlreader_import.pro(23)
c:\\program files (x86)\\visual prolog 7.3\\pfc\\windowsapi\\msxml_api\\msxml_sax_api\\saxxmlreader.pro(18)
c:\\1_b\\cdevs\\vip_et2\\gc1\\v1_0_0\\gc1_frontal\\v1_0_0\\gc1_frontal\\gc1_frontal_portegenerique_1.pro(168)
...

That line 168 is the one that contains "Reader = the_SAXXMLReader::new(),"

In addition, perhaps is it important to notice that i run on a 64bit machine, under Windows Vista 64.

User avatar
Thomas Linder Puls
VIP Member
Posts: 2438
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 9 Aug 2010 7:57

You should change your goal to use mainExe::runCom to have the COM system initialized (i.e. have CoInitialize called).
Regards Thomas Linder Puls
PDC

Olivier HAAS
Posts: 11
Joined: 8 Jan 2003 0:01

Unread post by Olivier HAAS » 9 Aug 2010 10:43

Ok. Since i don't have .exe but only DLLs, i changed the goal to "DLL:initCom([])." and, so, it works now.
Thanks Thomas !

... but, well ..., i'm encountering another problem. Here is the dump :

========================================
Dump: 2010/08/09 12:14:44
----------------------------------------
Exception: regdb_e_classnotreg_exception (com/visual-prolog/com/exceptionHandling/exceptionHandling_exception)

Class not registered

HRESULT code = 2147746132
HRESULT hex code = 80040154
hresultDescription = Class not registered
Predicate name = createInstance
Component class identifier = {90D6CECE-9704-486C-B66E-F2302C243AB6}
Pointer to iUnknown interface = 00000000
List of class contexts = 5
Interface identifier = {1545CDFA-9E4E-4497-A8A4-2BF7D0112C44}

raised() 2010/08/09 12:14:34
ThreadId=7488
ClassInfo: com/visual-prolog/com/comCreation $JustDate: 2009-02-27 $$Revision: 6 $


c:\\program files (x86)\\visual prolog 7.3\\pfc\\exception\\exception.pro(180)
C:\\_Installes\\o_GLOBAL_EXE_1\\VIP7Kernel.dll (0x14009864)
c:\\program files (x86)\\visual prolog 7.3\\pfc\\exception\\exception.pro(180)
c:\\program files (x86)\\visual prolog 7.3\\pfc\\com\\exceptionhandling\\comexceptioncheck.pro(415)
c:\\program files (x86)\\visual prolog 7.3\\pfc\\com\\exceptionhandling\\comexceptioncheck.pro(355)
c:\\program files (x86)\\visual prolog 7.3\\pfc\\com\\exceptionhandling\\comexceptioncheck.pro(344)
c:\\program files (x86)\\visual prolog 7.3\\pfc\\com\\exceptionhandling\\comexceptioncheck.pro(335)
c:\\program files (x86)\\visual prolog 7.3\\pfc\\com\\comsupport\\comcreation.pro(45)
c:\\program files (x86)\\visual prolog 7.3\\pfc\\windowsapi\\msxml_api\\msxml_sax_api\\import\\isaxcontenthandler_import.pro(23)
c:\\1_b\\cdevs\\vip_et2\\gc1\\v1_0_0\\gc1_frontal\\v1_0_0\\gc1_frontal\\gc1_cu_analysexml_nvt__ciblesax.pro(20)
c:\\1_b\\cdevs\\vip_et2\\gc1\\v1_0_0\\gc1_frontal\\v1_0_0\\gc1_frontal\\gc1_frontal_portegenerique_1.pro(173)
...

gc1_frontal_portegenerique_1.pro(173) is "CibleSAX_Impl = gC1_CU_AnalyseXML_NVT__CibleSAX::new(),"
gc1_cu_analysexml_nvt__ciblesax.pro(20) is the constructor of gc1_cu_analysexml_nvt__ciblesax, which contains "iSAXContentHandler_import::newComponent(guid::create())".

I notice also that {1545CDFA-9E4E-4497-A8A4-2BF7D0112C44} is well present in the windows registry, well linked to IVBSAXContentHandler, which seems contradictory to the exception, ... and makes me confused ...

User avatar
Thomas Linder Puls
VIP Member
Posts: 2438
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 10 Aug 2010 14:55

Well you have completely misunderstood newComponent. To call this constructor you must supply the CLSID of an existing and registered component class that implements the relevant interface.

You create a completely new GUID (i.e. guid::create()) and use that. Microsoft promises that with a very high probabiliity such a GUID is unique in the entire universe. So would be a miracle if this GUID should actually be the CLSID of a component class that is registered on your machine.

I have never used the SAX reader, but I guess you should implement the content handler (or maybe get it from SAX writer which you want to echo to) so that you can obtain/handle the content of the thing you read.
Regards Thomas Linder Puls
PDC

Olivier HAAS
Posts: 11
Joined: 8 Jan 2003 0:01

Unread post by Olivier HAAS » 11 Aug 2010 4:13

Ok, i confess that i come from the Java world and have a very small experience of MS dev, but the example provided by Pepe Samos for SAX (http://discuss.visual-prolog.com/viewto ... hlight=sax) seemed to me very logical, natural and obvious.

In VIP 7.3, the PFC msXML_SAX_api package has changed (no more *_export interfaces and implementations) and i cannot figure out how that package works and has to be used.

User avatar
Thomas Linder Puls
VIP Member
Posts: 2438
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 11 Aug 2010 8:15

Pepe Samos clearly uses his own content handler (i.e. myContentHandlerImpl).

So it was wrong of us to exclude the export directory from the SAX part. I have attached it here, so you can add it to your installation.
Attachments
export.zip
SAX export
(43.3 KiB) Downloaded 220 times
Regards Thomas Linder Puls
PDC

Olivier HAAS
Posts: 11
Joined: 8 Jan 2003 0:01

Unread post by Olivier HAAS » 11 Aug 2010 9:12

Ok Thomas, it works, but the fifth line of the Pepe Samos code has to become :

Code: Select all

            TheReader:putContentHandler(iSAXContentHandler_import::new(Handler)),
since iSAXContentHandler_export is not a subclass of iSAXContentHandler_import anymore.

With that modification, it works well. Thanks.

Olivier HAAS
Posts: 11
Joined: 8 Jan 2003 0:01

Unread post by Olivier HAAS » 14 Aug 2010 11:21

Well, yes, it works, but how slow it is !!!
Around 110 ms to parse less than 500 Elements on a 64bit quad core machine and without any code in the ContentHandler methods ...

For me, it is unusable with these performances.

Is there anybody who experienced better results ?

Gildas Menier
VIP Member
Posts: 78
Joined: 8 Jun 2004 23:01

Unread post by Gildas Menier » 15 Aug 2010 11:27

Hi Olivier,

I use libxml2 with Visual Prolog and I am pretty satisfied with the perf. It provides a sax-like interface (and many goodies such as code page encoding, HTMl parsing etc.), you may want to give it a try.

Best Regards

Gildas

Post Reply