Comparing 2 XML files need some suggestions please

R

Rishi Dhupar

Hi,

I have two files that look like:
<ROOT>
<File>
<FileOwner></FileOwner>
<FilePath>C:\</FilePath>
<FileName>arcldr.exe</FileName>
<FileAccessed>4/12/2005</FileAccessed>
<FileModified>6/19/2003</FileModified>
<FileCreated>12/07/1999</FileCreated>
<FileSize>150528</FileSize>
</File>
<File>
<FileOwner></FileOwner>
<FilePath>C:\</FilePath>
<FileName>arcsetup.exe</FileName>
<FileAccessed>4/12/2005</FileAccessed>
<FileModified>6/19/2003</FileModified>
<FileCreated>12/07/1999</FileCreated>
<FileSize>163840</FileSize>
</File>
</ROOT>


There are about 60,000 File nodes in both files (30 mb or so). The
files nodes are in different order in the files, what module could I
use to do something like this? Just looking for string to string
comparasion? And spit out any discrepancies between the two files.

Thanks for the help,

Rishi D
 
R

Rishi Dhupar

I am testing whether or not a File scan from an application we write is
accurate on all types of O/S. So I have the application ouput and then
I run a file scan using perl. Then I want to compare the two results
and see if there are any errors.
 
I

Ian Wilson

Rishi said:
Hi,

I have two files that look like:
<ROOT>
<File>
<FileOwner></FileOwner>
<FilePath>C:\</FilePath>
<FileName>arcldr.exe</FileName>
<FileAccessed>4/12/2005</FileAccessed>
<FileModified>6/19/2003</FileModified>
<FileCreated>12/07/1999</FileCreated>
<FileSize>150528</FileSize>
</File>
<File>
<FileOwner></FileOwner>
<FilePath>C:\</FilePath>
<FileName>arcsetup.exe</FileName>
<FileAccessed>4/12/2005</FileAccessed>
<FileModified>6/19/2003</FileModified>
<FileCreated>12/07/1999</FileCreated>
<FileSize>163840</FileSize>
</File>
</ROOT>


There are about 60,000 File nodes in both files (30 mb or so). The
files nodes are in different order in the files, what module could I
use to do something like this? Just looking for string to string
comparasion? And spit out any discrepancies between the two files.

I'd do something like ...

perl -ne <foo> file1 | sort > file1.txt
perl -ne <foo> file2 | sort > file2.txt
diff file1.txt file2.txt
rm file[12].txt

where <foo> is something like (untested) ...
$x.=$_; if (m!^\s*</filea>\s*$!) { print "$x\n"; $x=''; }

But I'm not a perl wizard, so there's certain to be far better ways to
do this :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top