SimpleXML and Xpath problems solved

I’ve been working on a tool that looks for a list of people with a given tag and displays their names, titles, locations, e-mail addresses, and other tags. It’ll be useful for reviewing our list of experts. I didn’t want to hammer the Lotus Connections server with too many requests, though, so I added some delays between requests. I should also cache the results.

I was using PHP’s SimpleXML library to parse the search results, but my XPath queries didn’t return anything. It turns out that you need to str_replace(‘xmlns=’, ‘ns=’, …) before you parse it with SimpleXML. That solved the problem.

Also, the tagcloud document didn’t get parsed at all. I had to replace the app:categories tag with atom:feed and remove the atom: namespace to get everything to work.

On the bright side, I figured out how to interact with long-running PHP processes! I used Sqlite to store the requests and updates, then I used at to run the PHP process. Next step: Cache results, rig up a temporary file directory, and tidy up the interface. The batch process code is another useful building block that will help me write other programs.

  • Greg

    did the trick. Thanks!!