note 116879 added to domelement.construct

From: Date: Sat, 14 Mar 2015 23:26:19 +0000
Subject: note 116879 added to domelement.construct
Groups: php.notes 
Request: Send a blank email to php-notes+get-201942@lists.php.net to get a copy of this message
В русской версии описания DOMElement::__construct() ошибка. Должно быть: ...Этот объект доступен только для чтения. Он может быть добавлен в документ, но в него нельзя добавить дочерние узлы пока данный узел НЕ связан с документом... В английской версии описания все правильно: ...This object is read only. It may be appended to a document, but additional nodes may not be appended to this node until the node is associated with a document... <?php error_reporting(-1); $dom = new DOMDocument('1.0', 'iso-8859-1'); $element = $dom->appendChild(new DOMElement('root')); $element_ns = new DOMElement('pr:node1', 'thisvalue', 'http://xyz'); $element->appendChild($element_ns); $second=new DOMElement('second'); //$second->appendChild(new domText('secondText'));//Fatal error: Uncaught exception 'DOMException' with message 'No Modification Allowed Error' $element_ns->appendChild($second); $second->appendChild(new domText('secondText'));//Okay. Not error $dom->formatOutput=true; echo "Bytes recorded: ".$dom->save('file.xml'); ?> ---- Server IP: 193.19.243.212 Probable Submitter: 193.19.243.212 (proxied: 178.216.123.184) ---- Manual Page -- http://php.net/manual/en/domelement.construct.php Edit -- https://master.php.net/note/edit/116879 Del: integrated -- https://master.php.net/note/delete/116879/integrated Del: useless -- https://master.php.net/note/delete/116879/useless Del: bad code -- https://master.php.net/note/delete/116879/bad+code Del: spam -- https://master.php.net/note/delete/116879/spam Del: non-english -- https://master.php.net/note/delete/116879/non-english Del: in docs -- https://master.php.net/note/delete/116879/in+docs Del: other reasons-- https://master.php.net/note/delete/116879 Reject -- https://master.php.net/note/reject/116879 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#201942) next »