我们已经要求将XML文件发送到另一个系统。我在看这个例子(它使用JAXB)。如何将多个POJO转换为所需格式的xml?
http://thomassundberg.wordpress.com/2010/01/19/how-to-convert-a-pojo-to-xml-with-jaxb/
然而,这一个转换仅单个POJO为xml而我们有多个POJO例如汽车/车轮/座椅等应该出现在XML中。
关于如何实现这一点的任何想法?
例如我想有这样的最后输出
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<car registration="abc123">
<brand>Volvo</brand>
<description>Sedan</description>
<wheel>
<brand>Ceat</brand>
</wheel>
</car>
+1 - JAXB是异常配置。这意味着你只需要提供注释来定制默认行为:http://wiki.eclipse.org/EclipseLink/Examples/MOXy/GettingStarted –
谢谢Blaise/spork ...链接上提到的示例解释了我正在寻找的内容对于。 - – Prabhjot