On Wed, 2007-05-30 at 17:55 +0300, Ross Burton wrote:
> The need for a cast is part of the (IMHO wrong) design of libxml2, the
> policy is that the libxml2 API requires UTF-8 strings, so they typedef
> xmlChar to unsigned char*.  Application writers are then meant to run
> all strings through UTF-8 conversion, or use xmlChar* if they know the
> string is UTF-8.

Ah, I had always wondered what the rationale was for that.

Since much (maybe all?) of the XML we're parsing is small configuration
files generated by Evolution itself, if we're feeling ambitious it might
be worth porting at least some of the parsing bits to the GMarkup API in

GMarkup has more of a SAX interface, where you specify a set of
callbacks to be invoked while GLib walks the XML tree for you.  The
callbacks are for things like encountering the start of an element, the
end of an element, character data, etc.

Looks like it also has a few functions to help you *generate* XML data
as well by properly escaping outgoing character data.

And it uses gchar pointers.

Matthew Barnes

Evolution-hackers mailing list

Reply via email to