GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  J2EE
Go To First  |  Previous Question  |  Next Question 
 J2EE  |  Question 41 of 98    Print  
DOM & SAX parsers
Explain about DOM & SAX parsers with real-time example of usage


  
Total Answers and Comments: 3 Last Update: May 16, 2007     Asked by: sudhakar_bvr 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
June 06, 2006 02:53:57   #1  
Eshwar        

RE: Tell about DOM & SAX parsers

DOM is Document Object Model. The entire XML document is loaded into the memory and is stored in the tree structure. So we can have easy traversal. In the case of large xml documents better to use SAX, coz the entire document is loaded into the memory which is memory consuming.

SAX is Simple API for XML parsing, it is event driven, means for every tag an event is fired like start tag, end tag etc. The document is not loaded into the memory as DOM. you have to handle the events (which most programmers try to esacape :)

Thanks and Regards

Eshwar


 
Is this answer useful? Yes | No
August 10, 2006 07:53:26   #2  
Subhash Thakur        

RE: Tell about DOM & SAX parsers
Nice Eshwar,thats true :-) but personally i feel SAX makes many good advantages over DOM when it comes to reading and have a custom validation on XML documents. Isn't it ?regards,Subhash
 
Is this answer useful? Yes | No
May 16, 2007 17:27:14   #3  
Chandan Reddy        

RE: Tell about DOM & SAX parsers
DOM:
-Its Object Driven parser
-Creates copy of XML document in Tree format, good for Large sized XMLs but very memory consuming for Large sized XMLs (think about XMLs which has 2GB or more size)
-Moves Backward&Forward directions in XML document
-supports CRUD
-bit slower compared to SAX

SAX:
-Its Event Driven parser
-Uses existing XML document...so doesn't create new one
-Moves Forward ONLY
-Doesn't support CRUD
-Recommended for large scale XML data transfers and where memory is costly.

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape