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 15:36:40 UTC

Help with SAX events

I'm trying to use startrecording(), endrecording() (from 
AbstractSAXTransformer)to create a DOM.

But it's not really clear about how I use them ?

Does someone already used them and show me some code.

Thanks
Lionel



Lionel CRINE
Société : 4DConcept
22 rue Etienne de Jouy 78353 JOUY EN JOSAS
Tel : 01.34.58.70.70 Fax : 01.39.58.70.70


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


RE: Help with SAX events

Posted by Lionel Crine <cr...@4dconcept.fr>.
OK I found what I wanted to do.


Thanks
Lionel


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


[EXAMPLE] extends from AbstractDOMTransformer

Posted by Lionel Crine <cr...@4dconcept.fr>.
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


RE: Help with SAX events

Posted by Reinhard Pötz <re...@gmx.net>.
Have a look at
org.apache.cocoon.webapps.session.transformation.SessionPostTransformer
(in the session-fw block) or
org.apache.cocoon.portal.transformation.EventLinkTransformer (in the
portal block)

Reinhard

> -----Original Message-----
> From: Lionel Crine [mailto:crine@4dconcept.fr] 
> Sent: Wednesday, May 14, 2003 3:37 PM
> To: cocoon-users@xml.apache.org
> Subject: Help with SAX events
> 
> 
> I'm trying to use startrecording(), endrecording() (from 
> AbstractSAXTransformer)to create a DOM.
> 
> But it's not really clear about how I use them ?
> 
> Does someone already used them and show me some code.
> 
> Thanks
> Lionel
> 
> 
> 
> Lionel CRINE
> Société : 4DConcept
> 22 rue Etienne de Jouy 78353 JOUY EN JOSAS
> Tel : 01.34.58.70.70 Fax : 01.39.58.70.70
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
> 


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