Hi folks I know this is an old chestnut, but I have a new question about it .....
As we all know, the Xerces DOM implementations are not thread safe, and this is intentional to maximise performance. However, there is a very useful pattern we use in a number of places in our products where we parse and cache XML documents as Xerces DOM trees, and then hand them out to callers. Right now, since we have multi[ple readers, we clone a fresh copy of the DOM for each caller. It would be nice to have a package of wrapper classes that would implement thread safe access for multiple readers by simply wrapping the underlying Xerces calls in synchronized(document), and of course wrap any returned Xerces handles. It wouldn't be Xerces specific, just a generic wrapper that implements the DOM API both as provider and consumer, c.f. Apache DBCP or Collections.unmodifiableX() .... I'd envisaged it as read only but in principle it could be made read-write. I'm aware there will be issues with things like Iterators. I know a lot of people have a similar need, and I was somewhat surprised that I couldn't find a robust, open source implementation of this. If I am lucky, I might be able to line up one of our junior devs to create this .... would there be any interest in open sourcing it and packaging it with Xerces? Cheers Dave