acid_core
12-12-2008, 06:22 AM
Dear all,
I am trying to update an existing XML file with PHP using DOMDocument. My code starts like this:
$doc = new DOMDocument();
$doc->formatOutput = true;
$doc->load("error_log.xml");
$start = $doc->getElementsByTagName("errors")->item(0);
$element = $doc->createElement("error");
$element = $doc->appendChild($element);
My problem is, the new elements I am trying to append are added in a single line although I am using formatOutput=true.!!
Can anyone help me on this? I would really want a good looking XML file with line breaks and indenting... Thank you in advance
I am trying to update an existing XML file with PHP using DOMDocument. My code starts like this:
$doc = new DOMDocument();
$doc->formatOutput = true;
$doc->load("error_log.xml");
$start = $doc->getElementsByTagName("errors")->item(0);
$element = $doc->createElement("error");
$element = $doc->appendChild($element);
My problem is, the new elements I am trying to append are added in a single line although I am using formatOutput=true.!!
Can anyone help me on this? I would really want a good looking XML file with line breaks and indenting... Thank you in advance