I have a multidimensional array, for example:
String[][] greatCities = new String[2][2];
greatCities[0][0] = "Vancouver";
greatCities[0][1] = "Charlottetown";
greatCities[1][0] = "Zürich";
greatCities[1][1] = "Bern";
Now I am looking for a good way to save the structure (without code) of this array in an XML file. The best solution I have so far:
<GreatCities>
<Item index0="0" index1="0">Vancouver</Item>
<Item index0="0" index1="1">Charlottetown</Item>
<Item index0="1" index1="0">Zürich</Item>
<Item index0="1" index1="1">Bern</Item>
</GreatCities>
Does anyone have a better solution?
source
share