Package xbird.xquery

Examples of xbird.xquery.DynamicError


            throws XQueryException {
        final Sequence ep = endpointExpr.eval(contextSeq, dynEnv);
        final IFocus<? extends Item> epFocus = ep.iterator();
        if(!epFocus.hasNext()) {
            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();
View Full Code Here


            final URI resolvedUri = baseuri.resolve(docName);
            final URL docurl;
            try {
                docurl = resolvedUri.toURL();
            } catch (MalformedURLException e) {
                throw new DynamicError("Malformed URL: " + resolvedUri, e);
            }
            DocumentManager docmgr = dynEnv.getDocumentManager();
            DTMDocument doc = docmgr.loadDocument(docurl, dynEnv);
            return doc;
        }
View Full Code Here

    }

    private static byte[] decodeHex(final String literal) throws DynamicError {
        final int len = literal.length();
        if((len & 1) != 0) {
            throw new DynamicError("err:FORG0001", "A xs:hexBinary value MUST contains an even number of characters, but was '"
                    + literal + '\'');
        }
        final byte[] binaryValue = new byte[len / 2];
        for(int i = 0, j = 0; i < len; i += 2, j++) {
            binaryValue[j] = (byte) ((decodeHex(literal, i) << 4) + decodeHex(literal, i + 1));
View Full Code Here

    private static int decodeHex(final String literal, final int index) throws DynamicError {
        final int c = literal.charAt(index);
        final int idx = HEX_CHARS.indexOf(c);
        if(idx == -1) {
            throw new DynamicError("err:FORG0001", "Illegal representation as xs:hexBinary: "
                    + literal);
        }
        if(idx > 15) {
            return (idx - 6) & 0xF;
        } else {
View Full Code Here

        final URI docuri;
        try {
            final String unescaped = XMLUtils.unescapeXML(uriStr);
            docuri = new URI(unescaped);
        } catch (URISyntaxException e) {
            throw new DynamicError("err:FODC0005", "Invalid uri: " + uriStr, e);
        }
        if(dynEnv.getDocumentManager().isDocumentAvailable(docuri)) {
            return BooleanValue.TRUE;
        } else {
            return BooleanValue.FALSE;
View Full Code Here

            throws XQueryException {
        if(_result != null) {
            return _result;
        }
        if(_value == null) {
            throw new DynamicError("The value of variable '$" + getName() + "' is not defined");
        }
        final Sequence<? extends Item> result = _value.eval(contextSeq, dynEnv);
        this._result = result;
        return result;
    }
View Full Code Here

    }

    public Sequence<? extends Item> eval(Sequence<? extends Item> contextSeq, DynamicContext dynEnv)
            throws XQueryException {
        if(contextSeq == null) {
            throw new DynamicError("err:XPDY0002", "ContextItem is not set");
        }
        return contextSeq;
    }
View Full Code Here

        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
                        + "`!");
            }
            final char[] chars = Character.toChars(cp);
            buf.append(chars);
        }
View Full Code Here

        @Override
        public Sequence<? extends Item> eval(Sequence<? extends Item> contextSeq, DynamicContext dynEnv)
                throws XQueryException {
            Sequence result = _result;
            if(result == null) {
                throw new DynamicError("External variable '$" + getName() + "' is not set");
            }
            if(checkType) {
                final Type resultType = result.getType();
                if(!TypeUtil.subtypeOf(resultType, _type)) {
                    result = DirectFunctionCall.mapFunctionArgument(_result, _type, dynEnv);
View Full Code Here

            final int scale;
            final int args = argv.size();
            if(args > 1) {
                Item precision = argv.getItem(1);
                if(!(precision instanceof XInteger)) {
                    throw new DynamicError("err:FORG0006", "second argument type for precision is invalid: "
                            + precision.getType());
                }
                scale = ((XInteger) precision).getNumber().intValue();
            } else {
                scale = 0;
            }
            XNumber promoted = promote(num, scale);
            return promoted;
        } else {
            throw new DynamicError("err:FORG0006", "Invalid argument type: " + firstItem.getType());
        }
    }
View Full Code Here

TOP

Related Classes of xbird.xquery.DynamicError

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.