I have an XML Document which contains XML elements containing attributes from which I would like to get it's value and store it in a Hashmap.
Example:
<?xml version="1.0" encoding="UTF-8"?>
<Nodes>
<Node name="test1">
<mou>
<line3>hello</line3>
</mou>
</Node>
<Node name="test2">
<mou>
<line3>hello</line3>
</mou>
</Node>
<InputNode name="Chance">
<Test>
<RoundTo>100</RoundTo>
</Test>
</InputNode>
<InputNode name="total" />
</Nodes>
I'd like to parse this xml and retrieve the values attributes from all the elements named 'Node' and store it in a map object. So from the example above I would get
[name=test1,name=test2]
The problem is with maps the keys must be unique. How can I accomplish my goal using Java?