當前位置: 首頁>>代碼示例>>Java>>正文


Java DomUtils.getChildElementByTagName方法代碼示例

本文整理匯總了Java中org.springframework.util.xml.DomUtils.getChildElementByTagName方法的典型用法代碼示例。如果您正苦於以下問題:Java DomUtils.getChildElementByTagName方法的具體用法?Java DomUtils.getChildElementByTagName怎麽用?Java DomUtils.getChildElementByTagName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.util.xml.DomUtils的用法示例。


在下文中一共展示了DomUtils.getChildElementByTagName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doParse

import org.springframework.util.xml.DomUtils; //導入方法依賴的package包/類
@Override
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
	// first check the attributes
	if (element.hasAttribute(AUTOEXPORT) && !DISABLED.equals(element.getAttribute(AUTOEXPORT).trim())) {
		if (element.hasAttribute(INTERFACE)) {
			parserContext.getReaderContext().error(
					"either 'auto-export' or 'interface' attribute has be specified but not both", element);
		}
		if (DomUtils.getChildElementByTagName(element, INTERFACES) != null) {
			parserContext.getReaderContext().error(
					"either 'auto-export' attribute or <intefaces> sub-element has be specified but not both",
					element);

		}

	}

	builder.addPropertyValue(CACHE_TARGET, true);
	super.doParse(element, parserContext, builder);
}
 
開發者ID:eclipse,項目名稱:gemini.blueprint,代碼行數:21,代碼來源:BlueprintServiceDefinitionParser.java

示例2: parseServerConfig

import org.springframework.util.xml.DomUtils; //導入方法依賴的package包/類
private String parseServerConfig(Element element, ParserContext parserContext) {
Element ipconfigs = DomUtils.getChildElementByTagName(element, AttributeNames.IPCONFIGS);
List<Element> ips = DomUtils.getChildElementsByTagName(ipconfigs, AttributeNames.IPCONFIG);
BeanDefinitionBuilder serverConfigBuilder = BeanDefinitionBuilder.genericBeanDefinition(ServerConfig.class);
serverConfigBuilder.addConstructorArgValue(element.getAttribute(AttributeNames.READ_SIZE));
serverConfigBuilder.addConstructorArgValue(element.getAttribute(AttributeNames.WRITE_SIZE));
ManagedList<BeanDefinition> inetSocketAddress = new ManagedList<BeanDefinition>();
for (Element ip : ips) {
    BeanDefinitionBuilder inetBuilder = BeanDefinitionBuilder.genericBeanDefinition(IpConfig.class);
    inetBuilder.addConstructorArgValue(ip.getAttribute(AttributeNames.HOST_NAME));
    inetBuilder.addConstructorArgValue(ip.getAttribute(AttributeNames.PORT));
    inetSocketAddress.add(inetBuilder.getBeanDefinition());
}
serverConfigBuilder.addConstructorArgValue(inetSocketAddress);
String serverConfig = StringUtils.uncapitalize(ServerConfig.class.getSimpleName());
parserContext.getRegistry().registerBeanDefinition(serverConfig, serverConfigBuilder.getBeanDefinition());
return serverConfig;
   }
 
開發者ID:ilivoo,項目名稱:game,代碼行數:19,代碼來源:NioServerBeanDefinitionParser.java

示例3: parseMessageParse

import org.springframework.util.xml.DomUtils; //導入方法依賴的package包/類
private String parseMessageParse(Element element, ParserContext parserContext) {
Element parse = DomUtils.getChildElementByTagName(element, AttributeNames.PARSE);
String basePackage = parse.getAttribute(AttributeNames.BASE_PACKAGE);
String ref = parse.getAttribute(AttributeNames.REF);
if (!StringUtils.hasLength(ref)) {
    BeanDefinitionBuilder serverConfigBuilder = BeanDefinitionBuilder
	    .genericBeanDefinition(SerializerHelper.class);
    serverConfigBuilder.addConstructorArgValue(basePackage);
    String serializerHelper = StringUtils.uncapitalize(SerializerHelper.class.getSimpleName());
    parserContext.getRegistry().registerBeanDefinition(serializerHelper,
	    serverConfigBuilder.getBeanDefinition());
    return serializerHelper;
}
return ref;

   }
 
開發者ID:ilivoo,項目名稱:game,代碼行數:17,代碼來源:NioServerBeanDefinitionParser.java

示例4: parseDebug

