use of net.sf.saxon.om.SequenceIterator in project camel by apache.
the class XQueryBuilder method evaluateAsString.
public String evaluateAsString(Exchange exchange) throws Exception {
LOG.debug("evaluateAsString: {} for exchange: {}", expression, exchange);
initialize(exchange);
StringWriter buffer = new StringWriter();
SequenceIterator iter = getExpression().iterator(createDynamicContext(exchange));
for (Item item = iter.next(); item != null; item = iter.next()) {
buffer.append(item.getStringValueCS());
}
String answer = buffer.toString();
buffer.close();
return answer;
}
use of net.sf.saxon.om.SequenceIterator in project intellij-community by JetBrains.
the class Saxon9StyleFrame method createValue.
private Value createValue(ValueFacade expression) throws XPathException {
final TypeHierarchy typeHierarchy = myXPathContext.getConfiguration().getTypeHierarchy();
final ItemType itemType = expression.getItemType(typeHierarchy);
final SequenceIterator it = expression.iterate(myXPathContext);
Item value = null;
if (it.next() != null) {
value = it.current();
}
if (it.next() == null) {
return new SingleValue(value, itemType);
}
return new SequenceValue(value, it, itemType);
}
Aggregations