use of org.codelibs.core.misc.ValueHolder in project fess by codelibs.
the class FessXpathTransformer method getSingleNodeValue.
protected String getSingleNodeValue(final Document document, final String xpath, final boolean pruned) {
StringBuilder buf = null;
NodeList list = null;
try {
list = getXPathAPI().selectNodeList(document, xpath);
for (int i = 0; i < list.getLength(); i++) {
if (buf == null) {
buf = new StringBuilder(1000);
}
Node node = list.item(i).cloneNode(true);
if (useGoogleOffOn) {
node = processGoogleOffOn(node, new ValueHolder<>(true));
}
if (pruned) {
node = pruneNode(node);
}
parseTextContent(node, buf);
}
} catch (final Exception e) {
logger.warn("Could not parse a value of {}", xpath);
}
if (buf == null) {
return null;
}
return buf.toString().trim();
}
Aggregations