Search in sources :

Example 61 with Node

use of org.dom4j.Node in project GenericKnimeNodes by genericworkflownodes.

the class GalaxyNodeConfigurationReader method readInPort.

private Port readInPort(Node portnode) throws Exception {
    Port port = new Port();
    port.setOptional(true);
    Node n = DOMHelper.selectSingleNode(portnode, "label");
    String portdescr = n.valueOf("text()");
    port.setDescription(portdescr);
    String extension = DOMHelper.valueOf(portnode, "@format");
    port.addMimeType(extension);
    String portname = DOMHelper.valueOf(portnode, "@name");
    port.setName(portname);
    String optional = DOMHelper.valueOf(portnode, "@optional");
    if (optional.equals("false")) {
        port.setOptional(false);
    }
    return port;
}
Also used : Port(com.genericworkflownodes.knime.port.Port) Node(org.dom4j.Node)

Example 62 with Node

use of org.dom4j.Node in project GenericKnimeNodes by genericworkflownodes.

the class GalaxyNodeConfigurationReader method readParameters.

private void readParameters() throws Exception {
    List<Node> nodes = DOMHelper.selectNodes(doc, "/tool/inputs/param[@type='text']");
    for (Node n : nodes) {
        processParameter(n);
    }
    nodes = DOMHelper.selectNodes(doc, "/tool/inputs/param[@type='float']");
    for (Node n : nodes) {
        processParameter(n);
    }
    nodes = DOMHelper.selectNodes(doc, "/tool/inputs/param[@type='boolean']");
    for (Node n : nodes) {
        processParameter(n);
    }
    nodes = DOMHelper.selectNodes(doc, "/tool/inputs/param[@type='integer']");
    for (Node n : nodes) {
        processParameter(n);
    }
    nodes = DOMHelper.selectNodes(doc, "/tool/inputs/param[@type='select']");
    for (Node n : nodes) {
        processParameter(n);
    }
}
Also used : Node(org.dom4j.Node)

Example 63 with Node

use of org.dom4j.Node in project GenericKnimeNodes by genericworkflownodes.

the class GalaxyNodeConfigurationReader method readPorts.

private void readPorts() throws Exception {
    List<Node> nodes = DOMHelper.selectNodes(doc, "/tool/inputs/param[@type='data']");
    for (Node n : nodes) {
        Port port = readInPort(n);
        inports.add(port);
    }
    nodes = DOMHelper.selectNodes(doc, "/tool/outputs/data");
    for (Node n : nodes) {
        Port port = readOutPort(n);
        outports.add(port);
    }
    config.setInports(inports.toArray(new Port[inports.size()]));
    config.setOutports(outports.toArray(new Port[outports.size()]));
}
Also used : Node(org.dom4j.Node) Port(com.genericworkflownodes.knime.port.Port)

Example 64 with Node

use of org.dom4j.Node in project summer-mis by cn-cerc.

the class AlipayJs method query_timestamp.

// 用于防钓鱼,调用接口query_timestamp来获取时间戳的处理函数 注意:远程解析XML出错,与服务器是否支持SSL等配置有关
public String query_timestamp() throws MalformedURLException, DocumentException, IOException {
    String strUrl = AlipayConfig.ALIPAY_GATEWAY_NEW + "service=query_timestamp&partner=" + this.partner + "&_input_charset" + AlipayConfig.input_charset;
    StringBuffer result = new StringBuffer();
    SAXReader reader = new SAXReader();
    Document doc = reader.read(new URL(strUrl).openStream());
    List<Node> nodeList = doc.selectNodes("//alipay/*");
    for (Node node : nodeList) {
        if (node.getName().equals("is_success") && node.getText().equals("T")) {
            List<Node> nodeList1 = doc.selectNodes("//response/timestamp/*");
            for (Node node1 : nodeList1) {
                result.append(node1.getText());
            }
        }
    }
    return result.toString();
}
Also used : SAXReader(org.dom4j.io.SAXReader) Node(org.dom4j.Node) Document(org.dom4j.Document) URL(java.net.URL)

Example 65 with Node

use of org.dom4j.Node in project GenericKnimeNodes by genericworkflownodes.

the class PluginXMLTemplate method registerNode.

/**
 * Registers the given node (clazz, path) in the plugin.xml file.
 *
 * @param clazz
 * @param path
 */
public void registerNode(String clazz, String path) {
    LOGGER.info("registering Node " + clazz);
    registerPath(path);
    Node node = doc.selectSingleNode("/plugin/extension[@point='org.knime.workbench.repository.nodes']");
    Element elem = (Element) node;
    elem.addElement("node").addAttribute("factory-class", clazz).addAttribute("category-path", path);
}
Also used : Node(org.dom4j.Node) Element(org.dom4j.Element)

Aggregations

Node (org.dom4j.Node)253 Document (org.dom4j.Document)83 Element (org.dom4j.Element)61 ArrayList (java.util.ArrayList)56 List (java.util.List)54 Test (org.junit.Test)40 SAXReader (org.dom4j.io.SAXReader)28 File (java.io.File)25 Iterator (java.util.Iterator)18 ReturnedDocument (org.collectionspace.chain.csp.persistence.services.connection.ReturnedDocument)18 IPentahoResultSet (org.pentaho.commons.connection.IPentahoResultSet)18 HashMap (java.util.HashMap)16 URL (java.net.URL)15 ReturnedMultipartDocument (org.collectionspace.chain.csp.persistence.services.connection.ReturnedMultipartDocument)15 InputStream (java.io.InputStream)14 Attribute (org.dom4j.Attribute)14 Image (java.awt.Image)12 ConnectionException (org.collectionspace.chain.csp.persistence.services.connection.ConnectionException)11 VFSItem (org.olat.core.util.vfs.VFSItem)10 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)10