You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Luca Morandini <sp...@ipzs.it> on 2002/11/08 10:55:15 UTC

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(ChartTransformer.java:6
55)
  at

org.apache.cocoon.components.sax.XMLByteStreamInterpreter.parse(XMLByteStrea
mInterpreter.java:129)
  at

org.apache.cocoon.components.sax.XMLByteStreamInterpreter.deserialize(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(ChartTransformer.java:6
55)
  at

org.apache.cocoon.components.sax.XMLByteStreamInterpreter.parse(XMLByteStrea
mInterpreter.java:129)
  at

org.apache.cocoon.components.sax.XMLByteStreamInterpreter.deserialize(XMLByt
eStreamInterpreter.java:102)
  at
 org.apache.cocoon.components.pipeline.CachingEventPipeline.process
 (CachingEventPipeline.java:219)
  at

org.apache.cocoon.components.pipeline.CachingStreamPipeline.process(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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


R: R: Strings to SAX events

Posted by Luca Morandini <sp...@ipzs.it>.
Marcus,

thanks for you help, but our implementation uses a SAX Transformer.
We evaluated Wings and decided to go our own way: I hate re-inventing the
wheel, but this time I deemed it necessary.

Best regards,

Luca Morandini
lmorandini@ieee.org

> -----Messaggio originale-----
> Da: Marcus Crafter [mailto:crafterm@fztig938.bank.dresdner.net]
> Inviato: venerdì 8 novembre 2002 13.00
> A: cocoon-users@xml.apache.org
> Oggetto: Re: R: Strings to SAX events
>
>
> Hi Luca,
>
> 	Have you seen the WingsTransformer in 2.1 scratchpad ? It converts
> 	xcml (over at Krysalis) chart markup to svg which you can then give
> 	to svg2png/etc.
>
> 	I'm using it at the moment and it works quite well for pie, line
> 	and bar charts. Perhaps that might be of use, as it works nicely
> 	with Cocoon ?
>
> 	Cheers,
>
> 	Marcus
>
> On Fri, Nov 08, 2002 at 11:33:03AM +0100, Luca Morandini wrote:
> > Ludovic,
> >
> > we're writing a Transformer to produce SVG (and JPEG/PNG
> optionally) charts.
> > The idea is having the chart description and associated data in XML as
> > input, transform them, ending up with a nice SVG to be serialized.
> >
> > We're using a charting library which doesn't produce a SAX stream, but
> > outputs the SVG element as a string, hence, the need to insert this XML
> > elements in the output SAX stream.
> >
> > I hope this clears the matter :)
> >
> > Luca Morandini
> > Istituto Poligrafico e Zecca dello Stato
> > lmorandini@ieee.org
> > spectrum.morandini@ipzs.it
> >
> >
> > > -----Messaggio originale-----
> > > Da: Ludovic de Beaurepaire [mailto:ludovic.debeaurepaire@axonie.com]
> > > Inviato: venerdì 8 novembre 2002 11.26
> > > A: cocoon-users@xml.apache.org
> > > Oggetto: Re: Strings to SAX events
> > >
> > >
> > > Luca
> > >
> > > Sorry if it is NOK, but i didn't understand why you want to add
> > > XML datas in
> > > the transformer instead of in your pipeline's generator ?
> > >
> > > Ludovic
> > > ----- Original Message -----
> > > From: "Luca Morandini" <sp...@ipzs.it>
> > > To: <co...@xml.apache.org>
> > > Sent: Friday, November 08, 2002 11:11 AM
> > > Subject: R: Strings to SAX events
> > >
> > >
> > > > 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
> > > > lmorandini@ieee.org
> > > >
> > > > > -----Messaggio originale-----
> > > > > Da: Ludovic de Beaurepaire
> [mailto:ludovic.debeaurepaire@axonie.com]
> > > > > Inviato: venerdì 8 novembre 2002 11.02
> > > > > A: cocoon-users@xml.apache.org
> > > > > 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" <sp...@ipzs.it>
> > > > > To: <co...@xml.apache.org>
> > > > > 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:
> <co...@xml.apache.org>
> > > > > For additional commands, e-mail:
> <co...@xml.apache.org>
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > 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:     <co...@xml.apache.org>
> > > For additional commands, e-mail:   <co...@xml.apache.org>
> > >
> >
> >
> >      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:     <co...@xml.apache.org>
> > For additional commands, e-mail:   <co...@xml.apache.org>
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> 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:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>
>
>      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:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>

