Libxml2 - How to get messages on Linux?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Libxml2 - How to get messages on Linux?

Gabor Boros-2
Hi All,

I need to accomplish validate XML files with an XSD. Found libxml in
packages and works as expected with Win32. But I have problem with
messages on Linux 64bit. Got %s instead the real message text. I use the
below code to get the messages. Any idea why not works with Linux64 bit?

var
   SL_Warning,SL_Error:TStringList;

procedure SchemaValidityWarningFunc(ctx: Pointer; const msg: PChar);
begin
   SL_Warning.Add(msg);
end;

procedure SchemaValidityErrorFunc(ctx: Pointer; const msg: PChar);
begin
   SL_Error.Add(msg);
end;

Gabor
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Libxml2 - How to get messages on Linux?

Gabor Boros-2
Same problem with Win64. So not Linux specific.

Gabor

2018. 05. 22. 10:06 keltezéssel, Gabor Boros írta:

> Hi All,
>
> I need to accomplish validate XML files with an XSD. Found libxml in
> packages and works as expected with Win32. But I have problem with
> messages on Linux 64bit. Got %s instead the real message text. I use the
> below code to get the messages. Any idea why not works with Linux64 bit?
>
> var
>    SL_Warning,SL_Error:TStringList;
>
> procedure SchemaValidityWarningFunc(ctx: Pointer; const msg: PChar);
> begin
>    SL_Warning.Add(msg);
> end;
>
> procedure SchemaValidityErrorFunc(ctx: Pointer; const msg: PChar);
> begin
>    SL_Error.Add(msg);
> end;
>
> Gabor
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Libxml2 - How to get messages on Linux?

Michael Van Canneyt


On Wed, 23 May 2018, Gabor Boros wrote:

> Same problem with Win64. So not Linux specific.

Are these functions callbacks ? If so, is the calling convention correct ?

Michael.

>
> Gabor
>
> 2018. 05. 22. 10:06 keltezéssel, Gabor Boros írta:
>> Hi All,
>>
>> I need to accomplish validate XML files with an XSD. Found libxml in
>> packages and works as expected with Win32. But I have problem with
>> messages on Linux 64bit. Got %s instead the real message text. I use the
>> below code to get the messages. Any idea why not works with Linux64 bit?
>>
>> var
>>    SL_Warning,SL_Error:TStringList;
>>
>> procedure SchemaValidityWarningFunc(ctx: Pointer; const msg: PChar);
>> begin
>>    SL_Warning.Add(msg);
>> end;
>>
>> procedure SchemaValidityErrorFunc(ctx: Pointer; const msg: PChar);
>> begin
>>    SL_Error.Add(msg);
>> end;
>>
>> Gabor
>> _______________________________________________
>> fpc-pascal maillist  -  [hidden email]
>> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Libxml2 - How to get messages on Linux?

Gabor Boros-2
2018. 05. 24. 9:37 keltezéssel, Michael Van Canneyt írta:
> Are these functions callbacks ? If so, is the calling convention correct ?


I used xmlSchemaSetValidErrors and the documentation say "Set the error
and warning callback informations". Tried with and without cdecl.

Meanwhile tried xmlSchemaSetValidStructuredErrors and that works with
Win32, Win64 and Linux 64bit.

Is libxml package have a maintainer or is it a legacy/deprecated thing?
I experienced some differences between the documentation of libxml2 and
the "Interfaces for validating" section in xmlschemas.inc.

Gabor
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Libxml2 - How to get messages on Linux?

Henry Vermaak
On Fri, May 25, 2018 at 12:48:20PM +0200, Gabor Boros wrote:
> 2018. 05. 24. 9:37 keltezéssel, Michael Van Canneyt írta:
> >Are these functions callbacks ? If so, is the calling convention correct ?
>
> I used xmlSchemaSetValidErrors and the documentation say "Set the error and
> warning callback informations". Tried with and without cdecl.

These functions use varargs, so the calling convention is different:

https://www.freepascal.org/docs-html/ref/refsu87.html

I thought it only works with external code, though.  Would be useful if
the documentation mentioned anything.

Henry
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Libxml2 - How to get messages on Linux?

Henry Vermaak
On Fri, May 25, 2018 at 12:05:11PM +0100, Henry Vermaak wrote:
> I thought it only works with external code, though.  Would be useful if
> the documentation mentioned anything.

Sorry I can't read today, the documentation says external only so you
are indeed out of luck it seems.

Henry
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal