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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:35:00+00:00 2026-05-11T02:35:00+00:00

I have two XML files. They are similar, but there are two nodes of

  • 0

I have two XML files. They are similar, but there are two nodes of which either of the file have only one. I want to merge two sets of such documents in one single document where first the node of side A is taken, followed by the nodes of side B.

I’m not an experienced user of diff tools and downloaded KDiff3 to start somewhere.. Can anybody put me on the right path?

–EDIT–
Finding diff tools is something I can manage on my own.
But how to make one of these tools (doesn’t matter which one) make the merging go automatically by first putting in the part from file1 and then from file2 is what I’m looking for. It’s a rather extensive amount of files, so I’d preferably not have any intervention in the mergin process.

  • 1 1 Answer
  • 3 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-11T02:35:00+00:00Added an answer on May 11, 2026 at 2:35 am

    This might be very problematic to do with a standard diff tool if the xml ‘nodes’ are in any way similar. For example:

    file1:

    1 <node id='1' /> 2 <node id='2a'> 3   <content item='1'/> 4   <content item='2a'/> 5 </node> 6 <node id='3' /> 

    file2:

    1 <node id='1' /> 2 <node id='2b'> 3   <content item='1'/> 4   <content item='2b'/> 5 </node> 6 <node id='3' /> 

    A standard diff tool is going to highlight lines 2 and 4 as needing to be merged, but even if you automatically add the lines from file2, you’ll end up with an invalid xml file:

    1 <node id='1' /> 2 <node id='2a'> 2 <node id='2b'> 3   <content item='1'/> 4   <content item='2a'/> 4   <content item='2b'/> 5 </node> 6 <node id='3' /> 

    You really need a diff/merge tool that is xml-aware. I found a description of one called XmlMerge, along with an example that shows it doing exactly what you’re asking for. It’s part of EL4J.

    There is a dormant effort called XUpdate that has a fair amount of tools around it (both for generating the XUpdate diffs and for applying them). There are also some .net classes that use a different foundation. You will need to do some scripting to use either of these systems I think.

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

Sidebar

Related Questions

I have two xml files which have the same data but different names for
Suppose I have two XML files. First XML File: <?xml version=1.0?> <AccessRequest xml:lang=en-US> <AccessLicenseNumber>Your_License</AccessLicenseNumber>
I am have two xml files.. I first get one and loop through it
I have created two folders layout and layout-land with two xml files, one for
I want to parse a large XML file and I have two options: Perl
I have set the two buttons in preference.xml file. I want to go to
I have two xml files and I need to create one xsd for both.
I want to compare two XML files, they are the same as each other.
I have an application which uses two sharedpreferences (so two xml files) to operate.
We have to compare responses (XML) of two different but they are doing the

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.