src/SimpleDOM.php
public function setAttributes(array $attr, $ns = null)
    {
        $dom = dom_import_simplexml($this);
        foreach ($attr as $k => $v) {
            $dom->setAttributeNS($ns, $k, $v);
        }
        return $this;
    }
public function setAttributes(array $attr, $ns = null)
    {
        $dom = dom_import_simplexml($this);
        foreach ($attr as $k => $v) {
            $dom->setAttributeNS($ns, $k, $v);
        }
        return $this;
    }
Set several attributes at once

@param    array $attr Attributes as name => value pairs
@param    string $ns Namespace for the attributes
@return    SimpleDOM            Current node