public function addAttribute($name, $value)
    {
        $nameUtf8 = $this->_toUTF8($name);
        $valueUtf8 = htmlspecialchars($this->_toUTF8($value), ENT_COMPAT, "UTF-8");
        if (($valueUtf8 === "") && (version_compare("5.2.2", PHP_VERSION, ">"))) {
            $this->_SimpleXmlElement->addAttribute($nameUtf8, "\0"); // Fixing bug #41175 (addAttribute() fails to add an attribute with an empty value)
        } else {
            $this->_SimpleXmlElement->addAttribute($nameUtf8, $valueUtf8);
        }
    }
public function addAttribute($name, $value)
    {
        $nameUtf8 = $this->_toUTF8($name);
        $valueUtf8 = htmlspecialchars($this->_toUTF8($value), ENT_COMPAT, "UTF-8");
        if (($valueUtf8 === "") && (version_compare("5.2.2", PHP_VERSION, ">"))) {
            $this->_SimpleXmlElement->addAttribute($nameUtf8, "\0"); // Fixing bug #41175 (addAttribute() fails to add an attribute with an empty value)
        } else {
            $this->_SimpleXmlElement->addAttribute($nameUtf8, $valueUtf8);
        }
    }
public function addAttribute ( $ name , $ value ) { $ nameUtf8 = $ this -> _toUTF8 ( $ name ) ; $ valueUtf8 = htmlspecialchars ( $ this -> _toUTF8 ( $ value ) , ENT_COMPAT , "UTF-8" ) ; if ( ( $ valueUtf8 === "" ) && ( version_compare ( "5.2.2" , PHP_VERSION , ">" ) ) ) { $ this -> _SimpleXmlElement -> addAttribute ( $ nameUtf8 , "\0" ) ; // Fixing bug #41175 (addAttribute() fails to add an attribute with an empty value) } else { $ this -> _SimpleXmlElement -> addAttribute ( $ nameUtf8 , $ valueUtf8 ) ; } }
add a attribute to a child and convert name and value to utf8

@param String $name  name of the attribute
@param String $value value of the attribute

@return Void
add a attribute to a child and convert name and value to utf8