org.w3c.dom.Element#hasAttribute ( )源码实例Demo

下面列出了org.w3c.dom.Element#hasAttribute ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: teamengine   文件: CtlEarlReporter.java
private TestInfo getTestinfo( Element logElements ) {
    Element starttestElements = getElementByTagName( logElements, "starttest" );
    Element endtestElements = getElementByTagName( logElements, "endtest" );
    String assertion = parseTextContent( logElements, "assertion" );
    if ( assertion == null ) {
        assertion = "Null";
    }
    String testName = starttestElements.getAttribute( "local-name" );
    int result = Integer.parseInt( endtestElements.getAttribute( "result" ) );
    Element ccElement = getElementByTagName( logElements, "conformanceClass" );
    boolean isCC = ( ccElement != null ) ? true : false;
    boolean isBasic = false;
    if ( ccElement != null && ccElement.hasAttribute( "isBasic" )
         && Boolean.valueOf( ccElement.getAttribute( "isBasic" ) ) ) {
        isBasic = true;
    }
    return new TestInfo( assertion, testName, result, isCC, isBasic );
}
 
源代码2 项目: lemminx   文件: XPathAttributeMatcher.java
public boolean match(Node testNode, Collection<String> wildcardValues) {
	if (testNode.getNodeType() == Node.ELEMENT_NODE) {
		// Node to test is element
		Element element = (Element) testNode;
		if (indexWildcard != -1) {
			// wildcard is defined in the attribute matcher.
			if (element.hasAttribute(attrName)) {
				// element define, attribute, match is OK.
				if (wildcardValues != null) {
					// wildcard values is filled, add the attribute value
					wildcardValues.add(element.getAttribute(attrName));
				}
				// element tested define the attribute, match is OK
				return true;
			}
			return false;
		}
		// No wildcard defined, test if element has attribute attrName and
		// if value is OK.
		String testAttrValue = element.getAttribute(attrName);
		return attrValue.equals(testAttrValue);
	}
	return false;
}
 
private RuntimeBeanReference registerUserDestHandler(Element brokerElem,
		RuntimeBeanReference userRegistry, RuntimeBeanReference inChannel,
		RuntimeBeanReference brokerChannel, ParserContext context, @Nullable Object source) {

	Object userDestResolver = registerUserDestResolver(brokerElem, userRegistry, context, source);

	RootBeanDefinition beanDef = new RootBeanDefinition(UserDestinationMessageHandler.class);
	beanDef.getConstructorArgumentValues().addIndexedArgumentValue(0, inChannel);
	beanDef.getConstructorArgumentValues().addIndexedArgumentValue(1, brokerChannel);
	beanDef.getConstructorArgumentValues().addIndexedArgumentValue(2, userDestResolver);

	Element relayElement = DomUtils.getChildElementByTagName(brokerElem, "stomp-broker-relay");
	if (relayElement != null && relayElement.hasAttribute("user-destination-broadcast")) {
		String destination = relayElement.getAttribute("user-destination-broadcast");
		beanDef.getPropertyValues().add("broadcastDestination", destination);
	}

	String beanName = registerBeanDef(beanDef, context, source);
	return new RuntimeBeanReference(beanName);
}
 
源代码4 项目: tracecompass   文件: XmlDataProviderManager.java
/**
 * Create (if necessary) and get the {@link ITmfTreeXYDataProvider} for the
 * specified trace and viewElement.
 *
 * @param trace
 *            trace for which we are querying a provider
 * @param viewElement
 *            the XML XY view element for which we are querying a provider
 * @return the unique instance of an XY provider for the queried parameters
 */
public synchronized @Nullable ITmfTreeXYDataProvider<@NonNull ITmfTreeDataModel> getXyProvider(ITmfTrace trace, Element viewElement) {
    if (!viewElement.hasAttribute(ID_ATTRIBUTE)) {
        return null;
    }
    String viewId = viewElement.getAttribute(ID_ATTRIBUTE);
    ITmfTreeXYDataProvider<@NonNull ITmfTreeDataModel> provider = fXyProviders.get(trace, viewId);
    if (provider != null) {
        return provider;
    }
    if (Iterables.any(TmfTraceManager.getInstance().getOpenedTraces(),
            opened -> TmfTraceManager.getTraceSetWithExperiment(opened).contains(trace))) {

        DataDrivenXYProviderFactory xyFactory = getXyProviderFactory(viewElement);
        // Create with the trace or experiment first
        if (xyFactory != null) {
            return createXYProvider(trace, viewId, xyFactory);
        }

    }
    return null;
}
 
