title: Reading an XML from a JavaFX application
body: <p>I would like to import an <code>XML</code> file via a pop-up window in my <code>JavaFX</code> application. After the importing, I would like to read it. For example I want to store, for every <code>&lt;testbus&gt;</code> the <code>&lt;index&gt;</code> and the <code>&lt;tb_name&gt;</code> in a <code>List</code> or something similar, where the <code>&lt;index&gt;</code> is the <code>index</code> of the <code>List</code> and the <code>&lt;tb_name&gt;</code> is the <code>element</code>of the <code>List</code>. I also would like that for every <code>&lt;testbus&gt;</code> I can access the <em>bitfields</em> and their name. So I was thinking about <code>List</code> of <code>List</code>. I have found a java Library called <code>JAXB</code> that can parse <code>XML</code> files, but I do not know how to achieve what I want.</p>
  
  <p><strong>This is the <code>XML</code> file</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  &lt;testbuses&gt;
      &lt;testbus&gt;
          &lt;index&gt;00&lt;/index&gt;
          &lt;tb_name&gt;buffermngr00&lt;/tb_name&gt;
              &lt;bitfield0&gt;
                  &lt;bitf_name&gt;aaa_00&lt;/bitf_name&gt;
              &lt;/bitfield0&gt;
              &lt;bitfield1&gt;
                  &lt;bitf_name&gt;aaa_01&lt;/bitf_name&gt;
              &lt;/bitfield1&gt;
              &lt;bitfield2&gt;
                  &lt;bitf_name&gt;aaa_02&lt;/bitf_name&gt;
              &lt;/bitfield2&gt;
              &lt;bitfield3&gt;
                  &lt;bitf_name&gt;aaa_03&lt;/bitf_name&gt;
              &lt;/bitfield3&gt;
              &lt;bitfield4&gt;
                  &lt;bitf_name&gt;aaa_03&lt;/bitf_name&gt;
              &lt;/bitfield4&gt;
              &lt;bitfield5&gt;
                  &lt;bitf_name&gt;aaa_04&lt;/bitf_name&gt;
              &lt;/bitfield5&gt;
              &lt;bitfield6&gt;
                  &lt;bitf_name&gt;aaa_04&lt;/bitf_name&gt;
              &lt;/bitfield6&gt;
              &lt;bitfield7&gt;
                  &lt;bitf_name&gt;aaa_05&lt;/bitf_name&gt;
              &lt;/bitfield7&gt;
      &lt;/testbus&gt;
      &lt;testbus&gt; 
          &lt;index&gt;01&lt;/index&gt;
          &lt;tb_name&gt;buffermngr01&lt;/tb_name&gt;
              &lt;bitfield0&gt;
                  &lt;bitf_name&gt;bbb_00&lt;/bitf_name&gt;
              &lt;/bitfield0&gt;
              &lt;bitfield1&gt;
                  &lt;bitf_name&gt;bbb_00&lt;/bitf_name&gt;
              &lt;/bitfield1&gt;
              &lt;bitfield2&gt;
                  &lt;bitf_name&gt;bbb_00&lt;/bitf_name&gt;
              &lt;/bitfield2&gt;
              &lt;bitfield3&gt;
                  &lt;bitf_name&gt;bbb_00&lt;/bitf_name&gt;
              &lt;/bitfield3&gt;
              &lt;bitfield4&gt;
                  &lt;bitf_name&gt;bbb_01&lt;/bitf_name&gt;
              &lt;/bitfield4&gt;
              &lt;bitfield5&gt;
                  &lt;bitf_name&gt;bbb_01&lt;/bitf_name&gt;
              &lt;/bitfield5&gt;
              &lt;bitfield6&gt;
                  &lt;bitf_name&gt;bbb_02&lt;/bitf_name&gt;
              &lt;/bitfield6&gt;
              &lt;bitfield7&gt;
                  &lt;bitf_name&gt;bbb_03&lt;/bitf_name&gt;
              &lt;/bitfield7&gt;
      &lt;/testbus&gt;  
  &lt;/testbuses&gt;
  </code></pre>
  
  <p>Anyway the structure of this XML is not strict, so if you have a suggestion for a better structure in order to make the reading easily, I will be happy to hear your solution.</p>