pQuery\DomNode::setAttributeNS PHP Method

setAttributeNS() public method

Sets namespace of attribute(s)
public setAttributeNS ( string | integer $attr, string $namespace, string $compare = 'name', boolean $case_sensitive = false ) : boolean
$attr string | integer Negative int to count from end
$namespace string
$compare string Find node using "namespace", "name" or "total"
$case_sensitive boolean Compare with case sensitivity
return boolean
    function setAttributeNS($attr, $namespace, $compare = 'name', $case_sensitive = false)
    {
        $f = $this->findAttribute($attr, $compare, $case_sensitive);
        if (is_array($f) && $f) {
            if ($namespace) {
                $namespace .= ':';
            }
            foreach ($f as $a) {
                $val = $this->attributes[$a[2]];
                unset($this->attributes[$a[2]]);
                $this->attributes[$namespace . $a[1]] = $val;
            }
            $this->attributes_ns = null;
            return true;
        } else {
            return false;
        }
    }
DomNode