源代码5 项目: jStyleParser   文件: ElementMatcherSafeCI.java
public boolean matchesClass(Element e, String className)
{
    if (e.hasAttribute(CLASS_ATTR))
    {
        String classNames = getAttribute(e, CLASS_ATTR).toLowerCase();
        String search = className.toLowerCase();
        int len = className.length();
        int lastIndex = 0;
        
        while ((lastIndex = classNames.indexOf(search, lastIndex)) != -1) {
            if ((lastIndex == 0 || Character.isWhitespace(classNames.charAt(lastIndex - 1))) &&
                    (lastIndex + len == classNames.length() || Character.isWhitespace(classNames.charAt(lastIndex + len)))) {
                return true;
            }
            lastIndex += len;
        }
        return false;
    }
    else
        return false;
}
 
源代码6 项目: lams   文件: ConfigBeanDefinitionParser.java
/**
 * Parses the {@code pointcut} or {@code pointcut-ref} attributes of the supplied
 * {@link Element} and add a {@code pointcut} property as appropriate. Generates a
 * {@link org.springframework.beans.factory.config.BeanDefinition} for the pointcut if  necessary
 * and returns its bean name, otherwise returns the bean name of the referred pointcut.
 */
private Object parsePointcutProperty(Element element, ParserContext parserContext) {
	if (element.hasAttribute(POINTCUT) && element.hasAttribute(POINTCUT_REF)) {
		parserContext.getReaderContext().error(
				"Cannot define both 'pointcut' and 'pointcut-ref' on <advisor> tag.",
				element, this.parseState.snapshot());
		return null;
	}
	else if (element.hasAttribute(POINTCUT)) {
		// Create a pointcut for the anonymous pc and register it.
		String expression = element.getAttribute(POINTCUT);
		AbstractBeanDefinition pointcutDefinition = createPointcutDefinition(expression);
		pointcutDefinition.setSource(parserContext.extractSource(element));
		return pointcutDefinition;
	}
	else if (element.hasAttribute(POINTCUT_REF)) {
		String pointcutRef = element.getAttribute(POINTCUT_REF);
		if (!StringUtils.hasText(pointcutRef)) {
			parserContext.getReaderContext().error(
					"'pointcut-ref' attribute contains empty value.", element, this.parseState.snapshot());
			return null;
		}
		return pointcutRef;
	}
	else {
		parserContext.getReaderContext().error(
				"Must define one of 'pointcut' or 'pointcut-ref' on <advisor> tag.",
				element, this.parseState.snapshot());
		return null;
	}
}
 
源代码7 项目: hop   文件: WsdlOpParameter.java
/**
 * Create a new WsdlOpParameter for a complex type.
 *
 * @param e         The schema element which defines the XML type of this attribute.
 * @param wsdlTypes Wsdl types abstraction.
 */
