for (int k = 0; k < dayKids.getLength(); k++) {
Node showNode = dayKids.item(k);
if (showNode.getNodeType() != Node.ELEMENT_NODE && !showNode.getNodeName().equals("show")) {
continue;
}
Show show = dayProgram.addShow(
showNode.getAttributes().getNamedItem("name").getTextContent(),
Util.dateTime(showNode.getAttributes().getNamedItem("start").getTextContent()),
Util.duration(showNode.getAttributes().getNamedItem("duration").getTextContent())
);
if (showNode.getAttributes().getNamedItem("shortName") != null) {
show.setShortName(showNode.getAttributes().getNamedItem("shortName").getTextContent());
}
if (showNode.getAttributes().getNamedItem("cancelled") != null) {
show.setCancelled(new Boolean(showNode.getAttributes().getNamedItem("cancelled").getTextContent()));
}
if (showNode.getAttributes().getNamedItem("id") != null) {
String showId = showNode.getAttributes().getNamedItem("id").getTextContent();
ShowMetadata showMetadata = (ShowMetadata) metadata.get(showId);
if (showMetadata != null) {
show.setMetadata(showMetadata);
}
Show theOtherShow = showById.get(showId);
if (theOtherShow != null) {
if (showNode.getAttributes().getNamedItem("oldVersion") == null
|| new Boolean(showNode.getAttributes().getNamedItem("oldVersion").getTextContent())) {
show.setNewVersion(theOtherShow);
theOtherShow.setOldVersion(show);
} else {
show.setOldVersion(theOtherShow);
theOtherShow.setNewVersion(show);
}
} else {
// we don't know our other show yet
showById.put(showId, show);
}