note 86679 added to function.simplexml-element-addChild
| From: | davedx at gmail dot com | Date: | Wed, 29 Oct 2008 15:48:09 +0000 |
| Subject: | note 86679 added to function.simplexml-element-addChild | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-145930@lists.php.net to get a copy of this message | ||
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...
if($sv == null)
{
$child = $node->addChild($k, '<blank>');
$child = '';
}
else
{
$node->addChild($k, $sv);
}
----
Server IP: 64.71.164.2
Probable Submitter: 80.6.91.225
----
Manual Page -- http://www.php.net/manual/en/function.simplexml-element-addChild.php
Edit -- https://master.php.net/note/edit/86679
Del: integrated -- https://master.php.net/note/delete/86679/integrated
Del: useless -- https://master.php.net/note/delete/86679/useless
Del: bad code -- https://master.php.net/note/delete/86679/bad+code
Del: spam -- https://master.php.net/note/delete/86679/spam
Del: non-english -- https://master.php.net/note/delete/86679/non-english
Del: in docs -- https://master.php.net/note/delete/86679/in+docs
Del: other reasons-- https://master.php.net/note/delete/86679
Reject -- https://master.php.net/note/reject/86679
Search -- https://master.php.net/manage/user-notes.php