WsdlOpParameter( Element e, WsdlTypes wsdlTypes ) {

  _mode = ParameterMode.UNDEFINED;
  _isArray = isArray( e );
  _isHeader = false;

  if ( e.hasAttribute( WsdlUtils.NAME_ATTR ) && e.hasAttribute( WsdlUtils.ELEMENT_TYPE_ATTR ) ) {
    setName( e.getAttribute( WsdlUtils.NAME_ATTR ), wsdlTypes );
    _xmlType = wsdlTypes.getTypeQName( e.getAttribute( WsdlUtils.ELEMENT_TYPE_ATTR ) );
  } else if ( e.hasAttribute( WsdlUtils.ELEMENT_REF_ATTR ) ) {
    _xmlType = wsdlTypes.getTypeQName( e.getAttribute( WsdlUtils.ELEMENT_REF_ATTR ) );
    _name = new QName( "", _xmlType.getLocalPart() );
  } else if ( e.hasAttribute( WsdlUtils.NAME_ATTR ) ) {
    setName( e.getAttribute( WsdlUtils.NAME_ATTR ), wsdlTypes );
    _xmlType = getElementType( e, wsdlTypes );
  } else {
    throw new RuntimeException( "invalid element: " + e.getNodeName() );
  }

  // check to see if the xml type of this element is an array type
  Element t = wsdlTypes.findNamedType( _xmlType );
  if ( t != null && WsdlUtils.COMPLEX_TYPE_NAME.equals( t.getLocalName() ) ) {
    _itemXmlType = getArrayItemType( t, wsdlTypes );
    _isArray = _itemXmlType != null;
    if ( _itemXmlType != null ) {
      _itemComplexType = wsdlTypes.getNamedComplexTypes().getComplexType( _itemXmlType.getLocalPart() );
    }
  }
}
 
private static void registerCacheAdvisor(Element element, ParserContext parserContext) {
	if (!parserContext.getRegistry().containsBeanDefinition(CacheManagementConfigUtils.JCACHE_ADVISOR_BEAN_NAME)) {
		Object eleSource = parserContext.extractSource(element);

		// Create the CacheOperationSource definition.
		BeanDefinition sourceDef = createJCacheOperationSourceBeanDefinition(element, eleSource);
		String sourceName = parserContext.getReaderContext().registerWithGeneratedName(sourceDef);

		// Create the CacheInterceptor definition.
		RootBeanDefinition interceptorDef =
				new RootBeanDefinition("org.springframework.cache.jcache.interceptor.JCacheInterceptor");
		interceptorDef.setSource(eleSource);
		interceptorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
		interceptorDef.getPropertyValues().add("cacheOperationSource", new RuntimeBeanReference(sourceName));
		parseErrorHandler(element, interceptorDef);
		String interceptorName = parserContext.getReaderContext().registerWithGeneratedName(interceptorDef);

		// Create the CacheAdvisor definition.
		RootBeanDefinition advisorDef = new RootBeanDefinition(
				"org.springframework.cache.jcache.interceptor.BeanFactoryJCacheOperationSourceAdvisor");
		advisorDef.setSource(eleSource);
		advisorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
		advisorDef.getPropertyValues().add("cacheOperationSource", new RuntimeBeanReference(sourceName));
		advisorDef.getPropertyValues().add("adviceBeanName", interceptorName);
		if (element.hasAttribute("order")) {
			advisorDef.getPropertyValues().add("order", element.getAttribute("order"));
		}
		parserContext.getRegistry().registerBeanDefinition(CacheManagementConfigUtils.JCACHE_ADVISOR_BEAN_NAME, advisorDef);

		CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(), eleSource);
		compositeDef.addNestedComponent(new BeanComponentDefinition(sourceDef, sourceName));
		compositeDef.addNestedComponent(new BeanComponentDefinition(interceptorDef, interceptorName));
		compositeDef.addNestedComponent(new BeanComponentDefinition(advisorDef, CacheManagementConfigUtils.JCACHE_ADVISOR_BEAN_NAME));
		parserContext.registerComponent(compositeDef);
	}
}
 
private CacheControl parseCacheControl(Element element) {
	CacheControl cacheControl = CacheControl.empty();
	if ("true".equals(element.getAttribute("no-cache"))) {
		cacheControl = CacheControl.noCache();
	}
	else if ("true".equals(element.getAttribute("no-store"))) {
		cacheControl = CacheControl.noStore();
	}
	else if (element.hasAttribute("max-age")) {
		cacheControl = CacheControl.maxAge(Long.parseLong(element.getAttribute("max-age")), TimeUnit.SECONDS);
	}
	if ("true".equals(element.getAttribute("must-revalidate"))) {
		cacheControl = cacheControl.mustRevalidate();
	}
	if ("true".equals(element.getAttribute("no-transform"))) {
		cacheControl = cacheControl.noTransform();
	}
	if ("true".equals(element.getAttribute("cache-public"))) {
		cacheControl = cacheControl.cachePublic();
	}
	if ("true".equals(element.getAttribute("cache-private"))) {
		cacheControl = cacheControl.cachePrivate();
	}
	if ("true".equals(element.getAttribute("proxy-revalidate"))) {
		cacheControl = cacheControl.proxyRevalidate();
	}
	if (element.hasAttribute("s-maxage")) {
		cacheControl = cacheControl.sMaxAge(Long.parseLong(element.getAttribute("s-maxage")), TimeUnit.SECONDS);
	}
	return cacheControl;
}
 
