I parametri dell'ogetto li imposti prima di chiamare qualsiasi metodo.
Sbagliato:
Codice PHP:
$dom = new DomDocument();
$newXmlText = $xml_file->asXML();
$dom->loadXML($newXmlText); // same new xmlText as above
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true; // here is where the magic happens
Corretto:
Codice PHP:
$dom = new DomDocument();
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true; // here is where the magic happens
$newXmlText = $xml_file->asXML();
$dom->loadXML($newXmlText); // same new xmlText as above