Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > 'invalid token' error and segmentation fault (XML issue?)

Reply
Thread Tools

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

 
 
dn.perl@gmail.com
Guest
Posts: n/a
 
      08-03-2011

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:umper, 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.
 
Reply With Quote
 
 
 
 
Bjoern Hoehrmann
Guest
Posts: n/a
 
      08-03-2011
* http://www.velocityreviews.com/forums/(E-Mail Removed) 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:umper, 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:arser. 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 · (E-Mail Removed) · 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/
 
Reply With Quote
 
 
 
 
Jürgen Exner
Guest
Posts: n/a
 
      08-04-2011
"(E-Mail Removed)" <(E-Mail Removed)> 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
 
Reply With Quote
 
Ilya Zakharevich
Guest
Posts: n/a
 
      08-04-2011
On 2011-08-03, (E-Mail Removed) <(E-Mail Removed)> 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
 
Reply With Quote
 
dn.perl
Guest
Posts: n/a
 
      08-04-2011

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.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Segmentation fault error enjoyfate@gmail.com C Programming 12 08-11-2008 05:02 AM
segmentation fault, malloc error mathieu.dutour@gmail.com C Programming 7 11-13-2007 09:37 AM
Segmentation Fault Error reported by GDB william C Programming 4 03-12-2007 09:52 PM
Error msg - Segmentation fault Pedro Pinto C Programming 10 11-03-2006 01:46 AM
copy algorithm:segmentation fault error appears utab C++ 1 02-18-2006 07:55 PM



Advertisments