wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes DOM and SAX Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "DOM and SAX" Watch "DOM and SAX" New topic
Author

DOM and SAX

Angela Poynton
Ranch Hand

Joined: Mar 02, 2000
Posts: 3143
I'm on a course learning about XML right now .. .we've just briefly gone through DOM and SAX but what I can't understand is when one would be more benefitial than the other.
So XML gurus .. when would you choose one over the other and would / could you use both for different parts of an application?


Pounding at a thick stone wall won't move it, sometimes, you need to step back to see the way around.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
This is a fairly popular topic hereabouts. See the following old messages for a starter, or search for DOM and SAX.
http://www.javaranch.com/ubb/Forum31/HTML/000014.html
http://www.javaranch.com/ubb/Forum31/HTML/000033.html
http://www.javaranch.com/ubb/Forum31/HTML/000239.html

Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Murali Mohan
Ranch Hand

Joined: Jun 14, 2001
Posts: 47
1)SAX is faster than DOM.
2)SAX is good for large documents because it takes comparitively less memory than Dom.
3)SAX takes less time to read a document where as Dom takes more time.
4)With SAX we can access data but we can't modify data.
5)We can stop the SAX parsing when ever and where ever you want.
6)SAX is sequential parsing but with DOM we can move to back also.
7)To parse machine generated code SAX is better.To parse human readable documents DOM is useful.

[This message has been edited by Murali Mohan (edited June 15, 2001).]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: DOM and SAX
 
Similar Threads
DOM and SAX
Parsing XML file
need help urgently
DOM or SAX confusing
Errors in DOM/SAX Mock exams ???