[Bulk] Re: [xmlsec] ErrorsCallback ???

Edward Shallow ed.shallow at rogers.com
Thu Jan 5 20:39:12 PST 2006

PostScript ...

     A call to the following works fine after any libxml2 function throwing
an error. I tried it after a failed xmlsec function call and received
nothing (i.e. Python None aka NULL)


errMsg = self.checkLibxml2Error()


def checkLibxml2Error(self):
    libxml2 = self.env.libxml2
    errMsg = None
    errorPtr = libxml2.xmlGetLastError()
    if errorPtr != 0:
            error = xmlError.from_address(errorPtr)                     #
set up pointer to a libxml2 xmlError structure
            errMsg = 'level ' + str(error.level) + ' error in domain ' +
str(error.domain) + ' code ' + str(error.code) + error.message, ' at line '
+ str(error.line)
            errMsg = 'Fatal error in xmlGetLastError function'
    return errMsg


-----Original Message-----
From: Edward Shallow [mailto:ed.shallow at rogers.com] 
Sent: January 5, 2006 11:02 PM
To: 'Aleksey Sanin'
Subject: RE: [Bulk] Re: [xmlsec] ErrorsCallback ???

Re 2,  Yes that sounds good !!! I'll try the xmlGetLastError support for
xmlsec as well. I am already using it for libxml2 parsing errors.

Re 1, Yes I am using Python with the ctypes module to directly access
libxml2 and xmlsec. I can set the breakpoint on Linux but my problem is
mscrypto and on Windows I am using Igor's binaries. I have never compiled
under Windows, don't have the patience or the software.

I doubt there is a coding problem as everything is coming back for openssl
and sometimes is coming back for mscrypto (Verify calls)


-----Original Message-----
From: xmlsec-bounces at aleksey.com [mailto:xmlsec-bounces at aleksey.com] On
Behalf Of Aleksey Sanin
Sent: January 5, 2006 7:51 PM
To: ed.shallow at rogers.com
Cc: xmlsec at aleksey.com
Subject: [Bulk] Re: [xmlsec] ErrorsCallback ???

1) Are you using xmlsec directly or via python? If you have C/C++ app,
simply set a  breakpoint in the error callback and then trace it back to the
error origin. You'll see the exact place where NULL shows up.

2) The default callback sets the reported error in to libxml2 thus you can
use xmlGetLastError() directly. If you have a custom callback then you can
do similar thing yourself.


xmlsec mailing list
xmlsec at aleksey.com

More information about the xmlsec mailing list