org\transform\driver\Xml::decode PHP Method

decode() public method

解码XML数据
public decode ( string $str, boolean $assoc = true, array $config = [] ) : string
$str string XML字符串
$assoc boolean 是否转换为数组
$config array 数据配置项
return string 解码后的XML数据
    public function decode($str, $assoc = true, array $config = [])
    {
        //初始化配置
        $config = array_merge($this->config, $config);
        //创建XML对象
        $xml = new \SimpleXMLElement($str);
        if ($assoc) {
            self::xml2data($xml, $data, $config['item_name'], $config['item_key']);
            return $data;
        }
        return $xml;
    }