From: why the lucky stiff Date: 2006-08-23T08:08:39+09:00 Subject: Re: (RE)XML question On Wed, Aug 23, 2006 at 07:15:09AM +0900, rubyhacker@gmail.com wrote: > Input: > > > >

Hi, there.

> some more text >

That's all.

> > > > Output: > > >

Hi, there.

>

I found a foo tag enclosing 'some more text' with > bar and bam values of 'this' and 'that'...

>

That's all.

> > So, in Hpricot: doc = Hpricot("...") doc.search("foo").each do |ele| new_ele = Hpricot \ '

I found a ' + ele.name + " tag enclosing \'" + ele.inner_html + "' with " + ele.attributes.keys.join(' and ') + " values of " + ele.attributes.values.map { |x| "'#{x}'" }.join(' and ') + "...

" ele.parent.replace_child(ele, new_ele.children.first) end puts doc REXML has a replace_child as well. But now you've motivated me to add Element#replace. _why