62.9. 格式化的 XML marshalling (pretty-printing)
使用 prettyPrint 选项时,可以在 marshalling 时输出一个格式良好的 XML:
<dataFormats>
<jacksonxml id="jack" prettyPrint="true"/>
</dataFormats>
<dataFormats>
<jacksonxml id="jack" prettyPrint="true"/>
</dataFormats>
在 Java DSL 中:
from("direct:inPretty").marshal().jacksonxml(true);
from("direct:inPretty").marshal().jacksonxml(true);
请注意,有 5 种不同的超载 jacksonxml () DSL 方法,它们支持 prettyPrint 选项和其他 unmarshalType、jsonView 等设置。