Hello Vadim,
sorry but you new patch gives although a NullPointerException, I even
added
this.setContentHandler(this.handler);
this.setLexicalHandler(this.handler);
to the recycle because both handler are set to null in
DOMBuilder-->AbstractXMLPipe-->AbstractXMLProducer.recycle(), but
this leads to some error reporting about only one root element for document
allowed.
So my suggested patch (suboptimal but working)
- without attribute this.hadler
- with attribute this.paretnNode
looks like the following:
--- work/cocoon-2.0.1/src/java/org/apache/cocoon/xml/dom/DOMBuilder.java_orig Fri Mar
8 17:51:11 2002
+++ work/cocoon-2.0.1/src/java/org/apache/cocoon/xml/dom/DOMBuilder.java Fri Mar
+ 8 19:53:47 2002
@@ -35,6 +35,9 @@
/** The result */
protected DOMResult result;
+ /** The parentNode */
+ protected Node parentNode;
+
/**
* Construct a new instance of this TreeGenerator.
*/
@@ -83,6 +86,7 @@
TransformerHandler handler = factory.newTransformerHandler();
this.setContentHandler(handler);
this.setLexicalHandler(handler);
+ this.parentNode = parentNode;
if (parentNode != null) {
this.result = new DOMResult( parentNode );
} else {
@@ -109,7 +113,21 @@
*/
public void recycle() {
super.recycle();
- this.result = null;
+ try {
+ TransformerHandler handler = factory.newTransformerHandler();
+ this.setContentHandler(handler);
+ this.setLexicalHandler(handler);
+ if (this.parentNode != null) {
+ this.result = new DOMResult(this.parentNode);
+ } else {
+ this.result = new DOMResult();
+ }
+ handler.setResult(this.result);
+
+ } catch (javax.xml.transform.TransformerException local) {
+ throw new RuntimeException("Fatal-Error: Unable to get transformer
+handler");
+ }
+
}
/**
Peter
On Thu, Mar 07, 2002 at 05:50:52PM -0500, Vadim Gritsenko wrote:
> I do not like re-creating transformer every time; it's quite expensive
> operation (IIRC). It should be enough just provide new result object
> instance.
>
> Could you try attached version?
>
> Thanks,
> Vadim
--
------------------------------------------------------------------------
Peter Seiderer E-Mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]