I am new and trying to enhance my knowledge to this framework. Having a difficulty in rendering a template, it gives me an error:
FileLoaderLoadException ERROR 64] XML declaration allowed only at the start of the document (in n/a - line 2, column 6) in C:\xampp\htdocs\symfony\configoutes/routes.xml (which is loaded in resource "C:\xampp\htdocs\symfony\configoutes/routes.xml")
Controller
<?php
namespace App\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
class UserController extends Controller
{
/**
* @Route("/homepage", name="user")
*/
public function index()
{
return $this->redirectToRoute('homepage');
}
}
YAML
user:
path: /homepage
controller: App\Controller\UserController::index
XML
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing
http://symfony.com/schema/routing/routing-1.0.xsd">
<route id="user" path="/homepage">
<default key="_controller">App\Controller\Userontroller::index</default>
</route>
</routes>
Question: How can I solve this? Is there something I missed causing this error?