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

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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
   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.

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

* dn.perl@gmail.com wrote in comp.lang.perl.misc:
Quoted text here. Click to load it

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


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:bjoern@hoehrmann.de · 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/

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

Quoted text here. Click to load it

You are missing semicolon in line 42.


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

Quoted text here. Click to load it

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

Quoted text here. Click to load it


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


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

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
Thanks for the leads, Bjoern and Ilya. The 'segmentation fault' error really
threw me off balance.

Site Timeline