src/mg/Ding/Bean/Provider/Xml.php
public function getBeanDefinition($beanName)
    {
        $simpleXmlBean = false;
        foreach($this->_simpleXml as $name => $xml) {
            $simpleXmlBean = $xml->xpath("//bean[@id='$beanName']");
            if (empty($simpleXmlBean)) {
                $simpleXmlBean = $xml->xpath("//bean[contains(@name, '$beanName')]");
                if (!empty($simpleXmlBean)) {
                    $name = (string)$simpleXmlBean[0]->attributes()->id;
                    return $this->getBeanDefinition($name);
                }
                $simpleXmlBean = $xml->xpath("//alias[@alias='$beanName']");
                if (!empty($simpleXmlBean)) {
                    $name = (string)$simpleXmlBean[0]->attributes()->name;
                    return $this->getBeanDefinition($name);
                }
            } else {
                break;
            }
        }
        if (empty($simpleXmlBean)) {
            return null;
        }
        // asume valid xml (only one bean with that id)
        $simpleXmlBean = $simpleXmlBean[0];
        $bMethods = $bProps = $bAspects = $constructorArgs = array();
        if (isset($simpleXmlBean->attributes()->parent)) {
            $value = (string)$simpleXmlBean->attributes()->parent;
            $bean = $this->container->getBeanDefinition($value);
            $bean = $bean->makeChildBean($beanName);
            $bProps = $bean->getProperties();
            $constructorArgs = $bean->getArguments();
            $bAspects = $bean->getAspects();
            $bMethods = $bean->getMethodInjections();
        } else {
            $bean = clone $this->_templateBeanDef;
        }
        $bean->setName($beanName);
        if (isset($simpleXmlBean->attributes()->class)) {
            $bean->setClass((string)$simpleXmlBean->attributes()->class);
        }
        if (isset($simpleXmlBean->attributes()->scope)) {
            $bScope = (string)$simpleXmlBean->attributes()->scope;
            if ($bScope == 'prototype') {
                $bean->setScope(BeanDefinition::BEAN_PROTOTYPE);
            } else if ($bScope == 'singleton') {
                $bean->setScope(BeanDefinition::BEAN_SINGLETON);
            } else {
                throw new BeanFactoryException('Invalid bean scope: ' . $bScope);
            }
        }
        if (isset($simpleXmlBean->attributes()->{'factory-method'})) {
            $bean->setFactoryMethod(
                (string)$simpleXmlBean->attributes()->{'factory-method'}
            );
        }

        if (isset($simpleXmlBean->attributes()->name)) {
            $aliases = (string)$simpleXmlBean->attributes()->name;
            $aliases = explode(',', $aliases);
            foreach ($aliases as $alias) {
                $bean->addAlias(trim($alias));
            }
        }
        if (isset($simpleXmlBean->attributes()->primary)) {
            $primary = (string)$simpleXmlBean->attributes()->primary;
            if ($primary == 'true') {
                $bean->markAsPrimaryCandidate();
            }
        }
        if (isset($simpleXmlBean->attributes()->{'depends-on'})) {
            $bean->setDependsOn(explode(
            	',',
                (string)$simpleXmlBean->attributes()->{'depends-on'}
            ));
        }
        if (isset($simpleXmlBean->attributes()->abstract)) {
            $value = (string)$simpleXmlBean->attributes()->abstract;
            if ($value == 'true') {
                $bean->makeAbstract();
            }
        }
        if (isset($simpleXmlBean->attributes()->{'factory-bean'})) {
            $bean->setFactoryBean(
                (string)$simpleXmlBean->attributes()->{'factory-bean'}
            );
        }
        if (isset($simpleXmlBean->attributes()->{'init-method'})) {
            $bean->setInitMethod(
                (string)$simpleXmlBean->attributes()->{'init-method'}
            );
        }
        if (isset($simpleXmlBean->attributes()->{'destroy-method'})) {
            $bean->setDestroyMethod(
                (string)$simpleXmlBean->attributes()->{'destroy-method'}
            );
        }
        foreach ($simpleXmlBean->property as $property) {
            $bProp = $this->_loadProperty($property);
            $bProps[$bProp->getName()] = $bProp;
        }
        foreach ($simpleXmlBean->aspect as $aspect) {
            $aspectDefinition = $this->_loadAspect($aspect);
            $bAspects[] = $aspectDefinition;
        }
        foreach ($simpleXmlBean->{'constructor-arg'} as $arg) {
            $constructorArgs[] = $this->_loadConstructorArg($arg);
        }
        foreach ($simpleXmlBean->{'lookup-method'} as $method) {
            $atts = $method->attributes();
            $bMethods[] = array((string)$atts->name, (string)$atts->bean);
        }
        if (!empty($bProps)) {
            $bean->setProperties($bProps);
        }
        if (!empty($bAspects)) {
            $bean->setAspects($bAspects);
        }
        if (!empty($constructorArgs)) {
            $bean->setArguments($constructorArgs);
        }
        if (!empty($bMethods)) {
            $bean->setMethodInjections($bMethods);
        }
        return $bean;
    }
