note 90676 added to domdocument.savexml
| From: | qjerry dot comatgmail dot com at osu1 dot php dot net | Date: | Mon, 04 May 2009 11:24:43 +0000 |
| Subject: | note 90676 added to domdocument.savexml | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-154177@lists.php.net to get a copy of this message | ||
The simpliest (and probably the fastest) way to strip an XML declaration (<?xml
version="1.0" ... ?>) out of output document, is to output child nodes of DOMDocument
separately:
<?php
$document = new DOMDocument();
$document->load('/some/file.xml');
// this will also output doctype and comments at top level
foreach($document->childNodes as $node)
$result .= $document->saveXML($node)."\n";
echo $result;
?>
This might be userful when dealing with browser compatibility issues, for example, well known
problem with valid XHTML in IE6.
----
Server IP: 78.41.104.4
Probable Submitter: 77.106.252.230
----
Manual Page -- http://www.php.net/manual/en/domdocument.savexml.php
Edit -- https://master.php.net/note/edit/90676
Del: integrated -- https://master.php.net/note/delete/90676/integrated
Del: useless -- https://master.php.net/note/delete/90676/useless
Del: bad code -- https://master.php.net/note/delete/90676/bad+code
Del: spam -- https://master.php.net/note/delete/90676/spam
Del: non-english -- https://master.php.net/note/delete/90676/non-english
Del: in docs -- https://master.php.net/note/delete/90676/in+docs
Del: other reasons-- https://master.php.net/note/delete/90676
Reject -- https://master.php.net/note/reject/90676
Search -- https://master.php.net/manage/user-notes.php