note 119774 added to class.domdocument

From: Date: Mon, 22 Aug 2016 13:04:25 +0000
Subject: note 119774 added to class.domdocument
Groups: php.notes 
Request: Send a blank email to php-notes+get-206364@lists.php.net to get a copy of this message
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. ---- Server IP: 91.199.167.223 Probable Submitter: 86.190.139.157 ---- Manual Page -- http://php.net/manual/en/class.domdocument.php Edit -- https://master.php.net/note/edit/119774 Del: integrated -- https://master.php.net/note/delete/119774/integrated Del: useless -- https://master.php.net/note/delete/119774/useless Del: bad code -- https://master.php.net/note/delete/119774/bad+code Del: spam -- https://master.php.net/note/delete/119774/spam Del: non-english -- https://master.php.net/note/delete/119774/non-english Del: in docs -- https://master.php.net/note/delete/119774/in+docs Del: other reasons-- https://master.php.net/note/delete/119774 Reject -- https://master.php.net/note/reject/119774 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#206364) next »