Spring Batch ドキュメントによると、Spring Batch は書式設定された xml ファイルを生成できましたが、失敗しました。すべての XML 要素が 1 行で生成されます。
テスト手順
- spring-batch-2.1.9.RELEASE-no-dependencies をダウンロード
- spring-*-3.2.0.RC1.jar をインポート
- jaxb-ri-2.2.6 をインポート
- org.springframework.batch.sample.iosample.XmlFunctionalTests を実行する
ジョブを実行する前に、/spring-batch-2.1.9.RELEASE-no-dependencies/spring-batch-2.1.9.RELEASE/spring-batch-samples/src/main/resources/jobs/iosample に以下の変更を加えます。 /xml.xml
<bean id="itemWriter" class="org.springframework.batch.item.xml.StaxEventItemWriter">
<property name="resource" ref="outputResource" />
<property name="marshaller" ref="customerCreditMarshaller2" />
<property name="rootTagName" value="customers" />
<property name="overwriteOutput" value="true" />
</bean>
<bean id="customerCreditMarshaller2" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="contextPaths">
<list>
<value>com.test.domain</value><!-- the package is generated from a XSD -->
</list>
</property>
<property name="marshallerProperties">
<map>
<entry key="jaxb.formatted.output"><value type="java.lang.Boolean">true</value></entry>
</map>
</property>