Listing 9-20. Spring's OXM Library Maven Dependency
Note Although Spring Batch considers itself compatible with Spring 3, and you're using Spring 3 for all examples
in this topic, this is one area where it isn't compatible and depends on an older version of OXM.
With the POM updated and the job configured, you're ready to build and run formatJob to generate
XML as the output. After running a mvn clean install from the command line, you can use the
command listed in Listing 9-21 to execute the job.
Listing 9-21. Executing formatJob to Generate XML
java -jar itemWriters-0.0.1-SNAPSHOT.jar jobs/formatJob.xml formatJob
When you look at the results of the XML, notice that it was obviously generated by a library in that
there is no formatting applied. But by running it through XML Tidy, you can see clearly that the output is
what you expected. Listing 9-22 shows a sample of the generated output XML.
Listing 9-22. formatJob XML Results
<?xml version="1.0" encoding="UTF-8"?>
<address>5570 Isabella Ave</address>
With not much more than a couple lines of XML, you can easily generate XML output with the full
power of any Spring-supported XML marshaller.
The ability to process XML as both input and output is important in today's enterprise environment,
as isthe ability to process flat files. However, although files play a large part in batch processing, they