title: Flatten XML document in Java
body: <p>Is there any way to Flatten an XML document by removing all the nested tags / arrays to simple Key / Value pair. For example I have an example</p>
  
  <pre><code>&lt;root&gt;
  &lt;a&gt;
      &lt;b&gt;some-value1&lt;/b&gt;
      &lt;c&gt;some-value2&lt;/c&gt;
  &lt;/a&gt;
  &lt;a&gt;
      &lt;b&gt;some-value3&lt;/b&gt;
      &lt;c&gt;some-value4&lt;/c&gt;
  &lt;/a&gt;
  &lt;p&gt;some-value-p&lt;/p&gt;
  </code></pre>
  
  <p></p>
  
  <p>TO</p>
  
  <pre><code>root.a.0.b=some-value1
  root.a.0.c=some-value2
  root.a.1.b=some-value3
  root.a.1.c=some-value4
  root.p=some-value-p
  </code></pre>
  
  <p>I am looking for some solution in Java or Scala?</p>