inner_html = "" in hpricot

M

Max Williams

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,967
Messages
2,570,148
Members
46,694
Latest member
LetaCadwal

Latest Threads

Top