* @param objectNode
*
* @return A TOCReference of the object has a non-blank param child with name 'Name' and a non-blank param name 'Local'
*/
private static TOCReference processObjectNode(Node objectNode, Resources resources) {
TOCReference result = null;
NodeList children = objectNode.getChildNodes();
String name = null;
String href = null;
for(int i = 0; i < children.getLength(); i++) {
Node node = children.item(i);
if(node.getNodeName().equals("param")) {
String paramName = ((Element) node).getAttribute("name");
if("Name".equals(paramName)) {
name = ((Element) node).getAttribute("value");
} else if("Local".equals(paramName)) {
href = ((Element) node).getAttribute("value");
}
}
}
if((! StringUtils.isBlank(href)) && href.startsWith("http://")) {
return result;
}
if(! StringUtils.isBlank(name)) {
Resource resource = resources.getByHref(href);
if (resource == null) {
resource = ResourceUtil.createResource(name, href);
resources.add(resource);
}
result = new TOCReference(name, resource);
}
return result;
}