For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > March 2005 > xml error









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author xml error
Octavian Rasnita

2005-03-08, 8:56 am

Hi,

I am using a simple program that downloads an XML file from a web site, then
gets the data from it using XML::Simple, but sometimes, it gives the
following error:

not well-formed (invalid token) at line 2, column 39381, byte 39420 at
D:/usr/site/lib/XML/Parser.pm line 187

I have previously saved the downloaded XML file in order to see what's wrong
with it, but the file has less than 39420 chars with 2 chars. And it seems
to be ok.

But maybe sometime the format of the generated XML file is bad... I would
like to let the program run without dying with that error.

Please help!

Thank you.

Teddy

Gretar M Hreggvidsson

2005-03-08, 3:57 pm

Have you tried to open that XML page in a browser?

Do you write the XML to file before you parse it? Then this could have
something to do with encoding, your computer might not support the
encoding defined in the XML header.

The XML source could also just be unreliable, lacking encoding of some
non-valid XML charachters. You could try to validate it using this
online XML validator:

http://www.w3schools.com/dom/dom_validate.asp

Gretar

Octavian Rasnita wrote:
> Hi,
>
> I am using a simple program that downloads an XML file from a web site, then
> gets the data from it using XML::Simple, but sometimes, it gives the
> following error:
>
> not well-formed (invalid token) at line 2, column 39381, byte 39420 at
> D:/usr/site/lib/XML/Parser.pm line 187
>
> I have previously saved the downloaded XML file in order to see what's wrong
> with it, but the file has less than 39420 chars with 2 chars. And it seems
> to be ok.
>
> But maybe sometime the format of the generated XML file is bad... I would
> like to let the program run without dying with that error.
>
> Please help!
>
> Thank you.
>
> Teddy
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com