• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

compare two XML files using DOM parser

 
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I need to compare two XML files in which second XML file has some slight modifications and I need to compare that particular node. Can any one help me by providing tutorials or any API( if its available).
As I am new in XML parsing.
for example-
First XML file
Second XML file--

like that some more nodes are there as I have to check names and then check enable_status and visisbility
How can I do that. Please help me
Thanks in advance.
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hava a look at xmlunit....You can use that to perform a diff.
Alternatively, marshall the xml into java objects and do direct comparison that way.
 
Divya Gehlot
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
As I am new to XML parsing could you please provide any link or tutorial for marshalling into java objects.
Thanks in advance.
 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Divya,
follow this link for marshalling (generating XML document using JAVA objects)

http://www.onjava.com/pub/a/onjava/2004/12/15/jaxb.html
and you search/google for unmarshalling (XML document to Java objects) which you want to look into.

I couldn't find a proper link for unmarshalling so get familiarize with marshalling first and unmarshalling will be real easy (just opposite to marshalling).

post any questions you have while you are working on unmarshalling.

Thanks,
Ugender
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use Castor Framework.

Just convert the first Xml into object and second xml into object and then compare.

Then marshal it.
 
reply
    Bookmark Topic Watch Topic
  • New Topic