You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Oscar Picasso <os...@yahoo.com> on 2004/06/05 22:06:09 UTC

Bewixt - SAXBeanWriter for a SAXSource

Hi,

I would like to transform the SAX events generated from a Bean with a
SAXBeanWriter to an arbitrary Result (DOMResult or StreamResult).

This kind of transformation is usually quite trivial. 

For example, if we use streams as source and result we could write something
like:

transformer.transform(new StreamSource(inputStream), new
StreamResult(outputStream));

Any idea of using the SAXBeanWriter to perform this kind of transformation.

I have tried many things without success. I don't see if it is possible to
create a SAXSource with the SAXBeanWriter. I have also tried several ways to
provide the ContentHandler needed by the SAXBeanWriter.

Any snippet of  code is welcome.

Oscar


	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Bewixt - SAXBeanWriter for a SAXSource

Posted by Oscar Picasso <os...@yahoo.com>.
Just found a solution to my problem. For those interested, it's quite simple.
Something like:

SAXTransformerFactory factory = (SAXTransformerFactory)
TransformerFactory.newInstance();
TransformerHandler handler = factory.newTransformerHandler();
handler.setResult(new StreamResult(System.out));
SAXBeanWriter writer = new SAXBeanWriter(handler);
writer.write(myObject);



--- Oscar Picasso <os...@yahoo.com> wrote:
> Hi,
> 
> I would like to transform the SAX events generated from a Bean with a
> SAXBeanWriter to an arbitrary Result (DOMResult or StreamResult).
> 
> This kind of transformation is usually quite trivial. 
> 
> For example, if we use streams as source and result we could write something
> like:
> 
> transformer.transform(new StreamSource(inputStream), new
> StreamResult(outputStream));
> 
> Any idea of using the SAXBeanWriter to perform this kind of transformation.
> 
> I have tried many things without success. I don't see if it is possible to
> create a SAXSource with the SAXBeanWriter. I have also tried several ways to
> provide the ContentHandler needed by the SAXBeanWriter.
> 
> Any snippet of  code is welcome.
> 
> Oscar
> 
> 
> 	
> 		
> __________________________________
> Do you Yahoo!?
> Friends.  Fun.  Try the all-new Yahoo! Messenger.
> http://messenger.yahoo.com/ 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 



	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org