Hi,

I've currently got some code working with XPathAPI, and am now looking
at improving its performance. The javadocs say that CachedXPathAPI can
be faster, but I'm not clear on what the conditions for its use are.

The application I'm working on processes many xml input documents.

for each one:
  parse document into a DOM (using Xerces)
  apply a series of fixed xpath expressions until one matches
  apply a couple of fixed xpath expressions to extract some data
  //  other processing

All this is being done within a single thread.

Would I be right in guessing that what my current code is doing under
the hood when I apply N xpaths to a single DOM is creating a "DTM"
representation N times (ie each time I call XPathAPI.eval(...))? If so,
I clearly want to avoid this..any suggestions how?

I have re-read the javadocs for CachedXPathAPI several times, but am
still not clear whether I can use it in the above situation or not.
The javadocs seem to imply that a CachedXPathAPI is somehow "bound" to a
specific document (aka DTM). I can't see how this happens, though. Is
there an implicit assumption that all the eval(...) methods are passed
Node objects from the same document, and that the DTM is built when the
first eval function is called?

It would seem reasonable to me to convert my DOM Document into a DTM
then call low-level xpath functions that take DTM integer "node ids"
rather than Node parameters. However I can't see any way of creating a
DTM from a Document. Have I missed something obvious?

All suggestions gratefully received...

Regards,

Simon


Reply via email to