Hi Guys,
I'm having some strange problems with a stream being closed when I do an XSL
transformation on an XML document that has an xml-stylesheet that is at a
remote location. If I instead put it locally, and and specify it as an
xsltSource, it works fine.
I have also narrowed it down to the following working...
final Document doc = stringToDocument((String) xml);
logger.debug(documentToString(doc));
xmlSource = new DOMSource(doc);
But not this...
xmlSource = new StreamSource(new StringReader((String) xml));
Any ideas why this wouldn't work?
I get a stack trace like the following; where the final "Caused by" indicates
it has a problem with the StringReader in the second example above. But, my
stringToDocument() method also does a StringReader.
Caused by: javax.xml.transform.TransformerException: java.io.IOException:
Stream closed
at
org.apache.xalan.transformer.TransformerImpl.fatalError(TransformerImpl.java:741)
at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:715)
at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1129)
at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1107)
at ca.athabascau.apas.xml.XMLUtil.xslTransformation(XMLUtil.java:226)
at ca.athabascau.apas.xml.XMLUtil.xslTransformation(XMLUtil.java:251)
at
ca.athabascau.apas.IncomingTranscripts.processTranscript(IncomingTranscripts.java:348)
at
ca.athabascau.apas.IncomingTranscripts.processWaitingTranscripts(IncomingTranscripts.java:107)
... 28 more
Caused by: java.io.IOException: Stream closed
at java.io.StringReader.ensureOpen(StringReader.java:39)
at java.io.StringReader.read(StringReader.java:73)
at
org.apache.xerces.impl.XMLEntityManager$EntityScanner.load(XMLEntityManager.java:3257)
at
org.apache.xerces.impl.XMLEntityManager$EntityScanner.skipString(XMLEntityManager.java:3017)
at
org.apache.xerces.impl.XMLDocumentScannerImpl$XMLDeclDispatcher.dispatch(XMLDocumentScannerImpl.java:577)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:333)
at
org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:524)
at
org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:580)
at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
at
org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1169)
at
org.apache.xml.dtm.ref.DTMManagerDefault.getDTM(DTMManagerDefault.java:495)
at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:658)
... 34 more
Trenton D. Adams
Systems Analyst/Web Software Engineer
Navy Penguins at your service!
Athabasca University
(780) 675-6195
:wq!
__
This communication is intended for the use of the recipient to whom it
is addressed, and may contain confidential, personal, and or privileged
information. Please contact us immediately if you are not the intended
recipient of this communication, and do not copy, distribute, or take
action relying on it. Any communications received in error, or
subsequent reply, should be deleted or destroyed.
---