You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Lionel Crine <cr...@4dconcept.fr> on 2003/05/14 17:38:27 UTC

[EXAMPLE] extends from AbstractDOMTransformer

I inherit my custom transformer from AbstractDOMTransformer :

For someone else who need to do the same thing , here is my code :


import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.component.Composable;
import org.apache.avalon.excalibur.pool.Recyclable;

import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.xml.dom.DOMBuilder;
import org.apache.cocoon.transformation.AbstractDOMTransformer;
import org.apache.cocoon.transformation.Transformer;

import org.w3c.dom.Document;
import java.util.Properties;


public class Record
extends AbstractDOMTransformer
implements Transformer,DOMBuilder.Listener, Composable, Disposable, 
Recyclable {


protected Document transform(Document doc) {
doc = this.builder.getDocument();
String docString = null;
try {
Properties format = 
org.apache.cocoon.xml.XMLUtils.defaultSerializeToXMLFormat(true);
docString = org.apache.cocoon.xml.XMLUtils.serializeNode(doc,format);
} catch (ProcessingException pe) {
System.err.println("record.transform : Processing Exception");
}
return doc;
}

}

Lionel 


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org