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 187121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:46:03+00:00 2026-05-11T15:46:03+00:00

I have an XML file which contains multiple nodes that have children. If the

  • 0

I have an XML file which contains multiple nodes that have children. If the nodes have the same keys, their children has to be merged into one node.

<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> 

Two records here have the same dates. How can I merge them into one? I have a list of these as key/value pairs.

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);     }  } 
  • 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. 2026-05-11T15:46:03+00:00Added an answer on May 11, 2026 at 3:46 pm

    You should check for repititions before you add availList1 to availList. You can write a function which traverses availList, gets avail_idate and matches it with the one you are about to add. How much records can be there in the list generally. Because you will need to consider peformance factors if traversing sounds costly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Me again... I have an XML File that contains different categories which I would
I have an application that generates a lengthy Xml output file which contains many
I want to know that I have the string.xml Resource file which contains status
I have a xml file which contains data I want to insert into a
Good morning. I have an XML file which contains lists of warning and errors
We have a PageRoles xml file which contains the page path and the user
I have a large XML file which in the middle contains the following: <ArticleName>Article
i have a log file which contains hundreds/thousands of seperate XML messages and need
I have an XML file which has many section like the one below: <Operations>
I have an XML file which I'd like to parse into a non-XML (text)

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.