I LOVE XPATH!

image

I just can't say how happy I am with XPath. It's such a phenomenal tool for working with XML. Now that it's integrated in everything from XSL through JDOM to XOM, you can use it whenever you need to grab bits of data out of your XML document, without having to loop and search and all that crud. It's just insanely useful.

For example, I was just trying to grok the massive WURFL XML document which lists every phone you can think of and the capabilities in a big hierarchy. It's pretty enormous and uses IDs as references so I couldn't get a good handle on what I was looking at. So I thought, "Ooh. This would a great time to mess with Lantern..." which is this Java-based interactive XPath expression tester that will let you mess with your XPath queries live. I had downloaded it the other day, but hadn't had a chance to play yet.

Lantern's a classic SWING app in that the UI is slow as death, but the queries run quick and are *really* quite informative. I especially liked the Tester which would return results instead highlighting - it was very comfortable, like an ISQL session which is how I learned SQL a decade ago. As I was playing, I started wanting to do things I hadn't done before using XPath, so I went back to the W3Schools XPath page and did a quick review. Very cool.

Anyways, weird thing about the current WURFL file. The one thing I wanted was the browser capabilities for each handset, and that stuff seems to be commented out! Weird... I guess I'm back to RegExing for well known User-Agents. No biggie.

-Russ

< Previous         Next >