wrest icon indicating copy to clipboard operation
wrest copied to clipboard

Namespaced XML not handled

Open apsoto opened this issue 14 years ago • 5 comments

For example, an xml file like this (sample rss)

<item>
  <title>Cool Video</title>
  <media:title>Cool Video</media:title>
</item>

node["title"]
#> ["Cool Video", "Cool Video"]

And there is no "media:title" key in the hash.

apsoto avatar Apr 06 '11 16:04 apsoto

didn't realize it was not just a plain text field, I'll re add with clearer description:

For example, an xml file like this (sample rss): <item> <title>Cool Video</title> <media:title>Cool Video</media:title> </item>

  node["title"]
  #> ["Cool Video", "Cool Video"]

And there is no "media:title" key in the hash.

apsoto avatar Apr 06 '11 16:04 apsoto

@achamian Could you take a look at this please?

kaiwren avatar Apr 06 '11 16:04 kaiwren

any new info on this?

apsoto avatar Apr 19 '11 17:04 apsoto

I was going through the code and realised that the problem is with the Hash#from_xml which ignores the Namespaces all together. I was talking to @kaiwren to figure out if we can provide a wrapper which bypasses Hash#from_xml and provide some other deserialiser.

Have you come across any library which wraps Nokogiri, libxml-ruby, REXML etc. and doesn't have this problem or want to collaborate on writing one?

achamian avatar Apr 19 '11 17:04 achamian

Yea, I traced it as well hoping it was a fix in wrest I could patch, but it was deep down in active support so I punted since I didn't have time to make changes to such a core lib at this time. From my little time spent diagnosing I think the correct fix is fixing it in active support instead of wrapping it. Unfortunately, this 'bug' hasn't been a blocker for me so I've moved on for the time being. I'll report back if I have time to work on fixing it, but not at the moment.

apsoto avatar Apr 19 '11 18:04 apsoto