> Is there a better list for such a question?
There is no better list anywhere or for anything... at least as far as
low-level Xalan stuff goes.
> In our application (Cocoon 2 based) we currently make extensive use of
> the XPathAPI.selectNodeList() function to return DocumentFragments to
> the calling functions.
You can browse the Javadoc and get some ideas of what you need to do to use
the XPath functionality outside of the XPathAPI wrapper.
The meaningful parts of XPathAPI are:
XPathContext xpathSupport = new XPathContext();
and
PrefixResolverDefault prefixResolver = new PrefixResolverDefault(
(namespaceNode.getNodeType() == Node.DOCUMENT_NODE)
? ((Document) namespaceNode).getDocumentElement() : namespaceNode);
// Create the XPath object.
XPath xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null);
So, you have three object creations to think about.
You can stub out the PrefixResolver. Chances are that you want to set the
XPath once and not have the prefix be document-dependent; if so, you can use
a bare-bones implementation in place of the one that XPathAPI invokes.
Once you do that, you can pre-build the XPath expression and the
XPathContext. Just make sure that you reset() the XPathContext in between
documents (or document changes, if you're mutating the underlying DOM). If
you don't, you'll get unpredictable results...
Beyond that, you should check your XPath statements for silly things like
"//". (And if you really want something like "//text()", write your own
NodeIterator to walk the tree...)
And then there have been several recent messages related to DTM/DOM
transitions and the overhead there.
Paul Brown
FiveSight Technologies