Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • 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
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

DOM & SAX

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI there,
I prepared some list (for my use), describing Merits & demerits of DOM & SAX. If iam wrong somewhere plz correct me. If i missed anything add to that



Thanks
Shakthy.
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
The following points you have told is contradicting/confusing. Could you/somebody please make it bit more clear.
1. Document is huge but there is a Constraint for Memory - Which one should be used.. SAX or DOM.
2. If Speed is the constraint - Which one is best.. SAX or DOM
Other points are good and clear. Thanks for your efforts.
=Rajan=
[ December 28, 2002: Message edited by: Rajan Thiyagarajan ]
 
Jaysakthy Muthuvelu
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
For Speed : DOM is the Best.
But If there is a memory constraint then we have to choose SAX.
Over all
Dom - speed
SAX - Limited Memory Use.
Thanks,
Shakthy,
 
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For speed, sax is the best. However, if you need to go through it more than once, dom is the best.
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Be careful when you talk about speed - without qualifying it can be pretty confusing.
The parsing speed for SAX is faster than DOM for significantly large docuements. I say so because for smaller documents(<1MB) the difference in speed is insignificant unless you are running an age old PC.
The parsing speed ie., time taken for the parse() call to return for DOM is slower because it has to allocate memory and creates the DOM tree with all the cross references between nodes.
The navigation speed, for lack of a better word is obviously faster in a DOM scenario because the entire document is in memory. If you were to navigate the XML document using SAX, you will have to parse it all over again!
Just my two cents worth...
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Roseanne Zhang:
For speed, sax is the best. However, if you need to go through it more than once, dom is the best.


because sax is not for that purposes.
 
Get off me! Here, read this tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic