Search in sources :

Example 1 with FastStringBuffer

use of net.sf.saxon.tree.util.FastStringBuffer in project sirix by sirixdb.

the class NodeWrapper method expandString.

/**
 * Filter text nodes.
 *
 * @return concatenated String of text node values
 */
private String expandString() {
    final FastStringBuffer fsb = new FastStringBuffer(FastStringBuffer.SMALL);
    try {
        final NodeReadTrx rtx = createRtxAndMove();
        final FilterAxis axis = new FilterAxis(new DescendantAxis(rtx), new TextFilter(rtx));
        while (axis.hasNext()) {
            axis.next();
            fsb.append(rtx.getValue());
        }
        rtx.close();
    } catch (final SirixException exc) {
        LOGGER.error(exc.toString());
    }
    return fsb.condense().toString();
}
Also used : TextFilter(org.sirix.axis.filter.TextFilter) FastStringBuffer(net.sf.saxon.tree.util.FastStringBuffer) NodeReadTrx(org.sirix.api.NodeReadTrx) SirixException(org.sirix.exception.SirixException) DescendantAxis(org.sirix.axis.DescendantAxis) FilterAxis(org.sirix.axis.filter.FilterAxis)

Aggregations

FastStringBuffer (net.sf.saxon.tree.util.FastStringBuffer)1 NodeReadTrx (org.sirix.api.NodeReadTrx)1 DescendantAxis (org.sirix.axis.DescendantAxis)1 FilterAxis (org.sirix.axis.filter.FilterAxis)1 TextFilter (org.sirix.axis.filter.TextFilter)1 SirixException (org.sirix.exception.SirixException)1