本文整理匯總了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);
}
}