#---------------------------------------------------------------
# ____                   _ _         ____  _
#|  _ \ ___  _   _  __ _| | |_ _   _/ ___|| |__   __ _ _ __ ___
#| |_) / _ \| | | |/ _` | | __| | | \___ \| '_ \ / _` | '__/ _ \
#|  _ < (_) | |_| | (_| | | |_| |_| |___) | | | | (_| | | |  __/
#|_| \_\___/ \__, |\__,_|_|\__|\__, |____/|_| |_|\__,_|_|  \___|
#            |___/             |___/
#
# Copyright (C) 2009 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#---------------------------------------------------------------
package BookPub::Catalog::Import::Process::Fetcher::Bloomsbury::FileHandler::ONIX;
use strict;
use warnings;

use File::Path;
use Data::Dumper;

use lib '/app/tools/common/lib';
use lib '/app/tools/bookpub/lib';
use Common::Assert;
use BookPub::DB::Item::CatalogImportItem::File;

use base 'BookPub::Catalog::Import::Process::Fetcher::FileHandler::ONIX';

# JPK - Doing this for everybody now.
#
sub _DEPRECATEDprocessLocalFile {
    my ($self) = @_;

    # !!! Our XML parser is stupid.
    # !!! It assumes a level of formatting.
    # !!! So, we're going to run the file through 'xmllint' to
    # !!! pretty-print it first.
    #
    my $path = $self->localFile();

    #    `/usr/bin/xmllint --format $path > $path.pretty`;
    `/app/tools/bookpub/bin/catalog_import/xmlindent < $path > $path.pretty`;
    rename( "$path.pretty", $path );

    # Now call the inherited method to get on with it.
    #
    return $self->SUPER::_processLocalFile();
}

1;
