Package org.exist.xquery.value

Examples of org.exist.xquery.value.SequenceIterator.nextItem()


                 
                    //It is possible for a text node constructor to construct a text node containing a zero-length string.
                    //However, if used in the content of a constructed element or document node,
                    //such a text node will be deleted or merged with another text node.
                  if (next instanceof TextImpl && ((TextImpl)next).getStringValue().isEmpty()) {
                        next = i.nextItem();
            continue;
          }
                    if (buf != null && buf.length() > 0) {
                        receiver.characters(buf);
                        buf.setLength(0);
View Full Code Here


                    if (next.getType() == Type.ATTRIBUTE && !allowAttribs)
                        {throw new XPathException(this, ErrorCodes.XQTY0024,
                            "An attribute may not appear after another child node.");}
                    next.copyTo(context.getBroker(), receiver);
                    allowAttribs = next.getType() == Type.ATTRIBUTE || next.getType() == Type.NAMESPACE;
                    next = i.nextItem();
                }
            }
            // flush remaining character data
            if (buf != null && buf.length() > 0)
                {receiver.characters(buf);}
View Full Code Here

        final Sequence inner = getArgument(0).eval(contextSequence, contextItem);
        if (inner.isEmpty()) {
            result = Sequence.EMPTY_SEQUENCE;
        } else {
            final SequenceIterator iter = inner.iterate();
            Item item = iter.nextItem();
            AtomicValue value = item.atomize();
            //Any values of type xdt:untypedAtomic are cast to xs:double
            if (value.getType() == Type.UNTYPED_ATOMIC)
                {value = value.convertTo(Type.DOUBLE);}
            if (!(value instanceof ComputableValue)) {
View Full Code Here

                    "can not be an operand in a sum", value);
            }
            //Set the first value
            ComputableValue sum = (ComputableValue) value;
            while (iter.hasNext()) {
                item = iter.nextItem();
                value = item.atomize();
                //Any value of type xdt:untypedAtomic are cast to xs:double
                if (value.getType() == Type.UNTYPED_ATOMIC)
                    {value = value.convertTo(Type.DOUBLE);}
                if (!(value instanceof ComputableValue)) {
View Full Code Here

          //TODO : test if a range index is defined *iff* it is compatible with the collator
        final Collator collator = getCollator(contextSequence, contextItem, 2);
        final SequenceIterator iter = arg.unorderedIterator();
        AtomicValue min = null;
        while (iter.hasNext()) {
                final Item item = iter.nextItem();
                if (item instanceof QNameValue)
                {throw new XPathException(this, ErrorCodes.FORG0006, "Cannot compare " + Type.getTypeName(item.getType()), arg);}
                AtomicValue value = item.atomize();

                //Duration values must either all be xs:yearMonthDuration values or must all be xs:dayTimeDuration values.
View Full Code Here

          //TODO : test if a range index is defined *iff* it is compatible with the collator
        final Collator collator = getCollator(contextSequence, contextItem, 2);
        final SequenceIterator iter = arg.unorderedIterator();
        AtomicValue max = null;
        while (iter.hasNext()) {
                final Item item = iter.nextItem();

                if (item instanceof QNameValue)
                {throw new XPathException(this, ErrorCodes.FORG0006, "Cannot compare " + Type.getTypeName(item.getType()), arg);}
               
                AtomicValue value = item.atomize();                
View Full Code Here

            ref.analyze(cachedContextInfo);
          Sequence zero = args[1];
          Sequence input = args[0];
          while (!input.isEmpty()) {
            final SequenceIterator i = input.iterate();
            zero = ref.evalFunction(contextSequence, null, new Sequence[] { zero, i.nextItem().toSequence() });
            ValueSequence tail = new ValueSequence();
            while (i.hasNext()) {
              tail.add(i.nextItem());
            }
            input = tail;
View Full Code Here

          while (!input.isEmpty()) {
            final SequenceIterator i = input.iterate();
            zero = ref.evalFunction(contextSequence, null, new Sequence[] { zero, i.nextItem().toSequence() });
            ValueSequence tail = new ValueSequence();
            while (i.hasNext()) {
              tail.add(i.nextItem());
            }
            input = tail;
          }
          result = zero;
        } else if (isCalledAs("fold-right")) {
View Full Code Here

            ref.analyze(cachedContextInfo);
          final SequenceIterator i1 = args[1].iterate();
          final SequenceIterator i2 = args[2].iterate();
          while (i1.hasNext() && i2.hasNext()) {
            final Sequence r = ref.evalFunction(contextSequence, null,
                new Sequence[] { i1.nextItem().toSequence(), i2.nextItem().toSequence() });
            result.addAll(r);
          }
        } else if (isCalledAs("for-each-pair")) {
            final FunctionReference ref = (FunctionReference) args[2].itemAt(0);
            ref.analyze(cachedContextInfo);
View Full Code Here

            ref.analyze(cachedContextInfo);
            final SequenceIterator i1 = args[0].iterate();
            final SequenceIterator i2 = args[1].iterate();
            while (i1.hasNext() && i2.hasNext()) {
                final Sequence r = ref.evalFunction(contextSequence, null,
                        new Sequence[] { i1.nextItem().toSequence(), i2.nextItem().toSequence() });
                result.addAll(r);
            }
        }
    return result;
  }
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.