import org.springframework.util.xml.DomUtils; //導入方法依賴的package包/類
private void parseDebug(Element element, ParserContext parserContext) {
Element debug = DomUtils.getChildElementByTagName(element, AttributeNames.DEBUG);
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(DebugConfig.class);
boolean all = Boolean.valueOf(debug.getAttribute(AttributeNames.IGNORE_ALL));
boolean convert = Boolean.valueOf(debug.getAttribute(AttributeNames.IGNORE_CONVERT));
boolean absent = Boolean.valueOf(debug.getAttribute(AttributeNames.IGNORE_ABSENT));
if (all) {
    log.warn("Resource資源注入啟動Ignore_All模式");
} else {
    if (convert) {
	log.warn("Resource資源注入啟動Ignore_convert模式");
    }
    if (absent) {
	log.warn("Resource資源注入啟動Ignore_absent模式");
    }
}
builder.addConstructorArgValue(all);
builder.addConstructorArgValue(convert);
builder.addConstructorArgValue(absent);
parserContext.getRegistry().registerBeanDefinition(StringUtils.uncapitalize(DebugConfig.class.getSimpleName()),
	builder.getBeanDefinition());
   }
 
開發者ID:ilivoo,項目名稱:game,代碼行數:23,代碼來源:ResourceBeanDefinitionParser.java

示例5: getCallableInterceptors

