public function asPrettyXML($level = 4)
    {
        // removed duplicate XML start of the document declaration
        $xml = preg_replace('/\<\?xml([^\>\/]*)\>/', '' , $this->asXML());

        $dom = new DOMDocument();
        $dom->preserveWhiteSpace = false;
        $dom->formatOutput = true;
        $dom->loadXML($xml);
        $formatted = $dom->saveXml();

        return $formatted;
    }
public function asPrettyXML($level = 4)
    {
        // removed duplicate XML start of the document declaration
        $xml = preg_replace('/\<\?xml([^\>\/]*)\>/', '' , $this->asXML());

        $dom = new DOMDocument();
        $dom->preserveWhiteSpace = false;
        $dom->formatOutput = true;
        $dom->loadXML($xml);
        $formatted = $dom->saveXml();

        return $formatted;
    }
public function asPrettyXML ( $ level = 4 ) { // removed duplicate XML start of the document declaration $ xml = preg_replace ( '/\<\?xml([^\>\/]*)\>/' , '' , $ this -> asXML ( ) ) ; $ dom = new DOMDocument ( ) ; $ dom -> preserveWhiteSpace = false ; $ dom -> formatOutput = true ; $ dom -> loadXML ( $ xml ) ; $ formatted = $ dom -> saveXml ( ) ; return $ formatted ; }
Returns a properly indented form of the current XML tree

@param string $level The number of spaces to use as indentation.

@return string Beautifully formatted XML code that will make your mom smile. Use your manners!

@deprecated $level is deprecated in 3.2.9, to be removed in 3.3.
Returns a properly indented form of the current XML tree