note 116879 added to domelement.construct
| From: | RiKdnUA at mail dot ru | 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