Document Object Model(DOM) is used for representing xml,html
But am not able to understand why DOM loads everything into main memory.Is it used for enabling us to insert,delete objects in it or is there something else to it..
Also what are it’s advantages that makes it’s use so wide?
Because to be able to implement a method such as
you need to have parsed the document completely, and loaded the tree of nodes in memory. You could imaging reparsing the document at every method call, but it would be extremely inefficient.
What makes it so popular is that it’s a standard API, supported by every language on earth, and which makes it relatively easy to navigate through the nodes and extract the information you want.