You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ricardo Trindade <Ri...@myrealbox.com> on 2002/06/17 12:38:39 UTC

writing custom serializer and generator

Hi,

	I'm writing a custom serializer and generator. I've already written some
custom actions, which was easy.
	I have libraries that generate XML, and I just want my generator to get it
from there. However, I don't understant how to define the output of the
generator. I've looked at FileGenerator.java, and there's a step where a
SourceResoler is used to convert from the filename to a Source. I already
have my xml in a string, just want to send it to the generator output.

Thanks for any help
Ricardo


---------------------------------------------------------------------
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: writing custom serializer and generator

Posted by Vadim Gritsenko <va...@verizon.net>.
> From: Ricardo Trindade [mailto:Ricardo.Trindade@myrealbox.com]
> 
> where can I get the instance ? is there any particular implementation
> or factory I should use ?

You should use component manager.

See util.xsl, lines 146-152 (v 1.4 of util.xsl)

Vadim


> thanks
> 
> -----Original Message-----
> From: Vadim Gritsenko [mailto:vadim.gritsenko@verizon.net]
> Sent: terca-feira, 18 de Junho de 2002 2:49
> To: cocoon-users@xml.apache.org
> Subject: RE: writing custom serializer and generator
> 
> 
> > From: Ricardo Trindade [mailto:Ricardo.Trindade@myrealbox.com]
> >
> > could you point me to an example of converting a string to SAX 
> > events? (my string contains well formed XML)
> 
> You need an instance of org.apache.avalon.excalibur.xml.Parser, then
> convert your string to input stream and create InputSource object 
> with it, set system ID for it, set parser's consumer to generator's
> contentHandler and call parse on parser - that's it.
> 
> See util.xsl, line 146-152 (v 1.4 of util.xsl)
> 
> Vadim
> 
> 
> > thanks
> > Ricardo
> >
> > -----Original Message-----
> > From: Vadim Gritsenko [mailto:vadim.gritsenko@verizon.net]
> > Sent: segunda-feira, 17 de Junho de 2002 14:57
> > To: cocoon-users@xml.apache.org
> > Subject: RE: writing custom serializer and generator
> >
> >
> > > From: Ricardo Trindade [mailto:Ricardo.Trindade@myrealbox.com]
> > >
> > > Hi,
> > >
> > > 	I'm writing a custom serializer and generator. I've already
> > > written some
> > > custom actions, which was easy.
> > > 	I have libraries that generate XML, and I just want my 
> > > generator to get it
> > > from there. However, I don't understant how to define the output 
> > > of the
> > > generator. I've looked at FileGenerator.java, and there's a step
> > > where a
> > > SourceResoler is used to convert from the filename to a Source. 
> > > I already
> > > have my xml in a string, just want to send it to the generator
> > > output.
> >
> > You will have to covert your String into SAX XML events, Cocoon 
> > event pipeline does not work with non-XML formats.
> >
> > Use XML parser for it.
> >
> > Vadim
> >
> > >
> > > Thanks for any help
> > > Ricardo


---------------------------------------------------------------------
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: writing custom serializer and generator

Posted by Ricardo Trindade <Ri...@myrealbox.com>.
where can I get the instance ? is there any particular implementation or
factory I should use ?

thanks

-----Original Message-----
From: Vadim Gritsenko [mailto:vadim.gritsenko@verizon.net]
Sent: terca-feira, 18 de Junho de 2002 2:49
To: cocoon-users@xml.apache.org
Subject: RE: writing custom serializer and generator


> From: Ricardo Trindade [mailto:Ricardo.Trindade@myrealbox.com]
>
> could you point me to an example of converting a string to SAX events
? (my
> string contains well formed XML)

You need an instance of org.apache.avalon.excalibur.xml.Parser, then
convert your string to input stream and create InputSource object with
it, set system ID for it, set parser's consumer to generator's
contentHandler and call parse on parser - that's it.

See util.xsl, line 146-152 (v 1.4 of util.xsl)

Vadim


