lib/atom/text.rb in atom-tools-2.0.0 vs lib/atom/text.rb in atom-tools-2.0.1
- old
+ new
@@ -25,13 +25,23 @@
on_parse_root do |e,x|
type = e.type
if x.is_a? REXML::Element
if type == 'xhtml'
- x = x.elements['div']
+ x = e.get_elem x, XHTML::NS, 'div'
+
raise Atom::ParseError, 'xhtml content needs div wrapper' unless x
c = x.dup
+
+ unless x.prefix.empty?
+ # content has a namespace prefix, strip prefixes from it and all
+ # XHTML children
+
+ REXML::XPath.each(c, './/xhtml:*', 'xhtml' => XHTML::NS) do |x|
+ x.name = x.name
+ end
+ end
else
c = x[0] ? x[0].value : nil
end
else
c = x.to_s