XML_Serializer null attributes

From: Date: Mon, 06 Feb 2006 17:08:40 +0000
Subject: XML_Serializer null attributes
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-22825@lists.php.net to get a copy of this message
I wonder if I have missed a piece of config somewhere. Setting XML_SERIALIZER_OPTION_IGNORE_NULL => true has the desired effect on elements with null content, but returns a zero length string for a null attribute. Further, if all attributes for an element are null and all content is also null, I believe the element should not be displayed. Is this a bug ? Perhaps I have missed something? Test case: $InvoiceCurrency = array ('Currency' => array ( 'TagAttributes' => array( 'Code' => 'GBP', 'Codelist' => null ) , 'TagContent' => 'Pound Sterling' ) , 'AlternateCurrency' => array ( 'TagAttributes' => array( 'Code' => null , 'Codelist' => null ) , 'TagContent' => null ) ); produces the following XML: <InvoiceCurrency> <Currency Code="GBP" Codelist="">Pound Sterling</Currency> <AlternateCurrency Code="" Codelist=""/> </InvoiceCurrency> where perhaps the following might be preferable: <InvoiceCurrency> <Currency Code="GBP">Pound Sterling</Currency> </InvoiceCurrency>

« previous php.pear.general (#22825) next »