data.openFrame(this); copyInputs(); inScopeOptions = parent.getInScopeOptions(); for (QName name : step.getOptions()) { Option option = step.getOption(name); RuntimeValue value = computeValue(option); setOption(name, value); inScopeOptions.put(name, value); RuntimeValue value = computeValue(var); inScopeOptions.put(var.getName(), value); step.run(); } catch (Throwable e) { throw handleException(e);
public ReadablePipe getBinding(String stepName, String portName) { if (name.equals(stepName) && "error".equals(portName)) { return new Pipe(runtime,errorPipe.documents()); } else { return super.getBinding(stepName, portName); } }
public String getInheritedExtensionAttribute(QName name) { if (getExtensionAttribute(name) != null) { return getExtensionAttribute(name); } if (parent != null) { return parent.getInheritedExtensionAttribute(name); } return null; }
public ReadablePipe getBinding(String stepName, String portName) { if (name.equals(stepName)) { XInput input = getInput(portName); return input.getReader(); } for (XStep step : subpipeline) { if (stepName.equals(step.getName())) { XOutput output = step.getOutput(portName); if (output == null) { return new ReadableEmpty(); } else { ReadablePipe rpipe = output.getReader(); return rpipe; } } } return parent.getBinding(stepName, portName); }
public void instantiate(Step step) { logger.trace(MessageFormatter.nodeMessage(step.getNode(), "--> instantiate " + step)); instantiateReaders(step); parent.addStep(this); ReadablePipe pipe = getPipeFromBinding(binding); pipe.canReadSequence(input.getSequence()); pipe.setReader(step); addInput(xinput); if (port.endsWith("|")) { String rport = port.substring(0,port.length()-1); XInput xinput = getInput(rport); WritablePipe wpipe = xinput.getWriter(); wpipe.setWriter(step); XOutput xoutput = new XOutput(runtime, output); xoutput.setLogger(step.getLog(port)); addOutput(xoutput); WritablePipe wpipe = xoutput.getWriter(); wpipe.setWriter(step);
pipe = start.getBinding(pnbinding.getStep(), pnbinding.getPort()); pipe.setNames(pnbinding.getStep(), pnbinding.getPort()); } else if (binding.getBindingType() == Binding.INLINE_BINDING) { XCompoundStep step = parent; while (! (step instanceof XCatch)) { step = step.getParent(); pipe = step.getBinding(step.getName(), "error"); } else { throw new XProcException(binding.getNode(), "Unknown binding type: " + binding.getBindingType());
public boolean shouldRun() throws SaxonApiException { String testExpr = ((When) step).getTest(); XdmNode doc = null; NamespaceBinding nsbinding = new NamespaceBinding(runtime, step.getNode()); Hashtable<QName,RuntimeValue> globals = parent.getInScopeOptions(); ReadablePipe reader = inputs.get("#xpath-context").firstElement(); doc = reader.read(); if (reader.moreDocuments() || inputs.get("#xpath-context").size() > 1) { throw XProcException.dynamicError(5); } // Surround testExpr with "boolean()" to force the EBV. Vector<XdmItem> results = evaluateXPath(doc, nsbinding.getNamespaceBindings(), "boolean(" + testExpr + ")", globals); if (results.size() != 1) { throw new XProcException("Attempt to compute EBV in p:when did not return a singleton!?"); } XdmAtomicValue value = (XdmAtomicValue) results.get(0); return value.getBooleanValue(); }
data.setIterationSize(isize); inScopeOptions = parent.getInScopeOptions(); for (Variable var : step.getVariables()) { RuntimeValue value = computeValue(var); xstep.run(); } finally { runtime.finish(this);
public void instantiate(Step step) { instantiateReaders(step); for (Output output : step.outputs()) { String port = output.getPort(); XOutput xoutput = new XOutput(runtime, output); xoutput.setLogger(step.getLog(port)); addOutput(xoutput); WritablePipe wpipe = xoutput.getWriter(); wpipe.canWriteSequence(output.getSequence()); outputs.put(port, wpipe); logger.trace(MessageFormatter.nodeMessage(step.getNode(), step.getName() + " writes to " + wpipe + " for " + port)); } parent.addStep(this); }
public void instantiate(Step step) { logger.trace(MessageFormatter.nodeMessage(step.getNode(), "--> instantiate " + step)); instantiateReaders(step); parent.addStep(this); ReadablePipe pipe = getPipeFromBinding(binding); pipe.canReadSequence(input.getSequence()); pipe.setReader(step); addInput(xinput); if (port.endsWith("|")) { String rport = port.substring(0,port.length()-1); XInput xinput = getInput(rport); WritablePipe wpipe = xinput.getWriter(); wpipe.setWriter(step); XOutput xoutput = new XOutput(runtime, output); xoutput.setLogger(step.getLog(port)); addOutput(xoutput); WritablePipe wpipe = xoutput.getWriter(); wpipe.setWriter(step);
pipe = start.getBinding(pnbinding.getStep(), pnbinding.getPort()); pipe.setNames(pnbinding.getStep(), pnbinding.getPort()); } else if (binding.getBindingType() == Binding.INLINE_BINDING) { XCompoundStep step = parent; while (! (step instanceof XCatch)) { step = step.getParent(); pipe = step.getBinding(step.getName(), "error"); } else { throw new XProcException(binding.getNode(), "Unknown binding type: " + binding.getBindingType());
public boolean shouldRun() throws SaxonApiException { String testExpr = ((When) step).getTest(); XdmNode doc = null; NamespaceBinding nsbinding = new NamespaceBinding(runtime, step.getNode()); Hashtable<QName,RuntimeValue> globals = parent.getInScopeOptions(); ReadablePipe reader = inputs.get("#xpath-context").firstElement(); doc = reader.read(); if (reader.moreDocuments() || inputs.get("#xpath-context").size() > 1) { throw XProcException.dynamicError(5); } // Surround testExpr with "boolean()" to force the EBV. Vector<XdmItem> results = evaluateXPath(doc, nsbinding.getNamespaceBindings(), "boolean(" + testExpr + ")", globals); if (results.size() != 1) { throw new XProcException("Attempt to compute EBV in p:when did not return a singleton!?"); } XdmAtomicValue value = (XdmAtomicValue) results.get(0); return value.getBooleanValue(); }
public ReadablePipe getBinding(String stepName, String portName) { if (name.equals(stepName)) { XInput input = getInput(portName); return input.getReader(); } for (XStep step : subpipeline) { if (stepName.equals(step.getName())) { XOutput output = step.getOutput(portName); if (output == null) { return new ReadableEmpty(); } else { ReadablePipe rpipe = output.getReader(); return rpipe; } } } return parent.getBinding(stepName, portName); }
data.setIterationSize(isize); inScopeOptions = parent.getInScopeOptions(); for (Variable var : step.getVariables()) { RuntimeValue value = computeValue(var); xstep.run(); } finally { runtime.getMessageListener().closeStep();
public void instantiate(Step step) { instantiateReaders(step); for (Output output : step.outputs()) { String port = output.getPort(); XOutput xoutput = new XOutput(runtime, output); xoutput.setLogger(step.getLog(port)); addOutput(xoutput); WritablePipe wpipe = xoutput.getWriter(); wpipe.canWriteSequence(output.getSequence()); outputs.put(port, wpipe); logger.trace(MessageFormatter.nodeMessage(step.getNode(), step.getName() + " writes to " + wpipe + " for " + port)); } parent.addStep(this); }
data.openFrame(this); copyInputs(); inScopeOptions = parent.getInScopeOptions(); for (QName name : step.getOptions()) { Option option = step.getOption(name); RuntimeValue value = computeValue(option); setOption(name, value); inScopeOptions.put(name, value); RuntimeValue value = computeValue(var); inScopeOptions.put(var.getName(), value);
public void run() throws SaxonApiException { inScopeOptions = parent.getInScopeOptions(); for (Variable var : step.getVariables()) { RuntimeValue value = computeValue(var);
public ReadablePipe getBinding(String stepName, String portName) { if (name.equals(stepName) && "error".equals(portName)) { return new Pipe(runtime,errorPipe.documents()); } else { return super.getBinding(stepName, portName); } }
public void instantiate(Step step) { parent.addStep(this);
public String getInheritedExtensionAttribute(QName name) { if (getExtensionAttribute(name) != null) { return getExtensionAttribute(name); } if (parent != null) { return parent.getInheritedExtensionAttribute(name); } return null; }