[Expat-discuss] (no subject)

Nick MacDonald nickmacd at gmail.com
Tue Mar 27 18:12:17 CEST 2007


Not sure if you missed a comma in there, or what.  I don't recognize
the phrase "sax dom" so I presume you are asking:
  "I want to know the difference between SAX, DOM and eXpat."

Based on that assumption, here is some information:

- SAX is event based.  As a component of an XML document is
recognized, an event is fired into the supporting code, and it should
update its internal state accordingly.  If the code has any concept of
the overall document structure, it is because it saved it somehow in
its own internal state(s).

- DOM reads the entire XML document structure into memory.  It
provides methods to "walk" this structure so that the code using the
document can get to any arbitrary place in the document as needed.

The big difference here is the amount of memory needed for a large
document, and the amount of up front processing.  With SAX, the
document processing occurs at the same time as the supporting code.
With DOM, most of the work of document processing is all up front, and
then the supporting code gets to have a look at the document after it
is all loaded into memory.  SAX is normally considered to be faster
and more memory efficient than DOM.  If memory footprint is your only
consideration SAX will always be better than DOM... however, there are
many kinds of XML document processing needs, and sometimes you need
DOM because you need simultaneous access to the whole document at
once, something that SAX can't really provide.

eXpat is a SAX XML document parser.  If you need SAX, eXpat is one of
the fastest parsers around.  eXpat does not have any DOM features
whatsoever... so if you need to have an in memory representation of
the entire XML document, you should probably look beyond eXpat.

Hope this is the info you needed... good luck on what ever projects
you're considering...
  Nick


On 3/27/07, Ines Farrah <ines.farrah at telnet.com.tn> wrote:
> I want to know the diffrence between sax dom and expat


More information about the Expat-discuss mailing list