Package com.xmlcalabash.core

Examples of com.xmlcalabash.core.XProcException


        public void error(String message) {
            step.error(step.getNode(), message, XProcConstants.stepError(1)); // FIXME: 1?
        }

        public void exception(String message, Exception exception) {
            throw new XProcException(message, exception);
        }
View Full Code Here


    public RuntimeValue getVariable(QName name) {
        throw new XProcException("The root step doesn't have getVariables!");
    }

    public ReadablePipe getBinding(String stepName, String portName) {
        throw new XProcException("No in-scope binding for " + portName + " on " + stepName);
    }
View Full Code Here

        throw new XProcException("The root step can't be instantiated!");
    }
*/
   
    public void run() {
        throw new XProcException("The root step can't be run!");
    }
View Full Code Here

            if ((((ostream == null) && (uri == null)) || (System.out.equals(ostream))) && runtime.getDebug()) {
                System.out.println("\n--<document boundary>--------------------------------------------------------------------------");
            }
        } catch (SaxonApiException sae) {
            logger.debug(sae.getMessage(), sae);
            throw new XProcException(sae);
        }

        if (writer != null) {
            logger.trace(MessageFormatter.nodeMessage(writer.getNode(),
                    writer.getName() + " wrote '" + (doc == null ? "null" : doc.getBaseURI())));
View Full Code Here

        return pipe;
    }

    public WritablePipe getWriter() {
        if (writer != null) {
            throw new XProcException(node, "Attempt to create two writers for the same output.");
        }
        if (inputWriter != null) {
            writer = inputWriter;
        } else {
            writer = new Pipe(runtime, documents);
View Full Code Here

            if (charset == null) {
                throw XProcException.stepError(10);
            }
            escapedContent = decodeBase64(doc, charset);
        } else if (encoding != null) {
            throw new XProcException(step.getNode(), "Unexpected encoding: " + encoding);
        } else {
            escapedContent = extractText(doc);
        }

        TreeWriter tree = new TreeWriter(runtime);
View Full Code Here

        DocumentBuilder builder = runtime.getProcessor().newDocumentBuilder();
        try {
            XdmNode doc = builder.build(saxSource);
            return doc;
        } catch (Exception e) {
            throw new XProcException(e);
        }
    }
View Full Code Here

            Document html = htmlBuilder.parse(src);
            DocumentBuilder builder = runtime.getProcessor().newDocumentBuilder();
            XdmNode doc = builder.build(new DOMSource(html));
            return doc;
        } catch (Exception e) {
            throw new XProcException(e);
        }
    }
View Full Code Here

        // 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();
    }
View Full Code Here

            XPathExecutable xexec = xcomp.compile(select);
            selector = xexec.load();
            // FIXME: Set getVariables
        } catch (SaxonApiException sae) {
            throw new XProcException(sae);
        }

        while (source.moreDocuments()) {
            // Ok, time to go looking for things to select from.
            try {
                XdmNode doc = source.read();

                if (reader != null) {
                    logger.trace(MessageFormatter.nodeMessage(reader.getNode(),
                            reader.getName() + " select read '" + (doc == null ? "null" : doc.getBaseURI()) + "' from " + source));
                }

                selector.setContextItem(doc);

                Iterator<XdmItem> iter = selector.iterator();
                while (iter.hasNext()) {
                    XdmItem item = iter.next();
                    XdmNode node = null;
                    try {
                        node = (XdmNode) item;
                    } catch (ClassCastException cce) {
                        throw new XProcException (context, "Select matched non-node!?");
                    }
                    XdmDestination dest = new XdmDestination();
                    S9apiUtils.writeXdmValue(runtime, node, dest, node.getBaseURI());

                    XdmNode sdoc = dest.getXdmNode();

                    if (reader != null) {
                        logger.trace(MessageFormatter.nodeMessage(reader.getNode(),
                                reader.getName() + " select wrote '" + (sdoc == null ? "null" : sdoc.getBaseURI()) + "' to " + documents));
                    }

                    documents.add(sdoc);
                }
            } catch (SaxonApiException sae) {
                throw new XProcException(sae);
            }
        }
    }
View Full Code Here

TOP

Related Classes of com.xmlcalabash.core.XProcException

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.