Package net.sf.saxon.om

Examples of net.sf.saxon.om.SequenceIterator


            return null;
        }

        // Now return an iterator over the documents that it refers to

        SequenceIterator iter =
                catalog.iterateAxis(Axis.CHILD, NodeKindTest.ELEMENT);
        NodeInfo top = null;
        while (true) {
            top = (NodeInfo)iter.next();
            if (top == null) break;
            if (!("collection".equals(top.getLocalPart()) &&
                    top.getURI().equals("") )) {
                dynamicError("collection catalogue must contain top-level element <collection>", context);
            }
            break;
        }

        SequenceIterator documents =
                top.iterateAxis(Axis.CHILD, NodeKindTest.ELEMENT);

        return new MappingIterator(documents, this, context, null);

    }
View Full Code Here


    * Evaluate the function to return an iteration of selected nodes.
    */

    public SequenceIterator iterate(XPathContext context) throws XPathException {
        AtomicComparer comparer = getAtomicComparer(2, context);
        SequenceIterator seq = argument[0].iterate(context);
        AtomicValue val = (AtomicValue)argument[1].evaluateItem(context);
        return new IndexIterator(seq, val, comparer);
    }
View Full Code Here

        } else if (value instanceof AtomicValue) {
            return (AtomicValue)value;
        } else if (value instanceof Closure) {
            return value.evaluateItem(context);
        } else {
            SequenceIterator iter = value.iterate(context);
            //if (iter.hasNext()) {
            Item item = iter.next();
            if (item == null) {
                return null;
            } else if (iter.next() != null) {
                throw new AssertionError("Attempting to access a sequence as an item");
            } else {
                return item;
            }
        }
View Full Code Here

        props.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
        emitter.setOutputProperties(props);
        c2.changeOutputDestination(props, rec, false, Validation.PRESERVE, null);

        if (select != null) {
            SequenceIterator iter = select.iterate(c2);
            while (true) {
                Item item = iter.next();
                if (item == null) {
                    break;
                }
                rec.append(item, locationId);
            }
View Full Code Here

        return null;
    }

    private GroupIterator getGroupIterator(XPathContext context) throws XPathException {
        SequenceIterator population = select.iterate(context);

        // get an iterator over the groups in "order of first appearance"

        GroupIterator groupIterator;
        switch (algorithm) {
View Full Code Here

      *     of the expression
      */

     public SequenceIterator iterate(XPathContext context) throws XPathException {
        // TODO: BUG: this doesn't handle the current-group() context correctly
         SequenceIterator master = getGroupIterator(context);
         XPathContext c2 = context.newMinorContext();
         c2.setOrigin(this);
         c2.setCurrentIterator(master);
         master = new MappingIterator(master, this, c2, null);
         return master;
View Full Code Here

    /**
    * Evaluate the function to return an iteration of selected nodes.
    */

    public SequenceIterator iterate(XPathContext context) throws XPathException {
        SequenceIterator seq = argument[0].iterate(context);
        AtomicValue n0 = (AtomicValue)argument[1].evaluateItem(context);
        NumericValue n = (NumericValue)n0.getPrimitiveValue();
        int pos = (int)n.longValue();
        SequenceIterator ins = argument[2].iterate(context);
        return new InsertIterator(seq, ins, pos);
    }
View Full Code Here

        DocumentInfo doc = e.getDocumentRoot();
        if (doc==null) {
            return false;
        }
        KeyManager km = context.getController().getKeyManager();
        SequenceIterator iter = keyexp.iterate(context);
        while (true) {
            Item it = iter.next();
            if (it == null) {
                return false;
            }
            SequenceIterator nodes = km.selectByKey(keyfingerprint, doc, (AtomicValue)it, context);
            while (true) {
                NodeInfo n = (NodeInfo)nodes.next();
                if (n == null) {
                    break;
                }
                if (n.isSameNodeInfo(e)) {
                    return true;
View Full Code Here

    public AtomicValue getCurrentGroupingKey() {
        return (AtomicValue)nodeKeys[(index-1)*recordSize+sortkeys.length+2];
    }

    public SequenceIterator iterateCurrentGroup() throws XPathException {
        SequenceIterator iter =
                (SequenceIterator)nodeKeys[(index-1)*recordSize+sortkeys.length+3];
        return iter.getAnother();
    }
View Full Code Here

    * @return true if p1 and p2 contain at least one node in common (i.e. if the intersection
    * is not empty)
    */

    public static boolean hasSameNode(SequenceIterator p1, SequenceIterator p2) throws XPathException {
        SequenceIterator intersection =
            new IntersectionEnumeration(p1, p2, GlobalOrderComparer.getInstance());
        return intersection.next() != null;
    }
View Full Code Here

TOP

Related Classes of net.sf.saxon.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.