note 102343 added to class.domdocument
| From: | MattD at osu1 dot php dot net | Date: | Wed, 09 Feb 2011 20:58:50 +0000 |
| Subject: | note 102343 added to class.domdocument | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-176820@lists.php.net to get a copy of this message | ||
Just to add to tloach's comment, the formatOutput bug does not save HTML formatting properly.
So if you're trying to save HTML a simple fix is to go ahead and still set the formatOutput to
true and save as XML, but then strip the XML tag.
<?php
...
$document->formatOutput = true;
$output = $document->saveXML();
$output = str_replace('<?xml version="1.0"?>',null,$output);
echo $output;
?>
This will actually do you a favor if you want XHTML instead of HTML 4.01.
----
Server IP: 192.41.42.26
Probable Submitter: 24.35.53.237
----
Manual Page -- http://www.php.net/manual/en/class.domdocument.php
Edit -- https://master.php.net/note/edit/102343
Del: integrated -- https://master.php.net/note/delete/102343/integrated
Del: useless -- https://master.php.net/note/delete/102343/useless
Del: bad code -- https://master.php.net/note/delete/102343/bad+code
Del: spam -- https://master.php.net/note/delete/102343/spam
Del: non-english -- https://master.php.net/note/delete/102343/non-english
Del: in docs -- https://master.php.net/note/delete/102343/in+docs
Del: other reasons-- https://master.php.net/note/delete/102343
Reject -- https://master.php.net/note/reject/102343
Search -- https://master.php.net/manage/user-notes.php