#!/usr/bin/perl -w

# ./lexin2dict.pl LEXIN.xml | iconv -f iso-8859-1 -t utf-8 > lexin.dict

use strict;

use XML::SAX;
use LexinSAXHandler;

if (@ARGV < 1) {
    print STDERR "Usage: lexin2dict <LEXIN file>\n";
    exit 2;
}

my $lexin_file = shift;

if (! -f $lexin_file) {
    print STDERR "File not found: $lexin_file\n";
    exit 1;
}
  
my $parser = XML::SAX::ParserFactory->parser(
                   Handler => LexinSAXHandler->new);
  
$parser->parse_uri($lexin_file);
