Added DomUtils.getChildElements() method. Also refactored ConfigBeanDefinitionParser.parse() to use it.
This commit is contained in:
parent
9f9a27a1d8
commit
3f885d0302
|
@ -102,20 +102,17 @@ class ConfigBeanDefinitionParser implements BeanDefinitionParser {
|
|||
|
||||
configureAutoProxyCreator(parserContext, element);
|
||||
|
||||
NodeList childNodes = element.getChildNodes();
|
||||
for (int i = 0; i < childNodes.getLength(); i++) {
|
||||
Node node = childNodes.item(i);
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
String localName = parserContext.getDelegate().getLocalName(node);
|
||||
if (POINTCUT.equals(localName)) {
|
||||
parsePointcut((Element) node, parserContext);
|
||||
}
|
||||
else if (ADVISOR.equals(localName)) {
|
||||
parseAdvisor((Element) node, parserContext);
|
||||
}
|
||||
else if (ASPECT.equals(localName)) {
|
||||
parseAspect((Element) node, parserContext);
|
||||
}
|
||||
List<Element> childElts = DomUtils.getChildElements(element);
|
||||
for (Element elt: childElts) {
|
||||
String localName = parserContext.getDelegate().getLocalName(elt);
|
||||
if (POINTCUT.equals(localName)) {
|
||||
parsePointcut(elt, parserContext);
|
||||
}
|
||||
else if (ADVISOR.equals(localName)) {
|
||||
parseAdvisor(elt, parserContext);
|
||||
}
|
||||
else if (ASPECT.equals(localName)) {
|
||||
parseAspect(elt, parserContext);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,3 +22,4 @@
|
|||
</ivy:makepom>
|
||||
</target>
|
||||
</project>
|
||||
|
|
@ -38,6 +38,7 @@ import org.springframework.util.Assert;
|
|||
* @author Rob Harrop
|
||||
* @author Costin Leau
|
||||
* @author Arjen Poutsma
|
||||
* @author Luke Taylor
|
||||
* @see org.w3c.dom.Node
|
||||
* @see org.w3c.dom.Element
|
||||
* @since 1.2
|
||||
|
@ -117,6 +118,25 @@ public abstract class DomUtils {
|
|||
return (child != null ? getTextValue(child) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all child elements of the given DOM element
|
||||
|
||||
* @param ele the DOM element to analyze
|
||||
* @return a List of child <code>org.w3c.dom.Element</code> instances
|
||||
*/
|
||||
public static List<Element> getChildElements(Element ele) {
|
||||
Assert.notNull(ele, "Element must not be null");
|
||||
NodeList nl = ele.getChildNodes();
|
||||
List<Element> childEles = new ArrayList<Element>();
|
||||
for (int i = 0; i < nl.getLength(); i++) {
|
||||
Node node = nl.item(i);
|
||||
if (node instanceof Element) {
|
||||
childEles.add((Element) node);
|
||||
}
|
||||
}
|
||||
return childEles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the text value from the given DOM element, ignoring XML comments. <p>Appends all CharacterData nodes and
|
||||
* EntityReference nodes into a single String value, excluding Comment nodes.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<classpathentry kind="src" path="src/test/java"/>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
|
||||
<classpathentry kind="lib" path="target/artifacts/org.springframework.oxm-sources.jar"/>
|
||||
<classpathentry kind="lib" path="target/artifacts/org.springframework.oxm.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="target/artifacts/org.springframework.oxm.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/com.thoughtworks.xstream/com.springsource.com.thoughtworks.xstream/1.3.1/com.springsource.com.thoughtworks.xstream-1.3.1.jar" sourcepath="/IVY_CACHE/com.thoughtworks.xstream/com.springsource.com.thoughtworks.xstream/1.3.1/com.springsource.com.thoughtworks.xstream-sources-1.3.1.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/javax.xml.bind/com.springsource.javax.xml.bind/2.1.7/com.springsource.javax.xml.bind-2.1.7.jar" sourcepath="/IVY_CACHE/javax.xml.bind/com.springsource.javax.xml.bind/2.1.7/com.springsource.javax.xml.bind-sources-2.1.7.jar"/>
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.core"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.jdbc"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.orm"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.oxm"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.transaction"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.web"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/com.lowagie.text/com.springsource.com.lowagie.text/2.0.8/com.springsource.com.lowagie.text-2.0.8.jar" sourcepath="/IVY_CACHE/com.lowagie.text/com.springsource.com.lowagie.text/2.0.8/com.springsource.com.lowagie.text-sources-2.0.8.jar"/>
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.beans"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.context"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.core"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.oxm"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/com.caucho/com.springsource.com.caucho/3.2.1/com.springsource.com.caucho-3.2.1.jar" sourcepath="/IVY_CACHE/com.caucho/com.springsource.com.caucho/3.2.1/com.springsource.com.caucho-sources-3.2.1.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/javax.el/com.springsource.javax.el/1.0.0/com.springsource.javax.el-1.0.0.jar" sourcepath="/IVY_CACHE/javax.el/com.springsource.javax.el/1.0.0/com.springsource.javax.el-sources-1.0.0.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/javax.faces/com.springsource.javax.faces/1.2.0.08/com.springsource.javax.faces-1.2.0.08.jar" sourcepath="/IVY_CACHE/javax.faces/com.springsource.javax.faces/1.2.0.08/com.springsource.javax.faces-sources-1.2.0.08.jar"/>
|
||||
|
|
Loading…
Reference in New Issue