Skip to main content

Posts

Showing posts with the label Document

DOM Parser Vs. SAX Parser

Many developers sometimes confuse which is better to parse the XML document. Ofcourse myself also got doubt which parser I can use for this situation.  Since I have read about DOM and SAX very long back. Just refreshing it again DOM (Document Object Model) Parser: Tree model parser(Object based) (Tree of nodes). DOM loads the file into the memory and then parse the file. Has memory constraints since it loads the whole XML file before parsing. DOM is read and write (can insert or delete the node). If the XML content is small then prefer DOM parser. Backward and forward search is possible for searching the tags and evaluation of the information inside the tags. So this gives the ease of navigation. Slower at run time.