Java tutorial
//package com.java2s; import java.util.ArrayList; import org.w3c.dom.CharacterData; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static ArrayList<String> getDatesArray(Document allDoc) { NodeList nodes = allDoc.getElementsByTagName("day"); ArrayList<String> datesArray = new ArrayList<String>(); for (int i = 0; i < nodes.getLength(); i++) { Element element = (Element) nodes.item(i); NodeList datesNodes = element.getElementsByTagName("date"); Element line = (Element) datesNodes.item(0); datesArray.add(getCharacterDataFromElement(line).trim());//gotta trim...or you can't see shiat } return datesArray; } public static String getCharacterDataFromElement(Element e) { Node child = e.getFirstChild(); if (child instanceof CharacterData) { CharacterData cd = (CharacterData) child; return cd.getData(); } return "?"; } }