Search in sources :

Example 1 with SequenceIterator

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;
}
Also used : Item(net.sf.saxon.om.Item) StringWriter(java.io.StringWriter) SequenceIterator(net.sf.saxon.om.SequenceIterator)

Example 2 with SequenceIterator

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);
}
Also used : Item(net.sf.saxon.om.Item) SequenceIterator(net.sf.saxon.om.SequenceIterator) ItemType(net.sf.saxon.type.ItemType) AnyItemType(net.sf.saxon.type.AnyItemType) TypeHierarchy(net.sf.saxon.type.TypeHierarchy)

Aggregations

Item (net.sf.saxon.om.Item)2 SequenceIterator (net.sf.saxon.om.SequenceIterator)2 StringWriter (java.io.StringWriter)1 AnyItemType (net.sf.saxon.type.AnyItemType)1 ItemType (net.sf.saxon.type.ItemType)1 TypeHierarchy (net.sf.saxon.type.TypeHierarchy)1