1
|
package eu.dnetlib.oai.mongo;
|
2
|
|
3
|
import java.util.function.Function;
|
4
|
|
5
|
import org.dom4j.Document;
|
6
|
import org.dom4j.Node;
|
7
|
|
8
|
/**
|
9
|
* Function to skip the header of the record and deliver only its metadata content as XML String.
|
10
|
*/
|
11
|
public class MetadataExtractor implements Function<Document, String> {
|
12
|
|
13
|
@Override
|
14
|
public String apply(final Document xmlDoc) {
|
15
|
final Node metadataNode = xmlDoc.selectSingleNode("//*[local-name() = 'metadata']/*");
|
16
|
// Node metadataNode = xmlDoc.selectSingleNode("/*[local-name()='record']/*[local-name() = 'metadata']/*");
|
17
|
return metadataNode.asXML();
|
18
|
}
|
19
|
}
|