public static function clearXml($xml = '', $remEnc = false)
    {
        //$xml = self::clearMsg($xml);
        $aFind = [
            'xmlns:default="http://www.w3.org/2000/09/xmldsig#"',
            ' standalone="no"',
            'default:',
            ':default',
            "\n",
            "\r",
            "\t",
        ];
        if ($remEnc) {
            $aFind[] = '<?xml version="1.0"?>';
            $aFind[] = '<?xml version="1.0" encoding="utf-8"?>';
            $aFind[] = '<?xml version="1.0" encoding="UTF-8"?>';
            $aFind[] = '<?xml version="1.0" encoding="utf-8" standalone="no"?>';
            $aFind[] = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>';
        }
        $retXml = str_replace($aFind, '', $xml);

        return $retXml;
    }
public static function clearXml($xml = '', $remEnc = false)
    {
        //$xml = self::clearMsg($xml);
        $aFind = [
            'xmlns:default="http://www.w3.org/2000/09/xmldsig#"',
            ' standalone="no"',
            'default:',
            ':default',
            "\n",
            "\r",
            "\t",
        ];
        if ($remEnc) {
            $aFind[] = '<?xml version="1.0"?>';
            $aFind[] = '<?xml version="1.0" encoding="utf-8"?>';
            $aFind[] = '<?xml version="1.0" encoding="UTF-8"?>';
            $aFind[] = '<?xml version="1.0" encoding="utf-8" standalone="no"?>';
            $aFind[] = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>';
        }
        $retXml = str_replace($aFind, '', $xml);

        return $retXml;
    }
public static function clearXml ( $ xml = '' , $ remEnc = false ) { //$xml = self::clearMsg($xml); $ aFind = [ 'xmlns:default="http://www.w3.org/2000/09/xmldsig#"' , ' standalone="no"' , 'default:' , ':default' , "\n" , "\r" , "\t" , ] ; if ( $ remEnc ) { $ aFind [ ] = '<?xml version="1.0"?>' ; $ aFind [ ] = '<?xml version="1.0" encoding="utf-8"?>' ; $ aFind [ ] = '<?xml version="1.0" encoding="UTF-8"?>' ; $ aFind [ ] = '<?xml version="1.0" encoding="utf-8" standalone="no"?>' ; $ aFind [ ] = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' ; } $ retXml = str_replace ( $ aFind , '' , $ xml ) ; return $ retXml ; }
clearXml
Remove \r \n \s \t.
@param string $xml
@param bool $remEnc remover encoding do xml
@return string
clearXml Remove \ r \ n \ s \ t .