165.10. 格式的 XMLmarshalling(pretty-printing)

使用 prettyPrint 选项时,可以输出一个格式良好的 XML:

 <dataFormats>
      <jacksonxml id="jack" prettyPrint="true"/>
 </dataFormats>

在 Java DSL 中:

from("direct:inPretty").marshal().jacksonxml(true);

请注意,有 5 种不同的 overloaded jacksonxml () DSL 方法,它支持 pretty打印 选项,与 unmarshalType、 jsonView 等的其他设置相结合。