Package com.xmlcalabash.io

Examples of com.xmlcalabash.io.ReadablePipe


        }

        RuntimeValue match = ((Viewport) step).getMatch();

        String iport = "#viewport-source";
        ReadablePipe vsource = null;

        if (inputs.get(iport).size() != 1) {
            throw XProcException.dynamicError(3);
        } else {
            vsource = inputs.get(iport).get(0);
        }

        XdmNode doc = vsource.read();
        if (doc == null || vsource.moreDocuments()) {
            throw XProcException.dynamicError(3);
        }
       
        matcher = new ProcessMatch(runtime, this);
View Full Code Here


            Vector<ReadablePipe> xpc = inputs.get("#xpath-context");
            if (xpc.size() == 0) {
                // If there's no binding for a p:choose, the default is an empty binding...
                return new ReadableEmpty();
            }
            ReadablePipe pipe = xpc.get(0)
            return new Pipe(runtime, pipe.documents());
        } else {
            return super.getBinding(stepName, portName);
        }
    }
View Full Code Here

        }

        loader.clearInputs("source");
        loader.writeTo("source", pipeDoc);
        loader.run();
        ReadablePipe xformed = loader.readFrom("result");
        pipeDoc = xformed.read();

        reset();
        return pipeDoc;
    }
View Full Code Here

        if (t.comparepipeline != null) {
            XProcPipeline compare = t.comparepipeline;
            Hashtable<String, Vector<XdmNode>> cinputs = new Hashtable<String, Vector<XdmNode>> ();
            for (String port : pipeoutputs.keySet()) {
                if (compare.inputPorts.contains(port)) {
                    ReadablePipe pipe = pipeoutputs.get(port);
                    while (pipe.moreDocuments()) {
                        try {
                            XdmNode p = pipe.read();
                            if (!cinputs.containsKey(port)) {
                                cinputs.put(port, new Vector<XdmNode> ());
                            }
                            cinputs.get(port).add(p);
                        } catch (SaxonApiException sae) {
                            result.catchException(sae);
                            return result;
                        }
                    }
                }
            }

            try {
                pipeoutputs = runPipe(compare.pipeline, cinputs, t.outputs, null, null);
            } catch (Exception err) {
                result.fail(err, "Compare pipelines failed: this shouldn't happen.");
            }
        }

        Hashtable<String,Vector<XdmNode>> results = new Hashtable<String,Vector<XdmNode>> ();
        Hashtable<String,Vector<XdmNode>> expects = new Hashtable<String,Vector<XdmNode>> ();

        try {
            for (String port : pipeoutputs.keySet()) {
                Vector<XdmNode> touts = t.outputs.get(port);
                ReadablePipe pipe = pipeoutputs.get(port);

                if (!results.containsKey(port)) {
                    results.put(port,new Vector<XdmNode>());
                }

                if (!expects.containsKey(port)) {
                    expects.put(port,new Vector<XdmNode>());
                }

                Vector<XdmNode> pres = results.get(port);
                Vector<XdmNode> pexp = expects.get(port);

                while (pipe.moreDocuments()) {
                    if (touts.size() > 0) {
                        XdmNode tdoc = touts.remove(0);
                        XdmNode pdoc = pipe.read();

                        if (t.ignoreWS) {
                            XPipeline pppipe = runtime.use(prettyPrint);
                            pppipe.writeTo("source", tdoc);
                            pppipe.run();
                            ReadablePipe rpipe = pppipe.readFrom("result");
                            tdoc = rpipe.read();

                            pppipe.reset();
                            pppipe.writeTo("source", pdoc);
                            pppipe.run();
                            rpipe = pppipe.readFrom("result");
                            pdoc = rpipe.read();
                        }

                        pres.add(pdoc);
                        pexp.add(tdoc);
                    } else {
View Full Code Here

        Hashtable<String, ReadablePipe> pipeoutputs = new Hashtable<String, ReadablePipe> ();

        Set<String> pipeouts = xpipeline.getOutputs();
        for (String port : pipeouts) {
            if (!port.startsWith("!")) {
                ReadablePipe rpipe = xpipeline.readFrom(port);
                rpipe.canReadSequence(true);
                pipeoutputs.put(port, rpipe);
            }
        }

        return pipeoutputs;
View Full Code Here

TOP

Related Classes of com.xmlcalabash.io.ReadablePipe

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.