Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7959183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:31:58+00:00 2026-06-04T04:31:58+00:00

I have created a spring-batch job. My reader class reads the data from the

  • 0

I have created a spring-batch job. My reader class reads the data from the DB and gives back the dataset object having the below structure.

@XmlRootElement
@XmlType(propOrder = { "start", "end", "users"})
public class DataSet implements Serializable {

    /**
     * Start datetime of this data set
     */
    private Date start;

    /**
     * End datetime of this data set
     */
    private Date end;

    /**
     * Providers involved in this data set
     */
    private List<User> users;
}

etc…… and the writer wites the above data using StaxEventItemWriter.
The resulting xml contains two root tag elements.

<root>  //added by the startDocument and endDocument methods from stax writer. 
  <DataSet>......</DataSet>  // from the dataSet xsd annotation.
</root>

i need to eliminate the with out overriding the startDocument and endDocument methods.

is there a way to do it through the configuration. its urgent please.

my writer configuartion is given below.

<bean id="testrWriter" class="com.test.writer.TestWriter"
        scope="step">
<property name="testXMLWriter" ref="testXMLWriter" />
<property name="baseDirectory" value"#{jobParameters['baseDirectory']}"></property>
</bean>

<bean id="testXMLWriter" class="org.springframework.batch.item.xml.StaxEventItemWriter">
   <property name="overwriteOutput" value="true" /> 
   <property name="marshaller" ref="testJaxb2Marshaller" /> 
</bean>

<bean id="testJaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
    <property name="classesToBeBound">
    <list>
             <value>com.test.service.dto.DataSet</value>
    </list>
   </property> 
</bean
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T04:31:59+00:00Added an answer on June 4, 2026 at 4:31 am

    I set the root to !-- --

    finally got a valid xml.

    <bean id="delegateWriter" class="org.springframework.batch.item.xml.StaxEventItemWriter">
        <property name="marshaller" ref="someMarshaller" />
        <property name="overwriteOutput" value="true" />
        <property name="RootTagName" value="!-- --"/>
    </bean>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple spring batch program which reads data from a INPUT file
I have a spring batch program which reads from a database and writes to
Background I have a Spring batch program that reads a file (example file I
I have several jobs in spring batch. The first job is kind of a
I have created the following string field for indexing. <fieldType name=short_text_for_sort class=solr.StrField omitNorms=true sortMissingLast=true
I have created a function that will return the string path from my DB.
I want to store data in string form to MySQL. I have created the
Say I have a structure like: class SomeObject Public Name as String Public Created
I have written a c# app to migrate my data from Blinksale to Freeagent.
I have some test classes that are making use of spring-batch, and hibernate. My

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.