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

Re: C++ XML Parser

Mike - EMAIL IGNORED writes:

On Wed, 03 Jan 2007 13:30:18 -0500, Dmitriy Kropivnitskiy wrote:

James Kosin wrote:

An XML parser is more or less a text parser.
Usually best to write your own.  It is very simple design and

Yikes! This is a very bad suggestion. The idea behind standards like XML is to have standard tools to work with them, thus eliminating repeating the same mistakes in every implementation. You don't go writing a new regular expression parser every time you need regexes do you? To answer the original email, there are a few XML parsers in common use out there. The main ones for UNIX are probably libxml and expat.

I agree with both of the quoted sentiments. I took a look at one of
the recommended parsers, and decided that it would take a while to
install it and figure out how to use it.  However, since:
   1) I already have a well tested general token parser;
   2) my present XML requirement is close to the most trivial
I parsed it directly, with numerous application-specific tests
for validity.  In a couple of hours, it is tested and running.

However, for general application, the use of software conforming
standards is certainly preferable.  There seems to be a number of

How to choose?

Well, I don't know what you evaluated, but late last year I had to through together a C++ XML parser. I remember looking at libxml a long time ago, so this time around I looked at it again.

I found that the current version of libxml2 had a new parsing API that was laughably easy to use directly, or wrap into a C++ class. It was laughably easy for me to wrap it up into a class, and get a robust parser with full namespace support. I could refer to the individual nodes and attributes by uri/name pair directly, without dealing with the headaches of implementing and tracking namespaces.

Attachment: pgpBvBmIjk3rP.pgp
Description: PGP signature

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