You´ll need a XML-parser to do that. Something like that should do the trick...

import org.apache.avalon.excalibur.xml.Parser;
import org.xml.sax.InputSource;
import java.io.ByteArrayInputStream;
...
String my_string = ...
ByteArrayInputStream my_string_as_stream = new 
java.io.ByteArrayInputStream(my_string.getBytes());
InputSource input_source = new InputSource(my_string_as_stream);
Parser parser = (Parser) componentManager.lookup(Parser.ROLE);
parser.parse(input_source, xmlConsumer);
...

xmlConsumer is the transformers xmlConsumer attribute.

Your transformer must implement Composable in order to get the componentManager. 

Regards,

-Jan Harms

> -----Ursprüngliche Nachricht-----
> Von: Lionel Crine [mailto:[EMAIL PROTECTED]]
> Gesendet: Mittwoch, 5. Februar 2003 17:35
> An: [EMAIL PROTECTED]
> Betreff: convert String into Sax events into my own transformer
> 
> 
> I would like convert a String into SAX events into my transformer.
> 
> In my enddocument method i wrote :
> 
> super.character(my_String.toCharArray(), 0, myString.length());
> 
> But I don't want that because it spit text in my browser.
> I want my String to be decomposed into elements and text.
> 
> 
> Is there a way to do that ?
> 

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

Reply via email to