Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <playList baseUrl= "Webaddress"
- <file name="xxxxxxx.xxx" showTime="YYYY-MM-DD HH:MM" />
- <file name="xxxxxxx.xxx" showTime="YYYY-MM-DD HH:MM" />
- .......
- </playList>
- static final String KEY_ITEM ="playlist";
- static final String KEY_NAME = "name";
- static final String KEY_DESC = "showTime";
- XMLParser parser = new XMLParser();
- String xml = parser.getXmlFromUrl(URL); // getting XML
- Document doc = parser.getDomElement(xml); // getting DOM element
- NodeList nl = doc.getElementsByTagName(KEY_ITEM);
- // looping through all item nodes <item>
- for (int i = 0; i < nl.getLength(); i++) {
- // creating new HashMap
- HashMap<String, String> map = new HashMap<String, String>();
- Element e = (Element) nl.item(i);
- map.put(KEY_COST, getString(e))
- // adding each child node to HashMap key => value
- map.put(KEY_NAME, parser.getValue(e, KEY_NAME));
- map.put(KEY_DESC, parser.getValue(e, KEY_DESC));
- // adding HashList to ArrayList
- menuItems.add(map);
Add Comment
Please, Sign In to add comment