A co-worker of mine was working on a Magento site and ran into the following error:
Warning: simplexml_load_string(): Entity: line 1: parser error : XML declaration allowed only at the start of the document in /.../.../.../.../app/code/core/Mage/Core/Model/Layout/Update.php on line 431
I’ve seen this before, but didn’t remember exactly what to look for. So, here’s what I did to solve his issue, and hopefully this ends up helping you:
Open up app/code/core/Mage/Core/Model/Layout/Update.php and go down to line 431 where the error is occurring. Right before that line, insert a new line:
Make sure your logging is turned on, then refresh the page in your browser. It will end up spitting out a bunch of layout files in your var/log/system.log. The last layout xml file on the list should be your culprit. In my case, there were 4 spaces in front of the xml declaration in the last file on the list. So, I removed the spaces, and everything worked fine.
Don’t forget to remove the line you put in Update.php when you are done!