import org.springframework.util.xml.DomUtils; //導入方法依賴的package包/類
private ManagedList<?> getCallableInterceptors(Element element, Object source, ParserContext parserContext) {
	ManagedList<? super Object> interceptors = new ManagedList<Object>();
	Element asyncElement = DomUtils.getChildElementByTagName(element, "async-support");
	if (asyncElement != null) {
		Element interceptorsElement = DomUtils.getChildElementByTagName(asyncElement, "callable-interceptors");
		if (interceptorsElement != null) {
			interceptors.setSource(source);
			for (Element converter : DomUtils.getChildElementsByTagName(interceptorsElement, "bean")) {
				BeanDefinitionHolder beanDef = parserContext.getDelegate().parseBeanDefinitionElement(converter);
				beanDef = parserContext.getDelegate().decorateBeanDefinitionIfRequired(converter, beanDef);
				interceptors.add(beanDef);
			}
		}
	}
	return interceptors;
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:17,代碼來源:AnnotationDrivenBeanDefinitionParser.java

示例6: getDeferredResultInterceptors

import org.springframework.util.xml.DomUtils; //導入方法依賴的package包/類
private ManagedList<?> getDeferredResultInterceptors(Element element, Object source, ParserContext parserContext) {
	ManagedList<? super Object> interceptors = new ManagedList<Object>();
	Element asyncElement = DomUtils.getChildElementByTagName(element, "async-support");
	if (asyncElement != null) {
		Element interceptorsElement = DomUtils.getChildElementByTagName(asyncElement, "deferred-result-interceptors");
		if (interceptorsElement != null) {
			interceptors.setSource(source);
			for (Element converter : DomUtils.getChildElementsByTagName(interceptorsElement, "bean")) {
				BeanDefinitionHolder beanDef = parserContext.getDelegate().parseBeanDefinitionElement(converter);
				beanDef = parserContext.getDelegate().decorateBeanDefinitionIfRequired(converter, beanDef);
				interceptors.add(beanDef);
			}
		}
	}
	return interceptors;
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:17,代碼來源:AnnotationDrivenBeanDefinitionParser.java

示例7: getResult

import org.springframework.util.xml.DomUtils; //導入方法依賴的package包/類
/**
 * Fills result object with test case information.
 * @param test
 * @param testCase
 * @return
 */
private TestResult getResult(Test test, Element testCase) {
    TestResult result = new TestResult();
    result.setTest(test);

    Element failureElement = DomUtils.getChildElementByTagName(testCase, "failure");
    if (failureElement != null) {
        result.setStatus(TestStatus.FAIL);
        result.setErrorMessage(failureElement.getAttribute("message"));
        result.setErrorCause(failureElement.getAttribute("type"));
        result.setStackTrace(DomUtils.getTextValue(failureElement).trim());
    } else {
        result.setStatus(TestStatus.PASS);
    }

    return result;
}
 
開發者ID:christophd,項目名稱:citrus-admin,代碼行數:23,代碼來源:JUnit4TestReportLoader.java

示例8: getResult

import org.springframework.util.xml.DomUtils; //導入方法依賴的package包/類
/**
 * Fills result object with test method information.
 * @param test
 * @param testMethod
 * @return
 */
private TestResult getResult(Test test, Element testMethod) {
    TestResult result = new TestResult();
    result.setTest(test);
    result.setStatus(TestStatus.valueOf(testMethod.getAttribute("status")));

    Element exceptionElement = DomUtils.getChildElementByTagName(testMethod, "exception");
    if (exceptionElement != null) {
        Element messageElement = DomUtils.getChildElementByTagName(exceptionElement, "message");
        if (messageElement != null) {
            result.setErrorMessage(DomUtils.getTextValue(messageElement).trim());
        }

        result.setErrorCause(exceptionElement.getAttribute("class"));

        Element stackTraceElement = DomUtils.getChildElementByTagName(exceptionElement, "full-stacktrace");
        if (stackTraceElement != null) {
            result.setStackTrace(DomUtils.getTextValue(stackTraceElement).trim());
        }
    }

    return result;
}
 
開發者ID:christophd,項目名稱:citrus-admin,代碼行數:29,代碼來源:TestNGTestReportLoader.java

示例9: doParse

import org.springframework.util.xml.DomUtils; //導入方法依賴的package包/類
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
    super.doParse(element, parserContext, builder);

    String space = element.getAttribute(SPACE);
    if (StringUtils.hasLength(space)) {
        builder.addPropertyReference("space", space);
    }

    String compression = element.getAttribute("compression");
    if (StringUtils.hasLength(compression)) {
        builder.addPropertyValue("compression", compression);
    }

    Element localCacheSettingEle = DomUtils.getChildElementByTagName(element, "local-cache-support");
    if (localCacheSettingEle != null) {
        Object template = parserContext.getDelegate().parsePropertySubElement(localCacheSettingEle, builder.getRawBeanDefinition());
        builder.addPropertyValue("localCacheSupport", template);
    }
}
 
開發者ID:Gigaspaces,項目名稱:xap-openspaces,代碼行數:20,代碼來源:MapBeanDefinitionParser.java

示例10: findKey

import org.springframework.util.xml.DomUtils; //導入方法依賴的package包/類
/**
 * Finds the key of a map entry in the custom schema.
 *
 * @param grandchild - The map entry.
 * @return The object (bean or value) entry key
 */
protected Object findKey(Element grandchild, BeanDefinitionBuilder parent, ParserContext parserContext) {
    String key = grandchild.getAttribute("key");
    if (!key.isEmpty()) {
        return key;
    }

    Element keyTag = DomUtils.getChildElementByTagName(grandchild, "key");
    if (keyTag != null) {
        if (DomUtils.getChildElements(keyTag).isEmpty()) {
            return keyTag.getTextContent();
        } else {
            return parseBean(DomUtils.getChildElements(keyTag).get(0), parent, parserContext);
        }
    }

    return null;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:24,代碼來源:CustomSchemaParser.java

示例11: doParse

import org.springframework.util.xml.DomUtils; //導入方法依賴的package包/類
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
    
    super.doParse(element, parserContext, builder);
    
    Element dynamicTemplateEle = DomUtils.getChildElementByTagName(element, DYNAMIC_TEMPLATE);
    if (isSupportsDynamicTemplate() && dynamicTemplateEle != null) {
        builder.addPropertyValue("dynamicTemplate", parserContext.getDelegate().parsePropertyValue(dynamicTemplateEle,
                    builder.getRawBeanDefinition(), "dynamicTemplate"));
    }
    else {

        Element templateEle = DomUtils.getChildElementByTagName(element, TEMPLATE);
        if (templateEle != null) {
            Object template = parserContext.getDelegate().parsePropertyValue(templateEle,
                    builder.getRawBeanDefinition(), "template");
            builder.addPropertyValue("template", template);
        }
        
        Element sqlQueryEle = DomUtils.getChildElementByTagName(element, SQL_QUERY);
        if (sqlQueryEle != null) {
            builder.addPropertyValue("template", parserContext.getDelegate().parsePropertySubElement(sqlQueryEle,
                    builder.getRawBeanDefinition(), null));
        }            
    }
}
 
開發者ID:Gigaspaces,項目名稱:xap-openspaces,代碼行數:26,代碼來源:AbstractTemplateEventContainerBeanDefinitionParser.java

示例12: doParse

import org.springframework.util.xml.DomUtils; //導入方法依賴的package包/類
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {

        super.doParse(element, parserContext, builder);

        Element asyncOperationHandlerEle = DomUtils.getChildElementByTagName(element, ASYNC_OPERATION_HANDLER);
        if (asyncOperationHandlerEle != null) {
            builder.addPropertyValue("asyncOperationHandler",
                    parserContext.getDelegate().parsePropertyValue(asyncOperationHandlerEle, builder.getRawBeanDefinition(), "asyncOperationHandler"));
        }

        String receiveTimeout = element.getAttribute(RECEIVE_TIMEOUT);
        if (StringUtils.hasLength(receiveTimeout)) {
            builder.addPropertyValue("receiveTimeout", receiveTimeout);
        }

        String concurrentConsumers = element.getAttribute(CONCURRENT_CONSUMERS);
        if (StringUtils.hasLength(concurrentConsumers)) {
            builder.addPropertyValue("concurrentConsumers", concurrentConsumers);
        }

        String performSnapshot = element.getAttribute(PERFORM_SNAPSHOT);
        if (StringUtils.hasLength(performSnapshot)) {
            builder.addPropertyValue("performSnapshot", performSnapshot);
        }
    }
 
開發者ID:Gigaspaces,項目名稱:xap-openspaces,代碼行數:26,代碼來源:AsyncPollingContainerBeanDefinitionParser.java

示例13: parseFogsElement

import org.springframework.util.xml.DomUtils; //導入方法依賴的package包/類
private void parseFogsElement(Element fogsElement, BeanDefinitionBuilder factory, ParserContext ctx) {
    if (fogsElement == null) {
        return;
    }
    Element e1 = DomUtils.getChildElementByTagName(fogsElement, "l1");
    Element e2 = DomUtils.getChildElementByTagName(fogsElement, "l2");

    BeanDefinitionBuilder manager = BeanDefinitionBuilder.rootBeanDefinition(TwoLevelFogManager.class);

    if (e2 != null) {
        manager.addPropertyReference("level2", e2.getAttribute("ref"));
    }

    if (e1 != null) {
        manager.addPropertyReference("level1", e1.getAttribute("ref"));

        factory.addPropertyValue("fogManager", manager.getBeanDefinition());
    }
}
 
開發者ID:steven-zhc,項目名稱:hummingbird-framework,代碼行數:20,代碼來源:CloudBeanDefinitionParser.java

示例14: doParse

import org.springframework.util.xml.DomUtils; //導入方法依賴的package包/類
@Override
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
    super.doParse(element, parserContext, builder);
    String space = element.getAttribute(SPACE);
    if (StringUtils.hasLength(space)) {
        builder.addPropertyReference("space", space);
    }
    Element propertiesEle = DomUtils.getChildElementByTagName(element, PROPERTIES);
    if (propertiesEle != null) {
        Object properties = parserContext.getDelegate().parsePropertyValue(propertiesEle,
            builder.getRawBeanDefinition(), "properties");

        builder.addPropertyValue("properties", properties);
    }
    
    String maxDisconnectionDuration = element.getAttribute("max-disconnection-duration");
    if (StringUtils.hasLength(maxDisconnectionDuration))
        builder.addPropertyValue("maxDisconnectionDuration", maxDisconnectionDuration);
    String batchSize = element.getAttribute("batch-size");
    if (StringUtils.hasLength(batchSize))
        builder.addPropertyValue("batchSize", batchSize);
    String batchTimeout = element.getAttribute("batch-timeout");
    if (StringUtils.hasLength(batchTimeout))
        builder.addPropertyValue("batchTimeout", batchTimeout);
}
 
