Re: [xml] Output from libxslt

On Sun, 11 Mar 2001, Daniel Veillard wrote:

On Sun, Mar 11, 2001 at 10:28:24AM +0000, Matt Sergeant wrote:
I can get libxslt to output using the right output method to a file, no
problem. It's just xsltSaveResultToFile. But I want to be able to output
to memory, or with callbacks...

Unfortunately there's no example of xmlOutputBuffer anywhere in the code,
which looks like how I would do it. So my question before I just start
hacking, is what is the "ioctxt" void pointer? Is it somewhere I can stash
a private structure for use in the callback? Or will it get overwritten?
If so, the output callbacks really need some way of storing a private
pointer, otherwise it's going to be impossible to make some of this stuff
thread safe.

  Okay, an IO output bufffer can be user defined to output to memory,
a protocol stack, a database ...
  It's like a device handler in most OSes, there is a set of entry points
(i.e. the write and close callbacks) and a context pointer which is
user definable.
  Yes the ioctx argument is the context defined by the user and passed
as the first argument of the write and close callbacks.

  More informations can be found in:

Seems I need better descriptions of the functions arguments or usage
description, feedback welcome :-)

Feedback: works fine. Thanks :-)

iowrite_scalar(void * context, const char * buffer, int len)
    SV * scalar;

    scalar = (SV *)context;

    sv_catpvn(scalar, (char*)buffer, len);

    return 0;

I love Perl :-)

I'm working on iowrite_fh() now, should be fairly simple too.

FWIW, I've had someone report that XML::LibXSLT is "more than twice as
fast as XML::Sablotron for the same large input file".


    /||    ** Founder and CTO  **  **     **
   //||    ** Ltd   **  ** XML Application Serving **
  // ||    ** **  ** XSLT, XPathScript, XSP  **
 // \\| // ** mod_perl news and resources:  **
    //  \\

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]