本文整理汇总了Java中org.springframework.util.xml.DomUtils.nodeNameEquals方法的典型用法代码示例。如果您正苦于以下问题:Java DomUtils.nodeNameEquals方法的具体用法?Java DomUtils.nodeNameEquals怎么用?Java DomUtils.nodeNameEquals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.util.xml.DomUtils
的用法示例。
在下文中一共展示了DomUtils.nodeNameEquals方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseTopLevelElement
import org.springframework.util.xml.DomUtils; //导入方法依赖的package包/类
/**
* Parses the top elements belonging to the RFC 124 namespace. Namely these are <component>,
* <description> and <type-converters>
*
* @param ele
* @param parserContext
*/
protected void parseTopLevelElement(Element ele, ParserContext parserContext) {
// description
if (DomUtils.nodeNameEquals(ele, DESCRIPTION)) {
// ignore description for now
} else if (DomUtils.nodeNameEquals(ele, BEAN)) {
parseComponentElement(ele, parserContext);
} else if (DomUtils.nodeNameEquals(ele, REFERENCE)) {
parseReferenceElement(ele, parserContext);
} else if (DomUtils.nodeNameEquals(ele, SERVICE)) {
parseServiceElement(ele, parserContext);
} else if (DomUtils.nodeNameEquals(ele, REFERENCE_LIST)) {
parseListElement(ele, parserContext);
} else if (DomUtils.nodeNameEquals(ele, REFERENCE_SET)) {
parseSetElement(ele, parserContext);
} else if (DomUtils.nodeNameEquals(ele, TypeConverterBeanDefinitionParser.TYPE_CONVERTERS)) {
parseConvertersElement(ele, parserContext);
} else {
throw new IllegalArgumentException("Unknown element " + ele);
}
}
示例2: parseConstructorArgElements
import org.springframework.util.xml.DomUtils; //导入方法依赖的package包/类
/**
* Parsers contructor arguments.
*
* @param ele
* @param beanDefinition
* @param parserContext
*/
private void parseConstructorArgElements(Element ele, AbstractBeanDefinition beanDefinition) {
NodeList nl = ele.getChildNodes();
for (int i = 0; i < nl.getLength(); i++) {
Node node = nl.item(i);
if (node instanceof Element && DomUtils.nodeNameEquals(node, CONSTRUCTOR_ARG)) {
parseConstructorArgElement((Element) node, beanDefinition);
}
}
}
示例3: parsePropertyElements
import org.springframework.util.xml.DomUtils; //导入方法依赖的package包/类
/**
* Parses property elements.
*
* @param ele
* @param beanDefinition
* @param parserContext
*/
private void parsePropertyElements(Element ele, AbstractBeanDefinition beanDefinition) {
NodeList nl = ele.getChildNodes();
for (int i = 0; i < nl.getLength(); i++) {
Node node = nl.item(i);
if (node instanceof Element && DomUtils.nodeNameEquals(node, BeanDefinitionParserDelegate.PROPERTY_ELEMENT)) {
parsePropertyElement((Element) node, beanDefinition);
}
}
}
示例4: parseCollectionElements
import org.springframework.util.xml.DomUtils; //导入方法依赖的package包/类
protected void parseCollectionElements(NodeList elementNodes, Collection<Object> target, BeanDefinition bd,
String defaultElementType) {
for (int i = 0; i < elementNodes.getLength(); i++) {
Node node = elementNodes.item(i);
if (node instanceof Element
&& !DomUtils.nodeNameEquals(node, BeanDefinitionParserDelegate.DESCRIPTION_ELEMENT)) {
target.add(parsePropertySubElement((Element) node, bd, defaultElementType));
}
}
}
示例5: accept
import org.springframework.util.xml.DomUtils; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public short accept(Element element) {
if (DomUtils.nodeNameEquals(element, elementName) &&
isEqualByNamespace(element, elementNamespace) &&
isEqualByBeanAttributes(element, attributes)) {
beanDefinitions.add(element);
}
return NodeFilter.FILTER_ACCEPT;
}
示例6: accept
import org.springframework.util.xml.DomUtils; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public short accept(Element element) {
if (DomUtils.nodeNameEquals(element, elementName) &&
isEqualByNamespace(element, elementNamespace) &&
(isEqualById(element, id) || isEqualByBeanName(element, id))) {
beanDefinition = element;
}
return NodeFilter.FILTER_ACCEPT;
}
示例7: accept
import org.springframework.util.xml.DomUtils; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public short accept(Element element) {
if (DomUtils.nodeNameEquals(element, "beans")) {
element.appendChild(element.getOwnerDocument().createTextNode("\n ")); //TODO make indentation configurable
element.appendChild(element.getOwnerDocument().importNode(beanDefinition, true));
}
return NodeFilter.FILTER_ACCEPT;
}
示例8: startElement
import org.springframework.util.xml.DomUtils; //导入方法依赖的package包/类
@Override
public short startElement(Element element) {
if (DomUtils.nodeNameEquals(element, "import")) {
String resourceLocation = element.getAttribute("resource");
if (StringUtils.hasText(resourceLocation)) {
if (resourceLocation.startsWith("classpath:")) {
resourceLocation = resourceLocation.substring("classpath:".length());
} else if (resourceLocation.startsWith("file:")) {
resourceLocation = resourceLocation.substring("file:".length());
}
try {
File importedFile = new FileSystemResource(parentConfigFile.getParentFile().getCanonicalPath() +
File.separator + resourceLocation).getFile();
if (importedFile.exists()) {
importedFiles.add(importedFile);
}
} catch (IOException e) {
log.warn("Unable to resolve imported file resource location", e);
}
}
}
return NodeFilter.FILTER_ACCEPT;
}
示例9: parsePropertySubElement
import org.springframework.util.xml.DomUtils; //导入方法依赖的package包/类
/**
* Parse a value, ref or collection sub-element of a property or constructor-arg element. This method is called from
* several places to handle reusable elements such as idref, ref, null, value and so on.
*
* In fact, this method is the main reason why the BeanDefinitionParserDelegate is not used in full since the
* element namespace becomes important as mixed rfc124/bean content can coexist.
*
* @param ele subelement of property element; we don't know which yet
* @param defaultValueType the default type (class name) for any <code><value></code> tag that might be
* created
*/
private Object parsePropertySubElement(Element ele, BeanDefinition bd, String defaultValueType) {
// skip other namespace
String namespaceUri = ele.getNamespaceURI();
// check Spring own namespace
if (parserContext.getDelegate().isDefaultNamespace(namespaceUri)) {
return parserContext.getDelegate().parsePropertySubElement(ele, bd);
}
// let the delegate handle other ns
else if (!NAMESPACE_URI.equals(namespaceUri)) {
return parserContext.getDelegate().parseCustomElement(ele);
}
//
else {
if (DomUtils.nodeNameEquals(ele, BEAN)) {
BeanDefinitionHolder bdHolder = parseComponentDefinitionElement(ele, bd);
if (bdHolder != null) {
bdHolder = ParsingUtils.decorateBeanDefinitionIfRequired(ele, bdHolder, parserContext);
}
return bdHolder;
}
if (DomUtils.nodeNameEquals(ele, BeanDefinitionParserDelegate.REF_ELEMENT)) {
return parseRefElement(ele);
} else if (DomUtils.nodeNameEquals(ele, BeanDefinitionParserDelegate.IDREF_ELEMENT)) {
return parseIdRefElement(ele);
} else if (DomUtils.nodeNameEquals(ele, BeanDefinitionParserDelegate.VALUE_ELEMENT)) {
return parseValueElement(ele, defaultValueType);
} else if (DomUtils.nodeNameEquals(ele, BeanDefinitionParserDelegate.NULL_ELEMENT)) {
// It's a distinguished null value. Let's wrap it in a TypedStringValue
// object in order to preserve the source location.
TypedStringValue nullHolder = new TypedStringValue(null);
nullHolder.setSource(parserContext.extractSource(ele));
return nullHolder;
} else if (DomUtils.nodeNameEquals(ele, BeanDefinitionParserDelegate.ARRAY_ELEMENT)) {
return parseArrayElement(ele, bd);
} else if (DomUtils.nodeNameEquals(ele, BeanDefinitionParserDelegate.LIST_ELEMENT)) {
return parseListElement(ele, bd);
} else if (DomUtils.nodeNameEquals(ele, BeanDefinitionParserDelegate.SET_ELEMENT)) {
return parseSetElement(ele, bd);
} else if (DomUtils.nodeNameEquals(ele, BeanDefinitionParserDelegate.MAP_ELEMENT)) {
return parseMapElement(ele, bd);
} else if (DomUtils.nodeNameEquals(ele, BeanDefinitionParserDelegate.PROPS_ELEMENT)) {
return parsePropsElement(ele);
}
// maybe it's a nested service/reference/ref-list/ref-set
return parserContext.getDelegate().parseCustomElement(ele, bd);
}
}