I would like to import an XML file via a pop-up window in my JavaFX application. After the importing, I would like to read it. For example I want to store, for every <testbus> the <index> and the <tb_name> in a List or something similar, where the <index> is the index of the List and the <tb_name> is the elementof the List. I also would like that for every <testbus> I can access the bitfields and their name. So I was thinking about List of List. I have found a java Library called JAXB that can parse XML files, but I do not know how to achieve what I want.
This is the XML file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<testbuses>
    <testbus>
        <index>00</index>
        <tb_name>buffermngr00</tb_name>
            <bitfield0>
                <bitf_name>aaa_00</bitf_name>
            </bitfield0>
            <bitfield1>
                <bitf_name>aaa_01</bitf_name>
            </bitfield1>
            <bitfield2>
                <bitf_name>aaa_02</bitf_name>
            </bitfield2>
            <bitfield3>
                <bitf_name>aaa_03</bitf_name>
            </bitfield3>
            <bitfield4>
                <bitf_name>aaa_03</bitf_name>
            </bitfield4>
            <bitfield5>
                <bitf_name>aaa_04</bitf_name>
            </bitfield5>
            <bitfield6>
                <bitf_name>aaa_04</bitf_name>
            </bitfield6>
            <bitfield7>
                <bitf_name>aaa_05</bitf_name>
            </bitfield7>
    </testbus>
    <testbus> 
        <index>01</index>
        <tb_name>buffermngr01</tb_name>
            <bitfield0>
                <bitf_name>bbb_00</bitf_name>
            </bitfield0>
            <bitfield1>
                <bitf_name>bbb_00</bitf_name>
            </bitfield1>
            <bitfield2>
                <bitf_name>bbb_00</bitf_name>
            </bitfield2>
            <bitfield3>
                <bitf_name>bbb_00</bitf_name>
            </bitfield3>
            <bitfield4>
                <bitf_name>bbb_01</bitf_name>
            </bitfield4>
            <bitfield5>
                <bitf_name>bbb_01</bitf_name>
            </bitfield5>
            <bitfield6>
                <bitf_name>bbb_02</bitf_name>
            </bitfield6>
            <bitfield7>
                <bitf_name>bbb_03</bitf_name>
            </bitfield7>
    </testbus>  
</testbuses>
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.
 
     
    