jnunemaker/happymapper — pull request #21 by teleological (2012-02-16 19:36:18+00:00)
Title: Support custom xpath for happymapper items?

Thanks for happymapper! I put it to work parsing the Intrade API, but ran into an issue with an element named "msg" which included a member element that was also named "msg", but of a different type than the outer element. This pull request includes a solution to that issue, allowing users to override the default xpath-generation logic with an xpath literal. The problem with the Intrade API can be resolved by specifying option :xpath => './msg', which only includes direct children. I included fixtures with a sanitized example and specs which exercise the new option. I hope you find this useful.