简体   繁体   中英

php domdocument: when i create an xml, how can i ident each element properly?

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM