File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Difference between SAX and DOM parsers

 
Saurabh Agrawal
Ranch Hand
Posts: 244
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello folks,
Can anyone let me know what is the difference between SAX and the DOM parsers??

I hope to get some comments on this.

Saurabh
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SAX is an event-based API, which means that a SAX parser generates events when making its way through an XML document.

DOM, on the other hand, is a tree-based API, which means that a DOM parser creates a DOM tree out of the elements it encounters while making its way through an XML document.

I'd recommend looking up articles named "Understanding SAX" and "Understanding DOM" at IBM developerWorks.
 
Damanjit Kaur
Ranch Hand
Posts: 346
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also SAX is for sequential access and DOM for random access. DOM requires more memory in case of big xml file.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic