note 103498 modified in function.xmlwriter-write-attribute by danbrown

From: Date: Fri, 15 Apr 2011 20:38:41 +0000
Subject: note 103498 modified in function.xmlwriter-write-attribute by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-178903@lists.php.net to get a copy of this message
If you intermix writing sub-elements and attributes, any attributes that are written after the first sub-element are ignored/discarded: <?php $xml->startElement('element'); $xml->writeAttribute('attr1', 0); $xml->writeElement('subelem', 0); $xml->writeAttribute('attr2', 0); $xml->endElement(); ?> Outputs: <element attr1=0> <subelem>0</subelem> </element> This is stupid, but the way it works as of PHP 5.2.4. --was-- If you intermix writing sub-elements and attributes, any attributes that are written after the first sub-element are ignored/discarded: $xml->startElement('element'); $xml->writeAttribute('attr1', 0); $xml->writeElement('subelem', 0); $xml->writeAttribute('attr2', 0); $xml->endElement(); Outputs: <element attr1=0> <subelem>0</subelem> </element> This is stupid, but the way it works as of PHP 5.2.4. http://php.net/manual/en/function.xmlwriter-write-attribute.php

« previous php.notes (#178903) next »