Skip to content

Instantly share code, notes, and snippets.

@danstreeter
Created August 7, 2019 15:14
Embed
What would you like to do?
<?php
/* To output XML as a nicely formatted (line breaks and indentations) on screen */
$doc = new \DOMDocument('1.0');
$doc->loadXML($rawXml);
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;
$xml_string = $doc->saveXML();
echo $xml_string;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment