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.