Comment traiter les occurences d'un Xml en java ?
Bonjour,
Je souhaiterais savoir comment je pourrais traiter des occurences d'un fichier XML tels que :
Code:
1 2 3 4 5
|
<Test>
<Information T="A">C</Information>
<Information T="B">D</Information>
</Test> |
Comment je pourrais traiter cette occurence avec une hashmap ?
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
if("Information".equals(rawName)){
map_Info.put("T=A",recupChaine);
map_Info.put("T=B",recupChaine);
test.setMap_Info(map_Info);
Set entries = map_Info.entrySet();
Iterator it = entries.iterator();
while (it.hasNext()) {
Map.Entry entry = (Map.Entry) it.next();
System.out.println(entry.getKey() + "-->" + entry.getValue());
} |
Le souci étant que ma recupChaine écrase ma précédente.
Du coup cela me fait
T=A-->D au lieu de T=A-->C
T=B-->D
Merci.