[Expat-discuss] DOM parser, expat vs. lbxml?

Michael B. Allen miallen at eskimo.com
Wed Mar 5 14:57:12 EST 2003


On Tue, 4 Mar 2003 11:23:34 -0800 
AFish at GoldenGate.com wrote:

> We need a DOM parser in C

DOM is not a parser. Expat is a parser. The DOM is a tree of nodes in
memory. Frequently they do come with some kind of module to load and
store from and to XML however in which case it would *use* an XML
parser.

> that will compile on any platform. So far, the

"any platform"? You really should be a little more spcecific. You might
say POSIX or ANSI platform but "any" just isn't possible.

> only C xml parsers I have seen are expat and libxml. The only DOM parser

There are several XML parsers in C and particularly in C++. Use 'xml
parser c' on google. Xerces C++, IBM's xml4c, and Oracle XML for C are
three that I can think of.

> build on top of expat I have seen is 'SCEW' the simple C expat wrapper
> (http://www.nongnu.org/scew/).

This isn't a real DOM though.

> Questions:
> 1. Are there other expat wrappers or examples which provide DOM-like xml
> tree traversal?

There are lot's of these I suspect. And you could write your own in 20
mintues. Here's one:

  http://www.eskimo.com/~miallen/libmba/dl/docs/ref/domnode.html

> 2. Has anyone done a side-by-side libxml vs. expat comparison? Is there any

I have never really used libxml. I believe it requires glib. I would
be willing to bet expat would be quite a bit faster and much much more
effecient though.

> reason we should roll our own DOM parser on top of expat instead of using
> libxml?

There are a couple of other DOM implementations. If you need a real
DOM rather than a simple DOM-like interface like those mentioned above
there's is DOMC (by yours truely):

  http://www.eskimo.com/~miallen/domc/

Incedentally I just finished testing 0.7 but I have to run through the
portability tests and create the various packages so it will take me
another week or so. I have already compiled it on Windows NT and have
a working Win32 Makefile for MSVC (I'm not a Linux zealot!).

Mike

-- 
A  program should be written to model the concepts of the task it
performs rather than the physical world or a process because this
maximizes  the  potential  for it to be applied to tasks that are
conceptually  similar and, more important, to tasks that have not
yet been conceived. 



More information about the Expat-discuss mailing list