'invalid token' error and segmentation fault (XML issue?)

Discussion in 'Perl Misc' started by dn.perl@gmail.com, Aug 4, 2011.

  1. Guest

    I have started getting an error:
    not well-formed (invalid token) at line 12 -- but the error-log does
    not say which file happens to have this invalid token.

    If it helps, the shell script has started giving Segmentation fault
    for:
    echo $PERL extract-history.pl --start "$dt 00:00:00"
    But in the very next line, it seems to call correctly:
    /home/y/bin/perl extract-history.pl --start 2011-08-02 00:00:00

    Well, extract-history.pl does use Data::Dumper, but it is difficult to
    say where any xml or utf-8 related stuff may be popping up and causing
    the error messages.

    These scripts were working perfect until 10 hours ago.

    Please advise.
     
    , Aug 4, 2011
    #1
    1. Advertising

  2. * wrote in comp.lang.perl.misc:
    >I have started getting an error:
    >not well-formed (invalid token) at line 12 -- but the error-log does
    >not say which file happens to have this invalid token.
    >
    >If it helps, the shell script has started giving Segmentation fault
    >for:
    > echo $PERL extract-history.pl --start "$dt 00:00:00"
    >But in the very next line, it seems to call correctly:
    >/home/y/bin/perl extract-history.pl --start 2011-08-02 00:00:00
    >
    >Well, extract-history.pl does use Data::Dumper, but it is difficult to
    >say where any xml or utf-8 related stuff may be popping up and causing
    >the error messages.


    Well, you don't tell us what the code is and don't tell us what the
    input is, and you claim there is a segmentation fault, but a segmen-
    tation fault would not come with a "not well-formed (invalid token)"
    error message. The error message is most likely from `expat`, an XML
    parser that is used by modules such as XML::parser. Your favourite
    search engine should point out, for a query like '"not well-formed
    (invalid token)" perl' the perl-xml FAQ

    http://perl-xml.sourceforge.net/faq/#not_well_formed

    which lists a couple of common errors in XML documents that trigger
    this error. Most likely your script obtains an XML document from
    somewhere, and the document is not well-formed, meaning it cannot be
    parsed by typical XML processors. In order to address this, you would
    have to find out where the malformed document is coming from and fix
    it (or have others fix it, or find some workaround), or otherwise re-
    move the errorneous document from the process modeled by the script.

    It might help to use a debugger or profiler to get a better idea of
    what the script does, like which modules are involved, where the XML
    parsing code is called from, and so on.
    --
    Björn Höhrmann · mailto: · http://bjoern.hoehrmann.de
    Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
    25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
     
    Bjoern Hoehrmann, Aug 4, 2011
    #2
    1. Advertising

  3. "" <> wrote:
    >I have started getting an error:
    >not well-formed (invalid token) at line 12 -- but the error-log does
    >not say which file happens to have this invalid token.


    You are missing semicolon in line 42.

    jue
     
    Jürgen Exner, Aug 4, 2011
    #3
  4. On 2011-08-03, <> wrote:

    > I have started getting an error:
    > not well-formed (invalid token) at line 12 -- but the error-log does
    > not say which file happens to have this invalid token.


    You need to provide an exact error message (including newlines).

    > If it helps, the shell script has started giving Segmentation fault
    > for:
    > echo $PERL extract-history.pl --start "$dt 00:00:00"
    > But in the very next line, it seems to call correctly:
    > /home/y/bin/perl extract-history.pl --start 2011-08-02 00:00:00


    Likewise.

    Note that a shell SCRIPT cann't be "giving Segmentation fault". You
    need to find which EXECUTABLE faults before asking for help...

    Ilya
     
    Ilya Zakharevich, Aug 4, 2011
    #4
  5. dn.perl Guest

    Jurgen was off by 6 lines.
    A semi-colon was missing in line 48 (not 42), the error said line 12, which
    is (48/4). And 12 = (48/6) + 4.

    A totally unsuspected line had created the issue. I had to comment out a
    block of 20 lines and find the offending line by uncommenting these 20 lines
    one-by-one. The owner of a called script (which gives out the vague
    error-message: not-well-formed line 12, no-filename-mentioned) has since
    fixed the issue.

    Will sort out later why the 'segmentation fault' error also appeared in the
    bargain.
    Thanks for the leads, Bjoern and Ilya. The 'segmentation fault' error really
    threw me off balance.
     
    dn.perl, Aug 4, 2011
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Cronus
    Replies:
    1
    Views:
    692
    Paul Mensonides
    Jul 15, 2004
  2. G Fernandes
    Replies:
    1
    Views:
    539
  3. Wessi
    Replies:
    3
    Views:
    878
    Lawrence Kirby
    Aug 11, 2005
  4. IamIan
    Replies:
    2
    Views:
    529
    IamIan
    Apr 7, 2007
  5. =?Utf-8?B?Y2FzaGRlc2ttYWM=?=

    This is an unexpected token. The expected token is 'NAME'

    =?Utf-8?B?Y2FzaGRlc2ttYWM=?=, Jul 13, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    796
    =?Utf-8?B?Y2FzaGRlc2ttYWM=?=
    Jul 13, 2007
Loading...

Share This Page