By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,830 Members | 2,276 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,830 IT Pros & Developers. It's quick & easy.

Using DOMDocument->SaveXML ... is it possible to have XML more readerfriendly?

P: n/a

When using the Save() and SaveXML() functions I am able to output xml
on a screen or save to file. The only issue is that I would prefer to
have it a bit more readable. For example:


<?xml... ?><root><person><first_name>Monty</first_name><surname>Burns</

This is better:

<?xml... ?>

I have an idea involving lots of str_replace's - e.g.
str_replace("<person>", "\n <person>", $xml) - but thought Id check
to see if maybe an option or setting exists to do this. Obviously my
xml is a bit more complicated that the above so it would help as it is
for an external API so I want it to be easy to read. I had a look in
the PHP Docu and notice that there are options you can set in Save and
SaveXML but didnt seem to be any to do what I was after (or maybe I
just didnt understand them properly). Any help would be much

Feb 10 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.