title: How to read an XML file with Java?
body: <p>I don't need to read complex XML files. I just want to read the following configuration file with a simplest XML reader</p>
  <pre><code>&lt;config&gt;
      &lt;db-host&gt;localhost&lt;/db-host&gt;
      &lt;db-port&gt;3306&lt;/db-port&gt;
      &lt;db-username&gt;root&lt;/db-username&gt;
      &lt;db-password&gt;root&lt;/db-password&gt;
      &lt;db-name&gt;cash&lt;/db-name&gt;
  &lt;/config&gt;
  </code></pre>
  <p>How to read the above XML file with a XML reader through Java?</p>
  <p><a href="https://i.stack.imgur.com/iatXr.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iatXr.jpg" alt="" /></a></p>