1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| public String transform(String xml) {
try {
if (transformer != null) {
StringReader stringReader = new StringReader(xml);
StreamSource streamSource = new StreamSource(stringReader);
StringWriter stringWriter = new StringWriter();
synchronized (transformer) {
transformer.transform(streamSource, new StreamResult(
stringWriter));//ce la ligne de l'erreur
}
return stringWriter.toString();
} else {
return xml;
}
} catch (Exception e) {
logger.error("transform error for doc "+xml + e.getMessage(),e);
return "<h2>" + e.getMessage() + "</h2>";
}
} |
Partager