Package xbird.xquery.dm.value.literal

Examples of xbird.xquery.dm.value.literal.XString


        super(arg0);
    }

    public void testEval() throws XQueryException {
        SequenceExpression seq = new SequenceExpression();
        AtomicValue it1 = new XString("1");
        AtomicValue it2 = new XString("2");
        seq.addExpression(new LiteralExpr(it1));
        seq.addExpression(new LiteralExpr(it2));
        Sequence<Item> res = (Sequence<Item>) seq.eval(null, new DynamicContext(new StaticContext()));
        Iterator<Item> resItor = res.iterator();
        assertTrue(resItor.hasNext());
View Full Code Here


    }

    @SuppressWarnings("unchecked")
    public Sequence eval(Sequence<? extends Item> contextSeq, ValueSequence argv, DynamicContext dynEnv)
            throws XQueryException {
        return new XString(expected);
    }
View Full Code Here

        // If $qname is the empty sequence, returns the empty sequence.
        Item firstItem = argv.getItem(0);
        if(firstItem.isEmpty()) {
            return ValueSequence.EMPTY_SEQUENCE;
        }
        XString qname = (XString) firstItem;
        String qnameStr = qname.getValue();
        final int pos = qnameStr.indexOf(':');
        final String nsuri;
        if(pos == -1) {
            // If the $qname has no prefix, and there is no namespace binding for $element
            // corresponding to the default (unnamed) namespace, then the resulting expanded-QName
View Full Code Here

                final String sv = ((XQNode) firstItem).stringValue();
                ret = XString.valueOf(sv);
            } else if(firstItem instanceof AtomicValue) {
                // If $arg is an atomic value, then the function returns the same string as
                // is returned by the expression "$arg cast as xs:string".
                final XString sv = ((AtomicValue) firstItem).<XString> castAs(StringType.STRING, dynEnv);
                ret = sv;
            } else {
                argItor.closeQuietly();
                throw new IllegalStateException("Illegal argument type: "
                        + arg.getClass().getName());
View Full Code Here

        for(XQNode curNode = element; curNode != null; curNode = curNode.parent()) {
            String prefixStr = curNode.nodeName().getPrefix();
            if(prefixStr == null) {
                prefixStr = "";
            }
            XString prefix = XString.valueOf(prefixStr);
            if(!prefixes.contains(prefix)) {
                prefixes.add(prefix);
            }
        }
        if(prefixes.isEmpty()) {
View Full Code Here

                currentToken = jj_consume_token(StringLiteral);
                String s = unescape(unquote(currentToken.image));
                if(s.indexOf('&') != -1) {
                    s = replaceReference(s);
                }
                value = new XString(s);
                break;
            default:
                jj_la1[138] = jj_gen;
                jj_consume_token(-1);
                throw new ParseException();
View Full Code Here

    public Sequence eval(Sequence<? extends Item> contextSeq, ValueSequence argv, DynamicContext dynEnv)
            throws XQueryException {
        assert (argv != null && argv.size() == 2);
        Item value = argv.getItem(0);
        Item secondItem = argv.getItem(1);
        XString label = (XString) secondItem;
        assert (label != null);
        final String message = label.getValue() + ": { " + traceItem(value, ", ") + " }.";
        LOGGER.trace(message); // TODO create trace listener?
        return value;
    }
View Full Code Here

        if(firstItem.isEmpty()) {
            return XString.valueOf("");
        }
        QNameValue arg = (QNameValue) firstItem;
        String lpart = arg.getValue().getLocalPart();
        return new XString(lpart, NCNameType.NCNAME);
    }
View Full Code Here

        return String.class;
    }

    public AtomicValue createInstance(String literal, AtomicType srcType, DynamicContext dynEnv)
            throws XQueryException {
        return new XString(literal, this);
    }
View Full Code Here

        QualifiedName qname = arg.getValue();
        String prefix = qname.getPrefix();
        if(prefix.length() == 0) {
            return ValueSequence.EMPTY_SEQUENCE;
        }
        return new XString(prefix, NCNameType.NCNAME);
    }
View Full Code Here

TOP

Related Classes of xbird.xquery.dm.value.literal.XString

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.