6197 comments
2357 subscribers
Follow me on Twitter (@sachac)
Subscribe! Feed reader E-mail

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.

Short URL: http://sachachua.com/blog/p/7150

On This Day...

  • 2013: Impatient for spring — If you leave a little bit left when chopping green onions, you can grow new ones. The ones on the [...]
  • 2012: Visual metaphors: Change — Click on the image for a larger version. Change is a journey. Sometimes you have a map, or a guide, or [...]
  • 2011: Making better use of travel time — I’m going to be in the office a lot more as I help with proposals or coach new hours. Time [...]
  • 2010: Weekly review: Week ending April 18, 2010 — From last week’s plans: Work [-] Map team challenges to examples of groups doing well [-] Install software needed to create [...]
  • 2009: Managing virtual assistants: Imagining more possibilities — When it comes to finding people for my outsourcing team, I’m like a 5-year-old in Willy Wonka’s chocolate factory. There [...]
  • 2007: Steel-cut oats — I have officially graduated to steel-cut oats. It took me a long time to try it out, but now that I [...]
  • 2006: Finding a niche — Enterprise social bookmarking. That’s what I’m into. Plenty of interesting questions and opportunities. It’s not going to be my main [...]
  • 2006: Happy girl — Did lots of fun things at IBM. Being there more than once a week definitely changes the dynamic. Blogging becomes more [...]
  • 2006: Comfort food: SPAM — Here’s incongruity for you: jasmine rice and SPAM. Yes, rice is rice, but jasmine rice is soft and fluffy and sticky [...]
  • 2006: Meeting — Ack. I don’t think I’ll stick around for pub night. I’m _starving_, and I have really low energy right now [...]
  • 2005: Freenet appreciation day — I am ultra-grateful to Jijo Sevilla (jijo AT free.net.ph) for my mail and DNS. He’s ubercool. He says: You can help by [...]
  • 2005: Graphic Expo 2005 contests — The 4th Animation Competition The Annual Digital Art Competition The Digital Imaging Contest http://www.graphicexpo.com.ph On Technorati: contests
  • 2005: Subic — We went to Subic last weekend. It was tons of fun. =) I’m really glad I had an opportunity to spend [...]
  • 2004: New system — I should get around to making a new Courses submission system so that I’ll actually use it. Improvements: - Teachers can create [...]
  • 2004: Security comparison between Linux and Windows — https://www6.software.ibm.com/dl/library/library-r?S_PKG=dllibrary Registration required. Link from Dominique Cimafranca E-Mail from Dominique Cimafranca