XML::Simple 2.14 and perl 5.8.8

XML::Simple 2.14 and perl 5.8.8

am 11.08.2006 00:22:19 von allenjo5

There sere some test failures, that I might be able to live with, but
I'm more concerned with the slew of warnings like this:

Unable to recognise encoding of this document at
/prod/free/perl588/lib/site_perl/5.8.8/XML/SAX/PurePerl/Enco dingDetect.pm
line 96, line 1.

This error occurs when the data you are trying to parse begins with
whitespace, as is shown by this test script:

#--------------
use XML::Simple;

my $opt = XMLin(q(

value1
value2

));
#----------------

And sure enough, if you look at EncodingDetect.pm, it is doing pattern
matching on the start of the data to determine the encoding, but the
patters don't consider whitespace.

So, has anyone seen this before? And if so, what's the appropriate
fix?

Thanks.

Re: XML::Simple 2.14 and perl 5.8.8

am 11.08.2006 10:26:26 von Jimi-Carlo Bukowski-Wills

On Thu, 10 Aug 2006 15:22:19 -0700, allenjo5 wrote:

> There sere some test failures, that I might be able to live with, but
> I'm more concerned with the slew of warnings like this:
>
> Unable to recognise encoding of this document at
> /prod/free/perl588/lib/site_perl/5.8.8/XML/SAX/PurePerl/Enco dingDetect.pm
> line 96, line 1.
>
> This error occurs when the data you are trying to parse begins with
> whitespace, as is shown by this test script:
>
> #--------------
> use XML::Simple;
>
> my $opt = XMLin(q(
>
> value1
> value2
>

> ));
> #----------------
>
> And sure enough, if you look at EncodingDetect.pm, it is doing pattern
> matching on the start of the data to determine the encoding, but the
> patters don't consider whitespace.
>
> So, has anyone seen this before? And if so, what's the appropriate
> fix?
>
> Thanks.

Well, I thought that white-space is not permitted at the start of an XML
file... although there seems to be no reference to this at
http://www.w3.org/TR/REC-xml/ so perhaps I'm wrong.

I'm running perl 5.8.7 and this code works for me!
So I guess this really IS a problem if the test scripts have white-space
in them and the module doesn't handle them!

Re: XML::Simple 2.14 and perl 5.8.8

am 11.08.2006 20:08:33 von allenjo5

Jimi-Carlo Bukowski-Wills wrote:

> Well, I thought that white-space is not permitted at the start of an XML
> file... although there seems to be no reference to this at
> http://www.w3.org/TR/REC-xml/ so perhaps I'm wrong.
>
> I'm running perl 5.8.7 and this code works for me!
> So I guess this really IS a problem if the test scripts have white-space
> in them and the module doesn't handle them!

Thanks for the test with 5.8.7. The real question is why does perl
5.8.8 not
strip the leading whitespace out, but lesser perls do? And once that
is
answered, which is the correct behavior?

Re: XML::Simple 2.14 and perl 5.8.8

am 11.08.2006 22:55:03 von allenjo5

Jimi-Carlo Bukowski-Wills wrote:
> On Thu, 10 Aug 2006 15:22:19 -0700, allenjo5 wrote:
>
....
> > use XML::Simple;
> >
> > my $opt = XMLin(q(
> >
> > value1
> > value2
> >

> > ));
...
> I'm running perl 5.8.7 and this code works for me!
> So I guess this really IS a problem if the test scripts have white-space
> in them and the module doesn't handle them!

I found out a little more: could you test with this line after the "use
XML::Simple":

$XML::Simple::PREFERRED_PARSER = "XML::SAX::PurePerl";

I suspect you may be getting a different default parser and therefore
not
seeing the error.

Thanks.