Gary:
> When I mentioned transforms, this refers to using XSLT with XalanJ.
> Apparently, you're not using the XSLT, just the XPath support so the
> transforms comment doesn't apply.
Thanks for the clarification. You are correct, there is no XSLT in this
particular implementation.
> The XPathAPI is really designed as a demonstration and for low volume
> use. It creates a new XPathContext and XPath every time that
> selectSingleNode is called. Are you specifying a different XPath every
> time or are you using the same XPath?
The XPath specification argument used in selectSingleNode or selectNodes
varies. It depends on the particular XML segment we get, but there are probably
about 10-15 different XPaths being called 10-20 times each.
> If you're using the same one, you
> can build the XPath once and just keep reusing it. The XPathContext()
> needs to be created for each thread but only once. You can call reset()
> after each use to prepare it for the next iteration.
Thanks for the suggestions. We will consider adapting our use of selectSingleNode
to be lower-level calls on XPath and XPathContext.
> Have a look at the code inside XPathAPI which is not big. You can
> restructure your application to build the XPath and XPathContext only
> once per thread and then serially resuse them as needed without having
> to recreate them. The XPath object does not contain any runtime state
> so it can safely be shared across threads.
I look into the code and see how we can optimize our use of these classes.
Thanks!
Glenn
