Inner_html = "" in hpricot

hey all

I'm using hpricot 0.8.1. I'm setting the contents of some tags using
the inner_html method, and if any of the values i set happen to be empty
strings, it blows up:

xml.search("/data/score/composer").inner_html = "foo"
=> "foo"
xml.search("/data/score/composer").inner_html = ""

/var/lib/gems/1.8/gems/hpricot-0.8.1/lib/hpricot/traverse.rb:198:in
`reparent': undefined method `parent=' for nil:NilClass (NoMethodError)
  from
/var/lib/gems/1.8/gems/hpricot-0.8.1/lib/hpricot/traverse.rb:198:in
`each'
  from
/var/lib/gems/1.8/gems/hpricot-0.8.1/lib/hpricot/traverse.rb:198:in
`reparent'
  from
/var/lib/gems/1.8/gems/hpricot-0.8.1/lib/hpricot/traverse.rb:177:in
`html'
  from
/var/lib/gems/1.8/gems/hpricot-0.8.1/lib/hpricot/traverse.rb:192:in
`inner_html='
  from
/var/lib/gems/1.8/gems/hpricot-0.8.1/lib/hpricot/elements.rb:96:in
`inner_html='
  from
/var/lib/gems/1.8/gems/hpricot-0.8.1/lib/hpricot/elements.rb:96:in
`each'
  from
/var/lib/gems/1.8/gems/hpricot-0.8.1/lib/hpricot/elements.rb:96:in
`inner_html='

Anyone know
  a) why this is happening and/or
  b) a way to set the contents of these tags that won't error on empty
strings?

thanks, max

···

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