Checkout the formatOutput setting in DOMDocument.
DOMDocument
$sitemap->formatOutput = true
not just PHP, there is a stylesheet for XML: XSLT, which can format XML into sth looks good.