0

i am getting below error for magento 2.4 and it is working fine in magento 2.3

Magento\Framework\Exception\LocalizedException: The XML in file "/var/www/html/magento240/app/code/PPPL/PhonePe/etc/frontend/events.xml" is invalid: Element 'event': Missing child element(s). Expected is ( observer ). Line: 4 Verify the XML and try again. in /var/www/html/magento240/vendor/magento/framework/Config/Reader/Filesystem.php:156 Stack trace: #0 /var/www/html/magento240/vendor/magento/framework/Config/Reader/Filesystem.php(132)

Please find the code for /var/www/html/magento240/app/code/PPPL/PhonePe/etc/frontend/events.xml

<?xml version="1.0"?><config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"><event name="checkout_onepage_controller_success_action">
        <!-- Do nothing -->
    </event>
</config>
1

It seems you didn't added observer name inside <event> tag.

You must have to declare <observer> tag inside <event> tag like below..

<observer name="observer_name" instance="Namespace\Module\Observer\ObserverClass" />

Because it's required, You can check more details in below Schema file..

vendor/magento/framework/Event/etc/events.xsd

Hope this will help you!

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.