aspose file tools*
The moose likes XML and Related Technologies and the fly likes learning about SAX Parser and the DOM Parsers 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 "learning about SAX Parser and the DOM Parsers " Watch "learning about SAX Parser and the DOM Parsers " New topic
Author

learning about SAX Parser and the DOM Parsers

Isaac Ferguson
Ranch Hand

Joined: Jun 22, 2012
Posts: 391
Hi

I am learning SAX Parser and the DOM Parser, so I have some questions

Could somebody help me a little bit please?

what's the difference between the SAX Parser and the DOM Parsers when processing XML files? What are the advantages and disadvantages of both? When would you use one over the other and vice versa?

Thanks

Vijaya Raghava
Greenhorn

Joined: Jul 30, 2006
Posts: 27



Use SAX when:
You need to scan large XML documents including: Scan huge files with little overhead.
You need more control over the parsing process: SAX does not actually do much only your program decides how anything is used, if at all.
You have limited system resources: SAX does not create many objects.
You need high performance: SAX quickly locates elements within any size XML document.


Use DOM when:
You need to make multiple processing passes over an XML document and no need to rescan the document on each pass
You need to merge several XML documents together. Here the structures can be the same or different
You need to do a lot with document content including: Sharing content with other processes, Frequent access of content
You need to modify document…including Content or Structure or Order
 
wood burning stoves
 
subject: learning about SAX Parser and the DOM Parsers