private void readImport(Element importElement) throws InvalidAttributesException {
    //plugin-id attribute
    if(!importElement.hasAttribute(PLUGIN_ID_ATTR)) {
        throw new InvalidAttributesException("Plugin.requires.import 'plugin-id' attribute is not set.");
    }
    plugin.addPrerequisites(importElement.getAttribute(PLUGIN_ID_ATTR), importElement.getAttribute(PLUGIN_VERSION_ATTR), importElement.getAttribute(MATCH_ATTR));
}
 
源代码11 项目: ignite   文件: PojoField.java
/**
 * Creates instance of {@link PojoField} based on it's description in XML element.
 *
 * @param el XML element describing Pojo field
 * @param pojoCls Pojo java class.
 */
public PojoField(Element el, Class<?> pojoCls) {
    if (el == null)
        throw new IllegalArgumentException("DOM element representing POJO field object can't be null");

    if (!el.hasAttribute(NAME_ATTR)) {
        throw new IllegalArgumentException("DOM element representing POJO field object should have '"
            + NAME_ATTR + "' attribute");
    }

    this.name = el.getAttribute(NAME_ATTR).trim();
    this.col = el.hasAttribute(COLUMN_ATTR) ? el.getAttribute(COLUMN_ATTR).trim() : name.toLowerCase();

    init(PropertyMappingHelper.getPojoFieldAccessor(pojoCls, name));
}
 
源代码12 项目: mil-sym-android   文件: XMLParser.java
/**
 * Get the attribute from an element.  If not present returns ""
 * @param elem
 * @param attribName
 * @return
 */
public static String getAttribute(Element elem, String attribName)
{
 if(elem != null && elem.hasAttribute(attribName))
  return elem.getAttribute(attribName);
 else
  return "";
}
 
源代码13 项目: ttt   文件: FontSpecification.java
public static List<FontSpecification> fromDocument(Document d, String sourceBase) {
    List<FontSpecification> specs = new java.util.ArrayList<FontSpecification>();
    for (Element f : Documents.findElementsByName(d, ttpeFontEltName)) {
        String family = null;
        FontStyle style = FontKey.DEFAULT_STYLE;
        FontWeight weight = FontKey.DEFAULT_WEIGHT;
        String language = FontKey.DEFAULT_LANGUAGE;
        String source = null;
        BitSet forcePath = null;
        for (Element p : Documents.findElementsByName(f, ttpeParamEltName)) {
            if (p.hasAttribute("name")) {
                String n = p.getAttribute("name");
                String v = p.getTextContent();
                if (n.equals("family"))
                    family = v.toLowerCase();
                else if (n.equals("style"))
                    style = FontStyle.valueOf(v);
                else if (n.equals("weight"))
                    weight = FontWeight.valueOf(v);
                else if (n.equals("language"))
                    language = v.toLowerCase();
                else if (n.equals("source")) {
                    source = v;
                    if (!source.startsWith(File.separator))
                        source = sourceBase + File.separator + source;
                } else if (n.equals("forcePath"))
                    forcePath = parseIntegerRanges(v);
            }
        }
        if ((family == null) || family.isEmpty())
            continue;
        if ((source == null) || source.isEmpty())
            continue;
        specs.add(new FontSpecification(family, style, weight, language, source, forcePath));
    }
    return specs;
}
 
