Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I'm getting a weird problem with XML::Simple;

[Tue Feb 17 03:40:51 2009] import_attachments.cgi: Couldn't open encma +p iso-8859 -15.enc: [Tue Feb 17 03:40:51 2009] import_attachments.cgi: No such file or dir +ectory [Tue Feb 17 03:40:51 2009] import_attachments.cgi: at /usr/lib/perl5/ +vendor_per l/5.8.4/x86_64-linux/XML/Parser.pm line 187
I've tried 2 ways of approaching:
my $data; open(READIT,"<$file"); while (<READIT>) { $data .= $_; } close(READIT); my $ref = XMLin($data);


..and also;

my $ref = XMLin($file);

Please note, this XML format has a lot of accents and stuff in. For example:
<vacation id="1872" type="VACATION" countryCode="TR" city="Antalya" +dayCount="-7" nightCount="-8" advertiser="expedia" advertiserLogo="ht +tp://www.illicotravel.com/fr/img/affil/expedia.gif" departureCities=" +Bale/Mulhouse, Lyon, Marseille, Nantes, Toulouse" minDepartureDate="2 +009-02-21" maxDepartureDate="2009-03-22"> <minPrice date="2009-02-21" value="529.0" /> <maxPrice date="2009-02-21" value="639.0" /> <title>Club Kimeros Hôtel</title> <shortDescription>Club Kimeros H&amp;ocirc;tel, Pension : All incl +usive, Pays de destination : TURQUIE, Ville de destin...</shortDescri +ption> <extraInfo /> <smallImageUrl>http:\//www.anyway.com/imgVar/SJ/wsj/1/6/wsj16376.j +pg</smallImageUrl> <redirectionParams>vacationType=VACATION&amp;departureDelta=15&amp +;departureDate.day=21&amp;departureDate.monthYear=02-2009&amp;departu +reCity=&amp;destination=TR</redirectionParams> <link>c2l0ZVNlY3Rpb249dmFjYXRpb24mYWR2ZXJ0aXNlck5hbWU9ZXhwZWRpYSZ1 +cmw9aHR0cDovL3d3dy5kcGJvbHZ3Lm5ldC9jbGljay0yMDM4MDgwLTEwNDY5MTkzP3Vyb +D1odHRwJTNBJTJGJTJGcHJvbW9zZWpvdXJzLmV4cGVkaWEuZnIlMkZyZWRpci5hc3AlM0 +ZhZmZjaWQlM0RleHBlLkZSLjAwMi4wMDkuJTI1enMuJTI1emEuJTI1enAuY2F0YWxvZ3V +lJTI2U0VSVklDRV9JRCUzRFhGX0VYRlJTQiUyNk1PREUlM0RXU0pfQ09NUCUyNlNKUElE +JTNEMTIwMzY=</link> </vacation>


Any suggestions are much appreciated (I looked on google, and found some results - but most werd not in english)

TIA

Andy

Replies are listed 'Best First'.
Re: Error with .xml file processing in XML::Simple
by ultranerds (Hermit) on Feb 17, 2009 at 08:50 UTC
    Sorry, this was me who posted this question - just forgot to login first <G>

    TIA

    Andy
        Hi,

        Thanks for the reply - thats put me on the right track :)

        I downloaded ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-15.TXT , and saved as a .enc file, and then uploaded to the folder where my script is.

        It says:

        This function looks for a file in the path list @XML::Parser::Expat::Encoding_Path, that matches the lower-cased name with a '.enc' extension. The first one it finds, it loads.


        ..but how do I set it, so that it knows to look in this path?

        TIA

        Andy