cesko80
cesko80

Reputation: 147

How to save a neatly formatted XML file using Simple XML?

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>

Upvotes: 1

Views: 882

Answers (1)

Elzo Valugi
Elzo Valugi

Reputation: 27876

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;

Upvotes: 4

Related Questions