title: parsing and display xml data in asp.net core
body: <p>Im still working on my first asp.net core project and now I want to display "a qoute of the day".
  I have the qoutes in a xml file stored in a folder called File under wwwroot.</p>
  
  <p>Im planning on my making this a View Component.</p>
  
  <p>Im used to working with web forms so it seems like Im spending alot of time on small issues, but I guess its the only way to learn.</p>
  
  <p>I've created a folder named Custom where I plan to hold all my custom classes. the QuoteController.cs is located in the Controllers folder.</p>
  
  <p>So yeah, I think I know how to crate the View Component. "I think" is an important factor here.
  Im also used to using XmlDocument, so Im trying my best to get XmlReader to work. But any hint or tips would be highly appreciated.</p>
  
  <p>This is what I got so far. QuoteController.cs</p>
  
  <pre><code>public class QuoteController : Controller
  {
      public Custom.Quote Index()
      {
          Custom.Quote result = new Custom.Quote();
          XmlReader rdr = XmlReader.Create(@"\File\qoutes.xml");
          Random rnd = new Random(DateTime.Now.Millisecond);
          int tmp = rdr.AttributeCount;
          int count = rnd.Next(0, tmp);
          int i = 0;
  
          while (rdr.Read())
          {
              if (count.Equals(i))
              {
                  result = new Custom.Quote(rdr.GetAttribute("q"), rdr.GetAttribute("author"));
                  break;
              }
  
              i++;    
          }
  
          rdr.Dispose();
          rdr = null;
          rnd = null;
  
          return result;
      }
  }
  </code></pre>
  
  <p>I guess the next step will be to add some visuals, but I cant imagine that my code actully works. Does anybody know how to easily parse through and xml file i CORE? Should I go for async?</p>
  
  <p>I guess it doesnt matter, but the xml file is formated like:</p>
  
  <pre><code>&lt;quotes&gt;
      &lt;q&gt;Be Strong&lt;/b&gt;
      &lt;author&gt;Stein The Ruler&lt;/author&gt;
  &lt;/quotes&gt;
  </code></pre>
  
  <p>Again, I will be very happy if you take the time to look at this :)</p>
  
  <p>Thank you!</p>