Until a few minutes ago I thought I understood how Magento xml files (config, layout, system, api, ...) are merged into one big xml that is later used by the application. Apparently I was wrong.
The question came into my mind after trying to find a solution for SOAP v2 catalogProductListOfAdditionalAttributes Uncaught SoapFault exception: Access Denied.
In the solution I found I had to make the Mage_Catalog module depend on one of my custom modules otherwise I would get strange results. Some nodes were not merged. They were overwritten.
I understand that for example these 2 xml sections:
<config>
<some_node some_attribute="attr_value">Some label</some_node>
</config>
and
<config>
<some_other_node some_other_attribute="other_attr_value">Other label label</some_node>
</config>
when merged, become
<config>
<some_node some_attribute="attr_value">Some label</some_node>
<some_other_node some_other_attribute="other_attr_value">Other label label</some_node>
</config>
But what happens if I have these:
<config>
<some_node>
<label>Some label</label>
</some_node>
</config>
and
<config>
<some_node attr="value"></some_node>
</config>
I thought that it will become
<config>
<some_node attr="value">
<label>Some label</label>
</some_node>
</config>
Apparently this does not happen at least for the api.xml files. It may not happen for other types of xmls, but most probably it does because the api.xml files are loaded fia the same method: Mage::getConfig()->loadModulesConfiguration().
After all this talk, here are my questions:
How are the xml files merged? What nodes are overwritten and what nodes are merged?