Generating XML with Java collection









up vote
0
down vote

favorite












Below is my code and I am trying to generate one
I have a excel spradsheet and I am trying to read the data and generate XML , I am struggling to create the proper method of looping to generate the XML file ,any help appreciated



ObjectFactory fct = new ObjectFactory();
ImportParams imp = fct.createImportParams();
FolderMaps fmaps = fct.createFolderMaps();
FolderMap fmap = null;

List<object> objs=new ArrayList<object>();

int numOfProduct = data.size();

System.out.println("Number of lines " + numOfProduct);
for (int i = 0; i < numOfProduct; i++)

fmap =fct.createFolderMap();

int index = 0;
for(String s: data.get(i))
String headerString = data.get(i).get(index);

System.out.println("For index " + index + "and value of row "+i+ " header string is " + headerString);
fmap.setSourceProject (data.get(i).get(0));
fmap.setSourceFolderPath (data.get(i).get(1));
Object ob = fct.createObject();
ob.setName(data.get(i).get(6));
ObjectList obl = fct.createObjectList();
obl.setSelect("all");
obl.setResolution("replace");
obl.setType(data.get(i).get(5));
obl.getObject().add(ob);
fmap.getObjectList().add(obl);



index++;


fmaps.getFolderMap().add(fmap);
imp.setFolderMaps(fmaps);


System.out.println("Size is " + imp.getFolderMaps().getFolderMap().size());


JAXBContext ctx = null;
System.out.println("Writing JAXB objects");
try
ctx = JAXBContext.newInstance("com.au");
System.out.println("Inside JAXB");
Marshaller marshaller = ctx.createMarshaller();
System.out.println("Marshal Started");
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);

marshaller.marshal(imp, System.out);

System.out.println("Marshal Completed");
marshaller.marshal(imp, new File ("C:\Users\prudra\Desktop\eclipse_workspace_64\abcjaxb.xml"));

catch (Exception e)
// TODO: handle exception
e.printStackTrace();



The following output



Writing to text file is completed...
Number of lines 7
For index 0and value of row 0 header string is Unknown
For index 1and value of row 0 header string is test
For index 2and value of row 0 header string is Unknown
For index 3and value of row 0 header string is import
For index 4and value of row 0 header string is truth
For index 5and value of row 0 header string is Application
For index 6and value of row 0 header string is all
For index 7and value of row 0 header string is replace
For index 8and value of row 0 header string is App_Hive_Incremental_Simple
For index 0and value of row 1 header string is Unknown
For index 1and value of row 1 header string is test
For index 2and value of row 1 header string is Unknown
For index 3and value of row 1 header string is import
For index 4and value of row 1 header string is truth
For index 5and value of row 1 header string is Workflow
For index 6and value of row 1 header string is all
For index 7and value of row 1 header string is replace
For index 8and value of row 1 header string is wf_Hive_Incremental_Simple
For index 0and value of row 2 header string is Unknown
For index 1and value of row 2 header string is test
For index 2and value of row 2 header string is Unknown
For index 3and value of row 2 header string is import
For index 4and value of row 2 header string is truth
For index 5and value of row 2 header string is mapping
For index 6and value of row 2 header string is m_Get_Max_Loaded_Value
For index 0and value of row 3 header string is Unknown
For index 1and value of row 3 header string is test
For index 2and value of row 3 header string is Unknown
For index 3and value of row 3 header string is import
For index 4and value of row 3 header string is truth
For index 5and value of row 3 header string is mapping
For index 6and value of row 3 header string is m_Hive_Incremental_Read
For index 0and value of row 4 header string is Unknown
For index 1and value of row 4 header string is test
For index 2and value of row 4 header string is Unknown
For index 3and value of row 4 header string is import
For index 4and value of row 4 header string is truth
For index 5and value of row 4 header string is Relational Data Object
For index 6and value of row 4 header string is student_data_target
For index 0and value of row 5 header string is Unknown
For index 1and value of row 5 header string is test
For index 2and value of row 5 header string is Unknown
For index 3and value of row 5 header string is import
For index 4and value of row 5 header string is truth
For index 5and value of row 5 header string is Flat File Data Object
For index 6and value of row 5 header string is studentdata
For index 0and value of row 6 header string is Unknown
For index 1and value of row 6 header string is test
For index 2and value of row 6 header string is Unknown
For index 3and value of row 6 header string is import
For index 4and value of row 6 header string is truth
For index 5and value of row 6 header string is Flat File Data Object
For index 6and value of row 6 header string is ff_temp
Size is 1
Writing JAXB objects
Inside JAXB
Marshal Started
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<importParams xmlns="http://www.informatica.com/oie/importControl/9">
<folderMaps>
<folderMap sourceProject="Unknown" sourceFolderPath="test">
<objectList type="Flat File Data Object" select="all" resolution="replace">
<object name="ff_temp"/>
</objectList>
<objectList type="Flat File Data Object" select="all" resolution="replace">
<object name="ff_temp"/>
</objectList>
<objectList type="Flat File Data Object" select="all" resolution="replace">
<object name="ff_temp"/>
</objectList>
<objectList type="Flat File Data Object" select="all" resolution="replace">
<object name="ff_temp"/>
</objectList>
<objectList type="Flat File Data Object" select="all" resolution="replace">
<object name="ff_temp"/>
</objectList>
<objectList type="Flat File Data Object" select="all" resolution="replace">
<object name="ff_temp"/>
</objectList>
<objectList type="Flat File Data Object" select="all" resolution="replace">
<object name="ff_temp"/>
</objectList>
</folderMap>
</folderMaps>
</importParams>
Marshal Completed


