Calabash: Writing to input ports - "Attempt to create two writers for the same input"


How can I write XML content to a pipeline's input port with Calabash? I am
using version 0.9.14

I have the following minimal Xproc definition:

<?xml version="1.0"?>

<p:declare-step xmlns:p="">
    <p:input port="source"/>
    <p:output port="result"/>

In the snippet below I retrieve the pipeline from the runtime, write to the
input port, run the pipeline, and read from the output port. The xplFilePath
variable contains the path to the Xproc file above.

XPipeline xPipeline = xProcRuntime.load(xplFilePath);
DocumentBuilder builder = xProcRuntime.getProcessor().newDocumentBuilder();
XdmNode inputXml = File("xproc/12345.rdf"));
WritablePipe source = xPipeline.getInput("source").getWriter();

XOutput xOutput = xPipeline.getOutput("result");
ReadablePipe readablePipe = xOutput.getReader();
XdmNode xdmNode =;

When I run this snippet I get the exception:
"com.xmlcalabash.core.XProcException: Attempt to create two writers for the
same input." Why is this exception thrown and what's the correct way to
write to an input port?


Frank Scholten

Received on Thursday, 15 October 2009 17:09:07 UTC