Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2008

Tip: Looking for answers? Try searching our database.

XML comparison

Thread view: 
Nick - 17 Apr 2008 16:21 GMT
Hi,

I have an urgent requirement to be done in JAVA where in I need to
compare between two directories and to see if there are exact same
name files available in both the directories. So for eg. DIR1 and DIR2
both have 1.xml, 2.xml then its fine or report the missing ones.

Secondly whichever files are avilable in both the directories compare
them so compare 1.xml in DIR1 to 1.xml in DIR2 but only on certain
fields.

So in summary :

DIR1 -> 1.xml{contents= <a>20</a><b>10</b> }, 2.xml, 3.xml
DIR2 -> 1.xml{contents= <a>25</a> }, 2.xml, 4.xml

Then the report should tell me that

a] 3.xml is missing in DIR2
b] 4.xml is missing in DIR1
c] <a> field in the 1.xml differs
d] But assuming <b> is a fields to be ignored do not display any
error.

Can these be done in JAVA and how ?

Please help.

regards
Nick
RedGrittyBrick - 17 Apr 2008 16:46 GMT
Nick multiposted:

Please don't multi-post. If you really need to post to multiple groups
use cross-posting not multi-posting.

http://www.blakjak.demon.co.uk/mul_crss.htm
http://www.cs.tut.fi/~jkorpela/usenet/xpost.html

I almost never find it necessary to post to more than one newsgroup.

Signature

RGB

Roedy Green - 22 Apr 2008 06:06 GMT
On Thu, 17 Apr 2008 08:21:56 -0700 (PDT), Nick
<nachiket.shirwalkar@gmail.com> wrote, quoted or indirectly quoted
someone who said :

>I have an urgent requirement to be done in JAVA where in I need to
>compare between two directories and to see if there are exact same
>name files available in both the directories.

Forget XML. Just use Files.list to get your directory listings.

Then sort each if the default order is not suitable.

Then compare.  See http://mindprod.com/products1.html#SORTED 
for code to compare two lists looking for differences.  Just use
standard merge logic.

see http://mindprod.com/jgloss/merge.html

Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.