diff options
Diffstat (limited to 'bin/xmldiff.pl')
-rw-r--r-- | bin/xmldiff.pl | 45 |
1 files changed, 8 insertions, 37 deletions
diff --git a/bin/xmldiff.pl b/bin/xmldiff.pl index 6b358e5..faeab63 100644 --- a/bin/xmldiff.pl +++ b/bin/xmldiff.pl @@ -13,12 +13,12 @@ # #Change this if xmlpp is not in your current path -#for example: $XMLPP = "./xmlpp"; -$XMLPP = "xmlpp"; +#for example: $XMLFORMAT = "./xmlpp"; +# $XMLFORMAT = "xmlpp"; use Getopt::Std; -getopts('tscupChHSi'); +getopts('scupChi'); if ($opt_h || @ARGV != 2) { usage(); @@ -54,45 +54,18 @@ if( $opt_s ) { $diffOpts .= "--new-line-format='+ %l\n' "; $diffOpts .= "--old-line-format='- %l\n' "; $diffOpts .= "--unchanged-line-format=' %l\n' "; -} elsif( $opt_H ) { - $diffOpts .= "--changed-group-format='%<%>' "; - $diffOpts .= " --new-group-format='%>' "; - $diffOpts .= "--old-group-format='%<' "; - $diffOpts .= "--new-line-format='<font color=\"green\">+ %l</font>\n' "; - $diffOpts .= "--old-line-format='<font color=\"red\">- %l</font>\n' "; - $diffOpts .= "--unchanged-line-format='<font color=\"gray\"> %l</font>\n' "; } -# Set up xmlpp options - -my $prettyOpts = $opt_t ? "-t " : ""; -$prettyOpts .= $opt_S ? "-S " : ""; -$prettyOpts .= $opt_H ? "-H " : ""; -$prettyOpts .= "-s -e "; +$XMLFORMAT = "xmlformat"; $file1 = "xmlppTEMP1.$$"; $file2 = "xmlppTEMP2.$$"; my $results = 0; -$results += system("$XMLPP $prettyOpts '$ARGV[0]' > $file1"); -$results += system("$XMLPP $prettyOpts '$ARGV[1]' > $file2"); - -if($opt_H) { - print "<HTML>\n"; - print " <HEAD>\n"; - print " <TITLE>XML Diff</TITLE>\n"; - print " </HEAD>\n"; - print " <BODY bgcolor=\"#FEFEFF\">\n"; - print " <PRE>"; - $results += system("/usr/bin/diff -bB $diffOpts $file1 $file2"); - # Do not add extra whitespace before the </PRE> - print "</PRE>\n"; - print " </BODY>\n"; - print "</HTML>\n"; - -} else { - $results += system("/usr/bin/diff -bB $diffOpts $file1 $file2"); -} +$results += system("$XMLFORMAT '$ARGV[0]' > $file1"); +$results += system("$XMLFORMAT '$ARGV[1]' > $file2"); + +$results += system("/usr/bin/diff -bB $diffOpts $file1 $file2"); unlink($file1,$file2); @@ -111,9 +84,7 @@ mode must be one of: -C vaguely CVS like unified diff options: - -H HTML output -t split attributes - good for spotting changes in attributes - -S schema hack mode - good for diffing schemas -i ignore element and attribute contents EOF |