printing xml of System > Configuration settings in Magento

Magento uses system.xml(app/code/[codePool]/[namespace]/[module]/etc/) for defining configuration section (System > Configuration) in backend.
It searches for the file(system.xml) in each module’s /etc folder and merge all those during parsing process. Here i am going to share the code for printing the XML as a result of merging system.xml from all active Magento modules.

Code:


<?php
$mageFilename = 'app/Mage.php';
require_once $mageFilename;
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
umask(0);
Mage::app('admin');
header('Content-Type: text/xml');
echo $config = Mage::getConfig()
->loadModulesConfiguration('system.xml')
->getNode()
->asXML();
exit;

Place the above code in separate php file and run it from browser, you will see the xml code responsible for generating System > Configuration setting fields.

Happy XML Parsing!!