wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes DOM vs SAX Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "DOM vs SAX" Watch "DOM vs SAX" New topic
Author

DOM vs SAX

bhuvan gupta
Greenhorn

Joined: Mar 26, 2001
Posts: 13
There are many XML parsers available.
Some of them use SAX and some DOM.
Which of these should be preferred ??
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
Neither DOM or SAX can be preferred on the base that �DOM is better� or �SAX is better�. Each has its own class of tasks it suits best, and they both should be used complimentary. For more details you can read this and this threads.


Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
Rich Wardwell
Ranch Hand

Joined: Jan 20, 2000
Posts: 33
Consider that SAX is a low level parsing method where you have to do all the work whereas DOM is fairly high level and creates an object tree for you. DOM also can be used to output XML where SAX inherently does not.
Generally, most DOM parsers are written using a SAX parser. Download JAXP from Sun and try them both out.

<B>Rich Wardwell</B><BR> <A HREF="mailto:rcw3@levelpath.com" rel="nofollow">rcw3@levelpath.com</A> <BR>Sun Certified Programmer for the Java 2 Platform
Hema Menon
Ranch Hand

Joined: Oct 29, 2000
Posts: 569
This short description on SAX vs DOM might help
http://www.xml-zone.com/articles/sf020101/sf0201-2.asp

-Hema


~hm
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: DOM vs SAX
 
Similar Threads
how to compare two xml files?
How to pasrse XML string quickly in java
SAX and DOM
How do i obtain unique value thru this code
SAX Vs DOM