Examples of StaticError


Examples of net.sf.saxon.xpath.StaticError

    */

    public String getURIForPrefix(String prefix) throws XPathException {
      String uri = checkURIForPrefix(prefix);
      if (uri==null) {
        throw new StaticError("Prefix " + prefix + " has not been declared");
      }
      return uri;
    }
View Full Code Here

Examples of net.sf.saxon.xpath.StaticError

     */

    public void declareDefaultCollation(String name) throws XPathException {
        Comparator c = getCollation(name);
        if (c==null) {
            throw new StaticError("Collation " + name + " is not recognized");
        }
        defaultCollationName = name;
    }
View Full Code Here

Examples of net.sf.saxon.xpath.StaticError

    public void declareVariable(VariableDeclaration var) throws StaticError {
        int key = var.getNameCode();
        Integer keyObj = new Integer(key);
        if (variables.get(keyObj) != null) {
            throw new StaticError(
                    "Duplicate definition of global variable " + var.getVariableName());
        }
        variables.put(keyObj, var);
        variableList.add(var);
    }
View Full Code Here

Examples of net.sf.saxon.xpath.StaticError

                var.compile(this, slot);
            } catch (XPathException err) {
                if (err instanceof StaticError) {
                    throw (StaticError)err;
                } else {
                    throw new StaticError(err);
                }
            }
        }
    }
View Full Code Here

Examples of net.sf.saxon.xpath.StaticError

    public VariableDeclaration bindVariable(int fingerprint) throws StaticError {

        VariableDeclaration var = (VariableDeclaration)variables.get(new Integer(fingerprint));
        if (var==null) {
            throw new StaticError("Undeclared variable in query");
        } else {
            return var;
        }
    }
View Full Code Here

Examples of net.sf.saxon.xpath.StaticError

//            throw new XPathException.Static("Duplicate definition of function " +
//                    namePool.getDisplayName(fp));
//        }
        if (moduleNamespace != null &&
                namePool.getURICode(fp) != moduleNamespaceURICode) {
            throw new StaticError("Function " + namePool.getDisplayName(fp) +
                                            " is not defined in the module namespace"
                                            );
        }
        //functions.put(keyObj, function);
        functions.declareFunction(function);
View Full Code Here

Examples of net.sf.saxon.xpath.StaticError

        if (mod != null) {
            return mod;
        }

        if (locationURI == null) {
            throw new StaticError(
                    "import module must either specify a known namespace or a location");
        }
        // Resolve relative URI

        URL absoluteURL;
        if (baseURI==null) {    // no base URI available
            try {
                // the href might be an absolute URL
                absoluteURL = new URL(locationURI);
            } catch (MalformedURLException err) {
                // it isn't
                throw new StaticError("Cannot resolve URI (no base URI available)", err);
            }
        } else {
            try {
                absoluteURL = new URL(new URL(baseURI), locationURI);
            } catch (MalformedURLException err) {
                throw new StaticError("Cannot resolve relative URI", err);
            }
        }
        InputStream is;
        try {
            is = absoluteURL.openStream();
            BufferedReader reader = new BufferedReader(
                                        new InputStreamReader(is));

            StringBuffer sb = new StringBuffer(2048);
            char[] buffer = new char[2048];
            int actual;
            while (true) {
                actual = reader.read(buffer, 0, 2048);
                if (actual<0) break;
                sb.append(buffer, 0, actual);
            }
            reader.close();
            is.close();
            StaticQueryContext module = new StaticQueryContext(config);
            module.setBaseURI(absoluteURL.toString());
            module.setExecutable(executable);
            QueryParser qp = new QueryParser();
            qp.parseLibraryModule(sb.toString(), module);
            if (module.getModuleNamespace() == null) {
                throw new StaticError(
                        "Imported module must be a library module");
            }
            if (!module.getModuleNamespace().equals(namespaceURI)) {
                throw new StaticError(
                        "Imported module's namespace does not match requested namespace");
            }
            executable.addQueryLibraryModule(module);
            return module;
        } catch (java.io.IOException ioErr) {
            throw new StaticError(ioErr);
        }
    }
View Full Code Here

Examples of net.sf.saxon.xpath.StaticError

    * @throws net.sf.saxon.xpath.XPathException if the number of arguments is out of range
    */

    private int checkArgumentCount(int numArgs, int min, int max, String local) throws XPathException {
        if (min==max && numArgs != min) {
            throw new StaticError("Function saxon:" + local + " must have "
                    + min + pluralArguments(min));
        }
        if (numArgs < min) {
            throw new StaticError("Function saxon:" + local + " must have at least "
                    + min + pluralArguments(min));
        }
        if (numArgs > max) {
            throw new StaticError("Function saxon:" + local + " must have no more than "
                    + max + pluralArguments(max));
        }
        return numArgs;
    }
View Full Code Here

Examples of net.sf.saxon.xpath.StaticError

        if (argument.length > pos) {
            return;
            // this can happen during optimization, if the extra argument is already present
        }
        if (argument.length != pos) {
            throw new StaticError("Too few arguments in call to " + augmentedName + "() function");
        }
        Expression[] newArgs = new Expression[pos+1];
        System.arraycopy(argument, 0, newArgs, 0, argument.length);
        final RootExpression rootExpression = new RootExpression();
        ExpressionTool.copyLocationInfo(this, newArgs[pos]);
View Full Code Here

Examples of net.sf.saxon.xpath.StaticError

    public String getURIForPrefix(String prefix) throws XPathException {
        try {
            return element.getURIForPrefix(prefix, false);
        } catch (NamespaceException err) {
            throw new StaticError(err);
        }
    }
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.