> thanks
> Ricardo
>
> -----Original Message-----
> From: Vadim Gritsenko [mailto:vadim.gritsenko@verizon.net]
> Sent: segunda-feira, 17 de Junho de 2002 14:57
> To: cocoon-users@xml.apache.org
> Subject: RE: writing custom serializer and generator
>
>
> > From: Ricardo Trindade [mailto:Ricardo.Trindade@myrealbox.com]
> >
> > Hi,
> >
> > 	I'm writing a custom serializer and generator. I've already
> > written some
> > custom actions, which was easy.
> > 	I have libraries that generate XML, and I just want my generator
> > to get
> > it
> > from there. However, I don't understant how to define the output of
> > the
> > generator. I've looked at FileGenerator.java, and there's a step
> > where a
> > SourceResoler is used to convert from the filename to a Source. I
> > already
> > have my xml in a string, just want to send it to the generator
output.
>
> You will have to covert your String into SAX XML events, Cocoon event
> pipeline does not work with non-XML formats.
>
> Use XML parser for it.
>
> Vadim
>
> >
> > Thanks for any help
> > Ricardo
>


---------------------------------------------------------------------
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: writing custom serializer and generator

Posted by Vadim Gritsenko <va...@verizon.net>.
> From: Ricardo Trindade [mailto:Ricardo.Trindade@myrealbox.com]
> 
> could you point me to an example of converting a string to SAX events
? (my
> string contains well formed XML)

You need an instance of org.apache.avalon.excalibur.xml.Parser, then
convert your string to input stream and create InputSource object with
it, set system ID for it, set parser's consumer to generator's
contentHandler and call parse on parser - that's it.

See util.xsl, line 146-152 (v 1.4 of util.xsl)

Vadim

 
> thanks
> Ricardo
> 
> -----Original Message-----
> From: Vadim Gritsenko [mailto:vadim.gritsenko@verizon.net]
> Sent: segunda-feira, 17 de Junho de 2002 14:57
> To: cocoon-users@xml.apache.org
> Subject: RE: writing custom serializer and generator
> 
> 
> > From: Ricardo Trindade [mailto:Ricardo.Trindade@myrealbox.com]
> >
> > Hi,
> >
> > 	I'm writing a custom serializer and generator. I've already
> > written some
> > custom actions, which was easy.
> > 	I have libraries that generate XML, and I just want my generator
> > to get
> > it
> > from there. However, I don't understant how to define the output of
> > the
> > generator. I've looked at FileGenerator.java, and there's a step 
> > where a
> > SourceResoler is used to convert from the filename to a Source. I
> > already
> > have my xml in a string, just want to send it to the generator
output.
> 
> You will have to covert your String into SAX XML events, Cocoon event
> pipeline does not work with non-XML formats.
> 
> Use XML parser for it.
> 
> Vadim
> 
> >
> > Thanks for any help
> > Ricardo
> 


---------------------------------------------------------------------
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: writing custom serializer and generator

Posted by Ricardo Trindade <Ri...@myrealbox.com>.
could you point me to an example of converting a string to SAX events ? (my
string contains well formed XML)

thanks
Ricardo

-----Original Message-----
From: Vadim Gritsenko [mailto:vadim.gritsenko@verizon.net]
Sent: segunda-feira, 17 de Junho de 2002 14:57
To: cocoon-users@xml.apache.org
Subject: RE: writing custom serializer and generator


> From: Ricardo Trindade [mailto:Ricardo.Trindade@myrealbox.com]
>
> Hi,
>
> 	I'm writing a custom serializer and generator. I've already
written some
> custom actions, which was easy.
> 	I have libraries that generate XML, and I just want my generator
to get
> it
> from there. However, I don't understant how to define the output of
the
> generator. I've looked at FileGenerator.java, and there's a step where
a
> SourceResoler is used to convert from the filename to a Source. I
already
> have my xml in a string, just want to send it to the generator output.

You will have to covert your String into SAX XML events, Cocoon event
pipeline does not work with non-XML formats.

Use XML parser for it.

Vadim

>
> Thanks for any help
> Ricardo


---------------------------------------------------------------------
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: writing custom serializer and generator

Posted by Vadim Gritsenko <va...@verizon.net>.
> From: Ricardo Trindade [mailto:Ricardo.Trindade@myrealbox.com]
> 
> Hi,
> 
> 	I'm writing a custom serializer and generator. I've already
written some
> custom actions, which was easy.
> 	I have libraries that generate XML, and I just want my generator
to get
> it
> from there. However, I don't understant how to define the output of
the
> generator. I've looked at FileGenerator.java, and there's a step where
a
> SourceResoler is used to convert from the filename to a Source. I
already
> have my xml in a string, just want to send it to the generator output.

You will have to covert your String into SAX XML events, Cocoon event
pipeline does not work with non-XML formats.

Use XML parser for it.

Vadim

> 
> Thanks for any help
> Ricardo


---------------------------------------------------------------------
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>