This week's book giveaway is in the Security forum.
We're giving away four copies of Securing DevOps and have Julien Vehent on-line!
See this thread for details.
Win a copy of Securing DevOps this week in the Security forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Difference between SAX and DOM parsers  RSS feed

 
Ranch Hand
Posts: 244
  • 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
 
author
Sheriff
Posts: 11962
5
  • 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.
 
Ranch Hand
Posts: 346
  • 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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!