parser

Difference between domparser and saxparser.

could you explain the mechanism include in domparser
LVL 9
Manikandan ThiagarajanSenior consultantAsked:
Who is Participating?
 
arun_kuttzCommented:
basically..

* The DOMParser parses an XML document and creates an inmemory Object representation for the whole XML as a DOM object.
whereas..
* 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..

-KuTtZ

0
 
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).
0
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.