How to format the XML document created using php
Filed Under (php, xml) by The Chef on 22-06-2007
Tagged Under : formatted xml, php, xml
When using php DOMdocument to generate xml files, the output is sometimes messy and difficult to read by a human. To tell php to output a nicely formatted xml file use this code:
$dom = new DOMDocument( ’1.0′, ‘iso-8859-1′ );
$dom->formatOutput = true;
…..
…..
That’s all. Now when you are looking at the page source you’ll have a nicely formatted xml.
Enjoy !