note 46440 deleted from function.dom-domdocument-load by didou
| From: | didou@php.net | Date: | Tue, 04 Jan 2005 10:16:15 +0000 |
| Subject: | note 46440 deleted from function.dom-domdocument-load by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-82679@lists.php.net to get a copy of this message | ||
Note Submitter: gem at rellim dot com
----
Here is a better example that tells WHY load() failed.
<?php
# next 2 lines make sure load() error message is in $php_errormsg
ini_set( 'track_errors', 1);
ini_set('error_reporting', E_ALL | E_STRICT);
$doc = new DOMDocument();
$ret = $doc->load("filename");
if ($ret) {
print $doc->saveXML();
} else {
print "Error loading file: " . $php_errormsg;
}
?>
There are also cases where load() will succeed, but strip things from the xml. For example, named
entities may be stripped, a log warning entry made and load() will still return true.