Take a look into an existing generator as base, e.g. the JSPGenerator.

There you have code like

SAXParser parser = null;
try {
  byte[] bytes = <byte array returned from JSP engine>;

InputSource input = new InputSource(new ByteArrayInputStream(bytes));

  // pipe the results into the parser
  parser = (SAXParser)this.manager.lookup(SAXParser.ROLE);
  parser.parse(input, this.xmlConsumer);
} finally {
  this.manager.release((Component)parser);
}

It's important to avoid instantiation directly, but to use the factories provided by Cocoon. Also the components should be released at the end.

Joerg

On 28.10.2003 21:36, Rui Alberto L. GonÃalves wrote:

Hi all,
I'm having some difficulties writing a custom generator.
Somewhere in the generate() method I have a String that
contains valid XML! I want to send it to the pipeline!
Does anyone know how to do this?

I tryed
--------------------------
public class MyRequestGenerator
  extends ServiceableGenerator

.......
org.xml.sax.helpers.XMLReaderAdapter
      reader_adpter = new org.xml.sax.helpers.XMLReaderAdapter();

super.setContentHandler((org.xml.sax.ContentHandler)reader_adpter);

reader_adpter.parse(new org.xml.sax.InputSource(
new java.io.CharArrayReader(str.toCharArray()));
----------------
but without success! Any help will be appreciated. Thanks.

Rui


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



Reply via email to