src/XmlUtil.php
public static function addAttribute(\DOMNode $rootNode, $name, $value)
    {
        XmlUtil::checkIfPrefixWasDefined($rootNode, $name);

        $owner = XmlUtil::getOwnerDocument($rootNode);
        $attrNode = $owner->createAttribute($name);
        $attrNode->value = $value;
        $rootNode->setAttributeNode($attrNode);
        return $rootNode;
    }
public static function addAttribute(\DOMNode $rootNode, $name, $value)
    {
        XmlUtil::checkIfPrefixWasDefined($rootNode, $name);

        $owner = XmlUtil::getOwnerDocument($rootNode);
        $attrNode = $owner->createAttribute($name);
        $attrNode->value = $value;
        $rootNode->setAttributeNode($attrNode);
        return $rootNode;
    }
public static function addAttribute ( \ DOMNode $ rootNode , $ name , $ value ) { XmlUtil :: checkIfPrefixWasDefined ( $ rootNode , $ name ) ; $ owner = XmlUtil :: getOwnerDocument ( $ rootNode ) ; $ attrNode = $ owner -> createAttribute ( $ name ) ; $ attrNode -> value = $ value ; $ rootNode -> setAttributeNode ( $ attrNode ) ; return $ rootNode ; }
Add a attribute to specific node

@param \DOMNode $rootNode Node to receive attribute
@param string $name Attribute name string
@param string $value Attribute value string
@return DOMNode
@throws \ByJG\Util\Exception\XmlUtilException
Add a attribute to specific node