W3C home > Mailing lists > Public > xproc-dev@w3.org > October 2009

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

From: Frank Scholten <franks@jteam.nl>
Date: Thu, 15 Oct 2009 16:40:06 +0200
Message-ID: <c74cff840910150740w534e02b2rafa4dfb8f150bb5f@mail.gmail.com>
To: xproc-dev@w3.org

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"/>

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();

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?


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

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:03:05 UTC