Created
January 7, 2020 07:22
-
-
Save magicliang/e911cff65791d7ddf06b782d4c9bf154 to your computer and use it in GitHub Desktop.
spring的DefaultBeanDefinitionDocumentReader解析xml得到资源的解法
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Parse the elements at the root level in the document: | |
* "import", "alias", "bean". | |
* @param root the DOM root element of the document | |
*/ | |
protected void parseBeanDefinitions(Element root, BeanDefinitionParserDelegate delegate) { | |
if (delegate.isDefaultNamespace(root)) { | |
NodeList nl = root.getChildNodes(); | |
for (int i = 0; i < nl.getLength(); i++) { | |
Node node = nl.item(i); | |
if (node instanceof Element) { | |
Element ele = (Element) node; | |
if (delegate.isDefaultNamespace(ele)) { | |
parseDefaultElement(ele, delegate); | |
} | |
else { | |
delegate.parseCustomElement(ele); | |
} | |
} | |
} | |
} | |
else { | |
delegate.parseCustomElement(root); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment