Support custom xpath for happymapper items? #21

merged 1 commit into from Jun 14, 2013


None yet
2 participants

teleological commented Feb 16, 2012

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.

Support for explicit xpath option
Default xpath for non-root nodes matches all descendants. Sometimes,
you only want to match the immediate child. The ability to specify
xpath will cover this and other cases.

Confusion referenced this pull request in Confusion/happymapper Dec 4, 2012

jnunemaker added a commit that referenced this pull request Jun 14, 2013

Merge pull request #21 from teleological/master
Support custom xpath for happymapper items?

@jnunemaker jnunemaker merged commit 2e95642 into jnunemaker:master Jun 14, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment