From: Hamish Mackenzie (hamish_at_[hidden])
Date: 2006-09-07 21:25:49
We use libxml2 with our own C++ wrappers (for SAX and XSLT mainly). The
wrappers are incomplete (they only cover what we use) and they are not
documented very well, so I don't think it would help much to publish
them here. Instead I'll try to summarize what we would like, that
libxml2 does not provide.
We have some code that parses using the push parser within async
callbacks (ISAPI). The only problem with this is that we can't perform
async actions easily in the libxml2 SAX callbacks. Making an async call
from a SAX callback is not possible without adding a queue, this is not
very nice and would not work well with SAX functions that return objects
(I think libxml2 has some of these and though I have not used them they
look like just the kinds of things you would want to use asio for).
For that reason I think the ideal low level interface would have the
option of async callbacks. I think data should be pushed to it with an
async write to give the caller control over the buffer size (and
avoiding unnecessary copying).
I don't think it is a good idea to focus on input alone. I think a good
interface could be used for both input and output of XML. For instance,
we have implemented a SAX handler that writes to a std::ostream and we
use that as the lowest level of our xml output system. This is useful
as it means we can easily use SAX for in-process communication and an
XML stream for inter process (avoiding writing and parsing XML when
I think one good test case for a boost.xml would be a boost.asio
application that reads XML from a socket and writes it to an XML
parser. This would cause SAX like async events, and these events would
write the XML back to the socket also using asio. A kind of XML echo.
I hope this helps,
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk