Results 1 to 10 of 10

Thread: How to compare 2 XML files using Java

  1. #1
    Join Date
    Apr 2009
    Posts
    89

    How to compare 2 XML files using Java

    I have assigned an project where i need to work with the XML files, and these XML files has little or almost minute difference in them, or sometimes it is duplicated and so i need to check the name of the file if it is similar then the size of the file and both the name and size matches then have to compare these XML fragments and for that need some handy source code which will work for me.

    I will be much more thankful to them whoever help me.

  2. #2
    Join Date
    Dec 2008
    Posts
    202

    Re: How to compare 2 XML files using Java

    Nobody will provide the source code for free,and on top of that ExamXML is a commercial product and the source code isn't published. Apart from that i also had the same requirement and for that I use the API available with java, which no doubt there must be for xml. It would be more reliable than any custom built programs.

  3. #3
    Join Date
    Jan 2009
    Posts
    99

    Re: How to compare 2 XML files using Java

    You might have to remove all irrelevant whitespace from both XML documents to make the exact comparison between two Java files to remove trivial differences such as additional whitespace. Then you are allow to start comparing the documents, but you'll need to know EXACTLY what is considered "different":

    <customer identity="a"/><customer identity="b"/>

    is semantically equivalent with

    <customer identity="b"/><customer identity="a"/>

    but lexically speaking these fragments are different.

  4. #4
    Join Date
    Feb 2009
    Posts
    105

    Re: How to compare 2 XML files using Java

    I also had the similar requirement for my projects and i developed my own comparator. Most comparators uses ExamXML etc it has also been showed that XML as different if the nodes under a parent node occur in different sequence or this will also help in setting of repeated nodes occur in different sequence. I was successful in creating the comparator that provides me the flexibility to configure to identify a node from a set of repeated nodes and is able to compare them successfully if they occur in any order.

  5. #5
    Join Date
    May 2010
    Posts
    4

    Re: How to compare 2 XML files using Java

    can anyone please guide me for comparing 2 xml files thro' java code ?
    how to use ExamXML thro' our java application

  6. #6
    Join Date
    Dec 2007
    Posts
    2,291

    Re: How to compare 2 XML files using Java

    Quote Originally Posted by MDJ View Post
    can anyone please guide me for comparing 2 xml files thro' java code ?
    how to use ExamXML thro' our java application
    A7Soft released java-base XML diff tool jExamXML (http://www.a7soft.com/jexamxml.html).

    It can be itegrated into java application.

  7. #7
    Join Date
    May 2010
    Posts
    4

    Re: How to compare 2 XML files using Java

    can anyone share the code example of integrating examXML with webapplication ?

  8. #8
    Join Date
    Dec 2007
    Posts
    1,736

    Re: How to compare 2 XML files using Java

    Quote Originally Posted by MDJ View Post
    can anyone share the code example of integrating examXML with webapplication ?
    For that you will have to download ExamXML. It is an application for comparing different versions of XML documents, without the need to reload them again after making the changes. ExamXML works from different sources, such as SQL servers and CSV files. It is easy to use and offers many, many working possibilities. Limitations of the trial version: Use limited to a 30-day period. Do your homework.

  9. #9
    Join Date
    May 2010
    Posts
    4

    Re: How to compare 2 XML files using Java

    Actually i can open exe of ExamXML from java . But how would I get control of compare button of Examxml . My requirement is : I want to highlight the differences of 2 xmls thro' web application

  10. #10
    Join Date
    May 2010
    Posts
    4

    Re: How to compare 2 XML files using Java

    Any updateds on this ..
    is there is any other way to implement it ?

Similar Threads

  1. C program to Compare two files
    By Ram Bharose in forum Software Development
    Replies: 6
    Last Post: 29-12-2010, 06:32 AM
  2. Java API for doc files
    By Rily in forum Software Development
    Replies: 4
    Last Post: 16-07-2010, 01:15 PM
  3. Replies: 4
    Last Post: 30-01-2010, 07:23 PM
  4. Compare lines of 2 txt files in C#
    By !const in forum Software Development
    Replies: 4
    Last Post: 11-04-2009, 05:36 PM
  5. Compare two Excel files
    By Bull50 in forum Software Development
    Replies: 4
    Last Post: 06-04-2009, 07:14 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,686,915.03774 seconds with 17 queries