• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

sax and dom

 
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
the difference between SAX and DOM is that sax is event based where DOM stores entire tree in memory.but can not apply it effectively. Can u tell me when to use SAX and when to use DOM keeping in view of memory and size of document
thanks
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SAX and DOM,
ok in DOM whole document is put in the memory,where as in SAX event are fired on the start of tags,doc..and on thier end.
If ur critical factor is memory than always use SAX as nothing is in memory.
if ur critical factor is speed than use DOM as in the case of DOM the search is not sequential so it is always possible to have much more efficiency than the SAX.
if ur document size is less than u can always use DOM ,as memory needed is very less ans u will get faster results.
If ur document require sequential search then no need of using complex DOM api's as it is very easy to catch document events in sequential form in SAX.
if u still need any more help then please ask
 
Manas Ahlaad
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks dean !
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to scan the whole XML document and you have your own data structure that represents the XML document use SAX.
If you want to scan the whole document and doesn't have your own data structure then use DOM
If you need to scan parts of XML document SAX is better.
Srikanth
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!