Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Debugging SimpleXML Objects

DZone's Guide to

Debugging SimpleXML Objects

·
Free Resource
AGRH@!! SimpleXML bites the big one -- you can't even var_dump it to examine the contents and the controls are terrible. Luckily, you can convert it for debugging:


$sxml = simplexml_load_string($data);
// .. much hate between then and now... //
debugsxml($sxml);


function debugsxml($sxml) {
    $dom = dom_import_simplexml($sxml);
    printArray($dom);
}

function printArray($array){
    echo '
';
    print_r($array);
    echo '
'; }
Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}