ref = file.getChild("FLocat", metsNS);
if (ref == null)
{
// check for forbidden FContent child first:
if (file.getChild("FContent", metsNS) == null)
throw new MetadataValidationException("Invalid METS Manifest: Every file element must have FLocat child.");
else
throw new MetadataValidationException("Invalid METS Manifest: file element has forbidden FContent child, only FLocat is allowed.");
}
}
else if (file.getName().equals("mdRef"))
ref = file;
else
throw new MetadataValidationException("getFileName() called with recognized element type: "+file.toString());
String loctype = ref.getAttributeValue("LOCTYPE");
if (loctype != null && loctype.equals("URL"))
{
String result = ref.getAttributeValue("href", xlinkNS);
if (result == null)
throw new MetadataValidationException("Invalid METS Manifest: FLocat/mdRef is missing the required xlink:href attribute.");
return result;
}
throw new MetadataValidationException("Invalid METS Manifest: FLocat/mdRef does not have LOCTYPE=\"URL\" attribute.");
}