Package org.exist.xquery.value

Examples of org.exist.xquery.value.Sequence.itemAt()


        filterParams[0] = new StringValue(name);
        filterParams[1] = new StringValue(dataType);
        filterParams[2] = filterParam;
        Sequence entryFilterFunctionResult = entryFilterFunction.evalFunction(contextSequence, null, filterParams);

        if(BooleanValue.FALSE == entryFilterFunctionResult.itemAt(0))
        {
            return Sequence.EMPTY_SEQUENCE;
        }
        else
        {
View Full Code Here


            final Sequence nameSeq = qnameExpr.eval(contextSequence, contextItem);
            if(!nameSeq.hasOne())
              {throw new XPathException(this, "The name expression should evaluate to a single value");}

            final Item qnItem = nameSeq.itemAt(0);
            QName qn;
            if (qnItem.getType() == Type.QNAME)
                {qn = ((QNameValue) qnItem).getQName();}
            else
              try {
View Full Code Here

    if(ls.isEmpty() || rs.isEmpty())
      {return Sequence.EMPTY_SEQUENCE;}
    if (ls.hasOne() && rs.hasOne()) {
            AtomicValue lv, rv;
      lv = ls.itemAt(0).atomize();
      rv = rs.itemAt(0).atomize();
            final Collator collator = getCollator(contextSequence);
      return BooleanValue.valueOf(compareAtomic(collator, lv, rv, Constants.TRUNC_NONE, relation));
    }
        throw new XPathException(this, "Type error: sequence with more than one item is not allowed here");
  }
View Full Code Here

                    final AtomicValue lv = current.atomize();
                    final Sequence rs = getRight().eval(context.getNode().toSequence());                   
                    if (!rs.hasOne())
                        {throw new XPathException(this,
                                "Type error: sequence with less or more than one item is not allowed here");}                   
                    if (compareAtomic(collator, lv, rs.itemAt(0).atomize(), Constants.TRUNC_NONE, relation))
                        {result.add(current);}
                } while ((context = context.getNextDirect()) != null);
            }
        } else {
            final Sequence rs = getRight().eval(null);
View Full Code Here

        } else {
            final Sequence rs = getRight().eval(null);
            if (!rs.hasOne())
                {throw new XPathException(this,
                        "Type error: sequence with less or more than one item is not allowed here");}
            final AtomicValue rv = rs.itemAt(0).atomize();
            for (final Iterator<NodeProxy> i = nodes.iterator(); i.hasNext();) {
                final NodeProxy current = i.next();
                final AtomicValue lv = current.atomize();
                if (compareAtomic(collator, lv, rv, Constants.TRUNC_NONE, Constants.EQ))
                    {result.add(current);}
View Full Code Here

            // create the element
            final Sequence qnameSeq = qnameExpr.eval(contextSequence, contextItem);
            if(!qnameSeq.hasOne())
              {throw new XPathException(this, ErrorCodes.XPTY0004, "Type error: the node name should evaluate to a single item");}
            final Item qnitem = qnameSeq.itemAt(0);
            QName qn;
            if (qnitem instanceof QNameValue) {
                qn = ((QNameValue)qnitem).getQName();
            } else {
                //Do we have the same result than Atomize there ? -pb
View Full Code Here

        XQuery xqs = broker.getXQueryService();
       
        Sequence results = xqs.execute(query, null, AccessContext.TEST);

        if (! results.isEmpty()) {
            String catalog = (String) results.itemAt(0).getStringValue();
            catalog = "XQTS_"+adoptString(catalog);
            File subfolder = new File(folder.getAbsolutePath()+sep+catalog);
            processGroups(null, subfolder, "."+catalog);
        }
    }
View Full Code Here

                    first = false;
                allTests.write("\t\tC_"+adoptString(parentName)+".class");
            }

            for (int i = 0; i < results.getItemCount(); i++) {
                String groupName = results.itemAt(i).getStringValue();
                subfolder = new File(folder.getAbsolutePath()+sep+groupName);
                subPackage = _package_+"."+adoptString(groupName);

                if (processGroups(groupName, subfolder, subPackage)) {
                    if (!first)
View Full Code Here

                "import org.junit.Test;\n\n" +
                "public class C_"+adoptString(testGroup)+" extends XQTS_case {\n" +
                "\tprivate String testGroup = \""+testGroup+"\";\n\n");

            for (int i = 0; i < results.getItemCount(); i++) {
                String caseName = results.itemAt(i).getStringValue();
                out.write("\t/* "+caseName+" */" +
                    "\t@Test\n" +
                    "\tpublic void test_"+adoptString(caseName)+"() {\n" +
                    "\tgroupCase(testGroup, \""+caseName+"\");"+
                    "\t}\n\n");
View Full Code Here

    Sequence result;
    if (args.length == 0 || args[0].isEmpty()) {
      result = Sequence.EMPTY_SEQUENCE;
    } else {
      final Sequence arg = args[0];
      final DurationValue duration = new DurationValue(((DurationValue) arg.itemAt(0)).getCanonicalDuration());
      if (isCalledAs("days-from-duration")) {
            result = new IntegerValue(duration.getPart(DurationValue.DAY));
      } else if (isCalledAs("hours-from-duration")) {
            result = new IntegerValue(duration.getPart(DurationValue.HOUR));
      } else if (isCalledAs("minutes-from-duration")) {
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.