private void dynamicError(int errno) { String msg = null; if (stepName != null) { msg = "Reading " + portName + " on " + stepName; } throw XProcException.dynamicError(errno, (String) msg); } }
private void dynamicError(int errno) { String msg = null; if (stepName != null) { msg = "Reading " + portName + " on " + stepName; } throw XProcException.dynamicError(errno, (String) msg); } }
public static void checkLiteral(String value, String literals) { String[] values = literals.split("\\|"); for (String v : values) { if (v.equals(value)) { return; } } throw XProcException.dynamicError(45, "Invalid value: \"" + value + "\" must be one of \"" + literals + "\"."); }
public static void checkLiteral(String value, String literals) { String[] values = literals.split("\\|"); for (String v : values) { if (v.equals(value)) { return; } } throw XProcException.dynamicError(45, "Invalid value: \"" + value + "\" must be one of \"" + literals + "\"."); }
private String crc(String value, String version) { if (version == null) { version = "32"; } if (!"32".equals(version)) { throw XProcException.dynamicError(36); } CRC32 crc = new CRC32(); crc.update(value.getBytes()); return Long.toHexString(crc.getValue()); }
public static String crc(byte[] bytes, String version) { if ((version != null) && !"32".equals(version)) { throw XProcException.dynamicError(36); } CRC32 crc = new CRC32(); crc.update(bytes); return Long.toHexString(crc.getValue()); }
public static String sha(byte[] bytes, String version) { version = version == null ? "SHA-1" : "SHA-" + version; MessageDigest digest = null; try { digest = MessageDigest.getInstance(version); } catch (NoSuchAlgorithmException nsae) { throw XProcException.dynamicError(36); } byte[] hash = digest.digest(bytes); return byteString(hash); }
public static String md(byte[] bytes, String version) { version = version == null ? "MD5" : "MD" + version; MessageDigest digest = null; try { digest = MessageDigest.getInstance(version); } catch (NoSuchAlgorithmException nsae) { throw XProcException.dynamicError(36); } byte[] hash = digest.digest(bytes); return byteString(hash); }
public XdmNode loadDocument(Load load) { boolean validate = load.getOption(_dtd_validate, false); RuntimeValue href = load.getOption(_href); String base = href.getBaseURI().toASCIIString(); if (runtime.getSafeMode() && base.startsWith("file:")) { throw XProcException.dynamicError(21); } return runtime.parse(href.getString(), base, validate); }
public XdmNode loadDocument(Load load) { boolean validate = load.getOption(_dtd_validate, false); RuntimeValue href = load.getOption(_href); String base = href.getBaseURI().toASCIIString(); if (runtime.getSafeMode() && base.startsWith("file:")) { throw XProcException.dynamicError(21); } return runtime.parse(href.getString(), base, validate); }
public static void assertDocument(XdmNode doc) { if (doc.getNodeKind() == XdmNodeKind.DOCUMENT) { S9apiUtils.assertDocumentContent(doc.axisIterator(Axis.CHILD)); } else if (doc.getNodeKind() == XdmNodeKind.ELEMENT) { // this is ok } else { throw XProcException.dynamicError(1, "Document root cannot be " + doc.getNodeKind()); } }
public Sequence call(XPathContext xPathContext, Sequence[] sequences) throws XPathException { XProcRuntime runtime = registry.getRuntime(xdef); XStep step = runtime.getXProcData().getStep(); // FIXME: this can't be the best way to do this... // step == null in use-when if (step != null && !(step instanceof XCompoundStep)) { throw XProcException.dynamicError(23); } DoubleValue reqVer = (DoubleValue) sequences[0].head(); return reqVer.getDoubleValue() == 1.0 ? BooleanValue.TRUE : BooleanValue.FALSE; } }
public static void assertDocument(XdmNode doc) { if (doc.getNodeKind() == XdmNodeKind.DOCUMENT) { S9apiUtils.assertDocumentContent(doc.axisIterator(Axis.CHILD)); } else if (doc.getNodeKind() == XdmNodeKind.ELEMENT) { // this is ok } else { throw XProcException.dynamicError(1, "Document root cannot be " + doc.getNodeKind()); } }
public Sequence call(XPathContext xPathContext, Sequence[] sequences) throws XPathException { XProcRuntime runtime = registry.getRuntime(xdef); XStep step = runtime.getXProcData().getStep(); // FIXME: this can't be the best way to do this... // step == null in use-when if (step != null && !(step instanceof XCompoundStep)) { throw XProcException.dynamicError(23); } DoubleValue reqVer = (DoubleValue) sequences[0].head(); return reqVer.getDoubleValue() == 1.0 ? BooleanValue.TRUE : BooleanValue.FALSE; } }
public Sequence call(XPathContext xPathContext, Sequence[] sequences) throws XPathException { XProcRuntime runtime = registry.getRuntime(xdef); XStep step = runtime.getXProcData().getStep(); // FIXME: this can't be the best way to do this... // step == null in use-when if (step != null && !(step instanceof XCompoundStep)) { throw XProcException.dynamicError(23); } return new Int64Value(runtime.getXProcData().getIterationSize()); } }
public Sequence call(XPathContext xPathContext, Sequence[] sequences) throws XPathException { XProcRuntime runtime = registry.getRuntime(xdef); XProcData data = runtime.getXProcData(); XStep step = data.getStep(); // FIXME: this can't be the best way to do this... // step == null in use-when if (step != null && !(step instanceof XCompoundStep)) { throw XProcException.dynamicError(23); } return new Int64Value(runtime.getXProcData().getIterationPosition()); } }
public Sequence call(XPathContext xPathContext, Sequence[] sequences) throws XPathException { XProcRuntime runtime = registry.getRuntime(xdef); XStep step = runtime.getXProcData().getStep(); // FIXME: this can't be the best way to do this... // step == null in use-when if (step != null && !(step instanceof XCompoundStep)) { throw XProcException.dynamicError(23); } return new Int64Value(runtime.getXProcData().getIterationSize()); } }
public Sequence call(XPathContext xPathContext, Sequence[] sequences) throws XPathException { XProcRuntime runtime = registry.getRuntime(xdef); XProcData data = runtime.getXProcData(); XStep step = data.getStep(); // FIXME: this can't be the best way to do this... // step == null in use-when if (step != null && !(step instanceof XCompoundStep)) { throw XProcException.dynamicError(23); } return new Int64Value(runtime.getXProcData().getIterationPosition()); } }
public void run() throws SaxonApiException { super.run(); matcher = new ProcessMatch(runtime, this); matcher.match(source.read(), getOption(_match)); if (source.moreDocuments()) { throw XProcException.dynamicError(6, "Reading source on " + getStep().getName()); } result.write(matcher.getResult()); }
public void run() throws SaxonApiException { super.run(); matcher = new ProcessMatch(runtime, this); matcher.match(source.read(), getOption(_match)); if (source.moreDocuments()) { throw XProcException.dynamicError(6, "Reading source on " + getStep().getName()); } result.write(matcher.getResult()); }