public static function xml2raw($val)
    {
        if (is_array($val)) {
            foreach ($val as $k => $v) {
                $val[$k] = self::xml2raw($v);
            }
            return $val;
        }

        // More complex text needs to use html2raw instead
        if (strpos($val, '<') !== false) {
            return self::html2raw($val);
        }

        return html_entity_decode($val, ENT_QUOTES, 'UTF-8');
    }