Examples of SequenceReceiver


Examples of net.sf.saxon.event.SequenceReceiver

        ValueRepresentation[] actualArgs = evaluateArguments(context);
        if (tailCall) {
            ((XPathContextMajor)context).requestTailCall(function, actualArgs);
            return EmptyEventIterator.getInstance();
        } else {
            SequenceReceiver out = context.getReceiver();
            XPathContextMajor c2 = context.newCleanContext();
            c2.setReceiver(out);
            c2.setOrigin(this);
            return function.iterateEvents(actualArgs, c2);
        }
View Full Code Here

Examples of net.sf.saxon.event.SequenceReceiver

     * @param state   a stack on which the instruction can save state information during the call on processLeft()
     */

    public void processLeft(Stack<XPathContext> contextStack, Stack state) throws XPathException {
        XPathContext context = contextStack.peek();
        SequenceReceiver out = context.getReceiver();
        state.push(out);
        SequenceOutputter out2 = new SequenceOutputter();
        out2.setPipelineConfiguration(out.getPipelineConfiguration());
        context.setReceiver(out2);
        int annotation = ((NodeInfo)context.getContextItem()).getTypeAnnotation();
        state.push(annotation);
    }
View Full Code Here

Examples of net.sf.saxon.event.SequenceReceiver

        XPathContext context = contextStack.peek();
        int annotation = (Integer)state.pop();
        CharSequence value = ((SequenceOutputter)context.getReceiver()).getFirstItem().getStringValueCS();
        SchemaType type = context.getConfiguration().getSchemaType(annotation);

        SequenceReceiver out = (SequenceReceiver)state.pop();
        context.setReceiver(out);
       
        if (type.isComplexType()) {
            if (((ComplexType)type).isMixedContent()) {
                SequenceIterator iter = SingletonIterator.makeIterator(new UntypedAtomicValue(value));
View Full Code Here

Examples of net.sf.saxon.event.SequenceReceiver

      * the current variables, etc.
      */

    public void process(XPathContext context) throws XPathException {
        SequenceIterator iter = iterate();
        SequenceReceiver out = context.getReceiver();
        while (true) {
            Item it = iter.next();
            if (it==null) break;
            out.append(it, 0, NodeInfo.ALL_NAMESPACES);
        }
    }
View Full Code Here

Examples of net.sf.saxon.event.SequenceReceiver

        XPathContext context = contextStack.peek();
        if (evalBeforeChildren) {
            ValueRepresentation val = eval(context);
            context.setLocalVariable(getLocalSlotNumber(), val);
        } else {
            SequenceReceiver out = context.getReceiver();
            state.push(out);
            SequenceOutputter out2 = new SequenceOutputter();
            out2.setPipelineConfiguration(out.getPipelineConfiguration());
            context.setReceiver(out2);
        }
    }
View Full Code Here

Examples of net.sf.saxon.event.SequenceReceiver

    public void processRight(Stack<XPathContext> contextStack, Stack state) throws XPathException {
        XPathContext context = contextStack.peek();
        if (!evalBeforeChildren) {
            SequenceOutputter out2 = (SequenceOutputter)context.getReceiver();
            SequenceReceiver out = (SequenceReceiver)state.pop();
            context.setReceiver(out);
            ValueRepresentation val = out2.getSequence();
            context.setLocalVariable(getLocalSlotNumber(), val);
            action.process(context);
        }
View Full Code Here

Examples of net.sf.saxon.event.SequenceReceiver

     */

    public void process(XPathContext context) throws XPathException {
        if (expression == null) {
            // This is a Closure that simply wraps a SequenceIterator supplied from the Java level
            SequenceReceiver out = context.getReceiver();
            while (true) {
                Item item = inputIterator.next();
                if (item == null) {
                    break;
                }
                out.append(item, 0, NodeInfo.ALL_NAMESPACES);
            }
            inputIterator = inputIterator.getAnother();
        } else {
            // To evaluate the closure in push mode, we need to use the original context of the
            // expression for everything except the current output destination, which is newly created
            XPathContext c2 = savedXPathContext.newContext();
            SequenceReceiver out = context.getReceiver();
            c2.setTemporaryReceiver(out);
            expression.process(c2);
        }
    }
View Full Code Here

Examples of net.sf.saxon.event.SequenceReceiver

      * the current variables, etc.
      */

    public void process(XPathContext context) throws XPathException {
        SequenceIterator iter = value.iterate();
        SequenceReceiver out = context.getReceiver();
        while (true) {
            Item it = iter.next();
            if (it==null) break;
            out.append(it, 0, NodeInfo.ALL_NAMESPACES);
        }
    }
View Full Code Here

Examples of net.sf.saxon.event.SequenceReceiver

     * @param context The dynamic context, giving access to the current node,
     *                the current variables, etc.
     */

    public void process(XPathContext context) throws XPathException {
        SequenceReceiver out = context.getReceiver();
        int numArgs = argument.length;
        // Start and end with an empty string to force space separation from any previous or following outputs
        out.append(StringValue.EMPTY_STRING, 0, 0);
        boolean empty = true;
        for (int i=0; i<numArgs; i++) {
            AtomicValue val = (AtomicValue)argument[i].evaluateItem(context);
            if (val!=null) {
                out.characters(val.getStringValueCS(), 0, 0);
                empty = false;
            }
        }
        if (!empty) {
            out.append(StringValue.EMPTY_STRING, 0, 0);
        }
    }
View Full Code Here

Examples of net.sf.saxon.event.SequenceReceiver

    public void process(XPathContext context) throws XPathException {
        // This rather tortuous code is designed to ensure that we don't evaluate the
        // separator argument unless there are at least two items in the sequence.

        SequenceReceiver out = context.getReceiver();
        // Start and end with an empty string to force space separation from any previous or following outputs
        out.append(StringValue.EMPTY_STRING, 0, 0);

        SequenceIterator iter = argument[0].iterate(context);
        Item it = iter.next();
        if (it==null) {
            return;
        }

        CharSequence first = it.getStringValueCS();
        out.characters(first, 0, 0);

        it = iter.next();
        if (it==null) {
            out.append(StringValue.EMPTY_STRING, 0, 0);
            return;
        }

        // Type checking ensures that the separator is not an empty sequence
        CharSequence sep = argument[1].evaluateItem(context).getStringValueCS();
        out.characters(sep, 0, 0);
        out.characters(it.getStringValueCS(), 0, 0);

        while (true) {
            it = iter.next();
            if (it == null) {
                break;
            }
            out.characters(sep, 0, 0);
            out.characters(it.getStringValueCS(), 0, 0);
        }

        out.append(StringValue.EMPTY_STRING, 0, 0);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.