return parse(doc);
}
public List<JavaOneInterval> parse(Document doc) {
List<JavaOneInterval> eventList = new ArrayList<JavaOneInterval>();
NodeList nl = doc.getElementsByTagName("tr");
for (int i = 0; i < nl.getLength(); i++) {
if (nl.item(i).getNodeType() != Node.ELEMENT_NODE) {
continue;
}
Element el = (Element) nl.item(i);
NodeList columnNodeList = el.getElementsByTagName("td");
JavaOneInterval event = new JavaOneInterval();
eventList.add(event);
for (int jj = 0; jj < columnNodeList.getLength(); jj++) {
if (columnNodeList.item(jj).getNodeType() != Node.ELEMENT_NODE) {
continue;
}
Element columnElement = (Element) columnNodeList.item(jj);
switch (jj) {
case 0:
event.setId(columnElement.getTextContent().trim());
break;
case 1:
event.setDescription(columnElement.getTextContent().trim());
break;
case 2:
event.setType(columnElement.getTextContent().trim());
break;
case 3:
event.setSpeakers(columnElement.getTextContent().trim());
break;
case 4:
NodeList timeNodes = columnElement.getChildNodes();
for (int j = 0; j < timeNodes.getLength(); j++) {
if (timeNodes.item(j) != null) {
String dateStr = timeNodes.item(j).getTextContent().trim();
if (dateStr.contains("June")) {
int day = Integer.parseInt(dateStr.split(" ")[1]);
String timeStrs[] = timeNodes.item(j + 2).getTextContent().trim().split(" - ");
String startStr = timeStrs[0];
String endStr = timeStrs[1];
int index = startStr.indexOf(":");
int index2 = startStr.indexOf(" ");
int startHour = Integer.parseInt(startStr.substring(0, index));