* @param metadataPrefix the OAI metadataPrefix of the desired metadata
* @return list of JDOM elements corresponding to the metadata entries in the located record.
*/
private List<Element> getMDrecord(String oaiSource, String itemOaiId, String metadataPrefix) throws IOException, ParserConfigurationException, SAXException, TransformerException, HarvestingException
{
GetRecord getRecord = new GetRecord(oaiSource,itemOaiId,metadataPrefix);
Set<String> errorSet = new HashSet<String>();
// If the metadata is not available for this item, can the whole thing
if (getRecord != null && getRecord.getErrors() != null && getRecord.getErrors().getLength() > 0) {
for (int i=0; i<getRecord.getErrors().getLength(); i++) {
String errorCode = getRecord.getErrors().item(i).getAttributes().getNamedItem("code").getTextContent();
errorSet.add(errorCode);
}
throw new HarvestingException("OAI server returned the following errors during getDescMD execution: " + errorSet.toString());
}
Document record = db.build(getRecord.getDocument());
Element root = record.getRootElement();
return root.getChild("GetRecord",OAI_NS).getChild("record", OAI_NS).getChild("metadata",OAI_NS).getChildren();
}