• 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

When will we use DOM and SAX?

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
What are the differents between DOM and SAX...

DOM-->Tree Structure Data Dealing(What is meaning for tree)
SAX-->Event Data Dealing..(What is event)

But i have doubt for all xml is a tree structur view why we use sax some time and dom also some... plz explain when will we use sax and dom....
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
DOM builds the complete XML tree in memory, which takes time and uses up a bunch of memory.

SAX, on the other hand, does not build any in-memory stuctures, and allows the developer to do something just with those nodes that the application is interested.

You'd use SAX if you don't need the XML tree (say, for later modification and saving), and want to save resources (time, memory). Drawback is (obviously) that you don't have the XML tree, so you can't easily determine, e.g., the parent or sibling of a given node.
 
Curse your sudden but inevitable betrayal! And this tiny ad too!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic