Package com.xmlcalabash.model

Examples of com.xmlcalabash.model.RuntimeValue


            Transformer transformer = tfactory.newTransformer(new SAXSource(is));

            transformer.setURIResolver(runtime.getResolver());

            for (QName name : params.keySet()) {
                RuntimeValue v = params.get(name);
                transformer.setParameter(name.getClarkName(), v.getString());
            }

            DOMResult result = new DOMResult();
            is = S9apiUtils.xdmToInputSource(runtime, document);
            transformer.transform(new SAXSource(is), result);
View Full Code Here


                    if (name == null || value == null) {
                        throw new XProcException(step.getNode(), "A cx:option element must have name and value attributes");
                    }

                    RuntimeValue runtimeValue = new RuntimeValue(value);
                    pipeline.passOption(qname, runtimeValue);
                }
            }
        }
View Full Code Here

        if (runtime.getSafeMode()) {
            throw XProcException.dynamicError(21);
        }

        RuntimeValue hrefOpt = getOption(_href);

        XdmNode doc = source.read();

        if (doc == null || source.moreDocuments()) {
            throw XProcException.dynamicError(6);
        }

        String href = null, base = null;
        if (hrefOpt != null) {
            href = hrefOpt.getString();
            base = hrefOpt.getBaseURI().toASCIIString();
        }

        if (method == CompressionMethod.GZIP) {
            logger.trace(MessageFormatter.nodeMessage(hrefOpt == null ? null : hrefOpt.getNode(),
                    "Gzipping" + (href == null ? "" : " to \"" + href + "\".")));
        } else {
            logger.trace(MessageFormatter.nodeMessage(hrefOpt.getNode(), "Storing to \"" + href + "\"."));
        }

        String decode = step.getExtensionAttribute(cx_decode);
        XdmNode root = S9apiUtils.getDocumentElement(doc);
        String contentType = root.getAttributeValue(_content_type);
View Full Code Here

    }

    public void run() throws SaxonApiException {
        super.run();

        RuntimeValue wrapperNameValue = getOption(_wrapper);
        String wrapperNameStr = wrapperNameValue.getString();
        String wpfx = getOption(_wrapper_prefix, (String) null);
        String wns = getOption(_wrapper_namespace, (String) null);

        if (wpfx != null && wns == null) {
            throw XProcException.dynamicError(34, "You can't specify a prefix without a namespace");
        }

        if (wns != null && wrapperNameStr.contains(":")) {
            throw XProcException.dynamicError(34, "You can't specify a namespace if the wrapper name contains a colon");
        }

        QName wrapper = null;
        if (wrapperNameStr.contains(":")) {
            wrapper = new QName(wrapperNameStr, wrapperNameValue.getNode());
        } else {
            wrapper = new QName(wpfx == null ? "" : wpfx, wns, wrapperNameStr);
        }

        while (source.moreDocuments() || alternate.moreDocuments()) {
View Full Code Here

    }

    public void run() throws SaxonApiException {
        super.run();

        RuntimeValue wrapperNameValue = getOption(_wrapper);
        String wrapperNameStr = wrapperNameValue.getString();
        String wpfx = getOption(_wrapper_prefix, (String) null);
        String wns = getOption(_wrapper_namespace, (String) null);

        if (wpfx != null && wns == null) {
            throw XProcException.dynamicError(34, step.getNode(), "You can't specify a prefix without a namespace");
        }

        if (wns != null && wrapperNameStr.contains(":")) {
            throw XProcException.dynamicError(34, step.getNode(), "You can't specify a namespace if the wrapper name contains a colon");
        }

        if (wrapperNameStr.contains(":")) {
            wrapper = new QName(wrapperNameStr, wrapperNameValue.getNode());
        } else {
            wrapper = new QName(wpfx == null ? "" : wpfx, wns, wrapperNameStr);
        }

        groupAdjacent = getOption(_group_adjacent);
View Full Code Here

        }

        context = source.read();

        matcher = new ProcessMatch(runtime, this);
        matcher.match(template.read(), new RuntimeValue("node()", step.getNode()));

        result.write(matcher.getResult());
    }
View Full Code Here

            String phase = getOption(_phase).getString();
            schemaCompiler.setParameter(new QName("","phase"), new XdmAtomicValue(phase));
        }

        for (QName name : params.keySet()) {
            RuntimeValue v = params.get(name);
            schemaCompiler.setParameter(name, new XdmAtomicValue(v.getString()));
        }

        schemaCompiler.setInitialContextNode(theSchema2_sch);
        result = new XdmDestination();
        schemaCompiler.setDestination(result);

        runtime.getConfigurer().getSaxonConfigurer().configSchematron(schemaCompiler.getUnderlyingController().getConfiguration());

        schemaCompiler.transform();

        XdmNode compiledSchema = result.getXdmNode();
        XdmNode compiledRoot = S9apiUtils.getDocumentElement(compiledSchema);
       
        if (compiledRoot == null) {
            XdmNode schemaRoot = S9apiUtils.getDocumentElement(schemaXML);
            String root = schemaRoot == null ? "null" : schemaRoot.getNodeName().toString();
            throw new XProcException("p:validate-with-schematron failed to compile provided schema: " + root);
        }

        XsltTransformer transformer;

        compiler = runtime.getProcessor().newXsltCompiler();
        compiler.setSchemaAware(schemaAware);
        exec = compiler.compile(compiledSchema.asSource());
        transformer = exec.load();
      for (QName name : params.keySet()) {
             RuntimeValue v = params.get(name);
             transformer.setParameter(name, new XdmAtomicValue(v.getString()));
        }       
        transformer.setInitialContextNode(sourceXML);
        result = new XdmDestination();
        transformer.setDestination(result);
        transformer.transform();
View Full Code Here

    public void run() throws SaxonApiException {
        super.run();

        XdmNode doc = source.read();
        RuntimeValue base = getOption(_base_uri);
        if (base != null) {
            setBaseURI = base.getBaseURI().resolve(base.getString());
        }

        logger.trace(MessageFormatter.nodeMessage(doc, "Making URIs absolute against: " + setBaseURI));

        matcher = new ProcessMatch(runtime, this);
View Full Code Here

            if (document != null) {
                xqeval.setContextItem(document);
            }

            for (QName name : params.keySet()) {
                RuntimeValue v = params.get(name);
                if (runtime.getAllowGeneralExpressions()) {
                    xqeval.setExternalVariable(name, v.getValue());
                } else {
                    xqeval.setExternalVariable(name, new XdmAtomicValue(v.getString()));
                }

            }

            Iterator<XdmItem> iter = xqeval.iterator();
View Full Code Here

        // Calculate all the options
        inScopeOptions = parent.getInScopeOptions();
        for (QName name : step.getOptions()) {
            Option option = step.getOption(name);
            RuntimeValue value = null;
            if (optionsPassedIn != null && optionsPassedIn.containsKey(name)) {
                value = optionsPassedIn.get(name);
            } else {
                if (option.getRequired() && option.getSelect() == null) {
                    throw XProcException.staticError(18, option.getNode(), "No value provided for required option \"" + option.getName() + "\"");
                }

                if (option.getSelect() == null) {
                    value = new RuntimeValue();
                } else {
                    value = computeValue(option);
                }
            }

            setOption(name, value);
            inScopeOptions.put(name, value);
        }

        for (Variable var : step.getVariables()) {
            RuntimeValue value = computeValue(var);
            inScopeOptions.put(var.getName(), value);
        }

        for (XStep step : subpipeline) {
            step.run();
View Full Code Here

TOP

Related Classes of com.xmlcalabash.model.RuntimeValue

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.