1

What's the "trick" to save an XML file that visually would result neatly formatted?

such as:

<xml>
   <item>foo</item>
</xml>

and not:

<xml><item>foo</item></xml>
Williham Totland
  • 28,471
  • 6
  • 52
  • 68
cesko80
  • 147
  • 1
  • 1
  • 9

1 Answers1

4

If the proper format of Xml is important for you instead of SimpleXml use the DOM (also included and much more complex) extension that has a property for this:

$xml->formatOutput = true;
Elzo Valugi
  • 27,240
  • 15
  • 95
  • 114