Following up a point that got raised about DOM performance.
The Xerces-j parser
says that it supports lazy DOM building by default. In this approach, practically nothing is built until you need it.
I wonder how you would handle parser errors with this approach?
However, looking at the xerces based implementation in
Java 5, code that mentions the feature "http://apache.org/xml/features/dom/defer-node-expansion" seems to be frequently commented out.
When I tried setting this feature on a standard library DocumentBuilderFactory, I got an AbstractMethodError!
So it appears you would have to use a different parser than the default to get lazy DOM.
I would be interested to hear from anybody who has found a parser that actually implements this feature.
Bill