LIBXML- Auto-Indent - How do it?
| From: | Junior, Ricardo | Date: | Mon, 17 Dec 2001 13:48:23 +0000 |
| Subject: | LIBXML- Auto-Indent - How do it? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-77928@lists.php.net to get a copy of this message | ||
Hi All,
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...
For example:
$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);
The result in test.xml file is:
<?xml version="1.0"?>
<ROOT><LEVEL-1><LEVEL2/></LEVEL-1></ROOT>
But I'm needing it like this:
<?xml version="1.0"?>
<ROOT>
<LEVEL-1>
<LEVEL2/>
</LEVEL-1>
</ROOT>
Could someone help me on this?!
Thanks.
_________________________________
Ricardo J. A. Júnior, Software Engineer Trainee
Bowne Global Solutions
Phone +55 21 2515 7713
ricardo.junior@bowneglobal.com.br <mailto:ricardo.junior@bowneglobal.com.br>
www.bowneglobal.com.br <http://www.bowneglobal.com.br/>