The transformer does not alter the source document.

Caveat: Remember that the DOM API is not promised to be threadsafe even in 
read-only usage. Most implementations are safe when only being read, but 
that isn't guaranteed; if you require that, be sure you document the 
requirement in case someone later wants to run your code against a 
different DOM.


______________________________________
"... Three things see no end: A loop with exit code done wrong,
A semaphore untested, And the change that comes along. ..."
  -- "Threes" Rev 1.1 - Duane Elms / Leslie Fish (
http://www.ovff.org/pegasus/songs/threes-rev-11.html)

Prabu <prabudhaks...@gmail.com> wrote on 11/11/2010 12:53:42 AM:

> From:
> 
> Prabu <prabudhaks...@gmail.com>
> 
> To:
> 
> xalan-j-users@xml.apache.org
> 
> Date:
> 
> 11/11/2010 12:53 AM
> 
> Subject:
> 
> transform method: Does it do Read only operation on the source?
> 
> Am using xalan-java to apply xsl rules on xml files. Initially I create 
> a DOM node (call it doc) from xml by using the DocumentBuilder. 
> My intention is to apply multiple rules on the same xml file
> in multiple threads, one thread per rule - I create separate 
> Transformer objects in each thread as seen below.
> 
> =====Code snippet - Thread's Run method ====
> 
> ...
> ...
> TransformerFactory tFactory = TransformerFactory.newInstance();  
> Transformer transformer = tFactory.newTransformer
>                                                         (new 
> StreamSource(ruleLocation));
> DOMResult domResult = new DOMResult();
> transformer.transform(new DOMSource(doc), domResult);
> ...
> ...
> 
> ==================
> 
> In the above code, I want to know whether the transform method
> does only read-only operation on the document source "doc".
> If it affects the source, then it will not be thread safe to run rules
> on the same xml.
> 
> 
> --
> 
> Thanks,
> Prabu D
> 

Reply via email to