Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: three way merge of xml documents

  1. #1
    Junior Member
    Join Date
    Sep 2014
    Thanked 0 Times in 0 Posts

    Default three way merge of xml documents

    I want to use Java to implement a Three way merge software for slx files. slx is a compressed file format containing mainly xml documents.
    The sizes of the xml files is pretty small, several of the files are around 1-2kB and the larger ones I have yet to come across any files larger than 200kB (assume 1MB to be sure).

    I want the software to be able to show the differences of the files and let the user choose parts from both documets. while automatically merging non-conflicting changes.

    What I can't figure out is what to use. As I understand I could use DOM, SAX, XSLT, XPath + XQuery to parse the documents. Trying to read up on these I have gotten this far:
    DOM - creates a tree structure in memory (feels intuitively correct) and allows you to manipulate this, big drawback is memory consumption since the tree can be a lot bigger than the original xml file. Even though intuitive people from xml conventions seem to agree that DOM is not recommended to anyone.
    SAX - Read the document once, is fast and fairly simple. Requires a lot of code (?). Is used in other three way merge tools such as 3dm. I don't find this intuitive at all, since I havn't understood what I acctually have to work with after this.
    ---- I realize that XSLT and XPath are Query languages whereas DOM is a model though I havn't really figure out what difference that does to me yet. Most of my work will be designing the algorithms to do the merge the document, what I really need is to get a reference the elements and attributes so I can compare these -----
    XSLT - Is what I recently got recommended to me, and it has its own merge function. This however will not support three way merge and will have to be done. Other than this I have no insight in XSLT.
    XPath + XQuery - Seems simple enough and fairly intuitive. Sort of like DOM in creating a tree to work with(?) but seems to be better with memory and quiete a lot of easy tutorials. However seems like a lot of work to use these in producing a Three way merge tool?

    As you can see I have never worked with any of these and a month ago I had no idea what an XML document nor what the difference in two way and three way merge was, so along the way it is likely I have missunderstood one or two things. Any recommendations to what I should choose and why would be much appretiated.

  2. #2
    Super Moderator
    Join Date
    Jun 2013
    So. Maryland, USA
    My Mood
    Thanked 698 Times in 680 Posts

    Default Re: three way merge of xml documents

    Thread moved.

Similar Threads

  1. Stubbing documents in SharePoint using java Api
    By suni.profile@gmail.com in forum Java Theory & Questions
    Replies: 7
    Last Post: July 14th, 2014, 06:17 AM
  2. Combining multiple uploaded documents into one report
    By bcshassan in forum Java Theory & Questions
    Replies: 1
    Last Post: May 28th, 2014, 08:00 PM
  3. Merge 20+ xml files with 7000+nodes into one using java
    By mija in forum What's Wrong With My Code?
    Replies: 2
    Last Post: July 3rd, 2013, 02:33 AM
  4. Reading and Writing Word Documents
    By Esanders in forum Java Theory & Questions
    Replies: 1
    Last Post: April 26th, 2013, 08:48 PM
  5. Appending to online documents
    By aussiemcgr in forum Java Theory & Questions
    Replies: 3
    Last Post: August 2nd, 2011, 08:44 AM

Tags for this Thread