Luca,
In a generator I use flowing code within the generate()-Method. Maybe this
helps:
parser = (Parser)this.manager.lookup(Parser.ROLE);
parser.setConsumer(super.xmlConsumer);
parser.parse(new InputSource(new StringReader(sb.toString())));
Regards,
Reinhard
> Ludovic,
>
> thanks for your kind answer, but we are not in an XSP page (we're writing
> a
> Transformer instead), hence, your suggestion is not truly useful to us.
>
> Best regards,
>
> Luca Morandini
> [EMAIL PROTECTED]
>
> > -----Messaggio originale-----
> > Da: Ludovic de Beaurepaire [mailto:ludovic.debeaurepaire@;axonie.com]
> > Inviato: venerd� 8 novembre 2002 11.02
> > A: [EMAIL PROTECTED]
> > Oggetto: Re: Strings to SAX events
> >
> >
> > Try in a XSP the following, data is your xml string :
> >
> > <util:include-expr>
> > <util:expr><xsp:expr>
> > data
> > </xsp:expr></util:expr>
> > </util:include-expr>
> >
> >
> >
> > ----- Original Message -----
> > From: "Luca Morandini" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Friday, November 08, 2002 10:55 AM
> > Subject: Strings to SAX events
> >
> >
> > > Folks,
> > >
> > > We're in the process of writing a Transformer, which, of
> > course, outputs
> > > SAX
> > > events... but, in the midst of this stream , we need to insert an
> > > XML element stored in a string.
> > >
> > > To do this we're groping in the dark trying something like this:
> > >
> > > JaxpParser respParser = new JaxpParser();
> > > respParser.parse( new InputSource(new StringReader(str)),
> > > new EmbeddedXMLPipe(contentHandler));
> > >
> > > Which fails giving this:
> > > org.apache.cocoon.ProcessingException: Failed to execute pipeline.:
> > > java.lang.ClassCastException
> > > ...
> > > Caused by: java.lang.ClassCastException
> > > at
> > >
> > >
> > com.lucamorandini.charts.ChartTransformer.endElement(ChartTransfor
> > mer.java:6
> > > 55)
> > > at
> > >
> > >
> > org.apache.cocoon.components.sax.XMLByteStreamInterpreter.parse(XM
> > LByteStrea
> > > mInterpreter.java:129)
> > > at
> > >
> > >
> > org.apache.cocoon.components.sax.XMLByteStreamInterpreter.deserial
> > ize(XMLByt
> > > eStreamInterpreter.java:102)
> > > at
> > > org.apache.cocoon.components.pipeline.CachingEventPipeline.process
> > > (CachingEventPipeline.java:219)
> > > ... 44 more
> > >
> > > java.lang.ClassCastException
> > > at
> > >
> > >
> > com.lucamorandini.charts.ChartTransformer.endElement(ChartTransfor
> > mer.java:6
> > > 55)
> > > at
> > >
> > >
> > org.apache.cocoon.components.sax.XMLByteStreamInterpreter.parse(XM
> > LByteStrea
> > > mInterpreter.java:129)
> > > at
> > >
> > >
> > org.apache.cocoon.components.sax.XMLByteStreamInterpreter.deserial
> > ize(XMLByt
> > > eStreamInterpreter.java:102)
> > > at
> > > org.apache.cocoon.components.pipeline.CachingEventPipeline.process
> > > (CachingEventPipeline.java:219)
> > > at
> > >
> > >
> > org.apache.cocoon.components.pipeline.CachingStreamPipeline.proces
> > s(CachingS
> > > treamPipeline.java:399)
> > >
> > > The classes we use are:
> > > org.apache.avalon.excalibur.xml.JaxpParser;
> > > org.xml.sax.InputSource;
> > > java.io.StringReader;
> > > org.apache.cocoon.xml.EmbeddedXMLPipe;
> > >
> > > And the environment is:
> > > Solaris 5.8
> > > JDK 1.4.1_01
> > > Tomcat 4.1.12-LE-jdk14
> > > Cocoon 2.0.3
> > >
> > > May someone please help us ?
> > >
> > > Thanks in advance,
> > >
> > > Piero De Nicola & Luca Morandini
> > >
> > >
> > > We are protected from the virus by Norton Antivirus
> > Corporate Edition
> > >
> > > ---------------------------------------------------------------------
> > > Please check that your question has not already been answered in the
> > > FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
> > >
> > > To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> > > For additional commands, e-mail: <[EMAIL PROTECTED]>
> > >
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > Please check that your question has not already been answered in the
> > FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
> >
> > To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> > For additional commands, e-mail: <[EMAIL PROTECTED]>
> >
>
>
> We are protected from the virus by Norton Antivirus Corporate Edition
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> For additional commands, e-mail: <[EMAIL PROTECTED]>
>
--
+++ GMX - Mail, Messaging & more http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr f�r 1 ct/ Min. surfen!
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>