0

I am using magento 2.0 I have learn magento2 tutorials(No frills magento2 layout) of alan storm. I have create two xml files. when i run controller file then give Following error

Warning: simplexml_load_string(): Entity: line 1: parser error : XML declaration allowed only at the start of the document in C:\wamp\www\magentodemo\vendor\magento\framework\View\Model\Layout\Merge.php on line 488

my xml file is :

top-container.xml

<?xml version="1.0" encoding="UTF-8"?>
 <container name="top" > </container>

block.xml

  <?xml version="1.0" encoding="UTF-8"?>
  <referenceContainer name="top">
<block class="Magento\Framework\View\Element\Template" name="pulsestorm_nofrills_chapter2_block1" template="Pulsestorm_Nofrillslayout :: chapter2/block1.phtml">
</block>
 </referenceContainer>

file locations is

app
  code
     namespace
         modulename
              sample-xml
                -top-container.xml
                -block.xml

Please suggest me

4
  • Can you update the whole xml code with xml file name? – Sukumar Gorai Oct 3 '18 at 15:20
  • @SukumarGorai i have update whole xml code – pramod24 Oct 3 '18 at 15:40
  • What are the file path of block.xml and top-container.xml? – Sukumar Gorai Oct 3 '18 at 15:45
  • @SukumarGorai i have update my question please check – pramod24 Oct 3 '18 at 16:29
0

in block.xml remove the space in the beginning (see below), then it should work

(no space here)<?xml version="1.0" encoding="UTF-8"?>
          <referenceContainer name="top">
        <block class="Magento\Framework\View\Element\Template" name="pulsestorm_nofrills_chapter2_block1" template="Pulsestorm_Nofrillslayout :: chapter2/block1.phtml">
        </block>
         </referenceContainer>

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.