DOM is Document Object Model. The entire XML document is loaded into the memory and is stored in the tree structure. So we can have easy traversal. In the case of large xml documents better to use SAX, coz the entire document is loaded into the memory which is memory consuming.
SAX is Simple API for XML parsing, it is event driven, means for every tag an event is fired like start tag, end tag etc. The document is not loaded into the memory as DOM. you have to handle the events (which most programmers try to esacape :)
Nice Eshwar,thats true :-) but personally i feel SAX makes many good advantages over DOM when it comes to reading and have a custom validation on XML documents. Isn't it ?regards,Subhash
DOM: -Its Object Driven parser -Creates copy of XML document in Tree format, good for Large sized XMLs but very memory consuming for Large sized XMLs (think about XMLs which has 2GB or more size) -Moves Backward&Forward directions in XML document -supports CRUD -bit slower compared to SAX
SAX: -Its Event Driven parser -Uses existing XML document...so doesn't create new one -Moves Forward ONLY -Doesn't support CRUD -Recommended for large scale XML data transfers and where memory is costly.