generating an object from XMl using Zend_Config_Xml
am 09.12.2009 21:52:21 von reda khyatti--0016e6d99eadf807b1047a51dd28
Content-Type: text/plain; charset=ISO-8859-1
Dear all
I have the following XMl document, that I parse and generate from it an
object using Zend_Config_Xml:
$category = *new* Zend_Config_Xml(*'category.xml'*,*'category'*) ;
print_r($category->toArray());**
the result is:
Array
(
[name] => Categoria
[grupos] => Array
(
[grupo] => Array
(
[0] => Array
(
[name] => Grupo 1
)
[1] => Array
(
[name] => Grupo 2
)
)
)
)
Till here, everything is fine, I do get what I want. But in the case I have
only one group in groups, the result is different.
Array
(
[name] => Categoria
[grupos] => Array
(
[grupo] => Array
(
[name] => Grupo
)
)
)
Indeed, I woul like to generate something like this:
Array
(
[name] => Categoria
[grupos] => Array
(
[grupo] => Array
(
[0] => Array
(
[name] => Grupo 1
)
)
)
)
Does anyone see how can we do that.
Regards
--
khyatti Reda
Tel: +21255880898
--0016e6d99eadf807b1047a51dd28--