I hava a XML file containing Infos:
<Datas>
<Data type="DL ">
<IndexLine>
<Field name="TerminalNum" string=""/>
</IndexLine>
<BusinessLine>
<Field name="MachineNum" string=" "/>
<Field name="StuffNum" string=" "/>
<Field name="psw" string=""/>
</BusinessLine>
</Data>
<Data type="PM ">
<IndexLine>
<Field name="TerminalNum" string=""/>
</IndexLine>
<BusinessLine>
<Field name="MachineNum" string=" "/>
<Field name="StuffNum" string=" "/>
<Field name="psw" string=""/>
</BusinessLine>
</Data>
</Datas>
How can I convert the above XML into Map such as HashMap<String,Data>
. The key is the value of attribute "type", and Data is a bean that defines the node <Data> </Data>
content.