preserveWhiteSpace = false; $dom->formatOutput = true; // End initial block $dom->loadXML( $xml ); $out = $dom->saveXML(); if ( $replaceHeader ) { // replacing the xml header in a hacky way return substr_replace( $out, "", 0, 22 ); } return $out; } public static function getMMLwrapped( $input ) { $math = new MMLmath(); $mml = $math->encapsulateRaw( $input->renderMML() ); return self::prettifyXML( $mml ); } }