title: Java : Convert formatted xml file to one line string
body: <p>I have a formatted XML file, and I want to convert it to one line string, how can I do that.</p>
  
  <p>Sample xml: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;books&gt;
     &lt;book&gt;
         &lt;title&gt;Basic XML&lt;/title&gt;
         &lt;price&gt;100&lt;/price&gt;
         &lt;qty&gt;5&lt;/qty&gt;
     &lt;/book&gt;
     &lt;book&gt;
       &lt;title&gt;Basic Java&lt;/title&gt;
       &lt;price&gt;200&lt;/price&gt;
       &lt;qty&gt;15&lt;/qty&gt;
     &lt;/book&gt;
  &lt;/books&gt;
  </code></pre>
  
  <p>Expected output</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;books&gt;&lt;book&gt; &lt;title&gt;Basic XML&lt;/title&gt;&lt;price&gt;100&lt;/price&gt;&lt;qty&gt;5&lt;/qty&gt;&lt;/book&gt;&lt;book&gt;&lt;title&gt;Basic Java&lt;/title&gt;&lt;price&gt;200&lt;/price&gt;&lt;qty&gt;15&lt;/qty&gt;&lt;/book&gt;&lt;/books&gt;
  </code></pre>
  
  <p>Thanks in advance.</p>