Both SAX and DOM are used to parse the XML document. Both has advantages and disadvantages and can be used in our programming depending on the situation.SAX:1. Parses node by node2. Doesn't store the XML in memory3. We cant insert or delete a node4. Top to bottom traversingDOM1. Stores the entire XML document into memory before processing2. Occupies more memory3. We can insert or delete nodes4. Traverse in any direction.If we need to find a node and doesn't need to insert or delete we can go with SAX itself otherwise DOM provided we have more memory.