for (String name : getSortedBeanNames()) {
Element beanElement = null;
try {
RootBeanDefinition bd = getBeanDefinition(name);
beanElement = new BeanDefinitionReverseEngine(bd, name, factory.getAliases(name)).toDom();
} catch (Exception e) {
beanElement = new Element("bean").setText(getStackTrace(getRootCause(e)));
}
if (beanElement != null) {