0

I added one custom HelloWorld module in a fresh Magento 2 installation and I got the following error:

Warning: DOMDocument::loadXML(): Extra content at the end of the document in Entity, line: 8 in /var/www/magento2/vendor/magento/framework/Config/Dom.php on line 365

What can be the exact cause for this issue?

I get this error even when I install the sample module from Magento repo. I have not done any edits to the sample module.

It was my custom module causing the problem. Sample module from magento github works fine.

1

Sounds like one of your XML files in your module has bad syntax. Make sure every opening tag has a closing tag, and that there is only one root level XML tag per XML file.

  • I get this error even when I install the sample module from Magento repo. I have not done any edits to the sample module. github.com/magento/magento2-samples/tree/master/… – Mukesh Chapagain Jan 14 '16 at 4:18
  • When do you get the error? Somewhere along the line you may have accidentally changed an XML file; maybe you accidentally deleted a > or similar. Can you look at all recently modified XML files? – andyjv Jan 15 '16 at 19:10
0

My module was named Chapagain_HelloWorld. The problematic XML file was app/code/Chapagain/HelloWorld/etc/frontend/routes.xml

I don't know what exactly caused the problem. I just replaced the code present there with similar code from another module and changed the module name, route id, and frontname and then the module worked without any error. But, I could not see any difference in the replaced code and the problematic code.

Here the code of my routes.xml file:

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="standard">
        <route id="helloworld" frontName="helloworld">
            <module name="Chapagain_HelloWorld" />
        </route>
    </router>
</config>
  • I faced this issue with empty routes.xml file – Mukesh Dec 30 '16 at 7:12
0

For version 2.0 remove xml version tag at starting of your xml files.

I don't know why but after removing it my code starts working, while the above works for version>2.1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.