lib/magento/Package.php
protected function _getNode($tag, $parent, $name='')
    {
        $found = false;
        foreach ($parent->xpath($tag) as $_node) {
            if ($_node['name'] == $name) {
                $node = $_node;
                $found = true;
                break;
            }
        }
        if (!$found) {
            $node = $parent->addChild($tag);
            if ($name) {
                $node->addAttribute('name', $name);
            }
        }
        return $node;
    }
protected function _getNode($tag, $parent, $name='')
    {
        $found = false;
        foreach ($parent->xpath($tag) as $_node) {
            if ($_node['name'] == $name) {
                $node = $_node;
                $found = true;
                break;
            }
        }
        if (!$found) {
            $node = $parent->addChild($tag);
            if ($name) {
                $node->addAttribute('name', $name);
            }
        }
        return $node;
    }
protected function _getNode ( $ tag , $ parent , $ name = '' ) { $ found = false ; foreach ( $ parent -> xpath ( $ tag ) as $ _node ) { if ( $ _node [ 'name' ] == $ name ) { $ node = $ _node ; $ found = true ; break ; } } if ( ! $ found ) { $ node = $ parent -> addChild ( $ tag ) ; if ( $ name ) { $ node -> addAttribute ( 'name' , $ name ) ; } } return $ node ; }
Retrieve SimpleXMLElement node by xpath. If it absent, create new.
For comparing nodes method uses attribute "name" in each nodes.
If attribute "name" is same for both nodes, nodes are same.

@param string $tag
@param SimpleXMLElement $parent
@param string $name
@return SimpleXMLElement
Retrieve SimpleXMLElement node by xpath . If it absent create new . For comparing nodes method uses attribute name in each nodes . If attribute name is same for both nodes nodes are same .