@Override
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
	List<Element> childElements = DomUtils.getChildElementsByTagName(element, "script");
	if (!childElements.isEmpty()) {
		List<String> locations = new ArrayList<>(childElements.size());
		for (Element childElement : childElements) {
			locations.add(childElement.getAttribute("location"));
		}
		builder.addPropertyValue("scripts", StringUtils.toStringArray(locations));
	}
	builder.addPropertyValue("engineName", element.getAttribute("engine-name"));
	if (element.hasAttribute("render-object")) {
		builder.addPropertyValue("renderObject", element.getAttribute("render-object"));
	}
	if (element.hasAttribute("render-function")) {
		builder.addPropertyValue("renderFunction", element.getAttribute("render-function"));
	}
	if (element.hasAttribute("content-type")) {
		builder.addPropertyValue("contentType", element.getAttribute("content-type"));
	}
	if (element.hasAttribute("charset")) {
		builder.addPropertyValue("charset", Charset.forName(element.getAttribute("charset")));
	}
	if (element.hasAttribute("resource-loader-path")) {
		builder.addPropertyValue("resourceLoaderPath", element.getAttribute("resource-loader-path"));
	}
	if (element.hasAttribute("shared-engine")) {
		builder.addPropertyValue("sharedEngine", element.getAttribute("shared-engine"));
	}
}
 
源代码15 项目: cxf   文件: BusDefinitionParser.java
public Metadata parse(Element element, ParserContext context) {
    String bname = element.hasAttribute("bus") ? element.getAttribute("bus") : "cxf";
    String id = element.hasAttribute("id") ? element.getAttribute("id") : null;
    MutableBeanMetadata cxfBean = getBus(context, bname);
    parseAttributes(element, context, cxfBean);
    parseChildElements(element, context, cxfBean);
    context.getComponentDefinitionRegistry().removeComponentDefinition(bname);
    if (!StringUtils.isEmpty(id)) {
        cxfBean.addProperty("id", createValue(context, id));
    }
    return cxfBean;
}
 
源代码16 项目: metafacture-core   文件: MetamorphTestCase.java
private java.io.Reader getInputData() throws InitializationError {
    final Element input = (Element) config.getElementsByTagName(INPUT_TAG).item(0);

    if (input.hasAttribute(SRC_ATTR)) {
        return getDataFromSource(input.getAttribute(SRC_ATTR));
    }
    return getDataEmbedded(input);
}
 
源代码17 项目: exit_code_java   文件: Plugin.java
@Override
public void run() {
    String path = console.getNavigator().getCurrentDirectory();

    Element dataElement = (Element) console.getNavigator().getDirectory(path);
    Node childNode = dataElement.getFirstChild();
    try {
        while( childNode.getNextSibling()!=null ){
            childNode = childNode.getNextSibling();
            if (childNode.getNodeType() == Node.ELEMENT_NODE) {
                Element childElement = (Element) childNode;
                if(childElement.hasAttribute("name")) {
                    if (childNode.getNodeName().trim().equals("dir")) {
                        Console.printText(termArea, String.format(
                            "%s d%s%s%s",
                            childElement.getAttribute("name"),
                            childElement.getAttribute("ownerp"),
                            childElement.getAttribute("groupp"),
                            childElement.getAttribute("otherp")
                        ));
                    } else {
                        Console.printText(termArea, String.format(
                            "%s -%s%s%s",
                            childElement.getAttribute("name"),
                            childElement.getAttribute("ownerp"),
                            childElement.getAttribute("groupp"),
                            childElement.getAttribute("otherp")
                        ));
                    }
                }
            }
        }
    }
    catch(Exception ex) {
        System.out.println(ex.getMessage());
    }

}
 
