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

Hello Monks,

I am working on a script to take some simple xml and turn it into CSV for consumption by another system. I have used XML::Simple before to do something similar, so I turned to it again.

The strange thing is I get the following error
not well-formed (invalid token) at line 1, column 5, byte 5 at C:/Perl/site/lib/ XML/Parser.pm line 187
with even the simplest of scripts, regardless of the XML file I am processing. See code below.

use strict; use XML::Simple; use Data::Dumper; my $data = XMLin(['../2005/01/06/19/doc0000011542/.metadata']); print Dumper($data);

What makes this strange is that I can use debug mode from XML::Parser directly with no problems, on the same XML file with no error messages.

I am using AS-Perl 5.8.7 on Win32
XML::Simple 2.1.4
XML::Parser 2.34.0.1

I have googled and super searched, and haven't found a solution yet. Has anyone else seen similar problems? Any ideas?

As always, thanks for your help
digger

Replies are listed 'Best First'.
Re: XML::Simple - strange error
by runrig (Abbot) on Jan 10, 2006 at 00:12 UTC
    Try:
    my $data = XMLin('../2005/01/06/19/doc0000011542/.metadata');

      Yeah - I know, it was s stupid mistake. I should have gone home and gotten some sleep before posting, and I probably would have seen it.

      I am amazed at how often simple little mistakes pop up when you work tired. There's definitely a point of diminishing returns when you push yourself past the limit.

      Thanks for your help,
      digger