简体   繁体   中英

how can i delete the list tag : StaxEventItemWriter

I want to generate XML file using Spring Batch (StaxEventItemWriter), but I stuck on below problem for 1 week.

Expected xml :

<RattPourUneReference>
    <DonneesPrestations>
        <Operation CdIdcDblRat="4" DtOuvDrt="1961-01-01">
        </Operation>
    </DonneesPrestations>

    <DonneesPrestations>
        <Operation CdIdcDblRat="4" DtOuvDrt="1961-01-01">
        </Operation>
    </DonneesPrestations>
</RattPourUneReference>

But i got :

<RattPourUneReference>
    <list>
    <DonneesPrestations>
        <Operation CdIdcDblRat="4" DtOuvDrt="1961-01-01">
        </Operation>
    </DonneesPrestations>

    <DonneesPrestations>
        <Operation CdIdcDblRat="4" DtOuvDrt="1961-01-01">
        </Operation>
    </DonneesPrestations>
    </list>
</RattPourUneReference>

how can i remove the list tag : <list> </list> ?

Below is the source code of my java class :

public class RattPourUneReference {


    private List<DonneesPrestations> list;

    public void setList(List<DonneesPrestations> list) {
        list= list;
    }

    public List<DonneesPrestations> getList() {
        return list;
    }

    }

Thanks in advance.

Try given below code:

public class RattPourUneReference {

private List<DonneesPrestations> donneesPrestations;

  public void setDonneesPrestations(List<DonneesPrestations> donneesPrestationsList) {
      this.donneesPrestations= donneesPrestationsList;
  }

  public List<DonneesPrestations> getDonneesPrestations() {
      return donneesPrestations;
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM