title: Scala: What is the easiest way to get all leaf nodes and their paths in an XML?
body: <p>I am currently implementing DFS traversal of an xml such that it goes to each leaf node and generates the path to the leaf node.</p>
  
  <p>Given XML:</p>
  
  <pre><code>&lt;vehicles&gt;
    &lt;vehicle&gt;
      gg
    &lt;/vehicle&gt;
    &lt;variable&gt;
    &lt;/variable&gt;
  &lt;/vehicles&gt;
  </code></pre>
  
  <p>Output (Somthing like):</p>
  
  <pre><code>Map("gg" -&gt; "vehicles/vehicle", "" -&gt; "vehicles/variable")
  </code></pre>
  
  <p>It would be great if there is a library available that does this so I dont have to maintain the code.<br/><br/>
  Thanks. Any help is appreciated.</p>