Apache Camle CXF Logging< as<和>作为>

时间:2015-11-20 10:04:42

标签: logging soap cxf jbossfuse

我正在使用Apache CXF拦截器进行日志记录

<cxf:inInterceptors>
  <bean class="org.apache.cxf.interceptor.LoggingInInterceptor" />
</cxf:inInterceptors>
<cxf:outInterceptors>
  <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"  />
</cxf:outInterceptors>

但LoggingOutInterceptor以&amp; lt和&amp; gt格式记录我的交换有效载荷

像这样

&lt;firstname&gt;Chittaranjan&lt;/firstname&gt;  
&lt;lastname&gt;Panda&lt;/lastname&gt;

但我想用这种格式

<firstname>Chittaranjan</firstname>
<lastname>Panda</lastname>

1 个答案:

答案 0 :(得分:0)

如果您的示例XML本身不是无效的,那么您将看到内部xml,即XML中的XML作为文本或CDATA节点。

基本上不可能只是取消整个XML字符串,因为正确和错误编码的XML之间存在冲突。

我已经写了一个library,可让您轻松解决此问题,即go prettyPrintCData prettyPrintTextNodes