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>
java collections
add a comment |
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>
java collections
add a comment |
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>
java collections
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
java collections
asked Nov 11 at 11:01
fallenbruce
13
13
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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