title: Retrieve local XML file from Angular 7 component
body: <p>I will like to read an XML file from found in <code>src/assets/test.xml</code>. I have a component found in <code>src/app/app.component.ts</code> as so:</p>
  
  <pre><code>import { Component } from '@angular/core';
  import { Router } from '@angular/router';
  import { HttpClient, HttpHeaders } from '@angular/common/http';
  
  @Component({
      selector: 'app-root',
      templateUrl: './home.component.html',
      styleUrls: ['./home.component.css']
  })
  export class HomeComponent {
      constructor(private router: Router, private httpClient: HttpClient) {
          this.getProducts();
      }
  
  
      getProducts() {
          const headers = new HttpHeaders();
          headers.set('Content-Type', 'text/xml');
  
          this.httpClient
              .get('assets/test.xml', { headers, responseType: 'text' })
              .subscribe(output =&gt; console.log(output));
      }
  }
  </code></pre>
  
  <p>Inside the <code>app.module.ts</code> I have imported the <code>HttpClientModule</code> as required and the only error message I receive is:</p>
  
  <pre><code>{
      body: {error: "Collection 'test' not found"},
      headers: HttpHeaders {normalizedNames: Map(0), lazyUpdate: null, lazyInit: ƒ},
      status: 404,
      statusText: "Not Found",
      url: "assets/test.xml"
  }
  </code></pre>
  
  <p>I tried with other assets in the <code>assets</code> folder but still without any success. Can anyone help me out please?</p>