Package client.net.sf.saxon.ce.event

Examples of client.net.sf.saxon.ce.event.SequenceReceiver


    public final void processValue(CharSequence value, XPathContext context) throws XPathException {
        int nameCode = evaluateNameCode(context);
//        if (nameCode == -1) {
//            return null;
//        }
        SequenceReceiver out = context.getReceiver();
        int opt = getOptions();
        int ann = getAnnotation();
       
      // we may need to change the namespace prefix if the one we chose is
      // already in use with a different namespace URI: this is done behind the scenes
      // by the ComplexContentOutputter

        if ((nameCode & NamePool.FP_MASK) == StandardNames.XML_ID) {
            value = Whitespace.collapseWhitespace(value);
        }
        try {
            out.attribute(nameCode, value);
        } catch (XPathException err) {
            throw dynamicError(getSourceLocator(), err, context);
        }

        //return null;
View Full Code Here


     */

    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, 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

    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();
        if (out instanceof ComplexContentOutputter) {
            // Optimization is only safe if evaluated as part of a complex content constructor
            // Start and end with an empty string to force space separation from any previous or following outputs
            out.append(StringValue.EMPTY_STRING, 0);

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

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

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

            // Type checking ensures that the separator is not an empty sequence
            if (argument.length == 1) {
                out.characters(it.getStringValueCS());

                while (true) {
                    it = iter.next();
                    if (it == null) {
                        break;
                    }
                    out.characters(it.getStringValueCS());
                }
            } else {
                CharSequence sep = argument[1].evaluateItem(context).getStringValueCS();
                out.characters(sep);
                out.characters(it.getStringValueCS());

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

            }


            out.append(StringValue.EMPTY_STRING, 0);
        } else {
            out.append(evaluateItem(context), 0);
        }
    }
View Full Code Here

    public void processValue(CharSequence value, XPathContext context) throws XPathException {
        String expandedName = evaluateName(context);
        if (expandedName != null) {
            String data = checkContent(value.toString(), context);
            SequenceReceiver out = context.getReceiver();
            out.processingInstruction(expandedName, data);
        }
    }
View Full Code Here

    public ItemType getItemType(TypeHierarchy th) {
        return NodeKindTest.DOCUMENT;
    }

    public TailCall processLeavingTail(XPathContext context) throws XPathException {
        SequenceReceiver out = context.getReceiver();
        out.startDocument();
        content.process(context);
        out.endDocument();
        return null;
    }
View Full Code Here

        Controller controller = context.getController();
        String prefix = evaluatePrefix(context);
        String uri = value.toString();
        checkPrefixAndUri(prefix, uri, context);

        SequenceReceiver out = context.getReceiver();
        out.namespace(new NamespaceBinding(prefix, uri), ReceiverOptions.REJECT_DUPLICATES);
    }
View Full Code Here

     * @throws client.net.sf.saxon.ce.trans.XPathException
     *
     */

    public void processValue(CharSequence value, XPathContext context) throws XPathException {
        SequenceReceiver out = context.getReceiver();
        out.characters(value);
    }
View Full Code Here

TOP

Related Classes of client.net.sf.saxon.ce.event.SequenceReceiver

Copyright © 2018 www.massapicom. 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.