I may or may not agree with you- but one could make the argument that xpath is likely heavily tested and proven, and will handle unexpected corner cases that arise in the future, which those 11 lines of ruby will not. In that case, using xpath lowers the amount of future headaches with that code.