--
        .....
     ,,$$$$$$$$$,      Marcus Crafter
    ;$'      '$$$$:    Computer Systems Engineer
    $:         $$$$:   ManageSoft GmbH
     $       o_)$$$:   82-84 Mainzer Landstrasse
     ;$,    _/\ &&:'   60327 Frankfurt Germany
       '     /( &&&
           \_&&&&'
          &&&&.
    &&&&&&&:

---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>



     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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: R: Strings to SAX events

Posted by Marcus Crafter <cr...@fztig938.bank.dresdner.net>.
Hi Luca,

	Have you seen the WingsTransformer in 2.1 scratchpad ? It converts
	xcml (over at Krysalis) chart markup to svg which you can then give
	to svg2png/etc.
	
	I'm using it at the moment and it works quite well for pie, line
	and bar charts. Perhaps that might be of use, as it works nicely
	with Cocoon ?
	
	Cheers,
	
	Marcus
	
On Fri, Nov 08, 2002 at 11:33:03AM +0100, Luca Morandini wrote:
> Ludovic,
> 
> we're writing a Transformer to produce SVG (and JPEG/PNG optionally) charts.
> The idea is having the chart description and associated data in XML as
> input, transform them, ending up with a nice SVG to be serialized.
> 
> We're using a charting library which doesn't produce a SAX stream, but
> outputs the SVG element as a string, hence, the need to insert this XML
> elements in the output SAX stream.
> 
> I hope this clears the matter :)
> 
> Luca Morandini
> Istituto Poligrafico e Zecca dello Stato
> lmorandini@ieee.org
> spectrum.morandini@ipzs.it
> 
> 
> > -----Messaggio originale-----
> > Da: Ludovic de Beaurepaire [mailto:ludovic.debeaurepaire@axonie.com]
> > Inviato: venerdì 8 novembre 2002 11.26
> > A: cocoon-users@xml.apache.org
> > Oggetto: Re: Strings to SAX events
> >
> >
> > Luca
> >
> > Sorry if it is NOK, but i didn't understand why you want to add
> > XML datas in
> > the transformer instead of in your pipeline's generator ?
> >
> > Ludovic
> > ----- Original Message -----
> > From: "Luca Morandini" <sp...@ipzs.it>
> > To: <co...@xml.apache.org>
> > Sent: Friday, November 08, 2002 11:11 AM
> > Subject: R: Strings to SAX events
> >
> >
> > > 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
> > > lmorandini@ieee.org
> > >
> > > > -----Messaggio originale-----
> > > > Da: Ludovic de Beaurepaire [mailto:ludovic.debeaurepaire@axonie.com]
> > > > Inviato: venerdì 8 novembre 2002 11.02
> > > > A: cocoon-users@xml.apache.org
> > > > 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" <sp...@ipzs.it>
> > > > To: <co...@xml.apache.org>
> > > > 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:     <co...@xml.apache.org>
> > > > For additional commands, e-mail:   <co...@xml.apache.org>
> > > >
> > > >
> > > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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:     <co...@xml.apache.org>
> > > For additional commands, e-mail:   <co...@xml.apache.org>
> > >
> >
> >
> >      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:     <co...@xml.apache.org>
> > For additional commands, e-mail:   <co...@xml.apache.org>
> >
> >
> >
> 
> 
> ---------------------------------------------------------------------
> 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:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
> 
> 
>      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:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
> 

-- 
        .....
     ,,$$$$$$$$$,      Marcus Crafter
    ;$'      '$$$$:    Computer Systems Engineer
    $:         $$$$:   ManageSoft GmbH
     $       o_)$$$:   82-84 Mainzer Landstrasse
     ;$,    _/\ &&:'   60327 Frankfurt Germany
       '     /( &&&
           \_&&&&'
          &&&&.
    &&&&&&&:

---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Strings to SAX events

Posted by Ludovic de Beaurepaire <lu...@axonie.com>.
Luca

I have the same type of need to produce SVG for barcodes. I have a String
code as parameter, and an external java module to produce graphic
informations. I will do it with an Action obtaining these informations as
java objects, a generator generating corresponding XML datas
(<svg>...</svg>) . A Stylesheet transform it.
But i'm not expert, surely there are other possibilities.

Regards,

Ludovic
----- Original Message -----
From: "Luca Morandini" <sp...@ipzs.it>
To: <co...@xml.apache.org>
Sent: Friday, November 08, 2002 11:33 AM
Subject: R: Strings to SAX events


