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

Hi,

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="http://www.w3.org/ns/xproc">
    <p:input port="source"/>
    <p:output port="result"/>
    <p:identity/>
</p:declare-step>

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 = builder.build(new File("xproc/12345.rdf"));
WritablePipe source = xPipeline.getInput("source").getWriter();
source.write(inputXml);
xPipeline.run();

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

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?

Regards,

Frank Scholten

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