#!/usr/bin/perl

use strict;
use warnings;

use XML::LibXML;

my $file_1=$ARGV[1];
my $file_2=$ARGV[0];
my $tmp_1='/tmp/1.xml';
my $tmp_2='/tmp/2.xml';

if(not -f $file_1) {
  print "I can't open $file_1\n";
  exit;
}

if(not -f $file_2) {
  print "I can't open $file_2\n";
}

system("xmllint --noblanks --c14n $file_1 > $tmp_1");
system("xmllint --noblanks --c14n $file_2 > $tmp_2");
system("perl -pi -e 's|</|\n</|g' $tmp_1");
system("perl -pi -e 's|</|\n</|g' $tmp_2");
system("diff $tmp_1 $tmp_2");
unlink $tmp_1;
unlink $tmp_2;

