I’ve been working with the Basecamp API to plugin our IRC bot that we use for time tracking and I’m astounded to learn that escaping single and/or double quotes for XPath queries in PHP does not have a well documented, best practices solution.
In fact, it seems as though this is not peculiar to PHP. I took a look around and found this excellent article by “Kushal” (s/he doesn’t have his full name on his blog):
I’ve produced a PHP solution for the general escaping/concatenation problem:
Anyone got a better/more elegant solution? I’m always a big fan of code golf 🙂