Package client.net.sf.saxon.ce.om

Examples of client.net.sf.saxon.ce.om.SequenceIterator


        flushCurrentLiteralList(currentLiteralList, targetList);
    }

    private void flushCurrentLiteralList(List<Item> currentLiteralList, List<Expression> list) throws XPathException {
        if (currentLiteralList != null) {
            SequenceIterator iter = new client.net.sf.saxon.ce.tree.iter.ListIterator(currentLiteralList);
            list.add(Literal.makeLiteral((Value)SequenceExtent.makeSequenceExtent(iter)));
        }
    }
View Full Code Here


    public int position() {
        return position;
    }

    public SequenceIterator getAnother() throws XPathException {
        SequenceIterator newBase = base.getAnother();
        ItemMappingFunction newAction = action instanceof StatefulMappingFunction ?
                (ItemMappingFunction)((StatefulMappingFunction)action).getAnother() :
                action;
        return new ItemMappingIterator(newBase, newAction, oneToOne);
    }
View Full Code Here

            return StaticProperty.EMPTY;
        } else if (value instanceof AtomicValue) {
            return StaticProperty.EXACTLY_ONE;
        }
        try {
            SequenceIterator iter = value.iterate();
            Item next = iter.next();
            if (next == null) {
                return StaticProperty.EMPTY;
            } else {
                if (iter.next() != null) {
                    return StaticProperty.ALLOWS_ONE_OR_MORE;
                } else {
                    return StaticProperty.EXACTLY_ONE;
                }
            }
View Full Code Here

      * @param context The dynamic context, giving access to the current node,
      * 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, NodeInfo.ALL_NAMESPACES);
        }
    }
View Full Code Here

            return false;
        }
        Value v0 = value;
        Value v1 = ((Literal)obj).value;
        try {
            SequenceIterator i0 = v0.iterate();
            SequenceIterator i1 = v1.iterate();
            while (true) {
                Item m0 = i0.next();
                Item m1 = i1.next();
                if (m0==null && m1==null) {
                    return true;
                }
                if (m0==null || m1==null) {
                    return false;
View Full Code Here

        // This class delivers the result of the path expression in unsorted order,
        // without removal of duplicates. If sorting and deduplication are needed,
        // this is achieved by wrapping the path expression in a DocumentSorter

        SequenceIterator master = start.iterate(context);
        XPathContext context2 = context.newMinorContext();
        context2.setCurrentIterator(master);

        return new ContextMappingIterator(this, context2);
View Full Code Here

            return null;
        }

        Element parent = (Element)((HTMLNodeWrapper)element).getUnderlyingNode();
        final PendingUpdateList pul = context.getController().getPendingUpdateList();
        SequenceIterator iter = content.iterate(context);
        while (true) {
            Item att = iter.next();
            if (att == null) {
                break;
            }
            if (att instanceof NodeInfo && ((NodeInfo)att).getNodeKind() == Type.ATTRIBUTE) {
                pul.add(new SetAttributeAction(parent, ((NodeInfo)att).getURI(), ((NodeInfo)att).getLocalPart(), att.getStringValue()));
View Full Code Here

            return null;
        }

        Element parent = (Element)((HTMLNodeWrapper)element).getUnderlyingNode();
        final PendingUpdateList pul = context.getController().getPendingUpdateList();
        SequenceIterator iter = content.iterate(context);
        while (true) {
            Item att = iter.next();
            if (att == null) {
                break;
            }
            if (att instanceof NodeInfo && ((NodeInfo)att).getNodeKind() == Type.ATTRIBUTE) {
                pul.add(new RemoveAttributeAction(parent, ((NodeInfo)att).getURI(), ((NodeInfo)att).getLocalPart()));
View Full Code Here

    public boolean effectiveBooleanValue(XPathContext context) throws XPathException {

        // If the first operand is a singleton boolean,
        // compare it with the effective boolean value of the other operand

        SequenceIterator iter0 = null;

        if (maybeBoolean0) {
            iter0 = operand0.iterate(context);
            Item i01 = iter0.next();
            Item i02 = (i01 == null ? null : iter0.next());
            if (i01 instanceof BooleanValue && i02 == null) {
                boolean b = operand1.effectiveBooleanValue(context);
                return compare((BooleanValue)i01, singletonOperator, BooleanValue.get(b), comparer, context);
            }
            if (i01 == null && !maybeBoolean1) {
                return false;
            }
        }

        // If the second operand is a singleton boolean,
        // compare it with the effective boolean value of the other operand

        SequenceIterator iter1 = null;

        if (maybeBoolean1) {
            iter1 = operand1.iterate(context);
            Item i11 = iter1.next();
            Item i12 = (i11 == null ? null : iter1.next());
            if (i11 instanceof BooleanValue && i12 == null) {
                boolean b = operand0.effectiveBooleanValue(context);
                return compare(BooleanValue.get(b), singletonOperator, (BooleanValue)i11, comparer, context);
            }
            if (i11 == null && !maybeBoolean0) {
                return false;
            }
        }

        // Atomize both operands where necessary

        if (iter0 == null) {
            iter0 = operand0.iterate(context);
        } else {
            iter0 = iter0.getAnother();
        }

        if (iter1 == null) {
            iter1 = operand1.iterate(context);
        } else {
            iter1 = iter1.getAnother();
        }

        if (atomize0) {
            iter0 = Atomizer.getAtomizingIterator(iter0);
        }

        if (atomize1) {
            iter1 = Atomizer.getAtomizingIterator(iter1);
        }

        // If the operator is one of <, >, <=, >=, then convert both operands to sequences of xs:double
        // using the number() function

        if (operator == Token.LT || operator == Token.LE || operator == Token.GT || operator == Token.GE) {
            ItemMappingFunction map = new ItemMappingFunction() {
                public Item mapItem(Item item) throws XPathException {
                    return NumberFn.convert((AtomicValue)item);
                }
            };
            iter0 = new ItemMappingIterator(iter0, map, true);
            iter1 = new ItemMappingIterator(iter1, map, true);
        }

        // Compare all pairs of atomic values in the two atomized sequences

        List seq1 = null;
        while (true) {
            AtomicValue item0 = (AtomicValue)iter0.next();
            if (item0 == null) {
                return false;
            }
            if (iter1 != null) {
                while (true) {
                    AtomicValue item1 = (AtomicValue)iter1.next();
                    if (item1 == null) {
                        iter1 = null;
                        if (seq1 == null) {
                            // second operand is empty
                            return false;
View Full Code Here

        return BooleanValue.get(effectiveBooleanValue(context));
    }

    public boolean effectiveBooleanValue(XPathContext context) throws XPathException {
        int count = 0;
        SequenceIterator iter = operand.iterate(context);
        while (true) {
            Item item = iter.next();
            if (item == null) {
                break;
            }
            AtomicValue av = item.getTypedValue();
            count++;
View Full Code Here

TOP

Related Classes of client.net.sf.saxon.ce.om.SequenceIterator

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.