stageMetadata.setUrl(metadataNodeKid.getAttributes().getNamedItem("url").getTextContent());
stageMetadata.setDescription(metadataNodeKid.getAttributes().getNamedItem("description").getTextContent());
metadata.put(metadataNodeKid.getAttributes().getNamedItem("id").getTextContent(), stageMetadata);
}
if (metadataNodeKid.getNodeName().equals("show")) {
ShowMetadata showMetadata = new ShowMetadata();
showMetadata.setUrl(metadataNodeKid.getAttributes().getNamedItem("url").getTextContent());
showMetadata.setDescription(metadataNodeKid.getAttributes().getNamedItem("description").getTextContent());
metadata.put(metadataNodeKid.getAttributes().getNamedItem("id").getTextContent(), showMetadata);
}
}
}
Node eventNode = dom.getDocumentElement();
event.setName(eventNode.getAttributes().getNamedItem("name").getTextContent());
if (eventNode.getAttributes().getNamedItem("shortName") != null) {
event.setShortName(eventNode.getAttributes().getNamedItem("shortName").getTextContent());
}
if (eventNode.getAttributes().getNamedItem("uri") != null) {
event.setUri(eventNode.getAttributes().getNamedItem("uri").getTextContent());
}
if (eventNode.getAttributes().getNamedItem("version") != null) {
event.setVersion(new Long(eventNode.getAttributes().getNamedItem("version").getTextContent()));
}
if (eventNode.getAttributes().getNamedItem("versionTime") != null) {
event.setVersionTime(Util.dateTime(eventNode.getAttributes().getNamedItem("versionTime").getTextContent()));
}
NodeList programKids = dom.getElementsByTagName("program").item(0).getChildNodes();
for (int i = 0; i < programKids.getLength(); i++) {
Node stageNode = programKids.item(i);
if (stageNode.getNodeType() != Node.ELEMENT_NODE && !stageNode.getNodeName().equals("stage")) {
continue;
}
Stage stage = event.addStage(stageNode.getAttributes().getNamedItem("name").getTextContent());
if (stageNode.getAttributes().getNamedItem("id") != null) {
StageMetadata stageMetadata = (StageMetadata) metadata.get(stageNode.getAttributes().getNamedItem("id").getTextContent());
stage.setMetadata(stageMetadata);
}
if (stageNode.getAttributes().getNamedItem("shortName") != null) {
stage.setShortName(stageNode.getAttributes().getNamedItem("shortName").getTextContent());
}
NodeList stageKids = stageNode.getChildNodes();
for (int j = 0; j < stageKids.getLength(); j++) {
Node dayNode = stageKids.item(j);
if (dayNode.getNodeType() != Node.ELEMENT_NODE && !dayNode.getNodeName().equals("day")) {
continue;
}
DayProgram dayProgram = stage.addDay(Util.date(dayNode.getAttributes().getNamedItem("date").getTextContent()));
NodeList dayKids = dayNode.getChildNodes();
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) {