Package org.w3c.dom

Examples of org.w3c.dom.Element


        dialect = "java";
      }
    NodeList subNodeList = xmlNode.getChildNodes();
        for (int j = 0; j < subNodeList.getLength(); j++) {
          if (subNodeList.item(j) instanceof Element) {
            Element subXmlNode = (Element) subNodeList.item(j);
            if ("script".equals(subXmlNode.getNodeName())) {
              String consequence = subXmlNode.getTextContent();
              DroolsConsequenceAction action = new DroolsConsequenceAction(dialect, consequence);
              return action;
            }
          }
      }
View Full Code Here


        NodeList nl = doc.getElementsByTagName("tr");
        for (int i = 0; i < nl.getLength(); i++) {
            if (nl.item(i).getNodeType() != Node.ELEMENT_NODE) {
                continue;
            }
            Element el = (Element) nl.item(i);
            NodeList columnNodeList = el.getElementsByTagName("td");
            JavaOneInterval event = new JavaOneInterval();
            eventList.add(event);
            for (int jj = 0; jj < columnNodeList.getLength(); jj++) {
                if (columnNodeList.item(jj).getNodeType() != Node.ELEMENT_NODE) {
                    continue;
                }
                Element columnElement = (Element) columnNodeList.item(jj);
                switch (jj) {
                    case 0:
                        event.setId(columnElement.getTextContent().trim());
                        break;
                    case 1:
                        event.setDescription(columnElement.getTextContent().trim());
                        break;
                    case 2:
                        event.setType(columnElement.getTextContent().trim());
                        break;
                    case 3:
                        event.setSpeakers(columnElement.getTextContent().trim());
                        break;
                    case 4:
                        NodeList timeNodes = columnElement.getChildNodes();
                        for (int j = 0; j < timeNodes.getLength(); j++) {
                            if (timeNodes.item(j) != null) {
                                String dateStr = timeNodes.item(j).getTextContent().trim();

                                if (dateStr.contains("June")) {
View Full Code Here

     * Step 5.10.11: process as xml elment
     * Add name/value pair to buffer
     */
    private boolean xmlNode(Node node, JSONWebService config,boolean hasData) {
    if(node instanceof Element){
      Element elem = (Element)node;
      if (hasData) {
        this.add(',');
          }
      this.add('{');
            this.add('"');
            this.add(elem.getTagName());
            this.add("\":[");
            NodeList childs = elem.getChildNodes();
            int childLength = childs.getLength();
            for(int c =0; c < childLength; c++){
              hasData = xmlNode(childs.item(c),null, hasData && c != 0);
            }
           
View Full Code Here

                    dsInfo.setEstablishedConnections(((Integer) server.getAttribute(managedConnectionPoolOName, "ConnectionCount")).intValue());
                    dsInfo.setBusyConnections(((Long) server.getAttribute(managedConnectionPoolOName, "InUseConnectionCount")).intValue());


                    ObjectName connectionFactoryOName = new ObjectName("jboss.jca:service=ManagedConnectionFactory,name=" + resource.getName());
                    Element elm = (Element) server.getAttribute(connectionFactoryOName, "ManagedConnectionFactoryProperties");

                    if (elm != null) {
                        NodeList nl = elm.getChildNodes();
                        for (int i = 0; i < nl.getLength(); i++) {
                            Node n = nl.item(i);
                            Node na = n.getAttributes().getNamedItem("name");
                            if (na != null) {
                                if ("ConnectionURL".equals(na.getNodeValue())) {
View Full Code Here

    Select command = (Select)translationUtility.parseCommand("select Name from Account"); //$NON-NLS-1$
    SalesforceConnection sfc = Mockito.mock(SalesforceConnection.class);
    QueryResult qr = new QueryResult();
    SObject so = new SObject();
    so.setType("Account");
    Element elem = Mockito.mock(Element.class);
    Mockito.stub(elem.getLocalName()).toReturn("AccountName");
    so.getAny().add(elem);
    qr.getRecords().add(so);
    qr.setDone(false);
    QueryResult finalQr = new QueryResult();
    so.getAny().add(elem);
View Full Code Here

        SslConfiguration ssl = parseSsl(element);
        if (ssl != null) {
            factoryBuilder.addPropertyValue("sslConfiguration", ssl);
        }

        Element dataConElm = SpringUtil.getChildElement(element,
                FtpServerNamespaceHandler.FTPSERVER_NS, "data-connection");
        DataConnectionConfiguration dc = parseDataConnection(dataConElm, ssl);
        factoryBuilder.addPropertyValue("dataConnectionConfiguration", dc);

        if (StringUtils.hasText(element.getAttribute("idle-timeout"))) {
            factoryBuilder.addPropertyValue("idleTimeout", SpringUtil.parseInt(
                    element, "idle-timeout", 300));
        }

        String localAddress = SpringUtil.parseStringFromInetAddress(element,
                "local-address");
        if (localAddress != null) {
            factoryBuilder.addPropertyValue("serverAddress", localAddress);
        }
        factoryBuilder.addPropertyValue("implicitSsl", SpringUtil.parseBoolean(
                element, "implicit-ssl", false));

        Element blacklistElm = SpringUtil.getChildElement(element,
                FtpServerNamespaceHandler.FTPSERVER_NS, "blacklist");
        if (blacklistElm != null) {
            LOG
                    .warn("Element 'blacklist' is deprecated, and may be removed in a future release. Please use 'remote-ip-filter' instead. ");
            try {
                RemoteIpFilter remoteIpFilter = new RemoteIpFilter(IpFilterType.DENY,
                        blacklistElm.getTextContent());
                factoryBuilder.addPropertyValue("sessionFilter", remoteIpFilter);
            } catch (UnknownHostException e) {
                throw new IllegalArgumentException(
                        "Invalid IP address or subnet in the 'blacklist' element",
                        e);
            }
        }

        Element remoteIpFilterElement = SpringUtil.getChildElement(element,
                FtpServerNamespaceHandler.FTPSERVER_NS, "remote-ip-filter");
        if (remoteIpFilterElement != null) {
            if (blacklistElm != null) {
                throw new FtpServerConfigurationException(
                        "Element 'remote-ip-filter' may not be used when 'blacklist' element is specified. ");
            }
            String filterType = remoteIpFilterElement.getAttribute("type");
            try {
                RemoteIpFilter remoteIpFilter = new RemoteIpFilter(IpFilterType
                        .parse(filterType), remoteIpFilterElement
                        .getTextContent());
                factoryBuilder
                        .addPropertyValue("sessionFilter", remoteIpFilter);
            } catch (UnknownHostException e) {
                throw new IllegalArgumentException(
View Full Code Here

        builder.getRawBeanDefinition().setFactoryBeanName(listenerFactoryName);
        builder.getRawBeanDefinition().setFactoryMethodName("createListener");
    }

    private SslConfiguration parseSsl(final Element parent) {
        Element sslElm = SpringUtil.getChildElement(parent,
                FtpServerNamespaceHandler.FTPSERVER_NS, "ssl");

        if (sslElm != null) {
            SslConfigurationFactory ssl = new SslConfigurationFactory();

            Element keyStoreElm = SpringUtil.getChildElement(sslElm,
                    FtpServerNamespaceHandler.FTPSERVER_NS, "keystore");
            if (keyStoreElm != null) {
                ssl.setKeystoreFile(SpringUtil.parseFile(keyStoreElm, "file"));
                ssl.setKeystorePassword(SpringUtil.parseString(keyStoreElm,
                        "password"));

                String type = SpringUtil.parseString(keyStoreElm, "type");
                if (type != null) {
                    ssl.setKeystoreType(type);
                }

                String keyAlias = SpringUtil.parseString(keyStoreElm,
                        "key-alias");
                if (keyAlias != null) {
                    ssl.setKeyAlias(keyAlias);
                }

                String keyPassword = SpringUtil.parseString(keyStoreElm,
                        "key-password");
                if (keyPassword != null) {
                    ssl.setKeyPassword(keyPassword);
                }

                String algorithm = SpringUtil.parseString(keyStoreElm,
                        "algorithm");
                if (algorithm != null) {
                    ssl.setKeystoreAlgorithm(algorithm);
                }
            }

            Element trustStoreElm = SpringUtil.getChildElement(sslElm,
                    FtpServerNamespaceHandler.FTPSERVER_NS, "truststore");
            if (trustStoreElm != null) {
                ssl.setTruststoreFile(SpringUtil.parseFile(trustStoreElm,
                        "file"));
                ssl.setTruststorePassword(SpringUtil.parseString(trustStoreElm,
View Full Code Here

                dc.setSslConfiguration(ssl);
            }

            dc.setIdleTime(SpringUtil.parseInt(element, "idle-timeout", dc.getIdleTime()));

            Element activeElm = SpringUtil.getChildElement(element,
                    FtpServerNamespaceHandler.FTPSERVER_NS, "active");
            if (activeElm != null) {
                dc.setActiveEnabled(SpringUtil.parseBoolean(activeElm, "enabled",
                        true));
                dc.setActiveIpCheck(SpringUtil.parseBoolean(activeElm,
                        "ip-check", false));
                dc.setActiveLocalPort(SpringUtil.parseInt(activeElm,
                        "local-port", 0));
               
                String localAddress = SpringUtil.parseStringFromInetAddress(
                        activeElm, "local-address");
                if (localAddress != null) {
                  dc.setActiveLocalAddress(localAddress);
                }
            }

            Element passiveElm = SpringUtil.getChildElement(element,
                    FtpServerNamespaceHandler.FTPSERVER_NS, "passive");
            if (passiveElm != null) {
                String address = SpringUtil.parseStringFromInetAddress(passiveElm,
                        "address");
                if (address != null) {
View Full Code Here

            }
            if (StringUtils.hasText(element.getAttribute("url"))) {
                factoryBuilder.addPropertyValue("url", element.getAttribute("url"));
            }
        } else {
            Element dsElm = SpringUtil.getChildElement(element,
                    FtpServerNamespaceHandler.FTPSERVER_NS, "data-source");

            // schema ensure we get the right type of element
            Element springElm = SpringUtil.getChildElement(dsElm, null, null);
            Object o;
            if ("bean".equals(springElm.getLocalName())) {
                o = parserContext.getDelegate().parseBeanDefinitionElement(
                        springElm, builder.getBeanDefinition());
            } else {
                // ref
                o = parserContext.getDelegate().parsePropertySubElement(
View Full Code Here

  public void run() throws Exception {
    DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
    Document tml = builder.parse(tmlFile);
    this.tld = builder.newDocument();
   
    Element taglib = createElement("taglib");
    taglib.setAttribute("xmlns", "http://java.sun.com/xml/ns/j2ee");
    taglib.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
    taglib.setAttribute("xsi:schemaLocation", "http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd");
    tld.appendChild(taglib);
   
    appendElement(taglib, "tlibversion", "4.0");
    appendElement(taglib, "jspversion", "2.0");
    appendElement(taglib, "shortname", "WebTML");
   
    NodeList groups = tml.getElementsByTagName("attributeGroup");
    for(int i = 0; i < groups.getLength(); i++) {
      Element group = (Element) groups.item(i);
      String name = childText(group, "name");
      attributeGroups.put(name, group.getElementsByTagName("attribute"));
    }
   
    NodeList tags = tml.getElementsByTagName("tag");
    for(int i = 0; i < tags.getLength(); i++) {
      Element tmlTag = (Element) tags.item(i);
      String name = childText(tmlTag, "name");
      copyTag(name, tmlTag, appendElement(taglib, "tag"));
      Element aliases = (Element) tmlTag.getElementsByTagName("aliases").item(0);
      NodeList aliasNames = aliases.getElementsByTagName("string");
      for(int j = 0; j < aliasNames.getLength(); j++) {
        String aliasName = aliasNames.item(j).getTextContent();
        copyTag(aliasName, tmlTag, appendElement(taglib, "tag"));
      }
    }
View Full Code Here

TOP

Related Classes of org.w3c.dom.Element

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.