On Wed, 10 Oct 2007 06:54:16 -0700 (PDT), AlliumPorrum wrote
> Hi!
>
> I'm just learning how to use FOP in a servlet, and all examples and
> documents I have found show how to use URIResolver for reading the
> XML contents from a file in a web server to a Source object. Anyway
> in my case I'm not going to do so, I get this XML- document thru a
> Java interface as a String. BUT, Transformer.transform()- method
> can't take a String as a parameter, it needs a Source object.
>
> So my question is; how in a world can I create a Source object from
> a Java String?? I have googled and browsed thru API's for hours now,
> and I just can't find the solution. Or have I understood something
> completely wrong with this issue...?
>
Hello,
Look at:
javax.xml.transform.stream.StreamSource
java.io.ByteArrayInputStream
>From input String create byte[] to build ByteArrayInputStream instance which
should be used to build StreamSource instance which has to be used in
Transformer.transform(...) method ... that's it :-)
Or upload the source data as InputStream from servlet (look at Servletrequest
and HttpServletRequest) and follow previous instruction from proper point.
Pat
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]