What would be the best way to stick this XML into an object?
<root>
<data value=1>
<cell a='1' b='0'/>
<cell a='2' b='0'/>
<cell a='3' b='0'/>
</data>
<data value=12>
<cell a='2' b='0'/>
<cell a='4' b='1'/>
<cell a='3' b='0'/>
</data>
</root>
We can assume that
- Each
data valuewill be unique. - Actual numeric value assigned to it is important and needs to be captured
- Actual numbers assigned to data value may come in different order, It won't necessarily be an array of sequential numbers. All we know is that numbers will be unique
Is it possible to put this into Map<Integer, List<Cell>>, grouping cells under the data value?
Ideally method signature would look as follows
public static Map<Integer, List<Cell>> parse(String pathToFile)
Would you provide an example please?
<data>element below the root? Is thevalueattribute important? Can they be treated as an array (e.g., are thevalueattributes sequential)?