Index: tests/Zend/Config/XmlTest.php
===================================================================
--- tests/Zend/Config/XmlTest.php	(Revision 16086)
+++ tests/Zend/Config/XmlTest.php	(Arbeitskopie)
@@ -237,6 +237,28 @@
         $this->assertEquals('live', $config->db->name);
         $this->assertEquals('multi', $config->one->two->three);
     }
+    
+    public function testConstants()
+    {
+        if (!defined('ZEND_CONFIG_XML_TEST_CONSTANT')) {
+            define('ZEND_CONFIG_XML_TEST_CONSTANT', 'test');
+        }
+        
+        $string = <<<EOT
+<?xml version="1.0"?>
+<config xmlns:zf="http://framework.zend.com/zend_config_xml/1.0/">
+    <all>
+        <foo>foo-<zf:const zf:name="ZEND_CONFIG_XML_TEST_CONSTANT"/>-bar-<zf:const zf:name="ZEND_CONFIG_XML_TEST_CONSTANT"/></foo>
+        <bar><const name="ZEND_CONFIG_XML_TEST_CONSTANT"/></bar>
+    </all>
+</config>
+EOT;
+        
+        $config = new Zend_Config_Xml($string, 'all');
+        
+        $this->assertEquals('foo-test-bar-test', $config->foo);
+        $this->assertEquals('ZEND_CONFIG_XML_TEST_CONSTANT', $config->bar->const->name);
+    }
 
     /*
      * @group 3702
Index: library/Zend/Config/Xml.php
===================================================================
--- library/Zend/Config/Xml.php	(Revision 16086)
+++ library/Zend/Config/Xml.php	(Arbeitskopie)
@@ -35,6 +35,11 @@
 class Zend_Config_Xml extends Zend_Config
 {
     /**
+     * XML namespace for ZF-related tags and attributes
+     */
+    const XML_NAMESPACE = 'http://framework.zend.com/zend_config_xml/1.0/';
+    
+    /**
      * Wether to skip extends or not
      *
      * @var boolean
@@ -195,10 +200,56 @@
             }
         }
 
+        // Search for local 'const' nodes and replace them
+        if (count($xmlObject->children(self::XML_NAMESPACE)) > 0) {
+            if (count($xmlObject->children()) > 0) {
+                require_once 'Zend/Config/Exception.php';
+                throw new Zend_Config_Exception("A node with a 'const' childnode may not have any other children");                 
+            }
+            
+            $dom                 = dom_import_simplexml($xmlObject);
+            $namespaceChildNodes = array();
+
+            // We have to store them in an array, as replacing nodes will
+            // confuse the DOMNodeList later
+            foreach ($dom->childNodes as $node) {
+                if ($node instanceof DOMElement && $node->namespaceURI === self::XML_NAMESPACE) {
+                    $namespaceChildNodes[] = $node;
+                }
+            }
+            
+            foreach ($namespaceChildNodes as $node) {
+                switch ($node->localName) {
+                    case 'const':
+                        if (!$node->hasAttributeNS(self::XML_NAMESPACE, 'name')) {
+                            require_once 'Zend/Config/Exception.php';
+                            throw new Zend_Config_Exception("Misssing 'name' attribute in 'const' node");                            
+                        }
+                        
+                        $constantName  = $node->getAttributeNS(self::XML_NAMESPACE, 'name');
+                        $constantValue = constant($constantName);
+                        
+                        if ($constantValue === null) {
+                            require_once 'Zend/Config/Exception.php';
+                            throw new Zend_Config_Exception("Constant with name '$constantName' was not defined");                            
+                        }
+                        
+                        $dom->replaceChild($dom->ownerDocument->createTextNode($constantValue), $node);
+                        break;
+                        
+                    default:
+                        require_once 'Zend/Config/Exception.php';
+                        throw new Zend_Config_Exception("Unknown node with name '$node->localName' found");  
+                }
+            }
+            
+            return (string) simplexml_import_dom($dom);
+        }
+
         // Search for children
         if (count($xmlObject->children()) > 0) {
             foreach ($xmlObject->children() as $key => $value) {
-                if (count($value->children()) > 0) {
+                if (count($value->children()) > 0 || count($value->children(self::XML_NAMESPACE)) > 0) {
                     $value = $this->_toArray($value);
                 } else if (count($value->attributes()) > 0) {
                     $attributes = $value->attributes();

