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); }
URI sourceUri = href.getBaseURI().resolve(href.getString()); File file = new File(sourceUri.getPath());
URI sourceUri = href.getBaseURI().resolve(href.getString()); File file = new File(sourceUri.getPath());
public void run() throws SaxonApiException { super.run(); if (runtime.getSafeMode()) { throw XProcException.dynamicError(21); } boolean recursive = getOption(_recursive, false); boolean fail_on_error = getOption(_fail_on_error, true); RuntimeValue href = getOption(_href); String base = href.getBaseURI().toASCIIString(); URI uri = href.getBaseURI().resolve(href.getString()); TreeWriter tree = new TreeWriter(runtime); tree.startDocument(step.getNode().getBaseURI()); tree.addStartElement(XProcConstants.c_result); tree.startContent(); tree.addText(uri.toASCIIString()); performDelete(href, base, recursive, fail_on_error); tree.addEndElement(); tree.endDocument(); result.write(tree.getResult()); }
public void run() throws SaxonApiException { super.run(); if (runtime.getSafeMode()) { throw XProcException.dynamicError(21); } boolean failOnError = getOption(_fail_on_error, true); RuntimeValue href = getOption(_href); URI sourceUri= href.getBaseURI().resolve(href.getString()); href = getOption(_target); URI destUri = href.getBaseURI().resolve(href.getString()); File target=this.getFile(destUri,sourceUri); TreeWriter tree = new TreeWriter(runtime); tree.startDocument(step.getNode().getBaseURI()); tree.addStartElement(XProcConstants.c_result); tree.startContent(); tree.addText(target.toURI().toASCIIString()); this.copy(sourceUri,target); tree.addEndElement(); tree.endDocument(); result.write(tree.getResult()); }
public void run() throws SaxonApiException { super.run(); if (runtime.getSafeMode()) { throw XProcException.dynamicError(21); } boolean recursive = getOption(_recursive, false); boolean fail_on_error = getOption(_fail_on_error, true); RuntimeValue href = getOption(_href); String base = href.getBaseURI().toASCIIString(); URI uri = href.getBaseURI().resolve(href.getString()); TreeWriter tree = new TreeWriter(runtime); tree.startDocument(step.getNode().getBaseURI()); tree.addStartElement(XProcConstants.c_result); tree.startContent(); tree.addText(uri.toASCIIString()); performDelete(href, base, recursive, fail_on_error); tree.addEndElement(); tree.endDocument(); result.write(tree.getResult()); }
public void run() throws SaxonApiException { super.run(); XdmNode doc = source.read(); RuntimeValue base = getOption(_base_uri); if (base != null) { setBaseURI = base.getBaseURI().resolve(base.getString()); } logger.trace(MessageFormatter.nodeMessage(doc, "Making URIs absolute against: " + setBaseURI)); matcher = new ProcessMatch(runtime, this); matcher.match(doc, 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(); XdmNode doc = source.read(); RuntimeValue base = getOption(_base_uri); if (base != null) { setBaseURI = base.getBaseURI().resolve(base.getString()); } logger.trace(MessageFormatter.nodeMessage(doc, "Making URIs absolute against: " + setBaseURI)); matcher = new ProcessMatch(runtime, this); matcher.match(doc, 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(); try { XdmNode doc = runtime.getConfigurer().getXMLCalabashConfigurer().loadDocument(this); result.write(doc); } catch (XProcException e) { logger.debug(e.getMessage(), e); if (err_XD0011.equals(e.getErrorCode())) { RuntimeValue href = getOption(_href); String baseURI = href.getBaseURI().toASCIIString(); boolean validate = getOption(_dtd_validate, false); throw XProcException.stepError(11, "Could not load " + href.getString() + " (" + baseURI + ") dtd-validate=" + validate); } throw e; } catch (Exception e) { throw new XProcException(e); } } }
public void run() throws SaxonApiException { super.run(); try { XdmNode doc = runtime.getConfigurer().getXMLCalabashConfigurer().loadDocument(this); result.write(doc); } catch (XProcException e) { logger.debug(e.getMessage(), e); if (err_XD0011.equals(e.getErrorCode())) { RuntimeValue href = getOption(_href); String baseURI = href.getBaseURI().toASCIIString(); boolean validate = getOption(_dtd_validate, false); throw XProcException.stepError(11, "Could not load " + href.getString() + " (" + baseURI + ") dtd-validate=" + validate); } throw e; } catch (Exception e) { throw new XProcException(e); } } }
public void run() throws SaxonApiException { super.run(); String uris = getOption(_uri, (String) null); if (uris == null) { throw new XProcException("URI is required"); } baseURI = getOption(_uri).getBaseURI().resolve(uris); XdmNode doc = source.read(); tree = new TreeWriter(runtime); tree.startDocument(baseURI); for (XdmNode node : new AxisNodes(doc, Axis.CHILD)) { write(node,false); } tree.endDocument(); result.write(tree.getResult()); }
public void run() throws SaxonApiException { super.run(); String uris = getOption(_uri, (String) null); if (uris == null) { throw new XProcException("URI is required"); } baseURI = getOption(_uri).getBaseURI().resolve(uris); XdmNode doc = source.read(); tree = new TreeWriter(runtime); tree.startDocument(baseURI); for (XdmNode node : new AxisNodes(doc, Axis.CHILD)) { write(node,false); } tree.endDocument(); result.write(tree.getResult()); }
public void load(URI id, String media, final InputStream src, long len) throws IOException { RuntimeValue target = getOption(_target); URI uri = store.writeEntry(target.getString(), target.getBaseURI().toASCIIString(), media, new DataWriter() { public void store(OutputStream dst) throws IOException { byte[] buffer = new byte[bufsize]; int read = src.read(buffer, 0, bufsize); while (read >= 0) { dst.write(buffer, 0, read); read = src.read(buffer, 0, bufsize); } } }); TreeWriter tree = new TreeWriter(runtime); tree.startDocument(step.getNode().getBaseURI()); tree.addStartElement(XProcConstants.c_result); tree.startContent(); tree.addText(uri.toASCIIString()); tree.addEndElement(); tree.endDocument(); result.write(tree.getResult()); } });
public void load(URI id, String media, final InputStream src, long len) throws IOException { RuntimeValue target = getOption(_target); URI uri = store.writeEntry(target.getString(), target.getBaseURI().toASCIIString(), media, new DataWriter() { public void store(OutputStream dst) throws IOException { byte[] buffer = new byte[bufsize]; int read = src.read(buffer, 0, bufsize); while (read >= 0) { dst.write(buffer, 0, read); read = src.read(buffer, 0, bufsize); } } }); TreeWriter tree = new TreeWriter(runtime); tree.startDocument(step.getNode().getBaseURI()); tree.addStartElement(XProcConstants.c_result); tree.startContent(); tree.addText(uri.toASCIIString()); tree.addEndElement(); tree.endDocument(); result.write(tree.getResult()); } });
public void load(URI id, String media, final InputStream src, long len) throws IOException { RuntimeValue target = getOption(_target); URI uri = store.writeEntry(target.getString(), target.getBaseURI().toASCIIString(), media, new DataWriter() { public void store(OutputStream dst) throws IOException { byte[] buffer = new byte[bufsize]; int read = src.read(buffer, 0, bufsize); while (read >= 0) { dst.write(buffer, 0, read); read = src.read(buffer, 0, bufsize); } } }); TreeWriter tree = new TreeWriter(runtime); tree.startDocument(step.getNode().getBaseURI()); tree.addStartElement(XProcConstants.c_result); tree.startContent(); tree.addText(uri.toASCIIString()); tree.addEndElement(); tree.endDocument(); result.write(tree.getResult()); } });
public void load(URI id, String media, final InputStream src, long len) throws IOException { RuntimeValue target = getOption(_target); URI uri = store.writeEntry(target.getString(), target.getBaseURI().toASCIIString(), media, new DataWriter() { public void store(OutputStream dst) throws IOException { byte[] buffer = new byte[bufsize]; int read = src.read(buffer, 0, bufsize); while (read >= 0) { dst.write(buffer, 0, read); read = src.read(buffer, 0, bufsize); } } }); TreeWriter tree = new TreeWriter(runtime); tree.startDocument(step.getNode().getBaseURI()); tree.addStartElement(XProcConstants.c_result); tree.startContent(); tree.addText(uri.toASCIIString()); tree.addEndElement(); tree.endDocument(); result.write(tree.getResult()); } });
zipURI = getOption(_href).getBaseURI();
public void run() throws SaxonApiException { super.run(); if (runtime.getSafeMode()) { throw XProcException.dynamicError(21); } RuntimeValue href = getOption(_href); TreeWriter tree = new TreeWriter(runtime); tree.startDocument(step.getNode().getBaseURI()); tree.addStartElement(XProcConstants.c_result); tree.startContent(); try { DataStore store = runtime.getDataStore(); URI uri = store.createList(href.getString(), href.getBaseURI().toASCIIString()); tree.addText(uri.toASCIIString()); } catch (FileNotFoundException e) { throw new XProcException(step.getNode(), "Cannot mkdir: file exists: " + href.getString()); } catch (IOException e) { throw new XProcException(step.getNode(), "Mkdir failed for: " + href.getString()); } tree.addEndElement(); tree.endDocument(); result.write(tree.getResult()); } }
public void run() throws SaxonApiException { super.run(); if (runtime.getSafeMode()) { throw XProcException.dynamicError(21); } RuntimeValue href = getOption(_href); TreeWriter tree = new TreeWriter(runtime); tree.startDocument(step.getNode().getBaseURI()); tree.addStartElement(XProcConstants.c_result); tree.startContent(); try { DataStore store = runtime.getDataStore(); URI uri = store.createList(href.getString(), href.getBaseURI().toASCIIString()); tree.addText(uri.toASCIIString()); } catch (FileNotFoundException e) { throw new XProcException(step.getNode(), "Cannot mkdir: file exists: " + href.getString()); } catch (IOException e) { throw new XProcException(step.getNode(), "Mkdir failed for: " + href.getString()); } tree.addEndElement(); tree.endDocument(); result.write(tree.getResult()); } }