We currently use XPathAPI.selectSingleNode() for an application which
extracts data from XML message text nodes based on a set of XPath query
strings.
As part of an investigation to improve performance, we are investigating
using CachedXPathAPI instead. This certainly is a lot faster (as would be
expected) but we are concerned about its safety in a multi-threaded
environment.. The Javadoc for CachedXPathAPI is not quite clear on this
subject, but suggests there may be a problem, as we are changing the source
document but keeping the XPath Strings the same. All of our tests which
attempt to 'force' errors or data corruption by sharing CachedXPathAPI
between threads have so far found no problems.
However I found the below post on the list archives:
> Subject: RE: Using DTMDocumentImpl
> From: Joseph Kesselman <[EMAIL PROTECTED]>
> Date: 2002-10-01 21:48:24
>
> <SNIP>
> (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.)
> <SNIP>
This suggests that text nodes should be OK - but can anyone give a more definitive
answer than _probably_ ?
Or suggest an alternative approach?
If not that's fine, I'll delve into the source code.
cheers,
Cameron Smith
______________________________________________________________________
*******************************************************************
* AEGON UK plc, Registered Office: 90 Long Acre, London WC2E 9TF. *
* Registered in England (No. 3679296). Telephone: 0870 60 00 337� *
*������ AEGON UK group companies and businesses include���������� *
*��� Scottish Equitable plc, AEGON Asset Management UK plc,������ *
*������ AEGON Individual Protection, AEGON UK Services,���������� *
*������ Scottish Equitable International Holdings plc������������ *
*����������� and HS Administrative Services Ltd.����������������� *
*******************************************************************
______________________________________________________________________
EMAIL DISCLAIMER
This message is for the intended recipient only. It may contain
confidential
or proprietary information. If you receive this message in error, please
immediately delete it, destroy all copies of it and notify the sender.
You must not use or disclose any part of this message if you are not the
intended recipient. We may monitor all Email communication through our
networks.
If you contact us by Email, we may store your name and address to
facilitate communication.
Any views expressed in this message are those of the individual sender,
except where the message states otherwise.
We take reasonable precautions to ensure our Emails are virus free.
However, we cannot accept responsibility for any virus transmitted by us
and recommend that you subject any incoming Email to your own virus
checking procedures.