About
An Xml Document can build in two programming models.
It can be seen:
- as a stream of events
- an object representation (DOM - document object model)
A stream model requires much less memory than DOM, because the stream model does not construct an internal representation (tree structure) of the XML data, as a DOM does.
You see the data as it streams in. In general, such parsers work well when you simply want to read data and have the application act on it. When you need to modify (interactively) an XML structure, an in-memory structure such as DOM makes more sense.
Constructing the dom requires reading the entire XML structure and holding the object tree in memory, so it is much more CPU- and memory-intensive.