Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Databases > Re: XML compari...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 3706 of 3800
Post > Topic >>

Re: XML comparison

by "Arved Sandstrom" <asandstrom@[EMAIL PROTECTED] > Apr 18, 2008 at 01:09 PM

"Nick" <nachiket.****rwalkar@[EMAIL PROTECTED]
> wrote in message 
news:813a8f4e-5823-4682-911d-b4d9d72c75de@[EMAIL PROTECTED]
> 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 re****t 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 re****t 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

For the first task you essentially need (recursive) directory listings.
You 
could start with something like this 
(http://exampledepot.com/egs/java.io/GetFiles.html)
and take it from there

(there are useful links). If you convert your file listings to sets you
can 
do a difference operation 
(http://java.sun.com/docs/books/tutorial/collections/interfaces/set.html)
to 
cleanly discover what files are different, and intersections to get the 
common file listings.

Once you have common file listings, and given that you are comparing XML 
content, you'll be able to find existing programs/utilities that do XML 
diffs.

AHS
 




 2 Posts in Topic:
XML comparison
Nick <nachiket.shirwal  2008-04-17 08:24:00 
Re: XML comparison
"Arved Sandstrom&quo  2008-04-18 13:09:07 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 4:50:01 CDT 2008.