> Ludovic,
>
> we're writing a Transformer to produce SVG (and JPEG/PNG optionally)
charts.
> The idea is having the chart description and associated data in XML as
> input, transform them, ending up with a nice SVG to be serialized.
>
> We're using a charting library which doesn't produce a SAX stream, but
> outputs the SVG element as a string, hence, the need to insert this XML
> elements in the output SAX stream.
>
> I hope this clears the matter :)
>
> Luca Morandini
> Istituto Poligrafico e Zecca dello Stato
> lmorandini@ieee.org
> spectrum.morandini@ipzs.it
>
>
> > -----Messaggio originale-----
> > Da: Ludovic de Beaurepaire [mailto:ludovic.debeaurepaire@axonie.com]
> > Inviato: venerdì 8 novembre 2002 11.26
> > A: cocoon-users@xml.apache.org
> > Oggetto: Re: Strings to SAX events
> >
> >
> > Luca
> >
> > Sorry if it is NOK, but i didn't understand why you want to add
> > XML datas in
> > the transformer instead of in your pipeline's generator ?
> >
> > Ludovic
> > ----- Original Message -----
> > From: "Luca Morandini" <sp...@ipzs.it>
> > To: <co...@xml.apache.org>
> > Sent: Friday, November 08, 2002 11:11 AM
> > Subject: R: Strings to SAX events
> >
> >
> > > 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
> > > lmorandini@ieee.org
> > >
> > > > -----Messaggio originale-----
> > > > Da: Ludovic de Beaurepaire [mailto:ludovic.debeaurepaire@axonie.com]
> > > > Inviato: venerdì 8 novembre 2002 11.02
> > > > A: cocoon-users@xml.apache.org
> > > > 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" <sp...@ipzs.it>
> > > > To: <co...@xml.apache.org>
> > > > 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:
<co...@xml.apache.org>
> > > > For additional commands, e-mail:
<co...@xml.apache.org>
> > > >
> > > >
> > > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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:     <co...@xml.apache.org>
> > > For additional commands, e-mail:   <co...@xml.apache.org>
> > >
> >
> >
> >      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:     <co...@xml.apache.org>
> > For additional commands, e-mail:   <co...@xml.apache.org>
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> 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:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>
>
>      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:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>
>
>


---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


R: Strings to SAX events

Posted by Luca Morandini <sp...@ipzs.it>.
Ludovic,

we're writing a Transformer to produce SVG (and JPEG/PNG optionally) charts.
The idea is having the chart description and associated data in XML as
input, transform them, ending up with a nice SVG to be serialized.

We're using a charting library which doesn't produce a SAX stream, but
outputs the SVG element as a string, hence, the need to insert this XML
elements in the output SAX stream.

I hope this clears the matter :)

Luca Morandini
Istituto Poligrafico e Zecca dello Stato
lmorandini@ieee.org
spectrum.morandini@ipzs.it


> -----Messaggio originale-----
> Da: Ludovic de Beaurepaire [mailto:ludovic.debeaurepaire@axonie.com]
> Inviato: venerdì 8 novembre 2002 11.26
> A: cocoon-users@xml.apache.org
> Oggetto: Re: Strings to SAX events
>
>
> Luca
>
> Sorry if it is NOK, but i didn't understand why you want to add
> XML datas in
> the transformer instead of in your pipeline's generator ?
>
> Ludovic
> ----- Original Message -----
> From: "Luca Morandini" <sp...@ipzs.it>
> To: <co...@xml.apache.org>
> Sent: Friday, November 08, 2002 11:11 AM
> Subject: R: Strings to SAX events
>
>
> > 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
> > lmorandini@ieee.org
> >
> > > -----Messaggio originale-----
> > > Da: Ludovic de Beaurepaire [mailto:ludovic.debeaurepaire@axonie.com]
> > > Inviato: venerdì 8 novembre 2002 11.02
> > > A: cocoon-users@xml.apache.org
> > > 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" <sp...@ipzs.it>
> > > To: <co...@xml.apache.org>
> > > 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:     <co...@xml.apache.org>
> > > For additional commands, e-mail:   <co...@xml.apache.org>
> > >
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > 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:     <co...@xml.apache.org>
> > For additional commands, e-mail:   <co...@xml.apache.org>
> >
>
>
>      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:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>
>
>


---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


     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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Strings to SAX events

Posted by Ludovic de Beaurepaire <lu...@axonie.com>.
Luca

Sorry if it is NOK, but i didn't understand why you want to add XML datas in
the transformer instead of in your pipeline's generator ?

Ludovic
----- Original Message -----
From: "Luca Morandini" <sp...@ipzs.it>
To: <co...@xml.apache.org>
Sent: Friday, November 08, 2002 11:11 AM
Subject: R: Strings to SAX events


