Re: [xml] Most portable xml library?



* richardcavell mail com wrote:
I'm writing a Wikipedia bot in C.  It is designed to be as standard and 
portable as possible.  I'm looking for an XML library to parse the 
output of Wikipedia requests.  The tasks are in fact very simple.  For 
example, look at the login result item here:

http://www.mediawiki.org/wiki/API:Login

My bot currently does XML parsing with <string.h> and does it 
correctly.  But it's not the pro way to do it.

It seems unlikely to me that you have implemented a fully conforming XML
processor yet would describe it as implemented "with <string.h>". Also,
having written a couple of tools that interace with the MediaWiki API, I
would also recommend against using anything but the JSON/JSON-P formats;
in my case I tried using the YAML output and found many bugs.

Is libxml2 the most portable XML library?

That is unlikely, simply because the library offers many features; there
are simpler libraries, like expat, that are likely to be more portable.
I am not sure though if portability should be much of a concern here.

And is there example code for extracting individual items from the 
result?  I don't desire to parse the entire document.

There are plenty of examples, but unless the format you care about has a
"you don't need to parse beyond this" marker, you cannot avoid "parsing"
entire documents, as you need to "parse" to discriminate between things
you care about and things you do not care about.
-- 
Björn Höhrmann · mailto:bjoern hoehrmann de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 



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