<?php

$xml = '<?xml version="1.0" encoding="UTF-8"?>
<root>
	<element attr="value"/>
</root>
';

$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;
		}
	}
}
