Here is one of my examples :


public class TransformerAddDmidref extends AbstractDOMTransformer { private String dmfamilyref;

/**
* Set the <code>SourceResolver</code>, objectModel <code>Map</code>,
* the source and sitemap <code>Parameters</code> used to process the request.
*
* If you wish to process the parameters, override this method, call
* <code>super()</code> and then add your code.
*/
public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par) throws ProcessingException, SAXException, IOException {
super.setup(resolver, objectModel, src, par);
}


/**
 * Get the DOM return it in the flow.
 */
protected Document transform(Document doc) {
doc = this.builder.getDocument(); //get the doc as DOM
doc = this.addDmidref(doc); //any method you want to use.
return doc;
}



Lionel


At 13:44 03/12/2003 -0500, you wrote:


i have tried to extend the AbstractDOMTransformer class. and now i dont find
anyhelp for ,"how to work with transform method"? it takes Document argument
and returns the document.but which other methods do I need to implement. I m
new bie and have started writing transformer straight away so, please help
me.
here is my code.i want to now get the Document object of the sax event that
has come from generator into my transformer.where do I write my code ? do i
have toimplement startElement and endElement methods? or just carry on with
transformer method? and another question is,

what does this transformer passes to next componanat? SAX event or DOM ?


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

public void setup(
SourceResolver resolver,
Map objectModel,
String src,
Parameters par)
throws ProcessingException, SAXException, IOException {
}
public void parameterize(Parameters parameters) throws ParameterException {
}
protected Document transform(Document doc) {
doc = this.builder.getDocument();
return doc;
}
}



-----Original Message----- From: Reuben Christie [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 02, 2003 11:58 AM To: Cocoon Apache Subject: how to create XML DOM from SAX event


Hi all, I m currently writing custom transformer to connect to external java program from cocoon. i m stuck here where i need to convert the sax event into xml DOM object. I use file generator to read from xml file and then pass it to the transformer(my custome transformer) in pipeline in this transformer i want to create the original xml file (anything, either string or DOM object). can anybody help me out and throw me some ideas how to do that? anyhelp will be grtly appriciated

thanks alot in advance
reuben


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Lionel CRINE Ingénieur Systèmes documentaires 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to