I do declare! But my XML doesn't.
February 26, 2008 5:24 PM   Subscribe

We are moving our sites from a WAMP to a LAMP and one of the XML parser classes has gone all haywire. Eeep.

I love that I have another developer on my team now, but unfortunately, that means I don't know every piece of code on our sites. Kid Wonder created an app for sending our product (video based) to mobile devices using the class WURFL_PHP. He *said* he tested everything on the new server before we changed, but now that the A records are switched (something I need a third party for) the parse in his application is returning "XML error: XML declaration not finished at line 1 column 15".

A Google of the error turned up a few CMS install issues, and several pages displaying the error, but nothing too useful to me. Everything was fine on the WAMP server, so I'm wondering if there's something I'm missing. (God knows I've had my head in the trees today and my grey matter isn't where it should be.)

I checked out the XML doc, and it's properly formatted, as far as I can tell. (It's the doc supplied here.) The class is well written and doesn't seem to be missing anything. XML features are all enabled in PHP. Help Mefites!
posted by foxydot to Computers & Internet (9 answers total)
check that the xml declaration is at the very begining of the doc, looks like:

<?xml version="1.0"?>

and has no leading spaces or newlines. It must be the absolutely very first thing in the file.

Good luck!
posted by jenkinsEar at 5:39 PM on February 26, 2008

DOS line endings?
posted by genghis at 5:51 PM on February 26, 2008

Smart quotes?
posted by flabdablet at 6:09 PM on February 26, 2008

OK, I just downloaded the file you linked to and had a look in it, and it contains neither DOS line endings nor "smart" quotes.

Are you sure your parser is parsing the file you think it's parsing?
posted by flabdablet at 6:35 PM on February 26, 2008

Are you sure your parser is parsing the file you think it's parsing?

Yeah, I suspect the file is never making it into the XML parser. When I follow that link in Firefox, I get a response saying the file is over 6MB, but it stops loading and just hangs after about 5MB.
posted by scottreynen at 7:04 PM on February 26, 2008

If the parser can't actually find the file it needs, and this has happened after moving from Windows to Linux, it might be because the Linux filesystems are case-sensitive and the Windows ones aren't. Can you chefilesystem issue. Are you sure you're not trying to parse Wurfl.xml or wurfl.XML?
posted by flabdablet at 7:08 PM on February 26, 2008

Phew, I did a fluffer. Please ignore that typing fart.
posted by flabdablet at 7:09 PM on February 26, 2008

Not smart quotes, but it put me on the trail. Two days ago Boy Wonder was testing another of the moved sites and had a "weird error", which was really a malformed MySQL request puking into the buffer. Because I didn't have time to figure out why his code wasn't escaping properly, I cheated my way out and turned on runtime magic quotes in PHP. Aaaaand, the magic quotes added a / before the " in version="1.0".

Thanks for the brain tap guys! At least now the mobile service is running, and that's the Big Boss' favorite toy. He won't notice the malformed MySQL for a couple days! ;)
posted by foxydot at 8:43 PM on February 26, 2008

Reason I thought it might be quote-related is because that's what's on line 1 at column 15.
posted by flabdablet at 3:13 AM on February 28, 2008

« Older Portable backup   |   Mental health services paid out-of-pocket: to tell... Newer »
This thread is closed to new comments.