note 119774 deleted from class.domdocument by cmb

From: Date: Mon, 22 Aug 2016 15:41:53 +0000
Subject: note 119774 deleted from class.domdocument by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-206366@lists.php.net to get a copy of this message
Note Submitter: biker dot mike at gmx dot com ---- Look out for the following gotcha when loading XML from a string: <?php $doc = new \DOMDocument; $doc->documentURI = $myXmlFilename; $doc->loadXML($myXmlString); ?> documentURI is now set to the value of $myXmlString, right? Wrong! It's set to the current working directory. If you want to manually set documentURI to something other than the CWD, do so AFTER the call to loadXML(). E.g.: <?php $doc = new \DOMDocument; $doc->loadXML($myXmlString); $doc->documentURI = $myXmlFilename; ?> documentURI really is now set to the value of $myXmlString.

« previous php.notes (#206366) next »