Examples of DynamicError


Examples of net.sf.saxon.trans.DynamicError

                Object o = ((VirtualNode)item).getUnderlyingNode();
                if (o instanceof Node) {
                    nodes.add(o);
                } else {
                    if (requireXOM) {
                        DynamicError err = new DynamicError("Extension function required class " + targetClass.getName() +
                                "; supplied value of class " + item.getClass().getName() +
                                " could not be converted");
                        throw err;
                    };
                }
            } else if (requireXOM) {
                DynamicError err = new DynamicError("Extension function required class " + targetClass.getName() +
                            "; supplied value of class " + item.getClass().getName() +
                            " could not be converted");
                throw err;
            } else {
                return null;
            }
        }

        if (nodes.size() == 0 && !requireXOM) {
            return null// empty sequence supplied - try a different mapping
        }
        if (Node.class.isAssignableFrom(targetClass)) {
            if (nodes.size() != 1) {
                DynamicError err = new DynamicError("Extension function requires a single XOM Node" +
                                "; supplied value contains " + nodes.size() + " nodes");
                throw err;
            }
            return nodes.get(0);
        } else if (targetClass.isArray() && Node.class.isAssignableFrom(targetClass.getComponentType())) {
View Full Code Here

Examples of net.sf.saxon.xpath.DynamicError

    {
        Object obj = Loader.getInstance(className);
        if (obj instanceof URIResolver) {
            return (URIResolver)obj;
        }
        throw new DynamicError("Class " + className + " is not a URIResolver");
    }
View Full Code Here

Examples of xbird.xquery.DynamicError

                    final Item groupKey;
                    if(atomizedItor.hasNext()) {
                        AtomicValue atom = (AtomicValue) atomizedItor.next();
                        if(atomizedItor.hasNext()) {
                            atomizedItor.closeQuietly();
                            throw new DynamicError("err:XQDY0095", "Illegal resulting value for a grouping variable: "
                                    + atomized);
                        }
                        groupKey = atom.asGroupingValue();
                    } else {
                        groupKey = ValueSequence.EMPTY_SEQUENCE;
View Full Code Here

Examples of xbird.xquery.DynamicError

        }

        public void putNonGroupingVariable(BindingVariable var) throws DynamicError {
            final Sequence result = var.getResult();
            if(result == null) {
                throw new DynamicError("Result is not bounded for " + var);
            }
            if(nonGroupingVaribales == null) {
                this.nonGroupingVaribales = new IdentityHashMap<BindingVariable, Sequence>(4);
                nonGroupingVaribales.put(var, result);
            } else {
View Full Code Here

Examples of xbird.xquery.DynamicError

        }
        final Reader fis;
        try {
            fis = new FileReader(_queryFile);
        } catch (FileNotFoundException e) {
            throw new DynamicError("Illegal Query file: " + path, e);
        }
        execute(fis, _timeout);
    }
View Full Code Here

Examples of xbird.xquery.DynamicError

        final Writer writer;
        if(_out != null) {
            try {
                writer = new FastBufferedWriter(new OutputStreamWriter(new FileOutputStream(_out), _encoding), 8192);
            } catch (IOException e) {
                throw new DynamicError("Illegal Output file: " + e.getMessage());
            }
        } else {
            writer = new FastBufferedWriter(new OutputStreamWriter(System.out, Charset.forName(_encoding)), 4096);
        }
View Full Code Here

Examples of xbird.xquery.DynamicError

    }

    public static XsDuration valueOf(String literal) throws XQueryException {
        final Matcher match = DURATION_PATTERN.matcher(literal);
        if(!match.matches()) {
            throw new DynamicError("err:FORG0001", "Illegal representation as xs:duration: "
                    + literal);
        }

        final String y, mo, d;
        int year = ((y = match.group(2)) == null) ? 0 : Integer.parseInt(y);
View Full Code Here

Examples of xbird.xquery.DynamicError

        if(argv == null) {
            // If the function is called without an argument, the context item is used
            // as the default argument.
            Item i = dynEnv.contextItem();
            if(i == null) {
                throw new DynamicError("err:XPDY0002", "ContextItem is not set");
            }
            if(i instanceof XQNode) {
                ((XQNode) i).getRoot();
            } else {
                throw new DynamicError("err:XPTY0004", "context item is not a node");
            }
        } else if(argv.size() == 1) {
            Item i = argv.getItem(0);
            if(i.isEmpty()) {
                return ValueSequence.EMPTY_SEQUENCE;
            }
            if(i instanceof XQNode) {
                return ((XQNode) i).getRoot();
            }
        }
        throw new DynamicError("Arguments size of " + SYMBOL + " must be 0 or 1, but was "
                + argv.size());
    }
View Full Code Here

Examples of xbird.xquery.DynamicError

        assert (arglen == 1 || arglen == 2);
        final XQNode node;
        if (arglen == 1) {
            Item contextItem = dynEnv.contextItem();
            if (contextItem == null) {
                throw new DynamicError("err:XPDY0002", "ContextItem is not set");
            }
            if (!(contextItem instanceof XQNode)) {
                throw new DynamicError("err:XPTY0004", "Context item is expected to node, but was "
                        + contextItem.getType());
            }
            node = (XQNode) contextItem;
        } else {
            Item secondItem = argv.getItem(1);
View Full Code Here

Examples of xbird.xquery.DynamicError

        public XDouble eval(DynamicContext dynEnv, Item v1, Item v2) throws XQueryException {
            double d1 = asDouble(v1, dynEnv);
            double d2 = asDouble(v2, dynEnv);
            final double res = d1 % d2;
            if(res == Double.POSITIVE_INFINITY) {
                throw new DynamicError("err:FOAR0002", "result overflow");
            }
            if(res == Double.NEGATIVE_INFINITY) {
                throw new DynamicError("err:FOAR0002", "result underflow");
            }
            return XDouble.valueOf(res);
        }
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.