private BeanDefinitionRegistry getBeanDefinitionRegistry() {
return beanDefinitionRegistry != null ? beanDefinitionRegistry : getReaderContext().getRegistry();
}
private void transformDocument(Element root) {
DocumentTraversal traversal = (DocumentTraversal) root.getOwnerDocument();
NodeIterator iterator = traversal.createNodeIterator(root, NodeFilter.SHOW_ELEMENT, null, true);
BeanDefinitionRegistry registry = getBeanDefinitionRegistry();
Map<String, Integer> referenceCountMap = new HashMap<String, Integer>();
for (Node n = iterator.nextNode(); n != null; n = iterator.nextNode()) {