diff --git a/cake/libs/xml.php b/cake/libs/xml.php
index 980cf2dee..2530c2b93 100644
--- a/cake/libs/xml.php
+++ b/cake/libs/xml.php
@@ -140,8 +140,11 @@ class Xml {
 			self::_toArray($child, $data);
 		}
 
+		$asString = trim((string)$xml);
 		if (empty($data)) {
-			$data = (string)$xml;
+			$data = $asString;
+		} elseif (!empty($asString)) {
+			$data['value'] = $asString;
 		}
 
 		$name = $xml->getName();
diff --git a/cake/tests/cases/libs/xml.test.php b/cake/tests/cases/libs/xml.test.php
index e78105cf4..23b6b604e 100644
--- a/cake/tests/cases/libs/xml.test.php
+++ b/cake/tests/cases/libs/xml.test.php
@@ -291,6 +291,21 @@ class XmlTest extends CakeTestCase {
 		);
 		$this->assertEqual(Xml::toArray(Xml::fromArray($expected)), $expected);
 
+		$xml = '<root>';
+		$xml .= '<tag id="1">defect</tag>';
+		$xml .= '</root>';
+		$obj = Xml::build($xml);
+
+		$expected = array(
+			'root' => array(
+				'tag' => array(
+					'id' => 1,
+					'value' => 'defect'
+				)
+			)
+		);
+		$this->assertEqual(Xml::toArray($obj), $expected);
+
 		$xml = '<root>';
 		$xml .= '<table xmlns="http://www.w3.org/TR/html4/"><tr><td>Apples</td><td>Bananas</td></tr></table>';
 		$xml .= '<table xmlns="http://www.cakephp.org"><name>CakePHP</name><license>MIT</license></table>';