public function trimXmlString($xmlString)
    {
        $xmlString = preg_replace('/[\r\n]+(?![^(]*\))/', '', $xmlString);
        $xmlString = preg_replace('/[\s]{2,}/', ' ', $xmlString);
        $xmlString = str_replace(["\r\n", "\n"], '', $xmlString);

        return trim($xmlString);
    }
public function trimXmlString($xmlString)
    {
        $xmlString = preg_replace('/[\r\n]+(?![^(]*\))/', '', $xmlString);
        $xmlString = preg_replace('/[\s]{2,}/', ' ', $xmlString);
        $xmlString = str_replace(["\r\n", "\n"], '', $xmlString);

        return trim($xmlString);
    }
public function trimXmlString ( $ xmlString ) { $ xmlString = preg_replace ( '/[\r\n]+(?![^(]*\))/' , '' , $ xmlString ) ; $ xmlString = preg_replace ( '/[\s]{2,}/' , ' ' , $ xmlString ) ; $ xmlString = str_replace ( [ "\r\n" , "\n" ] , '' , $ xmlString ) ; return trim ( $ xmlString ) ; }
Removing all spaces and line breaks

@param string $xmlString XML

@return string
Removing all spaces and line breaks