0

I have python background so its really hard for me to get my hands on magento2, since I've never touched php/xml/js etc. before.

Currently I just want to add a button in admin backend, which leads to a "export orders" section.

Unfortunately I do not understand, why I get following error inside my routes.xml which is located in vendor/module/etc/adminhtml/

content of routes.xml

<?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="admin">
        <route id="new" frontName="new">
            <module name="Vendor_Module" before="Magento_Backend">
                <router id="admin">
                    <route id="menu" frontName="menu">
                        <module name="Vendor_Module" />
                    </route>
                </router>
            </module>
        </route>
    </router>
</config>

As soon as I open the backend it throws following error: Element 'module': Character content is not allowed, because the content type is empty. LINE 6

As you can see its not empty and I already made sure, that vendor_module is always the same like i defined in my module.xml

1
  • You have two module elements. One is empty, the other is not. It's complaining about the one that isn't. Commented Dec 23, 2022 at 12:03

2 Answers 2

0

Please check your file content in the below URL. There is some special character or Unicode in your file that you can not see.

link: https://freetools.textmagic.com/unicode-detector

Or you can delete the whole file content and write manually all content in routes.xml.

Also Check this link : How to define multiple routes in single module

<?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="admin">
        <route id="new" frontName="new">
            <module name="Vendor_Module" before="Magento_Backend"/>
        </route>
        <route id="menu" frontName="menu">
            <module name="Vendor_Module"/>
        </route>
    </router>
</config>
0

You cannot nest router/route nodes. Try something like:

<?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="admin">
        <route id="new" frontName="new">
            <module name="Vendor_Module" before="Magento_Backend"/>
        </route>
        <route id="menu" frontName="menu">
            <module name="Vendor_Module"/>
        </route>
    </router>
</config>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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