XML : How to convert xml into Map

I have a XML file, it has several nodes, each node has the struct, show as below:

<ArchiveConfig type="XZCP"> <ArchiveProperties name="diner" fileName="diner.txt" maxCount="64" maxLength="161"/> <QuickCodeConfig enabled="true" length="10" position="144"/> <FieldFormat> <FieldItem byteCount="21" position="1" string=" "/> <FieldItem byteCount="77" position="22" string=" "/> <FieldItem byteCount="45" position="99" string=" "/> <FieldItem byteCount="40" position="144" string=" "/> </FieldFormat> </ArchiveConfig> I want to convert the XML file into a HashMap, and the key has to be the value of "type" in node "ArchiveConfig". I am using xStream and I am able to convert the XML file into a List, how can I solve the problem?

No comments:

Post a Comment