開發者ID:Gigaspaces,項目名稱:xap-openspaces,代碼行數:26,代碼來源:AbstractLocalCacheSpaceBeanDefinitionParser.java

示例15: doParse

import org.springframework.util.xml.DomUtils; //導入方法依賴的package包/類
@Override
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
    super.doParse(element, parserContext, builder);

    Element parametersEle = DomUtils.getChildElementByTagName(element, PARAMETERS);
    if (parametersEle != null) {
        Object parameters = parserContext.getDelegate().parsePropertyValue(parametersEle,
                builder.getRawBeanDefinition(), "parameters");
        builder.addPropertyValue("parameters", parameters);
    }
    Element urlPropertiesEle = DomUtils.getChildElementByTagName(element, URL_PROPERTIES);
    if (urlPropertiesEle != null) {
        Object properties = parserContext.getDelegate().parsePropertyValue(urlPropertiesEle,
                builder.getRawBeanDefinition(), "urlProperties");
        builder.addPropertyValue("urlProperties", properties);
    }

    parseServerComponents(element, parserContext, builder);
}
 
開發者ID:Gigaspaces,項目名稱:xap-openspaces,代碼行數:20,代碼來源:UrlSpaceBeanDefinitionParser.java


注:本文中的org.springframework.util.xml.DomUtils.getChildElementByTagName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。