Re: SimpleXML: Moving Forward
| From: | Adam Maccabee Trachtenberg | Date: | Tue, 13 Jan 2004 15:43:59 +0000 |
| Subject: | Re: SimpleXML: Moving Forward | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-7052@lists.php.net to get a copy of this message | ||
On Tue, 13 Jan 2004, Adam Trachtenberg wrote:
> Here are my thoughts on solutions:
>
> 1) Place all elements in an array (or nodeList) regardless whether
> there's 0, 1, or many. This is the DOM solution. This just leads to
> annoying code where you need to do $foo->item(0) and $foo->firstChild.
>
> However, I don't really see any way around this otherwise. Either it's
> general or not. It can't be both. (Unless there's some magical type
> that's both an array and a scalar.) I'm willing to put up with this
> headache because the klunkyness here is outweighted by the niceness for
> most cases.
To clarify, I prefer *NOT* to put everything in an array like DOM. The
headache I'm willing to put up with is the if(is_array()) code,
especially if it turns out to be feasable to do the XML Schema linkage
I suggested.
-adam
--
adam@trachtenberg.com
author of o'reilly's php cookbook
avoid the holiday rush, buy your copy today!