I have a XML file which contains the a parent node then child node which are more that one.So in these child nodes if there are duplicate keys both has to be merged one
<availexport>
<date>090423121513</date>
<employee emp_cd="9120004">
<day date="20050406" start="10" end="20"/>
<day date="20050406" start="21" end="23"/>
<day date="20050511" start="12" end="23"/>
</employee>
<records>3</records>
</availexport>
In this for same date here there are two records. How can I make it as one XML entry. Actually I am getting as List of all these items as KEY VALUE pairs. snippet for passing List is given
for (int k = this.employeesList.size(); k > 0; k--) {
Map empInfo1 = new HashMap();
Map empInfo = (Map) this.employeesList.remove(0);
this.empID = (Long) empInfo.get(EMP_ID);
this.hrID = (String) empInfo.get(HR_EMP_ID);
this.avail_iDate = (Long) empInfo.get(AVAIL_IDATE);
this.start_ITime = (Long) empInfo.get(START_ITIME);
this.end_ITime = (Long) empInfo.get(END_ITIME);
List availList = new ArrayList();
Map availList1 = new HashMap();
if (empAvailRecord.containsKey(empID)) {
empInfo1 = (Map) empAvailRecord.get(empID);
availList = (List) empInfo1.get("DAY");
availList1.put(AVAIL_IDATE, avail_iDate);
availList1.put(START_ITIME, start_ITime);
availList1.put(END_ITIME, end_ITime);
availList.add(availList1);
} else {
availList1.put(AVAIL_IDATE, avail_iDate);
availList1.put(START_ITIME, start_ITime);
availList1.put(END_ITIME, end_ITime);
availList.add(availList1);
empInfo1.put("HR_ID", hrID);
empInfo1.put("DAY", availList);
empAvailRecord.put(empID, empInfo1);
}
}