> 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
> lmorandini@ieee.org
>
> > -----Messaggio originale-----
> > Da: Ludovic de Beaurepaire [mailto:ludovic.debeaurepaire@axonie.com]
> > Inviato: venerdì 8 novembre 2002 11.02
> > A: cocoon-users@xml.apache.org
> > 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" <sp...@ipzs.it>
> > To: <co...@xml.apache.org>
> > 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:     <co...@xml.apache.org>
> > > For additional commands, e-mail:   <co...@xml.apache.org>
> > >
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > 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:     <co...@xml.apache.org>
> > For additional commands, e-mail:   <co...@xml.apache.org>
> >
>
>
>      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:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>
>
>


---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: R: Strings to SAX events

Posted by Damian Chojna <d....@adv.pl>.
Thanks for your suggestion Ludovic, it works really well!!

Damian.


Ludovic de Beaurepaire wrote:

>Hi Damian,
>
>Perhaps it helps : If you are in XSP, the following tags resolve it without
>java code :
>
><?xml version="1.0" encoding="ISO-8859-1"?>
><xsp:page language="java" xmlns:xsp="http://apache.org/xsp"
>xmlns:util="http://apache.org/xsp/util/2.0">
>...
><util:include-expr>
><util:expr><xsp:expr>
>yourXMLString
></xsp:expr></util:expr>
></util:include-expr>
>...
>
>Regards,
>
>Ludovic
>
>----- Original Message -----
>From: "Damian Chojna" <d....@adv.pl>
>To: <co...@xml.apache.org>
>Sent: Thursday, November 14, 2002 6:02 PM
>Subject: Re: R: Strings to SAX events
>
>
>>Hi Reinhard,
>>
>>thanks for the last post. I also need to add a string as XML elements
>>into an XSP generator and I used your suggestion (below). It seems
>>to work well, but I have two questions:
>>
>>1) I've noticed that the API states that the Parser is deprecated. I'm
>>currently using 2.0.3, if I choose to use this method will it effect me
>>being able to move to a newer version of cocoon at some time in the
>>
>future?
>
>>2) When I generate my XML elements it seems that the parser is including
>>the <?xml version="1.0" encoding="UTF-8"?> header. Is there a way to get
>>the parser not to include it, as it is causing me problems?
>>
>>Thanks in advance!
>>Damian.
>>
>>
>>
>>
>>reinhard_poetz@gmx.net wrote:
>>
>>>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
>>>
>>
>>
>>
>>---------------------------------------------------------------------
>>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:     <co...@xml.apache.org>
>>For additional commands, e-mail:   <co...@xml.apache.org>
>>
>>
>>
>
>
>---------------------------------------------------------------------
>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:     <co...@xml.apache.org>
>For additional commands, e-mail:   <co...@xml.apache.org>
>
>.
>




---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: R: Strings to SAX events

Posted by Ludovic de Beaurepaire <lu...@axonie.com>.
Hi Damian,

Perhaps it helps : If you are in XSP, the following tags resolve it without
java code :

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsp:page language="java" xmlns:xsp="http://apache.org/xsp"
xmlns:util="http://apache.org/xsp/util/2.0">
...
<util:include-expr>
<util:expr><xsp:expr>
yourXMLString
</xsp:expr></util:expr>
</util:include-expr>
...

Regards,

Ludovic

----- Original Message -----
From: "Damian Chojna" <d....@adv.pl>
To: <co...@xml.apache.org>
Sent: Thursday, November 14, 2002 6:02 PM
Subject: Re: R: Strings to SAX events


> Hi Reinhard,
>
> thanks for the last post. I also need to add a string as XML elements
> into an XSP generator and I used your suggestion (below). It seems
> to work well, but I have two questions:
>
> 1) I've noticed that the API states that the Parser is deprecated. I'm
> currently using 2.0.3, if I choose to use this method will it effect me
> being able to move to a newer version of cocoon at some time in the
future?
>
> 2) When I generate my XML elements it seems that the parser is including
> the <?xml version="1.0" encoding="UTF-8"?> header. Is there a way to get
> the parser not to include it, as it is causing me problems?
>
> Thanks in advance!
> Damian.
>
>
>
>
> reinhard_poetz@gmx.net wrote:
>
> > 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
>
>
>
>
> ---------------------------------------------------------------------
> 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:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>
>
>


---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: R: Strings to SAX events

Posted by Reinhard Poetz <re...@gmx.net>.