public function getBeanDefinition($beanName)
    {
        $simpleXmlBean = false;
        foreach($this->_simpleXml as $name => $xml) {
            $simpleXmlBean = $xml->xpath("//bean[@id='$beanName']");
            if (empty($simpleXmlBean)) {
                $simpleXmlBean = $xml->xpath("//bean[contains(@name, '$beanName')]");
                if (!empty($simpleXmlBean)) {
                    $name = (string)$simpleXmlBean[0]->attributes()->id;
                    return $this->getBeanDefinition($name);
                }
                $simpleXmlBean = $xml->xpath("//alias[@alias='$beanName']");
                if (!empty($simpleXmlBean)) {
                    $name = (string)$simpleXmlBean[0]->attributes()->name;
                    return $this->getBeanDefinition($name);
                }
            } else {
                break;
            }
        }
        if (empty($simpleXmlBean)) {
            return null;
        }
        // asume valid xml (only one bean with that id)
        $simpleXmlBean = $simpleXmlBean[0];
        $bMethods = $bProps = $bAspects = $constructorArgs = array();
        if (isset($simpleXmlBean->attributes()->parent)) {
            $value = (string)$simpleXmlBean->attributes()->parent;
            $bean = $this->container->getBeanDefinition($value);
            $bean = $bean->makeChildBean($beanName);
            $bProps = $bean->getProperties();
            $constructorArgs = $bean->getArguments();
            $bAspects = $bean->getAspects();
            $bMethods = $bean->getMethodInjections();
        } else {
            $bean = clone $this->_templateBeanDef;
        }
        $bean->setName($beanName);
        if (isset($simpleXmlBean->attributes()->class)) {
            $bean->setClass((string)$simpleXmlBean->attributes()->class);
        }
        if (isset($simpleXmlBean->attributes()->scope)) {
            $bScope = (string)$simpleXmlBean->attributes()->scope;
            if ($bScope == 'prototype') {
                $bean->setScope(BeanDefinition::BEAN_PROTOTYPE);
            } else if ($bScope == 'singleton') {
                $bean->setScope(BeanDefinition::BEAN_SINGLETON);
            } else {
                throw new BeanFactoryException('Invalid bean scope: ' . $bScope);
            }
        }
        if (isset($simpleXmlBean->attributes()->{'factory-method'})) {
            $bean->setFactoryMethod(
                (string)$simpleXmlBean->attributes()->{'factory-method'}
            );
        }

        if (isset($simpleXmlBean->attributes()->name)) {
            $aliases = (string)$simpleXmlBean->attributes()->name;
            $aliases = explode(',', $aliases);
            foreach ($aliases as $alias) {
                $bean->addAlias(trim($alias));
            }
        }
        if (isset($simpleXmlBean->attributes()->primary)) {
            $primary = (string)$simpleXmlBean->attributes()->primary;
            if ($primary == 'true') {
                $bean->markAsPrimaryCandidate();
            }
        }
        if (isset($simpleXmlBean->attributes()->{'depends-on'})) {
            $bean->setDependsOn(explode(
            	',',
                (string)$simpleXmlBean->attributes()->{'depends-on'}
            ));
        }
        if (isset($simpleXmlBean->attributes()->abstract)) {
            $value = (string)$simpleXmlBean->attributes()->abstract;
            if ($value == 'true') {
                $bean->makeAbstract();
            }
        }
        if (isset($simpleXmlBean->attributes()->{'factory-bean'})) {
            $bean->setFactoryBean(
                (string)$simpleXmlBean->attributes()->{'factory-bean'}
            );
        }
        if (isset($simpleXmlBean->attributes()->{'init-method'})) {
            $bean->setInitMethod(
                (string)$simpleXmlBean->attributes()->{'init-method'}
            );
        }
        if (isset($simpleXmlBean->attributes()->{'destroy-method'})) {
            $bean->setDestroyMethod(
                (string)$simpleXmlBean->attributes()->{'destroy-method'}
            );
        }
        foreach ($simpleXmlBean->property as $property) {
            $bProp = $this->_loadProperty($property);
            $bProps[$bProp->getName()] = $bProp;
        }
        foreach ($simpleXmlBean->aspect as $aspect) {
            $aspectDefinition = $this->_loadAspect($aspect);
            $bAspects[] = $aspectDefinition;
        }
        foreach ($simpleXmlBean->{'constructor-arg'} as $arg) {
            $constructorArgs[] = $this->_loadConstructorArg($arg);
        }
        foreach ($simpleXmlBean->{'lookup-method'} as $method) {
            $atts = $method->attributes();
            $bMethods[] = array((string)$atts->name, (string)$atts->bean);
        }
        if (!empty($bProps)) {
            $bean->setProperties($bProps);
        }
        if (!empty($bAspects)) {
            $bean->setAspects($bAspects);
        }
        if (!empty($constructorArgs)) {
            $bean->setArguments($constructorArgs);
        }
        if (!empty($bMethods)) {
            $bean->setMethodInjections($bMethods);
        }
        return $bean;
    }
(non-PHPdoc)
@see Ding\Aspect.IBeanDefinitionProvider::getBeanDefinition()