Package net.sf.saxon.s9api

Examples of net.sf.saxon.s9api.QName


                    }
                }
            }

            // Now lets see if we got the right results, 'k?
            QName doca = new QName("","doca");
            QName docb = new QName("","docb");

            for (String port : pipeoutputs.keySet()) {
                Vector<XdmNode> pres = results.get(port);
                Vector<XdmNode> pexp = expects.get(port);
View Full Code Here


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

        if (nameStr.contains(":")) {
            newName = new QName(nameStr, nameValue.getNode());
        } else {
            newName = new QName(npfx == null ? "" : npfx, nns, nameStr);
        }

        matcher = new ProcessMatch(runtime, this);
        matcher.match(source.read(), getOption(_match));
View Full Code Here

        return null;
    }
   
    public void addOption(Option option) {
        // FIXME: Is it worth making a hash for this?
        QName optName = option.getName();
        for (Option exoption : options) {
            if (optName.equals(exoption.getName())) {
                error(option.getNode(),"Duplication option name: " + optName,XProcConstants.staticError(4));
            }
        }
        options.add(option);
    }
View Full Code Here

        HashSet<QName> names = new HashSet<QName> ();
        boolean valid = true;
       
        for (Option p : options) {
            valid = valid && p.valid(env);
            QName pName = p.getName();
            if (pName == null) {
                valid = false;
                error("Option without name", XProcConstants.staticError(38));
            } else {
                if (names.contains(pName)) {
View Full Code Here

        HashSet<QName> names = new HashSet<QName> ();
        boolean valid = true;
       
        for (Parameter p : params) {
            valid = valid && p.valid(env);
            QName pName = p.getName();
            if (pName == null) {
                valid = false;
                error("Parameter without name", XProcConstants.staticError(38));
            } else {
                if (names.contains(pName)) {
View Full Code Here

                throw new XProcException(root, "Test must have t:test as root element.");
            }

            if (root.getAttributeValue(_error) != null) {
                String errString = root.getAttributeValue(_error);
                error = new QName(errString, root);
            }

            ignoreWS = true;
            if (root.getAttributeValue(_ignoreWS) != null) {
                String ignore = root.getAttributeValue(_ignoreWS);
View Full Code Here

            if (namestr == null || value == null) {
                throw new IllegalArgumentException("Each option and parameter must specify a name and a value");
            }

            QName name = new QName(namestr, input);

            if (t_option.equals(input.getNodeName())) {
                if (options.containsKey(name)) {
                    throw new IllegalArgumentException("Attempt to redefine option: " + name);
                } else {
View Full Code Here

        PipelineConfiguration pipeconfig = getPipelines().get(id);
        XProcRuntime runtime = pipeconfig.runtime;
        XPipeline xpipeline = pipeconfig.pipeline;

        String name = (String) getRequest().getAttributes().get("option");
        QName qname = qnameFromForm(name, getQuery());

        Vector<XdmItem> nodes = new Vector<XdmItem>();

        try {
            ReadablePipe pipe = null;

            if (isXml(entity.getMediaType())) {
                XdmNode doc = runtime.parse(new InputSource(entity.getStream()));
                pipe = new ReadableDocument(runtime, doc, null, null, null);
            } else {
                pipe = new ReadableData(runtime, XProcConstants.c_data, entity.getStream(), entity.getMediaType().toString());
            }

            while (pipe.moreDocuments()) {
                XdmNode doc = pipe.read();
                nodes.add(doc);
            }
        } catch (Exception e) {
            throw new XProcException(e);
        }

        String message = "Option added: " + qname.toString();

        RuntimeValue value = new RuntimeValue(null, nodes, null, null);
        xpipeline.passOption(qname, value);
        pipeconfig.setGVOption(qname);
View Full Code Here

            portParams.put(name, value);
            plainParams.put(port, portParams);
        }

        private QName makeQName(String name) {
            QName qname;

            if (name == null) {
                qname = new QName("");
            } else if (name.indexOf("{") == 0) {
                qname = fromClarkName(name);
            } else {
                int cpos = name.indexOf(":");
                if (cpos > 0) {
                    String prefix = name.substring(0, cpos);
                    if (!bindings.containsKey(prefix)) {
                        throw new XProcException("Unbound prefix '" + prefix + "' in: '" + name + "'.");
                    }
                    String uri = bindings.get(prefix);
                    qname = new QName(prefix, uri, name.substring(cpos + 1));
                } else {
                    qname = new QName("", name);
                }
            }

            return qname;
        }
View Full Code Here

            stepName = makeQName(plainStepName);

            options.clear();
            for (Entry<String, String> plainOption : plainOptions.entrySet()) {
                QName name = makeQName(plainOption.getKey());
                if (options.containsKey(name)) {
                    throw new XProcException("Duplicate option name: '" + name + "'.");
                }
                options.put(name, plainOption.getValue());
            }

            params.clear();
            for (Entry<String, Map<String, String>> plainParam : plainParams.entrySet()) {
                Map<QName, String> portParams = new HashMap<QName, String>();
                for (Entry<String, String> portParam : plainParam.getValue().entrySet()) {
                    QName name = makeQName(portParam.getKey());
                    if (portParams.containsKey(name)) {
                        throw new XProcException("Duplicate parameter name: '" + name + "'.");
                    }
                    portParams.put(name, portParam.getValue());
                }
View Full Code Here

TOP

Related Classes of net.sf.saxon.s9api.QName

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.