'; $doc = new DOMDocument(); $doc->loadXML($xml); $root = $doc->documentElement; foreach ($root->childNodes as $child) { if ($child instanceof DOMElement) { $attributes = $child->attributes; foreach ($attributes as $name => $attr) { echo $name, ' ', $attr->value; } } }