Skip to content
jrbasso edited this page Oct 3, 2010 · 17 revisions

The Xml class was all refactored. As PHP 5 have SimpleXML and DOMDocument, the CakePHP don't need re-implement methods to XML. The new XML class only will transform an array in SimpleXMLElement or DOMDocument object, and vice versa.

"Ok, very good! But... what I will do with my code???" The instructions below show how migrate your code.

Transforming a XML string in array

Old method:

$xmlString = '<?xml version="1.0"><root><child>value</child></value>';
$xmlObject = new Xml($xmlString);
$xmlArray = $xmlObject->toArray();

New method:

$xmlString = '<?xml version="1.0"><root><child>value</child></value>';
$xmlArray = Xml::toArray(Xml::build($xmlString));

Clone this wiki locally