note 17607 added to ref.domxml
| From: | ricardo dot junior at bowneglobal dot com dot br | Date: | Mon, 17 Dec 2001 02:41:33 +0000 |
| Subject: | note 17607 added to ref.domxml | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-22952@lists.php.net to get a copy of this message | ||
<p>I would like to know if there is any way to auto-indent the XML file when I add a new node
in a docxml object and export the string of the created XML file with dumpmem() function...
</p>
<br>
For example:<br>
$new = new_xmldoc("1.0");
$root = $new->add_root("ROOT");
$level1 = $root->new_child("LEVEL-1", "");
$level1->new_child("LEVEL2", "");
$new_xml_file = fopen ("test.xml", "w");
fwrite($new_xml_file, $new->dumpmem());
fclose ($new_xml_file);
<br>
<p> The result in test.xml file is:<br>
<?xml version="1.0"?>
<ROOT><LEVEL-1><LEVEL2/></LEVEL-1></ROOT>
</p>
<p> But I'm needing it like this: <br>
<?xml version="1.0"?>
<ROOT>
     <LEVEL-1>
          <LEVEL2/>
     </LEVEL-1>
</ROOT>
</p>
Could someone help me on this?!<br>
Thanks. Ricardo Jr.
--
http://www.php.net/manual/en/ref.domxml.php
http://master.php.net/manage/user-notes.php?action=edit+17607
http://master.php.net/manage/user-notes.php?action=delete+17607
http://master.php.net/manage/user-notes.php?action=reject+17607