Hello, I'm pretty new with using this framework. I'm having an issue while creating and xml output.
My problem is that my required xml output does not have any root tag. It looks like this...
<tag1>
<tag2>value</tag2>
<tag3>
<tag4>value</tag4>
.
.
.
<tag4>value</tag4>
</tag3>
</tag1>
I've created and object Tag1 which hast two attributes
tag2 is a String and tag3 is an object Type3 (which contains tag4 etc etc)
I've have this configuration in my xml
<bean id="diffusionItemWriter" class="org.springframework.batch.item.xml.StaxEven tItemWriter" >
<property name="rootTagName" value="tag1"/>
<property name="overwriteOutput" value="true"/>
<property name="resource" ref="outputResource" />
<property name="marshaller" ref="webSiteObjectMarshaller" />
</bean>
<bean id="webSiteObjectMarshaller" class="org.springframework.oxm.xstream.XStreamMars haller">
<property name="aliases">
<bean class="org.springframework.beans.factory.config.Ma pFactoryBean">
<property name="targetMapClass">
<value>java.util.HashMap</value>
</property>
<property name="sourceMap">
<map>
<entry key="tag1" value="com.package.Tag1" />
<entry key="tag3" value="com.package.Tag3" />
......
</map>
</property>
</bean>
</property>
</bean>
But my output looks actually like this...
<tag1>
<tag1>
<tag2>value</tag2>
<tag3>
<tag4>value</tag4>
.
.
.
<tag4>value</tag4>
</tag3>
</tag1>
</tag1>
Any help to avoid that extra tag will be much appreciated!


Reply With Quote
