NYCPHP Meetup

NYPHP.org

[nycphp-talk] (no subject) (SimpleXML)

David Sklar sklar at sklar.com
Wed Jan 21 09:47:51 EST 2004


Sterling wrote:
> Much of the current code in SimpleXML is due to immaturities in either
> Zend or the LibXML interface at the time I was writing SimpleXML.  I
> wanted to have cool things to show at conferences, plus other people
> wanted to see what was possible with simplexml, so features started
> to creep in. xsearch() and schema validation were the first added,
> then came other methods like hasChildren() and getChildren() (when a
> simple xpath query /child::node() can tell you this)
>
> Most of simplexml's methods are either redundant, or redundant based
> upon redundancy (hasChildren(), getChildren(), attributes(), count()).
> Each  of these methods are actually a very simple, very optimized
> xpath expression..."

Tim wrote:
> When I read this I sort of translated it in my mind to read: "Due to
> popular demand I allowed non-orthogonal features
> to creep into SimpleXML causing bloat and making it -- well not
> simple."

I think many of those features actually make SimpleXML *simpler* -- to the
non-xpath initiate, is $document->children() simpler or is
$document->xpath('/child::node()') simpler?

Xpath is swell, everyone using XML a lot should certainly learn Xpath, but
it's overkill for simple (there's that word again !:) operations. The
SimpleXML methods that handle common cases are useful just like having a
multiplication operator is useful -- sure, you could accomplish the same
thing with the addition operator, but it's a pain.

Agree? Disagree? Come congratulate/argue with me today at LinuxWorld!

David





More information about the talk mailing list