Look shandler.h too (sorry).

The working implementation of handlers is in the Perl extension, but is 
little bit tricky to read it (Sablotron.xs)

Tom, is it possible to post just small example?

Pavel

Shah Hitesh Bhavanji wrote:

> Hi,
> I went through the sablot.h and code of sabcmd to find how it uses it, but
> could not makemuch sense out of it. Can I get one sample example to see,
> how to use handlers or some more documentation about handlers?
> -Hitesh.
> 
> 
>> 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
>> 
>>> 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
>> 


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

Reply via email to