Package xbird.xquery.dm.value

Examples of xbird.xquery.dm.value.Item


        public boolean next(IFocus focus) throws XQueryException {
            Iterator<? extends Item> delItor = focus.getBaseFocus();
            boolean hasNext = delItor.hasNext();
            if(hasNext) {
                Item delItem = delItor.next();
                focus.setContextItem(delItem);
                _bindingVar.allocateResult(delItem, _dynEnv); // note that binding var is shared.
                return true;
            }
            focus.setReachedEnd(true);
View Full Code Here


            epFocus.closeQuietly();
            throw new DynamicError("Invalid XQueryD expression. Endpoint does not found");
        }
        final List<String> endpoints = new ArrayList<String>(4);
        do {
            Item firstItem = epFocus.next();
            String endpointStr = firstItem.stringValue();
            endpoints.add(endpointStr);
        } while(epFocus.hasNext());
        epFocus.closeQuietly();
        return endpoints;
    }
View Full Code Here

        return s;
    }

    public Sequence eval(Sequence<? extends Item> contextSeq, ValueSequence argv, DynamicContext dynEnv)
            throws XQueryException {
        Item docuri = argv.getItem(0);
        if(docuri.isEmpty()) {
            return XQueryDataModel.createDocument();
        } else {
            final String docName = docuri.stringValue();
            URI baseuri = dynEnv.getStaticContext().getBaseURI();
            if(baseuri == null) { // TODO REVIEWME workaround
                baseuri = dynEnv.getStaticContext().getSystemBaseURI();
            }
            final URI resolvedUri = baseuri.resolve(docName);
View Full Code Here

    }

    public XString eval(Sequence<? extends Item> contextSeq, ValueSequence argv, DynamicContext dynEnv)
            throws XQueryException {
        // If $uri-part is the empty sequence, returns the zero-length string.
        Item firstItem = argv.getItem(0);
        if(firstItem.isEmpty()) {
            return XString.valueOf("");
        }
        String uripart = firstItem.stringValue();
        String escaped = XMLUtils.escapeUri(uripart, false);
        return XString.valueOf(escaped);
    }
View Full Code Here

        if(!firstItor.hasNext() || !secondItor.hasNext()) {
            firstItor.closeQuietly();
            secondItor.closeQuietly();
            return ValueSequence.EMPTY_SEQUENCE;
        }
        final Item firstItem = firstItor.next();
        final Item secondItem = secondItor.next();
        assert (!firstItor.hasNext());
        assert (!secondItor.hasNext());
        firstItor.closeQuietly();
        secondItor.closeQuietly();
        final ValueSequence newSeq = new ValueSequence(dynEnv);
View Full Code Here

        return s;
    }

    public BooleanValue eval(Sequence<? extends Item> contextSeq, ValueSequence argv, DynamicContext dynEnv)
            throws XQueryException {
        Item uriItem = argv.getItem(0);
        if(uriItem.isEmpty()) {
            return BooleanValue.FALSE;
        }
        String uriStr = uriItem.stringValue();
        // If $uri is not a valid xs:anyURI, an error is raised [err:FODC0005].
        final URI docuri;
        try {
            final String unescaped = XMLUtils.unescapeXML(uriStr);
            docuri = new URI(unescaped);
View Full Code Here

            itor.closeQuietly();
            return "";
        }
        final StringBuilder buf = new StringBuilder(255);
        while(true) {
            final Item it = itor.next();
            buf.append(it.stringValue());
            if(itor.hasNext()) {
                buf.append(' ');
            } else {
                break;
            }
View Full Code Here

        return s;
    }

    public XString eval(Sequence<? extends Item> contextSeq, ValueSequence argv, DynamicContext dynEnv)
            throws XQueryException {
        Item firstItem = argv.getItem(0);
        if(firstItem.isEmpty()) {
            return XString.valueOf("");
        }
        String arg = firstItem.stringValue();
        final String converted = arg.toUpperCase();
        return XString.valueOf(converted);
    }
View Full Code Here

        return s;
    }

    public Sequence eval(Sequence<? extends Item> contextSeq, ValueSequence argv, DynamicContext dynEnv) throws XQueryException {
        assert (argv != null && argv.size() == 1);
        Item firstItem = argv.getItem(0);
        if(firstItem.isEmpty()) {
            // Returns the zero-length string if $arg is the empty sequence.
            return ValueSequence.EMPTY_SEQUENCE;
        }
        // If any of the code points in $arg is not a legal XML character,
        // an error is raised [err:FOCH0001].
        Iterator<? extends Item> argItor = firstItem.iterator();
        assert (argItor.hasNext());
        final StringBuilder buf = new StringBuilder(64);
        while(argItor.hasNext()) {
            Item it = argItor.next();
            assert (it instanceof XInteger);
            final int cp = (int) ((XInteger) it).getValue();
            if(!XMLUtils.isValid(cp)) {
                throw new DynamicError("err:FOCH0001", "Invalid XML char was detected: `" + cp
                        + "`!");
View Full Code Here

        return s;
    }

    public XString eval(Sequence<? extends Item> contextSeq, ValueSequence argv, DynamicContext dynEnv)
            throws XQueryException {
        Item firstItem = argv.getItem(0);
        if(firstItem.isEmpty()) {
            return XString.valueOf("");
        }
        String arg = firstItem.stringValue();
        String converted = arg.toLowerCase();
        return XString.valueOf(converted);
    }
View Full Code Here

TOP

Related Classes of xbird.xquery.dm.value.Item

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.