#!/usr/bin/perl -w
# 4BJ9OVI - xmltidy created by Pip Stuart <Pip@CPAN.Org>
#   to tidy up all the element indenting of XML documents.
# The parameters are:
#   filename
#   indent_type    ('spaces' or 'tabs')
#   indent_repeat  (number of times to repeat type character per indent)
# This utility is part of the XML::Merge Perl Module.  Please run
#   `perldoc XML::Merge` from the command-line for further documentation.
# This is licensed under the GNU General Public License version 2.
use strict;
use XML::Merge;

my $flnm = shift() || die "USAGE: `$0 FileName.xml <spaces|tabs> <# of repeats per indent>`\n";
my $ityp = shift() || 'spac';
my $irep = shift();
unless(defined($irep)) {
  if($ityp =~ /spac/i || $ityp eq ' ') { $irep = 2; }
  else                                 { $irep = 1; }
}
my $merg = XML::Merge->new('filename' => $flnm);
$merg->tidy('indent_type'   => $ityp,
            'indent_repeat' => $irep);
$merg->write();
