Nevermind: I got it, and here it is:
<?php
if($element->hasAttributes())
{
$attributes = $element->attributes;
    if(!is_null($attributes))
    {
        foreach ($attributes as $index=>$attr)
        {
            echo $attr->name."=\"".$attr->value."\"";
        }
    }
}
?>