note 108811 deleted from function.xmlwriter-end-element by cmb

From: Date: Sun, 20 Sep 2020 12:55:44 +0000
Subject: note 108811 deleted from function.xmlwriter-end-element by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-215147@lists.php.net to get a copy of this message
Note Submitter: contact at paulchaplin dot com ---- 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.

« previous php.notes (#215147) next »