I have XML like this:
<?xml version="1.0"?>
<configdata>
<data>
<data_name lang="en">Some name4</data_name>
</data>
</configdata>
For parsing I use Zend_Config_Xml:
$config = new Zend_Config_Xml($dir.$file,'data');
Then I convert data to array:
print_r($config->toArray());
But on result I don’t see value from tag data_name I see only attribute lang.
How to get value from tag? Is it possible or maybe I should parse XML file use DOMXML on PHP.
I tested with your code and indeed, I couldn’t get ‘Some name4’ neither. After some reading on http://framework.zend.com/manual/en/zend.config.adapters.xml.html it seems you can’t mix attributeds and tags that easily. So, if you with to get both the language and the name: I made this XML:
When you want the value ‘Some name4’ only when there is a specific language, you can use this XML:
I think I prefer the first XML because of its generic tags.