Project

General

Profile

1
package eu.dnetlib.data.oai.store.mongo;
2

    
3
import eu.dnetlib.miscutils.functional.UnaryFunction;
4
import org.dom4j.Document;
5
import org.dom4j.Node;
6

    
7
/**
8
 * Function to skip the header of the record and deliver only its metadata content as XML String.
9
 */
10
public class MetadataExtractor implements UnaryFunction<String, Document> {
11

    
12
	@Override
13
	public String evaluate(final Document xmlDoc) {
14
		Node metadataNode = xmlDoc.selectSingleNode("//*[local-name() = 'metadata']/*");
15
		//Node metadataNode = xmlDoc.selectSingleNode("/*[local-name()='record']/*[local-name() = 'metadata']/*");
16
		return metadataNode.asXML();
17
	}
18
}
(2-2/6)