It’s hardly, hardly news anymore when a search in Google unveils the answer to a technical problem. But every time it happens, I get a tickle. Still. Like a newbie searcher.

This borders on techno-trivia, but I’ve been working on some code that will allow us at NMC to create our own registration form to create accounts in Second Life, and then send the newbie avatars to our own Orientation island we are building (rather than the public place all other SL noobs land at– with the idea ours will be geared for educators). Linden Lab provides an API, some PHP code library, and some really meager code samples.

The first test failed miserably- my form cut off right after the first call to one of the library functions. So its time to troll the web server error logs, which reveal a problem. The API transactions are done back and forth in small XML bits, and this code makes use of the domxml package, an add on to PHP 4 that provides functions to easily deal with XML data. The problem is.. as I found, that it’s not a part of PHP5 which we run now, and that comes with a newer, better XML library built in (DOM). The recommendation:

If you are migrating from PHP 4 to PHP 5, the recommended best-practice is to port your domxml code to the much better DOM code.

So I started trying to understand the difference, and realized it might take way too long to tweak and test. So on a whim, I did a simple google on convert domxml to DOM php and ;anded rather nicely (not the top results) on Alexandre Alapetite’s library code for XML transition from PHP4 domxml to PHP5 dom which neatly provides a set of functions that intercept calls to the old code, and re-route them to the newer functions.

It worked like a charm. Plug and play,

It seems like not a big deal to find a tiny needle in a haystack the size of Texas, but it really is when you need something.

Profile Picture for Alan Levine aka CogDog
An early 90s builder of the web and blogging Alan Levine barks at CogDogBlog.com on web storytelling (#ds106 #4life), photography, bending WordPress, and serendipity in the infinite internet river. He thinks it's weird to write about himself in the third person.

Comments

  1. But Alapetite’s code was not tagged using the IMS standards, so it was just dumb luck you found it. And it wasn’t stored using the IMS content packaging spec, so you were fortunate to be able to read it. And are really sure it was what you wanted? Where was the peer review?

    If I were you, I would simply wait for the solution to appear in an approved repository. It’s time you clowns got serious, and stopped playing games.

Leave a Reply

Your email address will not be published. Required fields are marked *