DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3472>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3472

java.lang.OutOfMemoryError while transforming XmlDocument





------- Additional Comments From [EMAIL PROTECTED]  2001-09-26 07:09 -------
thank you for showing interest in this topic.
question:How do you get Transformers, and do 
they get reused endlessly or do you re-get them from prebuilt templates?
Answer: The 'Templates' object is cached in the memory and gets reused for 
every transformation. The 'Transformer' is created everytime using the 
Templates.newTransformer( ) method. Here is the code snippet which applies the 
stylesheet to the XmlDocument object ..
Note: the 'template' object passed on to this method is static and gets 
initialized once by the implementing subclasses. The following code snippet is 
in the super class [Worker.java] and the method 'applyStyleSheet' is invoked 
from the same class by ....
InputSource inSrc       = applyStyleSheet( inXml,getRequestTemplate( ) );
where inXml - com.sun.xml.tree.XmlDocument object
and 'getRequestTemplate' is an abstract method implemented by the subclass to 
return the static 'Templates' object.

protected InputSource applyStyleSheet( XmlDocument  inXmlDoc ,Templates 
template) {
                Transformer transformer = null;
                StreamSource inSource = null;
                InputSource outSource = null;
                try {
                        transformer = template.newTransformer( );
                        inSource    = createSource ( inXmlDoc );
                        outSource   = transformSource ( inSource , 
transformer );
                } catch (Exception exp ) {
                        exp.printStackTrace( );
                } finally {
                        transformer = null;
                        inSource = null;
                }
                return outSource;
        }

Reply via email to