• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DOM & SAX

 
Jaysakthy Muthuvelu
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.
 
Rajan Thiyagarajan
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,
 
Roseanne Zhang
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.
 
Ajith Kallambella
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic