if (SAXSource.class.isAssignableFrom(type)) {
XMLStreamReader reader = StaxUtils.createXMLStreamReader((Element)input);
return new StaxSource(reader);
} else if (StreamSource.class.isAssignableFrom(type)) {
try {
CachedOutputStream out = new CachedOutputStream();
DOMUtils.writeXml(input, out);
InputStream is = out.getInputStream();
out.close();
return new StreamSource(is);
} catch (IOException e) {
throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
} catch (TransformerException e) {