Document Object Model (DOM)

The Document Object Model presents a tree representation of an XML document through a standards-based API that the World-Wide-Web Consortium (W3C) maintains. The DOM is better suited for applications that want to read information from an XML file, manipulate the XML data, and then eventually write the data out to a destination. Additionally, it offers the benefit over SAX that the document can be accessed randomly (the program does not have to read through the document sequentially).

The DOM does have a serious limitation in that it must read the entire XML document into memory. This is not a problem for the small example in the chapter, but in some real life applications, such as B2B e-commerce, XML files can get ...

Get Java™ Web Services Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.