As we can see the XML only generating the elements from last row of excel ,attach is the excel input



enter image description here



Below is the output I am trying to achieve



<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<importParams xmlns="http://www.informatica.com/oie/importControl/9">
<folderMaps>
<folderMap sourceProject="Unknown" sourceFolderPath="test">
<objectList type="Application" select="all" resolution="replace">
<object name="App_Hive_Incremental"/>
</objectList>
<objectList type="Workflow" select="all" resolution="replace">
<object name="wf_hive_incremental"/>
</objectList>
<objectList type="mapping" select="all" resolution="replace">
<object name="m_Get_Max_Loaded_Value"/>
</objectList>
<objectList type="mapping" select="all" resolution="replace">
<object name="m_Hive_Incremental_Read"/>
</objectList>
<objectList type="Relational Data Object" select="all" resolution="replace">
<object name="student_data_target"/>
</objectList>
<objectList type="Flat File Data Object" select="all" resolution="replace">
<object name="Student_Data"/>
</objectList>
<objectList type="Flat File Data Object" select="all" resolution="replace">
<object name="ff_temp"/>
</objectList>
</folderMap>
</folderMaps>
</importParams>









share|improve this question

























    up vote
    0
    down vote

    favorite












    Below is my code and I am trying to generate one
    I have a excel spradsheet and I am trying to read the data and generate XML , I am struggling to create the proper method of looping to generate the XML file ,any help appreciated



    ObjectFactory fct = new ObjectFactory();
    ImportParams imp = fct.createImportParams();
    FolderMaps fmaps = fct.createFolderMaps();
    FolderMap fmap = null;

    List<object> objs=new ArrayList<object>();

    int numOfProduct = data.size();

    System.out.println("Number of lines " + numOfProduct);
    for (int i = 0; i < numOfProduct; i++)

    fmap =fct.createFolderMap();

    int index = 0;
    for(String s: data.get(i))
    String headerString = data.get(i).get(index);

    System.out.println("For index " + index + "and value of row "+i+ " header string is " + headerString);
    fmap.setSourceProject (data.get(i).get(0));
    fmap.setSourceFolderPath (data.get(i).get(1));
    Object ob = fct.createObject();
    ob.setName(data.get(i).get(6));
    ObjectList obl = fct.createObjectList();
    obl.setSelect("all");
    obl.setResolution("replace");
    obl.setType(data.get(i).get(5));
    obl.getObject().add(ob);
    fmap.getObjectList().add(obl);



    index++;


    fmaps.getFolderMap().add(fmap);
    imp.setFolderMaps(fmaps);


    System.out.println("Size is " + imp.getFolderMaps().getFolderMap().size());


    JAXBContext ctx = null;
    System.out.println("Writing JAXB objects");
    try
    ctx = JAXBContext.newInstance("com.au");
    System.out.println("Inside JAXB");
    Marshaller marshaller = ctx.createMarshaller();
    System.out.println("Marshal Started");
    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);

    marshaller.marshal(imp, System.out);

    System.out.println("Marshal Completed");
    marshaller.marshal(imp, new File ("C:\Users\prudra\Desktop\eclipse_workspace_64\abcjaxb.xml"));

    catch (Exception e)
    // TODO: handle exception
    e.printStackTrace();



    The following output



    Writing to text file is completed...
    Number of lines 7
    For index 0and value of row 0 header string is Unknown
    For index 1and value of row 0 header string is test
    For index 2and value of row 0 header string is Unknown
    For index 3and value of row 0 header string is import
    For index 4and value of row 0 header string is truth
    For index 5and value of row 0 header string is Application
    For index 6and value of row 0 header string is all
    For index 7and value of row 0 header string is replace
    For index 8and value of row 0 header string is App_Hive_Incremental_Simple
    For index 0and value of row 1 header string is Unknown
    For index 1and value of row 1 header string is test
    For index 2and value of row 1 header string is Unknown
    For index 3and value of row 1 header string is import
    For index 4and value of row 1 header string is truth
    For index 5and value of row 1 header string is Workflow
    For index 6and value of row 1 header string is all
    For index 7and value of row 1 header string is replace
    For index 8and value of row 1 header string is wf_Hive_Incremental_Simple
    For index 0and value of row 2 header string is Unknown
    For index 1and value of row 2 header string is test
    For index 2and value of row 2 header string is Unknown
    For index 3and value of row 2 header string is import
    For index 4and value of row 2 header string is truth
    For index 5and value of row 2 header string is mapping
    For index 6and value of row 2 header string is m_Get_Max_Loaded_Value
    For index 0and value of row 3 header string is Unknown
    For index 1and value of row 3 header string is test
    For index 2and value of row 3 header string is Unknown
    For index 3and value of row 3 header string is import
    For index 4and value of row 3 header string is truth
    For index 5and value of row 3 header string is mapping
    For index 6and value of row 3 header string is m_Hive_Incremental_Read
    For index 0and value of row 4 header string is Unknown
    For index 1and value of row 4 header string is test
    For index 2and value of row 4 header string is Unknown
    For index 3and value of row 4 header string is import
    For index 4and value of row 4 header string is truth
    For index 5and value of row 4 header string is Relational Data Object
    For index 6and value of row 4 header string is student_data_target
    For index 0and value of row 5 header string is Unknown
    For index 1and value of row 5 header string is test
    For index 2and value of row 5 header string is Unknown
    For index 3and value of row 5 header string is import
    For index 4and value of row 5 header string is truth
    For index 5and value of row 5 header string is Flat File Data Object
    For index 6and value of row 5 header string is studentdata
    For index 0and value of row 6 header string is Unknown
    For index 1and value of row 6 header string is test
    For index 2and value of row 6 header string is Unknown
    For index 3and value of row 6 header string is import
    For index 4and value of row 6 header string is truth
    For index 5and value of row 6 header string is Flat File Data Object
    For index 6and value of row 6 header string is ff_temp
    Size is 1
    Writing JAXB objects
    Inside JAXB
    Marshal Started
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <importParams xmlns="http://www.informatica.com/oie/importControl/9">
    <folderMaps>
    <folderMap sourceProject="Unknown" sourceFolderPath="test">
    <objectList type="Flat File Data Object" select="all" resolution="replace">
    <object name="ff_temp"/>
    </objectList>
    <objectList type="Flat File Data Object" select="all" resolution="replace">
    <object name="ff_temp"/>
    </objectList>
    <objectList type="Flat File Data Object" select="all" resolution="replace">
    <object name="ff_temp"/>
    </objectList>
    <objectList type="Flat File Data Object" select="all" resolution="replace">
    <object name="ff_temp"/>
    </objectList>
    <objectList type="Flat File Data Object" select="all" resolution="replace">
    <object name="ff_temp"/>
    </objectList>
    <objectList type="Flat File Data Object" select="all" resolution="replace">
    <object name="ff_temp"/>
    </objectList>
    <objectList type="Flat File Data Object" select="all" resolution="replace">
    <object name="ff_temp"/>
    </objectList>
    </folderMap>
    </folderMaps>
    </importParams>
    Marshal Completed


    As we can see the XML only generating the elements from last row of excel ,attach is the excel input



    enter image description here



    Below is the output I am trying to achieve



    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <importParams xmlns="http://www.informatica.com/oie/importControl/9">
    <folderMaps>
    <folderMap sourceProject="Unknown" sourceFolderPath="test">
    <objectList type="Application" select="all" resolution="replace">
    <object name="App_Hive_Incremental"/>
    </objectList>
    <objectList type="Workflow" select="all" resolution="replace">
    <object name="wf_hive_incremental"/>
    </objectList>
    <objectList type="mapping" select="all" resolution="replace">
    <object name="m_Get_Max_Loaded_Value"/>
    </objectList>
    <objectList type="mapping" select="all" resolution="replace">
    <object name="m_Hive_Incremental_Read"/>
    </objectList>
    <objectList type="Relational Data Object" select="all" resolution="replace">
    <object name="student_data_target"/>
    </objectList>
    <objectList type="Flat File Data Object" select="all" resolution="replace">
    <object name="Student_Data"/>
    </objectList>
    <objectList type="Flat File Data Object" select="all" resolution="replace">
    <object name="ff_temp"/>
    </objectList>
    </folderMap>
    </folderMaps>
    </importParams>









    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Below is my code and I am trying to generate one
      I have a excel spradsheet and I am trying to read the data and generate XML , I am struggling to create the proper method of looping to generate the XML file ,any help appreciated



      ObjectFactory fct = new ObjectFactory();
      ImportParams imp = fct.createImportParams();
      FolderMaps fmaps = fct.createFolderMaps();
      FolderMap fmap = null;

      List<object> objs=new ArrayList<object>();

      int numOfProduct = data.size();

      System.out.println("Number of lines " + numOfProduct);
      for (int i = 0; i < numOfProduct; i++)

      fmap =fct.createFolderMap();

      int index = 0;
      for(String s: data.get(i))
      String headerString = data.get(i).get(index);

      System.out.println("For index " + index + "and value of row "+i+ " header string is " + headerString);
      fmap.setSourceProject (data.get(i).get(0));
      fmap.setSourceFolderPath (data.get(i).get(1));
      Object ob = fct.createObject();
      ob.setName(data.get(i).get(6));
      ObjectList obl = fct.createObjectList();
      obl.setSelect("all");
      obl.setResolution("replace");
      obl.setType(data.get(i).get(5));
      obl.getObject().add(ob);
      fmap.getObjectList().add(obl);



      index++;


      fmaps.getFolderMap().add(fmap);
      imp.setFolderMaps(fmaps);


      System.out.println("Size is " + imp.getFolderMaps().getFolderMap().size());


      JAXBContext ctx = null;
      System.out.println("Writing JAXB objects");
      try
      ctx = JAXBContext.newInstance("com.au");
      System.out.println("Inside JAXB");
      Marshaller marshaller = ctx.createMarshaller();
      System.out.println("Marshal Started");
      marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);

      marshaller.marshal(imp, System.out);

      System.out.println("Marshal Completed");
      marshaller.marshal(imp, new File ("C:\Users\prudra\Desktop\eclipse_workspace_64\abcjaxb.xml"));

      catch (Exception e)
      // TODO: handle exception
      e.printStackTrace();



      The following output



      Writing to text file is completed...
      Number of lines 7
      For index 0and value of row 0 header string is Unknown
      For index 1and value of row 0 header string is test
      For index 2and value of row 0 header string is Unknown
      For index 3and value of row 0 header string is import
      For index 4and value of row 0 header string is truth
      For index 5and value of row 0 header string is Application
      For index 6and value of row 0 header string is all
      For index 7and value of row 0 header string is replace
      For index 8and value of row 0 header string is App_Hive_Incremental_Simple
      For index 0and value of row 1 header string is Unknown
      For index 1and value of row 1 header string is test
      For index 2and value of row 1 header string is Unknown
      For index 3and value of row 1 header string is import
      For index 4and value of row 1 header string is truth
      For index 5and value of row 1 header string is Workflow
      For index 6and value of row 1 header string is all
      For index 7and value of row 1 header string is replace
      For index 8and value of row 1 header string is wf_Hive_Incremental_Simple
      For index 0and value of row 2 header string is Unknown
      For index 1and value of row 2 header string is test
      For index 2and value of row 2 header string is Unknown
      For index 3and value of row 2 header string is import
      For index 4and value of row 2 header string is truth
      For index 5and value of row 2 header string is mapping
      For index 6and value of row 2 header string is m_Get_Max_Loaded_Value
      For index 0and value of row 3 header string is Unknown
      For index 1and value of row 3 header string is test
      For index 2and value of row 3 header string is Unknown
      For index 3and value of row 3 header string is import
      For index 4and value of row 3 header string is truth
      For index 5and value of row 3 header string is mapping
      For index 6and value of row 3 header string is m_Hive_Incremental_Read
      For index 0and value of row 4 header string is Unknown
      For index 1and value of row 4 header string is test
      For index 2and value of row 4 header string is Unknown
      For index 3and value of row 4 header string is import
      For index 4and value of row 4 header string is truth
      For index 5and value of row 4 header string is Relational Data Object
      For index 6and value of row 4 header string is student_data_target
      For index 0and value of row 5 header string is Unknown
      For index 1and value of row 5 header string is test
      For index 2and value of row 5 header string is Unknown
      For index 3and value of row 5 header string is import
      For index 4and value of row 5 header string is truth
      For index 5and value of row 5 header string is Flat File Data Object
      For index 6and value of row 5 header string is studentdata
      For index 0and value of row 6 header string is Unknown
      For index 1and value of row 6 header string is test
      For index 2and value of row 6 header string is Unknown
      For index 3and value of row 6 header string is import
      For index 4and value of row 6 header string is truth
      For index 5and value of row 6 header string is Flat File Data Object
      For index 6and value of row 6 header string is ff_temp
      Size is 1
      Writing JAXB objects
      Inside JAXB
      Marshal Started
      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <importParams xmlns="http://www.informatica.com/oie/importControl/9">
      <folderMaps>
      <folderMap sourceProject="Unknown" sourceFolderPath="test">
      <objectList type="Flat File Data Object" select="all" resolution="replace">
      <object name="ff_temp"/>
      </objectList>
      <objectList type="Flat File Data Object" select="all" resolution="replace">
      <object name="ff_temp"/>
      </objectList>
      <objectList type="Flat File Data Object" select="all" resolution="replace">
      <object name="ff_temp"/>
      </objectList>
      <objectList type="Flat File Data Object" select="all" resolution="replace">
      <object name="ff_temp"/>
      </objectList>
      <objectList type="Flat File Data Object" select="all" resolution="replace">
      <object name="ff_temp"/>
      </objectList>
      <objectList type="Flat File Data Object" select="all" resolution="replace">
      <object name="ff_temp"/>
      </objectList>
      <objectList type="Flat File Data Object" select="all" resolution="replace">
      <object name="ff_temp"/>
      </objectList>
      </folderMap>
      </folderMaps>
      </importParams>
      Marshal Completed


      As we can see the XML only generating the elements from last row of excel ,attach is the excel input



      enter image description here



      Below is the output I am trying to achieve



      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <importParams xmlns="http://www.informatica.com/oie/importControl/9">
      <folderMaps>
      <folderMap sourceProject="Unknown" sourceFolderPath="test">
      <objectList type="Application" select="all" resolution="replace">
      <object name="App_Hive_Incremental"/>
      </objectList>
      <objectList type="Workflow" select="all" resolution="replace">
      <object name="wf_hive_incremental"/>
      </objectList>
      <objectList type="mapping" select="all" resolution="replace">
      <object name="m_Get_Max_Loaded_Value"/>
      </objectList>
      <objectList type="mapping" select="all" resolution="replace">
      <object name="m_Hive_Incremental_Read"/>
      </objectList>
      <objectList type="Relational Data Object" select="all" resolution="replace">
      <object name="student_data_target"/>
      </objectList>
      <objectList type="Flat File Data Object" select="all" resolution="replace">
      <object name="Student_Data"/>
      </objectList>
      <objectList type="Flat File Data Object" select="all" resolution="replace">
      <object name="ff_temp"/>
      </objectList>
      </folderMap>
      </folderMaps>
      </importParams>









      share|improve this question













      Below is my code and I am trying to generate one
      I have a excel spradsheet and I am trying to read the data and generate XML , I am struggling to create the proper method of looping to generate the XML file ,any help appreciated



      ObjectFactory fct = new ObjectFactory();
      ImportParams imp = fct.createImportParams();
      FolderMaps fmaps = fct.createFolderMaps();
      FolderMap fmap = null;

      List<object> objs=new ArrayList<object>();

      int numOfProduct = data.size();

      System.out.println("Number of lines " + numOfProduct);
      for (int i = 0; i < numOfProduct; i++)

      fmap =fct.createFolderMap();

      int index = 0;
      for(String s: data.get(i))
      String headerString = data.get(i).get(index);

      System.out.println("For index " + index + "and value of row "+i+ " header string is " + headerString);
      fmap.setSourceProject (data.get(i).get(0));
      fmap.setSourceFolderPath (data.get(i).get(1));
      Object ob = fct.createObject();
      ob.setName(data.get(i).get(6));
      ObjectList obl = fct.createObjectList();
      obl.setSelect("all");
      obl.setResolution("replace");
      obl.setType(data.get(i).get(5));
      obl.getObject().add(ob);
      fmap.getObjectList().add(obl);



      index++;


      fmaps.getFolderMap().add(fmap);
      imp.setFolderMaps(fmaps);


      System.out.println("Size is " + imp.getFolderMaps().getFolderMap().size());


      JAXBContext ctx = null;
      System.out.println("Writing JAXB objects");
      try
      ctx = JAXBContext.newInstance("com.au");
      System.out.println("Inside JAXB");
      Marshaller marshaller = ctx.createMarshaller();
      System.out.println("Marshal Started");
      marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);

      marshaller.marshal(imp, System.out);

      System.out.println("Marshal Completed");
      marshaller.marshal(imp, new File ("C:\Users\prudra\Desktop\eclipse_workspace_64\abcjaxb.xml"));

      catch (Exception e)
      // TODO: handle exception
      e.printStackTrace();



      The following output



      Writing to text file is completed...
      Number of lines 7
      For index 0and value of row 0 header string is Unknown
      For index 1and value of row 0 header string is test
      For index 2and value of row 0 header string is Unknown
      For index 3and value of row 0 header string is import
      For index 4and value of row 0 header string is truth
      For index 5and value of row 0 header string is Application
      For index 6and value of row 0 header string is all
      For index 7and value of row 0 header string is replace
      For index 8and value of row 0 header string is App_Hive_Incremental_Simple
      For index 0and value of row 1 header string is Unknown
      For index 1and value of row 1 header string is test
      For index 2and value of row 1 header string is Unknown
      For index 3and value of row 1 header string is import
      For index 4and value of row 1 header string is truth
      For index 5and value of row 1 header string is Workflow
      For index 6and value of row 1 header string is all
      For index 7and value of row 1 header string is replace
      For index 8and value of row 1 header string is wf_Hive_Incremental_Simple
      For index 0and value of row 2 header string is Unknown
      For index 1and value of row 2 header string is test
      For index 2and value of row 2 header string is Unknown
      For index 3and value of row 2 header string is import
      For index 4and value of row 2 header string is truth
      For index 5and value of row 2 header string is mapping
      For index 6and value of row 2 header string is m_Get_Max_Loaded_Value
      For index 0and value of row 3 header string is Unknown
      For index 1and value of row 3 header string is test
      For index 2and value of row 3 header string is Unknown
      For index 3and value of row 3 header string is import
      For index 4and value of row 3 header string is truth
      For index 5and value of row 3 header string is mapping
      For index 6and value of row 3 header string is m_Hive_Incremental_Read
      For index 0and value of row 4 header string is Unknown
      For index 1and value of row 4 header string is test
      For index 2and value of row 4 header string is Unknown
      For index 3and value of row 4 header string is import
      For index 4and value of row 4 header string is truth
      For index 5and value of row 4 header string is Relational Data Object
      For index 6and value of row 4 header string is student_data_target
      For index 0and value of row 5 header string is Unknown
      For index 1and value of row 5 header string is test
      For index 2and value of row 5 header string is Unknown
      For index 3and value of row 5 header string is import
      For index 4and value of row 5 header string is truth
      For index 5and value of row 5 header string is Flat File Data Object
      For index 6and value of row 5 header string is studentdata
      For index 0and value of row 6 header string is Unknown
      For index 1and value of row 6 header string is test
      For index 2and value of row 6 header string is Unknown
      For index 3and value of row 6 header string is import
      For index 4and value of row 6 header string is truth
      For index 5and value of row 6 header string is Flat File Data Object
      For index 6and value of row 6 header string is ff_temp
      Size is 1
      Writing JAXB objects
      Inside JAXB
      Marshal Started
      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <importParams xmlns="http://www.informatica.com/oie/importControl/9">
      <folderMaps>
      <folderMap sourceProject="Unknown" sourceFolderPath="test">
      <objectList type="Flat File Data Object" select="all" resolution="replace">
      <object name="ff_temp"/>
      </objectList>
      <objectList type="Flat File Data Object" select="all" resolution="replace">
      <object name="ff_temp"/>
      </objectList>
      <objectList type="Flat File Data Object" select="all" resolution="replace">
      <object name="ff_temp"/>
      </objectList>
      <objectList type="Flat File Data Object" select="all" resolution="replace">
      <object name="ff_temp"/>
      </objectList>
      <objectList type="Flat File Data Object" select="all" resolution="replace">
      <object name="ff_temp"/>
      </objectList>
      <objectList type="Flat File Data Object" select="all" resolution="replace">
      <object name="ff_temp"/>
      </objectList>
      <objectList type="Flat File Data Object" select="all" resolution="replace">
      <object name="ff_temp"/>
      </objectList>
      </folderMap>
      </folderMaps>
      </importParams>
      Marshal Completed


      As we can see the XML only generating the elements from last row of excel ,attach is the excel input



      enter image description here



      Below is the output I am trying to achieve



      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <importParams xmlns="http://www.informatica.com/oie/importControl/9">
      <folderMaps>
      <folderMap sourceProject="Unknown" sourceFolderPath="test">
      <objectList type="Application" select="all" resolution="replace">
      <object name="App_Hive_Incremental"/>
      </objectList>
      <objectList type="Workflow" select="all" resolution="replace">
      <object name="wf_hive_incremental"/>
      </objectList>
      <objectList type="mapping" select="all" resolution="replace">
      <object name="m_Get_Max_Loaded_Value"/>
      </objectList>
      <objectList type="mapping" select="all" resolution="replace">
      <object name="m_Hive_Incremental_Read"/>
      </objectList>
      <objectList type="Relational Data Object" select="all" resolution="replace">
      <object name="student_data_target"/>
      </objectList>
      <objectList type="Flat File Data Object" select="all" resolution="replace">
      <object name="Student_Data"/>
      </objectList>
      <objectList type="Flat File Data Object" select="all" resolution="replace">
      <object name="ff_temp"/>
      </objectList>
      </folderMap>
      </folderMaps>
      </importParams>






      java collections






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 11 at 11:01









      fallenbruce

      13




      13



























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53248055%2fgenerating-xml-with-java-collection%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53248055%2fgenerating-xml-with-java-collection%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          What does pagestruct do in Eviews?

          Dutch intervention in Lombok and Karangasem

          Channel Islands