SAX can parse XML documents but cannot create them. In contrast, DOM can parse and create XML documents. This chapter introduces you to DOM.
What Is DOM?
Document Object Model (DOM)is a Java API for parsing an XML document into an in-memory tree of nodes, and for creating an XML document from a node tree. After a DOM parser creates a tree, an application uses the DOM API to navigate over and extract infoset items from the tree’s nodes.
DOM has two big advantages over SAX:
DOM permits random access to a document’s infoset items, whereas SAX only permits serial access.
DOM also lets ...