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

Hi Monks,

I have an XML::Twig application that runs fine here on Windows XP, also at another site on XP. At a third site, someone is trying to run the same script on a 64 bit Linux system, and it is failing.

The error reported is...

"syntax error at line 1, column 68, byte 68 at /usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi/XML/Parser.pm line 187"

... I do not have a Linux system, or a 64 bit system, so I can't try it myself. Searching, I can't find any issues.

I've suggested checking how up-to-date the Twig and Parser modules are. Is there anything else obvious I can advise the user or try to get furterh info? The user is a non-programmer.

  • Comment on XML::Twig crashing on 64 bit Linux box.

Replies are listed 'Best First'.
Re: XML::Twig crashing on 64 bit Linux box.
by almut (Canon) on Feb 24, 2007 at 17:07 UTC

    The syntax error is being reported by the underlying expat library, which is apparently having problems with byte 68 of the XML file being parsed. Maybe some encoding issue...(which encoding does the XML file specify?) It would also help to know what content/chars/bytes there is at position 68.

      A data error..., hmmm, I hadn't considered that, but I do recall that Windows and Linux handle the end of lines differently.

      The first line of the XML buffer looks like this...

      <?xml version="1.0" encoding="ISO-8859-1" ?>

      ... I am about to write the buffer to a file and see exactly what is contained within. Certainly from visual inspection, it looks perfectly sound.

      Line 1 does not have 68 characters, at least, not visible, could be some trailing spaces. I'll know more when I've dumped the buffer.

Re: XML::Twig crashing on 64 bit Linux box.
by mirod (Canon) on Feb 24, 2007 at 17:08 UTC

    I don't have a 64 bit system, so I can't test it either. That said, the error message seems to point the origin of the problem at XML::Parser. Maybe checking that expat and XML::Parser are properly installed, and look at the bug reports for the 2 softwares (there doesn't seem to be anything in XML::Parser's buglist).

      The guy running the Linux box says he has installed the latest and greatest. I am working on a line termination hypothesis at the moment, will update the thread once I get any further data. It shouldn't be that as the XML stream is coming from a supposedly OS neutral webservice.

      I did browse the CPAN testers lists and saw that it should work.

        The guy running the Linux box says he has installed the latest and greatest

        Is that the "latest and greatest" version of the expat library, too ?

        This could potentially be a significant aspect.

        Cheers,
        Rob
Re: XML::Twig crashing on 64 bit Linux box.
by Anonymous Monk on Feb 25, 2007 at 04:20 UTC
    Your xml file is malformed?
    C:\>echo >not.xml C:\>xml_pp not.xml syntax error at line 1, column 0, byte 0: ECHO is on. ^ at C:/Perl/site/lib/XML/Parser.pm line 187 C:\>
Re: XML::Twig crashing on 64 bit Linux box.
by adrianxw (Acolyte) on Feb 25, 2007 at 18:02 UTC
    Hi all,

    It looks very much like this is a stupid bug in the server that supplies the data stream I was retrieving. s/\r\n//g'ing out the carriage return and linefeed characters has corrected the fault.

    I am saddened that I did not think of this, but saddened further that a service purported to be an OS neutral stream is, in fact, anything but.

    As usual, the wise here pointed me in the direction of solution, and sacremental wine is available in the bar.

    *** EDIT ***

    The square brackets went, but you know what I mean!