Last active
May 3, 2023 07:55
-
-
Save gueff/09a61713a73640a2d547 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @param string $sMarkup | |
* @return string | |
*/ | |
function beautifyXml($sMarkup = '') : string | |
{ | |
$oDOMDocument = new DOMDocument(); | |
$oDOMDocument->preserveWhiteSpace = false; | |
$oDOMDocument->loadXML($sMarkup); | |
$oDOMDocument->formatOutput = true; | |
$sMarkup = $oDOMDocument->saveXml(); | |
return $sMarkup; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment