Node node = new SourceTransformer().toDOMNode(me.getMessage("in").getContent()); me.getMessage("in").setContent(new DOMSource(node)); String str = DOMUtil.asXML(node);
    private void traceMessageExchange(String header, MessageExchange me) {        try {            StringBuffer sb = new StringBuffer();            sb.append(header);            sb.append(": ");            sb.append("MessageExchange[\n");            sb.append("  id: ").append(me.getExchangeId()).append('\n');            sb.append("  status: ").append(me.getStatus()).append('\n');            if (me.getMessage("in") != null) {                Node node = new SourceTransformer().toDOMNode(me.getMessage("in").getContent());                me.getMessage("in").setContent(new DOMSource(node));                String str = DOMUtil.asXML(node);                sb.append("  in: ");                if (str.length() > 150) {                    sb.append(str.substring(0, 150)).append("...");                } else {                    sb.append(str);                }                sb.append('\n');            }            if (me.getMessage("out") != null) {                Node node = new SourceTransformer().toDOMNode(me.getMessage("out").getContent());                me.getMessage("out").setContent(new DOMSource(node));                String str = DOMUtil.asXML(node);                sb.append("  out: ");                if (str.length() > 150) {                    sb.append(str.substring(0, 150)).append("...");                } else {                    sb.append(str);                }                sb.append('\n');            }            sb.append("]");            log.trace(sb.toString());        } catch (Exception e) {            log.trace("Unable to display message", e);        }    }