Re: how to create XML DOM from SAX event
Because If I do not write it, I don't get the Document coming from the pipeline. At 10:37 11/12/2003 +0100, you wrote: Lionel Crine wrote: /** * 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; } In above code, why do you set doc to this.builder.getDocument()? I thought the document was already handed to you as DOM already so why not use the reference passed in the function? Jorg 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] - 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]
Re: how to create XML DOM from SAX event
Lionel Crine wrote: /** * 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; } In above code, why do you set doc to this.builder.getDocument()? I thought the document was already handed to you as DOM already so why not use the reference passed in the function? Jorg 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to create XML DOM from SAX event
Here is one of my examples : public class TransformerAddDmidref extends AbstractDOMTransformer { private String dmfamilyref; /** * Set the SourceResolver, objectModel Map, * the source and sitemap Parameters used to process the request. * * If you wish to process the parameters, override this method, call * super() 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]
AW: how to create XML DOM from SAX event
hi reuben, when inheriting from the AbstractDOMTransformer you'd be overriding the transform method, and there do the work you want to do; you're given a Document (which represents the SAX events produced earlier in the pipeline), which you can process in any way you like and at the end return it. the Document you return will then be streamed as SAX events to the other components in the pipeline. > -Ursprüngliche Nachricht- > Von: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Auftrag > von Reuben Christie > Gesendet: Mittwoch, 3. Dezember 2003 19:44 > An: Cocoon Apache > Betreff: how to create XML DOM from SAX event > > > > 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 ? > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
how to create XML DOM from SAX event
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]