> -----Original Message-----
> From: Damian Chojna [mailto:d.chojna@adv.pl]
> Sent: Thursday, November 14, 2002 6:02 PM
> To: cocoon-users@xml.apache.org
> Subject: Re: R: Strings to SAX events
>
>
> Hi Reinhard,
>
> thanks for the last post. I also need to add a string as XML elements
> into an XSP generator and I used your suggestion (below). It seems
> to work well, but I have two questions:
>
> 1) I've noticed that the API states that the Parser is deprecated. I'm
> currently using 2.0.3, if I choose to use this method will it effect me
> being able to move to a newer version of cocoon at some time in
> the future?

Yep, you are right. I developed the component long time ago ... Please try
org.apache.avalon.excalibur.xml.JaxpParser.

>
> 2) When I generate my XML elements it seems that the parser is including
> the <?xml version="1.0" encoding="UTF-8"?> header. Is there a way to get
> the parser not to include it, as it is causing me problems?

Currently there is a problem with the encoding (always UTF-8 encoding is
used) when you use Xalan. As far as I know those problem don't arise if you
use Saxon.

I don't know how you can remove the processing instruction.

Regards,
Reinhard

>
> Thanks in advance!
> Damian.
>
>
>
>
> reinhard_poetz@gmx.net wrote:
>
> > 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
>
>
>
>
> ---------------------------------------------------------------------
> 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:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>


---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: R: Strings to SAX events

Posted by Damian Chojna <d....@adv.pl>.
Hi Reinhard,

thanks for the last post. I also need to add a string as XML elements 
into an XSP generator and I used your suggestion (below). It seems
to work well, but I have two questions:

1) I've noticed that the API states that the Parser is deprecated. I'm 
currently using 2.0.3, if I choose to use this method will it effect me 
being able to move to a newer version of cocoon at some time in the future?

2) When I generate my XML elements it seems that the parser is including 
the <?xml version="1.0" encoding="UTF-8"?> header. Is there a way to get 
the parser not to include it, as it is causing me problems?

Thanks in advance!
Damian.




reinhard_poetz@gmx.net wrote:

> 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




---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: R: Strings to SAX events

Posted by re...@gmx.net.
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
> lmorandini@ieee.org
> 
> > -----Messaggio originale-----
> > Da: Ludovic de Beaurepaire [mailto:ludovic.debeaurepaire@axonie.com]
> > Inviato: venerdì 8 novembre 2002 11.02
> > A: cocoon-users@xml.apache.org
> > 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" <sp...@ipzs.it>
> > To: <co...@xml.apache.org>
> > 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:     <co...@xml.apache.org>
> > > For additional commands, e-mail:   <co...@xml.apache.org>
> > >
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > 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:     <co...@xml.apache.org>
> > For additional commands, e-mail:   <co...@xml.apache.org>
> >
> 
> 
>      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:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
> 

-- 
+++ 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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


R: Strings to SAX events

Posted by Luca Morandini <sp...@ipzs.it>.
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
lmorandini@ieee.org

> -----Messaggio originale-----
> Da: Ludovic de Beaurepaire [mailto:ludovic.debeaurepaire@axonie.com]
> Inviato: venerdì 8 novembre 2002 11.02
> A: cocoon-users@xml.apache.org
> 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" <sp...@ipzs.it>
> To: <co...@xml.apache.org>
> 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:     <co...@xml.apache.org>
> > For additional commands, e-mail:   <co...@xml.apache.org>
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> 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:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>


     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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Strings to SAX events

Posted by Ludovic de Beaurepaire <lu...@axonie.com>.
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" <sp...@ipzs.it>
To: <co...@xml.apache.org>
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(ChartTransformer.java:6
> 55)
>   at
>
>
org.apache.cocoon.components.sax.XMLByteStreamInterpreter.parse(XMLByteStrea
> mInterpreter.java:129)
>   at
>
>
org.apache.cocoon.components.sax.XMLByteStreamInterpreter.deserialize(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(ChartTransformer.java:6
> 55)
>   at
>
>
org.apache.cocoon.components.sax.XMLByteStreamInterpreter.parse(XMLByteStrea
> mInterpreter.java:129)
>   at
>
>
org.apache.cocoon.components.sax.XMLByteStreamInterpreter.deserialize(XMLByt
> eStreamInterpreter.java:102)
>   at
>  org.apache.cocoon.components.pipeline.CachingEventPipeline.process
>  (CachingEventPipeline.java:219)
>   at
>
>
org.apache.cocoon.components.pipeline.CachingStreamPipeline.process(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:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>
>
>


---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>