Tuesday, May 4, 2010

cakephp xml helper serialize create standard elements wise xml array

We are using the xmlHelper and serialize to output an array as XML. This
works ok, except that the outputed XML uses "attributes" (http://
www.w3schools.com/XML/xml_attributes.asp) instead of standard
elements.

You can change
to change this behaviour of CakePHP XML helper.

$xml->serialize($yourData, array('format' => 'elements'));

or

$xml->serialize($yourData, array('format' => 'tags'));