1
|
package eu.dnetlib.oai.mongo;
|
2
|
|
3
|
import eu.dnetlib.miscutils.functional.UnaryFunction;
|
4
|
import org.dom4j.Document;
|
5
|
import org.dom4j.Node;
|
6
|
|
7
|
/**
|
8
|
* Function to deliver only the about/provenance content of a record as XML String.
|
9
|
*/
|
10
|
public class ProvenanceExtractor implements UnaryFunction<String, Document> {
|
11
|
|
12
|
@Override
|
13
|
public String evaluate(final Document xmlDoc) {
|
14
|
// Node provenanceNode = xmlDoc.selectSingleNode("//*[local-name() = 'about']/*[local-name() = 'provenance']");
|
15
|
Node provenanceNode = xmlDoc.selectSingleNode("/*[local-name()='record']/*[local-name() = 'about']/*[local-name() = 'provenance']");
|
16
|
if (provenanceNode != null) return provenanceNode.asXML();
|
17
|
else return null;
|
18
|
}
|
19
|
}
|