Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:11834 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15339 invoked by uid 1010); 2 Aug 2004 21:40:27 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 15294 invoked from network); 2 Aug 2004 21:40:27 -0000 Received: from unknown (HELO home.sklar.com) (24.199.89.111) by pb1.pair.com with SMTP; 2 Aug 2004 21:40:27 -0000 Received: from [127.0.0.1] ([127.0.0.1]) by home.sklar.com with Microsoft SMTPSVC(6.0.2600.1106); Mon, 2 Aug 2004 17:40:27 -0400 Message-ID: <410EB4CB.7020908@sklar.com> Date: Mon, 02 Aug 2004 17:40:27 -0400 User-Agent: Mozilla Thunderbird 0.7.1 (Windows/20040626) X-Accept-Language: en-us, en MIME-Version: 1.0 CC: internals@lists.php.net References: <410EA9DD.6060003@sklar.com> <24e5f3b704080213583849fc6a@mail.gmail.com> In-Reply-To: <24e5f3b704080213583849fc6a@mail.gmail.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 02 Aug 2004 21:40:27.0915 (UTC) FILETIME=[539B75B0:01C478D9] Subject: Re: [PHP-DEV] SimpleXML returning attributes as objects instead of strings From: sklar@sklar.com (David Sklar) Ahh. Thanks. David Sterling Hughes wrote: > iterators... > > On Mon, 02 Aug 2004 16:53:49 -0400, David Sklar wrote: > >>SimpleXML returns attribute values as SimpleXMLElement objects instead >>of strings. E.g, given this: >> >>$sxe = simplexml_load_string('Doc >>Ock'); >> >>$sxe['arms'] and $sxe['legs'] are SimpleXMLElement objects. >> >>This mostly works OK, but causes problems when using empty() to test if >>an attribute has a value. empty($sxe['arms']) is false, but so is >>empty($sxe['legs']). >> >>An easy workaround is to use strlen() instead of empty(), I suppose >>(except if an attribute value is "0"), but I am wondering why SimpleXML >>works this way. >> >>Thanks, >>David