note 108811 added to function.xmlwriter-end-element
| From: | contact at paulchaplin dot com | Date: | Sat, 26 May 2012 00:32:27 +0000 |
| Subject: | note 108811 added to function.xmlwriter-end-element | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188248@lists.php.net to get a copy of this message | ||
Note that elements opened this way will *remain open* (i.e. the XML will be badly formed and thus
invalid) unless *each element* is explicitly closed with XMLWriter::endElement.
If you have multiple elements open, and wish to simply close them all -- including the root element
-- this snippet is what you want:
<?php
// Automatically close all remaining open elements.
while ($xml->endElement() !== false) { continue; }
?>
In some cases, XMLWriter::writeElement might serve you better: it writes complete elements, but
isn't suitable when you need to loop to generate its contents, unless this is done beforehand.
----
Server IP: 94.76.225.145
Probable Submitter: 86.3.147.192
----
Manual Page -- http://www.php.net/manual/en/function.xmlwriter-end-element.php
Edit -- https://master.php.net/note/edit/108811
Del: integrated -- https://master.php.net/note/delete/108811/integrated
Del: useless -- https://master.php.net/note/delete/108811/useless
Del: bad code -- https://master.php.net/note/delete/108811/bad+code
Del: spam -- https://master.php.net/note/delete/108811/spam
Del: non-english -- https://master.php.net/note/delete/108811/non-english
Del: in docs -- https://master.php.net/note/delete/108811/in+docs
Del: other reasons-- https://master.php.net/note/delete/108811
Reject -- https://master.php.net/note/reject/108811
Search -- https://master.php.net/manage/user-notes.php