Thursday, December 16, 2010

[Rails] XML behaviour issue

I am trying to parse both rss feed and atom feed using Nokogiri. I'm
meeting a problem where i cannot use one query to universally select
both rss element and atom element.

E.g.

@item = "item"
root.xpath(//#{@item}) will select for rss
@item = "entry"
root.xpath(//#{@item}) will not select for rss

Even though the entry tag has no explicit namespace attached to it. I
understand this is an implicit namespace issue which is in the xml
specifications. However, I am wondering if there's a way to circumvent
this issue to allow nokogiri to somehow modify the document so that the
xpath on implicitly namespaced element would work without a namespace.
Thanks!

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate