public static function getAttribute(\SimpleXMLElement $xml, $attr, $default = null)
    {
        if (!isset($xml[$attr])) {
            return $default;
        }

        return (string) $xml[$attr];
    }