private CacheControl parseCacheControl(Element element) {
	CacheControl cacheControl;
	if ("true".equals(element.getAttribute("no-cache"))) {
		cacheControl = CacheControl.noCache();
	}
	else if ("true".equals(element.getAttribute("no-store"))) {
		cacheControl = CacheControl.noStore();
	}
	else if (element.hasAttribute("max-age")) {
		cacheControl = CacheControl.maxAge(Long.parseLong(element.getAttribute("max-age")), TimeUnit.SECONDS);
	}
	else {
		cacheControl = CacheControl.empty();
	}

	if ("true".equals(element.getAttribute("must-revalidate"))) {
		cacheControl = cacheControl.mustRevalidate();
	}
	if ("true".equals(element.getAttribute("no-transform"))) {
		cacheControl = cacheControl.noTransform();
	}
	if ("true".equals(element.getAttribute("cache-public"))) {
		cacheControl = cacheControl.cachePublic();
	}
	if ("true".equals(element.getAttribute("cache-private"))) {
		cacheControl = cacheControl.cachePrivate();
	}
	if ("true".equals(element.getAttribute("proxy-revalidate"))) {
		cacheControl = cacheControl.proxyRevalidate();
	}
	if (element.hasAttribute("s-maxage")) {
		cacheControl = cacheControl.sMaxAge(Long.parseLong(element.getAttribute("s-maxage")), TimeUnit.SECONDS);
	}
	if (element.hasAttribute("stale-while-revalidate")) {
		cacheControl = cacheControl.staleWhileRevalidate(
				Long.parseLong(element.getAttribute("stale-while-revalidate")), TimeUnit.SECONDS);
	}
	if (element.hasAttribute("stale-if-error")) {
		cacheControl = cacheControl.staleIfError(
				Long.parseLong(element.getAttribute("stale-if-error")), TimeUnit.SECONDS);
	}
	return cacheControl;
}
 
/**
 * Creates the RootBeanDefinition for a POJO advice bean. Also causes pointcut
 * parsing to occur so that the pointcut may be associate with the advice bean.
 * This same pointcut is also configured as the pointcut for the enclosing
 * Advisor definition using the supplied MutablePropertyValues.
 */
private AbstractBeanDefinition createAdviceDefinition(
		Element adviceElement, ParserContext parserContext, String aspectName, int order,
		RootBeanDefinition methodDef, RootBeanDefinition aspectFactoryDef,
		List<BeanDefinition> beanDefinitions, List<BeanReference> beanReferences) {

	RootBeanDefinition adviceDefinition = new RootBeanDefinition(getAdviceClass(adviceElement, parserContext));
	adviceDefinition.setSource(parserContext.extractSource(adviceElement));

	adviceDefinition.getPropertyValues().add(ASPECT_NAME_PROPERTY, aspectName);
	adviceDefinition.getPropertyValues().add(DECLARATION_ORDER_PROPERTY, order);

	if (adviceElement.hasAttribute(RETURNING)) {
		adviceDefinition.getPropertyValues().add(
				RETURNING_PROPERTY, adviceElement.getAttribute(RETURNING));
	}
	if (adviceElement.hasAttribute(THROWING)) {
		adviceDefinition.getPropertyValues().add(
				THROWING_PROPERTY, adviceElement.getAttribute(THROWING));
	}
	if (adviceElement.hasAttribute(ARG_NAMES)) {
		adviceDefinition.getPropertyValues().add(
				ARG_NAMES_PROPERTY, adviceElement.getAttribute(ARG_NAMES));
	}

	ConstructorArgumentValues cav = adviceDefinition.getConstructorArgumentValues();
	cav.addIndexedArgumentValue(METHOD_INDEX, methodDef);

	Object pointcut = parsePointcutProperty(adviceElement, parserContext);
	if (pointcut instanceof BeanDefinition) {
		cav.addIndexedArgumentValue(POINTCUT_INDEX, pointcut);
		beanDefinitions.add((BeanDefinition) pointcut);
	}
	else if (pointcut instanceof String) {
		RuntimeBeanReference pointcutRef = new RuntimeBeanReference((String) pointcut);
		cav.addIndexedArgumentValue(POINTCUT_INDEX, pointcutRef);
		beanReferences.add(pointcutRef);
	}

	cav.addIndexedArgumentValue(ASPECT_INSTANCE_FACTORY_INDEX, aspectFactoryDef);

	return adviceDefinition;
}
 
源代码20 项目: blog_demos   文件: BeanDefinitionParserDelegate.java
/**
 * Apply the attributes of the given bean element to the given bean * definition.
 * @param ele bean declaration element
 * @param beanName bean name
 * @param containingBean containing bean definition
 * @return a bean definition initialized according to the bean element attributes
 */
