List of usage examples for org.w3c.dom Element getAttribute
public String getAttribute(String name);
From source file:com.dangdang.ddframe.rdb.sharding.spring.namespace.parser.MasterSlaveDataSourceBeanDefinitionParser.java
private String parseMasterDataSourceRef(final Element element) { return element.getAttribute(MasterSlaveDataSourceBeanDefinitionParserTag.MASTER_DATA_SOURCE_REF_ATTRIBUTE); }
From source file:com.griddynamics.banshun.config.xml.ImportBeanDefinitionParser.java
@Override protected String getBeanClassName(Element el) { return el.getAttribute(INTERFACE_ATTR); }
From source file:eu.semaine.util.XMLTool.java
/** * For the given element, return the value of the given attribute if it exists, * or complain with a MessageFormatException if it doesn't exist. * @param e the element whose attribute to return * @param attributeName the name of the attribute to look up. * @return the String value of the attribute if it exists * @throws MessageFormatException if the attribute doesn't exist. *///w w w .j ava2s . c om public static String needAttribute(Element e, String attributeName) throws MessageFormatException { if (!e.hasAttribute(attributeName)) { throw new MessageFormatException("Element '" + e.getTagName() + "' in namespace '" + e.getNamespaceURI() + "' needs an attribute '" + attributeName + "'"); } return e.getAttribute(attributeName); }
From source file:MyCounter.java
public void init(org.apache.xalan.extensions.XSLProcessorContext context, org.w3c.dom.Element elem) { String name = elem.getAttribute("name"); String value = elem.getAttribute("value"); int val; try {// w ww .ja v a2 s . c om val = Integer.parseInt(value); } catch (NumberFormatException e) { e.printStackTrace(); val = 0; } counters.put(name, new Integer(val)); }
From source file:com.bstek.dorado.view.loader.PackagesConfigPatternParser.java
@Override @SuppressWarnings("unchecked") protected Object doParse(Node node, ParseContext context) throws Exception { Element element = (Element) node; String name = element.getAttribute("name"); Assert.notEmpty(name);//from w w w .j a v a 2 s .c o m Pattern pattern = new Pattern(name); Map<String, Object> properties = parseProperties(element, context); ((Map<String, Object>) new BeanMap(pattern)).putAll(properties); return pattern; }
From source file:com.jeffrodriguez.webtools.spring.ns.UrlBeanDefinitionParser.java
private Parameter parseParameter(Element element) { String name = element.getAttribute("name"); String value = element.getAttribute("value"); return new Parameter(name, value); }
From source file:com.github.xdcrafts.flower.spring.impl.xml.PredicateSelectorBeanDefinitionHandler.java
protected void doParse(Element element, BeanDefinitionBuilder bean) { final String required = element.getAttribute("required"); if (required != null && !required.isEmpty()) { bean.addPropertyValue("required", Boolean.valueOf(required)); }//from w ww. j a va2 s . c o m }
From source file:nz.co.senanque.madura.spring.ConfigurationBeanDefinitionParser.java
protected void doParse(Element element, BeanDefinitionBuilder bean) { String source = element.getAttribute("source"); if (StringUtils.hasText(source)) { bean.addPropertyReference("configuration", source); }//from w ww . java 2s . co m bean.setInitMethodName("init"); }
From source file:uk.co.bssd.monitoring.spring.CsvFileLoggerBeanDefinitionParser.java
@Override protected void doParse(Element element, BeanDefinitionBuilder bean) { String id = element.getAttribute("id"); bean.addConstructorArgValue(id);// ww w. j a v a2s . c om String filename = element.getAttribute("filename"); if (!StringUtils.hasText(filename)) { filename = id + ".csv"; } bean.addConstructorArgValue(filename); }
From source file:com.newlandframework.rpc.spring.NettyRpcRegisteryParser.java
public BeanDefinition parse(Element element, ParserContext parserContext) { String id = element.getAttribute("id"); String ipAddr = element.getAttribute("ipAddr"); String protocolType = element.getAttribute("protocol"); RootBeanDefinition beanDefinition = new RootBeanDefinition(); beanDefinition.setBeanClass(NettyRpcRegistery.class); beanDefinition.getPropertyValues().addPropertyValue("ipAddr", ipAddr); beanDefinition.getPropertyValues().addPropertyValue("protocol", protocolType); parserContext.getRegistry().registerBeanDefinition(id, beanDefinition); return beanDefinition; }