• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

learning about SAX Parser and the DOM Parsers

 
Ranch Hand
Posts: 1402
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Ranch Hand
Posts: 37
Spring Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic