Convert a string to XML input stream in java

jobinbasani picture jobinbasani · Oct 2, 2009 · Viewed 39.7k times · Source

I'm trying to generate a PDF document using FOP and Java.

I receive the XML as a string and not as a file.

How can I convert this XML string to an XML input stream so that I can call xslfoTransformer.transform(source, res); where source is my XML string as an Input stream.

Please provide your suggestions.

Answer

Vladimir Dyuzhev picture Vladimir Dyuzhev · Oct 2, 2009
new StreamSource(new StringReader(str))