Wednesday, 13 August 2014

What is different between DOM and SAX

SAX:
SAX stands for Simple Access for XML API.
It is an event based processing model.
It process the XML Sequentially one after the other from top to bottom.
It consumes the less amount of memory as at any point of time loads only one element into the memory.
It i faster when compared with DOM as it doesn't need to load or form anything.
SAX is a readonly API which means we can just read the XML document but we cannot modify or create new.

DOM:
DOM stands for Document Object Model.
It is a hierarchical processing model where it loads the entire XML memory and represents in tree Structure.
DOM supports random access of elements.
It consumes huge amount of memory as it loads the entire XML and forms tree structure .
It is slow when compared with SAX as it has to represent the XML by loading it.
DOM is a read and write API using which we can read or modify or create an XML documents.

No comments:

Post a Comment