CachedXPathAPI, as the name says, caches DTMs for the documents you've run 
XPaths against. It _shouldn't_ be allocating a new DOM2DTM for each 
DOMSource... but that would be worth checking.

Of course DOM2DTM isn't exactly lightweight; it's most of a DTM built 
alongside your DOM. We're hoping the experimental DOM2DTM2 code might 
provide a lighter-weight alternative.

(Note that there's a problem if you're changing your DOM between XPath 
queries; DOM2DTM assumes the source DOM is not being altered, and 
violating that expectation can break Xalan. Changing the content of text 
nodes is _probably_ safe, but most other changes wouldn't be, and would 
probably require flushing the DTM from the cache and rebuilding it from 
scratch... and I think our only flush mechanism today is to switch to a 
new instance of CachedXPathAPI. Another of the reasons we're experimenting 
with the DOM2DTM2 approach is that it should be more tolerant of 
alterations in the DOM between XPath scans.)

______________________________________
Joe Kesselman  / IBM Research

Reply via email to