cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Horsfield, Peter A." <peter.horsfi...@ngc.com>
Subject RE: Writing transformer question!
Date Wed, 07 Jan 2004 18:12:55 GMT
Hi Rui,

What you have there seems closer to a generator than a transformer.

To filter events like startDocument you need to build your own 
XML Consumer that forwards all events onwards the original XML Consumer.

As luck would have it, theres just such a class:

	org.apache.cocoon.xml.AbstractXMLPipe

Just derive from this class and override the startDocument and endDocument
methods to do nothing. Remember to configure it with your original
XMLConsumer, of course.

http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/java/org/apache/cocoon/xml/
AbstractXMLPipe.java

Peter

-----Original Message-----
From: Rui Alberto L." Gonçalves [mailto:rui-l-goncalves@ptinovacao.pt]
Sent: Wednesday, January 07, 2004 11:14 AM
To: users@cocoon.apache.org
Subject: Writing transformer question!


Hi all,
I wrote a transformer that write and reads XML from a socket.
When a document is readed from the socket I need to fire
the corresponding events on the pipeline. For doing so
I'm using:
SAXParser parser = null;
    try
    {
      byte[] bytes = buffer.toString().getBytes();
      InputSource input = new 
		InputSource(new ByteArrayInputStream(bytes));
      parser = (SAXParser)this.manager.lookup(SAXParser.ROLE);
      parser.parse(input, this.xmlConsumer);
    }

the problem is that there are events that can't be generated again,
like "startDocument", because the events sequence on the pipeline
will be invalid!!
Does anyone have an idea how can I overcome this problem.

Thanks to all,
Rui







-- 
Rui Alberto L. Gonçalves <rui-l-goncalves@ptinovacao.pt>
PT Inovação


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message