public AbstractBeanDefinition parseBeanDefinitionAttributes(Element ele, String beanName,
		BeanDefinition containingBean, AbstractBeanDefinition bd) {

	if (ele.hasAttribute(SCOPE_ATTRIBUTE)) {
		bd.setScope(ele.getAttribute(SCOPE_ATTRIBUTE));
	}
	else if (containingBean != null) {
		// Take default from containing bean in case of an inner bean definition.
		bd.setScope(containingBean.getScope());
	}

	if (ele.hasAttribute(ABSTRACT_ATTRIBUTE)) {
		bd.setAbstract(TRUE_VALUE.equals(ele.getAttribute(ABSTRACT_ATTRIBUTE)));
	}

	String lazyInit = ele.getAttribute(LAZY_INIT_ATTRIBUTE);
	if (DEFAULT_VALUE.equals(lazyInit)) {
		lazyInit = this.defaults.getLazyInit();
	}
	bd.setLazyInit(TRUE_VALUE.equals(lazyInit));

	String autowire = ele.getAttribute(AUTOWIRE_ATTRIBUTE);
	bd.setAutowireMode(getAutowireMode(autowire));

	String dependencyCheck = ele.getAttribute(DEPENDENCY_CHECK_ATTRIBUTE);
	bd.setDependencyCheck(getDependencyCheck(dependencyCheck));

	if (ele.hasAttribute(DEPENDS_ON_ATTRIBUTE)) {
		String dependsOn = ele.getAttribute(DEPENDS_ON_ATTRIBUTE);
		bd.setDependsOn(StringUtils.tokenizeToStringArray(dependsOn, MULTI_VALUE_ATTRIBUTE_DELIMITERS));
	}

	String autowireCandidate = ele.getAttribute(AUTOWIRE_CANDIDATE_ATTRIBUTE);
	if ("".equals(autowireCandidate) || DEFAULT_VALUE.equals(autowireCandidate)) {
		String candidatePattern = this.defaults.getAutowireCandidates();
		if (candidatePattern != null) {
			String[] patterns = StringUtils.commaDelimitedListToStringArray(candidatePattern);
			bd.setAutowireCandidate(PatternMatchUtils.simpleMatch(patterns, beanName));
		}
	}
	else {
		bd.setAutowireCandidate(TRUE_VALUE.equals(autowireCandidate));
	}

	if (ele.hasAttribute(PRIMARY_ATTRIBUTE)) {
		bd.setPrimary(TRUE_VALUE.equals(ele.getAttribute(PRIMARY_ATTRIBUTE)));
	}

	if (ele.hasAttribute(INIT_METHOD_ATTRIBUTE)) {
		String initMethodName = ele.getAttribute(INIT_METHOD_ATTRIBUTE);
		if (!"".equals(initMethodName)) {
			bd.setInitMethodName(initMethodName);
		}
	}
	else {
		if (this.defaults.getInitMethod() != null) {
			bd.setInitMethodName(this.defaults.getInitMethod());
			bd.setEnforceInitMethod(false);
		}
	}

	if (ele.hasAttribute(DESTROY_METHOD_ATTRIBUTE)) {
		String destroyMethodName = ele.getAttribute(DESTROY_METHOD_ATTRIBUTE);
		if (!"".equals(destroyMethodName)) {
			bd.setDestroyMethodName(destroyMethodName);
		}
	}
	else {
		if (this.defaults.getDestroyMethod() != null) {
			bd.setDestroyMethodName(this.defaults.getDestroyMethod());
			bd.setEnforceDestroyMethod(false);
		}
	}

	if (ele.hasAttribute(FACTORY_METHOD_ATTRIBUTE)) {
		bd.setFactoryMethodName(ele.getAttribute(FACTORY_METHOD_ATTRIBUTE));
	}
	if (ele.hasAttribute(FACTORY_BEAN_ATTRIBUTE)) {
		bd.setFactoryBeanName(ele.getAttribute(FACTORY_BEAN_ATTRIBUTE));
	}

	return bd;
}