Examples of itemAt()


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

        return result;
    }

    protected Item getKey(Sequence contextSequence, Item contextItem) throws XPathException {
        Sequence keySeq = getArgument(1).eval(contextSequence, contextItem);
        Item key = keySeq.itemAt(0);
        if (!(Type.subTypeOf(key.getType(), Type.STRING) || Type.subTypeOf(key.getType(), Type.NODE)))
            throw new XPathException(this, "Second argument to ft:query should either be a query string or " +
                    "an XML element describing the query. Found: " + Type.getTypeName(key.getType()));
        return key;
    }
View Full Code Here

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

    protected Properties parseOptions(Sequence contextSequence, Item contextItem) throws XPathException {
        if (getArgumentCount() < 3)
            return null;
        Properties options = new Properties();
        Sequence optSeq = getArgument(2).eval(contextSequence, contextItem);
        NodeValue optRoot = (NodeValue) optSeq.itemAt(0);
        try {
            XMLStreamReader reader = context.getXMLStreamReader(optRoot);
            reader.next();
             reader.next();
            while (reader.hasNext()) {
View Full Code Here

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

//              qnameSeq = super.eval(contextSequence, contextItem);
           
            if (qnameSeq != null) {
              if(!qnameSeq.hasOne())
                throw new XPathException(this, "Type error: the node name should evaluate to a single item");
              Item qnitem = qnameSeq.itemAt(0);
              if (qnitem instanceof QNameValue) {
                qn = ((QNameValue)qnitem).getQName();
              } else {
                tagName = qnitem.getStringValue();
              }
View Full Code Here

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

            }
        }
       
        Sequence result;
        Sequence seq = args[0].convertTo(Type.DOUBLE);
        NumericValue value = (NumericValue)seq.itemAt(0).convertTo(Type.DOUBLE);

        if(seq.isEmpty())
            result = Sequence.EMPTY_SEQUENCE;
        else {         
            double calcValue=0;
View Full Code Here

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

        Sequence result;
        double calcValue=0;
        String functionName = getSignature().getName().getLocalName();
       
        Sequence seqA = args[0].convertTo(Type.DOUBLE);
        NumericValue valueA = (NumericValue)seqA.itemAt(0).convertTo(Type.DOUBLE);
       
        Sequence seqB = args[1].convertTo(Type.DOUBLE);
        NumericValue valueB = (NumericValue)seqB.itemAt(0).convertTo(Type.DOUBLE);
       
        if("atan2".equals(functionName)) {
View Full Code Here

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

       
        Sequence seqA = args[0].convertTo(Type.DOUBLE);
        NumericValue valueA = (NumericValue)seqA.itemAt(0).convertTo(Type.DOUBLE);
       
        Sequence seqB = args[1].convertTo(Type.DOUBLE);
        NumericValue valueB = (NumericValue)seqB.itemAt(0).convertTo(Type.DOUBLE);
       
        if("atan2".equals(functionName)) {
            calcValue = Math.atan2(valueA.getDouble(), valueB.getDouble());
           
        } else if("power".equals(functionName)) {
View Full Code Here

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

            compiled = xquery.compile(context, GET_CURRENT_REV_SOURCE);
        try {
            Sequence s = xquery.execute(compiled, Sequence.EMPTY_SEQUENCE);
            if (s.isEmpty())
                return 0;
            IntegerValue iv = (IntegerValue) s.itemAt(0);
            return iv.getLong();
        } finally {
            pool.returnCompiledXQuery(GET_CURRENT_REV_SOURCE, compiled);
        }
    }
View Full Code Here

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

        try {
            Sequence s = xquery.execute(compiled, Sequence.EMPTY_SEQUENCE);
            if (s.isEmpty())
                return 0;

            IntegerValue iv = (IntegerValue) s.itemAt(0);
            return iv.getLong();
        } finally {
            pool.returnCompiledXQuery(GET_BASE_REV_FOR_KEY_SOURCE, compiled);
        }
    }
View Full Code Here

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

            // test text node
            seq = xquery.execute("doc('/db/test/test_string.xml')/test//b/text()",
                    null, AccessContext.TEST);
            assertEquals(1, seq.getItemCount());
            NodeProxy text = (NodeProxy) seq.itemAt(0);
            assertEquals("1.5.2.1", text.getNodeId().toString());
            // test DOMFile.getNodeValue()
            assertEquals(text.getStringValue(), "paragraph");
            // test Text deserialization
            Text node = (Text) text.getNode();
View Full Code Here

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

            Sequence seq = xquery.execute("/products", null, AccessContext.TEST);
            assertEquals(seq.getItemCount(), 1);

            Serializer serializer = broker.getSerializer();
            System.out.println(serializer.serialize((NodeValue) seq.itemAt(0)));

            seq = xquery.execute("//product", null, AccessContext.TEST);
            assertEquals(ITEMS_TO_APPEND, seq.getItemCount());

            System.out.println("testAppendCDATA: PASS");
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.