note 86679 deleted from function.simplexml-element-addChild by danbrown
| From: | danbrown@php.net | Date: | Wed, 16 Sep 2009 16:37:58 +0000 |
| Subject: | note 86679 deleted from function.simplexml-element-addChild by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-160736@lists.php.net to get a copy of this message | ||
Note Submitter: davedx at gmail dot com
----
As noted by zspencer at zacharyspencer dot com, addChild with an empty string causes a redundant
node to be added. This was screwing up our web services xml->JSON conversion - the following hack
seems to fix it, use at your own risk...
<?php
if($sv == null)
{
$child = $node->addChild($k, '<blank>');
$child = '';
}
else
{
$node->addChild($k, $sv);
}
?>