SablotGetMsgText doesn't return the last reported error, just the 
template message for given code. To catch all error, you have to 
implement message handler. See sablot.h, search SablotRegHandler.

HTH

Pavel

Shah Hitesh Bhavanji wrote:

> Hi,
> I have written a simple wrapper over Sablotron 0.50 which does processing
> and returns transformed output.
> The stripped code for the same is
> 
> 01 char* XSLTProcess(char* xmlStream, char* xslStream)
> 02 {
> 03   char *argums[] =
> 04    {
> 05       "/_stylesheet", xslStream,
> 06      "/_xmlinput", xmlStream,
> 07        "/_output", NULL,
> 08        NULL
> 09    };
> 10   int returncode =
> SablotProcess("arg:/_stylesheet","arg:/_xmlinput","arg:/_output", params,
> argums, &resultStr);
> 11   if(returncode != 0)
> 12    {
> 13       myException exp(SablotGetMsgText(returncode));
> 14        throw exp;
> 15    }
> 16    else
> 17    {
> 18        cout << resultStr << endl;
> 19        if(resultStr == NULL)
> 20            cout << "Result is NULL" << endl;
> 21        else
> 22       {
> 23            transformedStream = new char[strlen(resultStr) + 1];
> 24           strcpy(transformedStream, resultStr);
> 25        }
> 26    }
> 27    SablotFree(resultStr);
> 28    return transformedStream;
> 29}
> 
> On line number 13, I am using char* SablotGetMsgText(int) for getting the
> error message.
> Whenever xml stream is malformed, I get a error "XML parser error %s: %s".
> How can I get get a message string that has all the '%s' resolved?
> Do I need to implement messagehandler? Where can I get documentation for the
> same?
> 
> Thanks and Regards,
> Hitesh.
> 
> 
>> Could you be more specific?
>> Did you implement the message handler?
>> Which kind of message contains the %s format?
>> Pavel
>> 
>>> I am using sablotron for XSLT processing of a few simple xml.
>>> I have written my own processing class and in case of error messages, I
>>> get a message
>>> containing %s.
>>> I wanted to know how to get a message that does not contain %s and
>>> instead has complete
>>> error string with all the parameters filled in.
>>> Thanks and Regards,
>>> Hitesh.
>>> Note:- I am using Sablotron in a C++ application.
>> 


-- 
Pavel Hlavnicka
Ginger Alliance Ltd.
Prague; Czech Republic

Reply via email to