/** * Get the ErrorListener being used during this compilation episode * * @return listener The error listener in use. This is notified of all errors detected during the * compilation. If no user-supplied ErrorListener has been set, returns the system-supplied * ErrorListener. */ public ErrorListener getErrorListener() { return env.getErrorListener(); }
/** * Get the ErrorListener being used during this compilation episode * @return listener The error listener in use. This is notified of all errors detected during the * compilation. If no user-supplied ErrorListener has been set, returns the system-supplied * ErrorListener. */ public ErrorListener getErrorListener() { return env.getErrorListener(); }
/** * Get the ErrorListener being used during this compilation episode * * @return listener The error listener in use. This is notified of all errors detected during the * compilation. If no user-supplied ErrorListener has been set, returns the system-supplied * ErrorListener. */ public ErrorListener getErrorListener() { return env.getErrorListener(); }
private String getError(XPathException ex, StaticQueryContext sqc) { StringBuilder buff = new StringBuilder(); if (sqc.getErrorListener() instanceof LocalErrorListener) { List<TransformerException> errors = ((LocalErrorListener) sqc.getErrorListener()).getErrors(); for (TransformerException tex: errors) { buff.append(tex.getMessageAndLocation()).append("\n"); } } else { Throwable err = ex; while (err != null) { buff.append(err.getMessage()).append("\n"); err = err.getCause(); } } return buff.toString(); }
/** * Say whether an XQuery 1.0, 3.0, or 3.1 processor is required. * * @param value Must be "3.1"; any other value is ignored with a warning. * @since 9.2. The handling of different XQuery version numbers has changed in * successive Saxon releases. * @deprecated in 9.8; the only XQuery version supported is "3.1", and any other value is * ignored with a warning. */ public void setLanguageVersion(String value) { if (!"3.1".equals(value)) { env.getErrorListener().warning(new XPathException("XQuery version ignored: only \"3.1\" is recognized")); } env.setLanguageVersion(31); }
/** * Say whether an XQuery 1.0, 3.0, or 3.1 processor is required. * * @param value Must be "3.1"; any other value is ignored with a warning. * @since 9.2. The handling of different XQuery version numbers has changed in * successive Saxon releases. * @deprecated in 9.8; the only XQuery version supported is "3.1", and any other value is * ignored with a warning. */ public void setLanguageVersion(String value) { if (!"3.1".equals(value)) { env.getErrorListener().warning(new XPathException("XQuery version ignored: only \"3.1\" is recognized")); } env.setLanguageVersion(31); }
/** * Get a named collation. * * @param name the name of the collation, as an absolute URI * @return the collation identified by the given name, as set previously using declareCollation. * If no collation with this name has been declared, the method calls the CollationURIResolver * to locate a collation with this name. * Return null if no collation with this name is found. * @throws NullPointerException if the collation name argument is null. * @since 8.4 * @deprecated since 9.6. Collations are now all held globally at the level of the * Configuration. Calling this method will get the relevant collation held in the Configuration. */ public StringCollator getCollation(String name) { try { return getConfiguration().getCollation(name); } catch (XPathException e) { getErrorListener().warning(e); return null; } }
/** * Get a named collation. * * @param name the name of the collation, as an absolute URI * @return the collation identified by the given name, as set previously using declareCollation. * If no collation with this name has been declared, the method calls the CollationURIResolver * to locate a collation with this name. * Return null if no collation with this name is found. * @throws NullPointerException if the collation name argument is null. * @since 8.4 * @deprecated since 9.6. Collations are now all held globally at the level of the * Configuration. Calling this method will get the relevant collation held in the Configuration. */ public StringCollator getCollation(String name) { try { return getConfiguration().getCollation(name); } catch (XPathException e) { getErrorListener().warning(e); return null; } }
/** * Report a static error in the query (via the registered ErrorListener) * * @param err the error to be signalled */ public void reportStaticError(/*@NotNull*/ XPathException err) { if (!err.hasBeenReported()) { if (userQueryContext == null) { config.getErrorListener().fatalError(err); } else { userQueryContext.getErrorListener().fatalError(err); } err.setHasBeenReported(true); } }
/** * Report a static error in the query (via the registered ErrorListener) * * @param err the error to be signalled */ public void reportStaticError(/*@NotNull*/ XPathException err) { if (!err.hasBeenReported()) { if (userQueryContext == null) { config.getErrorListener().fatalError(err); } else { userQueryContext.getErrorListener().fatalError(err); } err.setHasBeenReported(true); } }
/** * Issue a compile-time warning. This method is used during XQuery expression compilation to * output warning conditions. * <p>This method is intended for internal use only.</p> */ public void issueWarning(String s, Location locator) { XPathException err = new XPathException(s); err.setLocator(locator); if (userQueryContext != null) { userQueryContext.getErrorListener().warning(err); } else { getConfiguration().getErrorListener().warning(err); } }
/** * Report a fatal error in the query (via the registered ErrorListener) * @param err the error to be signalled */ public void reportFatalError(XPathException err) { if (!err.hasBeenReported()) { try { if (userQueryContext == null) { config.getErrorListener().fatalError(err); } else { userQueryContext.getErrorListener().fatalError(err); } } catch (TransformerException e) { // ignore secondary errors } err.setHasBeenReported(); } }
/** * Report a fatal error in the query (via the registered ErrorListener) * @param err the error to be signalled */ public void reportFatalError(XPathException err) { if (!err.hasBeenReported()) { try { if (userQueryContext == null) { config.getErrorListener().fatalError(err); } else { userQueryContext.getErrorListener().fatalError(err); } } catch (TransformerException e) { // ignore secondary errors } err.setHasBeenReported(); } }
/** * Issue a compile-time warning. This method is used during XQuery expression compilation to * output warning conditions. * <p>This method is intended for internal use only.</p> */ public void issueWarning(String s, Location locator) { XPathException err = new XPathException(s); err.setLocator(locator); if (userQueryContext != null) { userQueryContext.getErrorListener().warning(err); } else { getConfiguration().getErrorListener().warning(err); } }
return (T)getDefaultStaticQueryContext().getErrorListener().getClass().getName();
return (T)getDefaultStaticQueryContext().getErrorListener().getClass().getName();