(repost w more suitable title)
Below, I will understand that the use of SXML is made with the highly
qualitative SSAX-SXML library, which has several parts (serialization,
sxpath etc.) and is distributed for lots of Scheme implementations on a
public domain basis. Essential parts of it are available as Black Hole
modules for anyone for whom that might be of interest. Now:
What is advantageous of using SXML or LIBXML depends on the application.
Motivations for using a C library for a particular mechanism that is
already implemented in very very well in Scheme would be, that you are
using some code that requires you to use that C library anyhow, or, that
there would happen to be some routines implemented in that C library that
you need, are not in the Scheme library, and by some reason would be very
time-consuming to implement.
Also of course, like Cyrille points out, there can be occasions when
you want or need a specific library choice due to reasons relating to how
you handle the code in your application, or the specific computer
environment in which your application will execute.
>From a very wide perspective, I relate to such occasions as very rare.
SXML is a data format standard that expresses the entire XML format
in S-expression form. For several purposes this is highly usable.
As a general rule, processing Scheme objects rather than FFI objects
carries many benefits with it: the language and routines for processing and
manipulation available is extremely rich already (sporadic examples:
iteration and serialization), your need of custom code for many operations
is zero, and also as a sidenote the memory handling is implicit in all
steps, including safety of memory fragmentation.
SXML is, generally speaking, an excellent example of when this applies. The
only thing that SXML does not include, which a typical XML library does
include, is a parent element attribute on (SXML/XML) elements. For the one
for whom that would show to be relevant though, it's easy enough to
implement, didn't hear anyone ask for that up to now though.
If you have further thoughts or questions please feel free to share,
Mikael
2012/7/17 Klaus Schilling <schilling.klaus(a)web.de>
> What are the major advantages of using libxml2 xmlreader with ffi over
> using sxml?
>
> Klaus Schilling
>