There are very useful differences between SAX and DOM parsing. SAX Parser is the one which is developed to run the java programs especially. Primarily, if we want to extract the data from a xml file once, we should move to SAX, which is one time top to bottom read approach and if we want ot randomly pick the data in an xml file then the tree reperesentation of DOM model is to be put into use.
If we need to find a node and doesnt need to insert or delete we can go with SAX itself otherwise DOM provided we have more memory.
Few top level differences
1. Parses node by node
2. Doesnt store the XML in memory
3. We cant insert or delete a node
4. Top to bottom traversing
1. Stores the entire XML document into memory before processing
2. Occupies more memory
3. We can insert or delete nodes
4. Traverse in any direction.
Source: obviously internet as you all know.
No comments:
Post a Comment