December 14, 2018


Thinking Magento

Warning: simplexml_load_string(): Entity: line parser error : StartTag: invalid element name

So you've enabled your Magento cache and your var/log/system.log file is starting to fill up with entries. This is because it's just built a cache of your config.xml, system.xml & adminhtml.xml files and there is an error in one of them.

StartTag: invalid element name - This is often simple because the xml element starts with a number, but could be a symbol etc

Can we be sure it's a configuration .xml file? Yep, because of the following error lib/Varien/Simplexml/Config.php

Navigate via SSH to your app directory and run

find . -type f -name "*.xml" -exec xmllint --noout {} \;

This will validate your xml files and find the bad one... hopefully.

Unfortunately Magento throws a spanner into the works that you should also be aware of  the table CORE_CONFIG_DATA in your database. Magento takes the path value of each entry and converts it to an XML. So in your core_config_data table, you may see postcode/license and Magento will convert this to <postcode><license>

However if an old module corrupted or was badly formed when it was saved, you may find something with a path like 2DSoR0swfgww77YzlyE0EsGDiyjUIE4G, which would create an XML value of <2DSoR0swfgww77YzlyE0EsGDiyjUIE4G>, which is invalid anyway but also doesn't pertain to a modules configuration.

Delete this entry from your core_config_data table and you will be steam rolling along again