Originally posted by Mortin kim:
can any one tell me what are the differences between SAX and DOM..?
Where Excetly DOM Fits and SAX fits.?
You may use DOM when you are going to build xml from elements or you need to traverse between xml nodes backward and forward to decide on your next action, edit the document...
Dom will load your xml into memory so it is memory consumer, from the other hand it gives you the most possible flexibility with an almost easy to use API.
SAX, on the other hand, will pars the document and let you catch some events based on what kind of element parser found during its parse operation. It is forward only, fast and it is not that kind of memory consumer which DOM is. It can not help you with XML authoring and client (your code which use the parser) will bound to parser to complete its operation.
FYI: Stax, let you have all good thing that sax has, also it allows you to write xml, it is not a pull parse so your parser client will not lock for the parser until it complete the document.
You should select your Parser based on several condition like:
-maximum and minimum size of document which need to be parsed
-validation requirement
-one way parsing or traversing in the document
-...
hope it helps.