Elliotte Rusty Harold wrote:
> Don't use selectSingleNode. It's hard to tell without knowing more about
> your use case, but I suspect you can reduce this to one or a few calls
> to selectNodes (Or whatever Jaxen calls that functionality) that return
> a list you them iterate through, so you don't keep searching the
> document every time.
I agree. In Jaxen 1.0 FCS, selectSingleNode performs a selectNodes call and
returns only the first object in the list.
Thus, selectSingleNode performs a full document scan instead of stopping once
the first matching node is found as one would expect.
To fix such a performance issue, you should use XPath expressions that narrow
the scope of search. Especially avoid expressions such as "//myNode" which
will force a full document search. Prefer "/nodeA/nodeB//myNode".
Laurent
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@(protected)