I want to parse Xml. In the xml there are multiple items, each item has a description, image and url amongst other things. I want to group all the items with the same description together and then have each item as a menu item. when clicking on the menu item it opens the list of all the items for that description.
Im thinking of using a HashTable with the key being the description and an ArrayList. Is there any other way?
Example
Something that I cannot figure out is this :
Description URL Image
Cars www.ford.com www.ford.com/image.jpg
Cars www.vw.com www.vw.com/image.jpg
Boat www.suzuki.com www.suzuki.com/image.jpg
So Cars would be the key in the Hashmap, how do I have 2 Strings? and then there would need to be 2 entries for Cars.
I support your solution.
I am thinking about encapsulate these three attributes as an object, in case that you don’t care about the order, i refer using
HashTablewith the key of the description and values areArrayListwith the classes you have created which has the three attributes you described. With this solution, you can conveniently access all the objects you want.Hope to help.