Package net.sf.saxon.xpath

Examples of net.sf.saxon.xpath.StaticError


            XQueryFunction fd = (XQueryFunction)functions.get(keyObj);
            if (fd != null) {
                ufc.setStaticType(fd.getResultType());
                fd.registerReference(ufc);
            } else {
                throw new StaticError("Function " +
                        getNamePool().getDisplayName(ufc.getFunctionNameCode()) +
                        " has not been declared",
                        ExpressionTool.getLocator(ufc));
            }
        }
View Full Code Here


                e.setLocator(this);
            }
            if (e instanceof StaticError) {
                throw (StaticError)e;
            } else {
                throw new StaticError(e);
            }
        }
    }
View Full Code Here

                    env.getConfiguration().getErrorListener().fatalError(err);
                } catch (TransformerException err2) {
                    if (err2 instanceof XPathException) {
                        throw (XPathException) err2;
                    } else {
                        throw new StaticError(err2);
                    }
                }
            }
        }
        if (errorCount == 0) {
            return exp;
        } else {
            throw new StaticError("Query Parsing failed");
        }
    }
View Full Code Here

            env.bindUnboundFunctionCalls();
            env.fixupGlobalVariables(env.getExecutable().getGlobalVariableMap());
            env.fixupGlobalFunctions();
        }
        if (errorCount != 0) {
            throw new StaticError("Query parsing failed");
        }
    }
View Full Code Here

        String module = env.getSystemId();
        lineInfo += (module == null ? "" : "of " + module + ' ');
        String prefix = getLanguage() + " syntax error " + lineInfo +
                (message.startsWith("...") ? "near" : "in") +
                " `" + s + "`:\n    ";
        XPathException exception = new StaticError(prefix + message);
        try {
            env.getConfiguration().getErrorListener().error(exception);
        } catch (TransformerException err) {
            if (err instanceof StaticError) {
                throw (StaticError) err;
            } else {
                throw new StaticError(err);
            }
        }
        throw new StaticError("XQuery syntax error");
    }
View Full Code Here

        last = start;
        len = avt.length();
        while (last < len) {
            i2 = avt.indexOf(terminator, last);
            if (i2 < 0) {
                throw new StaticError("Attribute constructor is not properly terminated");
            }

            i0 = avt.indexOf("{", last);
            i1 = avt.indexOf("{{", last);
            i8 = avt.indexOf("}", last);
            i9 = avt.indexOf("}}", last);

            if ((i0 < 0 || i2 < i0) && (i8 < 0 || i2 < i8)) {   // found end of string
                addStringComponent(components, avt, last, i2);

                // look for doubled quotes, and skip them (for now)
                if (i2+1 < avt.length() && avt.charAt(i2+1)==terminator) {
                    components.add(new StringValue(terminator + ""));
                    last = i2+2;
                    continue;
                } else {
                    last = i2;
                    break;
                }
            } else if (i8 >= 0 && (i0 < 0 || i8 < i0)) {             // found a "}"
                if (i8 != i9) {                        // a "}" that isn't a "}}"
                    throw new StaticError(
                            "Closing curly brace in attribute value template \"" + avt + "\" must be doubled");
                }
                addStringComponent(components, avt, last, i8 + 1);
                last = i8 + 2;
            } else if (i1 >= 0 && i1 == i0) {              // found a doubled "{{"
View Full Code Here

        // compile the regular expression once if possible
        if (!(e instanceof Value)) {
            regexp = Matches.tryToCompile(argument, 1, 2);
            // check that it's not a pattern that matches ""
            if (regexp != null && regexp.matcher("").matches()) {
                throw new StaticError(
                        "The regular expression must not be one that matches a zero-length string");
            }
        }

        return e;
View Full Code Here

                throw new DynamicError(err);
            }

            // check that it's not a pattern that matches ""
            if (re.matcher("").matches()) {
                throw new StaticError(
                        "The regular expression must not be one that matches a zero-length string");
            }

        }
        return new TokenIterator(input, re);
View Full Code Here

                    break;
                case 'x':
                    flags |= Pattern.COMMENTS;  // note, this enables comments as well as whitespace
                    break;
                default:
                    throw new StaticError("Invalid character '" + c + "' in regular expression flags");
            }
        }
        return flags;
    }
View Full Code Here

            try {
                String javaRegex = RegexTranslator.translate(
                        ((StringValue)args[patternArg]).getStringValue(), true);
                return Pattern.compile(javaRegex, flags);
            } catch (RegexTranslator.RegexSyntaxException err) {
                throw new StaticError(err);
            } catch (PatternSyntaxException err) {
                throw new StaticError(err);
            }
        } else {
            return null;
        }
    }
View Full Code Here

TOP

Related Classes of net.sf.saxon.xpath.StaticError

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.