I am new to xml file reading in android. I looked up google for this but could not get an appropriate solution.
I wish to parse this xml file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aaaa</key>
<array>
<string>b</string>
<string>c</string>
<string>d</string>
<string>e</string>
<string>f</string>
</array>
<key>bbbb</key>
<array>
<string>g</string>
<string>h</string>
<string>i</string>
<string>j</string>
<string>k</string>
</array>
</dict>
</plist>
After parsing, I wish to obtain the following correspondance:
aaaa [b,c,d,e,f] -> a list/array
bbbb [g,h,i,j,k] -> a list/array
In other words, every string(key) should correspond to the array of the strings inside that key.
How do I do it? Also, I would like to know where I should place the xml file. (Is it in the res/raw/ folder ? If yes, then what would be the address of the file?)
A first draw to do that on your own :
In order to anserw your question regarding res/raw/ folder. Yes you have to put your XML in that folder and used it in your Java code via the R class.
Hope it helps,