Difference between domparser and saxparser.

could you explain the mechanism include in domparser
Manikandan ThiagarajanSenior consultantAsked:
Who is Participating?

* The DOMParser parses an XML document and creates an inmemory Object representation for the whole XML as a DOM object.
* The SAXParser reads the XML file and as it reads, as it reads, it searches for registered callback funtions (which are written by the user) so that as the parser encounters a particular tag/element etc. while reading, those corresponding callback functions are fired.

as u can see, DOM is more memory intensive, but its more flexible/easier to use..


Mayank SAssociate Director - Product EngineeringCommented:
A Sax parser will give you better performance than a DOM parser. DOM will load the entire object into memory and will give you easier API access/ control to the tree (adding/ removing nodes is simpler).
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.