<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:p="http://www.springframework.org/schema/p"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:util="http://www.springframework.org/schema/util"
	xsi:schemaLocation="
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd">

	<bean id="xmlStaxJob" parent="simpleJob">
		<property name="steps">
			<bean id="step1" parent="simpleStep">
				<property name="itemReader">
					<bean
						class="org.springframework.batch.item.xml.StaxEventItemReader">
						<property name="fragmentRootElementName"
							value="trade" />
						<property name="resource"
							value="data/staxJob/input/20070918.testStream.xmlFileStep.xml" />
						<property name="fragmentDeserializer">
							<bean
								class="org.springframework.batch.item.xml.oxm.UnmarshallingEventReaderDeserializer">
								<constructor-arg>
									<bean
										class="org.springframework.oxm.xstream.XStreamMarshaller">
										<property name="aliases"
											ref="aliases" />
									</bean>
								</constructor-arg>
							</bean>
						</property>
					</bean>
				</property>
				<property name="itemWriter" ref="tradeStaxWriter" />
			</bean>
		</property>
	</bean>

	<bean class="org.springframework.batch.item.xml.StaxEventItemWriter"
		id="tradeStaxWriter">
		<property name="resource"
			value="file:target/test-outputs/20070918.testStream.xmlFileStep.output.xml" />
		<property name="serializer" ref="tradeMarshallingSerializer" />
		<property name="rootTagName" value="trades" />
		<property name="overwriteOutput" value="true" />
	</bean>

	<bean
		class="org.springframework.batch.item.xml.oxm.MarshallingEventWriterSerializer"
		id="tradeMarshallingSerializer">
		<constructor-arg>
			<bean
				class="org.springframework.oxm.xstream.XStreamMarshaller">
				<property name="aliases" ref="aliases" />
			</bean>
		</constructor-arg>
	</bean>

	<util:map id="aliases">
		<entry key="trade"
			value="org.springframework.batch.sample.domain.Trade" />
		<entry key="isin" value="java.lang.String" />
		<entry key="quantity" value="long" />
		<entry key="price" value="java.math.BigDecimal" />
		<entry key="customer" value="java.lang.String" />
	</util:map>

</beans>
