views:

27

answers:

1

Hiya. When i create an XML using php's DomDocument it creates the xml properly but all the elements are in one line, the xml file itself is not so readable.

I searched in google and find that the attribute formatOutput in DomDocument should resolve the issue, i use php 5.3 and i do not have this properly in DomDocument.

any ideas?

+3  A: 

Like this..

$doc = new DOMDocument('1.0');
$doc->formatOutput = true;

I see you said that you're using 5.3 and this isn't working but nothing in the Docs implies that this has been deprecated though

seengee
oh.. code completion didn't provide this parameter so i thought it wasn't available. thanks
ufk
ah i see - no worries :)
seengee
you might have to set `preserveWhiteSpace` to `false` though as well
Gordon