EOFException when reading in streamSource from String

Joined
Dec 5, 2007
Messages
2
Reaction score
0
I have something like:

String baseXSL = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n .... "

(I want to be able to modify the XSL on the fly)

Then I create a streamSource like ...

StreamSource theXSL = new StreamSource(new ByteArrayInputStream(baseXSL.getBytes()));

for use in something like ...

Templates template = tFactory.newTemplates(theXSL);
Transformer xslTrans = template.newTransformer();

ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
Result res = new StreamResult(byteStream);

xslTrans.transform(theXML, res);

I get an:
ERROR Servlet.service() for servlet action threw exception
java.io.EOFException
when trying to build the streamSource out of the String instead of out of a filePath (which works just fine).

Any ideas?

TIA!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top