Iterator<DefaultElement> children = this.elementIterator();
boolean organizationsAdded = false;
boolean resourcesAdded = false;
while (children.hasNext()) {
DefaultElement child = children.next();
if (child.getName().equals(CPCore.ORGANIZATIONS)) {
if (organizationsAdded) errors.add("Invalid IMS-Manifest ( only one <organizations> element is allowed )");
CPOrganizations org = new CPOrganizations(child);
org.buildChildren();
org.setParentElement(this);
organizations = org;
organizationsAdded = true;
} else if (child.getName().equals(CPCore.RESOURCES)) {
if (resourcesAdded) errors.add("Invalid IMS-Manifest ( only one <resources> element is allowed )");
CPResources res = new CPResources(child);
res.setParentElement(this);
res.buildChildren();
resources = res;
resourcesAdded = true;
} else if (child.getName().equals(CPCore.METADATA)) {
// TODO: implement LOM METADATA
metadata = new CPMetadata(child);
metadata.setParentElement(this);
}
}