How to create a blank ajax or htmlresponse page in Drupal 8.

I needed a page where I would render custom xml. First I tried a Drupal's HTMLResponse (first snippet), but only the second snippet using Symfony's response worked for me.
If not using rendering or views.
File name
MyModuleController.php
<?php

namespace Drupal\my_module\Controller;

use
Drupal\Core\Controller\ControllerBase;
use
Drupal\Core\Render\HtmlResponse;

/**
 * Class MyModuleController.
 *
 * @package Drupal\my_module\Controller
 */
class MyModuleController extends ControllerBase {

 
/**
   * Display.
   *
   * @return string
   *   Return html string.
   */
 
public function display() {
   
$html = 'content';

   
$response = new HtmlResponse();
   
$response->setContent($html);

    return
$response;
  }
}

?>
When using views or other rendering technique, caches get generated that may break your response. Then, use Symfony's HTTPFoundation response.
File name
MyModuleController.php
<?php

namespace Drupal\my_module\Controller;

use
Drupal\Core\Controller\ControllerBase;
use
Symfony\Component\HttpFoundation\Response;

/**
 * Class MyModuleController.
 *
 * @package Drupal\my_module\Controller
 */
class MyModuleController extends ControllerBase {

 
/**
   * Display.
   *
   * @return string
   *   Return html string.
   */
 
public function display() {
   
$xml = '<?xml version="1.0"?>
';

    $response = new Response();
    $response->setContent($xml);
    $response->setStatusCode(Response::HTTP_OK);
    $response->headers->set('Content-Type', 'application/rss+xml');
    $response->send();

    return new Response();
  }
}

?>