From: Benoit Cerrina Date: 2001-11-19T00:08:36+09:00 Subject: [ruby-talk:25758] Re: REXML inserting an element Thanks for the answer, I had scanned too fast the documentation and missed the Parent inheritence... "Sean Russell" wrote in message news:3bf1be83_2@spamkiller.newsgroups.com... > Ben Schumacher wrote: > > > Here is are some examples of how to do inserts. > ... > > These are documented here: > > http://www.germane-software.com/~ser/software/rexml/tutorial.html > > BTW, I've always thought the way REXML does inserts now was rather tedious. > Any suggestions on better ways of doing this? How about: > > c_element = Element.new("c") > doc.elements["a/b[position()=1]"].insert_after_me( c_element ) > > or perhaps > > ... > b_element.next_sibling = c_element > > I'm partial to the last. Vote now or forever hold your peace. :-) I like it too. Benoit > > -- > --- SER