discuss-gnustep
[Top][All Lists]
Advanced

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

Re: NSXMLNode and libxml


From: Richard Frith-Macdonald
Subject: Re: NSXMLNode and libxml
Date: Sun, 15 May 2011 09:00:32 +0100

On 14 May 2011, at 22:45, Niels Grewe wrote:

> Hello all,
> 
> I recently and quite obliviously started using NSXMLNode in DBusKit
> because I want it to emit D-Bus introspection data, which is XML.
> As it turns out, that was a bit hasty since we only have a stub for
> NSXMLNode in -base.
> There are some comments in the code that suggest that it should be
> implemented using libxml2. Since the libxml2 APIs are reasonably easy to
> use, it would be willing to do that. Still, I wanted to check back first
> whether this is still the path we want to go down.
> I remember Richard making a few changes to NSXMLParser so that it always
> works without libxml and I got the impression that the goal was to
> avoid the dependency on the library. So: Do we need a home-grown
> implementation here or is a thin wrapper around libxml sufficient?


I think either would be good.  There's no particular reason to avoid libxml2 
except to keep the options open of building a more lightweight gnustep-base for 
mobile devices.

When I looked at the Apple API, I found it was so similar to libxml2 that it 
seemed likely to merely be a wrapper ... which means that implementing our own 
wrapper round libxml2 is likely to give us code where incompatibilities with 
the Apple implementation are automatically minimal.  However, the GSXML classes 
in the additions library (which were written a long time before Apple added 
their API) took that approach and had a lot of problems because the libxml2 
design (memory management in particular) is quite ugly/confusing, so you might 
find that implementing the NSXML classes from scratch is actually easier and/or 
more fun.

So ... wrapping libxml2 has the advantages of re-using established code and 
probably making Apple compatibility easy, but writing your own has the 
advantage of likely being more fun and not having to read libxml2 source code 
to try to figure out how it actually works.

Basically, either way is fine as far as inclusion in gnustep-base is concerned.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]