Example usage for org.w3c.dom Element getAttribute

List of usage examples for org.w3c.dom Element getAttribute

Introduction

In this page you can find the example usage for org.w3c.dom Element getAttribute.

Prototype

public String getAttribute(String name);

Source Link

Document

Retrieves an attribute value by name.

Usage

From source file:com.github.xdcrafts.flower.spring.impl.xml.KeywordSelectorBeanDefinitionHandler.java

protected void doParse(Element element, BeanDefinitionBuilder bean) {
    final String keyword = element.getAttribute("keyword");
    bean.addPropertyValue("keyword", keyword);
    final String required = element.getAttribute("required");
    if (required != null && !required.isEmpty()) {
        bean.addPropertyValue("required", Boolean.valueOf(required));
    }/*w w w  .  j  a va  2  s  . co  m*/
}

From source file:org.atomserver.spring.WorkspaceBeanDefinitionParser.java

protected void doParse(Element element, BeanDefinitionBuilder bean) {
    bean.addPropertyValue("name", element.getAttribute("name"));
    bean.addPropertyValue("defaultLocalized", Boolean.valueOf(element.getAttribute("localized")));
}

From source file:com.minderupt.integration.pushmsg.config.APNSPushMessageOutboundChannelAdapterParserTest.java

@Test
public void testGetBeanDefinitionFromElementWithApnsHostPortCertificatePathBasicTest() throws Exception {

    Element element = mock(Element.class);
    when(element.getAttribute(ParserConstants.ATTRIBUTE_NAME_APNS_HOST)).thenReturn("apns.test.host.com");
    when(element.getAttribute(ParserConstants.ATTRIBUTE_NAME_APNS_PORT)).thenReturn("9160");
    when(element.getAttribute(ParserConstants.ATTRIBUTE_NAME_CERTIFICATE_PATH))
            .thenReturn("/path/to/certificate");

    ParserContext parserContext = new ParserContext(mock(XmlReaderContext.class),
            mock(BeanDefinitionParserDelegate.class));

    BeanDefinition beanDefinition = parseConsumer(element, parserContext);
    assertNotNull(beanDefinition);/* www  . j  a  v  a  2 s  . c  o m*/
    assertEquals("/path/to/certificate",
            beanDefinition.getConstructorArgumentValues().getArgumentValue(0, String.class).getValue());
    assertEquals("apns.test.host.com",
            beanDefinition.getConstructorArgumentValues().getArgumentValue(1, String.class).getValue());
    assertEquals(9160,
            beanDefinition.getConstructorArgumentValues().getArgumentValue(2, Integer.class).getValue());

}

From source file:com.springcryptoutils.core.spring.keystore.KeyStoreRegistryBeanDefinitionParser.java

protected void doParse(Element element, BeanDefinitionBuilder bean) {
    bean.addPropertyReference("entries", element.getAttribute("entries-ref"));
}

From source file:uk.co.bssd.monitoring.spring.CpuUsageAdapterBeanDefinitionParser.java

@Override
protected void doParse(Element element, BeanDefinitionBuilder bean) {
    String managementBeanServerName = element.getAttribute("managementBeanServerRef");
    bean.addConstructorArgReference(managementBeanServerName);
}

From source file:com.clican.pluto.fsm.spring.parser.TaskStateParser.java

@Override
public void customiseBeanDefinition(BeanDefinition beanDef, Element element, ParserContext parserContext) {
    String taskName = element.getAttribute("taskName");
    beanDef.getPropertyValues().addPropertyValue("taskName", taskName);
    String taskType = element.getAttribute("taskType");
    beanDef.getPropertyValues().addPropertyValue("taskType", taskType);
    String assignees = element.getAttribute("assignees");
    beanDef.getPropertyValues().addPropertyValue("assignees", assignees);
}

From source file:at.ac.tuwien.dsg.celar.mela.jCatascopiaClient.spring.JCatascopiaPollDataSourceBeanDefinitionParser.java

@Override
protected void doParse(Element element, BeanDefinitionBuilder builder) {
    String url = element.getAttribute("url");
    //        String port = element.getAttribute("port");
    String pollingIntervalMs = element.getAttribute("polling-interval-ms");

    builder.addPropertyValue("url", url);
    //        builder.addPropertyValue("port", Integer.valueOf(port));
    if (StringUtils.hasText(pollingIntervalMs)) {
        builder.addPropertyValue("pollingIntervalMs", Integer.valueOf(pollingIntervalMs));
    }/* w  w w .j a  v  a  2  s  .  co m*/

}

From source file:org.globus.security.authorization.xml.AbstractBeanDefinitionParser.java

protected String getIdOrName(Element elem) {
    String id = elem.getAttribute(BeanDefinitionParserDelegate.ID_ATTRIBUTE);

    if (null == id || "".equals(id)) {
        String names = elem.getAttribute("name");
        if (null != names) {
            StringTokenizer st = new StringTokenizer(names, BeanDefinitionParserDelegate.BEAN_NAME_DELIMITERS);
            if (st.countTokens() > 0) {
                id = st.nextToken();/*from  w  w  w  . j ava2 s  . c o  m*/
            }
        }
    }
    return id;
}

From source file:com.springcryptoutils.core.spring.cipher.symmetric.SymmetricKeyGeneratorBeanDefinitionParser.java

@Override
protected void doParse(Element element, BeanDefinitionBuilder bean) {
    bean.addPropertyValue("algorithm", element.getAttribute("algorithm"));
    bean.addPropertyValue("provider", element.getAttribute("provider"));
}

From source file:com.springcryptoutils.core.spring.key.PublicKeyBeanDefinitionParser.java

protected void doParse(Element element, BeanDefinitionBuilder bean) {
    bean.addPropertyReference("keystore", element.getAttribute("keystore-ref"));
    bean.addPropertyValue("alias", element.getAttribute("alias"));
}