Search in sources :

Example 21 with NodeImpl

use of org.exist.dom.memtree.NodeImpl in project exist by eXist-db.

the class ArrayListValueSequence method getFollowing.

@Override
public Sequence getFollowing(final NodeTest test, final int position) throws XPathException {
    final ArrayListValueSequence nodes = new ArrayListValueSequence();
    for (final Item value : values) {
        final NodeImpl node = (NodeImpl) value;
        node.selectFollowing(test, nodes, position);
    }
    return nodes;
}
Also used : NodeImpl(org.exist.dom.memtree.NodeImpl)

Example 22 with NodeImpl

use of org.exist.dom.memtree.NodeImpl in project exist by eXist-db.

the class ArrayListValueSequence method getDescendants.

@Override
public Sequence getDescendants(final boolean includeSelf, final NodeTest test) throws XPathException {
    final ArrayListValueSequence nodes = new ArrayListValueSequence();
    for (final Item value : values) {
        final NodeImpl node = (NodeImpl) value;
        node.selectDescendants(includeSelf, test, nodes);
    }
    return nodes;
}
Also used : NodeImpl(org.exist.dom.memtree.NodeImpl)

Example 23 with NodeImpl

use of org.exist.dom.memtree.NodeImpl in project exist by eXist-db.

the class ArrayListValueSequence method getAttributes.

// <editor-fold desc="Methods of MemoryNodeSet">
@Override
public Sequence getAttributes(final NodeTest test) throws XPathException {
    final ArrayListValueSequence nodes = new ArrayListValueSequence();
    for (final Item value : values) {
        final NodeImpl node = (NodeImpl) value;
        node.selectAttributes(test, nodes);
    }
    return nodes;
}
Also used : NodeImpl(org.exist.dom.memtree.NodeImpl)

Example 24 with NodeImpl

use of org.exist.dom.memtree.NodeImpl in project exist by eXist-db.

the class ContentReceiver method sendDataToCallback.

/**
 * Send data to callback handler
 */
private void sendDataToCallback() {
    // Retrieve result as document
    Document doc = docBuilderReceiver.getDocument();
    // Get the root
    NodeImpl root = (NodeImpl) doc.getDocumentElement();
    // Construct parameters
    Sequence[] params = new Sequence[3];
    params[0] = root;
    params[1] = userData;
    params[2] = prevReturnData;
    try {
        // Send data to callback function
        Sequence ret = ref.evalFunction(null, null, params);
        prevReturnData = ret;
        result.addAll(ret);
    } catch (XPathException e) {
        LOG.warn(e.getMessage(), e);
    }
}
Also used : NodeImpl(org.exist.dom.memtree.NodeImpl) XPathException(org.exist.xquery.XPathException) ValueSequence(org.exist.xquery.value.ValueSequence) Sequence(org.exist.xquery.value.Sequence) Document(org.w3c.dom.Document)

Example 25 with NodeImpl

use of org.exist.dom.memtree.NodeImpl in project exist by eXist-db.

the class CommentConstructor method eval.

/* (non-Javadoc)
	 * @see org.exist.xquery.Expression#eval(org.exist.xquery.StaticContext, org.exist.dom.persistent.DocumentSet, org.exist.xquery.value.Sequence, org.exist.xquery.value.Item)
	 */
public Sequence eval(Sequence contextSequence, Item contextItem) throws XPathException {
    if (newDocumentContext) {
        context.pushDocumentContext();
    }
    try {
        final MemTreeBuilder builder = context.getDocumentBuilder();
        final int nodeNr = builder.comment(data);
        final NodeImpl node = builder.getDocument().getNode(nodeNr);
        return node;
    } finally {
        if (newDocumentContext) {
            context.popDocumentContext();
        }
    }
}
Also used : MemTreeBuilder(org.exist.dom.memtree.MemTreeBuilder) NodeImpl(org.exist.dom.memtree.NodeImpl)

Aggregations

NodeImpl (org.exist.dom.memtree.NodeImpl)53 MemTreeBuilder (org.exist.dom.memtree.MemTreeBuilder)14 XPathException (org.exist.xquery.XPathException)9 DocumentImpl (org.exist.dom.memtree.DocumentImpl)8 Sequence (org.exist.xquery.value.Sequence)8 SAXException (org.xml.sax.SAXException)8 SAXAdapter (org.exist.dom.memtree.SAXAdapter)6 NodeProxy (org.exist.dom.persistent.NodeProxy)6 ValueSequence (org.exist.xquery.value.ValueSequence)6 IOException (java.io.IOException)5 Document (org.w3c.dom.Document)5 InputSource (org.xml.sax.InputSource)5 StringReader (java.io.StringReader)4 QName (org.exist.dom.QName)4 SequenceIterator (org.exist.xquery.value.SequenceIterator)4 XMLReader (org.xml.sax.XMLReader)4 DocumentBuilderReceiver (org.exist.dom.memtree.DocumentBuilderReceiver)3 NodeSet (org.exist.dom.persistent.NodeSet)3 NodeId (org.exist.numbering.NodeId)3 ValidationReport (org.exist.validation.ValidationReport)3