0

question worth million dollars for a noob like me. I would like to store a list in xml in java for android... Such as this

<?xml version="1.0" encoding="utf-8"?>
<places>
    <id1>
        <Name>Sydney</Name>
        <Code>abc-def-ghi</Code>
        <Latitude>-33.859972</Latitude>
        <Longitude>151.211111</Longitude>
    </id1>

    <id2>
        ...
    </id2>
</places>

Then I would like to call it back programatically. I saw people using such construction in all tutorials all over the web, but eclipse expects Array with items.

Q1: What am I doing wrong with the XML? Q2: How can I recall the values in the code?

Thank you all!

Ondra

Whitewall
  • 597
  • 1
  • 7
  • 18

1 Answers1

1

Store the XML file in the assets folder and then check out this question, it answers how to open the file.

android: how to load xml file from assets directory?

Community
  • 1
  • 1
Faisal Abid
  • 8,900
  • 14
  • 59
  • 91