0

I migrated M1 data to M2 using ubertheme data migration pro. When I install a theme to my site and load the home page, I am getting the following exception:

1 exception(s): Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'block', attribute 'class': [facet 'pattern'] The value 'about-us' is not accepted by the pattern '[A-Z][_a-zA-Z\d](\[A-Z][_a-zA-Z\d])*'. Line: 710

Ansar Husain
  • 3,409
  • 1
  • 12
  • 30
Gok
  • 1
  • 1
  • 2

4 Answers4

1

In my case there was a blank space

<block class=" test\test\Block\Adminhtml\Datacheck" name='dataimprortblock' template="test::dataimport.phtml"/>

class name was having blank space before start

" test\test\Block\Adminhtml\Datacheck"

After removing the blank space the class name

"test\test\Block\Adminhtml\Datacheck"

That fixed in my case

Muhammad Ayaz
  • 452
  • 3
  • 11
0

Hey You can go through below link for solution:

How to fixElement block,attribute,class

if you find this answer helpful please mark it as solution or upvote thanks.

Shubham Khandelwal
  • 1,076
  • 6
  • 10
  • Hi Shubham, can you please help me locate this file; where I need to go make the change? – Gok Sep 26 '18 at 06:59
  • I am not sure still can you check "Magento\Framework\Config\Dom\ValidationException" and "magento/framework/View/Element/Template/File/Validator.php" these two files because they are basically use to validate the files. – Shubham Khandelwal Sep 26 '18 at 07:11
  • "Magento\Framework\Config\Dom\ValidationException" has nothing other than 'namespace Magento\Framework\Config\Dom;

    /**

    • @api

    */ class ValidationException extends \InvalidArgumentException { }'

    What should I look for inside "magento/framework/View/Element/Template/File/Validator.php" in particular?

    – Gok Sep 26 '18 at 08:28
0

This error showed up to me when I created a custom block. The class attribute value was correct, there was no space or slash at the beginning, but the error was still happening.

After a lot of time, I finally figured out my module namespace was not following Magento pattern.

Apparently, the first letter for Magento modules / namespaces must be uppercase, or some weird errors start happening (as was my case).

So I changed my custom module from vendor/Module to Vendor/Module and it worked :D

0

In my case there was a slash issue in xml file.

<block class="World/Just/Block/Adminhtml/Testing" name='dataimprortblock' template="World_Just::just.phtml"/>

After change slash in the class name

"World\Just\Block\Adminhtml\Testing"

After That fixed.