note 83673 added to ref.xmlwriter

From: Date: Fri, 06 Jun 2008 21:17:09 +0000
Subject: note 83673 added to ref.xmlwriter
Groups: php.notes 
Request: Send a blank email to php-notes+get-140193@lists.php.net to get a copy of this message
Missing attributes?? <?php header("Content-type: text/xml"); $xml = new XMLWriter(); $xml->startElement('test'); $xml->startElement('with-two-attr'); $xml->writeAttribute('exists', 'true'); $xml->writeAttribute('and', 'another'); $xml->writeElement('fine', 'no problem here :)'); $xml->endElement(); $xml->startElement('with-one-attr'); $xml->writeAttribute('exists', 'true'); $xml->writeElement('error', 'problem is here :('); $xml->writeAttribute('and', 'another'); $xml->endElement(); $xml->endElement(); echo $xml->outputMemory(true); ?> This code gives the result: <test> <with-two-attr exists="true" and="another"> <fine>no problem here :)</fine> </with-two-attr> <with-one-attr exists="true"> <error>problem is here :(</error> </with-one-attr> </test> What we can see is that second attribute of 'with-one-attr' is missing. This always happens when you want to add attributes after inserting some data(element/text) into element. ---- Server IP: 69.147.83.197 Probable Submitter: 78.8.7.86 ---- Manual Page -- http://www.php.net/manual/en/ref.xmlwriter.php Edit -- https://master.php.net/note/edit/83673 Del: integrated -- https://master.php.net/note/delete/83673/integrated Del: useless -- https://master.php.net/note/delete/83673/useless Del: bad code -- https://master.php.net/note/delete/83673/bad+code Del: spam -- https://master.php.net/note/delete/83673/spam Del: non-english -- https://master.php.net/note/delete/83673/non-english Del: in docs -- https://master.php.net/note/delete/83673/in+docs Del: other reasons-- https://master.php.net/note/delete/83673 Reject -- https://master.php.net/note/reject/83673 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#140193) next »